@braze/web-sdk 4.3.0 → 4.5.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 +68 -6
- 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 +32 -1
- package/shared-lib/guid.js +10 -1
- package/shared-lib/indexed-db-adapter.js +315 -1
- package/shared-lib/logger.js +38 -1
- package/shared-lib/supported-options.js +26 -1
- package/src/Card/card-manager-factory.js +14 -1
- package/src/Card/card-manager.js +72 -1
- package/src/Card/display/card-display.js +134 -1
- package/src/Card/index.js +5 -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-impressions.js +4 -1
- package/src/Card/models/banner.js +30 -1
- package/src/Card/models/captioned-image.js +32 -1
- package/src/Card/models/card.js +175 -1
- package/src/Card/models/classic-card.js +32 -1
- package/src/Card/models/control-card.js +39 -1
- package/src/Card/models/index.js +5 -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 +283 -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 +14 -1
- package/src/ContentCards/ui/hide-content-cards.js +8 -1
- package/src/ContentCards/ui/show-content-cards.js +72 -1
- package/src/ContentCards/ui/toggle-content-cards.js +8 -1
- package/src/Core/add-sdk-metadata.js +27 -1
- package/src/Core/braze-sdk-metadata.js +10 -1
- package/src/Core/change-user.js +19 -1
- package/src/Core/destroy.js +5 -1
- package/src/Core/device-properties.js +9 -1
- package/src/Core/disable-sdk.js +10 -1
- package/src/Core/enable-sdk.js +8 -1
- package/src/Core/get-device-id.js +10 -1
- package/src/Core/get-user.js +4 -1
- package/src/Core/handle-braze-action.js +64 -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 +36 -1
- package/src/Core/log-purchase.js +245 -1
- package/src/Core/open-session.js +23 -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 +4 -1
- package/src/Core/set-logger.js +4 -1
- package/src/Core/set-sdk-authentication-signature.js +9 -1
- package/src/Core/subscribe-to-sdk-authentication-failures.js +4 -1
- package/src/Core/toggle-logging.js +4 -1
- package/src/Core/wipe-data.js +15 -1
- package/src/FeatureFlags/feature-flag-factory.js +14 -0
- package/src/FeatureFlags/feature-flag.js +16 -0
- package/src/FeatureFlags/feature-flags-provider-factory.js +19 -0
- package/src/FeatureFlags/feature-flags-provider.js +94 -0
- package/src/FeatureFlags/get-all-feature-flags.js +12 -0
- package/src/FeatureFlags/get-feature-flag.js +12 -0
- package/src/FeatureFlags/index.js +4 -0
- package/src/FeatureFlags/refresh-feature-flags.js +9 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +6 -0
- package/src/Feed/feed-provider-factory.js +18 -1
- package/src/Feed/feed-provider.js +79 -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 +5 -1
- package/src/Feed/request-feed-refresh.js +5 -1
- package/src/Feed/subscribe-to-feed-updates.js +5 -1
- package/src/Feed/ui/hide-feed.js +7 -1
- package/src/Feed/ui/show-feed.js +89 -1
- package/src/Feed/ui/toggle-feed.js +8 -1
- package/src/InAppMessage/display/get-animation-effect.js +19 -1
- package/src/InAppMessage/display/html-message-to-html.js +223 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +152 -1
- package/src/InAppMessage/display/modal-utils.js +68 -1
- package/src/InAppMessage/in-app-message-factory.js +145 -1
- package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
- package/src/InAppMessage/in-app-message-manager.js +189 -1
- package/src/InAppMessage/index.js +14 -1
- package/src/InAppMessage/log-in-app-message-button-click.js +19 -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 +8 -1
- package/src/InAppMessage/models/full-screen-message.js +71 -1
- package/src/InAppMessage/models/html-message.js +54 -1
- package/src/InAppMessage/models/in-app-message-button.js +40 -1
- package/src/InAppMessage/models/in-app-message.js +271 -1
- package/src/InAppMessage/models/modal-message.js +68 -1
- package/src/InAppMessage/models/slide-up-message.js +58 -1
- package/src/InAppMessage/models/templated-in-app-message.js +14 -1
- package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
- package/src/InAppMessage/ui/show-in-app-message.js +170 -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 +360 -1
- package/src/Push/request-push-permission.js +8 -1
- package/src/Push/unregister-push.js +5 -1
- package/src/Push/utils/push-utils.js +34 -1
- package/src/User/index.js +1 -1
- package/src/User/user-manager.js +70 -1
- package/src/User/user.js +278 -1
- package/src/common/base-feed.js +25 -1
- package/src/common/base-provider.js +6 -1
- package/src/common/constants.js +5 -1
- package/src/common/event-logger.js +24 -1
- package/src/common/feed-display.js +200 -1
- package/src/common/translations.js +148 -1
- package/src/index.js +9 -1
- package/src/l10n/l10n-manager-factory.js +22 -1
- package/src/l10n/l10n-manager.js +21 -1
- package/src/managers/auth-manager.js +48 -1
- package/src/managers/braze-instance.js +307 -1
- package/src/managers/device-manager.js +80 -1
- package/src/managers/network-manager.js +219 -1
- package/src/managers/server-config-manager.js +88 -1
- package/src/managers/session-manager.js +68 -1
- package/src/managers/storage-manager-factory.js +35 -1
- package/src/managers/storage-manager.js +394 -1
- package/src/managers/subscription-manager.js +25 -1
- package/src/models/backend-errors.js +8 -1
- package/src/models/braze-event.js +41 -1
- package/src/models/braze-sdk-metadata.js +10 -1
- package/src/models/device.js +26 -1
- package/src/models/identifier.js +20 -1
- package/src/models/push-token.js +22 -1
- package/src/models/request-result.js +8 -1
- package/src/models/server-config.js +32 -1
- package/src/request-controller.js +288 -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 +98 -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 +109 -1
- package/src/triggers/models/trigger-events.js +8 -1
- package/src/triggers/models/trigger.js +110 -1
- package/src/triggers/triggers-provider-factory.js +30 -1
- package/src/triggers/triggers-provider.js +307 -1
- package/src/ui/js/attach-css.js +12 -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 +79 -1
- package/src/util/browser-detector.js +85 -1
- package/src/util/client-hints-parser.js +60 -1
- package/src/util/code-utils.js +92 -1
- package/src/util/color-utils.js +23 -1
- package/src/util/component-utils.js +26 -1
- package/src/util/date-utils.js +27 -1
- package/src/util/deprecation-utils.js +5 -1
- package/src/util/device-constants.js +14 -1
- package/src/util/dom-utils.js +87 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/math.js +5 -1
- package/src/util/net.js +75 -1
- package/src/util/string-utils.js +22 -1
- package/src/util/url-utils.js +23 -1
- package/src/util/user-agent-parser.js +85 -1
- package/src/util/validation-utils.js +136 -1
- package/src/util/window-utils.js +35 -1
|
@@ -1 +1,288 @@
|
|
|
1
|
-
import b from"./util/net.js";
|
|
1
|
+
import b from "./util/net.js";
|
|
2
|
+
import ue from "./models/braze-event.js";
|
|
3
|
+
import s from "./common/event-logger.js";
|
|
4
|
+
import { randomInclusive as pt } 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 o } from "./managers/storage-manager.js";
|
|
8
|
+
import u from "./managers/subscription-manager.js";
|
|
9
|
+
import dt from "./Push/utils/push-utils.js";
|
|
10
|
+
export default class Lt {
|
|
11
|
+
constructor(t, s, i, e, n, l, h, o, r, a) {
|
|
12
|
+
(this._r = t),
|
|
13
|
+
(this.Bo = s),
|
|
14
|
+
(this.kl = 0),
|
|
15
|
+
(this.yl = h.Pa()),
|
|
16
|
+
(this.jl = null),
|
|
17
|
+
(this.j = i),
|
|
18
|
+
(this.Ur = e),
|
|
19
|
+
(this.v = n),
|
|
20
|
+
(this.gt = l),
|
|
21
|
+
(this.h = h),
|
|
22
|
+
(this.Ko = r),
|
|
23
|
+
(this.vt = a),
|
|
24
|
+
(this.$l = o),
|
|
25
|
+
(this.Al = new u()),
|
|
26
|
+
(this.Tl = 50);
|
|
27
|
+
}
|
|
28
|
+
ql(t, s) {
|
|
29
|
+
return !t && !s && this.Ko.Yn() >= this.Tl;
|
|
30
|
+
}
|
|
31
|
+
Fl(t) {
|
|
32
|
+
let s = this.j.gh();
|
|
33
|
+
if (t.length > 0) {
|
|
34
|
+
const i = this.v.getUserId();
|
|
35
|
+
for (const e of t) {
|
|
36
|
+
const t = (!e.userId && !i) || e.userId === i;
|
|
37
|
+
e.type === r.A.Ch && t && (s = !0);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return s;
|
|
41
|
+
}
|
|
42
|
+
Dl(t, s, i, e, n, l, h) {
|
|
43
|
+
null == i && (i = !0), i && this.Ll();
|
|
44
|
+
const u = this.h.Ua(),
|
|
45
|
+
a = this.h.Ba();
|
|
46
|
+
let c = !1;
|
|
47
|
+
const d = (t, s) => {
|
|
48
|
+
let h = !1;
|
|
49
|
+
b.Hs({
|
|
50
|
+
url: this.Bo + "/data/",
|
|
51
|
+
data: t,
|
|
52
|
+
headers: s,
|
|
53
|
+
S: i => {
|
|
54
|
+
null != t.respond_with &&
|
|
55
|
+
t.respond_with.triggers &&
|
|
56
|
+
(this.kl = Math.max(this.kl - 1, 0)),
|
|
57
|
+
this.vt.Os(t, i, s)
|
|
58
|
+
? (this.Ko.Qs(),
|
|
59
|
+
this.gt.al(i),
|
|
60
|
+
(null != t.respond_with &&
|
|
61
|
+
t.respond_with.user_id != this.v.getUserId()) ||
|
|
62
|
+
(null != t.device && this.h.B(o.q.Yo, t.device),
|
|
63
|
+
null != t.sdk_metadata &&
|
|
64
|
+
(this.h.B(o.q.ua, t.sdk_metadata),
|
|
65
|
+
this.h.B(o.q.ha, this.j.ca())),
|
|
66
|
+
this.$l(i),
|
|
67
|
+
"function" == typeof e && e()))
|
|
68
|
+
: i.auth_error && (h = !0);
|
|
69
|
+
},
|
|
70
|
+
error: () => {
|
|
71
|
+
null != t.respond_with &&
|
|
72
|
+
t.respond_with.triggers &&
|
|
73
|
+
(this.kl = Math.max(this.kl - 1, 0)),
|
|
74
|
+
this.vt.la(t.events, t.attributes),
|
|
75
|
+
"function" == typeof n && n();
|
|
76
|
+
},
|
|
77
|
+
Pl: t => {
|
|
78
|
+
if (("function" == typeof l && l(t), i && !c)) {
|
|
79
|
+
if (t && !h) this.Rl();
|
|
80
|
+
else {
|
|
81
|
+
let t = this.jl;
|
|
82
|
+
(null == t || t < 1e3 * this.yl) && (t = 1e3 * this.yl),
|
|
83
|
+
this.Rl(Math.min(3e5, pt(1e3 * this.yl, 3 * t)));
|
|
84
|
+
}
|
|
85
|
+
c = !0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
m = this.Fl(u),
|
|
91
|
+
f = s || m;
|
|
92
|
+
if (this.ql(h, m))
|
|
93
|
+
return void r.D.info(
|
|
94
|
+
"Declining to flush data due to 50 consecutive authentication failures"
|
|
95
|
+
);
|
|
96
|
+
if (i && !this.vt.ga(u, a, t, f))
|
|
97
|
+
return this.Rl(), void ("function" == typeof l && l(!0));
|
|
98
|
+
const g = this.vt.qa(t, f, u, a);
|
|
99
|
+
f && this.kl++;
|
|
100
|
+
let p = !1;
|
|
101
|
+
if (g)
|
|
102
|
+
for (const t of g)
|
|
103
|
+
this.vt.Gs(t.requestData, () => d(t.requestData, t.headers)), (p = !0);
|
|
104
|
+
this.Ko.Jn() && i && !p
|
|
105
|
+
? this.Rl()
|
|
106
|
+
: m && (r.D.info("Invoking new session subscriptions"), this.Al.St());
|
|
107
|
+
}
|
|
108
|
+
Ml() {
|
|
109
|
+
return this.kl > 0;
|
|
110
|
+
}
|
|
111
|
+
Rl(t) {
|
|
112
|
+
this.Il ||
|
|
113
|
+
(null == t && (t = 1e3 * this.yl),
|
|
114
|
+
this.Ll(),
|
|
115
|
+
(this.Nl = setTimeout(() => {
|
|
116
|
+
if (document.hidden) {
|
|
117
|
+
const t = "visibilitychange",
|
|
118
|
+
s = () => {
|
|
119
|
+
document.hidden ||
|
|
120
|
+
(document.removeEventListener(t, s, !1), this.Dl());
|
|
121
|
+
};
|
|
122
|
+
document.addEventListener(t, s, !1);
|
|
123
|
+
} else this.Dl();
|
|
124
|
+
}, t)),
|
|
125
|
+
(this.jl = t));
|
|
126
|
+
}
|
|
127
|
+
Ll() {
|
|
128
|
+
null != this.Nl && (clearTimeout(this.Nl), (this.Nl = null));
|
|
129
|
+
}
|
|
130
|
+
initialize() {
|
|
131
|
+
(this.Il = !1), this.Rl();
|
|
132
|
+
}
|
|
133
|
+
destroy() {
|
|
134
|
+
this.Al.removeAllSubscriptions(),
|
|
135
|
+
this.Ko.Wn(),
|
|
136
|
+
this.Ll(),
|
|
137
|
+
(this.Il = !0),
|
|
138
|
+
this.Dl(null, null, !1),
|
|
139
|
+
(this.Nl = null);
|
|
140
|
+
}
|
|
141
|
+
cr(t) {
|
|
142
|
+
return this.Al.ut(t);
|
|
143
|
+
}
|
|
144
|
+
openSession() {
|
|
145
|
+
const t = this.j.ca() !== this.j.mo();
|
|
146
|
+
t && (this.h.ya(o.eu.Jo), this.h.ya(o.eu.su)),
|
|
147
|
+
this.Dl(null, !1, null, null, null),
|
|
148
|
+
this.Ln(),
|
|
149
|
+
t &&
|
|
150
|
+
import("./Push/push-manager-factory.js").then(t => {
|
|
151
|
+
if (this.Il) return;
|
|
152
|
+
const s = t.default.aa();
|
|
153
|
+
if (
|
|
154
|
+
null != s &&
|
|
155
|
+
(dt.isPushPermissionGranted() || dt.isPushBlocked())
|
|
156
|
+
) {
|
|
157
|
+
const t = () => {
|
|
158
|
+
s.Gr()
|
|
159
|
+
? r.D.info(
|
|
160
|
+
"Push token maintenance is disabled, not refreshing token for backend."
|
|
161
|
+
)
|
|
162
|
+
: s.subscribe();
|
|
163
|
+
},
|
|
164
|
+
i = (s, i) => {
|
|
165
|
+
i && t();
|
|
166
|
+
},
|
|
167
|
+
e = () => {
|
|
168
|
+
const s = this.h.I(o.q.Pn);
|
|
169
|
+
(null == s || s) && t();
|
|
170
|
+
},
|
|
171
|
+
n = r.xt.Ft;
|
|
172
|
+
new r.qt(n, r.D).hr(n.$t.cu, i, e);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
changeUser(t, s, i) {
|
|
177
|
+
const e = this.v.getUserId();
|
|
178
|
+
if (e !== t) {
|
|
179
|
+
this.j.Gh(),
|
|
180
|
+
null != e && this.Dl(null, !1, null, null, null),
|
|
181
|
+
this.v.uu(t),
|
|
182
|
+
i ? this.Ko.setSdkAuthenticationSignature(i) : this.Ko.Qn();
|
|
183
|
+
for (let t = 0; t < s.length; t++) s[t].changeUser(null == e);
|
|
184
|
+
null != e && this.h.Xs(o.q.P),
|
|
185
|
+
this.h.Xs(o.q.Yo),
|
|
186
|
+
this.openSession(),
|
|
187
|
+
r.D.info('Changed user to "' + t + '".');
|
|
188
|
+
} else {
|
|
189
|
+
let s = "Doing nothing.";
|
|
190
|
+
i &&
|
|
191
|
+
this.Ko.Kn() !== i &&
|
|
192
|
+
(this.Ko.setSdkAuthenticationSignature(i),
|
|
193
|
+
(s = "Updated SDK authentication signature")),
|
|
194
|
+
r.D.info(`Current user is already ${t}. ${s}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
requestImmediateDataFlush(t) {
|
|
198
|
+
this.Ll(), this.j.mo();
|
|
199
|
+
this.Dl(
|
|
200
|
+
null,
|
|
201
|
+
null,
|
|
202
|
+
null,
|
|
203
|
+
null,
|
|
204
|
+
() => {
|
|
205
|
+
r.D.error(
|
|
206
|
+
"Failed to flush data, request will be retried automatically."
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
t,
|
|
210
|
+
!0
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
requestFeedRefresh() {
|
|
214
|
+
this.j.mo(), this.Dl(!0);
|
|
215
|
+
}
|
|
216
|
+
zr(t, s) {
|
|
217
|
+
this.j.mo(),
|
|
218
|
+
r.D.info("Requesting explicit trigger refresh."),
|
|
219
|
+
this.Dl(null, !0, null, t, s);
|
|
220
|
+
}
|
|
221
|
+
Nn(t, i) {
|
|
222
|
+
const e = r.A.Ol,
|
|
223
|
+
n = { a: t, l: i },
|
|
224
|
+
l = s.G(e, n);
|
|
225
|
+
return l && r.D.info(`Logged alias ${t} with label ${i}`), l;
|
|
226
|
+
}
|
|
227
|
+
In(i, e, n) {
|
|
228
|
+
if (this.gt.hu(e))
|
|
229
|
+
return (
|
|
230
|
+
r.D.info(`Custom Attribute "${e}" is blocklisted, ignoring.`), new t()
|
|
231
|
+
);
|
|
232
|
+
const l = { key: e, value: n },
|
|
233
|
+
h = s.G(i, l);
|
|
234
|
+
return h && r.D.info(`Logged custom attribute: ${e} with value: ${n}`), h;
|
|
235
|
+
}
|
|
236
|
+
setLastKnownLocation(t, i, e, n, l, h) {
|
|
237
|
+
const o = { latitude: i, longitude: e };
|
|
238
|
+
null != n && (o.altitude = n),
|
|
239
|
+
null != l && (o.ll_accuracy = l),
|
|
240
|
+
null != h && (o.alt_accuracy = h);
|
|
241
|
+
const u = s.G(r.A.Ul, o, t);
|
|
242
|
+
return (
|
|
243
|
+
u &&
|
|
244
|
+
r.D.info(
|
|
245
|
+
`Set user last known location as ${JSON.stringify(o, null, 2)}`
|
|
246
|
+
),
|
|
247
|
+
u
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
kr(t, s) {
|
|
251
|
+
const i = this.j.mo();
|
|
252
|
+
return new ue(this.v.getUserId(), r.A.xl, t, i, { cid: s });
|
|
253
|
+
}
|
|
254
|
+
Ln() {
|
|
255
|
+
const t = r.xt.Ft;
|
|
256
|
+
new r.qt(t, r.D).setItem(t.$t.Kl, 1, {
|
|
257
|
+
baseUrl: this.Bo,
|
|
258
|
+
data: { api_key: this._r, device_id: this.Ur.te().id },
|
|
259
|
+
userId: this.v.getUserId(),
|
|
260
|
+
sdkAuthEnabled: this.Ko.Jn()
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
wr(t) {
|
|
264
|
+
for (const s of t)
|
|
265
|
+
if (s.api_key === this._r) this.vt.la(s.events, s.attributes);
|
|
266
|
+
else {
|
|
267
|
+
const t = r.xt.Ft;
|
|
268
|
+
new r.qt(t, r.D).setItem(t.$t.$r, r.it.nt(), s);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
Tn(i, e, n) {
|
|
272
|
+
if (this.gt.hu(i))
|
|
273
|
+
return (
|
|
274
|
+
r.D.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()
|
|
275
|
+
);
|
|
276
|
+
let l, h;
|
|
277
|
+
return (
|
|
278
|
+
null === e && null === n
|
|
279
|
+
? ((l = r.A.Wl), (h = { key: i }))
|
|
280
|
+
: ((l = r.A.Bl), (h = { key: i, latitude: e, longitude: n })),
|
|
281
|
+
s.G(l, h)
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
$n(t, i) {
|
|
285
|
+
const e = { group_id: t, status: i };
|
|
286
|
+
return s.G(r.A.Gl, e);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export default class xt
|
|
1
|
+
export default class xt {
|
|
2
|
+
constructor(t) {
|
|
3
|
+
this.Jl = t;
|
|
4
|
+
}
|
|
5
|
+
Hl(t) {
|
|
6
|
+
return null == this.Jl || this.Jl === t[0];
|
|
7
|
+
}
|
|
8
|
+
static fromJson(t) {
|
|
9
|
+
return new xt(t ? t.event_name : null);
|
|
10
|
+
}
|
|
11
|
+
ss() {
|
|
12
|
+
return this.Jl;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import kt from "./filter-set.js";
|
|
2
|
+
export default class Dt {
|
|
3
|
+
constructor(t, s) {
|
|
4
|
+
(this.Jl = t), (this.Ql = s);
|
|
5
|
+
}
|
|
6
|
+
Hl(t) {
|
|
7
|
+
if (null == this.Jl || null == this.Ql) return !1;
|
|
8
|
+
const s = t[0],
|
|
9
|
+
r = t[1];
|
|
10
|
+
return s === this.Jl && this.Ql.Hl(r);
|
|
11
|
+
}
|
|
12
|
+
static fromJson(t) {
|
|
13
|
+
return new Dt(
|
|
14
|
+
t ? t.event_name : null,
|
|
15
|
+
t ? kt.fromJson(t.property_filters) : null
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
ss() {
|
|
19
|
+
return { e: this.Jl, pf: this.Ql.ss() };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1 +1,55 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Gt from "./filter.js";
|
|
2
|
+
import { isArray as p } from "../../util/code-utils.js";
|
|
3
|
+
export default class kt {
|
|
4
|
+
constructor(t) {
|
|
5
|
+
this.filters = t;
|
|
6
|
+
}
|
|
7
|
+
Hl(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].Hl(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(Gt.fromJson(s[t]));
|
|
31
|
+
r.push(o);
|
|
32
|
+
}
|
|
33
|
+
return new kt(r);
|
|
34
|
+
}
|
|
35
|
+
ss() {
|
|
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].ss());
|
|
41
|
+
t.push(o);
|
|
42
|
+
}
|
|
43
|
+
return t;
|
|
44
|
+
}
|
|
45
|
+
static Sn(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(Gt.Sn(s[t]));
|
|
51
|
+
r.push(o);
|
|
52
|
+
}
|
|
53
|
+
return new kt(r);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1 +1,98 @@
|
|
|
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 l,
|
|
4
|
+
dateFromUnixTimestamp as h,
|
|
5
|
+
secondsAgo as Ht,
|
|
6
|
+
secondsInTheFuture as Ut
|
|
7
|
+
} from "../../util/date-utils.js";
|
|
8
|
+
export default class Gt {
|
|
9
|
+
constructor(t, s, e, i) {
|
|
10
|
+
(this.Xl = t),
|
|
11
|
+
(this.Vl = s),
|
|
12
|
+
(this.comparator = e),
|
|
13
|
+
(this.Yl = i),
|
|
14
|
+
this.Vl === Gt.Th.Zl &&
|
|
15
|
+
this.comparator !== Gt._h.Ah &&
|
|
16
|
+
this.comparator !== Gt._h.yh &&
|
|
17
|
+
this.comparator !== Gt._h.Mh &&
|
|
18
|
+
this.comparator !== Gt._h.Rh &&
|
|
19
|
+
(this.Yl = h(this.Yl));
|
|
20
|
+
}
|
|
21
|
+
Hl(t) {
|
|
22
|
+
let s = null;
|
|
23
|
+
switch ((null != t && (s = t[this.Xl]), this.comparator)) {
|
|
24
|
+
case Gt._h.Hh:
|
|
25
|
+
return null != s && s.valueOf() === this.Yl.valueOf();
|
|
26
|
+
case Gt._h.Lh:
|
|
27
|
+
return null == s || s.valueOf() !== this.Yl.valueOf();
|
|
28
|
+
case Gt._h.Ih:
|
|
29
|
+
return typeof s == typeof this.Yl && s > this.Yl;
|
|
30
|
+
case Gt._h.Ah:
|
|
31
|
+
return this.Vl === Gt.Th.Zl
|
|
32
|
+
? null != s && yt(s) && Ht(s) <= this.Yl
|
|
33
|
+
: typeof s == typeof this.Yl && s >= this.Yl;
|
|
34
|
+
case Gt._h.Oh:
|
|
35
|
+
return typeof s == typeof this.Yl && s < this.Yl;
|
|
36
|
+
case Gt._h.yh:
|
|
37
|
+
return this.Vl === Gt.Th.Zl
|
|
38
|
+
? null != s && yt(s) && Ht(s) >= this.Yl
|
|
39
|
+
: typeof s == typeof this.Yl && s <= this.Yl;
|
|
40
|
+
case Gt._h.Uh:
|
|
41
|
+
return (
|
|
42
|
+
null != s &&
|
|
43
|
+
"string" == typeof s &&
|
|
44
|
+
typeof s == typeof this.Yl &&
|
|
45
|
+
null != s.match(this.Yl)
|
|
46
|
+
);
|
|
47
|
+
case Gt._h.Qh:
|
|
48
|
+
return null != s;
|
|
49
|
+
case Gt._h.Xh:
|
|
50
|
+
return null == s;
|
|
51
|
+
case Gt._h.Mh:
|
|
52
|
+
return null != s && yt(s) && Ut(s) < this.Yl;
|
|
53
|
+
case Gt._h.Rh:
|
|
54
|
+
return null != s && yt(s) && Ut(s) > this.Yl;
|
|
55
|
+
case Gt._h.Bh:
|
|
56
|
+
return (
|
|
57
|
+
null == s ||
|
|
58
|
+
typeof s != typeof this.Yl ||
|
|
59
|
+
"string" != typeof s ||
|
|
60
|
+
null == s.match(this.Yl)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
return !1;
|
|
64
|
+
}
|
|
65
|
+
static fromJson(t) {
|
|
66
|
+
return new Gt(
|
|
67
|
+
t.property_key,
|
|
68
|
+
t.property_type,
|
|
69
|
+
t.comparator,
|
|
70
|
+
t.property_value
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
ss() {
|
|
74
|
+
let t = this.Yl;
|
|
75
|
+
return (
|
|
76
|
+
yt(this.Yl) && (t = l(t.valueOf())),
|
|
77
|
+
{ k: this.Xl, t: this.Vl, c: this.comparator, v: t }
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
static Sn(t) {
|
|
81
|
+
return new Gt(t.k, t.t, t.c, t.v);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
(Gt._h = {
|
|
85
|
+
Hh: 1,
|
|
86
|
+
Lh: 2,
|
|
87
|
+
Ih: 3,
|
|
88
|
+
Ah: 4,
|
|
89
|
+
Oh: 5,
|
|
90
|
+
yh: 6,
|
|
91
|
+
Uh: 10,
|
|
92
|
+
Qh: 11,
|
|
93
|
+
Xh: 12,
|
|
94
|
+
Mh: 15,
|
|
95
|
+
Rh: 16,
|
|
96
|
+
Bh: 17
|
|
97
|
+
}),
|
|
98
|
+
(Gt.Th = { Fh: "boolean", kh: "number", Jh: "string", Zl: "date" });
|
|
@@ -1 +1,25 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Kt from "./trigger-condition.js";
|
|
2
|
+
export default class Qt {
|
|
3
|
+
constructor(t, i) {
|
|
4
|
+
(this.fu = t), (this.au = i);
|
|
5
|
+
}
|
|
6
|
+
Hl(t) {
|
|
7
|
+
if (null == this.fu) return !1;
|
|
8
|
+
const i = Kt.du(t[0], this.fu);
|
|
9
|
+
if (!i) return !1;
|
|
10
|
+
let r = null == this.au || 0 === this.au.length;
|
|
11
|
+
if (null != this.au)
|
|
12
|
+
for (let i = 0; i < this.au.length; i++)
|
|
13
|
+
if (this.au[i] === t[1]) {
|
|
14
|
+
r = !0;
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
return i && r;
|
|
18
|
+
}
|
|
19
|
+
static fromJson(t) {
|
|
20
|
+
return new Qt(t ? t.id : null, t ? t.buttons : null);
|
|
21
|
+
}
|
|
22
|
+
ss() {
|
|
23
|
+
return this.fu;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class Wt {
|
|
2
|
+
constructor(t) {
|
|
3
|
+
this.productId = t;
|
|
4
|
+
}
|
|
5
|
+
Hl(t) {
|
|
6
|
+
return null == this.productId || t[0] === this.productId;
|
|
7
|
+
}
|
|
8
|
+
static fromJson(t) {
|
|
9
|
+
return new Wt(t ? t.product_id : null);
|
|
10
|
+
}
|
|
11
|
+
ss() {
|
|
12
|
+
return this.productId;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import kt from "./filter-set.js";
|
|
2
|
+
export default class Xt {
|
|
3
|
+
constructor(t, s) {
|
|
4
|
+
(this.productId = t), (this.Ql = s);
|
|
5
|
+
}
|
|
6
|
+
Hl(t) {
|
|
7
|
+
if (null == this.productId || null == this.Ql) return !1;
|
|
8
|
+
const s = t[0],
|
|
9
|
+
i = t[1];
|
|
10
|
+
return s === this.productId && this.Ql.Hl(i);
|
|
11
|
+
}
|
|
12
|
+
static fromJson(t) {
|
|
13
|
+
return new Xt(
|
|
14
|
+
t ? t.product_id : null,
|
|
15
|
+
t ? kt.fromJson(t.property_filters) : null
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
ss() {
|
|
19
|
+
return { id: this.productId, pf: this.Ql.ss() };
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Kt from "./trigger-condition.js";
|
|
2
|
+
export default class Yt {
|
|
3
|
+
constructor(t) {
|
|
4
|
+
this.fu = t;
|
|
5
|
+
}
|
|
6
|
+
Hl(t) {
|
|
7
|
+
return null == this.fu || Kt.du(t[0], this.fu);
|
|
8
|
+
}
|
|
9
|
+
static fromJson(t) {
|
|
10
|
+
return new Yt(t ? t.campaign_id : null);
|
|
11
|
+
}
|
|
12
|
+
ss() {
|
|
13
|
+
return this.fu;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1 +1,109 @@
|
|
|
1
|
-
import xt from
|
|
1
|
+
import xt from "./custom-event-data.js";
|
|
2
|
+
import Dt from "./custom-event-property-data.js";
|
|
3
|
+
import kt from "./filter-set.js";
|
|
4
|
+
import Qt from "./in-app-message-click-data.js";
|
|
5
|
+
import Wt from "./purchase-data.js";
|
|
6
|
+
import Xt from "./purchase-property-data.js";
|
|
7
|
+
import Yt from "./push-click-data.js";
|
|
8
|
+
import V from "./trigger-events.js";
|
|
9
|
+
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
10
|
+
export default class Kt {
|
|
11
|
+
constructor(e, t) {
|
|
12
|
+
(this.type = e), (this.data = t);
|
|
13
|
+
}
|
|
14
|
+
ec(e, t) {
|
|
15
|
+
return Kt.tc[this.type] === e && (null == this.data || this.data.Hl(t));
|
|
16
|
+
}
|
|
17
|
+
static du(e, t) {
|
|
18
|
+
let a = null;
|
|
19
|
+
try {
|
|
20
|
+
a = window.atob(e);
|
|
21
|
+
} catch (t) {
|
|
22
|
+
return (
|
|
23
|
+
r.D.info("Failed to unencode analytics id " + e + ": " + t.message), !1
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
return t === a.split("_")[0];
|
|
27
|
+
}
|
|
28
|
+
static fromJson(e) {
|
|
29
|
+
const t = e.type;
|
|
30
|
+
let r;
|
|
31
|
+
switch (t) {
|
|
32
|
+
case Kt.rc.OPEN:
|
|
33
|
+
r = null;
|
|
34
|
+
break;
|
|
35
|
+
case Kt.rc.Rr:
|
|
36
|
+
r = Wt.fromJson(e.data);
|
|
37
|
+
break;
|
|
38
|
+
case Kt.rc.ac:
|
|
39
|
+
r = Xt.fromJson(e.data);
|
|
40
|
+
break;
|
|
41
|
+
case Kt.rc.vr:
|
|
42
|
+
r = Yt.fromJson(e.data);
|
|
43
|
+
break;
|
|
44
|
+
case Kt.rc.be:
|
|
45
|
+
r = xt.fromJson(e.data);
|
|
46
|
+
break;
|
|
47
|
+
case Kt.rc.sc:
|
|
48
|
+
r = Dt.fromJson(e.data);
|
|
49
|
+
break;
|
|
50
|
+
case Kt.rc.Ar:
|
|
51
|
+
r = Qt.fromJson(e.data);
|
|
52
|
+
break;
|
|
53
|
+
case Kt.rc.ks:
|
|
54
|
+
r = null;
|
|
55
|
+
}
|
|
56
|
+
return new Kt(t, r);
|
|
57
|
+
}
|
|
58
|
+
ss() {
|
|
59
|
+
return { t: this.type, d: this.data ? this.data.ss() : null };
|
|
60
|
+
}
|
|
61
|
+
static Sn(e) {
|
|
62
|
+
let t, r;
|
|
63
|
+
switch (e.t) {
|
|
64
|
+
case Kt.rc.OPEN:
|
|
65
|
+
t = null;
|
|
66
|
+
break;
|
|
67
|
+
case Kt.rc.Rr:
|
|
68
|
+
t = new Wt(e.d);
|
|
69
|
+
break;
|
|
70
|
+
case Kt.rc.ac:
|
|
71
|
+
(r = e.d || {}), (t = new Xt(r.id, kt.Sn(r.pf || [])));
|
|
72
|
+
break;
|
|
73
|
+
case Kt.rc.vr:
|
|
74
|
+
t = new Yt(e.d);
|
|
75
|
+
break;
|
|
76
|
+
case Kt.rc.be:
|
|
77
|
+
t = new xt(e.d);
|
|
78
|
+
break;
|
|
79
|
+
case Kt.rc.sc:
|
|
80
|
+
(r = e.d || {}), (t = new Dt(r.e, kt.Sn(r.pf || [])));
|
|
81
|
+
break;
|
|
82
|
+
case Kt.rc.Ar:
|
|
83
|
+
t = new Qt(e.d);
|
|
84
|
+
break;
|
|
85
|
+
case Kt.rc.ks:
|
|
86
|
+
t = null;
|
|
87
|
+
}
|
|
88
|
+
return new Kt(e.t, t);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
(Kt.rc = {
|
|
92
|
+
OPEN: "open",
|
|
93
|
+
Rr: "purchase",
|
|
94
|
+
ac: "purchase_property",
|
|
95
|
+
vr: "push_click",
|
|
96
|
+
be: "custom_event",
|
|
97
|
+
sc: "custom_event_property",
|
|
98
|
+
Ar: "iam_click",
|
|
99
|
+
ks: "test"
|
|
100
|
+
}),
|
|
101
|
+
(Kt.tc = {}),
|
|
102
|
+
(Kt.tc[Kt.rc.OPEN] = V.OPEN),
|
|
103
|
+
(Kt.tc[Kt.rc.Rr] = V.Rr),
|
|
104
|
+
(Kt.tc[Kt.rc.ac] = V.Rr),
|
|
105
|
+
(Kt.tc[Kt.rc.vr] = V.vr),
|
|
106
|
+
(Kt.tc[Kt.rc.be] = V.be),
|
|
107
|
+
(Kt.tc[Kt.rc.sc] = V.be),
|
|
108
|
+
(Kt.tc[Kt.rc.Ar] = V.Ar),
|
|
109
|
+
(Kt.tc[Kt.rc.ks] = V.ks);
|