@braze/web-sdk 5.9.1 → 6.1.0
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 +209 -283
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +27 -29
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +22 -22
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +22 -23
- package/src/Banner/banner-factory.js +2 -1
- package/src/Banner/banner-provider-factory.js +7 -7
- package/src/Banner/banner-provider.js +92 -98
- package/src/Banner/banner.js +21 -18
- package/src/Banner/display/banner-to-html.js +18 -30
- package/src/Banner/display/detect-banner-impressions.js +11 -11
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +7 -7
- package/src/Banner/index.js +0 -1
- package/src/Banner/log-banner-click.js +7 -7
- package/src/Banner/log-banner-impressions.js +9 -9
- package/src/Banner/request-banners-refresh.js +23 -27
- package/src/Banner/subscribe-to-banners-updates.js +9 -9
- package/src/Banner/ui/insert-banner.js +10 -10
- package/src/Card/card-manager-factory.js +7 -7
- package/src/Card/card-manager.js +45 -47
- package/src/Card/display/card-display.js +76 -74
- package/src/Card/index.js +0 -2
- package/src/Card/log-card-dismissal.js +4 -4
- package/src/Card/log-content-card-click.js +9 -2
- package/src/Card/log-content-card-impressions.js +11 -2
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +116 -110
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +15 -15
- package/src/Card/models/image-only.js +20 -21
- package/src/Card/util/card-factory.js +58 -79
- package/src/ContentCards/content-cards-provider-factory.js +13 -13
- package/src/ContentCards/content-cards-provider.js +148 -148
- package/src/ContentCards/content-cards.js +21 -13
- 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 +8 -8
- package/src/ContentCards/ui/hide-content-cards.js +5 -5
- package/src/ContentCards/ui/show-content-cards.js +35 -35
- package/src/Core/add-sdk-metadata.js +5 -5
- package/src/Core/change-user.js +7 -7
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +10 -10
- package/src/Core/enable-sdk.js +7 -7
- package/src/Core/get-device-id.js +4 -4
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +10 -10
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +18 -18
- package/src/Core/log-purchase.js +19 -19
- package/src/Core/open-session.js +13 -13
- package/src/Core/request-immediate-data-flush.js +1 -1
- package/src/Core/set-logger.js +2 -2
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +20 -71
- package/src/FeatureFlags/feature-flags-provider-factory.js +7 -7
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +8 -8
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +41 -41
- package/src/InAppMessage/display/in-app-message-to-html.js +145 -139
- package/src/InAppMessage/display/modal-utils.js +40 -42
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -1
- package/src/InAppMessage/in-app-message-factory.js +24 -16
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +124 -122
- package/src/InAppMessage/log-in-app-message-button-click.js +12 -12
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-impression.js +4 -4
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +41 -35
- package/src/InAppMessage/models/html-message.js +28 -26
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +156 -152
- package/src/InAppMessage/models/modal-message.js +40 -34
- package/src/InAppMessage/models/slide-up-message.js +38 -32
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +68 -74
- 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 +17 -17
- package/src/Push/push-manager.js +127 -127
- package/src/Push/request-push-permission.js +1 -1
- package/src/Push/utils/push-utils.js +25 -15
- package/src/User/user-manager.js +20 -20
- package/src/User/user.js +60 -61
- package/src/common/base-provider.js +1 -1
- package/src/common/content-cards-display.js +211 -0
- package/src/common/event-logger.js +12 -12
- package/src/common/properties-base.js +56 -0
- package/src/index.js +0 -1
- package/src/l10n/l10n-manager-factory.js +10 -10
- package/src/l10n/l10n-manager.js +7 -7
- package/src/managers/auth-manager.js +36 -36
- package/src/managers/braze-instance.js +184 -185
- package/src/managers/device-manager.js +26 -26
- package/src/managers/network-manager.js +194 -193
- package/src/managers/server-config-manager.js +75 -75
- package/src/managers/session-manager.js +29 -29
- package/src/managers/storage-manager-factory.js +13 -13
- package/src/managers/storage-manager.js +162 -164
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +16 -16
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +8 -8
- package/src/models/push-token.js +10 -10
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +33 -33
- package/src/request-controller.js +193 -192
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +8 -8
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +43 -43
- package/src/triggers/models/in-app-message-click-data.js +4 -4
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +52 -52
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +19 -19
- package/src/triggers/triggers-provider-factory.js +14 -14
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/banner-css.js +1 -1
- package/src/ui/js/iam-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +4 -4
- package/src/util/braze-actions.js +12 -18
- package/src/util/browser-detector.js +27 -20
- package/src/util/client-hints-parser.js +8 -8
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +14 -14
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +9 -9
- package/src/util/html-display-utils.js +38 -38
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +12 -12
- package/src/util/request-header-utils.js +22 -22
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +17 -17
- package/src/util/validation-utils.js +28 -28
- package/src/util/window-utils.js +2 -2
- package/src/Card/log-card-click.js +0 -11
- package/src/Card/log-card-impressions.js +0 -13
- package/src/Feed/feed-provider-factory.js +0 -18
- package/src/Feed/feed-provider.js +0 -90
- package/src/Feed/feed.js +0 -20
- package/src/Feed/get-cached-feed.js +0 -5
- package/src/Feed/index.js +0 -8
- package/src/Feed/log-feed-displayed.js +0 -7
- package/src/Feed/request-feed-refresh.js +0 -5
- package/src/Feed/subscribe-to-feed-updates.js +0 -5
- package/src/Feed/types.js +0 -1
- package/src/Feed/ui/hide-feed.js +0 -7
- package/src/Feed/ui/show-feed.js +0 -96
- package/src/Feed/ui/toggle-feed.js +0 -8
- package/src/common/base-feed.js +0 -29
- package/src/common/feed-display.js +0 -211
|
@@ -1,85 +1,83 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ue from "../models/braze-event.js";
|
|
2
2
|
import _t from "../models/identifier.js";
|
|
3
3
|
import {
|
|
4
|
-
isArray as
|
|
4
|
+
isArray as D,
|
|
5
5
|
keys as C,
|
|
6
6
|
validateValueIsFromEnum as ta,
|
|
7
|
-
values as
|
|
7
|
+
values as Pt,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
|
-
import { logger as
|
|
9
|
+
import { logger as E, EventTypes as m } 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 si } from "../util/error-utils.js";
|
|
13
13
|
export const STORAGE_KEYS = {
|
|
14
14
|
iu: {
|
|
15
15
|
su: "ab.storage.userId",
|
|
16
|
-
|
|
16
|
+
Jh: "ab.storage.deviceId",
|
|
17
17
|
Nl: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
ct: {
|
|
20
|
+
ec: "ab.test",
|
|
21
21
|
tE: "ab.storage.events",
|
|
22
22
|
eE: "ab.storage.attributes",
|
|
23
23
|
sE: "ab.storage.attributes.anonymous_user",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
rE: "ab.storage.triggers",
|
|
33
|
-
oE: "ab.storage.triggers.ts",
|
|
24
|
+
Qa: "ab.storage.device",
|
|
25
|
+
au: "ab.storage.sdk_metadata",
|
|
26
|
+
du: "ab.storage.session_id_for_cached_metadata",
|
|
27
|
+
In: "ab.storage.pushToken",
|
|
28
|
+
rE: "ab.storage.cardImpressions",
|
|
29
|
+
hl: "ab.storage.serverConfig",
|
|
30
|
+
oE: "ab.storage.triggers",
|
|
31
|
+
nE: "ab.storage.triggers.ts",
|
|
34
32
|
Hl: "ab.storage.messagingSessionStart",
|
|
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
|
-
|
|
33
|
+
Ps: "ab.storage.cc",
|
|
34
|
+
Gs: "ab.storage.ccLastFullSync",
|
|
35
|
+
Hs: "ab.storage.ccLastCardUpdated",
|
|
36
|
+
Pu: "ab.storage.globalRateLimitCurrentTokenCount",
|
|
37
|
+
Hu: "ab.storage.dynamicRateLimitCurrentTokenCount",
|
|
38
|
+
Et: "ab.storage.ccClicks",
|
|
39
|
+
Pt: "ab.storage.ccImpressions",
|
|
40
|
+
Lt: "ab.storage.ccDismissals",
|
|
41
|
+
aE: "ab.storage.lastDisplayedTriggerTimesById",
|
|
42
|
+
iE: "ab.storage.lastDisplayedTriggerTime",
|
|
43
|
+
EE: "ab.storage.triggerFireInstancesById",
|
|
44
|
+
jh: "ab.storage.signature",
|
|
45
|
+
lE: "ab.storage.brazeSyncRetryCount",
|
|
46
|
+
Qs: "ab.storage.sdkVersion",
|
|
47
|
+
Ie: "ab.storage.ff",
|
|
48
|
+
qe: "ab.storage.ffImpressions",
|
|
49
|
+
Ae: "ab.storage.ffLastRefreshAt",
|
|
50
|
+
Me: "ab.storage.ff.sessionId",
|
|
51
|
+
SE: "ab.storage.lastReqToEndpoint",
|
|
52
|
+
_E: "ab.storage.requestAttempts",
|
|
53
|
+
Nr: "ab.storage.deferredIam",
|
|
54
|
+
Lu: "ab.storage.lastSdkReq",
|
|
55
|
+
uE: "ab.storage.alias",
|
|
56
|
+
ut: "ab.storage.banners",
|
|
57
|
+
It: "ab.storage.banners.impressions",
|
|
58
|
+
gt: "ab.storage.banners.sessionId",
|
|
61
59
|
},
|
|
62
|
-
|
|
60
|
+
ie: "ab.optOut",
|
|
63
61
|
};
|
|
64
|
-
export default class
|
|
62
|
+
export default class ee {
|
|
65
63
|
constructor(t, e) {
|
|
66
|
-
(this.
|
|
64
|
+
(this.cE = t), (this.TE = e), (this.cE = t), (this.TE = e);
|
|
67
65
|
}
|
|
68
|
-
|
|
66
|
+
Da(t) {
|
|
69
67
|
const e = C(STORAGE_KEYS.iu),
|
|
70
|
-
s = new ne
|
|
68
|
+
s = new ee.ne(t);
|
|
71
69
|
for (const t of e) s.remove(STORAGE_KEYS.iu[t]);
|
|
72
70
|
}
|
|
73
71
|
uu(t, e) {
|
|
74
72
|
let s = null;
|
|
75
|
-
null != e && e instanceof _t && (s = e.
|
|
73
|
+
null != e && e instanceof _t && (s = e.dt()), this.cE.store(t, s);
|
|
76
74
|
}
|
|
77
|
-
|
|
75
|
+
hE(t) {
|
|
78
76
|
const e = this.tu(t);
|
|
79
77
|
null != e && ((e.ql = new Date().valueOf()), this.uu(t, e));
|
|
80
78
|
}
|
|
81
79
|
tu(t) {
|
|
82
|
-
const e = this.
|
|
80
|
+
const e = this.cE.br(t),
|
|
83
81
|
s = ((t) => {
|
|
84
82
|
let e;
|
|
85
83
|
try {
|
|
@@ -90,44 +88,44 @@ export default class ne {
|
|
|
90
88
|
return e;
|
|
91
89
|
})(e);
|
|
92
90
|
let r;
|
|
93
|
-
if (s) (r = _t.
|
|
91
|
+
if (s) (r = _t.qn(s) || null), r && this.uu(t, r);
|
|
94
92
|
else {
|
|
95
|
-
const s = _t.
|
|
96
|
-
(r = _t.
|
|
93
|
+
const s = _t.AE(e);
|
|
94
|
+
(r = _t.qn(s) || null), s !== e && r && this.uu(t, r);
|
|
97
95
|
}
|
|
98
96
|
return r;
|
|
99
97
|
}
|
|
100
|
-
|
|
101
|
-
this.
|
|
98
|
+
Fl(t) {
|
|
99
|
+
this.cE.remove(t);
|
|
102
100
|
}
|
|
103
|
-
|
|
101
|
+
Ua() {
|
|
104
102
|
const t = C(STORAGE_KEYS.iu);
|
|
105
103
|
let e;
|
|
106
104
|
for (const s of t)
|
|
107
105
|
(e = this.tu(STORAGE_KEYS.iu[s])),
|
|
108
106
|
null != e && this.uu(STORAGE_KEYS.iu[s], e);
|
|
109
107
|
}
|
|
110
|
-
|
|
108
|
+
Eo(t) {
|
|
111
109
|
let e;
|
|
112
110
|
if (null == t || 0 === t.length) return !1;
|
|
113
|
-
e =
|
|
114
|
-
let s = this.
|
|
115
|
-
(null != s &&
|
|
116
|
-
for (let t = 0; t < e.length; t++) s.push(e[t].
|
|
117
|
-
return this.
|
|
111
|
+
e = D(t) ? t : [t];
|
|
112
|
+
let s = this.TE.br(STORAGE_KEYS.ct.tE);
|
|
113
|
+
(null != s && D(s)) || (s = []);
|
|
114
|
+
for (let t = 0; t < e.length; t++) s.push(e[t].dt());
|
|
115
|
+
return this.TE.store(STORAGE_KEYS.ct.tE, s);
|
|
118
116
|
}
|
|
119
|
-
|
|
120
|
-
return null != t && this.
|
|
117
|
+
yl(t) {
|
|
118
|
+
return null != t && this.Eo([t]);
|
|
121
119
|
}
|
|
122
|
-
|
|
123
|
-
let t = this.
|
|
124
|
-
this.
|
|
120
|
+
RE() {
|
|
121
|
+
let t = this.TE.br(STORAGE_KEYS.ct.tE);
|
|
122
|
+
this.TE.remove(STORAGE_KEYS.ct.tE), null == t && (t = []);
|
|
125
123
|
const e = [];
|
|
126
124
|
let s = !1,
|
|
127
125
|
r = null;
|
|
128
|
-
if (
|
|
126
|
+
if (D(t))
|
|
129
127
|
for (let s = 0; s < t.length; s++)
|
|
130
|
-
|
|
128
|
+
ue.gE(t[s]) ? e.push(ue.qn(t[s])) : (r = s);
|
|
131
129
|
else s = !0;
|
|
132
130
|
if (s || null != r) {
|
|
133
131
|
let o = "Stored events could not be deserialized as Events";
|
|
@@ -140,160 +138,160 @@ export default class ne {
|
|
|
140
138
|
typeof t +
|
|
141
139
|
": " +
|
|
142
140
|
JSON.stringify(t)),
|
|
143
|
-
e.push(new
|
|
141
|
+
e.push(new ue(null, m.pu, new Date().valueOf(), null, { e: o }));
|
|
144
142
|
}
|
|
145
143
|
return e;
|
|
146
144
|
}
|
|
147
|
-
|
|
145
|
+
ft(t, e) {
|
|
148
146
|
return (
|
|
149
147
|
!!ta(
|
|
150
|
-
STORAGE_KEYS.
|
|
148
|
+
STORAGE_KEYS.ct,
|
|
151
149
|
t,
|
|
152
150
|
"StorageManager cannot store object.",
|
|
153
151
|
"STORAGE_KEYS.OBJECTS",
|
|
154
|
-
) && this.
|
|
152
|
+
) && this.TE.store(t, e)
|
|
155
153
|
);
|
|
156
154
|
}
|
|
157
|
-
|
|
155
|
+
lt(t) {
|
|
158
156
|
return (
|
|
159
157
|
!!ta(
|
|
160
|
-
STORAGE_KEYS.
|
|
158
|
+
STORAGE_KEYS.ct,
|
|
161
159
|
t,
|
|
162
160
|
"StorageManager cannot retrieve object.",
|
|
163
161
|
"STORAGE_KEYS.OBJECTS",
|
|
164
|
-
) && this.
|
|
162
|
+
) && this.TE.br(t)
|
|
165
163
|
);
|
|
166
164
|
}
|
|
167
|
-
|
|
165
|
+
Nt(t) {
|
|
168
166
|
return (
|
|
169
167
|
!!ta(
|
|
170
|
-
STORAGE_KEYS.
|
|
168
|
+
STORAGE_KEYS.ct,
|
|
171
169
|
t,
|
|
172
170
|
"StorageManager cannot remove object.",
|
|
173
171
|
"STORAGE_KEYS.OBJECTS",
|
|
174
|
-
) && (this.
|
|
172
|
+
) && (this.TE.remove(t), !0)
|
|
175
173
|
);
|
|
176
174
|
}
|
|
177
175
|
clearData() {
|
|
178
176
|
const t = C(STORAGE_KEYS.iu),
|
|
179
|
-
e = C(STORAGE_KEYS.
|
|
177
|
+
e = C(STORAGE_KEYS.ct);
|
|
180
178
|
for (let e = 0; e < t.length; e++) {
|
|
181
179
|
const s = t[e];
|
|
182
|
-
this.
|
|
180
|
+
this.cE.remove(STORAGE_KEYS.iu[s]);
|
|
183
181
|
}
|
|
184
182
|
for (let t = 0; t < e.length; t++) {
|
|
185
183
|
const s = e[t];
|
|
186
|
-
this.
|
|
184
|
+
this.TE.remove(STORAGE_KEYS.ct[s]);
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
|
-
|
|
190
|
-
return t || STORAGE_KEYS.
|
|
187
|
+
OE(t) {
|
|
188
|
+
return t || STORAGE_KEYS.ct.sE;
|
|
191
189
|
}
|
|
192
|
-
|
|
193
|
-
let e = this.
|
|
190
|
+
ku(t) {
|
|
191
|
+
let e = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
194
192
|
null == e && (e = {});
|
|
195
|
-
const s = this.
|
|
193
|
+
const s = this.OE(t[User.Jn]),
|
|
196
194
|
r = e[s];
|
|
197
195
|
for (const o in t)
|
|
198
|
-
o !== User.
|
|
196
|
+
o !== User.Jn &&
|
|
199
197
|
(null == e[s] || (r && null == r[o])) &&
|
|
200
|
-
this.mu(t[User.
|
|
198
|
+
this.mu(t[User.Jn], o, t[o]);
|
|
201
199
|
}
|
|
202
200
|
mu(t, e, s) {
|
|
203
|
-
let r = this.
|
|
201
|
+
let r = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
204
202
|
null == r && (r = {});
|
|
205
|
-
const o = this.
|
|
203
|
+
const o = this.OE(t);
|
|
206
204
|
let n = r[o];
|
|
207
205
|
if (
|
|
208
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
206
|
+
(null == n && ((n = {}), null != t && (n[User.Jn] = t)), e === User.lu)
|
|
209
207
|
) {
|
|
210
208
|
null == n[e] && (n[e] = {});
|
|
211
209
|
for (const t in s) n[e][t] = s[t];
|
|
212
210
|
} else n[e] = s;
|
|
213
|
-
return (r[o] = n), this.
|
|
211
|
+
return (r[o] = n), this.TE.store(STORAGE_KEYS.ct.eE, r);
|
|
214
212
|
}
|
|
215
|
-
|
|
216
|
-
const t = this.
|
|
217
|
-
this.
|
|
213
|
+
IE() {
|
|
214
|
+
const t = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
215
|
+
this.TE.remove(STORAGE_KEYS.ct.eE);
|
|
218
216
|
const e = [];
|
|
219
217
|
for (const s in t) null != t[s] && e.push(t[s]);
|
|
220
218
|
return e;
|
|
221
219
|
}
|
|
222
220
|
ru(t) {
|
|
223
|
-
const e = this.
|
|
221
|
+
const e = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
224
222
|
if (null != e) {
|
|
225
|
-
const s = this.
|
|
223
|
+
const s = this.OE(null),
|
|
226
224
|
r = e[s];
|
|
227
225
|
null != r &&
|
|
228
226
|
((e[s] = void 0),
|
|
229
|
-
this.
|
|
230
|
-
(r[User.
|
|
231
|
-
this.
|
|
227
|
+
this.TE.store(STORAGE_KEYS.ct.eE, e),
|
|
228
|
+
(r[User.Jn] = t),
|
|
229
|
+
this.ku(r));
|
|
232
230
|
}
|
|
233
231
|
const s = this.tu(STORAGE_KEYS.iu.Nl);
|
|
234
232
|
let r = null;
|
|
235
233
|
null != s && (r = s.eu);
|
|
236
|
-
const o = this.
|
|
234
|
+
const o = this.RE();
|
|
237
235
|
if (null != o)
|
|
238
236
|
for (let e = 0; e < o.length; e++) {
|
|
239
237
|
const s = o[e];
|
|
240
|
-
null == s.userId && s.sessionId == r && (s.userId = t), this.
|
|
238
|
+
null == s.userId && s.sessionId == r && (s.userId = t), this.yl(s);
|
|
241
239
|
}
|
|
242
240
|
}
|
|
243
|
-
|
|
244
|
-
return this.
|
|
241
|
+
dE() {
|
|
242
|
+
return this.TE.fE;
|
|
245
243
|
}
|
|
246
244
|
}
|
|
247
|
-
(
|
|
245
|
+
(ee.rc = class {
|
|
248
246
|
constructor(t) {
|
|
249
|
-
(this.
|
|
247
|
+
(this.sn = t), (this.sn = t), (this.fE = ro.bE() ? 3 : 10);
|
|
250
248
|
}
|
|
251
|
-
|
|
252
|
-
return t + "." + this.
|
|
249
|
+
mE(t) {
|
|
250
|
+
return t + "." + this.sn;
|
|
253
251
|
}
|
|
254
252
|
store(t, e) {
|
|
255
253
|
const s = { v: e };
|
|
256
254
|
try {
|
|
257
|
-
return localStorage.setItem(this.
|
|
255
|
+
return localStorage.setItem(this.mE(t), JSON.stringify(s)), !0;
|
|
258
256
|
} catch (t) {
|
|
259
|
-
return
|
|
257
|
+
return E.info("Storage failure: " + si(t)), !1;
|
|
260
258
|
}
|
|
261
259
|
}
|
|
262
|
-
|
|
260
|
+
br(t) {
|
|
263
261
|
try {
|
|
264
262
|
let e = null;
|
|
265
|
-
const s = localStorage.getItem(this.
|
|
263
|
+
const s = localStorage.getItem(this.mE(t));
|
|
266
264
|
return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
|
|
267
265
|
} catch (t) {
|
|
268
|
-
return
|
|
266
|
+
return E.info("Storage retrieval failure: " + si(t)), null;
|
|
269
267
|
}
|
|
270
268
|
}
|
|
271
269
|
remove(t) {
|
|
272
270
|
try {
|
|
273
|
-
localStorage.removeItem(this.
|
|
271
|
+
localStorage.removeItem(this.mE(t));
|
|
274
272
|
} catch (t) {
|
|
275
|
-
return
|
|
273
|
+
return E.info("Storage removal failure: " + si(t)), !1;
|
|
276
274
|
}
|
|
277
275
|
}
|
|
278
276
|
}),
|
|
279
|
-
(
|
|
277
|
+
(ee.ac = class {
|
|
280
278
|
constructor() {
|
|
281
|
-
(this.KE = {}), (this.
|
|
279
|
+
(this.KE = {}), (this.YE = 5242880), (this.fE = 3);
|
|
282
280
|
}
|
|
283
281
|
store(t, e) {
|
|
284
282
|
const s = { value: e },
|
|
285
|
-
r = this.
|
|
286
|
-
return r > this.
|
|
287
|
-
? (
|
|
283
|
+
r = this.NE(e);
|
|
284
|
+
return r > this.YE
|
|
285
|
+
? (E.info(
|
|
288
286
|
"Storage failure: object is ≈" +
|
|
289
287
|
r +
|
|
290
288
|
" bytes which is greater than the max of " +
|
|
291
|
-
this.
|
|
289
|
+
this.YE,
|
|
292
290
|
),
|
|
293
291
|
!1)
|
|
294
292
|
: ((this.KE[t] = s), !0);
|
|
295
293
|
}
|
|
296
|
-
|
|
294
|
+
NE(t) {
|
|
297
295
|
const e = [],
|
|
298
296
|
s = [t];
|
|
299
297
|
let r = 0;
|
|
@@ -310,7 +308,7 @@ export default class ne {
|
|
|
310
308
|
}
|
|
311
309
|
return r;
|
|
312
310
|
}
|
|
313
|
-
|
|
311
|
+
br(t) {
|
|
314
312
|
const e = this.KE[t];
|
|
315
313
|
return null == e ? null : e.value;
|
|
316
314
|
}
|
|
@@ -318,17 +316,17 @@ export default class ne {
|
|
|
318
316
|
this.KE[t] = null;
|
|
319
317
|
}
|
|
320
318
|
}),
|
|
321
|
-
(ne
|
|
319
|
+
(ee.ne = class {
|
|
322
320
|
constructor(t, e) {
|
|
323
|
-
(this.
|
|
324
|
-
(this.
|
|
325
|
-
(this.
|
|
326
|
-
(this.
|
|
327
|
-
(this.
|
|
328
|
-
(this.
|
|
321
|
+
(this.sn = t),
|
|
322
|
+
(this.GE = e),
|
|
323
|
+
(this.sn = t),
|
|
324
|
+
(this.CE = this.DE()),
|
|
325
|
+
(this.ME = 576e3),
|
|
326
|
+
(this.GE = !!e);
|
|
329
327
|
}
|
|
330
|
-
|
|
331
|
-
return null != this.
|
|
328
|
+
mE(t) {
|
|
329
|
+
return null != this.sn ? t + "." + this.sn : t;
|
|
332
330
|
}
|
|
333
331
|
DE() {
|
|
334
332
|
let t = 0,
|
|
@@ -345,12 +343,12 @@ export default class ne {
|
|
|
345
343
|
e
|
|
346
344
|
);
|
|
347
345
|
}
|
|
348
|
-
|
|
346
|
+
se() {
|
|
349
347
|
const t = new Date();
|
|
350
|
-
return t.setTime(t.getTime() + 60 * this.
|
|
348
|
+
return t.setTime(t.getTime() + 60 * this.ME * 1e3), t.getFullYear();
|
|
351
349
|
}
|
|
352
|
-
|
|
353
|
-
const t =
|
|
350
|
+
pE() {
|
|
351
|
+
const t = Pt(STORAGE_KEYS.iu),
|
|
354
352
|
e = document.cookie.split(";");
|
|
355
353
|
for (let s = 0; s < e.length; s++) {
|
|
356
354
|
let r = e[s];
|
|
@@ -363,21 +361,21 @@ export default class ne {
|
|
|
363
361
|
}
|
|
364
362
|
if (o) {
|
|
365
363
|
const t = r.split("=")[0];
|
|
366
|
-
-1 === t.indexOf("." + this.
|
|
364
|
+
-1 === t.indexOf("." + this.sn) && this.vE(t);
|
|
367
365
|
}
|
|
368
366
|
}
|
|
369
367
|
}
|
|
370
368
|
store(t, e) {
|
|
371
|
-
this.
|
|
369
|
+
this.pE();
|
|
372
370
|
const s = new Date();
|
|
373
|
-
s.setTime(s.getTime() + 60 * this.
|
|
371
|
+
s.setTime(s.getTime() + 60 * this.ME * 1e3);
|
|
374
372
|
const r = "expires=" + s.toUTCString(),
|
|
375
|
-
o = "domain=" + this.
|
|
373
|
+
o = "domain=" + this.CE;
|
|
376
374
|
let n;
|
|
377
|
-
n = this.
|
|
378
|
-
const a = this.
|
|
375
|
+
n = this.GE ? e : encodeURIComponent(e);
|
|
376
|
+
const a = this.mE(t) + "=" + n + ";" + r + ";" + o + ";path=/";
|
|
379
377
|
return a.length >= 4093
|
|
380
|
-
? (
|
|
378
|
+
? (E.info(
|
|
381
379
|
"Storage failure: string is " +
|
|
382
380
|
a.length +
|
|
383
381
|
" chars which is too large to store as a cookie.",
|
|
@@ -385,9 +383,9 @@ export default class ne {
|
|
|
385
383
|
!1)
|
|
386
384
|
: ((document.cookie = a), !0);
|
|
387
385
|
}
|
|
388
|
-
|
|
386
|
+
br(t) {
|
|
389
387
|
const e = [],
|
|
390
|
-
s = this.
|
|
388
|
+
s = this.mE(t) + "=",
|
|
391
389
|
r = document.cookie.split(";");
|
|
392
390
|
for (let o = 0; o < r.length; o++) {
|
|
393
391
|
let n = r[o];
|
|
@@ -395,13 +393,13 @@ export default class ne {
|
|
|
395
393
|
if (0 === n.indexOf(s))
|
|
396
394
|
try {
|
|
397
395
|
let t;
|
|
398
|
-
(t = this.
|
|
396
|
+
(t = this.GE
|
|
399
397
|
? n.substring(s.length, n.length)
|
|
400
398
|
: decodeURIComponent(n.substring(s.length, n.length))),
|
|
401
399
|
e.push(t);
|
|
402
400
|
} catch (e) {
|
|
403
401
|
return (
|
|
404
|
-
|
|
402
|
+
E.info("Storage retrieval failure: " + si(e)),
|
|
405
403
|
this.remove(t),
|
|
406
404
|
null
|
|
407
405
|
);
|
|
@@ -410,37 +408,37 @@ export default class ne {
|
|
|
410
408
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
411
409
|
}
|
|
412
410
|
remove(t) {
|
|
413
|
-
this.
|
|
411
|
+
this.vE(this.mE(t));
|
|
414
412
|
}
|
|
415
|
-
|
|
413
|
+
vE(t) {
|
|
416
414
|
const e = t + "=;expires=" + new Date(0).toUTCString();
|
|
417
415
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
418
|
-
const s = e + ";domain=" + this.
|
|
416
|
+
const s = e + ";domain=" + this.CE;
|
|
419
417
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
420
418
|
}
|
|
421
419
|
}),
|
|
422
|
-
(
|
|
420
|
+
(ee.tc = class {
|
|
423
421
|
constructor(t, e, s) {
|
|
424
|
-
(this.
|
|
425
|
-
(this.
|
|
426
|
-
e && this.
|
|
427
|
-
s && this.
|
|
428
|
-
this.
|
|
422
|
+
(this.sn = t),
|
|
423
|
+
(this.UE = []),
|
|
424
|
+
e && this.UE.push(new ee.ne(t)),
|
|
425
|
+
s && this.UE.push(new ee.rc(t)),
|
|
426
|
+
this.UE.push(new ee.ac());
|
|
429
427
|
}
|
|
430
428
|
store(t, e) {
|
|
431
429
|
let s = !0;
|
|
432
|
-
for (let r = 0; r < this.
|
|
430
|
+
for (let r = 0; r < this.UE.length; r++) s = this.UE[r].store(t, e) && s;
|
|
433
431
|
return s;
|
|
434
432
|
}
|
|
435
|
-
|
|
436
|
-
for (let e = 0; e < this.
|
|
437
|
-
const s = this.
|
|
433
|
+
br(t) {
|
|
434
|
+
for (let e = 0; e < this.UE.length; e++) {
|
|
435
|
+
const s = this.UE[e].br(t);
|
|
438
436
|
if (null != s) return s;
|
|
439
437
|
}
|
|
440
438
|
return null;
|
|
441
439
|
}
|
|
442
440
|
remove(t) {
|
|
443
|
-
new ne
|
|
444
|
-
for (let e = 0; e < this.
|
|
441
|
+
new ee.ne(this.sn).remove(t);
|
|
442
|
+
for (let e = 0; e < this.UE.length; e++) this.UE[e].remove(t);
|
|
445
443
|
}
|
|
446
444
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Guid as
|
|
1
|
+
import { Guid as P } from "../../shared-lib/index.js";
|
|
2
2
|
export default class u {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this.yi = {};
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
wt(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
|
-
const i =
|
|
9
|
-
return (this.
|
|
8
|
+
const i = P.oe();
|
|
9
|
+
return (this.yi[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
12
|
-
delete this.
|
|
12
|
+
delete this.yi[t];
|
|
13
13
|
}
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
|
-
this.
|
|
15
|
+
this.yi = {};
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
return Object.keys(this.
|
|
17
|
+
sc() {
|
|
18
|
+
return Object.keys(this.yi).length;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
L(t) {
|
|
21
21
|
const i = [];
|
|
22
|
-
for (const s in this.
|
|
23
|
-
const r = this.
|
|
22
|
+
for (const s in this.yi) {
|
|
23
|
+
const r = this.yi[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
|
+
gu: "invalid_api_key",
|
|
3
|
+
bu: "blacklisted",
|
|
4
|
+
qu: "no_device_identifier",
|
|
5
|
+
Ru: "invalid_json_response",
|
|
6
|
+
vu: "empty_response",
|
|
7
7
|
__: "sdk_auth_error",
|
|
8
8
|
};
|