@braze/web-sdk 4.10.1 → 5.0.1
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 +26 -111
- 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/indexed-db-adapter.js +352 -1
- package/shared-lib/logger.js +38 -1
- package/shared-lib/supported-options.js +26 -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/captioned-image.js +33 -1
- package/src/Card/models/card.js +197 -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 +31 -1
- package/src/Card/models/index.js +5 -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 +7 -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 +10 -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 +243 -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 +29 -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 +322 -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 +426 -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 +13 -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 +80 -1
- package/src/util/validation-utils.js +217 -1
- package/src/util/window-utils.js +34 -1
- package/src/Card/models/banner.js +0 -1
- package/src/ContentCards/log-content-cards-displayed.js +0 -1
|
@@ -1 +1,311 @@
|
|
|
1
|
-
import C from"./util/net.js";
|
|
1
|
+
import C from "./util/net.js";
|
|
2
|
+
import ue from "./models/braze-event.js";
|
|
3
|
+
import s from "./common/event-logger.js";
|
|
4
|
+
import { randomInclusive as D } from "./util/math.js";
|
|
5
|
+
import t from "./models/request-result.js";
|
|
6
|
+
import r from "../shared-lib/braze-shared-lib.js";
|
|
7
|
+
import { STORAGE_KEYS as i } from "./managers/storage-manager.js";
|
|
8
|
+
import E from "./managers/subscription-manager.js";
|
|
9
|
+
import vt from "./Push/utils/push-utils.js";
|
|
10
|
+
import T from "./util/request-header-utils.js";
|
|
11
|
+
export default class Lt {
|
|
12
|
+
constructor(t, i, s, e, h, o, n, r, u, l) {
|
|
13
|
+
(this.cn = t),
|
|
14
|
+
(this.baseUrl = i),
|
|
15
|
+
(this._e = s),
|
|
16
|
+
(this.fn = e),
|
|
17
|
+
(this.wt = h),
|
|
18
|
+
(this.yt = o),
|
|
19
|
+
(this.u = n),
|
|
20
|
+
(this.fu = r),
|
|
21
|
+
(this.Mo = u),
|
|
22
|
+
(this.$t = l),
|
|
23
|
+
(this.cn = t),
|
|
24
|
+
(this.baseUrl = i),
|
|
25
|
+
(this.gu = 0),
|
|
26
|
+
(this.OE = n.RE() || 0),
|
|
27
|
+
(this.vu = null),
|
|
28
|
+
(this._e = s),
|
|
29
|
+
(this.fn = e),
|
|
30
|
+
(this.wt = h),
|
|
31
|
+
(this.yt = o),
|
|
32
|
+
(this.u = n),
|
|
33
|
+
(this.Mo = u),
|
|
34
|
+
(this.$t = l),
|
|
35
|
+
(this.fu = r),
|
|
36
|
+
(this.wu = new E()),
|
|
37
|
+
(this.ku = null),
|
|
38
|
+
(this.yu = 50),
|
|
39
|
+
(this.ju = !1);
|
|
40
|
+
}
|
|
41
|
+
Su(t, i) {
|
|
42
|
+
return !t && !i && this.Mo.Jh() >= this.yu;
|
|
43
|
+
}
|
|
44
|
+
$u(t) {
|
|
45
|
+
let i = this._e.El();
|
|
46
|
+
if (t.length > 0) {
|
|
47
|
+
const s = this.wt.getUserId();
|
|
48
|
+
for (const e of t) {
|
|
49
|
+
const t = (!e.userId && !s) || e.userId === s;
|
|
50
|
+
e.type === r.q.Wl && t && (i = !0);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return i;
|
|
54
|
+
}
|
|
55
|
+
qu(t = !1, s = !1, e = !0, h, o, n, u = !1, l = !1) {
|
|
56
|
+
e && this.Au();
|
|
57
|
+
const a = this.u.cE(),
|
|
58
|
+
c = this.u.AE();
|
|
59
|
+
let d = !1;
|
|
60
|
+
const f = (t, s) => {
|
|
61
|
+
let r = !1;
|
|
62
|
+
T.Ws(this.u, T.Os.Na, new Date().valueOf()),
|
|
63
|
+
C.Xs({
|
|
64
|
+
url: this.baseUrl + "/data/",
|
|
65
|
+
data: t,
|
|
66
|
+
headers: s,
|
|
67
|
+
O: (e) => {
|
|
68
|
+
null != t.respond_with &&
|
|
69
|
+
t.respond_with.triggers &&
|
|
70
|
+
(this.gu = Math.max(this.gu - 1, 0)),
|
|
71
|
+
this.$t.Zs(t, e, s)
|
|
72
|
+
? (this.Mo.ti(),
|
|
73
|
+
this.yt.ul(e),
|
|
74
|
+
(null != t.respond_with &&
|
|
75
|
+
t.respond_with.user_id != this.wt.getUserId()) ||
|
|
76
|
+
(null != t.device && this.u.D(i.k.Fa, t.device),
|
|
77
|
+
null != t.sdk_metadata &&
|
|
78
|
+
(this.u.D(i.k.Kh, t.sdk_metadata),
|
|
79
|
+
this.u.D(i.k.Wh, this._e.Yh())),
|
|
80
|
+
this.fu(e),
|
|
81
|
+
T.si(this.u, T.Os.Na, 1),
|
|
82
|
+
"function" == typeof h && h()))
|
|
83
|
+
: e.auth_error && (r = !0);
|
|
84
|
+
},
|
|
85
|
+
error: () => {
|
|
86
|
+
null != t.respond_with &&
|
|
87
|
+
t.respond_with.triggers &&
|
|
88
|
+
(this.gu = Math.max(this.gu - 1, 0)),
|
|
89
|
+
this.$t.Qh(t.events, t.attributes),
|
|
90
|
+
"function" == typeof o && o();
|
|
91
|
+
},
|
|
92
|
+
ei: (t) => {
|
|
93
|
+
if (("function" == typeof n && n(t), e && !d)) {
|
|
94
|
+
if (t && !r) this.Cu();
|
|
95
|
+
else {
|
|
96
|
+
T.hi(this.u, T.Os.Na);
|
|
97
|
+
let t = this.vu;
|
|
98
|
+
(null == t || t < 1e3 * this.OE) && (t = 1e3 * this.OE),
|
|
99
|
+
this.Cu(Math.min(3e5, D(1e3 * this.OE, 3 * t)));
|
|
100
|
+
}
|
|
101
|
+
d = !0;
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
m = this.$u(a),
|
|
107
|
+
g = s || m;
|
|
108
|
+
if (this.Su(u, m))
|
|
109
|
+
return void r.j.info(
|
|
110
|
+
"Declining to flush data due to 50 consecutive authentication failures",
|
|
111
|
+
);
|
|
112
|
+
if (e && !this.$t.Pa(a, c, t, g))
|
|
113
|
+
return this.Cu(), void ("function" == typeof n && n(!0));
|
|
114
|
+
const v = this.$t.$a(t, g, a, c, l);
|
|
115
|
+
g && this.gu++;
|
|
116
|
+
let p = !1;
|
|
117
|
+
if (v)
|
|
118
|
+
for (const t of v)
|
|
119
|
+
this.$t.Qs(t.requestData, () => f(t.requestData, t.headers)), (p = !0);
|
|
120
|
+
this.Mo.wh() && e && !p
|
|
121
|
+
? this.Cu()
|
|
122
|
+
: m && (r.j.info("Invoking new session subscriptions"), this.wu.Dt());
|
|
123
|
+
}
|
|
124
|
+
Du() {
|
|
125
|
+
return this.gu > 0;
|
|
126
|
+
}
|
|
127
|
+
Cu(t = 1e3 * this.OE) {
|
|
128
|
+
this.ju ||
|
|
129
|
+
(this.Au(),
|
|
130
|
+
(this.ku = window.setTimeout(() => {
|
|
131
|
+
if (document.hidden) {
|
|
132
|
+
const t = "visibilitychange",
|
|
133
|
+
i = () => {
|
|
134
|
+
document.hidden ||
|
|
135
|
+
(document.removeEventListener(t, i, !1), this.qu());
|
|
136
|
+
};
|
|
137
|
+
document.addEventListener(t, i, !1);
|
|
138
|
+
} else this.qu();
|
|
139
|
+
}, t)),
|
|
140
|
+
(this.vu = t));
|
|
141
|
+
}
|
|
142
|
+
Au() {
|
|
143
|
+
null != this.ku && (clearTimeout(this.ku), (this.ku = null));
|
|
144
|
+
}
|
|
145
|
+
initialize() {
|
|
146
|
+
(this.ju = !1), this.Cu();
|
|
147
|
+
}
|
|
148
|
+
destroy() {
|
|
149
|
+
this.wu.removeAllSubscriptions(),
|
|
150
|
+
this.Mo.Gh(),
|
|
151
|
+
this.Au(),
|
|
152
|
+
(this.ju = !0),
|
|
153
|
+
this.qu(void 0, void 0, !1, void 0, void 0, void 0, void 0, !0),
|
|
154
|
+
(this.ku = null);
|
|
155
|
+
}
|
|
156
|
+
pr(t) {
|
|
157
|
+
return this.wu.It(t);
|
|
158
|
+
}
|
|
159
|
+
openSession() {
|
|
160
|
+
const t = this._e.Yh() !== this._e.co();
|
|
161
|
+
t && (this.u.uE(i.eu.Zo), this.u.uE(i.eu.su)),
|
|
162
|
+
this.qu(void 0, !1, void 0, void 0, void 0),
|
|
163
|
+
this.pu(),
|
|
164
|
+
t &&
|
|
165
|
+
import("./Push/push-manager-factory.js").then((t) => {
|
|
166
|
+
if (this.ju) return;
|
|
167
|
+
const s = t.default.m();
|
|
168
|
+
if (
|
|
169
|
+
null != s &&
|
|
170
|
+
(vt.isPushPermissionGranted() || vt.isPushBlocked())
|
|
171
|
+
) {
|
|
172
|
+
const t = () => {
|
|
173
|
+
s.Sn()
|
|
174
|
+
? r.j.info(
|
|
175
|
+
"Push token maintenance is disabled, not refreshing token for backend.",
|
|
176
|
+
)
|
|
177
|
+
: s.subscribe();
|
|
178
|
+
},
|
|
179
|
+
e = (i, s) => {
|
|
180
|
+
s && t();
|
|
181
|
+
},
|
|
182
|
+
h = () => {
|
|
183
|
+
const s = this.u.v(i.k.Bn);
|
|
184
|
+
(null == s || s) && t();
|
|
185
|
+
},
|
|
186
|
+
o = r.ts.Zt;
|
|
187
|
+
new r.es(o, r.j).hr(o.rs.cu, e, h);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
Fu() {
|
|
192
|
+
this.u.ni(i.k.Ri), this.u.ni(i.k.gs), this.u.ni(i.k.rn);
|
|
193
|
+
}
|
|
194
|
+
changeUser(t, s, e) {
|
|
195
|
+
const h = this.wt.getUserId();
|
|
196
|
+
if (h !== t) {
|
|
197
|
+
this._e.kl(),
|
|
198
|
+
this.Fu(),
|
|
199
|
+
null != h && this.qu(void 0, !1, void 0, void 0, void 0),
|
|
200
|
+
this.wt.ru(t),
|
|
201
|
+
e ? this.Mo.setSdkAuthenticationSignature(e) : this.Mo.yh();
|
|
202
|
+
for (let t = 0; t < s.length; t++) s[t].changeUser(null == h);
|
|
203
|
+
null != h && this.u.ni(i.k.L),
|
|
204
|
+
this.u.ni(i.k.Fa),
|
|
205
|
+
this.openSession(),
|
|
206
|
+
r.j.info('Changed user to "' + t + '".');
|
|
207
|
+
} else {
|
|
208
|
+
let i = "Doing nothing.";
|
|
209
|
+
e &&
|
|
210
|
+
this.Mo.jh() !== e &&
|
|
211
|
+
(this.Mo.setSdkAuthenticationSignature(e),
|
|
212
|
+
(i = "Updated SDK authentication signature")),
|
|
213
|
+
r.j.info(`Current user is already ${t}. ${i}`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
requestImmediateDataFlush(t) {
|
|
217
|
+
this.Au(), this._e.co();
|
|
218
|
+
this.qu(
|
|
219
|
+
void 0,
|
|
220
|
+
void 0,
|
|
221
|
+
void 0,
|
|
222
|
+
void 0,
|
|
223
|
+
() => {
|
|
224
|
+
r.j.error(
|
|
225
|
+
"Failed to flush data, request will be retried automatically.",
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
t,
|
|
229
|
+
!0,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
requestFeedRefresh() {
|
|
233
|
+
this._e.co(), this.qu(!0);
|
|
234
|
+
}
|
|
235
|
+
$r(t, i) {
|
|
236
|
+
this._e.co(),
|
|
237
|
+
r.j.info("Requesting explicit trigger refresh."),
|
|
238
|
+
this.qu(void 0, !0, void 0, t, i);
|
|
239
|
+
}
|
|
240
|
+
$n(t, i) {
|
|
241
|
+
const e = r.q.Tu,
|
|
242
|
+
h = { a: t, l: i },
|
|
243
|
+
o = s.N(e, h);
|
|
244
|
+
return o && r.j.info(`Logged alias ${t} with label ${i}`), o;
|
|
245
|
+
}
|
|
246
|
+
Gn(i, e, h) {
|
|
247
|
+
if (this.yt.hu(e))
|
|
248
|
+
return (
|
|
249
|
+
r.j.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
|
|
250
|
+
);
|
|
251
|
+
const o = { key: e, value: h },
|
|
252
|
+
n = s.N(i, o);
|
|
253
|
+
if (n) {
|
|
254
|
+
const t = "object" == typeof h ? JSON.stringify(h, null, 2) : h;
|
|
255
|
+
r.j.info(`Logged custom attribute: ${e} with value: ${t}`);
|
|
256
|
+
}
|
|
257
|
+
return n;
|
|
258
|
+
}
|
|
259
|
+
setLastKnownLocation(t, i, e, h, o, n) {
|
|
260
|
+
const u = { latitude: i, longitude: e };
|
|
261
|
+
null != h && (u.altitude = h),
|
|
262
|
+
null != o && (u.ll_accuracy = o),
|
|
263
|
+
null != n && (u.alt_accuracy = n);
|
|
264
|
+
const l = s.N(r.q.Lu, u, t || void 0);
|
|
265
|
+
return (
|
|
266
|
+
l &&
|
|
267
|
+
r.j.info(
|
|
268
|
+
`Set user last known location as ${JSON.stringify(u, null, 2)}`,
|
|
269
|
+
),
|
|
270
|
+
l
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
vr(t, i) {
|
|
274
|
+
const s = this._e.co();
|
|
275
|
+
return new ue(this.wt.getUserId(), r.q.Mu, t, s, { cid: i });
|
|
276
|
+
}
|
|
277
|
+
pu() {
|
|
278
|
+
const t = r.ts.Zt;
|
|
279
|
+
new r.es(t, r.j).setItem(t.rs.Na, 1, {
|
|
280
|
+
baseUrl: this.baseUrl,
|
|
281
|
+
data: { api_key: this.cn, device_id: this.fn.ce().id },
|
|
282
|
+
userId: this.wt.getUserId(),
|
|
283
|
+
sdkAuthEnabled: this.Mo.wh(),
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
yr(t) {
|
|
287
|
+
for (const i of t)
|
|
288
|
+
if (i.api_key === this.cn) this.$t.Qh(i.events, i.attributes);
|
|
289
|
+
else {
|
|
290
|
+
const t = r.ts.Zt;
|
|
291
|
+
new r.es(t, r.j).setItem(t.rs.wr, r.Z.Y(), i);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
Zn(i, e, h) {
|
|
295
|
+
if (this.yt.hu(i))
|
|
296
|
+
return (
|
|
297
|
+
r.j.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()
|
|
298
|
+
);
|
|
299
|
+
let o, n;
|
|
300
|
+
return (
|
|
301
|
+
null === e && null === h
|
|
302
|
+
? ((o = r.q.Pu), (n = { key: i }))
|
|
303
|
+
: ((o = r.q.Ru), (n = { key: i, latitude: e, longitude: h })),
|
|
304
|
+
s.N(o, n)
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
au(t, i) {
|
|
308
|
+
const e = { group_id: t, status: i };
|
|
309
|
+
return s.N(r.q.Nu, e);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export default class Qt
|
|
1
|
+
export default class Qt {
|
|
2
|
+
constructor(t) {
|
|
3
|
+
(this.yl = t), (this.yl = t);
|
|
4
|
+
}
|
|
5
|
+
Bl(t) {
|
|
6
|
+
return null == this.yl || this.yl === t[0];
|
|
7
|
+
}
|
|
8
|
+
static fromJson(t) {
|
|
9
|
+
return new Qt(t ? t.event_name : null);
|
|
10
|
+
}
|
|
11
|
+
tt() {
|
|
12
|
+
return this.yl;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Wt from "./filter-set.js";
|
|
2
|
+
export default class Yt {
|
|
3
|
+
constructor(t, s) {
|
|
4
|
+
(this.yl = t), (this.Jl = s), (this.yl = t), (this.Jl = s);
|
|
5
|
+
}
|
|
6
|
+
Bl(t) {
|
|
7
|
+
if (null == this.yl || null == this.Jl) return !1;
|
|
8
|
+
const s = t[0],
|
|
9
|
+
i = t[1];
|
|
10
|
+
return s === this.yl && this.Jl.Bl(i);
|
|
11
|
+
}
|
|
12
|
+
static fromJson(t) {
|
|
13
|
+
return new Yt(
|
|
14
|
+
t ? t.event_name : null,
|
|
15
|
+
t ? Wt.fromJson(t.property_filters) : null,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
tt() {
|
|
19
|
+
return { e: this.yl, pf: this.Jl ? this.Jl.tt() : null };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Zt from "./filter.js";
|
|
2
|
+
import { isArray as p } from "../../util/code-utils.js";
|
|
3
|
+
export default class Wt {
|
|
4
|
+
constructor(t) {
|
|
5
|
+
(this.filters = t), (this.filters = t);
|
|
6
|
+
}
|
|
7
|
+
Bl(t) {
|
|
8
|
+
let r = !0;
|
|
9
|
+
for (let e = 0; e < this.filters.length; e++) {
|
|
10
|
+
const o = this.filters[e];
|
|
11
|
+
let s = !1;
|
|
12
|
+
for (let r = 0; r < o.length; r++)
|
|
13
|
+
if (o[r].Bl(t)) {
|
|
14
|
+
s = !0;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
if (!s) {
|
|
18
|
+
r = !1;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
static fromJson(t) {
|
|
25
|
+
if (null == t || !p(t)) return null;
|
|
26
|
+
const r = [];
|
|
27
|
+
for (let e = 0; e < t.length; e++) {
|
|
28
|
+
const o = [],
|
|
29
|
+
s = t[e];
|
|
30
|
+
for (let t = 0; t < s.length; t++) o.push(Zt.fromJson(s[t]));
|
|
31
|
+
r.push(o);
|
|
32
|
+
}
|
|
33
|
+
return new Wt(r);
|
|
34
|
+
}
|
|
35
|
+
tt() {
|
|
36
|
+
const t = [];
|
|
37
|
+
for (let r = 0; r < this.filters.length; r++) {
|
|
38
|
+
const e = this.filters[r],
|
|
39
|
+
o = [];
|
|
40
|
+
for (let t = 0; t < e.length; t++) o.push(e[t].tt());
|
|
41
|
+
t.push(o);
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
}
|
|
45
|
+
static Yn(t) {
|
|
46
|
+
const r = [];
|
|
47
|
+
for (let e = 0; e < t.length; e++) {
|
|
48
|
+
const o = [],
|
|
49
|
+
s = t[e];
|
|
50
|
+
for (let t = 0; t < s.length; t++) o.push(Zt.Yn(s[t]));
|
|
51
|
+
r.push(o);
|
|
52
|
+
}
|
|
53
|
+
return new Wt(r);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1 +1,102 @@
|
|
|
1
|
-
import{isDate as yt}from"../../util/code-utils.js";
|
|
1
|
+
import { isDate as yt } from "../../util/code-utils.js";
|
|
2
|
+
import {
|
|
3
|
+
convertMsToSeconds as h,
|
|
4
|
+
dateFromUnixTimestamp as l,
|
|
5
|
+
secondsAgo as ts,
|
|
6
|
+
secondsInTheFuture as es,
|
|
7
|
+
} from "../../util/date-utils.js";
|
|
8
|
+
export default class Zt {
|
|
9
|
+
constructor(t, s, e, i) {
|
|
10
|
+
(this.Tl = t),
|
|
11
|
+
(this.Al = s),
|
|
12
|
+
(this.comparator = e),
|
|
13
|
+
(this._l = i),
|
|
14
|
+
(this.Tl = t),
|
|
15
|
+
(this.Al = s),
|
|
16
|
+
(this.comparator = e),
|
|
17
|
+
(this._l = i),
|
|
18
|
+
this.Al === Zt.Rl.Ml &&
|
|
19
|
+
this.comparator !== Zt.Il.Ll &&
|
|
20
|
+
this.comparator !== Zt.Il.Ol &&
|
|
21
|
+
this.comparator !== Zt.Il.Ul &&
|
|
22
|
+
this.comparator !== Zt.Il.Ql &&
|
|
23
|
+
(this._l = l(this._l));
|
|
24
|
+
}
|
|
25
|
+
Bl(t) {
|
|
26
|
+
let s = null;
|
|
27
|
+
switch ((null != t && (s = t[this.Tl]), this.comparator)) {
|
|
28
|
+
case Zt.Il.Xl:
|
|
29
|
+
return null != s && s.valueOf() === this._l.valueOf();
|
|
30
|
+
case Zt.Il.Fl:
|
|
31
|
+
return null == s || s.valueOf() !== this._l.valueOf();
|
|
32
|
+
case Zt.Il.Kl:
|
|
33
|
+
return null != s && typeof s == typeof this._l && s > this._l;
|
|
34
|
+
case Zt.Il.Ll:
|
|
35
|
+
return this.Al === Zt.Rl.Ml
|
|
36
|
+
? null != s && yt(s) && ts(s) <= this._l.valueOf()
|
|
37
|
+
: null != s && typeof s == typeof this._l && s >= this._l;
|
|
38
|
+
case Zt.Il.Pl:
|
|
39
|
+
return null != s && typeof s == typeof this._l && s < this._l;
|
|
40
|
+
case Zt.Il.Ol:
|
|
41
|
+
return this.Al === Zt.Rl.Ml
|
|
42
|
+
? null != s && yt(s) && ts(s) >= this._l.valueOf()
|
|
43
|
+
: null != s && typeof s == typeof this._l && s <= this._l;
|
|
44
|
+
case Zt.Il.Yl:
|
|
45
|
+
return (
|
|
46
|
+
null != s &&
|
|
47
|
+
"string" == typeof s &&
|
|
48
|
+
typeof s == typeof this._l &&
|
|
49
|
+
null != s.match(this._l)
|
|
50
|
+
);
|
|
51
|
+
case Zt.Il.Zl:
|
|
52
|
+
return null != s;
|
|
53
|
+
case Zt.Il.$l:
|
|
54
|
+
return null == s;
|
|
55
|
+
case Zt.Il.Ul:
|
|
56
|
+
return null != s && yt(s) && es(s) < this._l;
|
|
57
|
+
case Zt.Il.Ql:
|
|
58
|
+
return null != s && yt(s) && es(s) > this._l;
|
|
59
|
+
case Zt.Il.Eu:
|
|
60
|
+
return (
|
|
61
|
+
null == s ||
|
|
62
|
+
typeof s != typeof this._l ||
|
|
63
|
+
"string" != typeof s ||
|
|
64
|
+
null == s.match(this._l)
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return !1;
|
|
68
|
+
}
|
|
69
|
+
static fromJson(t) {
|
|
70
|
+
return new Zt(
|
|
71
|
+
t.property_key,
|
|
72
|
+
t.property_type,
|
|
73
|
+
t.comparator,
|
|
74
|
+
t.property_value,
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
tt() {
|
|
78
|
+
let t = this._l;
|
|
79
|
+
return (
|
|
80
|
+
yt(this._l) && (t = h(t.valueOf())),
|
|
81
|
+
{ k: this.Tl, t: this.Al, c: this.comparator, v: t }
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
static Yn(t) {
|
|
85
|
+
return new Zt(t.k, t.t, t.c, t.v);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
(Zt.Rl = { _u: "boolean", Hu: "number", Iu: "string", Ml: "date" }),
|
|
89
|
+
(Zt.Il = {
|
|
90
|
+
Xl: 1,
|
|
91
|
+
Fl: 2,
|
|
92
|
+
Kl: 3,
|
|
93
|
+
Ll: 4,
|
|
94
|
+
Pl: 5,
|
|
95
|
+
Ol: 6,
|
|
96
|
+
Yl: 10,
|
|
97
|
+
Zl: 11,
|
|
98
|
+
$l: 12,
|
|
99
|
+
Ul: 15,
|
|
100
|
+
Ql: 16,
|
|
101
|
+
Eu: 17,
|
|
102
|
+
});
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
import ri from"./trigger-condition.js";
|
|
1
|
+
import ri from "./trigger-condition.js";
|
|
2
|
+
export default class si {
|
|
3
|
+
constructor(t, i) {
|
|
4
|
+
(this.xu = t), (this.zu = i), (this.xu = t), (this.zu = i);
|
|
5
|
+
}
|
|
6
|
+
Bl(t) {
|
|
7
|
+
if (null == this.xu) return !1;
|
|
8
|
+
const i = ri.Bu(t[0], this.xu);
|
|
9
|
+
if (!i) return !1;
|
|
10
|
+
let r = null == this.zu || 0 === this.zu.length;
|
|
11
|
+
if (null != this.zu)
|
|
12
|
+
for (let i = 0; i < this.zu.length; i++)
|
|
13
|
+
if (this.zu[i] === t[1]) {
|
|
14
|
+
r = !0;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
return i && r;
|
|
18
|
+
}
|
|
19
|
+
static fromJson(t) {
|
|
20
|
+
return new si(t ? t.id : null, t ? t.buttons : null);
|
|
21
|
+
}
|
|
22
|
+
tt() {
|
|
23
|
+
return this.xu;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export default class rs
|
|
1
|
+
export default class rs {
|
|
2
|
+
constructor(t) {
|
|
3
|
+
(this.productId = t), (this.productId = t);
|
|
4
|
+
}
|
|
5
|
+
Bl(t) {
|
|
6
|
+
return null == this.productId || t[0] === this.productId;
|
|
7
|
+
}
|
|
8
|
+
static fromJson(t) {
|
|
9
|
+
return new rs(t ? t.product_id : null);
|
|
10
|
+
}
|
|
11
|
+
tt() {
|
|
12
|
+
return this.productId;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Wt from "./filter-set.js";
|
|
2
|
+
export default class is {
|
|
3
|
+
constructor(t, s) {
|
|
4
|
+
(this.productId = t), (this.Jl = s), (this.productId = t), (this.Jl = s);
|
|
5
|
+
}
|
|
6
|
+
Bl(t) {
|
|
7
|
+
if (null == this.productId || null == this.Jl) return !1;
|
|
8
|
+
const s = t[0],
|
|
9
|
+
i = t[1];
|
|
10
|
+
return s === this.productId && this.Jl.Bl(i);
|
|
11
|
+
}
|
|
12
|
+
static fromJson(t) {
|
|
13
|
+
return new is(
|
|
14
|
+
t ? t.product_id : null,
|
|
15
|
+
t ? Wt.fromJson(t.property_filters) : null,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
tt() {
|
|
19
|
+
return { id: this.productId, pf: this.Jl ? this.Jl.tt() : null };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import ri from"./trigger-condition.js";
|
|
1
|
+
import ri from "./trigger-condition.js";
|
|
2
|
+
export default class sr {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
(this.xu = t), (this.xu = t);
|
|
5
|
+
}
|
|
6
|
+
Bl(t) {
|
|
7
|
+
return null == this.xu || ri.Bu(t[0], this.xu);
|
|
8
|
+
}
|
|
9
|
+
static fromJson(t) {
|
|
10
|
+
return new sr(t ? t.campaign_id : null);
|
|
11
|
+
}
|
|
12
|
+
tt() {
|
|
13
|
+
return this.xu;
|
|
14
|
+
}
|
|
15
|
+
}
|