@braze/web-sdk 4.8.3 → 4.10.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 +2247 -2071
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +4 -4
- package/shared-lib/event-types.js +23 -22
- package/shared-lib/guid.js +7 -7
- package/shared-lib/indexed-db-adapter.js +172 -135
- package/shared-lib/logger.js +26 -26
- package/shared-lib/supported-options.js +14 -13
- package/shared-lib/types.js +1 -0
- package/src/Card/card-manager-factory.js +1 -1
- package/src/Card/card-manager.js +2 -2
- package/src/Card/display/card-display.js +5 -4
- package/src/Card/models/banner.js +10 -10
- package/src/Card/models/captioned-image.js +7 -7
- package/src/Card/models/card.js +37 -36
- package/src/Card/models/classic-card.js +7 -7
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +32 -0
- package/src/Card/models/index.js +1 -0
- package/src/Card/util/card-factory.js +16 -16
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +102 -102
- 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 +4 -4
- package/src/ContentCards/ui/show-content-cards.js +15 -12
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/braze-sdk-metadata.js +1 -1
- package/src/Core/change-user.js +1 -1
- package/src/Core/device-properties.js +1 -1
- package/src/Core/disable-sdk.js +10 -7
- package/src/Core/enable-sdk.js +5 -2
- package/src/Core/get-device-id.js +9 -7
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +4 -4
- package/src/Core/log-purchase.js +9 -9
- package/src/Core/open-session.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +5 -3
- package/src/FeatureFlags/feature-flag.js +17 -14
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +56 -43
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/index.js +1 -0
- package/src/FeatureFlags/log-feature-flag-impression.js +23 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +20 -20
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +13 -10
- package/src/InAppMessage/defer-in-app-message.js +13 -0
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +47 -47
- package/src/InAppMessage/display/in-app-message-to-html.js +92 -91
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +5 -0
- package/src/InAppMessage/in-app-message-factory.js +77 -57
- package/src/InAppMessage/in-app-message-manager-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +121 -82
- package/src/InAppMessage/index.js +2 -0
- package/src/InAppMessage/log-in-app-message-button-click.js +17 -9
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +65 -29
- package/src/InAppMessage/models/html-message.js +32 -13
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +203 -134
- package/src/InAppMessage/models/modal-message.js +64 -29
- package/src/InAppMessage/models/slide-up-message.js +52 -24
- 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 +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +49 -47
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- 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 +19 -19
- package/src/Push/push-manager.js +131 -131
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +12 -10
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +63 -62
- package/src/common/base-feed.js +1 -1
- package/src/common/constants.js +1 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +34 -34
- package/src/common/translations.js +33 -33
- package/src/l10n/l10n-manager-factory.js +8 -8
- package/src/l10n/l10n-manager.js +6 -2
- package/src/l10n/types.js +1 -0
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +132 -130
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +103 -98
- package/src/managers/server-config-manager.js +23 -23
- package/src/managers/session-manager.js +5 -5
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +134 -131
- package/src/managers/subscription-manager.js +7 -7
- package/src/models/backend-errors.js +6 -6
- package/src/models/braze-event.js +11 -11
- package/src/models/braze-sdk-metadata.js +1 -1
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +197 -180
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +7 -7
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +65 -61
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +52 -56
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +50 -38
- package/src/triggers/triggers-provider-factory.js +10 -6
- package/src/triggers/triggers-provider.js +204 -186
- package/src/triggers/types.js +1 -0
- package/src/ui/js/attach-css.js +5 -4
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +5 -5
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +35 -30
- package/src/util/browser-detector.js +30 -31
- package/src/util/client-hints-parser.js +28 -22
- package/src/util/code-utils.js +22 -21
- package/src/util/color-utils.js +19 -13
- package/src/util/component-utils.js +4 -4
- package/src/util/date-utils.js +6 -5
- package/src/util/device-constants.js +10 -10
- package/src/util/dom-utils.js +28 -24
- package/src/util/error-utils.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +53 -57
- package/src/util/request-header-utils.js +34 -11
- package/src/util/string-utils.js +14 -14
- package/src/util/types.js +1 -0
- package/src/util/url-utils.js +1 -4
- package/src/util/user-agent-parser.js +39 -39
- package/src/util/validation-utils.js +34 -34
- package/src/util/window-utils.js +11 -12
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import be from "../models/braze-event.js";
|
|
2
2
|
import _t from "../models/identifier.js";
|
|
3
3
|
import {
|
|
4
4
|
isArray as p,
|
|
5
5
|
keys as oo,
|
|
6
6
|
validateValueIsFromEnum as H,
|
|
7
|
-
values as
|
|
7
|
+
values as Pt,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
9
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
10
10
|
import { User } from "../User/index.js";
|
|
@@ -13,89 +13,92 @@ import { getErrorMessage as ei } from "../util/error-utils.js";
|
|
|
13
13
|
export const STORAGE_KEYS = {
|
|
14
14
|
eu: {
|
|
15
15
|
su: "ab.storage.userId",
|
|
16
|
-
|
|
17
|
-
Dl: "ab.storage.sessionId"
|
|
16
|
+
Zo: "ab.storage.deviceId",
|
|
17
|
+
Dl: "ab.storage.sessionId",
|
|
18
18
|
},
|
|
19
19
|
k: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
Qa: "ab.test",
|
|
21
|
+
tE: "ab.storage.events",
|
|
22
|
+
eE: "ab.storage.attributes",
|
|
23
|
+
sE: "ab.storage.attributes.anonymous_user",
|
|
24
|
+
Fa: "ab.storage.device",
|
|
25
|
+
Kh: "ab.storage.sdk_metadata",
|
|
26
|
+
Wh: "ab.storage.session_id_for_cached_metadata",
|
|
27
|
+
Bn: "ab.storage.pushToken",
|
|
28
|
+
Bi: "ab.storage.newsFeed",
|
|
29
|
+
Ei: "ab.storage.lastNewsFeedRefresh",
|
|
30
30
|
L: "ab.storage.cardImpressions",
|
|
31
31
|
hl: "ab.storage.serverConfig",
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
rE: "ab.storage.triggers",
|
|
33
|
+
oE: "ab.storage.triggers.ts",
|
|
34
34
|
zl: "ab.storage.messagingSessionStart",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
Yt: "ab.storage.cc",
|
|
36
|
+
ws: "ab.storage.ccLastFullSync",
|
|
37
|
+
vs: "ab.storage.ccLastCardUpdated",
|
|
38
|
+
Vs: "ab.storage.ccLastClientRequest",
|
|
39
|
+
ci: "ab.storage.ccRateLimitCurrentTokenCount",
|
|
40
40
|
C: "ab.storage.ccClicks",
|
|
41
41
|
K: "ab.storage.ccImpressions",
|
|
42
42
|
G: "ab.storage.ccDismissals",
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
nE: "ab.storage.lastDisplayedTriggerTimesById",
|
|
44
|
+
iE: "ab.storage.lastDisplayedTriggerTime",
|
|
45
|
+
aE: "ab.storage.triggerFireInstancesById",
|
|
46
|
+
xh: "ab.storage.signature",
|
|
47
|
+
Ls: "ab.storage.brazeSyncRetryCount",
|
|
48
48
|
Ss: "ab.storage.sdkVersion",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
Ri: "ab.storage.ff",
|
|
50
|
+
qi: "ab.storage.ffImpressions",
|
|
51
|
+
Ui: "ab.storage.ffLastRefreshAt",
|
|
52
|
+
EE: "ab.storage.lastReqToEndpoint",
|
|
53
|
+
lE: "ab.storage.requestAttempts",
|
|
54
|
+
rn: "ab.storage.deferredIam",
|
|
52
55
|
},
|
|
53
|
-
|
|
56
|
+
re: "ab.optOut",
|
|
54
57
|
};
|
|
55
58
|
export default class O {
|
|
56
59
|
constructor(t, e) {
|
|
57
|
-
(this.
|
|
60
|
+
(this.SE = t), (this._E = e), (this.SE = t), (this._E = e);
|
|
58
61
|
}
|
|
59
|
-
|
|
62
|
+
Jo(t) {
|
|
60
63
|
const e = oo(STORAGE_KEYS.eu),
|
|
61
64
|
s = new O.ee(t);
|
|
62
65
|
for (const t of e) s.remove(STORAGE_KEYS.eu[t]);
|
|
63
66
|
}
|
|
64
67
|
uu(t, e) {
|
|
65
68
|
let s = null;
|
|
66
|
-
null != e && e instanceof _t && (s = e.ss()), this.
|
|
69
|
+
null != e && e instanceof _t && (s = e.ss()), this.SE.store(t, s);
|
|
67
70
|
}
|
|
68
|
-
|
|
71
|
+
uE(t) {
|
|
69
72
|
const e = this.tu(t);
|
|
70
73
|
null != e && ((e.Nl = new Date().valueOf()), this.uu(t, e));
|
|
71
74
|
}
|
|
72
75
|
tu(t) {
|
|
73
|
-
return _t.
|
|
76
|
+
return _t.Yn(this.SE.jr(t));
|
|
74
77
|
}
|
|
75
78
|
ql(t) {
|
|
76
|
-
this.
|
|
79
|
+
this.SE.remove(t);
|
|
77
80
|
}
|
|
78
81
|
bo(t) {
|
|
79
82
|
let e;
|
|
80
83
|
if (null == t || 0 === t.length) return !1;
|
|
81
84
|
e = p(t) ? t : [t];
|
|
82
|
-
let s = this.
|
|
85
|
+
let s = this._E.jr(STORAGE_KEYS.k.tE);
|
|
83
86
|
(null != s && p(s)) || (s = []);
|
|
84
87
|
for (let t = 0; t < e.length; t++) s.push(e[t].ss());
|
|
85
|
-
return this.
|
|
88
|
+
return this._E.store(STORAGE_KEYS.k.tE, s);
|
|
86
89
|
}
|
|
87
90
|
Hl(t) {
|
|
88
91
|
return null != t && this.bo([t]);
|
|
89
92
|
}
|
|
90
|
-
|
|
91
|
-
let t = this.
|
|
92
|
-
this.
|
|
93
|
+
cE() {
|
|
94
|
+
let t = this._E.jr(STORAGE_KEYS.k.tE);
|
|
95
|
+
this._E.remove(STORAGE_KEYS.k.tE), null == t && (t = []);
|
|
93
96
|
const e = [];
|
|
94
97
|
let s = !1,
|
|
95
98
|
o = null;
|
|
96
99
|
if (p(t))
|
|
97
100
|
for (let s = 0; s < t.length; s++)
|
|
98
|
-
|
|
101
|
+
be.TE(t[s]) ? e.push(be.Yn(t[s])) : (o = s);
|
|
99
102
|
else s = !0;
|
|
100
103
|
if (s || null != o) {
|
|
101
104
|
let n = "Stored events could not be deserialized as Events";
|
|
@@ -108,7 +111,7 @@ export default class O {
|
|
|
108
111
|
typeof t +
|
|
109
112
|
": " +
|
|
110
113
|
JSON.stringify(t)),
|
|
111
|
-
e.push(new
|
|
114
|
+
e.push(new be(null, r.q.qs, new Date().valueOf(), null, { e: n }));
|
|
112
115
|
}
|
|
113
116
|
return e;
|
|
114
117
|
}
|
|
@@ -118,8 +121,8 @@ export default class O {
|
|
|
118
121
|
STORAGE_KEYS.k,
|
|
119
122
|
t,
|
|
120
123
|
"StorageManager cannot store object.",
|
|
121
|
-
"STORAGE_KEYS.OBJECTS"
|
|
122
|
-
) && this.
|
|
124
|
+
"STORAGE_KEYS.OBJECTS",
|
|
125
|
+
) && this._E.store(t, e)
|
|
123
126
|
);
|
|
124
127
|
}
|
|
125
128
|
v(t) {
|
|
@@ -128,18 +131,18 @@ export default class O {
|
|
|
128
131
|
STORAGE_KEYS.k,
|
|
129
132
|
t,
|
|
130
133
|
"StorageManager cannot retrieve object.",
|
|
131
|
-
"STORAGE_KEYS.OBJECTS"
|
|
132
|
-
) && this.
|
|
134
|
+
"STORAGE_KEYS.OBJECTS",
|
|
135
|
+
) && this._E.jr(t)
|
|
133
136
|
);
|
|
134
137
|
}
|
|
135
|
-
|
|
138
|
+
ni(t) {
|
|
136
139
|
return (
|
|
137
140
|
!!H(
|
|
138
141
|
STORAGE_KEYS.k,
|
|
139
142
|
t,
|
|
140
143
|
"StorageManager cannot remove object.",
|
|
141
|
-
"STORAGE_KEYS.OBJECTS"
|
|
142
|
-
) && (this.
|
|
144
|
+
"STORAGE_KEYS.OBJECTS",
|
|
145
|
+
) && (this._E.remove(t), !0)
|
|
143
146
|
);
|
|
144
147
|
}
|
|
145
148
|
clearData() {
|
|
@@ -147,90 +150,90 @@ export default class O {
|
|
|
147
150
|
e = oo(STORAGE_KEYS.k);
|
|
148
151
|
for (let e = 0; e < t.length; e++) {
|
|
149
152
|
const s = t[e];
|
|
150
|
-
this.
|
|
153
|
+
this.SE.remove(STORAGE_KEYS.eu[s]);
|
|
151
154
|
}
|
|
152
155
|
for (let t = 0; t < e.length; t++) {
|
|
153
156
|
const s = e[t];
|
|
154
|
-
this.
|
|
157
|
+
this._E.remove(STORAGE_KEYS.k[s]);
|
|
155
158
|
}
|
|
156
159
|
}
|
|
157
|
-
|
|
158
|
-
return t || STORAGE_KEYS.k.
|
|
160
|
+
hE(t) {
|
|
161
|
+
return t || STORAGE_KEYS.k.sE;
|
|
159
162
|
}
|
|
160
|
-
|
|
161
|
-
let e = this.
|
|
163
|
+
Ha(t) {
|
|
164
|
+
let e = this._E.jr(STORAGE_KEYS.k.eE);
|
|
162
165
|
null == e && (e = {});
|
|
163
|
-
const s = this.
|
|
166
|
+
const s = this.hE(t[User.bu]),
|
|
164
167
|
r = e[s];
|
|
165
168
|
for (const o in t)
|
|
166
|
-
o !== User.
|
|
169
|
+
o !== User.bu &&
|
|
167
170
|
(null == e[s] || (r && null == r[o])) &&
|
|
168
|
-
this.mu(t[User.
|
|
171
|
+
this.mu(t[User.bu], o, t[o]);
|
|
169
172
|
}
|
|
170
173
|
mu(t, e, s) {
|
|
171
|
-
let r = this.
|
|
174
|
+
let r = this._E.jr(STORAGE_KEYS.k.eE);
|
|
172
175
|
null == r && (r = {});
|
|
173
|
-
const o = this.
|
|
176
|
+
const o = this.hE(t);
|
|
174
177
|
let n = r[o];
|
|
175
178
|
if (
|
|
176
|
-
(null == n && ((n = {}), null != t && (n[User.
|
|
179
|
+
(null == n && ((n = {}), null != t && (n[User.bu] = t)), e === User.lu)
|
|
177
180
|
) {
|
|
178
181
|
null == n[e] && (n[e] = {});
|
|
179
182
|
for (const t in s) n[e][t] = s[t];
|
|
180
183
|
} else null != s && (n[e] = s);
|
|
181
|
-
return (r[o] = n), this.
|
|
184
|
+
return (r[o] = n), this._E.store(STORAGE_KEYS.k.eE, r);
|
|
182
185
|
}
|
|
183
|
-
|
|
184
|
-
const t = this.
|
|
185
|
-
this.
|
|
186
|
+
AE() {
|
|
187
|
+
const t = this._E.jr(STORAGE_KEYS.k.eE);
|
|
188
|
+
this._E.remove(STORAGE_KEYS.k.eE);
|
|
186
189
|
const e = [];
|
|
187
190
|
for (const s in t) null != t[s] && e.push(t[s]);
|
|
188
191
|
return e;
|
|
189
192
|
}
|
|
190
193
|
ou(t) {
|
|
191
|
-
const e = this.
|
|
194
|
+
const e = this._E.jr(STORAGE_KEYS.k.eE);
|
|
192
195
|
if (null != e) {
|
|
193
|
-
const s = this.
|
|
196
|
+
const s = this.hE(null),
|
|
194
197
|
r = e[s];
|
|
195
198
|
null != r &&
|
|
196
199
|
((e[s] = void 0),
|
|
197
|
-
this.
|
|
198
|
-
(r[User.
|
|
199
|
-
this.
|
|
200
|
+
this._E.store(STORAGE_KEYS.k.eE, e),
|
|
201
|
+
(r[User.bu] = t),
|
|
202
|
+
this.Ha(r));
|
|
200
203
|
}
|
|
201
204
|
const s = this.tu(STORAGE_KEYS.eu.Dl);
|
|
202
205
|
let r = null;
|
|
203
206
|
null != s && (r = s.iu);
|
|
204
|
-
const o = this.
|
|
207
|
+
const o = this.cE();
|
|
205
208
|
if (null != o)
|
|
206
209
|
for (let e = 0; e < o.length; e++) {
|
|
207
210
|
const s = o[e];
|
|
208
211
|
null == s.userId && s.sessionId == r && (s.userId = t), this.Hl(s);
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
|
-
|
|
212
|
-
return this.
|
|
214
|
+
RE() {
|
|
215
|
+
return this._E.gE;
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
|
-
(O.
|
|
218
|
+
(O.Ya = class {
|
|
216
219
|
constructor(t) {
|
|
217
|
-
(this.
|
|
220
|
+
(this.cn = t), (this.cn = t), (this.gE = V.OE() ? 3 : 10);
|
|
218
221
|
}
|
|
219
|
-
|
|
220
|
-
return t + "." + this.
|
|
222
|
+
dE(t) {
|
|
223
|
+
return t + "." + this.cn;
|
|
221
224
|
}
|
|
222
225
|
store(t, e) {
|
|
223
226
|
const s = { v: e };
|
|
224
227
|
try {
|
|
225
|
-
return localStorage.setItem(this.
|
|
228
|
+
return localStorage.setItem(this.dE(t), JSON.stringify(s)), !0;
|
|
226
229
|
} catch (t) {
|
|
227
230
|
return r.j.info("Storage failure: " + ei(t)), !1;
|
|
228
231
|
}
|
|
229
232
|
}
|
|
230
|
-
|
|
233
|
+
jr(t) {
|
|
231
234
|
try {
|
|
232
235
|
let e = null;
|
|
233
|
-
const s = localStorage.getItem(this.
|
|
236
|
+
const s = localStorage.getItem(this.dE(t));
|
|
234
237
|
return null != s && (e = JSON.parse(s)), null == e ? null : e.v;
|
|
235
238
|
} catch (t) {
|
|
236
239
|
return r.j.info("Storage retrieval failure: " + ei(t)), null;
|
|
@@ -238,30 +241,30 @@ export default class O {
|
|
|
238
241
|
}
|
|
239
242
|
remove(t) {
|
|
240
243
|
try {
|
|
241
|
-
localStorage.removeItem(this.
|
|
244
|
+
localStorage.removeItem(this.dE(t));
|
|
242
245
|
} catch (t) {
|
|
243
246
|
return r.j.info("Storage removal failure: " + ei(t)), !1;
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
249
|
}),
|
|
247
|
-
(O.
|
|
250
|
+
(O.Za = class {
|
|
248
251
|
constructor() {
|
|
249
|
-
(this.
|
|
252
|
+
(this.fE = {}), (this.bE = 5242880), (this.gE = 3);
|
|
250
253
|
}
|
|
251
254
|
store(t, e) {
|
|
252
255
|
const s = { value: e },
|
|
253
|
-
o = this.
|
|
254
|
-
return o > this.
|
|
256
|
+
o = this.IE(e);
|
|
257
|
+
return o > this.bE
|
|
255
258
|
? (r.j.info(
|
|
256
259
|
"Storage failure: object is ≈" +
|
|
257
260
|
o +
|
|
258
261
|
" bytes which is greater than the max of " +
|
|
259
|
-
this.
|
|
262
|
+
this.bE,
|
|
260
263
|
),
|
|
261
264
|
!1)
|
|
262
|
-
: ((this.
|
|
265
|
+
: ((this.fE[t] = s), !0);
|
|
263
266
|
}
|
|
264
|
-
|
|
267
|
+
IE(t) {
|
|
265
268
|
const e = [],
|
|
266
269
|
s = [t];
|
|
267
270
|
let r = 0;
|
|
@@ -278,27 +281,27 @@ export default class O {
|
|
|
278
281
|
}
|
|
279
282
|
return r;
|
|
280
283
|
}
|
|
281
|
-
|
|
282
|
-
const e = this.
|
|
284
|
+
jr(t) {
|
|
285
|
+
const e = this.fE[t];
|
|
283
286
|
return null == e ? null : e.value;
|
|
284
287
|
}
|
|
285
288
|
remove(t) {
|
|
286
|
-
this.
|
|
289
|
+
this.fE[t] = null;
|
|
287
290
|
}
|
|
288
291
|
}),
|
|
289
292
|
(O.ee = class {
|
|
290
293
|
constructor(t, e) {
|
|
291
|
-
(this.
|
|
292
|
-
(this.
|
|
293
|
-
(this.
|
|
294
|
-
(this.
|
|
295
|
-
(this.
|
|
296
|
-
(this.
|
|
294
|
+
(this.cn = t),
|
|
295
|
+
(this.mE = e),
|
|
296
|
+
(this.cn = t),
|
|
297
|
+
(this.KE = this.YE()),
|
|
298
|
+
(this.NE = 576e3),
|
|
299
|
+
(this.mE = !!e);
|
|
297
300
|
}
|
|
298
|
-
|
|
299
|
-
return null != this.
|
|
301
|
+
dE(t) {
|
|
302
|
+
return null != this.cn ? t + "." + this.cn : t;
|
|
300
303
|
}
|
|
301
|
-
|
|
304
|
+
YE() {
|
|
302
305
|
let t = 0,
|
|
303
306
|
e = document.location.hostname;
|
|
304
307
|
const s = e.split("."),
|
|
@@ -313,12 +316,12 @@ export default class O {
|
|
|
313
316
|
e
|
|
314
317
|
);
|
|
315
318
|
}
|
|
316
|
-
|
|
319
|
+
ae() {
|
|
317
320
|
const t = new Date();
|
|
318
|
-
return t.setTime(t.getTime() + 60 * this.
|
|
321
|
+
return t.setTime(t.getTime() + 60 * this.NE * 1e3), t.getFullYear();
|
|
319
322
|
}
|
|
320
|
-
|
|
321
|
-
const t =
|
|
323
|
+
DE() {
|
|
324
|
+
const t = Pt(STORAGE_KEYS.eu),
|
|
322
325
|
e = document.cookie.split(";");
|
|
323
326
|
for (let s = 0; s < e.length; s++) {
|
|
324
327
|
let r = e[s];
|
|
@@ -331,31 +334,31 @@ export default class O {
|
|
|
331
334
|
}
|
|
332
335
|
if (o) {
|
|
333
336
|
const t = r.split("=")[0];
|
|
334
|
-
-1 === t.indexOf("." + this.
|
|
337
|
+
-1 === t.indexOf("." + this.cn) && this.CE(t);
|
|
335
338
|
}
|
|
336
339
|
}
|
|
337
340
|
}
|
|
338
341
|
store(t, e) {
|
|
339
|
-
this.
|
|
342
|
+
this.DE();
|
|
340
343
|
const s = new Date();
|
|
341
|
-
s.setTime(s.getTime() + 60 * this.
|
|
344
|
+
s.setTime(s.getTime() + 60 * this.NE * 1e3);
|
|
342
345
|
const o = "expires=" + s.toUTCString(),
|
|
343
|
-
n = "domain=" + this.
|
|
346
|
+
n = "domain=" + this.KE;
|
|
344
347
|
let i;
|
|
345
|
-
i = this.
|
|
346
|
-
const a = this.
|
|
348
|
+
i = this.mE ? e : encodeURIComponent(JSON.stringify(e));
|
|
349
|
+
const a = this.dE(t) + "=" + i + ";" + o + ";" + n + ";path=/";
|
|
347
350
|
return a.length >= 4093
|
|
348
351
|
? (r.j.info(
|
|
349
352
|
"Storage failure: string is " +
|
|
350
353
|
a.length +
|
|
351
|
-
" chars which is too large to store as a cookie."
|
|
354
|
+
" chars which is too large to store as a cookie.",
|
|
352
355
|
),
|
|
353
356
|
!1)
|
|
354
357
|
: ((document.cookie = a), !0);
|
|
355
358
|
}
|
|
356
|
-
|
|
359
|
+
jr(t) {
|
|
357
360
|
const e = [],
|
|
358
|
-
s = this.
|
|
361
|
+
s = this.dE(t) + "=",
|
|
359
362
|
o = document.cookie.split(";");
|
|
360
363
|
for (let n = 0; n < o.length; n++) {
|
|
361
364
|
let i = o[n];
|
|
@@ -363,10 +366,10 @@ export default class O {
|
|
|
363
366
|
if (0 === i.indexOf(s))
|
|
364
367
|
try {
|
|
365
368
|
let t;
|
|
366
|
-
(t = this.
|
|
369
|
+
(t = this.mE
|
|
367
370
|
? i.substring(s.length, i.length)
|
|
368
371
|
: JSON.parse(
|
|
369
|
-
decodeURIComponent(i.substring(s.length, i.length))
|
|
372
|
+
decodeURIComponent(i.substring(s.length, i.length)),
|
|
370
373
|
)),
|
|
371
374
|
e.push(t);
|
|
372
375
|
} catch (e) {
|
|
@@ -380,37 +383,37 @@ export default class O {
|
|
|
380
383
|
return e.length > 0 ? e[e.length - 1] : null;
|
|
381
384
|
}
|
|
382
385
|
remove(t) {
|
|
383
|
-
this.
|
|
386
|
+
this.CE(this.dE(t));
|
|
384
387
|
}
|
|
385
|
-
|
|
388
|
+
CE(t) {
|
|
386
389
|
const e = t + "=;expires=" + new Date(0).toUTCString();
|
|
387
390
|
(document.cookie = e), (document.cookie = e + ";path=/");
|
|
388
|
-
const s = e + ";domain=" + this.
|
|
391
|
+
const s = e + ";domain=" + this.KE;
|
|
389
392
|
(document.cookie = s), (document.cookie = s + ";path=/");
|
|
390
393
|
}
|
|
391
394
|
}),
|
|
392
|
-
(O.
|
|
395
|
+
(O.Va = class {
|
|
393
396
|
constructor(t, e, s) {
|
|
394
|
-
(this.
|
|
395
|
-
(this.
|
|
396
|
-
e && this.
|
|
397
|
-
s && this.
|
|
398
|
-
this.
|
|
397
|
+
(this.cn = t),
|
|
398
|
+
(this.GE = []),
|
|
399
|
+
e && this.GE.push(new O.ee(t)),
|
|
400
|
+
s && this.GE.push(new O.Ya(t)),
|
|
401
|
+
this.GE.push(new O.Za());
|
|
399
402
|
}
|
|
400
403
|
store(t, e) {
|
|
401
404
|
let s = !0;
|
|
402
|
-
for (let r = 0; r < this.
|
|
405
|
+
for (let r = 0; r < this.GE.length; r++) s = this.GE[r].store(t, e) && s;
|
|
403
406
|
return s;
|
|
404
407
|
}
|
|
405
|
-
|
|
406
|
-
for (let e = 0; e < this.
|
|
407
|
-
const s = this.
|
|
408
|
+
jr(t) {
|
|
409
|
+
for (let e = 0; e < this.GE.length; e++) {
|
|
410
|
+
const s = this.GE[e].jr(t);
|
|
408
411
|
if (null != s) return s;
|
|
409
412
|
}
|
|
410
413
|
return null;
|
|
411
414
|
}
|
|
412
415
|
remove(t) {
|
|
413
|
-
new O.ee(this.
|
|
414
|
-
for (let e = 0; e < this.
|
|
416
|
+
new O.ee(this.cn).remove(t);
|
|
417
|
+
for (let e = 0; e < this.GE.length; e++) this.GE[e].remove(t);
|
|
415
418
|
}
|
|
416
419
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
2
2
|
export default class E {
|
|
3
3
|
constructor() {
|
|
4
|
-
this.
|
|
4
|
+
this.Ve = {};
|
|
5
5
|
}
|
|
6
6
|
lt(t) {
|
|
7
7
|
if ("function" != typeof t) return null;
|
|
8
8
|
const i = r.Z.Y();
|
|
9
|
-
return (this.
|
|
9
|
+
return (this.Ve[i] = t), i;
|
|
10
10
|
}
|
|
11
11
|
removeSubscription(t) {
|
|
12
|
-
delete this.
|
|
12
|
+
delete this.Ve[t];
|
|
13
13
|
}
|
|
14
14
|
removeAllSubscriptions() {
|
|
15
|
-
this.
|
|
15
|
+
this.Ve = {};
|
|
16
16
|
}
|
|
17
17
|
tc() {
|
|
18
|
-
return Object.keys(this.
|
|
18
|
+
return Object.keys(this.Ve).length;
|
|
19
19
|
}
|
|
20
20
|
Et(t) {
|
|
21
21
|
const i = [];
|
|
22
|
-
for (const r in this.
|
|
23
|
-
const s = this.
|
|
22
|
+
for (const r in this.Ve) {
|
|
23
|
+
const s = this.Ve[r];
|
|
24
24
|
i.push(s(t));
|
|
25
25
|
}
|
|
26
26
|
return i;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
__: "sdk_auth_error"
|
|
2
|
+
Ra: "invalid_api_key",
|
|
3
|
+
Xa: "blacklisted",
|
|
4
|
+
Ea: "no_device_identifier",
|
|
5
|
+
Zh: "invalid_json_response",
|
|
6
|
+
Vh: "empty_response",
|
|
7
|
+
__: "sdk_auth_error",
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isObject as
|
|
1
|
+
import { isObject as Nt } from "../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
3
|
convertMsToSeconds as h,
|
|
4
|
-
timestampOrNow as Jt
|
|
4
|
+
timestampOrNow as Jt,
|
|
5
5
|
} from "../util/date-utils.js";
|
|
6
|
-
export default class
|
|
6
|
+
export default class be {
|
|
7
7
|
constructor(t, i, s, r, e) {
|
|
8
8
|
(this.userId = t),
|
|
9
9
|
(this.type = i),
|
|
@@ -16,13 +16,13 @@ export default class ue {
|
|
|
16
16
|
(this.sessionId = r),
|
|
17
17
|
(this.data = e);
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
Kr() {
|
|
20
20
|
const t = {
|
|
21
21
|
name: this.type,
|
|
22
22
|
time: h(this.time),
|
|
23
23
|
data: this.data || {},
|
|
24
24
|
session_id: this.sessionId,
|
|
25
|
-
user_id: void 0
|
|
25
|
+
user_id: void 0,
|
|
26
26
|
};
|
|
27
27
|
return null != this.userId && (t.user_id = this.userId), t;
|
|
28
28
|
}
|
|
@@ -32,16 +32,16 @@ export default class ue {
|
|
|
32
32
|
t: this.type,
|
|
33
33
|
ts: this.time,
|
|
34
34
|
s: this.sessionId,
|
|
35
|
-
d: this.data
|
|
35
|
+
d: this.data,
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
static fromJson(t) {
|
|
39
|
-
return new
|
|
39
|
+
return new be(t.user_id, t.name, t.time, t.session_id, t.data);
|
|
40
40
|
}
|
|
41
|
-
static
|
|
42
|
-
return null != t &&
|
|
41
|
+
static TE(t) {
|
|
42
|
+
return null != t && Nt(t) && null != t.t && "" !== t.t;
|
|
43
43
|
}
|
|
44
|
-
static
|
|
45
|
-
return new
|
|
44
|
+
static Yn(t) {
|
|
45
|
+
return new be(t.u, t.t, t.ts, t.s, t.d);
|
|
46
46
|
}
|
|
47
47
|
}
|
package/src/models/device.js
CHANGED
|
@@ -2,11 +2,11 @@ export default class xt {
|
|
|
2
2
|
constructor(s) {
|
|
3
3
|
(this.id = s), (this.id = s);
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Kr() {
|
|
6
6
|
const s = {};
|
|
7
7
|
return (
|
|
8
8
|
null != this.browser && (s.browser = this.browser),
|
|
9
|
-
null != this.
|
|
9
|
+
null != this.Ia && (s.browser_version = this.Ia),
|
|
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
package/src/models/push-token.js
CHANGED
|
@@ -2,12 +2,12 @@ import { rehydrateDateAfterJsonization as w } 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.Mn = i),
|
|
6
6
|
(this.publicKey = s),
|
|
7
7
|
(this.Vl = l),
|
|
8
8
|
(this.al = h),
|
|
9
9
|
(this.endpoint = t || null),
|
|
10
|
-
(this.
|
|
10
|
+
(this.Mn = i || null),
|
|
11
11
|
(this.publicKey = s || null),
|
|
12
12
|
(this.Vl = l || null),
|
|
13
13
|
(this.al = h || null);
|
|
@@ -15,13 +15,13 @@ export default class ti {
|
|
|
15
15
|
ss() {
|
|
16
16
|
return {
|
|
17
17
|
e: this.endpoint,
|
|
18
|
-
c: this.
|
|
18
|
+
c: this.Mn,
|
|
19
19
|
p: this.publicKey,
|
|
20
20
|
u: this.Vl,
|
|
21
|
-
v: this.al
|
|
21
|
+
v: this.al,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
static
|
|
24
|
+
static Yn(t) {
|
|
25
25
|
return new ti(t.e, w(t.c), t.p, t.u, t.v);
|
|
26
26
|
}
|
|
27
27
|
}
|