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