@braze/web-sdk 6.0.0 → 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 +103 -33
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +22 -22
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +19 -19
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +15 -15
- 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 +9 -9
- package/src/Banner/display/destroy-banner-html.js +2 -2
- package/src/Banner/display/detect-banner-impressions.js +2 -2
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +7 -7
- 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 +16 -20
- package/src/Banner/subscribe-to-banners-updates.js +7 -7
- package/src/Banner/ui/insert-banner.js +6 -6
- package/src/Card/card-manager-factory.js +7 -7
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +4 -4
- package/src/Card/log-content-card-click.js +4 -4
- 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 +68 -68
- 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 +35 -35
- package/src/ContentCards/content-cards-provider-factory.js +13 -13
- package/src/ContentCards/content-cards-provider.js +136 -136
- 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 +7 -7
- package/src/Core/add-sdk-metadata.js +3 -3
- package/src/Core/change-user.js +7 -7
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +8 -8
- package/src/Core/enable-sdk.js +6 -6
- package/src/Core/get-device-id.js +4 -4
- package/src/Core/handle-braze-action.js +5 -5
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +10 -10
- package/src/Core/log-purchase.js +13 -13
- package/src/Core/open-session.js +10 -10
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +7 -7
- 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 +12 -12
- package/src/FeatureFlags/feature-flags-provider.js +87 -87
- package/src/FeatureFlags/get-all-feature-flags.js +4 -4
- package/src/FeatureFlags/get-feature-flag.js +4 -4
- package/src/FeatureFlags/log-feature-flag-impression.js +9 -9
- package/src/FeatureFlags/refresh-feature-flags.js +2 -2
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +28 -28
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +15 -15
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +100 -100
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-html-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-impression.js +4 -4
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +35 -35
- package/src/InAppMessage/models/html-message.js +21 -21
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +75 -75
- package/src/InAppMessage/models/modal-message.js +34 -34
- package/src/InAppMessage/models/slide-up-message.js +31 -31
- 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 +19 -19
- package/src/Push/push-manager-factory.js +9 -9
- package/src/Push/push-manager.js +118 -118
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +20 -20
- package/src/User/user.js +44 -45
- package/src/common/base-provider.js +1 -1
- package/src/common/content-cards-display.js +18 -18
- package/src/common/event-logger.js +10 -10
- package/src/common/properties-base.js +56 -0
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +143 -143
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +172 -168
- package/src/managers/server-config-manager.js +73 -73
- package/src/managers/session-manager.js +40 -40
- package/src/managers/storage-manager-factory.js +6 -6
- package/src/managers/storage-manager.js +97 -97
- 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 +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +13 -13
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +159 -159
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +6 -6
- package/src/triggers/models/filter.js +26 -26
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +37 -37
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +16 -16
- package/src/triggers/triggers-provider-factory.js +12 -12
- package/src/triggers/triggers-provider.js +61 -61
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +6 -6
- package/src/util/browser-detector.js +20 -13
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/code-utils.js +2 -2
- package/src/util/component-utils.js +1 -1
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/device-constants.js +4 -4
- package/src/util/dom-utils.js +9 -9
- package/src/util/html-display-utils.js +7 -7
- 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 +16 -16
- package/src/util/validation-utils.js +12 -12
- package/src/util/window-utils.js +2 -2
|
@@ -6,78 +6,78 @@ import {
|
|
|
6
6
|
validateValueIsFromEnum as ta,
|
|
7
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
|
-
|
|
17
|
-
|
|
16
|
+
Jh: "ab.storage.deviceId",
|
|
17
|
+
Nl: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
ct: {
|
|
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
|
-
|
|
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
28
|
rE: "ab.storage.cardImpressions",
|
|
29
|
-
|
|
29
|
+
hl: "ab.storage.serverConfig",
|
|
30
30
|
oE: "ab.storage.triggers",
|
|
31
31
|
nE: "ab.storage.triggers.ts",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
Hl: "ab.storage.messagingSessionStart",
|
|
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
41
|
aE: "ab.storage.lastDisplayedTriggerTimesById",
|
|
42
42
|
iE: "ab.storage.lastDisplayedTriggerTime",
|
|
43
43
|
EE: "ab.storage.triggerFireInstancesById",
|
|
44
|
-
|
|
44
|
+
jh: "ab.storage.signature",
|
|
45
45
|
lE: "ab.storage.brazeSyncRetryCount",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
51
|
SE: "ab.storage.lastReqToEndpoint",
|
|
52
52
|
_E: "ab.storage.requestAttempts",
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
Nr: "ab.storage.deferredIam",
|
|
54
|
+
Lu: "ab.storage.lastSdkReq",
|
|
55
55
|
uE: "ab.storage.alias",
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
ut: "ab.storage.banners",
|
|
57
|
+
It: "ab.storage.banners.impressions",
|
|
58
|
+
gt: "ab.storage.banners.sessionId",
|
|
59
59
|
},
|
|
60
|
-
|
|
60
|
+
ie: "ab.optOut",
|
|
61
61
|
};
|
|
62
62
|
export default class ee {
|
|
63
63
|
constructor(t, e) {
|
|
64
64
|
(this.cE = t), (this.TE = e), (this.cE = t), (this.TE = e);
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
Da(t) {
|
|
67
67
|
const e = C(STORAGE_KEYS.iu),
|
|
68
|
-
s = new ee.
|
|
68
|
+
s = new ee.ne(t);
|
|
69
69
|
for (const t of e) s.remove(STORAGE_KEYS.iu[t]);
|
|
70
70
|
}
|
|
71
71
|
uu(t, e) {
|
|
72
72
|
let s = null;
|
|
73
|
-
null != e && e instanceof _t && (s = e.
|
|
73
|
+
null != e && e instanceof _t && (s = e.dt()), this.cE.store(t, s);
|
|
74
74
|
}
|
|
75
75
|
hE(t) {
|
|
76
76
|
const e = this.tu(t);
|
|
77
|
-
null != e && ((e.
|
|
77
|
+
null != e && ((e.ql = new Date().valueOf()), this.uu(t, e));
|
|
78
78
|
}
|
|
79
79
|
tu(t) {
|
|
80
|
-
const e = this.cE.
|
|
80
|
+
const e = this.cE.br(t),
|
|
81
81
|
s = ((t) => {
|
|
82
82
|
let e;
|
|
83
83
|
try {
|
|
@@ -88,44 +88,44 @@ export default class ee {
|
|
|
88
88
|
return e;
|
|
89
89
|
})(e);
|
|
90
90
|
let r;
|
|
91
|
-
if (s) (r = _t.
|
|
91
|
+
if (s) (r = _t.qn(s) || null), r && this.uu(t, r);
|
|
92
92
|
else {
|
|
93
93
|
const s = _t.AE(e);
|
|
94
|
-
(r = _t.
|
|
94
|
+
(r = _t.qn(s) || null), s !== e && r && this.uu(t, r);
|
|
95
95
|
}
|
|
96
96
|
return r;
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
Fl(t) {
|
|
99
99
|
this.cE.remove(t);
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
Ua() {
|
|
102
102
|
const t = C(STORAGE_KEYS.iu);
|
|
103
103
|
let e;
|
|
104
104
|
for (const s of t)
|
|
105
105
|
(e = this.tu(STORAGE_KEYS.iu[s])),
|
|
106
106
|
null != e && this.uu(STORAGE_KEYS.iu[s], e);
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
Eo(t) {
|
|
109
109
|
let e;
|
|
110
110
|
if (null == t || 0 === t.length) return !1;
|
|
111
111
|
e = D(t) ? t : [t];
|
|
112
|
-
let s = this.TE.
|
|
112
|
+
let s = this.TE.br(STORAGE_KEYS.ct.tE);
|
|
113
113
|
(null != s && D(s)) || (s = []);
|
|
114
|
-
for (let t = 0; t < e.length; t++) s.push(e[t].
|
|
115
|
-
return this.TE.store(STORAGE_KEYS.
|
|
114
|
+
for (let t = 0; t < e.length; t++) s.push(e[t].dt());
|
|
115
|
+
return this.TE.store(STORAGE_KEYS.ct.tE, s);
|
|
116
116
|
}
|
|
117
|
-
|
|
118
|
-
return null != t && this.
|
|
117
|
+
yl(t) {
|
|
118
|
+
return null != t && this.Eo([t]);
|
|
119
119
|
}
|
|
120
120
|
RE() {
|
|
121
|
-
let t = this.TE.
|
|
122
|
-
this.TE.remove(STORAGE_KEYS.
|
|
121
|
+
let t = this.TE.br(STORAGE_KEYS.ct.tE);
|
|
122
|
+
this.TE.remove(STORAGE_KEYS.ct.tE), null == t && (t = []);
|
|
123
123
|
const e = [];
|
|
124
124
|
let s = !1,
|
|
125
125
|
r = null;
|
|
126
126
|
if (D(t))
|
|
127
127
|
for (let s = 0; s < t.length; s++)
|
|
128
|
-
ue.gE(t[s]) ? e.push(ue.
|
|
128
|
+
ue.gE(t[s]) ? e.push(ue.qn(t[s])) : (r = s);
|
|
129
129
|
else s = !0;
|
|
130
130
|
if (s || null != r) {
|
|
131
131
|
let o = "Stored events could not be deserialized as Events";
|
|
@@ -138,34 +138,34 @@ export default class ee {
|
|
|
138
138
|
typeof t +
|
|
139
139
|
": " +
|
|
140
140
|
JSON.stringify(t)),
|
|
141
|
-
e.push(new ue(null,
|
|
141
|
+
e.push(new ue(null, m.pu, new Date().valueOf(), null, { e: o }));
|
|
142
142
|
}
|
|
143
143
|
return e;
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
ft(t, e) {
|
|
146
146
|
return (
|
|
147
147
|
!!ta(
|
|
148
|
-
STORAGE_KEYS.
|
|
148
|
+
STORAGE_KEYS.ct,
|
|
149
149
|
t,
|
|
150
150
|
"StorageManager cannot store object.",
|
|
151
151
|
"STORAGE_KEYS.OBJECTS",
|
|
152
152
|
) && this.TE.store(t, e)
|
|
153
153
|
);
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
lt(t) {
|
|
156
156
|
return (
|
|
157
157
|
!!ta(
|
|
158
|
-
STORAGE_KEYS.
|
|
158
|
+
STORAGE_KEYS.ct,
|
|
159
159
|
t,
|
|
160
160
|
"StorageManager cannot retrieve object.",
|
|
161
161
|
"STORAGE_KEYS.OBJECTS",
|
|
162
|
-
) && this.TE.
|
|
162
|
+
) && this.TE.br(t)
|
|
163
163
|
);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
Nt(t) {
|
|
166
166
|
return (
|
|
167
167
|
!!ta(
|
|
168
|
-
STORAGE_KEYS.
|
|
168
|
+
STORAGE_KEYS.ct,
|
|
169
169
|
t,
|
|
170
170
|
"StorageManager cannot remove object.",
|
|
171
171
|
"STORAGE_KEYS.OBJECTS",
|
|
@@ -174,68 +174,68 @@ export default class ee {
|
|
|
174
174
|
}
|
|
175
175
|
clearData() {
|
|
176
176
|
const t = C(STORAGE_KEYS.iu),
|
|
177
|
-
e = C(STORAGE_KEYS.
|
|
177
|
+
e = C(STORAGE_KEYS.ct);
|
|
178
178
|
for (let e = 0; e < t.length; e++) {
|
|
179
179
|
const s = t[e];
|
|
180
180
|
this.cE.remove(STORAGE_KEYS.iu[s]);
|
|
181
181
|
}
|
|
182
182
|
for (let t = 0; t < e.length; t++) {
|
|
183
183
|
const s = e[t];
|
|
184
|
-
this.TE.remove(STORAGE_KEYS.
|
|
184
|
+
this.TE.remove(STORAGE_KEYS.ct[s]);
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
OE(t) {
|
|
188
|
-
return t || STORAGE_KEYS.
|
|
188
|
+
return t || STORAGE_KEYS.ct.sE;
|
|
189
189
|
}
|
|
190
|
-
|
|
191
|
-
let e = this.TE.
|
|
190
|
+
ku(t) {
|
|
191
|
+
let e = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
192
192
|
null == e && (e = {});
|
|
193
|
-
const s = this.OE(t[User.
|
|
193
|
+
const s = this.OE(t[User.Jn]),
|
|
194
194
|
r = e[s];
|
|
195
195
|
for (const o in t)
|
|
196
|
-
o !== User.
|
|
196
|
+
o !== User.Jn &&
|
|
197
197
|
(null == e[s] || (r && null == r[o])) &&
|
|
198
|
-
this.mu(t[User.
|
|
198
|
+
this.mu(t[User.Jn], o, t[o]);
|
|
199
199
|
}
|
|
200
200
|
mu(t, e, s) {
|
|
201
|
-
let r = this.TE.
|
|
201
|
+
let r = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
202
202
|
null == r && (r = {});
|
|
203
203
|
const o = this.OE(t);
|
|
204
204
|
let n = r[o];
|
|
205
205
|
if (
|
|
206
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
206
|
+
(null == n && ((n = {}), null != t && (n[User.Jn] = t)), e === User.lu)
|
|
207
207
|
) {
|
|
208
208
|
null == n[e] && (n[e] = {});
|
|
209
209
|
for (const t in s) n[e][t] = s[t];
|
|
210
210
|
} else n[e] = s;
|
|
211
|
-
return (r[o] = n), this.TE.store(STORAGE_KEYS.
|
|
211
|
+
return (r[o] = n), this.TE.store(STORAGE_KEYS.ct.eE, r);
|
|
212
212
|
}
|
|
213
213
|
IE() {
|
|
214
|
-
const t = this.TE.
|
|
215
|
-
this.TE.remove(STORAGE_KEYS.
|
|
214
|
+
const t = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
215
|
+
this.TE.remove(STORAGE_KEYS.ct.eE);
|
|
216
216
|
const e = [];
|
|
217
217
|
for (const s in t) null != t[s] && e.push(t[s]);
|
|
218
218
|
return e;
|
|
219
219
|
}
|
|
220
220
|
ru(t) {
|
|
221
|
-
const e = this.TE.
|
|
221
|
+
const e = this.TE.br(STORAGE_KEYS.ct.eE);
|
|
222
222
|
if (null != e) {
|
|
223
223
|
const s = this.OE(null),
|
|
224
224
|
r = e[s];
|
|
225
225
|
null != r &&
|
|
226
226
|
((e[s] = void 0),
|
|
227
|
-
this.TE.store(STORAGE_KEYS.
|
|
228
|
-
(r[User.
|
|
229
|
-
this.
|
|
227
|
+
this.TE.store(STORAGE_KEYS.ct.eE, e),
|
|
228
|
+
(r[User.Jn] = t),
|
|
229
|
+
this.ku(r));
|
|
230
230
|
}
|
|
231
|
-
const s = this.tu(STORAGE_KEYS.iu.
|
|
231
|
+
const s = this.tu(STORAGE_KEYS.iu.Nl);
|
|
232
232
|
let r = null;
|
|
233
233
|
null != s && (r = s.eu);
|
|
234
234
|
const o = this.RE();
|
|
235
235
|
if (null != o)
|
|
236
236
|
for (let e = 0; e < o.length; e++) {
|
|
237
237
|
const s = o[e];
|
|
238
|
-
null == s.userId && s.sessionId == r && (s.userId = t), this.
|
|
238
|
+
null == s.userId && s.sessionId == r && (s.userId = t), this.yl(s);
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
dE() {
|
|
@@ -244,33 +244,33 @@ export default class ee {
|
|
|
244
244
|
}
|
|
245
245
|
(ee.rc = class {
|
|
246
246
|
constructor(t) {
|
|
247
|
-
(this.
|
|
247
|
+
(this.sn = t), (this.sn = t), (this.fE = ro.bE() ? 3 : 10);
|
|
248
248
|
}
|
|
249
249
|
mE(t) {
|
|
250
|
-
return t + "." + this.
|
|
250
|
+
return t + "." + this.sn;
|
|
251
251
|
}
|
|
252
252
|
store(t, e) {
|
|
253
253
|
const s = { v: e };
|
|
254
254
|
try {
|
|
255
255
|
return localStorage.setItem(this.mE(t), JSON.stringify(s)), !0;
|
|
256
256
|
} catch (t) {
|
|
257
|
-
return
|
|
257
|
+
return E.info("Storage failure: " + si(t)), !1;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
|
|
260
|
+
br(t) {
|
|
261
261
|
try {
|
|
262
262
|
let e = null;
|
|
263
263
|
const s = localStorage.getItem(this.mE(t));
|
|
264
264
|
return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
|
|
265
265
|
} catch (t) {
|
|
266
|
-
return
|
|
266
|
+
return E.info("Storage retrieval failure: " + si(t)), null;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
remove(t) {
|
|
270
270
|
try {
|
|
271
271
|
localStorage.removeItem(this.mE(t));
|
|
272
272
|
} catch (t) {
|
|
273
|
-
return
|
|
273
|
+
return E.info("Storage removal failure: " + si(t)), !1;
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
}),
|
|
@@ -282,7 +282,7 @@ export default class ee {
|
|
|
282
282
|
const s = { value: e },
|
|
283
283
|
r = this.NE(e);
|
|
284
284
|
return r > this.YE
|
|
285
|
-
? (
|
|
285
|
+
? (E.info(
|
|
286
286
|
"Storage failure: object is ≈" +
|
|
287
287
|
r +
|
|
288
288
|
" bytes which is greater than the max of " +
|
|
@@ -308,7 +308,7 @@ export default class ee {
|
|
|
308
308
|
}
|
|
309
309
|
return r;
|
|
310
310
|
}
|
|
311
|
-
|
|
311
|
+
br(t) {
|
|
312
312
|
const e = this.KE[t];
|
|
313
313
|
return null == e ? null : e.value;
|
|
314
314
|
}
|
|
@@ -316,17 +316,17 @@ export default class ee {
|
|
|
316
316
|
this.KE[t] = null;
|
|
317
317
|
}
|
|
318
318
|
}),
|
|
319
|
-
(ee.
|
|
319
|
+
(ee.ne = class {
|
|
320
320
|
constructor(t, e) {
|
|
321
|
-
(this.
|
|
321
|
+
(this.sn = t),
|
|
322
322
|
(this.GE = e),
|
|
323
|
-
(this.
|
|
323
|
+
(this.sn = t),
|
|
324
324
|
(this.CE = this.DE()),
|
|
325
325
|
(this.ME = 576e3),
|
|
326
326
|
(this.GE = !!e);
|
|
327
327
|
}
|
|
328
328
|
mE(t) {
|
|
329
|
-
return null != this.
|
|
329
|
+
return null != this.sn ? t + "." + this.sn : t;
|
|
330
330
|
}
|
|
331
331
|
DE() {
|
|
332
332
|
let t = 0,
|
|
@@ -343,7 +343,7 @@ export default class ee {
|
|
|
343
343
|
e
|
|
344
344
|
);
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
se() {
|
|
347
347
|
const t = new Date();
|
|
348
348
|
return t.setTime(t.getTime() + 60 * this.ME * 1e3), t.getFullYear();
|
|
349
349
|
}
|
|
@@ -361,7 +361,7 @@ export default class ee {
|
|
|
361
361
|
}
|
|
362
362
|
if (o) {
|
|
363
363
|
const t = r.split("=")[0];
|
|
364
|
-
-1 === t.indexOf("." + this.
|
|
364
|
+
-1 === t.indexOf("." + this.sn) && this.vE(t);
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
}
|
|
@@ -375,7 +375,7 @@ export default class ee {
|
|
|
375
375
|
n = this.GE ? e : encodeURIComponent(e);
|
|
376
376
|
const a = this.mE(t) + "=" + n + ";" + r + ";" + o + ";path=/";
|
|
377
377
|
return a.length >= 4093
|
|
378
|
-
? (
|
|
378
|
+
? (E.info(
|
|
379
379
|
"Storage failure: string is " +
|
|
380
380
|
a.length +
|
|
381
381
|
" chars which is too large to store as a cookie.",
|
|
@@ -383,7 +383,7 @@ export default class ee {
|
|
|
383
383
|
!1)
|
|
384
384
|
: ((document.cookie = a), !0);
|
|
385
385
|
}
|
|
386
|
-
|
|
386
|
+
br(t) {
|
|
387
387
|
const e = [],
|
|
388
388
|
s = this.mE(t) + "=",
|
|
389
389
|
r = document.cookie.split(";");
|
|
@@ -399,7 +399,7 @@ export default class ee {
|
|
|
399
399
|
e.push(t);
|
|
400
400
|
} catch (e) {
|
|
401
401
|
return (
|
|
402
|
-
|
|
402
|
+
E.info("Storage retrieval failure: " + si(e)),
|
|
403
403
|
this.remove(t),
|
|
404
404
|
null
|
|
405
405
|
);
|
|
@@ -419,9 +419,9 @@ export default class ee {
|
|
|
419
419
|
}),
|
|
420
420
|
(ee.tc = class {
|
|
421
421
|
constructor(t, e, s) {
|
|
422
|
-
(this.
|
|
422
|
+
(this.sn = t),
|
|
423
423
|
(this.UE = []),
|
|
424
|
-
e && this.UE.push(new ee.
|
|
424
|
+
e && this.UE.push(new ee.ne(t)),
|
|
425
425
|
s && this.UE.push(new ee.rc(t)),
|
|
426
426
|
this.UE.push(new ee.ac());
|
|
427
427
|
}
|
|
@@ -430,15 +430,15 @@ export default class ee {
|
|
|
430
430
|
for (let r = 0; r < this.UE.length; r++) s = this.UE[r].store(t, e) && s;
|
|
431
431
|
return s;
|
|
432
432
|
}
|
|
433
|
-
|
|
433
|
+
br(t) {
|
|
434
434
|
for (let e = 0; e < this.UE.length; e++) {
|
|
435
|
-
const s = this.UE[e].
|
|
435
|
+
const s = this.UE[e].br(t);
|
|
436
436
|
if (null != s) return s;
|
|
437
437
|
}
|
|
438
438
|
return null;
|
|
439
439
|
}
|
|
440
440
|
remove(t) {
|
|
441
|
-
new ee.
|
|
441
|
+
new ee.ne(this.sn).remove(t);
|
|
442
442
|
for (let e = 0; e < this.UE.length; e++) this.UE[e].remove(t);
|
|
443
443
|
}
|
|
444
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
|
};
|
|
@@ -18,7 +18,7 @@ export default class ue {
|
|
|
18
18
|
(this.sessionId = r),
|
|
19
19
|
(this.data = e);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
Ar() {
|
|
22
22
|
var t;
|
|
23
23
|
const s = {
|
|
24
24
|
name: this.type,
|
|
@@ -27,14 +27,14 @@ export default class ue {
|
|
|
27
27
|
session_id: this.sessionId,
|
|
28
28
|
};
|
|
29
29
|
null != this.userId && (s.user_id = this.userId);
|
|
30
|
-
const i = (null === (t = r.Sr()) || void 0 === t ? void 0 : t.
|
|
30
|
+
const i = (null === (t = r.Sr()) || void 0 === t ? void 0 : t.fh()) || !1;
|
|
31
31
|
if (!s.user_id && !i) {
|
|
32
|
-
const t = ce(r.
|
|
32
|
+
const t = ce(r.p());
|
|
33
33
|
t && (s.alias = t);
|
|
34
34
|
}
|
|
35
35
|
return s;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
dt() {
|
|
38
38
|
return {
|
|
39
39
|
u: this.userId,
|
|
40
40
|
t: this.type,
|
|
@@ -49,7 +49,7 @@ export default class ue {
|
|
|
49
49
|
static gE(t) {
|
|
50
50
|
return null != t && It(t) && null != t.t && "" !== t.t;
|
|
51
51
|
}
|
|
52
|
-
static
|
|
52
|
+
static qn(t) {
|
|
53
53
|
return new ue(t.u, t.t, t.ts, t.s, t.d);
|
|
54
54
|
}
|
|
55
55
|
}
|
package/src/models/device.js
CHANGED
|
@@ -2,11 +2,11 @@ export default class Qt {
|
|
|
2
2
|
constructor(s) {
|
|
3
3
|
(this.id = s), (this.id = s);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Ar() {
|
|
6
6
|
const s = {};
|
|
7
7
|
return (
|
|
8
8
|
null != this.browser && (s.browser = this.browser),
|
|
9
|
-
null != this.
|
|
9
|
+
null != this.Ga && (s.browser_version = this.Ga),
|
|
10
10
|
null != this.os && (s.os_version = this.os),
|
|
11
11
|
null != this.resolution && (s.resolution = this.resolution),
|
|
12
12
|
null != this.language && (s.locale = this.language),
|
package/src/models/identifier.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Guid as
|
|
1
|
+
import { Guid as P, logger as E } from "../../shared-lib/index.js";
|
|
2
2
|
import { isArray as D } from "../util/code-utils.js";
|
|
3
3
|
import { getErrorMessage as si } from "../util/error-utils.js";
|
|
4
4
|
export default class _t {
|
|
5
5
|
constructor(t, e, i) {
|
|
6
6
|
(this.eu = t),
|
|
7
|
-
null == t && (t =
|
|
8
|
-
!i || isNaN(i) ? (this.
|
|
7
|
+
null == t && (t = P.oe()),
|
|
8
|
+
!i || isNaN(i) ? (this.Gl = new Date().valueOf()) : (this.Gl = i),
|
|
9
9
|
(this.eu = t),
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.ql = new Date().valueOf()),
|
|
11
|
+
(this.kl = e);
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
return `g:${encodeURIComponent(this.eu)}|e:${this.
|
|
15
|
-
this.
|
|
13
|
+
dt() {
|
|
14
|
+
return `g:${encodeURIComponent(this.eu)}|e:${this.kl}|c:${this.Gl}|l:${
|
|
15
|
+
this.ql
|
|
16
16
|
}`;
|
|
17
17
|
}
|
|
18
18
|
static AE(t) {
|
|
@@ -26,7 +26,7 @@ export default class _t {
|
|
|
26
26
|
(t = t.replace(i, `g:${n}`))
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
|
-
static
|
|
29
|
+
static qn(t) {
|
|
30
30
|
let e;
|
|
31
31
|
if ("string" == typeof t)
|
|
32
32
|
try {
|
|
@@ -38,15 +38,15 @@ export default class _t {
|
|
|
38
38
|
if (!isNaN(e)) return e;
|
|
39
39
|
};
|
|
40
40
|
(e = new _t(decodeURIComponent(r(i[0])), n(i[1]), n(i[2]))),
|
|
41
|
-
(e.
|
|
41
|
+
(e.ql = n(i[3]));
|
|
42
42
|
} catch (e) {
|
|
43
|
-
|
|
43
|
+
E.info(
|
|
44
44
|
`Unable to parse cookie string ${t}, failed with error: ${si(e)}`,
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
48
|
if (null == t || null == t.g) return null;
|
|
49
|
-
(e = new _t(t.g, t.e, t.c)), (e.
|
|
49
|
+
(e = new _t(t.g, t.e, t.c)), (e.ql = t.l);
|
|
50
50
|
}
|
|
51
51
|
return e;
|
|
52
52
|
}
|
package/src/models/push-token.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { rehydrateDateAfterJsonization as
|
|
1
|
+
import { rehydrateDateAfterJsonization as Y } from "../util/date-utils.js";
|
|
2
2
|
export default class ti {
|
|
3
3
|
constructor(t, i, s, l, h) {
|
|
4
4
|
(this.endpoint = t),
|
|
5
|
-
(this.
|
|
5
|
+
(this.Vn = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
|
-
(this.
|
|
8
|
-
(this.
|
|
7
|
+
(this.Vl = l),
|
|
8
|
+
(this.dl = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
|
-
(this.
|
|
10
|
+
(this.Vn = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
|
-
(this.
|
|
13
|
-
(this.
|
|
12
|
+
(this.Vl = l || null),
|
|
13
|
+
(this.dl = h || null);
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
dt() {
|
|
16
16
|
return {
|
|
17
17
|
e: this.endpoint,
|
|
18
|
-
c: this.
|
|
18
|
+
c: this.Vn,
|
|
19
19
|
p: this.publicKey,
|
|
20
|
-
u: this.
|
|
21
|
-
v: this.
|
|
20
|
+
u: this.Vl,
|
|
21
|
+
v: this.dl,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
static
|
|
25
|
-
return new ti(t.e,
|
|
24
|
+
static qn(t) {
|
|
25
|
+
return new ti(t.e, Y(t.c), t.p, t.u, t.v);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class H {
|
|
2
2
|
constructor(t = !1, s = []) {
|
|
3
|
-
(this.
|
|
3
|
+
(this.W = t), (this.ue = s), (this.W = t), (this.ue = s);
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
(this.
|
|
5
|
+
Vt(t) {
|
|
6
|
+
(this.W = this.W && t.W), this.ue.push(...t.ue);
|
|
7
7
|
}
|
|
8
8
|
}
|