Skip to content

Commit

Permalink
Woo! Now go support!
Browse files Browse the repository at this point in the history
  • Loading branch information
martyf committed Jun 14, 2023
0 parents commit c526bcc
Show file tree
Hide file tree
Showing 22 changed files with 1,288 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.idea
.DS_Store
/node_modules
/resources/dist/hot
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Supportamic

<!-- statamic:hide -->

![Statamic 4.0+](https://img.shields.io/badge/Statamic-4.0+-FF269E?style=for-the-badge&link=https://statamic.com)
[![Supportamic on Packagist](https://img.shields.io/packagist/v/mitydigital/supportamic?style=for-the-badge)](https://packagist.org/packages/mitydigital/supportamic/stats)

---

<!-- /statamic:hide -->

> Supportamic is an very opinionated support add-on for Statamic 4 including HubSpot chat support and a Dashboard Widget.
## Configuration

You will need to have some `.env` variables added to take full advantage of what the addon can do.

Make sure you have these set and ready to go:

```dotenv
SUPPORTAMIC_CHAT=hubspot
SUPPORTAMIC_CHAT_ENDPOINT=
SUPPORTAMIC_EMAIL=
SUPPORTAMIC_WEBSITE=
SUPPORTAMIC_WIDGET_SHOW_GUIDE=true
```

### Advanced configuration

The Chat component of this add-on uses identification based on the logged in Statamic user. If you need to make changes
beyond what the default configuration is doing, don't forget to publish the config file:

```shell
php artisan vendor:publish --tag=supportamic-config
```

For most sites, this won't be necessary.

## Chat

Supportamic is configured to work with one chat engine, HubSpot's chat (conversations) widget.

`SUPPORTAMIC_CHAT` should be "hubspot" - anything else will throw a wobbly.

`SUPPORTAMIC_CHAT_ENDPOINT` is the endpoint URL provided by HubSpot for embedding your chat widget to your page.

### Chat Identification

By default, Supportamic will try to get the logged in user's Name and Email Address and pass these to the chat widget
for a smoother UX for users.

These are set to look for the `email` and `name` fields of the User, and most likely won't need to change.

If you have a custom User Blueprint, you can override these in the `config/supportamic.php` config file.

## Widget

The Dashboard Widget can be added to your site by adding `supportamic` to your `config/statamic/cp.php` widgets configuration:

```php
'widgets' => [

// ...

'supportamic',

// ...

],
```

There are two key sections - Admin Guide and Support.

### Admin Guide
The Admin Guide allows you to have a link to your site's support documentation. This is pulled from Statamic's
`STATAMIC_SUPPORT_URL` environment variable (`statamic.cp.support_url`).

Setting `SUPPORTAMIC_WIDGET_SHOW_GUIDE` to `false` will always hide the Admin Guide section, even when the URL is set.

Keeping `SUPPORTAMIC_WIDGET_SHOW_GUIDE` as `true` will show the Admin Guide section when the Support URL is not
Statamic's URL.

### Support: Start a conversation

If you have Chat correctly configured, the "Start a Conversation" button will appear.

When loaded, this will be disabled, but will be enabled when the Chat widget is ready.

### Support: Email support

Set `SUPPORTAMIC_EMAIL` to a valid email address to enable the "Email Support" option.

This will create a button with a `mailto:` link.

### Support: Visit support website

Set `SUPPORTAMIC_WEBSITE` to a valid website to enable the "Visit support website" option.

This will open in a new window.

## Add-on Support

We've made this for our projects really... some may find it useful, but it's not something we're looking to support
beyond what is useful for our projects too.

But hey, you could always ask - you may have a brilliant idea that we'd love to implement and use too. Say hello.

## Credits

- [Marty Friedel](https://github.com/martyf)

## License

This addon is licensed under the MIT license.
35 changes: 35 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "mitydigital/supportamic",
"description": "Adds Mity Digital's support features to Statamic.",
"type": "statamic-addon",
"keywords": [
"statamic",
"support"
],
"autoload": {
"psr-4": {
"MityDigital\\Supportamic\\": "src"
}
},
"license": "MIT",
"authors": [
{
"name": "Marty Friedel"
}
],
"require": {
"php": "^8.1",
"statamic/cms": "^4.0"
},
"extra": {
"statamic": {
"name": "Supportamic",
"description": "Adds Mity Digital's support features to Statamic."
},
"laravel": {
"providers": [
"MityDigital\\Supportamic\\ServiceProvider"
]
}
}
}
58 changes: 58 additions & 0 deletions config/supportamic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| Chat Settings
|--------------------------------------------------------------------------
|
| Chitty chitty chat chat. Let's all chat.
|
| Available types: hubspot
| Set to "null" to just ingore all other chat-type setup and config.
|
| Endpoint is required for "hubspot"
|
| Identity allows you to map User blueprint field handles (the values) to key email and name
| properties to pre-set identity within the chat widget. If the type supports it.
|
*/
'chat' => [
'type' => env('SUPPORTAMIC_CHAT', null),

'endpoint' => env('SUPPORTAMIC_CHAT_ENDPOINT', null),

'identity' => [
'email' => 'email',
'name' => 'name'
]
],


/*
|--------------------------------------------------------------------------
| Widget Settings
|--------------------------------------------------------------------------
|
| Not all sites have a docs guide - and this is governed by Statamic's STATAMIC_LINK_TO_DOCS
| configuration option in your .env file (if you use it). If you have this set, and want to
| include the "guide" section, make sure SUPPORTAMIC_WIDGET_SHOW_GUIDE is true.
|
| The section will be hidden when false, or if your STATAMIC_SUPPORT_URL starts with "https://statamic.com".
|
| The contact options will appear/disappear automatically based on your configuration.
|
| Chat will be shown if chat is configured above.
| Email will be shown when SUPPORTAMIC_EMAIL is set
| Website will be shown when SUPPORTAMIC_WEBSITE is set
|
*/
'widget' => [
'email' => env('SUPPORTAMIC_EMAIL', null),

'show_guide' => env('SUPPORTAMIC_WIDGET_SHOW_GUIDE', false),

'website' => env('SUPPORTAMIC_WEBSITE', null),
]
];
Loading

0 comments on commit c526bcc

Please sign in to comment.