@hellotext/hellotext 2.5.6 → 2.5.7

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.
@@ -1 +1 @@
1
- /*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */
1
+ /*! @license DOMPurify 3.4.14 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.14/LICENSE */
package/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface HellotextConfig {
7
7
  }
8
8
  webchat?: false | HellotextWebchatConfig
9
9
  whatsappWidget?: false | HellotextWhatsAppWidgetConfig
10
+ push?: false | HellotextPushConfig
10
11
  session?: string
11
12
  autoGenerateSession?: boolean
12
13
  }
@@ -67,6 +68,18 @@ export interface HellotextWhatsAppWidgetConfig {
67
68
  appearance?: HellotextWhatsAppWidgetAppearance
68
69
  }
69
70
 
71
+ export interface HellotextPushConfig {
72
+ serviceWorkerUrl?: string | null
73
+ channelId?: string | null
74
+ }
75
+
76
+ export interface HellotextPush {
77
+ readonly ready: Promise<void>
78
+ readonly subscribed: boolean
79
+ subscribe(): Promise<Response | void>
80
+ unsubscribe(): Promise<Response | null | void>
81
+ }
82
+
70
83
  export interface HellotextBusinessCountry {
71
84
  code?: string
72
85
  prefix?: string
@@ -81,6 +94,7 @@ export interface HellotextBusinessData {
81
94
  style_url?: string
82
95
  webchat?: HellotextWebchatConfig | null
83
96
  whatsapp?: HellotextWhatsAppWidgetConfig | null
97
+ push?: { public_key: string } | null
84
98
  whitelist?: string | string[] | null
85
99
  subscription?: string | null
86
100
  [key: string]: any
@@ -142,6 +156,7 @@ declare class Hellotext {
142
156
  static business: HellotextBusiness
143
157
  static webchat: any
144
158
  static whatsapp: any
159
+ static push: HellotextPush | null
145
160
  }
146
161
 
147
162
  export declare class User {
package/lib/api/index.cjs CHANGED
@@ -18,6 +18,7 @@ var _identifications = _interopRequireDefault(require("./identifications"));
18
18
  var _webchats = _interopRequireDefault(require("./webchats"));
19
19
  var _whatsapp_widgets = _interopRequireDefault(require("./whatsapp_widgets"));
20
20
  var _acks = _interopRequireDefault(require("./acks"));
21
+ var _identities = _interopRequireDefault(require("./push/identities"));
21
22
  var _response = require("./response");
22
23
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
24
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -84,6 +85,11 @@ let API = /*#__PURE__*/function () {
84
85
  get: function () {
85
86
  return _acks.default;
86
87
  }
88
+ }, {
89
+ key: "pushIdentities",
90
+ get: function () {
91
+ return _identities.default;
92
+ }
87
93
  }]);
88
94
  return API;
89
95
  }();
package/lib/api/index.js CHANGED
@@ -10,6 +10,7 @@ import IdentificationsAPI from './identifications';
10
10
  import WebchatsAPI from './webchats';
11
11
  import WhatsAppWidgetsAPI from './whatsapp_widgets';
12
12
  import AcksAPI from './acks';
13
+ import PushIdentitiesAPI from './push/identities';
13
14
 
14
15
  // Browsers keep `fetch(..., { keepalive: true })` requests alive during page
15
16
  // unload/navigation, which is exactly the failure mode for analytics events
@@ -70,6 +71,11 @@ var API = /*#__PURE__*/function () {
70
71
  get: function get() {
71
72
  return AcksAPI;
72
73
  }
74
+ }, {
75
+ key: "pushIdentities",
76
+ get: function get() {
77
+ return PushIdentitiesAPI;
78
+ }
73
79
  }]);
74
80
  return API;
75
81
  }();
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _hellotext = _interopRequireDefault(require("../../hellotext"));
8
+ var _core = require("../../core");
9
+ var _response = require("../response");
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
+ 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); } }
13
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
+ 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); }
16
+ let PushIdentitiesAPI = /*#__PURE__*/function () {
17
+ function PushIdentitiesAPI() {
18
+ _classCallCheck(this, PushIdentitiesAPI);
19
+ }
20
+ _createClass(PushIdentitiesAPI, null, [{
21
+ key: "endpoint",
22
+ get: function () {
23
+ return _core.Configuration.endpoint('public/push/identities');
24
+ }
25
+ }, {
26
+ key: "create",
27
+ value: async function create(data = {}) {
28
+ const response = await fetch(this.endpoint, {
29
+ method: 'POST',
30
+ keepalive: true,
31
+ headers: _hellotext.default.headers,
32
+ body: JSON.stringify({
33
+ ...data,
34
+ session: _hellotext.default.session,
35
+ origin: window.location.origin
36
+ })
37
+ });
38
+ return new _response.Response(response.ok, response);
39
+ }
40
+ }, {
41
+ key: "destroy",
42
+ value: async function destroy(data = {}) {
43
+ const response = await fetch(this.endpoint, {
44
+ method: 'DELETE',
45
+ keepalive: true,
46
+ headers: _hellotext.default.headers,
47
+ body: JSON.stringify({
48
+ ...data,
49
+ session: _hellotext.default.session,
50
+ origin: window.location.origin
51
+ })
52
+ });
53
+ return new _response.Response(response.ok, response);
54
+ }
55
+ }]);
56
+ return PushIdentitiesAPI;
57
+ }();
58
+ var _default = PushIdentitiesAPI;
59
+ exports.default = _default;
@@ -0,0 +1,68 @@
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
+ import Hellotext from '../../hellotext';
12
+ import { Configuration } from '../../core';
13
+ import { Response } from '../response';
14
+ var PushIdentitiesAPI = /*#__PURE__*/function () {
15
+ function PushIdentitiesAPI() {
16
+ _classCallCheck(this, PushIdentitiesAPI);
17
+ }
18
+ _createClass(PushIdentitiesAPI, null, [{
19
+ key: "endpoint",
20
+ get: function get() {
21
+ return Configuration.endpoint('public/push/identities');
22
+ }
23
+ }, {
24
+ key: "create",
25
+ value: function () {
26
+ var _create = _asyncToGenerator(function* () {
27
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
+ var response = yield fetch(this.endpoint, {
29
+ method: 'POST',
30
+ keepalive: true,
31
+ headers: Hellotext.headers,
32
+ body: JSON.stringify(_objectSpread(_objectSpread({}, data), {}, {
33
+ session: Hellotext.session,
34
+ origin: window.location.origin
35
+ }))
36
+ });
37
+ return new Response(response.ok, response);
38
+ });
39
+ function create() {
40
+ return _create.apply(this, arguments);
41
+ }
42
+ return create;
43
+ }()
44
+ }, {
45
+ key: "destroy",
46
+ value: function () {
47
+ var _destroy = _asyncToGenerator(function* () {
48
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
49
+ var response = yield fetch(this.endpoint, {
50
+ method: 'DELETE',
51
+ keepalive: true,
52
+ headers: Hellotext.headers,
53
+ body: JSON.stringify(_objectSpread(_objectSpread({}, data), {}, {
54
+ session: Hellotext.session,
55
+ origin: window.location.origin
56
+ }))
57
+ });
58
+ return new Response(response.ok, response);
59
+ });
60
+ function destroy() {
61
+ return _destroy.apply(this, arguments);
62
+ }
63
+ return destroy;
64
+ }()
65
+ }]);
66
+ return PushIdentitiesAPI;
67
+ }();
68
+ export default PushIdentitiesAPI;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Push = void 0;
7
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
8
+ 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); } }
9
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
11
+ 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); }
12
+ let Push = /*#__PURE__*/function () {
13
+ function Push() {
14
+ _classCallCheck(this, Push);
15
+ }
16
+ _createClass(Push, null, [{
17
+ key: "assign",
18
+ value: function assign(props) {
19
+ this.serviceWorkerUrl = (props === null || props === void 0 ? void 0 : props.serviceWorkerUrl) || null;
20
+ this.channelId = (props === null || props === void 0 ? void 0 : props.channelId) || null;
21
+ return this;
22
+ }
23
+ }]);
24
+ return Push;
25
+ }();
26
+ exports.Push = Push;
27
+ Push.serviceWorkerUrl = null;
28
+ Push.channelId = null;
@@ -0,0 +1,22 @@
1
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
+ 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); } }
3
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
+ 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); }
6
+ var Push = /*#__PURE__*/function () {
7
+ function Push() {
8
+ _classCallCheck(this, Push);
9
+ }
10
+ _createClass(Push, null, [{
11
+ key: "assign",
12
+ value: function assign(props) {
13
+ this.serviceWorkerUrl = (props === null || props === void 0 ? void 0 : props.serviceWorkerUrl) || null;
14
+ this.channelId = (props === null || props === void 0 ? void 0 : props.channelId) || null;
15
+ return this;
16
+ }
17
+ }]);
18
+ return Push;
19
+ }();
20
+ Push.serviceWorkerUrl = null;
21
+ Push.channelId = null;
22
+ export { Push };
@@ -8,6 +8,7 @@ var _forms = require("./configuration/forms");
8
8
  var _locale = require("./configuration/locale");
9
9
  var _webchat = require("./configuration/webchat");
10
10
  var _whatsapp = require("./configuration/whatsapp");
11
+ var _push = require("./configuration/push");
11
12
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
13
  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); } }
13
14
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -22,6 +23,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
22
23
  * @property {Forms} [forms] - form configuration
23
24
  * @property {Webchat} [webchat] - webchat configuration
24
25
  * @property {WhatsApp} [whatsappWidget] - WhatsApp widget configuration
26
+ * @property {Push} [push] - push subscription configuration
25
27
  * @property {Locale} [locale] - locale configuration
26
28
  */
27
29
  let Configuration = /*#__PURE__*/function () {
@@ -49,6 +51,8 @@ let Configuration = /*#__PURE__*/function () {
49
51
  this.webchat = _webchat.Webchat.assign(value);
50
52
  } else if (key === 'whatsappWidget') {
51
53
  this.whatsapp = _whatsapp.WhatsApp.assign(value);
54
+ } else if (key === 'push') {
55
+ this.push = _push.Push.assign(value);
52
56
  } else {
53
57
  this[key] = value;
54
58
  }
@@ -97,4 +101,5 @@ Configuration.autoGenerateSession = true;
97
101
  Configuration.session = null;
98
102
  Configuration.forms = _forms.Forms;
99
103
  Configuration.webchat = _webchat.Webchat;
100
- Configuration.whatsapp = _whatsapp.WhatsApp;
104
+ Configuration.whatsapp = _whatsapp.WhatsApp;
105
+ Configuration.push = _push.Push;
@@ -7,6 +7,7 @@ import { Forms } from './configuration/forms';
7
7
  import { Locale } from './configuration/locale';
8
8
  import { Webchat } from './configuration/webchat';
9
9
  import { WhatsApp } from './configuration/whatsapp';
10
+ import { Push } from './configuration/push';
10
11
 
11
12
  /**
12
13
  * @class Configuration
@@ -17,6 +18,7 @@ import { WhatsApp } from './configuration/whatsapp';
17
18
  * @property {Forms} [forms] - form configuration
18
19
  * @property {Webchat} [webchat] - webchat configuration
19
20
  * @property {WhatsApp} [whatsappWidget] - WhatsApp widget configuration
21
+ * @property {Push} [push] - push subscription configuration
20
22
  * @property {Locale} [locale] - locale configuration
21
23
  */
22
24
  var Configuration = /*#__PURE__*/function () {
@@ -45,6 +47,8 @@ var Configuration = /*#__PURE__*/function () {
45
47
  this.webchat = Webchat.assign(value);
46
48
  } else if (key === 'whatsappWidget') {
47
49
  this.whatsapp = WhatsApp.assign(value);
50
+ } else if (key === 'push') {
51
+ this.push = Push.assign(value);
48
52
  } else {
49
53
  this[key] = value;
50
54
  }
@@ -93,4 +97,5 @@ Configuration.session = null;
93
97
  Configuration.forms = Forms;
94
98
  Configuration.webchat = Webchat;
95
99
  Configuration.whatsapp = WhatsApp;
100
+ Configuration.push = Push;
96
101
  export { Configuration };
package/lib/hellotext.cjs CHANGED
@@ -28,13 +28,25 @@ let Hellotext = /*#__PURE__*/function () {
28
28
  * @param { Configuration } config
29
29
  */
30
30
  async function initialize(business, config = {}) {
31
+ var _this$push, _businessData$push;
32
+ (_this$push = this.push) === null || _this$push === void 0 ? void 0 : _this$push.dispose();
33
+ this.push = null;
31
34
  this.business = new _models.Business(business);
32
35
  this.page = new _models.Page();
33
- _core.Configuration.assign(config);
36
+ _core.Configuration.assign({
37
+ push: {},
38
+ ...config
39
+ });
34
40
  _models.Session.initialize(this.page);
35
41
  this.forms = new _models.FormCollection();
36
42
  this.query = new _models.Query();
37
43
  const businessData = await this.business.hydrate();
44
+ if (config.push !== false && businessData !== null && businessData !== void 0 && (_businessData$push = businessData.push) !== null && _businessData$push !== void 0 && _businessData$push.public_key && _models.Push.supported) {
45
+ this.push = new _models.Push(businessData.push);
46
+ this.push.initialize().catch(error => {
47
+ console.warn('Hellotext Push initialization failed:', error);
48
+ });
49
+ }
38
50
  const webchatConfig = config.webchat === false ? false : this.mergeWebchatConfig(businessData && businessData.webchat || {}, config.webchat || {});
39
51
  const whatsappConfig = config.whatsappWidget === false ? false : this.mergeWhatsAppConfig(businessData && businessData.whatsapp || {}, config.whatsappWidget || {});
40
52
  const hasExplicitBehaviourOverride = config.webchat && config.webchat !== false && Object.prototype.hasOwnProperty.call(config.webchat, 'behaviour');
@@ -237,5 +249,6 @@ Hellotext.forms = void 0;
237
249
  Hellotext.business = void 0;
238
250
  Hellotext.webchat = void 0;
239
251
  Hellotext.whatsapp = void 0;
252
+ Hellotext.push = void 0;
240
253
  var _default = Hellotext;
241
254
  exports.default = _default;
package/lib/hellotext.js CHANGED
@@ -10,7 +10,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
10
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
11
  import { Configuration, Event } from './core';
12
12
  import API, { Response, keepaliveFor } from './api';
13
- import { Business, Fingerprint, FormCollection, Page, Query, Session, User, Webchat, WhatsAppWidget } from './models';
13
+ import { Business, Fingerprint, FormCollection, Page, Push, Query, Session, User, Webchat, WhatsAppWidget } from './models';
14
14
  import { NotInitializedError } from './errors';
15
15
  var Hellotext = /*#__PURE__*/function () {
16
16
  function Hellotext() {
@@ -26,14 +26,25 @@ var Hellotext = /*#__PURE__*/function () {
26
26
  */
27
27
  function () {
28
28
  var _initialize = _asyncToGenerator(function* (business) {
29
+ var _this$push, _businessData$push;
29
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;
30
33
  this.business = new Business(business);
31
34
  this.page = new Page();
32
- Configuration.assign(config);
35
+ Configuration.assign(_objectSpread({
36
+ push: {}
37
+ }, config));
33
38
  Session.initialize(this.page);
34
39
  this.forms = new FormCollection();
35
40
  this.query = new Query();
36
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
+ }
37
48
  var webchatConfig = config.webchat === false ? false : this.mergeWebchatConfig(businessData && businessData.webchat || {}, config.webchat || {});
38
49
  var whatsappConfig = config.whatsappWidget === false ? false : this.mergeWhatsAppConfig(businessData && businessData.whatsapp || {}, config.whatsappWidget || {});
39
50
  var hasExplicitBehaviourOverride = config.webchat && config.webchat !== false && Object.prototype.hasOwnProperty.call(config.webchat, 'behaviour');
@@ -251,4 +262,5 @@ Hellotext.forms = void 0;
251
262
  Hellotext.business = void 0;
252
263
  Hellotext.webchat = void 0;
253
264
  Hellotext.whatsapp = void 0;
265
+ Hellotext.push = void 0;
254
266
  export default Hellotext;
@@ -38,6 +38,7 @@ const stylesheetLoadTimeout = 10000;
38
38
  * @property {String} [locale] - Default dashboard locale for the business.
39
39
  * @property {String} [style_url] - Stylesheet URL to inject for dashboard-managed surfaces.
40
40
  * @property {BusinessWebchat|null} [webchat] - Dashboard webchat defaults.
41
+ * @property {{public_key: String}|null} [push] - Public VAPID key for push subscriptions.
41
42
  * @property {String|Array<String>} [whitelist] - Domain whitelist configuration.
42
43
  * @property {String} [subscription] - Current business subscription tier.
43
44
  */
@@ -33,6 +33,7 @@ var stylesheetLoadTimeout = 10000;
33
33
  * @property {String} [locale] - Default dashboard locale for the business.
34
34
  * @property {String} [style_url] - Stylesheet URL to inject for dashboard-managed surfaces.
35
35
  * @property {BusinessWebchat|null} [webchat] - Dashboard webchat defaults.
36
+ * @property {{public_key: String}|null} [push] - Public VAPID key for push subscriptions.
36
37
  * @property {String|Array<String>} [whitelist] - Domain whitelist configuration.
37
38
  * @property {String} [subscription] - Current business subscription tier.
38
39
  */
@@ -39,6 +39,12 @@ Object.defineProperty(exports, "Page", {
39
39
  return _page.Page;
40
40
  }
41
41
  });
42
+ Object.defineProperty(exports, "Push", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _push.Push;
46
+ }
47
+ });
42
48
  Object.defineProperty(exports, "Query", {
43
49
  enumerable: true,
44
50
  get: function () {
@@ -81,6 +87,7 @@ var _fingerprint = require("./fingerprint");
81
87
  var _form = require("./form");
82
88
  var _form_collection = require("./form_collection");
83
89
  var _page = require("./page");
90
+ var _push = require("./push");
84
91
  var _query = require("./query");
85
92
  var _session = require("./session");
86
93
  var _user = require("./user");
@@ -4,6 +4,7 @@ export { Fingerprint } from './fingerprint';
4
4
  export { Form } from './form';
5
5
  export { FormCollection } from './form_collection';
6
6
  export { Page } from './page';
7
+ export { Push } from './push';
7
8
  export { Query } from './query';
8
9
  export { Session } from './session';
9
10
  export { User } from './user';