@braze/web-sdk 6.6.0 → 6.7.1
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/index.d.ts +253 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +21 -20
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +26 -26
- package/src/Banner/banner-factory.js +11 -1
- package/src/Banner/banner-provider.js +244 -120
- package/src/Banner/banner.js +14 -12
- package/src/Banner/display/banner-to-html.js +23 -16
- package/src/Banner/display/detect-banner-impressions.js +13 -13
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +4 -4
- package/src/Banner/log-banner-click.js +4 -4
- package/src/Banner/log-banner-dismissal.js +23 -0
- package/src/Banner/log-banner-impressions.js +7 -7
- package/src/Banner/request-banners-refresh.js +12 -16
- package/src/Banner/subscribe-to-banners-updates.js +6 -6
- package/src/Banner/ui/insert-banner.js +12 -12
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +33 -33
- package/src/Card/constants.js +1 -1
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +18 -18
- package/src/Card/util/card-factory.js +41 -41
- package/src/ContentCards/content-cards-provider-factory.js +12 -12
- package/src/ContentCards/content-cards-provider.js +151 -151
- package/src/ContentCards/content-cards.js +5 -5
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/show-content-cards.js +10 -10
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +9 -9
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +8 -8
- package/src/Core/log-purchase.js +5 -5
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-provider-factory.js +11 -11
- package/src/DUST/dust-provider.js +255 -255
- package/src/DUST/dust-shared-worker-impl.js +100 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/InAppMessage/constants.js +83 -2
- package/src/InAppMessage/display/html-message-display-utils.js +15 -15
- package/src/InAppMessage/display/html-message-to-html.js +36 -37
- package/src/InAppMessage/display/in-app-message-to-html.js +44 -44
- package/src/InAppMessage/display/modal-utils.js +10 -14
- package/src/InAppMessage/in-app-message-factory.js +16 -20
- package/src/InAppMessage/in-app-message-manager.js +115 -116
- package/src/InAppMessage/log-in-app-message-button-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +56 -49
- package/src/InAppMessage/models/html-message.js +31 -27
- package/src/InAppMessage/models/in-app-message-button.js +12 -12
- package/src/InAppMessage/models/in-app-message.js +202 -256
- package/src/InAppMessage/models/modal-message.js +55 -49
- package/src/InAppMessage/models/slide-up-message.js +57 -51
- package/src/InAppMessage/models/templated-in-app-message.js +10 -10
- package/src/InAppMessage/shared-types.js +1 -0
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +43 -41
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +9 -9
- package/src/Push/push-manager.js +15 -15
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +60 -59
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -1
- package/src/common/content-cards-display.js +38 -38
- package/src/common/event-logger.js +8 -8
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +197 -186
- package/src/managers/constants.js +1 -0
- package/src/managers/device-manager.js +25 -25
- package/src/managers/network-manager.js +155 -155
- package/src/managers/server-config-manager.js +106 -93
- package/src/managers/session-manager.js +37 -33
- package/src/managers/storage-manager-factory.js +33 -28
- package/src/managers/storage-manager.js +192 -170
- package/src/managers/subscription-manager.js +13 -13
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +13 -13
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +9 -9
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +29 -38
- package/src/request-controller.js +160 -164
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +12 -12
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +8 -8
- package/src/triggers/models/trigger-condition.js +58 -58
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +44 -44
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/component-utils.js +3 -3
- package/src/util/dom-utils.js +2 -2
- package/src/util/html-display-utils.js +11 -11
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +8 -8
- package/src/util/request-header-utils.js +25 -25
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +21 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,87 +1,89 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Ie from "../models/braze-event.js";
|
|
2
2
|
import _t from "../models/identifier.js";
|
|
3
3
|
import {
|
|
4
|
-
isArray as
|
|
5
|
-
keys as
|
|
4
|
+
isArray as g,
|
|
5
|
+
keys as D,
|
|
6
6
|
validateValueIsFromEnum as ta,
|
|
7
|
-
values as
|
|
7
|
+
values as Wt,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
|
-
import { logger as E, EventTypes as
|
|
9
|
+
import { logger as E, EventTypes as p } from "../../shared-lib/index.js";
|
|
10
10
|
import { User } from "../User/index.js";
|
|
11
11
|
import ro from "../util/browser-detector.js";
|
|
12
12
|
import { getErrorMessage as ai } from "../util/error-utils.js";
|
|
13
13
|
export const STORAGE_KEYS = {
|
|
14
14
|
Ou: {
|
|
15
15
|
Cu: "ab.storage.userId",
|
|
16
|
-
|
|
16
|
+
Wh: "ab.storage.deviceId",
|
|
17
17
|
um: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
Tt: {
|
|
20
|
+
_c: "ab.test",
|
|
21
|
+
QE: "ab.storage.events",
|
|
22
|
+
ZE: "ab.storage.attributes",
|
|
23
|
+
$E: "ab.storage.attributes.anonymous_user",
|
|
24
|
+
Ba: "ab.storage.device",
|
|
25
|
+
Ka: "ab.storage.sdk_metadata",
|
|
26
|
+
Pa: "ab.storage.session_id_for_cached_metadata",
|
|
27
27
|
Uu: "ab.storage.pushToken",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
tS: "ab.storage.cardImpressions",
|
|
29
|
+
tc: "ab.storage.serverConfig",
|
|
30
|
+
eS: "ab.storage.triggers",
|
|
31
|
+
sS: "ab.storage.triggers.ts",
|
|
32
32
|
dm: "ab.storage.messagingSessionStart",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
33
|
+
Ci: "ab.storage.cc",
|
|
34
|
+
gi: "ab.storage.ccLastFullSync",
|
|
35
|
+
ji: "ab.storage.ccLastCardUpdated",
|
|
36
|
+
Ml: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
37
|
+
Ll: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
38
|
+
ns: "ab.storage.ccClicks",
|
|
39
|
+
hs: "ab.storage.ccImpressions",
|
|
40
|
+
us: "ab.storage.ccDismissals",
|
|
41
|
+
rS: "ab.storage.lastDisplayedTriggerTimesById",
|
|
42
|
+
oS: "ab.storage.lastDisplayedTriggerTime",
|
|
43
|
+
nS: "ab.storage.triggerFireInstancesById",
|
|
44
|
+
fh: "ab.storage.signature",
|
|
45
|
+
aS: "ab.storage.brazeSyncRetryCount",
|
|
46
|
+
ki: "ab.storage.sdkVersion",
|
|
47
|
+
Fo: "ab.storage.ff",
|
|
48
|
+
jo: "ab.storage.ffImpressions",
|
|
49
|
+
qo: "ab.storage.ffLastRefreshAt",
|
|
50
|
+
Do: "ab.storage.ff.sessionId",
|
|
51
|
+
iS: "ab.storage.lastReqToEndpoint",
|
|
52
|
+
ES: "ab.storage.requestAttempts",
|
|
53
|
+
pa: "ab.storage.deferredIam",
|
|
54
|
+
Cl: "ab.storage.lastSdkReq",
|
|
55
|
+
SS: "ab.storage.alias",
|
|
56
|
+
St: "ab.storage.banners",
|
|
57
|
+
Wt: "ab.storage.banners.impressions",
|
|
58
|
+
Mt: "ab.storage.banners.dismissals",
|
|
59
|
+
_t: "ab.storage.banners.sessionId",
|
|
60
|
+
Gt: "ab.storage.banners.lastRequestedTime",
|
|
61
|
+
Ke: "ab.storage.dust.mite",
|
|
62
|
+
Qe: "ab.storage.dust.host",
|
|
63
|
+
Ve: "ab.storage.dust.auth",
|
|
64
|
+
Xe: "ab.storage.dust.expiration",
|
|
63
65
|
},
|
|
64
|
-
|
|
66
|
+
ce: "ab.optOut",
|
|
65
67
|
};
|
|
66
|
-
export default class
|
|
68
|
+
export default class ne {
|
|
67
69
|
constructor(t, e) {
|
|
68
|
-
(this.
|
|
70
|
+
(this.lS = t), (this._S = e), (this.lS = t), (this._S = e);
|
|
69
71
|
}
|
|
70
|
-
|
|
71
|
-
const e =
|
|
72
|
-
s = new
|
|
72
|
+
hl(t) {
|
|
73
|
+
const e = D(STORAGE_KEYS.Ou),
|
|
74
|
+
s = new ne.le(t);
|
|
73
75
|
for (const t of e) s.remove(STORAGE_KEYS.Ou[t]);
|
|
74
76
|
}
|
|
75
77
|
Iu(t, e) {
|
|
76
78
|
let s = null;
|
|
77
|
-
null != e && e instanceof _t && (s = e.
|
|
79
|
+
null != e && e instanceof _t && (s = e.qt()), this.lS.store(t, s);
|
|
78
80
|
}
|
|
79
|
-
|
|
81
|
+
uS(t) {
|
|
80
82
|
const e = this.$u(t);
|
|
81
|
-
null != e && ((e.
|
|
83
|
+
null != e && ((e.pm = new Date().valueOf()), this.Iu(t, e));
|
|
82
84
|
}
|
|
83
85
|
$u(t) {
|
|
84
|
-
const e = this.
|
|
86
|
+
const e = this.lS.wr(t),
|
|
85
87
|
s = ((t) => {
|
|
86
88
|
let e;
|
|
87
89
|
try {
|
|
@@ -94,16 +96,16 @@ export default class ee {
|
|
|
94
96
|
let r;
|
|
95
97
|
if (s) (r = _t._u(s) || null), r && this.Iu(t, r);
|
|
96
98
|
else {
|
|
97
|
-
const s = _t.
|
|
99
|
+
const s = _t.cS(e);
|
|
98
100
|
(r = _t._u(s) || null), s !== e && r && this.Iu(t, r);
|
|
99
101
|
}
|
|
100
102
|
return r;
|
|
101
103
|
}
|
|
102
|
-
|
|
103
|
-
this.
|
|
104
|
+
jm(t) {
|
|
105
|
+
this.lS.remove(t);
|
|
104
106
|
}
|
|
105
|
-
|
|
106
|
-
const t =
|
|
107
|
+
ll() {
|
|
108
|
+
const t = D(STORAGE_KEYS.Ou);
|
|
107
109
|
let e;
|
|
108
110
|
for (const s of t)
|
|
109
111
|
(e = this.$u(STORAGE_KEYS.Ou[s])),
|
|
@@ -112,24 +114,24 @@ export default class ee {
|
|
|
112
114
|
ol(t) {
|
|
113
115
|
let e;
|
|
114
116
|
if (null == t || 0 === t.length) return !1;
|
|
115
|
-
e =
|
|
116
|
-
let s = this.
|
|
117
|
-
(null != s &&
|
|
118
|
-
for (let t = 0; t < e.length; t++) s.push(e[t].
|
|
119
|
-
return this.
|
|
117
|
+
e = g(t) ? t : [t];
|
|
118
|
+
let s = this._S.wr(STORAGE_KEYS.Tt.QE);
|
|
119
|
+
(null != s && g(s)) || (s = []);
|
|
120
|
+
for (let t = 0; t < e.length; t++) s.push(e[t].qt());
|
|
121
|
+
return this._S.store(STORAGE_KEYS.Tt.QE, s);
|
|
120
122
|
}
|
|
121
|
-
|
|
123
|
+
gm(t) {
|
|
122
124
|
return null != t && this.ol([t]);
|
|
123
125
|
}
|
|
124
|
-
|
|
125
|
-
let t = this.
|
|
126
|
-
this.
|
|
126
|
+
TS() {
|
|
127
|
+
let t = this._S.wr(STORAGE_KEYS.Tt.QE);
|
|
128
|
+
this._S.remove(STORAGE_KEYS.Tt.QE), null == t && (t = []);
|
|
127
129
|
const e = [];
|
|
128
130
|
let s = !1,
|
|
129
131
|
r = null;
|
|
130
|
-
if (
|
|
132
|
+
if (g(t))
|
|
131
133
|
for (let s = 0; s < t.length; s++)
|
|
132
|
-
|
|
134
|
+
Ie.hS(t[s]) ? e.push(Ie._u(t[s])) : (r = s);
|
|
133
135
|
else s = !0;
|
|
134
136
|
if (s || null != r) {
|
|
135
137
|
let o = "Stored events could not be deserialized as Events";
|
|
@@ -142,129 +144,129 @@ export default class ee {
|
|
|
142
144
|
typeof t +
|
|
143
145
|
": " +
|
|
144
146
|
JSON.stringify(t)),
|
|
145
|
-
e.push(new
|
|
147
|
+
e.push(new Ie(null, p.Ya, new Date().valueOf(), null, { e: o }));
|
|
146
148
|
}
|
|
147
149
|
return e;
|
|
148
150
|
}
|
|
149
|
-
|
|
151
|
+
It(t, e) {
|
|
150
152
|
return (
|
|
151
153
|
!!ta(
|
|
152
|
-
STORAGE_KEYS.
|
|
154
|
+
STORAGE_KEYS.Tt,
|
|
153
155
|
t,
|
|
154
156
|
"StorageManager cannot store object.",
|
|
155
157
|
"STORAGE_KEYS.OBJECTS",
|
|
156
|
-
) && this.
|
|
158
|
+
) && this._S.store(t, e)
|
|
157
159
|
);
|
|
158
160
|
}
|
|
159
|
-
|
|
161
|
+
Rt(t) {
|
|
160
162
|
return (
|
|
161
163
|
!!ta(
|
|
162
|
-
STORAGE_KEYS.
|
|
164
|
+
STORAGE_KEYS.Tt,
|
|
163
165
|
t,
|
|
164
166
|
"StorageManager cannot retrieve object.",
|
|
165
167
|
"STORAGE_KEYS.OBJECTS",
|
|
166
|
-
) && this.
|
|
168
|
+
) && this._S.wr(t)
|
|
167
169
|
);
|
|
168
170
|
}
|
|
169
|
-
|
|
171
|
+
Qt(t) {
|
|
170
172
|
return (
|
|
171
173
|
!!ta(
|
|
172
|
-
STORAGE_KEYS.
|
|
174
|
+
STORAGE_KEYS.Tt,
|
|
173
175
|
t,
|
|
174
176
|
"StorageManager cannot remove object.",
|
|
175
177
|
"STORAGE_KEYS.OBJECTS",
|
|
176
|
-
) && (this.
|
|
178
|
+
) && (this._S.remove(t), !0)
|
|
177
179
|
);
|
|
178
180
|
}
|
|
179
181
|
clearData() {
|
|
180
|
-
const t =
|
|
181
|
-
e =
|
|
182
|
+
const t = D(STORAGE_KEYS.Ou),
|
|
183
|
+
e = D(STORAGE_KEYS.Tt);
|
|
182
184
|
for (let e = 0; e < t.length; e++) {
|
|
183
185
|
const s = t[e];
|
|
184
|
-
this.
|
|
186
|
+
this.lS.remove(STORAGE_KEYS.Ou[s]);
|
|
185
187
|
}
|
|
186
188
|
for (let t = 0; t < e.length; t++) {
|
|
187
189
|
const s = e[t];
|
|
188
|
-
this.
|
|
190
|
+
this._S.remove(STORAGE_KEYS.Tt[s]);
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
|
-
|
|
192
|
-
return t || STORAGE_KEYS.
|
|
193
|
+
AS(t) {
|
|
194
|
+
return t || STORAGE_KEYS.Tt.$E;
|
|
193
195
|
}
|
|
194
|
-
|
|
195
|
-
let e = this.
|
|
196
|
+
vl(t) {
|
|
197
|
+
let e = this._S.wr(STORAGE_KEYS.Tt.ZE);
|
|
196
198
|
null == e && (e = {});
|
|
197
|
-
const s = this.
|
|
199
|
+
const s = this.AS(t[User.Sa]),
|
|
198
200
|
r = e[s];
|
|
199
201
|
for (const o in t)
|
|
200
|
-
o !== User.
|
|
202
|
+
o !== User.Sa &&
|
|
201
203
|
(null == e[s] || (r && null == r[o])) &&
|
|
202
|
-
this.Eu(t[User.
|
|
204
|
+
this.Eu(t[User.Sa], o, t[o]);
|
|
203
205
|
}
|
|
204
206
|
Eu(t, e, s) {
|
|
205
|
-
let r = this.
|
|
207
|
+
let r = this._S.wr(STORAGE_KEYS.Tt.ZE);
|
|
206
208
|
null == r && (r = {});
|
|
207
|
-
const o = this.
|
|
209
|
+
const o = this.AS(t);
|
|
208
210
|
let n = r[o];
|
|
209
211
|
if (
|
|
210
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
212
|
+
(null == n && ((n = {}), null != t && (n[User.Sa] = t)), e === User.Bu)
|
|
211
213
|
) {
|
|
212
214
|
null == n[e] && (n[e] = {});
|
|
213
215
|
for (const t in s) n[e][t] = s[t];
|
|
214
216
|
} else n[e] = s;
|
|
215
|
-
return (r[o] = n), this.
|
|
217
|
+
return (r[o] = n), this._S.store(STORAGE_KEYS.Tt.ZE, r);
|
|
216
218
|
}
|
|
217
|
-
|
|
218
|
-
const t = this.
|
|
219
|
-
this.
|
|
219
|
+
gS() {
|
|
220
|
+
const t = this._S.wr(STORAGE_KEYS.Tt.ZE);
|
|
221
|
+
this._S.remove(STORAGE_KEYS.Tt.ZE);
|
|
220
222
|
const e = [];
|
|
221
223
|
for (const s in t) null != t[s] && e.push(t[s]);
|
|
222
224
|
return e;
|
|
223
225
|
}
|
|
224
226
|
Lu(t) {
|
|
225
|
-
const e = this.
|
|
227
|
+
const e = this._S.wr(STORAGE_KEYS.Tt.ZE);
|
|
226
228
|
if (null != e) {
|
|
227
|
-
const s = this.
|
|
229
|
+
const s = this.AS(null),
|
|
228
230
|
r = e[s];
|
|
229
231
|
null != r &&
|
|
230
232
|
((e[s] = void 0),
|
|
231
|
-
this.
|
|
232
|
-
(r[User.
|
|
233
|
-
this.
|
|
233
|
+
this._S.store(STORAGE_KEYS.Tt.ZE, e),
|
|
234
|
+
(r[User.Sa] = t),
|
|
235
|
+
this.vl(r));
|
|
234
236
|
}
|
|
235
237
|
const s = this.$u(STORAGE_KEYS.Ou.um);
|
|
236
238
|
let r = null;
|
|
237
239
|
null != s && (r = s.Tu);
|
|
238
|
-
const o = this.
|
|
240
|
+
const o = this.TS();
|
|
239
241
|
if (null != o)
|
|
240
242
|
for (let e = 0; e < o.length; e++) {
|
|
241
243
|
const s = o[e];
|
|
242
|
-
null == s.userId && s.sessionId == r && (s.userId = t), this.
|
|
244
|
+
null == s.userId && s.sessionId == r && (s.userId = t), this.gm(s);
|
|
243
245
|
}
|
|
244
246
|
}
|
|
245
|
-
|
|
246
|
-
return this.
|
|
247
|
+
RS() {
|
|
248
|
+
return this._S.dS;
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
|
-
(
|
|
251
|
+
(ne.wc = class {
|
|
250
252
|
constructor(t) {
|
|
251
|
-
(this.tu = t), (this.tu = t), (this.
|
|
253
|
+
(this.tu = t), (this.tu = t), (this.dS = ro.IS() ? 3 : 10);
|
|
252
254
|
}
|
|
253
|
-
|
|
255
|
+
bS(t) {
|
|
254
256
|
return t + "." + this.tu;
|
|
255
257
|
}
|
|
256
258
|
store(t, e) {
|
|
257
259
|
const s = { v: e };
|
|
258
260
|
try {
|
|
259
|
-
return localStorage.setItem(this.
|
|
261
|
+
return localStorage.setItem(this.bS(t), JSON.stringify(s)), !0;
|
|
260
262
|
} catch (t) {
|
|
261
263
|
return E.info("Storage failure: " + ai(t)), !1;
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
|
-
|
|
266
|
+
wr(t) {
|
|
265
267
|
try {
|
|
266
268
|
let e = null;
|
|
267
|
-
const s = localStorage.getItem(this.
|
|
269
|
+
const s = localStorage.getItem(this.bS(t));
|
|
268
270
|
return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
|
|
269
271
|
} catch (t) {
|
|
270
272
|
return E.info("Storage retrieval failure: " + ai(t)), null;
|
|
@@ -272,30 +274,30 @@ export default class ee {
|
|
|
272
274
|
}
|
|
273
275
|
remove(t) {
|
|
274
276
|
try {
|
|
275
|
-
localStorage.removeItem(this.
|
|
277
|
+
localStorage.removeItem(this.bS(t));
|
|
276
278
|
} catch (t) {
|
|
277
279
|
return E.info("Storage removal failure: " + ai(t)), !1;
|
|
278
280
|
}
|
|
279
281
|
}
|
|
280
282
|
}),
|
|
281
|
-
(
|
|
283
|
+
(ne.Rc = class {
|
|
282
284
|
constructor() {
|
|
283
|
-
(this.
|
|
285
|
+
(this.fS = {}), (this.mS = 5242880), (this.dS = 3);
|
|
284
286
|
}
|
|
285
287
|
store(t, e) {
|
|
286
288
|
const s = { value: e },
|
|
287
|
-
r = this.
|
|
288
|
-
return r > this.
|
|
289
|
+
r = this.KS(e);
|
|
290
|
+
return r > this.mS
|
|
289
291
|
? (E.info(
|
|
290
292
|
"Storage failure: object is ≈" +
|
|
291
293
|
r +
|
|
292
294
|
" bytes which is greater than the max of " +
|
|
293
|
-
this.
|
|
295
|
+
this.mS,
|
|
294
296
|
),
|
|
295
297
|
!1)
|
|
296
|
-
: ((this.
|
|
298
|
+
: ((this.fS[t] = s), !0);
|
|
297
299
|
}
|
|
298
|
-
|
|
300
|
+
KS(t) {
|
|
299
301
|
const e = [],
|
|
300
302
|
s = [t];
|
|
301
303
|
let r = 0;
|
|
@@ -312,24 +314,24 @@ export default class ee {
|
|
|
312
314
|
}
|
|
313
315
|
return r;
|
|
314
316
|
}
|
|
315
|
-
|
|
316
|
-
const e = this.
|
|
317
|
+
wr(t) {
|
|
318
|
+
const e = this.fS[t];
|
|
317
319
|
return null == e ? null : e.value;
|
|
318
320
|
}
|
|
319
321
|
remove(t) {
|
|
320
|
-
this.
|
|
322
|
+
this.fS[t] = null;
|
|
321
323
|
}
|
|
322
324
|
}),
|
|
323
|
-
(
|
|
325
|
+
(ne.le = class {
|
|
324
326
|
constructor(t, e, s) {
|
|
325
|
-
(this.tu = t), (this.
|
|
327
|
+
(this.tu = t), (this.YS = e), (this.tu = t), (this.NS = this.DS());
|
|
326
328
|
const r = "number" == typeof s && s > 0 ? s : 400;
|
|
327
|
-
(this.
|
|
329
|
+
(this.GS = 24 * r * 60), (this.CS = {}), (this.YS = !!e);
|
|
328
330
|
}
|
|
329
|
-
|
|
331
|
+
bS(t) {
|
|
330
332
|
return null != this.tu ? t + "." + this.tu : t;
|
|
331
333
|
}
|
|
332
|
-
|
|
334
|
+
DS() {
|
|
333
335
|
let t = 0,
|
|
334
336
|
e = document.location.hostname;
|
|
335
337
|
const s = e.split("."),
|
|
@@ -344,12 +346,12 @@ export default class ee {
|
|
|
344
346
|
e
|
|
345
347
|
);
|
|
346
348
|
}
|
|
347
|
-
|
|
349
|
+
me() {
|
|
348
350
|
const t = new Date();
|
|
349
|
-
return t.setTime(t.getTime() + 60 * this.
|
|
351
|
+
return t.setTime(t.getTime() + 60 * this.GS * 1e3), t.getFullYear();
|
|
350
352
|
}
|
|
351
|
-
|
|
352
|
-
const t =
|
|
353
|
+
MS() {
|
|
354
|
+
const t = Wt(STORAGE_KEYS.Ou),
|
|
353
355
|
e = document.cookie.split(";");
|
|
354
356
|
for (let s = 0; s < e.length; s++) {
|
|
355
357
|
let r = e[s];
|
|
@@ -362,31 +364,53 @@ export default class ee {
|
|
|
362
364
|
}
|
|
363
365
|
if (o) {
|
|
364
366
|
const t = r.split("=")[0];
|
|
365
|
-
-1 === t.indexOf("." + this.tu) && this.
|
|
367
|
+
-1 === t.indexOf("." + this.tu) && this.pS(t);
|
|
366
368
|
}
|
|
367
369
|
}
|
|
368
370
|
}
|
|
369
371
|
store(t, e) {
|
|
370
|
-
this.
|
|
371
|
-
const s =
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
372
|
+
this.MS();
|
|
373
|
+
const s = this.bS(t),
|
|
374
|
+
r = new Date();
|
|
375
|
+
r.setTime(r.getTime() + 60 * this.GS * 1e3);
|
|
376
|
+
const o = "expires=" + r.toUTCString(),
|
|
377
|
+
n = "domain=" + this.NS;
|
|
378
|
+
let a;
|
|
379
|
+
a = this.YS ? e : encodeURIComponent(e);
|
|
380
|
+
const i = s + "=" + a + ";" + o + ";" + n + ";path=/";
|
|
381
|
+
if (i.length >= 4093)
|
|
382
|
+
return (
|
|
383
|
+
E.info(
|
|
380
384
|
"Storage failure: string is " +
|
|
381
|
-
|
|
385
|
+
i.length +
|
|
382
386
|
" chars which is too large to store as a cookie.",
|
|
383
387
|
),
|
|
388
|
+
(this.CS[s] = !0),
|
|
389
|
+
this.pS(s),
|
|
390
|
+
!1
|
|
391
|
+
);
|
|
392
|
+
try {
|
|
393
|
+
document.cookie = i;
|
|
394
|
+
} catch (t) {
|
|
395
|
+
return E.info("Storage failure: " + ai(t)), (this.CS[s] = !0), !1;
|
|
396
|
+
}
|
|
397
|
+
const S = this.YS ? String(a) : decodeURIComponent(a);
|
|
398
|
+
return this.vS(s) !== S
|
|
399
|
+
? (E.info(
|
|
400
|
+
`Storage failure: unable to verify cookie write for "${s}". Falling back to other storage.`,
|
|
401
|
+
),
|
|
402
|
+
(this.CS[s] = !0),
|
|
403
|
+
this.pS(s),
|
|
384
404
|
!1)
|
|
385
|
-
: (
|
|
405
|
+
: (delete this.CS[s], !0);
|
|
406
|
+
}
|
|
407
|
+
wr(t) {
|
|
408
|
+
const e = this.bS(t);
|
|
409
|
+
return this.CS[e] ? null : this.vS(e);
|
|
386
410
|
}
|
|
387
|
-
|
|
411
|
+
vS(t) {
|
|
388
412
|
const e = [],
|
|
389
|
-
s =
|
|
413
|
+
s = t + "=",
|
|
390
414
|
r = document.cookie.split(";");
|
|
391
415
|
for (let o = 0; o < r.length; o++) {
|
|
392
416
|
let n = r[o];
|
|
@@ -394,52 +418,50 @@ export default class ee {
|
|
|
394
418
|
if (0 === n.indexOf(s))
|
|
395
419
|
try {
|
|
396
420
|
let t;
|
|
397
|
-
(t = this.
|
|
421
|
+
(t = this.YS
|
|
398
422
|
? n.substring(s.length, n.length)
|
|
399
423
|
: decodeURIComponent(n.substring(s.length, n.length))),
|
|
400
424
|
e.push(t);
|
|
401
425
|
} catch (e) {
|
|
402
426
|
return (
|
|
403
|
-
E.info("Storage retrieval failure: " + ai(e)),
|
|
404
|
-
this.remove(t),
|
|
405
|
-
null
|
|
427
|
+
E.info("Storage retrieval failure: " + ai(e)), this.pS(t), null
|
|
406
428
|
);
|
|
407
429
|
}
|
|
408
430
|
}
|
|
409
431
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
410
432
|
}
|
|
411
433
|
remove(t) {
|
|
412
|
-
this.
|
|
434
|
+
this.pS(this.bS(t));
|
|
413
435
|
}
|
|
414
|
-
|
|
436
|
+
pS(t) {
|
|
415
437
|
const e = t + "=;expires=" + new Date(0).toUTCString();
|
|
416
438
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
417
|
-
const s = e + ";domain=" + this.
|
|
439
|
+
const s = e + ";domain=" + this.NS;
|
|
418
440
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
419
441
|
}
|
|
420
442
|
}),
|
|
421
|
-
(
|
|
443
|
+
(ne.Ec = class {
|
|
422
444
|
constructor(t, e, s, r) {
|
|
423
445
|
(this.tu = t),
|
|
424
|
-
(this.
|
|
425
|
-
e && this.
|
|
426
|
-
s && this.
|
|
427
|
-
this.
|
|
446
|
+
(this.US = []),
|
|
447
|
+
e && this.US.push(new ne.le(t, void 0, r)),
|
|
448
|
+
s && this.US.push(new ne.wc(t)),
|
|
449
|
+
this.US.push(new ne.Rc());
|
|
428
450
|
}
|
|
429
451
|
store(t, e) {
|
|
430
452
|
let s = !0;
|
|
431
|
-
for (let r = 0; r < this.
|
|
453
|
+
for (let r = 0; r < this.US.length; r++) s = this.US[r].store(t, e) && s;
|
|
432
454
|
return s;
|
|
433
455
|
}
|
|
434
|
-
|
|
435
|
-
for (let e = 0; e < this.
|
|
436
|
-
const s = this.
|
|
456
|
+
wr(t) {
|
|
457
|
+
for (let e = 0; e < this.US.length; e++) {
|
|
458
|
+
const s = this.US[e].wr(t);
|
|
437
459
|
if (null != s) return s;
|
|
438
460
|
}
|
|
439
461
|
return null;
|
|
440
462
|
}
|
|
441
463
|
remove(t) {
|
|
442
|
-
new
|
|
443
|
-
for (let e = 0; e < this.
|
|
464
|
+
new ne.le(this.tu).remove(t);
|
|
465
|
+
for (let e = 0; e < this.US.length; e++) this.US[e].remove(t);
|
|
444
466
|
}
|
|
445
467
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Guid as
|
|
2
|
-
export default class
|
|
1
|
+
import { Guid as V } from "../../shared-lib/index.js";
|
|
2
|
+
export default class f {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this.In = {};
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
Kt(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
|
-
const i =
|
|
9
|
-
return (this.
|
|
8
|
+
const i = V.de();
|
|
9
|
+
return (this.In[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
12
|
-
delete this.
|
|
12
|
+
delete this.In[t];
|
|
13
13
|
}
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
|
-
this.
|
|
15
|
+
this.In = {};
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return Object.keys(this.
|
|
17
|
+
Le() {
|
|
18
|
+
return Object.keys(this.In).length;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
A(t) {
|
|
21
21
|
const i = [];
|
|
22
|
-
for (const s in this.
|
|
23
|
-
const r = this.
|
|
22
|
+
for (const s in this.In) {
|
|
23
|
+
const r = this.In[s];
|
|
24
24
|
i.push(r(t));
|
|
25
25
|
}
|
|
26
26
|
return i;
|
package/src/managers/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Va: "invalid_api_key",
|
|
3
|
+
Za: "blacklisted",
|
|
4
|
+
dl: "no_device_identifier",
|
|
5
|
+
Qa: "invalid_json_response",
|
|
6
|
+
Wa: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|