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