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