Getchat.me onboarding tour library that works with their autochats
gettour.on(eventName, callback);
gettour.off(eventName, callback);
gettour.dispatch('myEvent', { payloadParam1: 'payloadParam1Value' })
opened:on-click
- On widget expand event while user click on iconopened:auto
- On automatic widget expand eventclosed:on-click
- On hide by clicking "X" icon eventclosed:auto
- On automatic widget hide eventchat-event:ga
- Chatbot Google analytics event triggered
CSS Files:
dist
css
styles.css
styles.min.css
lib
index.js // Compiled module entrypoint
gettour.js // Same as lib/index.js
gettour.min.js // minified version of gettour.js
src
* // Source files are here
- Webpack 4 based.
- ES6 as a source.
- Exports in a umd format so your library works everywhere.
- ES6 test setup with Mocha and Chai.
- Linting with ESLint.
ES6 source files
|
|
webpack
|
+--- babel, eslint
|
ready to use
library
in umd format
Have in mind that you have to build your library before publishing. The files under the lib
folder are the ones that should be distributed.
- Setting up the name of your library
- Open
webpack.config.js
file and change the value oflibraryName
variable. - Open
package.json
file and change the value ofmain
property so it matches the name of your library.
- Build your library
- Run
yarn install
(recommended) ornpm install
to get the project's dependencies - Run
yarn build
ornpm run build
to produce minified version of your library.
- Development mode
- Having all the dependencies installed run
yarn dev
ornpm run dev
. This command will generate an non-minified version of your library and will run a watcher so you get the compilation on file change.
- Running the tests
- Run
yarn test
ornpm run test
yarn build
ornpm run build
- produces production version of your library under thelib
folderyarn dev
ornpm run dev
- produces development version of your library and runs a watcheryarn test
ornpm run test
- well ... it runs the tests :)yarn test:watch
ornpm run test:watch
- same as above but in a watch mode
An example of using dependencies that shouldn’t be resolved by webpack, but should become dependencies of the resulting bundle
In the following example we are excluding React and Lodash:
{
devtool: 'source-map',
output: {
path: '...',
libraryTarget: 'umd',
library: '...'
},
entry: '...',
...
externals: {
react: 'react'
// Use more complicated mapping for lodash.
// We need to access it differently depending
// on the environment.
lodash: {
commonjs: 'lodash',
commonjs2: 'lodash',
amd: '_',
root: '_'
}
}
}