Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vtex/angular-intercom
Intercom wrapper for Angular
https://github.com/vtex/angular-intercom
srv-oms-ui xp-post-purchase
Last synced: about 1 month ago
JSON representation
Intercom wrapper for Angular
- Host: GitHub
- URL: https://github.com/vtex/angular-intercom
- Owner: vtex
- Created: 2015-07-09T16:53:04.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-10T18:39:25.000Z (over 9 years ago)
- Last Synced: 2024-04-14T22:51:51.954Z (9 months ago)
- Topics: srv-oms-ui, xp-post-purchase
- Language: JavaScript
- Size: 121 KB
- Stars: 2
- Watchers: 194
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Angular Intercom
Intercom wrapper for Angular## Usage
### Reference script
```html```
### Inject `vtex.intercom`
```coffeescript
angular.module 'yourApp', ['vtex.intercom']
```### Fill `intercomConfig`
This object should contain at least your Intercom application credentials (`app_id`) and main user data, such as name, email, age, etc.```coffeescript
.config (intercomConfig) ->
intercomConfig.app_id = 'bs8us8hw'
intercomConfig.user = window.vtex.topbar.utils.user # `Object`# e.g.: Custom widget/button that pops Intercom conversation modal:
# intercomConfig.widget =
# activator: '#vtex-intercom-widget'
# See Intercom docs for more
```##### Send all user data you want by extending `intercomUserData` as well
This is mainly for extra user data, such as environment of access and all other info your `user` object lacks. Feel free to send whatever back to your Intercom.```coffeescript
.value 'intercomUserData',
'Store': vtex.topbar.utils.config.store
'Environment': vtex.topbar.topbar.environment.match(/beta|stable/)[0] ? 'stable'
```### Directive and binding
Defaults and shortcuts:
- `intercom-event`: Event name, be creative. ( `String` )
- `intercom-on`: "click" ( *this is what fires events to Intercom*, e.g.: "hover", "mouseleave" )
- `intercom-metadata`: Whatever extra info to send alongExample:
```html```
### API `intercomService`
#### trigger eventName, data
- string `eventName`, Object `data` with any information you want to be registered within the event#### updateUser data
- Object `data` with new (full or partial) user data to be updated and send### Development
Inside `src` you can find this module source code, written in **CoffeeScript**. To build the `.js` and uglify it, install npm dev-dependencies and run grunt:(sudo) npm i
grunt**Don't forget to build after updating the version and before committing any changes, since it's version appears in minified files.**