Skip to content

Commit

Permalink
Merge branch 'release-2.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jimstrike committed Jun 16, 2024
2 parents 451ae7f + 5bd5d68 commit df7647e
Show file tree
Hide file tree
Showing 22 changed files with 766 additions and 338 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Release Notes for "Intercom Messenger" plugin

## 2.1.0 - 2024-06-16

### Added

- Added new configuration settings.

### Changed

- Updated plugin for Craft 5.
- Removed broken links.

## 2.0.0 - 2022-06-22

### Changed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Intercom Messenger plugin for Craft CMS 4.x
# Intercom Messenger plugin for Craft CMS 4.x|5.x

This is Intercom: the Business Messenger you and your customers will love

Expand All @@ -13,7 +13,7 @@ For more information visit: [Intercom.com](https://www.intercom.com/).

## Requirements

This plugin requires Craft CMS 4.0.0 or later.
This plugin requires Craft CMS 4.0.0|5.0.0 or later.

You will need an Intercom [trial](https://www.intercom.com/pricing) or [subscription](https://www.intercom.com/pricing) in order to use this plugin. Or you can create a free [developer account](https://app.intercom.com/a/developer-signup) to build and test Intercom Messenger in development environment before signing up for a subcription.

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jimstrike/craft-intercom-messenger",
"description": "Intercom Messenger",
"type": "craft-plugin",
"version": "2.0.0",
"version": "2.1.0",
"keywords": [
"craft",
"cms",
Expand Down Expand Up @@ -33,7 +33,7 @@
],
"require": {
"php": "^8.0.2",
"craftcms/cms": "^4.0.0"
"craftcms/cms": "^4.0.0|^5.0.0"
},
"autoload": {
"psr-4": {
Expand All @@ -48,4 +48,4 @@
"changelogUrl": "https://github.com/jimstrike/craft-intercom-messenger/blob/main/CHANGELOG.md",
"documentationUrl": "https://github.com/jimstrike/craft-intercom-messenger/blob/main/README.md"
}
}
}
4 changes: 2 additions & 2 deletions src/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand Down Expand Up @@ -52,7 +52,7 @@ class Plugin extends \craft\base\Plugin
* @inheritdoc
* @var string
*/
public string $schemaVersion = '2.0.0';
public string $schemaVersion = '2.1.0';

/**
* @inheritdoc
Expand Down
45 changes: 43 additions & 2 deletions src/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand Down Expand Up @@ -172,6 +172,33 @@
*/
'verticalPadding' => 20,

/**
* Action color
*
* Used in button links and more to highlight and emphasise. Default color is: #8f00b3
*
* @var string
*/
'actionColor' => '#8f00b3',

/**
* Background color
*
* Used behind your team profile and other attributes. Default color is: #8f00b3
*
* @var string
*/
'backgroundColor' => '#8f00b3',

/**
* Use your own theme color?
*
* Allows you to overwrite Intercom's color settings and set your own "Action color" and "Background color" above.
*
* @var bool
*/
'useOwnThemeColor' => false,

/**
* Show standard launcher only when a user scrolls to the bottom of the page?
*
Expand Down Expand Up @@ -209,6 +236,20 @@
* @var bool
*/
'hideDefaultLauncher' => false,

/**
* API regional location
*
* If you are using a data center hosted in one of the regional locations listed below, you will need to choose the associated API base.
* Select the default value if in doubt or preview and test before enabling the plugin.
*
* Available options are: 'default', 'us', 'eu', 'au'.
*
* A null or empty value will trigger 'default' option.
*
* @var string
*/
'apiRegionalLocation' => 'default'
];

//** Multi-site settings */
Expand Down Expand Up @@ -240,4 +281,4 @@
(2) => [
'enabled' => false,
],
]; */
]; */
2 changes: 1 addition & 1 deletion src/controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/PreviewController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/SettingsController.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand Down
2 changes: 1 addition & 1 deletion src/elements/FakeUser.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand Down
9 changes: 5 additions & 4 deletions src/etc/help.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand All @@ -15,12 +15,13 @@
'homepage' => 'https://www.intercom.com/',
'help_center' => 'https://www.intercom.com/help',
'messenger' => 'https://www.intercom.com/help/en/collections/2094767-the-intercom-messenger',
'customize_basics' => 'https://www.intercom.com/help/en/articles/178-customize-the-intercom-messenger-basics',
'find_app_id' => 'https://www.intercom.com/help/en/articles/3539-where-can-i-find-my-workspace-id-app-id',
'customize_basics' => 'https://www.intercom.com/help/en/articles/6612589-set-up-and-customize-the-messenger',
// 'find_app_id' => 'https://www.intercom.com/help/en/articles/3539-where-can-i-find-my-workspace-id-app-id',
'trusted_domains' => 'https://www.intercom.com/help/en/articles/4418-list-trusted-domains-you-use-with-intercom',
'identity_verification' => 'https://www.intercom.com/help/en/articles/183-enable-identity-verification-for-web-and-mobile',
'disable_standard_launcher' => 'https://www.intercom.com/help/en/articles/189-turn-off-show-or-hide-the-intercom-messenger',
'signup' => 'https://www.intercom.com/pricing',
'developer_signup' => 'https://app.intercom.com/a/developer-signup',
'developers' => 'https://developers.intercom.com/',
];
'logged_in_url_pattern' => 'https://app.intercom.com/a/apps/{YOUR-WORKSPACE-ID}/home',
];
34 changes: 32 additions & 2 deletions src/helpers/PluginHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Intercom Messenger plugin for Craft CMS 4.x
* Intercom Messenger plugin for Craft CMS 4.x|5.x
*
* Intercom.com: the Business Messenger you and your customers will love.
* Sure, it does live chat. But there’s also bots, apps, product tours, and more
Expand Down Expand Up @@ -68,4 +68,34 @@ public static function minify($str): string

return $str;
}
}

/**
* Sanitize a hex color value
*
* @param string $color
* @param bool $hash default
*
* @return string
*/
public static function color(string $color, bool $hash = true): string
{
$color = \str_replace('#', '', trim($color));

// If the string is 6 characters long then use it in pairs.
if (3 == \strlen($color)) {
$color = \substr($color, 0, 1) . \substr($color, 0, 1) . \substr($color, 1, 1) . \substr($color, 1, 1) . \substr($color, 2, 1) . \substr($color, 2, 1);
}

$substr = [];

for ($i = 0; $i <= 5; $i++) {
$default = 0 == $i ? 'F' : $substr[$i-1];
$substr[$i] = \substr($color, $i, 1);
$substr[$i] = false === $substr[$i] || !\ctype_xdigit($substr[$i]) ? $default : $substr[$i];
}

$hex = \implode('', $substr);

return !$hash ? $hex : '#' . $hex;
}
}
Loading

0 comments on commit df7647e

Please sign in to comment.