@hellotext/hellotext 2.5.6 → 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 (113) hide show
  1. package/README.md +5 -26
  2. package/dist/hellotext.js +1 -1
  3. package/dist/hellotext.js.LICENSE.txt +1 -1
  4. package/index.d.ts +15 -6
  5. package/lib/api/acks.cjs +17 -31
  6. package/lib/api/acks.js +17 -42
  7. package/lib/api/businesses.cjs +14 -28
  8. package/lib/api/businesses.js +13 -36
  9. package/lib/api/events.cjs +26 -40
  10. package/lib/api/events.js +28 -52
  11. package/lib/api/forms.cjs +24 -40
  12. package/lib/api/forms.js +24 -57
  13. package/lib/api/identifications.cjs +15 -29
  14. package/lib/api/identifications.js +15 -40
  15. package/lib/api/index.cjs +26 -46
  16. package/lib/api/index.js +28 -49
  17. package/lib/api/push/identities.cjs +43 -0
  18. package/lib/api/push/identities.js +35 -0
  19. package/lib/api/response.cjs +30 -52
  20. package/lib/api/response.js +31 -60
  21. package/lib/api/submissions.cjs +18 -34
  22. package/lib/api/submissions.js +18 -48
  23. package/lib/api/webchat/messages.cjs +44 -64
  24. package/lib/api/webchat/messages.js +44 -80
  25. package/lib/api/webchats.cjs +37 -56
  26. package/lib/api/webchats.js +37 -65
  27. package/lib/api/whatsapp_widgets.cjs +49 -72
  28. package/lib/api/whatsapp_widgets.js +48 -91
  29. package/lib/builders/input_builder.cjs +36 -48
  30. package/lib/builders/input_builder.js +36 -48
  31. package/lib/builders/logo_builder.cjs +10 -29
  32. package/lib/builders/logo_builder.js +20 -28
  33. package/lib/channels/application_channel.cjs +136 -178
  34. package/lib/channels/application_channel.js +137 -180
  35. package/lib/channels/webchat_channel.cjs +125 -170
  36. package/lib/channels/webchat_channel.js +125 -170
  37. package/lib/controllers/form_controller.cjs +82 -121
  38. package/lib/controllers/form_controller.js +82 -130
  39. package/lib/controllers/message_controller.cjs +211 -282
  40. package/lib/controllers/message_controller.js +209 -284
  41. package/lib/controllers/mixins/usePopover.cjs +3 -6
  42. package/lib/controllers/mixins/usePopover.js +17 -22
  43. package/lib/controllers/webchat/emoji_picker_controller.cjs +106 -150
  44. package/lib/controllers/webchat/emoji_picker_controller.js +105 -170
  45. package/lib/controllers/webchat/useBehaviour.js +5 -5
  46. package/lib/controllers/webchat/useOpeningSequence.js +6 -6
  47. package/lib/controllers/webchat/useTeaser.js +9 -9
  48. package/lib/controllers/webchat_controller.cjs +916 -1088
  49. package/lib/controllers/webchat_controller.js +926 -1152
  50. package/lib/core/configuration/forms.cjs +21 -35
  51. package/lib/core/configuration/forms.js +20 -35
  52. package/lib/core/configuration/locale.cjs +36 -71
  53. package/lib/core/configuration/locale.js +36 -70
  54. package/lib/core/configuration/push.cjs +16 -0
  55. package/lib/core/configuration/push.js +10 -0
  56. package/lib/core/configuration/webchat.cjs +142 -182
  57. package/lib/core/configuration/webchat.js +145 -189
  58. package/lib/core/configuration/whatsapp.cjs +76 -102
  59. package/lib/core/configuration/whatsapp.js +76 -105
  60. package/lib/core/configuration.cjs +62 -75
  61. package/lib/core/configuration.js +61 -75
  62. package/lib/core/event.cjs +36 -59
  63. package/lib/core/event.js +35 -61
  64. package/lib/core/sanitize_html.js +4 -4
  65. package/lib/errors/invalid_event.cjs +5 -26
  66. package/lib/errors/invalid_event.js +5 -26
  67. package/lib/errors/not_initialized_error.cjs +5 -26
  68. package/lib/errors/not_initialized_error.js +5 -26
  69. package/lib/hellotext.cjs +186 -211
  70. package/lib/hellotext.js +189 -236
  71. package/lib/index.js +1 -1
  72. package/lib/models/business.cjs +115 -152
  73. package/lib/models/business.js +118 -162
  74. package/lib/models/cookies.cjs +34 -51
  75. package/lib/models/cookies.js +34 -51
  76. package/lib/models/fingerprint.cjs +8 -23
  77. package/lib/models/fingerprint.js +25 -58
  78. package/lib/models/form.cjs +106 -142
  79. package/lib/models/form.js +105 -153
  80. package/lib/models/form_collection.cjs +63 -101
  81. package/lib/models/form_collection.js +61 -107
  82. package/lib/models/index.cjs +7 -0
  83. package/lib/models/index.js +1 -0
  84. package/lib/models/page.cjs +106 -129
  85. package/lib/models/page.js +106 -131
  86. package/lib/models/push.cjs +345 -0
  87. package/lib/models/push.js +339 -0
  88. package/lib/models/query.cjs +21 -41
  89. package/lib/models/query.js +21 -41
  90. package/lib/models/session.cjs +33 -65
  91. package/lib/models/session.js +30 -63
  92. package/lib/models/user.cjs +29 -51
  93. package/lib/models/user.js +29 -51
  94. package/lib/models/utm.cjs +15 -27
  95. package/lib/models/utm.js +17 -32
  96. package/lib/models/webchat.cjs +52 -76
  97. package/lib/models/webchat.js +52 -90
  98. package/lib/models/whatsapp_widget.cjs +41 -59
  99. package/lib/models/whatsapp_widget.js +41 -73
  100. package/lib/vanilla.cjs +4 -7
  101. package/lib/vanilla.js +2 -1
  102. package/package.json +2 -10
  103. package/src/api/index.js +5 -0
  104. package/src/api/push/identities.js +42 -0
  105. package/src/core/configuration/push.js +12 -0
  106. package/src/core/configuration.js +5 -0
  107. package/src/hellotext.js +15 -1
  108. package/src/index.bundle.js +0 -1
  109. package/src/models/business.js +1 -0
  110. package/src/models/index.js +1 -0
  111. package/src/models/push.js +397 -0
  112. package/src/vanilla.js +2 -1
  113. package/styles/index.css +0 -30
package/lib/hellotext.js CHANGED
@@ -1,254 +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
- import { Business, Fingerprint, FormCollection, Page, Query, Session, User, Webchat, WhatsAppWidget } from './models';
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 config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
30
- this.business = new Business(business);
31
- this.page = new Page();
32
- Configuration.assign(config);
33
- Session.initialize(this.page);
34
- this.forms = new FormCollection();
35
- this.query = new Query();
36
- var businessData = yield this.business.hydrate();
37
- var webchatConfig = config.webchat === false ? false : this.mergeWebchatConfig(businessData && businessData.webchat || {}, config.webchat || {});
38
- var whatsappConfig = config.whatsappWidget === false ? false : this.mergeWhatsAppConfig(businessData && businessData.whatsapp || {}, config.whatsappWidget || {});
39
- var 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 = yield Webchat.load(webchatConfig.id);
44
- }
45
- if (whatsappConfig && whatsappConfig.id) {
46
- Configuration.whatsapp.assign(whatsappConfig);
47
- this.whatsapp = yield WhatsAppWidget.load(whatsappConfig.id);
48
- }
49
- if (typeof MutationObserver !== 'undefined') {
50
- this.forms.collectExistingFormsOnPage();
51
- }
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);
52
35
  });
53
- function initialize(_x) {
54
- return _initialize.apply(this, arguments);
55
- }
56
- return initialize;
57
- }()
58
- }, {
59
- key: "mergeWebchatConfig",
60
- value: function mergeWebchatConfig(dashboardConfig, localConfig) {
61
- return this.deepMergePlainObjects(dashboardConfig, localConfig);
62
36
  }
63
- }, {
64
- key: "mergeWhatsAppConfig",
65
- value: function mergeWhatsAppConfig(dashboardConfig, localConfig) {
66
- 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);
67
44
  }
68
- }, {
69
- key: "deepMergePlainObjects",
70
- value: function deepMergePlainObjects(base, override) {
71
- var result = _objectSpread({}, base);
72
- Object.entries(override).forEach(_ref => {
73
- var [key, value] = _ref;
74
- if (this.isPlainObject(value) && this.isPlainObject(result[key])) {
75
- result[key] = this.deepMergePlainObjects(result[key], value);
76
- } else {
77
- result[key] = value;
78
- }
79
- });
80
- return result;
45
+ if (whatsappConfig && whatsappConfig.id) {
46
+ Configuration.whatsapp.assign(whatsappConfig);
47
+ this.whatsapp = await WhatsAppWidget.load(whatsappConfig.id);
81
48
  }
82
- }, {
83
- key: "isPlainObject",
84
- value: function isPlainObject(value) {
85
- return typeof value === 'object' && value !== null && !Array.isArray(value);
49
+ if (typeof MutationObserver !== 'undefined') {
50
+ this.forms.collectExistingFormsOnPage();
86
51
  }
87
-
88
- /**
89
- * Tracks an action that has happened on the page
90
- *
91
- * @param { String } action a valid action name
92
- * @param { Object } params
93
- * @returns {Promise<Response>}
94
- */
95
- }, {
96
- key: "track",
97
- value: function () {
98
- var _track = _asyncToGenerator(function* (action) {
99
- var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
100
- if (this.notInitialized) {
101
- throw new NotInitializedError();
102
- }
103
- var headers = _objectSpread(_objectSpread({}, params && params.headers || {}), this.headers);
104
- var user_parameters = _objectSpread(_objectSpread({}, User.identificationData), params.user_parameters || {});
105
- var pageInstance = params && params.url ? new Page(params.url) : this.page;
106
- var body = _objectSpread(_objectSpread({
107
- session: this.session,
108
- user_parameters,
109
- action
110
- }, params), pageInstance.trackingData);
111
- delete body.headers;
112
- return yield API.events.create({
113
- headers,
114
- body,
115
- // Track is the SDK's unload-sensitive analytics path. Keepalive belongs
116
- // here rather than on identify/forms/webchat calls because event tracking
117
- // is allowed to be fire-and-navigate, while those other calls have
118
- // stronger request/response or interaction contracts.
119
- keepalive: keepaliveFor(body)
120
- });
121
- });
122
- function track(_x2) {
123
- return _track.apply(this, arguments);
124
- }
125
- return track;
126
- }()
127
- /**
128
- * @typedef { Object } IdentificationOptions
129
- * @property { String } [email] - the email of the user
130
- * @property { String } [phone] - the phone number of the user
131
- * @property { String } [name] - the name of the user
132
- * @property { String } [source] - the platform specific identifier where this pixel is running on.
133
- *
134
- * Identifies a user and attaches the hello_session to the user ID.
135
- * Repeated calls are skipped only when the last successful identify payload
136
- * for the current session remains unchanged.
137
- * @param { String } externalId - the user ID
138
- * @param { IdentificationOptions } options - the options for the identification
139
- * @returns {Promise<Response>}
140
- */
141
- }, {
142
- key: "identify",
143
- value: function () {
144
- var _identify = _asyncToGenerator(function* (externalId) {
145
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
146
- var fingerprint = yield Fingerprint.generate(this.session, externalId, options);
147
- if (Fingerprint.matches(User.fingerprint, fingerprint)) {
148
- return new Response(true, {
149
- json: function () {
150
- var _json = _asyncToGenerator(function* () {
151
- return {
152
- already_identified: true
153
- };
154
- });
155
- function json() {
156
- return _json.apply(this, arguments);
157
- }
158
- return json;
159
- }()
160
- });
161
- }
162
- var response = yield API.identifications.create(_objectSpread({
163
- user_id: externalId
164
- }, options));
165
- if (response.succeeded) {
166
- User.remember(externalId, options.source, fingerprint);
167
- }
168
- return response;
169
- });
170
- function identify(_x3) {
171
- 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;
172
68
  }
173
- return identify;
174
- }()
175
- /**
176
- * Clears the user session, use when the user logs out to clear the hello cookies
177
- *
178
- * @returns {void}
179
- */
180
- }, {
181
- key: "forget",
182
- value: function forget() {
183
- User.forget();
184
- }
69
+ });
70
+ return result;
71
+ }
72
+ static isPlainObject(value) {
73
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
74
+ }
185
75
 
186
- /**
187
- * Registers an event listener
188
- * @param event the name of the event to listen to
189
- * @param callback the callback. This method will be called with the payload
190
- */
191
- }, {
192
- key: "on",
193
- value: function on(event, callback) {
194
- 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();
195
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
+ }
196
114
 
197
- /**
198
- * Removes an event listener
199
- * @param event the name of the event to remove
200
- * @param callback the callback to remove
201
- */
202
- }, {
203
- key: "removeEventListener",
204
- value: function removeEventListener(event, callback) {
205
- 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
+ });
206
137
  }
207
-
208
- /**
209
- *
210
- * @returns {String}
211
- */
212
- }, {
213
- key: "session",
214
- get: function get() {
215
- 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);
216
144
  }
145
+ return response;
146
+ }
217
147
 
218
- /**
219
- * Determines if the session is set or not
220
- * @returns {boolean}
221
- */
222
- }, {
223
- key: "isInitialized",
224
- get: function get() {
225
- return Session.session !== undefined;
226
- }
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
+ }
227
156
 
228
- // private
229
- }, {
230
- key: "notInitialized",
231
- get: function get() {
232
- return !this.business || this.business.id === undefined;
233
- }
234
- }, {
235
- key: "headers",
236
- get: function get() {
237
- if (this.notInitialized) {
238
- throw new NotInitializedError();
239
- }
240
- return {
241
- Authorization: "Bearer ".concat(this.business.id),
242
- Accept: 'application/json',
243
- 'Content-Type': 'application/json'
244
- };
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();
245
199
  }
246
- }]);
247
- return Hellotext;
248
- }();
249
- Hellotext.eventEmitter = new Event();
250
- Hellotext.forms = void 0;
251
- Hellotext.business = void 0;
252
- Hellotext.webchat = void 0;
253
- Hellotext.whatsapp = void 0;
200
+ return {
201
+ Authorization: `Bearer ${this.business.id}`,
202
+ Accept: 'application/json',
203
+ 'Content-Type': 'application/json'
204
+ };
205
+ }
206
+ }
254
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);