@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.
- package/README.md +5 -26
- package/dist/hellotext.js +1 -1
- package/dist/hellotext.js.LICENSE.txt +1 -1
- package/index.d.ts +15 -6
- package/lib/api/acks.cjs +17 -31
- package/lib/api/acks.js +17 -42
- package/lib/api/businesses.cjs +14 -28
- package/lib/api/businesses.js +13 -36
- package/lib/api/events.cjs +26 -40
- package/lib/api/events.js +28 -52
- package/lib/api/forms.cjs +24 -40
- package/lib/api/forms.js +24 -57
- package/lib/api/identifications.cjs +15 -29
- package/lib/api/identifications.js +15 -40
- package/lib/api/index.cjs +26 -46
- package/lib/api/index.js +28 -49
- package/lib/api/push/identities.cjs +43 -0
- package/lib/api/push/identities.js +35 -0
- package/lib/api/response.cjs +30 -52
- package/lib/api/response.js +31 -60
- package/lib/api/submissions.cjs +18 -34
- package/lib/api/submissions.js +18 -48
- package/lib/api/webchat/messages.cjs +44 -64
- package/lib/api/webchat/messages.js +44 -80
- package/lib/api/webchats.cjs +37 -56
- package/lib/api/webchats.js +37 -65
- package/lib/api/whatsapp_widgets.cjs +49 -72
- package/lib/api/whatsapp_widgets.js +48 -91
- package/lib/builders/input_builder.cjs +36 -48
- package/lib/builders/input_builder.js +36 -48
- package/lib/builders/logo_builder.cjs +10 -29
- package/lib/builders/logo_builder.js +20 -28
- package/lib/channels/application_channel.cjs +136 -178
- package/lib/channels/application_channel.js +137 -180
- package/lib/channels/webchat_channel.cjs +125 -170
- package/lib/channels/webchat_channel.js +125 -170
- package/lib/controllers/form_controller.cjs +82 -121
- package/lib/controllers/form_controller.js +82 -130
- package/lib/controllers/message_controller.cjs +211 -282
- package/lib/controllers/message_controller.js +209 -284
- package/lib/controllers/mixins/usePopover.cjs +3 -6
- package/lib/controllers/mixins/usePopover.js +17 -22
- package/lib/controllers/webchat/emoji_picker_controller.cjs +106 -150
- package/lib/controllers/webchat/emoji_picker_controller.js +105 -170
- package/lib/controllers/webchat/useBehaviour.js +5 -5
- package/lib/controllers/webchat/useOpeningSequence.js +6 -6
- package/lib/controllers/webchat/useTeaser.js +9 -9
- package/lib/controllers/webchat_controller.cjs +916 -1088
- package/lib/controllers/webchat_controller.js +926 -1152
- package/lib/core/configuration/forms.cjs +21 -35
- package/lib/core/configuration/forms.js +20 -35
- package/lib/core/configuration/locale.cjs +36 -71
- package/lib/core/configuration/locale.js +36 -70
- package/lib/core/configuration/push.cjs +16 -0
- package/lib/core/configuration/push.js +10 -0
- package/lib/core/configuration/webchat.cjs +142 -182
- package/lib/core/configuration/webchat.js +145 -189
- package/lib/core/configuration/whatsapp.cjs +76 -102
- package/lib/core/configuration/whatsapp.js +76 -105
- package/lib/core/configuration.cjs +62 -75
- package/lib/core/configuration.js +61 -75
- package/lib/core/event.cjs +36 -59
- package/lib/core/event.js +35 -61
- package/lib/core/sanitize_html.js +4 -4
- package/lib/errors/invalid_event.cjs +5 -26
- package/lib/errors/invalid_event.js +5 -26
- package/lib/errors/not_initialized_error.cjs +5 -26
- package/lib/errors/not_initialized_error.js +5 -26
- package/lib/hellotext.cjs +186 -211
- package/lib/hellotext.js +189 -236
- package/lib/index.js +1 -1
- package/lib/models/business.cjs +115 -152
- package/lib/models/business.js +118 -162
- package/lib/models/cookies.cjs +34 -51
- package/lib/models/cookies.js +34 -51
- package/lib/models/fingerprint.cjs +8 -23
- package/lib/models/fingerprint.js +25 -58
- package/lib/models/form.cjs +106 -142
- package/lib/models/form.js +105 -153
- package/lib/models/form_collection.cjs +63 -101
- package/lib/models/form_collection.js +61 -107
- package/lib/models/index.cjs +7 -0
- package/lib/models/index.js +1 -0
- package/lib/models/page.cjs +106 -129
- package/lib/models/page.js +106 -131
- package/lib/models/push.cjs +345 -0
- package/lib/models/push.js +339 -0
- package/lib/models/query.cjs +21 -41
- package/lib/models/query.js +21 -41
- package/lib/models/session.cjs +33 -65
- package/lib/models/session.js +30 -63
- package/lib/models/user.cjs +29 -51
- package/lib/models/user.js +29 -51
- package/lib/models/utm.cjs +15 -27
- package/lib/models/utm.js +17 -32
- package/lib/models/webchat.cjs +52 -76
- package/lib/models/webchat.js +52 -90
- package/lib/models/whatsapp_widget.cjs +41 -59
- package/lib/models/whatsapp_widget.js +41 -73
- package/lib/vanilla.cjs +4 -7
- package/lib/vanilla.js +2 -1
- package/package.json +2 -10
- package/src/api/index.js +5 -0
- package/src/api/push/identities.js +42 -0
- package/src/core/configuration/push.js +12 -0
- package/src/core/configuration.js +5 -0
- package/src/hellotext.js +15 -1
- package/src/index.bundle.js +0 -1
- package/src/models/business.js +1 -0
- package/src/models/index.js +1 -0
- package/src/models/push.js +397 -0
- package/src/vanilla.js +2 -1
- package/styles/index.css +0 -30
package/lib/core/event.js
CHANGED
|
@@ -1,67 +1,41 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5
|
-
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); } }
|
|
6
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
7
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
8
|
-
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); }
|
|
9
1
|
import { InvalidEvent } from '../errors';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
export default class Event {
|
|
3
|
+
static events = ['session-set', 'utm-set', 'forms:collected', 'form:completed', 'webchat:mounted', 'webchat:opened', 'webchat:closed', 'webchat:message:sent', 'webchat:message:received', 'cart.added'];
|
|
4
|
+
static valid(name) {
|
|
5
|
+
return Event.exists(name);
|
|
6
|
+
}
|
|
7
|
+
static invalid(name) {
|
|
8
|
+
return !this.valid(name);
|
|
9
|
+
}
|
|
10
|
+
static exists(name) {
|
|
11
|
+
return this.events.find(eventName => eventName === name) !== undefined;
|
|
12
|
+
}
|
|
13
|
+
constructor() {
|
|
13
14
|
this.subscribers = {};
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (Event.invalid(eventName)) {
|
|
19
|
-
throw new InvalidEvent(eventName);
|
|
20
|
-
}
|
|
21
|
-
this.subscribers = _objectSpread(_objectSpread({}, this.subscribers), {}, {
|
|
22
|
-
[eventName]: this.subscribers[eventName] ? [...this.subscribers[eventName], callback] : [callback]
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}, {
|
|
26
|
-
key: "removeSubscriber",
|
|
27
|
-
value: function removeSubscriber(eventName, callback) {
|
|
28
|
-
if (Event.invalid(eventName)) {
|
|
29
|
-
throw new InvalidEvent(eventName);
|
|
30
|
-
}
|
|
31
|
-
if (this.subscribers[eventName]) {
|
|
32
|
-
this.subscribers[eventName] = this.subscribers[eventName].filter(cb => cb !== callback);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
key: "dispatch",
|
|
37
|
-
value: function dispatch(eventName, data) {
|
|
38
|
-
var _this$subscribers$eve;
|
|
39
|
-
(_this$subscribers$eve = this.subscribers[eventName]) === null || _this$subscribers$eve === void 0 ? void 0 : _this$subscribers$eve.forEach(subscriber => {
|
|
40
|
-
subscriber(data);
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}, {
|
|
44
|
-
key: "listeners",
|
|
45
|
-
get: function get() {
|
|
46
|
-
return Object.keys(this.subscribers).length !== 0;
|
|
16
|
+
addSubscriber(eventName, callback) {
|
|
17
|
+
if (Event.invalid(eventName)) {
|
|
18
|
+
throw new InvalidEvent(eventName);
|
|
47
19
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return !this.valid(name);
|
|
20
|
+
this.subscribers = {
|
|
21
|
+
...this.subscribers,
|
|
22
|
+
[eventName]: this.subscribers[eventName] ? [...this.subscribers[eventName], callback] : [callback]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
removeSubscriber(eventName, callback) {
|
|
26
|
+
if (Event.invalid(eventName)) {
|
|
27
|
+
throw new InvalidEvent(eventName);
|
|
57
28
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
value: function exists(name) {
|
|
61
|
-
return this.events.find(eventName => eventName === name) !== undefined;
|
|
29
|
+
if (this.subscribers[eventName]) {
|
|
30
|
+
this.subscribers[eventName] = this.subscribers[eventName].filter(cb => cb !== callback);
|
|
62
31
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
32
|
+
}
|
|
33
|
+
dispatch(eventName, data) {
|
|
34
|
+
this.subscribers[eventName]?.forEach(subscriber => {
|
|
35
|
+
subscriber(data);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
get listeners() {
|
|
39
|
+
return Object.keys(this.subscribers).length !== 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DOMPurify from 'dompurify';
|
|
2
|
-
|
|
2
|
+
const RICH_TEXT_SANITIZER_OPTIONS = {
|
|
3
3
|
ADD_ATTR: ['target'],
|
|
4
4
|
ALLOW_DATA_ATTR: false,
|
|
5
5
|
RETURN_DOM_FRAGMENT: true,
|
|
@@ -7,7 +7,7 @@ var RICH_TEXT_SANITIZER_OPTIONS = {
|
|
|
7
7
|
html: true
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
const WEBCHAT_COMPONENT_SANITIZER_OPTIONS = {
|
|
11
11
|
ADD_ATTR: ['target'],
|
|
12
12
|
ADD_TAGS: ['hellotext-icon'],
|
|
13
13
|
RETURN_DOM_FRAGMENT: true,
|
|
@@ -17,9 +17,9 @@ var WEBCHAT_COMPONENT_SANITIZER_OPTIONS = {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
function sanitizedFragment(html, options) {
|
|
20
|
-
|
|
20
|
+
const fragment = DOMPurify.sanitize(html, options);
|
|
21
21
|
fragment.querySelectorAll('a[target="_blank"]').forEach(link => {
|
|
22
|
-
|
|
22
|
+
const rel = new Set(link.rel.split(/\s+/).filter(Boolean));
|
|
23
23
|
rel.add('noopener');
|
|
24
24
|
rel.add('noreferrer');
|
|
25
25
|
link.rel = Array.from(rel).join(' ');
|
|
@@ -4,31 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.InvalidEvent = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
15
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
17
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
18
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
-
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
20
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
let InvalidEvent = /*#__PURE__*/function (_Error) {
|
|
23
|
-
_inherits(InvalidEvent, _Error);
|
|
24
|
-
var _super = _createSuper(InvalidEvent);
|
|
25
|
-
function InvalidEvent(event) {
|
|
26
|
-
var _this;
|
|
27
|
-
_classCallCheck(this, InvalidEvent);
|
|
28
|
-
_this = _super.call(this, `${event} is not valid. Please provide a valid event name`);
|
|
29
|
-
_this.name = 'InvalidEvent';
|
|
30
|
-
return _this;
|
|
7
|
+
class InvalidEvent extends Error {
|
|
8
|
+
constructor(event) {
|
|
9
|
+
super(`${event} is not valid. Please provide a valid event name`);
|
|
10
|
+
this.name = 'InvalidEvent';
|
|
31
11
|
}
|
|
32
|
-
|
|
33
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
12
|
+
}
|
|
34
13
|
exports.InvalidEvent = InvalidEvent;
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
11
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
14
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
|
-
var InvalidEvent = /*#__PURE__*/function (_Error) {
|
|
17
|
-
_inherits(InvalidEvent, _Error);
|
|
18
|
-
var _super = _createSuper(InvalidEvent);
|
|
19
|
-
function InvalidEvent(event) {
|
|
20
|
-
var _this;
|
|
21
|
-
_classCallCheck(this, InvalidEvent);
|
|
22
|
-
_this = _super.call(this, "".concat(event, " is not valid. Please provide a valid event name"));
|
|
23
|
-
_this.name = 'InvalidEvent';
|
|
24
|
-
return _this;
|
|
1
|
+
class InvalidEvent extends Error {
|
|
2
|
+
constructor(event) {
|
|
3
|
+
super(`${event} is not valid. Please provide a valid event name`);
|
|
4
|
+
this.name = 'InvalidEvent';
|
|
25
5
|
}
|
|
26
|
-
|
|
27
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
6
|
+
}
|
|
28
7
|
export { InvalidEvent };
|
|
@@ -4,31 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.NotInitializedError = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
15
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
17
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
18
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19
|
-
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
20
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
let NotInitializedError = /*#__PURE__*/function (_Error) {
|
|
23
|
-
_inherits(NotInitializedError, _Error);
|
|
24
|
-
var _super = _createSuper(NotInitializedError);
|
|
25
|
-
function NotInitializedError() {
|
|
26
|
-
var _this;
|
|
27
|
-
_classCallCheck(this, NotInitializedError);
|
|
28
|
-
_this = _super.call(this, 'You need to initialize before tracking events. Call Hellotext.initialize and pass your public business id');
|
|
29
|
-
_this.name = 'NotInitializedError';
|
|
30
|
-
return _this;
|
|
7
|
+
class NotInitializedError extends Error {
|
|
8
|
+
constructor() {
|
|
9
|
+
super('You need to initialize before tracking events. Call Hellotext.initialize and pass your public business id');
|
|
10
|
+
this.name = 'NotInitializedError';
|
|
31
11
|
}
|
|
32
|
-
|
|
33
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
12
|
+
}
|
|
34
13
|
exports.NotInitializedError = NotInitializedError;
|
|
@@ -1,28 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
7
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
9
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
10
|
-
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
|
|
11
|
-
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
|
|
12
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
|
-
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
|
|
14
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
15
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
|
-
var NotInitializedError = /*#__PURE__*/function (_Error) {
|
|
17
|
-
_inherits(NotInitializedError, _Error);
|
|
18
|
-
var _super = _createSuper(NotInitializedError);
|
|
19
|
-
function NotInitializedError() {
|
|
20
|
-
var _this;
|
|
21
|
-
_classCallCheck(this, NotInitializedError);
|
|
22
|
-
_this = _super.call(this, 'You need to initialize before tracking events. Call Hellotext.initialize and pass your public business id');
|
|
23
|
-
_this.name = 'NotInitializedError';
|
|
24
|
-
return _this;
|
|
1
|
+
class NotInitializedError extends Error {
|
|
2
|
+
constructor() {
|
|
3
|
+
super('You need to initialize before tracking events. Call Hellotext.initialize and pass your public business id');
|
|
4
|
+
this.name = 'NotInitializedError';
|
|
25
5
|
}
|
|
26
|
-
|
|
27
|
-
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
6
|
+
}
|
|
28
7
|
export { NotInitializedError };
|