@hellotext/hellotext 2.5.7 → 2.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/README.md +0 -25
  2. package/dist/hellotext.js +1 -1
  3. package/index.d.ts +0 -6
  4. package/lib/api/acks.cjs +17 -31
  5. package/lib/api/acks.js +17 -42
  6. package/lib/api/businesses.cjs +14 -28
  7. package/lib/api/businesses.js +13 -36
  8. package/lib/api/events.cjs +26 -40
  9. package/lib/api/events.js +28 -52
  10. package/lib/api/forms.cjs +24 -40
  11. package/lib/api/forms.js +24 -57
  12. package/lib/api/identifications.cjs +15 -29
  13. package/lib/api/identifications.js +15 -40
  14. package/lib/api/index.cjs +25 -51
  15. package/lib/api/index.js +27 -54
  16. package/lib/api/push/identities.cjs +30 -46
  17. package/lib/api/push/identities.js +30 -63
  18. package/lib/api/response.cjs +30 -52
  19. package/lib/api/response.js +31 -60
  20. package/lib/api/submissions.cjs +18 -34
  21. package/lib/api/submissions.js +18 -48
  22. package/lib/api/webchat/messages.cjs +44 -64
  23. package/lib/api/webchat/messages.js +44 -80
  24. package/lib/api/webchats.cjs +37 -56
  25. package/lib/api/webchats.js +37 -65
  26. package/lib/api/whatsapp_widgets.cjs +49 -72
  27. package/lib/api/whatsapp_widgets.js +48 -91
  28. package/lib/builders/input_builder.cjs +36 -48
  29. package/lib/builders/input_builder.js +36 -48
  30. package/lib/builders/logo_builder.cjs +10 -29
  31. package/lib/builders/logo_builder.js +20 -28
  32. package/lib/channels/application_channel.cjs +136 -178
  33. package/lib/channels/application_channel.js +137 -180
  34. package/lib/channels/webchat_channel.cjs +125 -170
  35. package/lib/channels/webchat_channel.js +125 -170
  36. package/lib/controllers/form_controller.cjs +82 -121
  37. package/lib/controllers/form_controller.js +82 -130
  38. package/lib/controllers/message_controller.cjs +211 -282
  39. package/lib/controllers/message_controller.js +209 -284
  40. package/lib/controllers/mixins/usePopover.cjs +3 -6
  41. package/lib/controllers/mixins/usePopover.js +17 -22
  42. package/lib/controllers/webchat/emoji_picker_controller.cjs +106 -150
  43. package/lib/controllers/webchat/emoji_picker_controller.js +105 -170
  44. package/lib/controllers/webchat/useBehaviour.js +5 -5
  45. package/lib/controllers/webchat/useOpeningSequence.js +6 -6
  46. package/lib/controllers/webchat/useTeaser.js +9 -9
  47. package/lib/controllers/webchat_controller.cjs +916 -1088
  48. package/lib/controllers/webchat_controller.js +926 -1152
  49. package/lib/core/configuration/forms.cjs +21 -35
  50. package/lib/core/configuration/forms.js +20 -35
  51. package/lib/core/configuration/locale.cjs +36 -71
  52. package/lib/core/configuration/locale.js +36 -70
  53. package/lib/core/configuration/push.cjs +9 -21
  54. package/lib/core/configuration/push.js +8 -20
  55. package/lib/core/configuration/webchat.cjs +142 -182
  56. package/lib/core/configuration/webchat.js +145 -189
  57. package/lib/core/configuration/whatsapp.cjs +76 -102
  58. package/lib/core/configuration/whatsapp.js +76 -105
  59. package/lib/core/configuration.cjs +60 -78
  60. package/lib/core/configuration.js +59 -78
  61. package/lib/core/event.cjs +36 -59
  62. package/lib/core/event.js +35 -61
  63. package/lib/core/sanitize_html.js +4 -4
  64. package/lib/errors/invalid_event.cjs +5 -26
  65. package/lib/errors/invalid_event.js +5 -26
  66. package/lib/errors/not_initialized_error.cjs +5 -26
  67. package/lib/errors/not_initialized_error.js +5 -26
  68. package/lib/hellotext.cjs +185 -223
  69. package/lib/hellotext.js +188 -247
  70. package/lib/index.js +1 -1
  71. package/lib/models/business.cjs +114 -152
  72. package/lib/models/business.js +117 -162
  73. package/lib/models/cookies.cjs +34 -51
  74. package/lib/models/cookies.js +34 -51
  75. package/lib/models/fingerprint.cjs +8 -23
  76. package/lib/models/fingerprint.js +25 -58
  77. package/lib/models/form.cjs +106 -142
  78. package/lib/models/form.js +105 -153
  79. package/lib/models/form_collection.cjs +63 -101
  80. package/lib/models/form_collection.js +61 -107
  81. package/lib/models/page.cjs +106 -129
  82. package/lib/models/page.js +106 -131
  83. package/lib/models/push.cjs +278 -322
  84. package/lib/models/push.js +284 -357
  85. package/lib/models/query.cjs +21 -41
  86. package/lib/models/query.js +21 -41
  87. package/lib/models/session.cjs +33 -65
  88. package/lib/models/session.js +30 -63
  89. package/lib/models/user.cjs +29 -51
  90. package/lib/models/user.js +29 -51
  91. package/lib/models/utm.cjs +15 -27
  92. package/lib/models/utm.js +17 -32
  93. package/lib/models/webchat.cjs +52 -76
  94. package/lib/models/webchat.js +52 -90
  95. package/lib/models/whatsapp_widget.cjs +41 -59
  96. package/lib/models/whatsapp_widget.js +41 -73
  97. package/lib/vanilla.cjs +4 -7
  98. package/lib/vanilla.js +2 -1
  99. package/package.json +1 -9
  100. package/src/index.bundle.js +0 -1
  101. package/src/vanilla.js +2 -1
  102. package/styles/index.css +0 -30
package/lib/hellotext.js CHANGED
@@ -1,266 +1,207 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
5
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
8
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
9
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
10
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
11
1
  import { Configuration, Event } from './core';
12
2
  import API, { Response, keepaliveFor } from './api';
13
3
  import { Business, Fingerprint, FormCollection, Page, Push, Query, Session, User, Webchat, WhatsAppWidget } from './models';
14
4
  import { NotInitializedError } from './errors';
15
- var Hellotext = /*#__PURE__*/function () {
16
- function Hellotext() {
17
- _classCallCheck(this, Hellotext);
18
- }
19
- _createClass(Hellotext, null, [{
20
- key: "initialize",
21
- value:
22
- /**
23
- * initialize the module.
24
- * @param business public business id
25
- * @param { Configuration } config
26
- */
27
- function () {
28
- var _initialize = _asyncToGenerator(function* (business) {
29
- var _this$push, _businessData$push;
30
- var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
31
- (_this$push = this.push) === null || _this$push === void 0 ? void 0 : _this$push.dispose();
32
- this.push = null;
33
- this.business = new Business(business);
34
- this.page = new Page();
35
- Configuration.assign(_objectSpread({
36
- push: {}
37
- }, config));
38
- Session.initialize(this.page);
39
- this.forms = new FormCollection();
40
- this.query = new Query();
41
- var businessData = yield this.business.hydrate();
42
- if (config.push !== false && businessData !== null && businessData !== void 0 && (_businessData$push = businessData.push) !== null && _businessData$push !== void 0 && _businessData$push.public_key && Push.supported) {
43
- this.push = new Push(businessData.push);
44
- this.push.initialize().catch(error => {
45
- console.warn('Hellotext Push initialization failed:', error);
46
- });
47
- }
48
- var webchatConfig = config.webchat === false ? false : this.mergeWebchatConfig(businessData && businessData.webchat || {}, config.webchat || {});
49
- var whatsappConfig = config.whatsappWidget === false ? false : this.mergeWhatsAppConfig(businessData && businessData.whatsapp || {}, config.whatsappWidget || {});
50
- var hasExplicitBehaviourOverride = config.webchat && config.webchat !== false && Object.prototype.hasOwnProperty.call(config.webchat, 'behaviour');
51
- Configuration.webchat.behaviourOverride = hasExplicitBehaviourOverride;
52
- if (webchatConfig && webchatConfig.id) {
53
- Configuration.webchat.assign(webchatConfig);
54
- this.webchat = yield Webchat.load(webchatConfig.id);
55
- }
56
- if (whatsappConfig && whatsappConfig.id) {
57
- Configuration.whatsapp.assign(whatsappConfig);
58
- this.whatsapp = yield WhatsAppWidget.load(whatsappConfig.id);
59
- }
60
- if (typeof MutationObserver !== 'undefined') {
61
- this.forms.collectExistingFormsOnPage();
62
- }
5
+ class Hellotext {
6
+ static eventEmitter = new Event();
7
+ static forms;
8
+ static business;
9
+ static webchat;
10
+ static whatsapp;
11
+ static push;
12
+
13
+ /**
14
+ * initialize the module.
15
+ * @param business public business id
16
+ * @param { Configuration } config
17
+ */
18
+ static async initialize(business, config = {}) {
19
+ this.push?.dispose();
20
+ this.push = null;
21
+ this.business = new Business(business);
22
+ this.page = new Page();
23
+ Configuration.assign({
24
+ push: {},
25
+ ...config
26
+ });
27
+ Session.initialize(this.page);
28
+ this.forms = new FormCollection();
29
+ this.query = new Query();
30
+ const businessData = await this.business.hydrate();
31
+ if (config.push !== false && businessData?.push?.public_key && Push.supported) {
32
+ this.push = new Push(businessData.push);
33
+ this.push.initialize().catch(error => {
34
+ console.warn('Hellotext Push initialization failed:', error);
63
35
  });
64
- function initialize(_x) {
65
- return _initialize.apply(this, arguments);
66
- }
67
- return initialize;
68
- }()
69
- }, {
70
- key: "mergeWebchatConfig",
71
- value: function mergeWebchatConfig(dashboardConfig, localConfig) {
72
- return this.deepMergePlainObjects(dashboardConfig, localConfig);
73
36
  }
74
- }, {
75
- key: "mergeWhatsAppConfig",
76
- value: function mergeWhatsAppConfig(dashboardConfig, localConfig) {
77
- return this.deepMergePlainObjects(dashboardConfig, localConfig);
37
+ const webchatConfig = config.webchat === false ? false : this.mergeWebchatConfig(businessData && businessData.webchat || {}, config.webchat || {});
38
+ const whatsappConfig = config.whatsappWidget === false ? false : this.mergeWhatsAppConfig(businessData && businessData.whatsapp || {}, config.whatsappWidget || {});
39
+ const hasExplicitBehaviourOverride = config.webchat && config.webchat !== false && Object.prototype.hasOwnProperty.call(config.webchat, 'behaviour');
40
+ Configuration.webchat.behaviourOverride = hasExplicitBehaviourOverride;
41
+ if (webchatConfig && webchatConfig.id) {
42
+ Configuration.webchat.assign(webchatConfig);
43
+ this.webchat = await Webchat.load(webchatConfig.id);
78
44
  }
79
- }, {
80
- key: "deepMergePlainObjects",
81
- value: function deepMergePlainObjects(base, override) {
82
- var result = _objectSpread({}, base);
83
- Object.entries(override).forEach(_ref => {
84
- var [key, value] = _ref;
85
- if (this.isPlainObject(value) && this.isPlainObject(result[key])) {
86
- result[key] = this.deepMergePlainObjects(result[key], value);
87
- } else {
88
- result[key] = value;
89
- }
90
- });
91
- return result;
45
+ if (whatsappConfig && whatsappConfig.id) {
46
+ Configuration.whatsapp.assign(whatsappConfig);
47
+ this.whatsapp = await WhatsAppWidget.load(whatsappConfig.id);
92
48
  }
93
- }, {
94
- key: "isPlainObject",
95
- value: function isPlainObject(value) {
96
- return typeof value === 'object' && value !== null && !Array.isArray(value);
49
+ if (typeof MutationObserver !== 'undefined') {
50
+ this.forms.collectExistingFormsOnPage();
97
51
  }
98
-
99
- /**
100
- * Tracks an action that has happened on the page
101
- *
102
- * @param { String } action a valid action name
103
- * @param { Object } params
104
- * @returns {Promise<Response>}
105
- */
106
- }, {
107
- key: "track",
108
- value: function () {
109
- var _track = _asyncToGenerator(function* (action) {
110
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
111
- if (this.notInitialized) {
112
- throw new NotInitializedError();
113
- }
114
- var headers = _objectSpread(_objectSpread({}, params && params.headers || {}), this.headers);
115
- var user_parameters = _objectSpread(_objectSpread({}, User.identificationData), params.user_parameters || {});
116
- var pageInstance = params && params.url ? new Page(params.url) : this.page;
117
- var body = _objectSpread(_objectSpread({
118
- session: this.session,
119
- user_parameters,
120
- action
121
- }, params), pageInstance.trackingData);
122
- delete body.headers;
123
- return yield API.events.create({
124
- headers,
125
- body,
126
- // Track is the SDK's unload-sensitive analytics path. Keepalive belongs
127
- // here rather than on identify/forms/webchat calls because event tracking
128
- // is allowed to be fire-and-navigate, while those other calls have
129
- // stronger request/response or interaction contracts.
130
- keepalive: keepaliveFor(body)
131
- });
132
- });
133
- function track(_x2) {
134
- return _track.apply(this, arguments);
135
- }
136
- return track;
137
- }()
138
- /**
139
- * @typedef { Object } IdentificationOptions
140
- * @property { String } [email] - the email of the user
141
- * @property { String } [phone] - the phone number of the user
142
- * @property { String } [name] - the name of the user
143
- * @property { String } [source] - the platform specific identifier where this pixel is running on.
144
- *
145
- * Identifies a user and attaches the hello_session to the user ID.
146
- * Repeated calls are skipped only when the last successful identify payload
147
- * for the current session remains unchanged.
148
- * @param { String } externalId - the user ID
149
- * @param { IdentificationOptions } options - the options for the identification
150
- * @returns {Promise<Response>}
151
- */
152
- }, {
153
- key: "identify",
154
- value: function () {
155
- var _identify = _asyncToGenerator(function* (externalId) {
156
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
157
- var fingerprint = yield Fingerprint.generate(this.session, externalId, options);
158
- if (Fingerprint.matches(User.fingerprint, fingerprint)) {
159
- return new Response(true, {
160
- json: function () {
161
- var _json = _asyncToGenerator(function* () {
162
- return {
163
- already_identified: true
164
- };
165
- });
166
- function json() {
167
- return _json.apply(this, arguments);
168
- }
169
- return json;
170
- }()
171
- });
172
- }
173
- var response = yield API.identifications.create(_objectSpread({
174
- user_id: externalId
175
- }, options));
176
- if (response.succeeded) {
177
- User.remember(externalId, options.source, fingerprint);
178
- }
179
- return response;
180
- });
181
- function identify(_x3) {
182
- return _identify.apply(this, arguments);
52
+ }
53
+ static mergeWebchatConfig(dashboardConfig, localConfig) {
54
+ return this.deepMergePlainObjects(dashboardConfig, localConfig);
55
+ }
56
+ static mergeWhatsAppConfig(dashboardConfig, localConfig) {
57
+ return this.deepMergePlainObjects(dashboardConfig, localConfig);
58
+ }
59
+ static deepMergePlainObjects(base, override) {
60
+ const result = {
61
+ ...base
62
+ };
63
+ Object.entries(override).forEach(([key, value]) => {
64
+ if (this.isPlainObject(value) && this.isPlainObject(result[key])) {
65
+ result[key] = this.deepMergePlainObjects(result[key], value);
66
+ } else {
67
+ result[key] = value;
183
68
  }
184
- return identify;
185
- }()
186
- /**
187
- * Clears the user session, use when the user logs out to clear the hello cookies
188
- *
189
- * @returns {void}
190
- */
191
- }, {
192
- key: "forget",
193
- value: function forget() {
194
- User.forget();
195
- }
69
+ });
70
+ return result;
71
+ }
72
+ static isPlainObject(value) {
73
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
74
+ }
196
75
 
197
- /**
198
- * Registers an event listener
199
- * @param event the name of the event to listen to
200
- * @param callback the callback. This method will be called with the payload
201
- */
202
- }, {
203
- key: "on",
204
- value: function on(event, callback) {
205
- this.eventEmitter.addSubscriber(event, callback);
76
+ /**
77
+ * Tracks an action that has happened on the page
78
+ *
79
+ * @param { String } action a valid action name
80
+ * @param { Object } params
81
+ * @returns {Promise<Response>}
82
+ */
83
+ static async track(action, params = {}) {
84
+ if (this.notInitialized) {
85
+ throw new NotInitializedError();
206
86
  }
87
+ const headers = {
88
+ ...(params && params.headers || {}),
89
+ ...this.headers
90
+ };
91
+ const user_parameters = {
92
+ ...User.identificationData,
93
+ ...(params.user_parameters || {})
94
+ };
95
+ const pageInstance = params && params.url ? new Page(params.url) : this.page;
96
+ const body = {
97
+ session: this.session,
98
+ user_parameters,
99
+ action,
100
+ ...params,
101
+ ...pageInstance.trackingData
102
+ };
103
+ delete body.headers;
104
+ return await API.events.create({
105
+ headers,
106
+ body,
107
+ // Track is the SDK's unload-sensitive analytics path. Keepalive belongs
108
+ // here rather than on identify/forms/webchat calls because event tracking
109
+ // is allowed to be fire-and-navigate, while those other calls have
110
+ // stronger request/response or interaction contracts.
111
+ keepalive: keepaliveFor(body)
112
+ });
113
+ }
207
114
 
208
- /**
209
- * Removes an event listener
210
- * @param event the name of the event to remove
211
- * @param callback the callback to remove
212
- */
213
- }, {
214
- key: "removeEventListener",
215
- value: function removeEventListener(event, callback) {
216
- this.eventEmitter.removeSubscriber(event, callback);
115
+ /**
116
+ * @typedef { Object } IdentificationOptions
117
+ * @property { String } [email] - the email of the user
118
+ * @property { String } [phone] - the phone number of the user
119
+ * @property { String } [name] - the name of the user
120
+ * @property { String } [source] - the platform specific identifier where this pixel is running on.
121
+ *
122
+ * Identifies a user and attaches the hello_session to the user ID.
123
+ * Repeated calls are skipped only when the last successful identify payload
124
+ * for the current session remains unchanged.
125
+ * @param { String } externalId - the user ID
126
+ * @param { IdentificationOptions } options - the options for the identification
127
+ * @returns {Promise<Response>}
128
+ */
129
+ static async identify(externalId, options = {}) {
130
+ const fingerprint = await Fingerprint.generate(this.session, externalId, options);
131
+ if (Fingerprint.matches(User.fingerprint, fingerprint)) {
132
+ return new Response(true, {
133
+ json: async () => ({
134
+ already_identified: true
135
+ })
136
+ });
217
137
  }
218
-
219
- /**
220
- *
221
- * @returns {String}
222
- */
223
- }, {
224
- key: "session",
225
- get: function get() {
226
- return Session.session;
138
+ const response = await API.identifications.create({
139
+ user_id: externalId,
140
+ ...options
141
+ });
142
+ if (response.succeeded) {
143
+ User.remember(externalId, options.source, fingerprint);
227
144
  }
145
+ return response;
146
+ }
228
147
 
229
- /**
230
- * Determines if the session is set or not
231
- * @returns {boolean}
232
- */
233
- }, {
234
- key: "isInitialized",
235
- get: function get() {
236
- return Session.session !== undefined;
237
- }
148
+ /**
149
+ * Clears the user session, use when the user logs out to clear the hello cookies
150
+ *
151
+ * @returns {void}
152
+ */
153
+ static forget() {
154
+ User.forget();
155
+ }
238
156
 
239
- // private
240
- }, {
241
- key: "notInitialized",
242
- get: function get() {
243
- return !this.business || this.business.id === undefined;
244
- }
245
- }, {
246
- key: "headers",
247
- get: function get() {
248
- if (this.notInitialized) {
249
- throw new NotInitializedError();
250
- }
251
- return {
252
- Authorization: "Bearer ".concat(this.business.id),
253
- Accept: 'application/json',
254
- 'Content-Type': 'application/json'
255
- };
157
+ /**
158
+ * Registers an event listener
159
+ * @param event the name of the event to listen to
160
+ * @param callback the callback. This method will be called with the payload
161
+ */
162
+ static on(event, callback) {
163
+ this.eventEmitter.addSubscriber(event, callback);
164
+ }
165
+
166
+ /**
167
+ * Removes an event listener
168
+ * @param event the name of the event to remove
169
+ * @param callback the callback to remove
170
+ */
171
+ static removeEventListener(event, callback) {
172
+ this.eventEmitter.removeSubscriber(event, callback);
173
+ }
174
+
175
+ /**
176
+ *
177
+ * @returns {String}
178
+ */
179
+ static get session() {
180
+ return Session.session;
181
+ }
182
+
183
+ /**
184
+ * Determines if the session is set or not
185
+ * @returns {boolean}
186
+ */
187
+ static get isInitialized() {
188
+ return Session.session !== undefined;
189
+ }
190
+
191
+ // private
192
+
193
+ static get notInitialized() {
194
+ return !this.business || this.business.id === undefined;
195
+ }
196
+ static get headers() {
197
+ if (this.notInitialized) {
198
+ throw new NotInitializedError();
256
199
  }
257
- }]);
258
- return Hellotext;
259
- }();
260
- Hellotext.eventEmitter = new Event();
261
- Hellotext.forms = void 0;
262
- Hellotext.business = void 0;
263
- Hellotext.webchat = void 0;
264
- Hellotext.whatsapp = void 0;
265
- Hellotext.push = void 0;
200
+ return {
201
+ Authorization: `Bearer ${this.business.id}`,
202
+ Accept: 'application/json',
203
+ 'Content-Type': 'application/json'
204
+ };
205
+ }
206
+ }
266
207
  export default Hellotext;
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@ import FormController from './controllers/form_controller';
4
4
  import MessageController from './controllers/message_controller';
5
5
  import WebChatEmojiController from './controllers/webchat/emoji_picker_controller';
6
6
  import WebchatController from './controllers/webchat_controller';
7
- var application = Application.start();
7
+ const application = Application.start();
8
8
  application.register('hellotext--form', FormController);
9
9
  application.register('hellotext--webchat', WebchatController);
10
10
  application.register('hellotext--webchat--emoji', WebChatEmojiController);