@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.
- package/README.md +0 -25
- package/dist/hellotext.js +1 -1
- package/index.d.ts +0 -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 +25 -51
- package/lib/api/index.js +27 -54
- package/lib/api/push/identities.cjs +30 -46
- package/lib/api/push/identities.js +30 -63
- 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 +9 -21
- package/lib/core/configuration/push.js +8 -20
- 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 +60 -78
- package/lib/core/configuration.js +59 -78
- 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 +185 -223
- package/lib/hellotext.js +188 -247
- package/lib/index.js +1 -1
- package/lib/models/business.cjs +114 -152
- package/lib/models/business.js +117 -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/page.cjs +106 -129
- package/lib/models/page.js +106 -131
- package/lib/models/push.cjs +278 -322
- package/lib/models/push.js +284 -357
- 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 +1 -9
- package/src/index.bundle.js +0 -1
- package/src/vanilla.js +2 -1
- package/styles/index.css +0 -30
|
@@ -4,11 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Forms = 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
7
|
/**
|
|
13
8
|
* @class Forms
|
|
14
9
|
* @classdesc
|
|
@@ -16,34 +11,25 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
16
11
|
* @property {Boolean} autoMount - whether to auto mount forms
|
|
17
12
|
* @property {Boolean|String} successMessage - whether to show success message after form completion or not
|
|
18
13
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Object.entries(props).forEach(([key, value]) => {
|
|
34
|
-
this[key] = value;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return this;
|
|
38
|
-
}
|
|
39
|
-
}, {
|
|
40
|
-
key: "shouldShowSuccessMessage",
|
|
41
|
-
get: function () {
|
|
42
|
-
return this.successMessage;
|
|
14
|
+
class Forms {
|
|
15
|
+
static autoMount = true;
|
|
16
|
+
static successMessage = true;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} props
|
|
20
|
+
* @param {Boolean} [props.autoMount=true] - whether to auto mount forms
|
|
21
|
+
* @param {Boolean|String} [props.successMessage=true] - whether to show success message after form completion or not
|
|
22
|
+
*/
|
|
23
|
+
static assign(props) {
|
|
24
|
+
if (props) {
|
|
25
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
26
|
+
this[key] = value;
|
|
27
|
+
});
|
|
43
28
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
static get shouldShowSuccessMessage() {
|
|
32
|
+
return this.successMessage;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.Forms = Forms;
|
|
@@ -1,8 +1,3 @@
|
|
|
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
1
|
/**
|
|
7
2
|
* @class Forms
|
|
8
3
|
* @classdesc
|
|
@@ -10,35 +5,25 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
10
5
|
* @property {Boolean} autoMount - whether to auto mount forms
|
|
11
6
|
* @property {Boolean|String} successMessage - whether to show success message after form completion or not
|
|
12
7
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Object.entries(props).forEach(_ref => {
|
|
28
|
-
var [key, value] = _ref;
|
|
29
|
-
this[key] = value;
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
}, {
|
|
35
|
-
key: "shouldShowSuccessMessage",
|
|
36
|
-
get: function get() {
|
|
37
|
-
return this.successMessage;
|
|
8
|
+
class Forms {
|
|
9
|
+
static autoMount = true;
|
|
10
|
+
static successMessage = true;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @param {Object} props
|
|
14
|
+
* @param {Boolean} [props.autoMount=true] - whether to auto mount forms
|
|
15
|
+
* @param {Boolean|String} [props.successMessage=true] - whether to show success message after form completion or not
|
|
16
|
+
*/
|
|
17
|
+
static assign(props) {
|
|
18
|
+
if (props) {
|
|
19
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
20
|
+
this[key] = value;
|
|
21
|
+
});
|
|
38
22
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
static get shouldShowSuccessMessage() {
|
|
26
|
+
return this.successMessage;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
44
29
|
export { Forms };
|
|
@@ -4,17 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Locale = 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
|
-
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
|
|
13
|
-
var id = 0;
|
|
14
|
-
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
|
|
15
|
-
var _fromHtmlLangProperty = /*#__PURE__*/_classPrivateFieldLooseKey("fromHtmlLangProperty");
|
|
16
|
-
var _fromMetaTag = /*#__PURE__*/_classPrivateFieldLooseKey("fromMetaTag");
|
|
17
|
-
var _fromBrowserLanguage = /*#__PURE__*/_classPrivateFieldLooseKey("fromBrowserLanguage");
|
|
18
7
|
/**
|
|
19
8
|
* @class Locale
|
|
20
9
|
* @classdesc
|
|
@@ -22,66 +11,42 @@ var _fromBrowserLanguage = /*#__PURE__*/_classPrivateFieldLooseKey("fromBrowserL
|
|
|
22
11
|
* Provides automatic locale detection from HTML lang attribute, meta tags,
|
|
23
12
|
* and browser language with fallback to 'en'.
|
|
24
13
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
class Locale {
|
|
15
|
+
static _identifier;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Sets the locale identifier explicitly.
|
|
19
|
+
* @param {string} value - The locale identifier (e.g., 'en', 'es')
|
|
20
|
+
*/
|
|
21
|
+
static set identifier(value) {
|
|
22
|
+
this._identifier = value;
|
|
28
23
|
}
|
|
29
|
-
_createClass(Locale, null, [{
|
|
30
|
-
key: "identifier",
|
|
31
|
-
get:
|
|
32
|
-
/**
|
|
33
|
-
* Gets the effective locale identifier.
|
|
34
|
-
* Falls back to auto-detection if not explicitly set.
|
|
35
|
-
* @returns {string} The locale identifier
|
|
36
|
-
*/
|
|
37
|
-
function () {
|
|
38
|
-
if (this._identifier) return this._identifier;
|
|
39
|
-
return _classPrivateFieldLooseBase(this, _fromHtmlLangProperty)[_fromHtmlLangProperty] || _classPrivateFieldLooseBase(this, _fromMetaTag)[_fromMetaTag] || _classPrivateFieldLooseBase(this, _fromBrowserLanguage)[_fromBrowserLanguage] || 'en';
|
|
40
|
-
}
|
|
41
24
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var _document2, _document2$querySelec;
|
|
69
|
-
return (_document2 = document) === null || _document2 === void 0 ? void 0 : (_document2$querySelec = _document2.querySelector('meta[name="locale"]')) === null || _document2$querySelec === void 0 ? void 0 : _document2$querySelec.content;
|
|
70
|
-
}
|
|
71
|
-
function _get_fromBrowserLanguage() {
|
|
72
|
-
var _navigator, _navigator$language;
|
|
73
|
-
return (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$language = _navigator.language) === null || _navigator$language === void 0 ? void 0 : _navigator$language.split('-')[0]; // Extract primary language
|
|
25
|
+
/**
|
|
26
|
+
* Gets the effective locale identifier.
|
|
27
|
+
* Falls back to auto-detection if not explicitly set.
|
|
28
|
+
* @returns {string} The locale identifier
|
|
29
|
+
*/
|
|
30
|
+
static get identifier() {
|
|
31
|
+
if (this._identifier) return this._identifier;
|
|
32
|
+
return this.#fromHtmlLangProperty || this.#fromMetaTag || this.#fromBrowserLanguage || 'en';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns the locale identifier as a string.
|
|
37
|
+
* @returns {string} The locale identifier
|
|
38
|
+
*/
|
|
39
|
+
static toString() {
|
|
40
|
+
return this.identifier;
|
|
41
|
+
}
|
|
42
|
+
static get #fromHtmlLangProperty() {
|
|
43
|
+
return document?.documentElement?.lang;
|
|
44
|
+
}
|
|
45
|
+
static get #fromMetaTag() {
|
|
46
|
+
return document?.querySelector('meta[name="locale"]')?.content;
|
|
47
|
+
}
|
|
48
|
+
static get #fromBrowserLanguage() {
|
|
49
|
+
return navigator?.language?.split('-')[0]; // Extract primary language
|
|
50
|
+
}
|
|
74
51
|
}
|
|
75
|
-
|
|
76
|
-
get: _get_fromBrowserLanguage,
|
|
77
|
-
set: void 0
|
|
78
|
-
});
|
|
79
|
-
Object.defineProperty(Locale, _fromMetaTag, {
|
|
80
|
-
get: _get_fromMetaTag,
|
|
81
|
-
set: void 0
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(Locale, _fromHtmlLangProperty, {
|
|
84
|
-
get: _get_fromHtmlLangProperty,
|
|
85
|
-
set: void 0
|
|
86
|
-
});
|
|
87
|
-
Locale._identifier = void 0;
|
|
52
|
+
exports.Locale = Locale;
|
|
@@ -1,14 +1,3 @@
|
|
|
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
|
-
function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }
|
|
7
|
-
var id = 0;
|
|
8
|
-
function _classPrivateFieldLooseKey(name) { return "__private_" + id++ + "_" + name; }
|
|
9
|
-
var _fromHtmlLangProperty = /*#__PURE__*/_classPrivateFieldLooseKey("fromHtmlLangProperty");
|
|
10
|
-
var _fromMetaTag = /*#__PURE__*/_classPrivateFieldLooseKey("fromMetaTag");
|
|
11
|
-
var _fromBrowserLanguage = /*#__PURE__*/_classPrivateFieldLooseKey("fromBrowserLanguage");
|
|
12
1
|
/**
|
|
13
2
|
* @class Locale
|
|
14
3
|
* @classdesc
|
|
@@ -16,66 +5,43 @@ var _fromBrowserLanguage = /*#__PURE__*/_classPrivateFieldLooseKey("fromBrowserL
|
|
|
16
5
|
* Provides automatic locale detection from HTML lang attribute, meta tags,
|
|
17
6
|
* and browser language with fallback to 'en'.
|
|
18
7
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
8
|
+
class Locale {
|
|
9
|
+
static _identifier;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Sets the locale identifier explicitly.
|
|
13
|
+
* @param {string} value - The locale identifier (e.g., 'en', 'es')
|
|
14
|
+
*/
|
|
15
|
+
static set identifier(value) {
|
|
16
|
+
this._identifier = value;
|
|
22
17
|
}
|
|
23
|
-
_createClass(Locale, null, [{
|
|
24
|
-
key: "identifier",
|
|
25
|
-
get:
|
|
26
|
-
/**
|
|
27
|
-
* Gets the effective locale identifier.
|
|
28
|
-
* Falls back to auto-detection if not explicitly set.
|
|
29
|
-
* @returns {string} The locale identifier
|
|
30
|
-
*/
|
|
31
|
-
function get() {
|
|
32
|
-
if (this._identifier) return this._identifier;
|
|
33
|
-
return _classPrivateFieldLooseBase(this, _fromHtmlLangProperty)[_fromHtmlLangProperty] || _classPrivateFieldLooseBase(this, _fromMetaTag)[_fromMetaTag] || _classPrivateFieldLooseBase(this, _fromBrowserLanguage)[_fromBrowserLanguage] || 'en';
|
|
34
|
-
}
|
|
35
18
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return (_document2 = document) === null || _document2 === void 0 ? void 0 : (_document2$querySelec = _document2.querySelector('meta[name="locale"]')) === null || _document2$querySelec === void 0 ? void 0 : _document2$querySelec.content;
|
|
63
|
-
}
|
|
64
|
-
function _get_fromBrowserLanguage() {
|
|
65
|
-
var _navigator, _navigator$language;
|
|
66
|
-
return (_navigator = navigator) === null || _navigator === void 0 ? void 0 : (_navigator$language = _navigator.language) === null || _navigator$language === void 0 ? void 0 : _navigator$language.split('-')[0]; // Extract primary language
|
|
19
|
+
/**
|
|
20
|
+
* Gets the effective locale identifier.
|
|
21
|
+
* Falls back to auto-detection if not explicitly set.
|
|
22
|
+
* @returns {string} The locale identifier
|
|
23
|
+
*/
|
|
24
|
+
static get identifier() {
|
|
25
|
+
if (this._identifier) return this._identifier;
|
|
26
|
+
return this.#fromHtmlLangProperty || this.#fromMetaTag || this.#fromBrowserLanguage || 'en';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns the locale identifier as a string.
|
|
31
|
+
* @returns {string} The locale identifier
|
|
32
|
+
*/
|
|
33
|
+
static toString() {
|
|
34
|
+
return this.identifier;
|
|
35
|
+
}
|
|
36
|
+
static get #fromHtmlLangProperty() {
|
|
37
|
+
return document?.documentElement?.lang;
|
|
38
|
+
}
|
|
39
|
+
static get #fromMetaTag() {
|
|
40
|
+
return document?.querySelector('meta[name="locale"]')?.content;
|
|
41
|
+
}
|
|
42
|
+
static get #fromBrowserLanguage() {
|
|
43
|
+
return navigator?.language?.split('-')[0]; // Extract primary language
|
|
44
|
+
}
|
|
67
45
|
}
|
|
68
|
-
|
|
69
|
-
get: _get_fromBrowserLanguage,
|
|
70
|
-
set: void 0
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(Locale, _fromMetaTag, {
|
|
73
|
-
get: _get_fromMetaTag,
|
|
74
|
-
set: void 0
|
|
75
|
-
});
|
|
76
|
-
Object.defineProperty(Locale, _fromHtmlLangProperty, {
|
|
77
|
-
get: _get_fromHtmlLangProperty,
|
|
78
|
-
set: void 0
|
|
79
|
-
});
|
|
80
|
-
Locale._identifier = void 0;
|
|
46
|
+
|
|
81
47
|
export { Locale };
|
|
@@ -4,25 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Push = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
_classCallCheck(this, Push);
|
|
7
|
+
class Push {
|
|
8
|
+
static serviceWorkerUrl = null;
|
|
9
|
+
static channelId = null;
|
|
10
|
+
static assign(props) {
|
|
11
|
+
this.serviceWorkerUrl = props?.serviceWorkerUrl || null;
|
|
12
|
+
this.channelId = props?.channelId || null;
|
|
13
|
+
return this;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
|
|
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;
|
|
15
|
+
}
|
|
16
|
+
exports.Push = Push;
|
|
@@ -1,22 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
_classCallCheck(this, Push);
|
|
1
|
+
class Push {
|
|
2
|
+
static serviceWorkerUrl = null;
|
|
3
|
+
static channelId = null;
|
|
4
|
+
static assign(props) {
|
|
5
|
+
this.serviceWorkerUrl = props?.serviceWorkerUrl || null;
|
|
6
|
+
this.channelId = props?.channelId || null;
|
|
7
|
+
return this;
|
|
9
8
|
}
|
|
10
|
-
|
|
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;
|
|
9
|
+
}
|
|
22
10
|
export { Push };
|