@braze/web-sdk 4.6.3 → 4.7.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 +13 -8
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +2 -2
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +18 -17
- package/shared-lib/indexed-db-adapter.js +2 -2
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +15 -15
- package/src/Core/handle-braze-action.js +40 -34
- package/src/Core/log-custom-event.js +2 -7
- package/src/Core/log-purchase.js +3 -3
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag.js +33 -16
- package/src/FeatureFlags/feature-flags-provider.js +86 -75
- package/src/FeatureFlags/get-all-feature-flags.js +5 -5
- package/src/FeatureFlags/get-feature-flag.js +6 -6
- package/src/FeatureFlags/refresh-feature-flags.js +1 -1
- package/src/FeatureFlags/types.js +1 -0
- package/src/Feed/feed-provider.js +17 -17
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +135 -120
- package/src/InAppMessage/display/in-app-message-to-html.js +21 -21
- package/src/InAppMessage/display/modal-utils.js +6 -6
- package/src/InAppMessage/in-app-message-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager-factory.js +3 -3
- package/src/InAppMessage/in-app-message-manager.js +65 -65
- package/src/InAppMessage/log-in-app-message-button-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +1 -1
- package/src/InAppMessage/models/html-message.js +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +80 -80
- package/src/InAppMessage/models/modal-message.js +2 -2
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- package/src/InAppMessage/models/templated-in-app-message.js +4 -4
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +20 -20
- package/src/Push/push-manager.js +216 -209
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +11 -8
- package/src/User/user.js +52 -41
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -0
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/managers/auth-manager.js +24 -24
- package/src/managers/braze-instance.js +120 -120
- package/src/managers/device-manager.js +11 -11
- package/src/managers/network-manager.js +63 -54
- package/src/managers/server-config-manager.js +20 -20
- package/src/managers/session-manager.js +29 -29
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +104 -104
- package/src/managers/subscription-manager.js +6 -6
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +1 -1
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +3 -3
- package/src/models/server-config.js +15 -15
- package/src/request-controller.js +92 -88
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +63 -63
- package/src/triggers/models/in-app-message-click-data.js +5 -5
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +9 -9
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +48 -48
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +29 -29
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +87 -89
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +4 -4
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +8 -8
- package/src/util/browser-detector.js +8 -8
- package/src/util/client-hints-parser.js +3 -3
- package/src/util/code-utils.js +10 -3
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +9 -9
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +3 -3
- package/src/util/user-agent-parser.js +4 -4
- package/src/util/validation-utils.js +155 -74
- package/src/util/window-utils.js +1 -1
|
@@ -7,47 +7,47 @@ import r from "../shared-lib/braze-shared-lib.js";
|
|
|
7
7
|
import { STORAGE_KEYS as o } from "./managers/storage-manager.js";
|
|
8
8
|
import u from "./managers/subscription-manager.js";
|
|
9
9
|
import dt from "./Push/utils/push-utils.js";
|
|
10
|
-
export default class
|
|
10
|
+
export default class Rt {
|
|
11
11
|
constructor(t, s, i, e, n, l, h, o, r, a) {
|
|
12
12
|
(this._r = t),
|
|
13
|
-
(this.
|
|
13
|
+
(this.Uo = s),
|
|
14
14
|
(this.kl = 0),
|
|
15
|
-
(this.yl = h.
|
|
16
|
-
(this.
|
|
15
|
+
(this.yl = h.Ba()),
|
|
16
|
+
(this.Sl = null),
|
|
17
17
|
(this.j = i),
|
|
18
18
|
(this.Ur = e),
|
|
19
19
|
(this.v = n),
|
|
20
20
|
(this.gt = l),
|
|
21
21
|
(this.h = h),
|
|
22
|
-
(this.
|
|
22
|
+
(this.Vo = r),
|
|
23
23
|
(this.vt = a),
|
|
24
|
-
(this
|
|
25
|
-
(this
|
|
26
|
-
(this.
|
|
24
|
+
(this.jl = o),
|
|
25
|
+
(this.$l = new u()),
|
|
26
|
+
(this.Al = 50);
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
return !t && !s && this.
|
|
28
|
+
Cl(t, s) {
|
|
29
|
+
return !t && !s && this.Vo.Wn() >= this.Al;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
let s = this.j.
|
|
31
|
+
Tl(t) {
|
|
32
|
+
let s = this.j.Ch();
|
|
33
33
|
if (t.length > 0) {
|
|
34
34
|
const i = this.v.getUserId();
|
|
35
35
|
for (const e of t) {
|
|
36
36
|
const t = (!e.userId && !i) || e.userId === i;
|
|
37
|
-
e.type === r.A.
|
|
37
|
+
e.type === r.A.yh && t && (s = !0);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return s;
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
null == i && (i = !0), i && this.
|
|
44
|
-
const u = this.h.
|
|
45
|
-
a = this.h.
|
|
42
|
+
_l(t, s, i, e, n, l, h) {
|
|
43
|
+
null == i && (i = !0), i && this.ql();
|
|
44
|
+
const u = this.h.ya(),
|
|
45
|
+
a = this.h.La();
|
|
46
46
|
let c = !1;
|
|
47
47
|
const d = (t, s) => {
|
|
48
48
|
let h = !1;
|
|
49
49
|
b.Hs({
|
|
50
|
-
url: this.
|
|
50
|
+
url: this.Uo + "/data/",
|
|
51
51
|
data: t,
|
|
52
52
|
headers: s,
|
|
53
53
|
S: i => {
|
|
@@ -55,15 +55,15 @@ export default class Lt {
|
|
|
55
55
|
t.respond_with.triggers &&
|
|
56
56
|
(this.kl = Math.max(this.kl - 1, 0)),
|
|
57
57
|
this.vt.Os(t, i, s)
|
|
58
|
-
? (this.
|
|
58
|
+
? (this.Vo.Qs(),
|
|
59
59
|
this.gt.al(i),
|
|
60
60
|
(null != t.respond_with &&
|
|
61
61
|
t.respond_with.user_id != this.v.getUserId()) ||
|
|
62
|
-
(null != t.device && this.h.B(o.q.
|
|
62
|
+
(null != t.device && this.h.B(o.q.Qo, t.device),
|
|
63
63
|
null != t.sdk_metadata &&
|
|
64
|
-
(this.h.B(o.q.
|
|
65
|
-
this.h.B(o.q.
|
|
66
|
-
this
|
|
64
|
+
(this.h.B(o.q.sa, t.sdk_metadata),
|
|
65
|
+
this.h.B(o.q.oa, this.j.ua())),
|
|
66
|
+
this.jl(i),
|
|
67
67
|
"function" == typeof e && e()))
|
|
68
68
|
: i.auth_error && (h = !0);
|
|
69
69
|
},
|
|
@@ -71,91 +71,91 @@ export default class Lt {
|
|
|
71
71
|
null != t.respond_with &&
|
|
72
72
|
t.respond_with.triggers &&
|
|
73
73
|
(this.kl = Math.max(this.kl - 1, 0)),
|
|
74
|
-
this.vt.
|
|
74
|
+
this.vt.ha(t.events, t.attributes),
|
|
75
75
|
"function" == typeof n && n();
|
|
76
76
|
},
|
|
77
|
-
|
|
77
|
+
wi: t => {
|
|
78
78
|
if (("function" == typeof l && l(t), i && !c)) {
|
|
79
|
-
if (t && !h) this.
|
|
79
|
+
if (t && !h) this.Fl();
|
|
80
80
|
else {
|
|
81
|
-
let t = this.
|
|
81
|
+
let t = this.Sl;
|
|
82
82
|
(null == t || t < 1e3 * this.yl) && (t = 1e3 * this.yl),
|
|
83
|
-
this.
|
|
83
|
+
this.Fl(Math.min(3e5, tt(1e3 * this.yl, 3 * t)));
|
|
84
84
|
}
|
|
85
85
|
c = !0;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
},
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (this.
|
|
90
|
+
f = this.Tl(u),
|
|
91
|
+
m = s || f;
|
|
92
|
+
if (this.Cl(h, f))
|
|
93
93
|
return void r.D.info(
|
|
94
94
|
"Declining to flush data due to 50 consecutive authentication failures"
|
|
95
95
|
);
|
|
96
|
-
if (i && !this.vt.
|
|
97
|
-
return this.
|
|
98
|
-
const g = this.vt.
|
|
99
|
-
|
|
96
|
+
if (i && !this.vt.Ra(u, a, t, m))
|
|
97
|
+
return this.Fl(), void ("function" == typeof l && l(!0));
|
|
98
|
+
const g = this.vt.ba(t, m, u, a);
|
|
99
|
+
m && this.kl++;
|
|
100
100
|
let p = !1;
|
|
101
101
|
if (g)
|
|
102
102
|
for (const t of g)
|
|
103
103
|
this.vt.Gs(t.requestData, () => d(t.requestData, t.headers)), (p = !0);
|
|
104
|
-
this.
|
|
105
|
-
? this.
|
|
106
|
-
:
|
|
104
|
+
this.Vo.Jn() && i && !p
|
|
105
|
+
? this.Fl()
|
|
106
|
+
: f && (r.D.info("Invoking new session subscriptions"), this.$l.St());
|
|
107
107
|
}
|
|
108
|
-
|
|
108
|
+
Dl() {
|
|
109
109
|
return this.kl > 0;
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
this.
|
|
111
|
+
Fl(t) {
|
|
112
|
+
this.Ll ||
|
|
113
113
|
(null == t && (t = 1e3 * this.yl),
|
|
114
|
-
this.
|
|
115
|
-
(this.
|
|
114
|
+
this.ql(),
|
|
115
|
+
(this.Pl = setTimeout(() => {
|
|
116
116
|
if (document.hidden) {
|
|
117
117
|
const t = "visibilitychange",
|
|
118
118
|
s = () => {
|
|
119
119
|
document.hidden ||
|
|
120
|
-
(document.removeEventListener(t, s, !1), this.
|
|
120
|
+
(document.removeEventListener(t, s, !1), this._l());
|
|
121
121
|
};
|
|
122
122
|
document.addEventListener(t, s, !1);
|
|
123
|
-
} else this.
|
|
123
|
+
} else this._l();
|
|
124
124
|
}, t)),
|
|
125
|
-
(this.
|
|
125
|
+
(this.Sl = t));
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
null != this.
|
|
127
|
+
ql() {
|
|
128
|
+
null != this.Pl && (clearTimeout(this.Pl), (this.Pl = null));
|
|
129
129
|
}
|
|
130
130
|
initialize() {
|
|
131
|
-
(this.
|
|
131
|
+
(this.Ll = !1), this.Fl();
|
|
132
132
|
}
|
|
133
133
|
destroy() {
|
|
134
|
-
this.
|
|
135
|
-
this.
|
|
136
|
-
this.
|
|
137
|
-
(this.
|
|
138
|
-
this.
|
|
139
|
-
(this.
|
|
134
|
+
this.$l.removeAllSubscriptions(),
|
|
135
|
+
this.Vo.Rn(),
|
|
136
|
+
this.ql(),
|
|
137
|
+
(this.Ll = !0),
|
|
138
|
+
this._l(null, null, !1),
|
|
139
|
+
(this.Pl = null);
|
|
140
140
|
}
|
|
141
141
|
cr(t) {
|
|
142
|
-
return this.
|
|
142
|
+
return this.$l.ut(t);
|
|
143
143
|
}
|
|
144
144
|
openSession() {
|
|
145
|
-
const t = this.j.
|
|
146
|
-
t && (this.h.
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
145
|
+
const t = this.j.ua() !== this.j.mo();
|
|
146
|
+
t && (this.h.Ca(o.eu.Jo), this.h.Ca(o.eu.su)),
|
|
147
|
+
this._l(null, !1, null, null, null),
|
|
148
|
+
this.Bn(),
|
|
149
149
|
t &&
|
|
150
150
|
import("./Push/push-manager-factory.js").then(t => {
|
|
151
|
-
if (this.
|
|
151
|
+
if (this.Ll) return;
|
|
152
152
|
const s = t.default.aa();
|
|
153
153
|
if (
|
|
154
154
|
null != s &&
|
|
155
155
|
(dt.isPushPermissionGranted() || dt.isPushBlocked())
|
|
156
156
|
) {
|
|
157
157
|
const t = () => {
|
|
158
|
-
s.
|
|
158
|
+
s.Qr()
|
|
159
159
|
? r.D.info(
|
|
160
160
|
"Push token maintenance is disabled, not refreshing token for backend."
|
|
161
161
|
)
|
|
@@ -165,7 +165,7 @@ export default class Lt {
|
|
|
165
165
|
i && t();
|
|
166
166
|
},
|
|
167
167
|
e = () => {
|
|
168
|
-
const s = this.h.I(o.q.
|
|
168
|
+
const s = this.h.I(o.q.vn);
|
|
169
169
|
(null == s || s) && t();
|
|
170
170
|
},
|
|
171
171
|
n = r.xt.Ft;
|
|
@@ -176,27 +176,27 @@ export default class Lt {
|
|
|
176
176
|
changeUser(t, s, i) {
|
|
177
177
|
const e = this.v.getUserId();
|
|
178
178
|
if (e !== t) {
|
|
179
|
-
this.j.
|
|
180
|
-
null != e && this.
|
|
181
|
-
this.v.
|
|
182
|
-
i ? this.
|
|
179
|
+
this.j.Bh(),
|
|
180
|
+
null != e && this._l(null, !1, null, null, null),
|
|
181
|
+
this.v.ru(t),
|
|
182
|
+
i ? this.Vo.setSdkAuthenticationSignature(i) : this.Vo.On();
|
|
183
183
|
for (let t = 0; t < s.length; t++) s[t].changeUser(null == e);
|
|
184
184
|
null != e && this.h.Xs(o.q.P),
|
|
185
|
-
this.h.Xs(o.q.
|
|
185
|
+
this.h.Xs(o.q.Qo),
|
|
186
186
|
this.openSession(),
|
|
187
187
|
r.D.info('Changed user to "' + t + '".');
|
|
188
188
|
} else {
|
|
189
189
|
let s = "Doing nothing.";
|
|
190
190
|
i &&
|
|
191
|
-
this.
|
|
192
|
-
(this.
|
|
191
|
+
this.Vo.Kn() !== i &&
|
|
192
|
+
(this.Vo.setSdkAuthenticationSignature(i),
|
|
193
193
|
(s = "Updated SDK authentication signature")),
|
|
194
194
|
r.D.info(`Current user is already ${t}. ${s}`);
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
requestImmediateDataFlush(t) {
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
198
|
+
this.ql(), this.j.mo();
|
|
199
|
+
this._l(
|
|
200
200
|
null,
|
|
201
201
|
null,
|
|
202
202
|
null,
|
|
@@ -211,15 +211,15 @@ export default class Lt {
|
|
|
211
211
|
);
|
|
212
212
|
}
|
|
213
213
|
requestFeedRefresh() {
|
|
214
|
-
this.j.mo(), this.
|
|
214
|
+
this.j.mo(), this._l(!0);
|
|
215
215
|
}
|
|
216
216
|
zr(t, s) {
|
|
217
217
|
this.j.mo(),
|
|
218
218
|
r.D.info("Requesting explicit trigger refresh."),
|
|
219
|
-
this.
|
|
219
|
+
this._l(null, !0, null, t, s);
|
|
220
220
|
}
|
|
221
221
|
Nn(t, i) {
|
|
222
|
-
const e = r.A.
|
|
222
|
+
const e = r.A.Rl,
|
|
223
223
|
n = { a: t, l: i },
|
|
224
224
|
l = s.G(e, n);
|
|
225
225
|
return l && r.D.info(`Logged alias ${t} with label ${i}`), l;
|
|
@@ -231,14 +231,18 @@ export default class Lt {
|
|
|
231
231
|
);
|
|
232
232
|
const l = { key: e, value: n },
|
|
233
233
|
h = s.G(i, l);
|
|
234
|
-
|
|
234
|
+
if (h) {
|
|
235
|
+
const t = "object" == typeof n ? JSON.stringify(n, null, 2) : n;
|
|
236
|
+
r.D.info(`Logged custom attribute: ${e} with value: ${t}`);
|
|
237
|
+
}
|
|
238
|
+
return h;
|
|
235
239
|
}
|
|
236
240
|
setLastKnownLocation(t, i, e, n, l, h) {
|
|
237
241
|
const o = { latitude: i, longitude: e };
|
|
238
242
|
null != n && (o.altitude = n),
|
|
239
243
|
null != l && (o.ll_accuracy = l),
|
|
240
244
|
null != h && (o.alt_accuracy = h);
|
|
241
|
-
const u = s.G(r.A.
|
|
245
|
+
const u = s.G(r.A.Ml, o, t);
|
|
242
246
|
return (
|
|
243
247
|
u &&
|
|
244
248
|
r.D.info(
|
|
@@ -249,26 +253,26 @@ export default class Lt {
|
|
|
249
253
|
}
|
|
250
254
|
kr(t, s) {
|
|
251
255
|
const i = this.j.mo();
|
|
252
|
-
return new ue(this.v.getUserId(), r.A.
|
|
256
|
+
return new ue(this.v.getUserId(), r.A.Nl, t, i, { cid: s });
|
|
253
257
|
}
|
|
254
|
-
|
|
258
|
+
Bn() {
|
|
255
259
|
const t = r.xt.Ft;
|
|
256
|
-
new r.qt(t, r.D).setItem(t.$t.
|
|
257
|
-
baseUrl: this.
|
|
260
|
+
new r.qt(t, r.D).setItem(t.$t.Ol, 1, {
|
|
261
|
+
baseUrl: this.Uo,
|
|
258
262
|
data: { api_key: this._r, device_id: this.Ur.te().id },
|
|
259
263
|
userId: this.v.getUserId(),
|
|
260
|
-
sdkAuthEnabled: this.
|
|
264
|
+
sdkAuthEnabled: this.Vo.Jn()
|
|
261
265
|
});
|
|
262
266
|
}
|
|
263
267
|
wr(t) {
|
|
264
268
|
for (const s of t)
|
|
265
|
-
if (s.api_key === this._r) this.vt.
|
|
269
|
+
if (s.api_key === this._r) this.vt.ha(s.events, s.attributes);
|
|
266
270
|
else {
|
|
267
271
|
const t = r.xt.Ft;
|
|
268
272
|
new r.qt(t, r.D).setItem(t.$t.$r, r.it.nt(), s);
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
|
-
|
|
275
|
+
Tn(i, e, n) {
|
|
272
276
|
if (this.gt.hu(i))
|
|
273
277
|
return (
|
|
274
278
|
r.D.info(`Custom Attribute "${i}" is blocklisted, ignoring.`), new t()
|
|
@@ -276,13 +280,13 @@ export default class Lt {
|
|
|
276
280
|
let l, h;
|
|
277
281
|
return (
|
|
278
282
|
null === e && null === n
|
|
279
|
-
? ((l = r.A.
|
|
280
|
-
: ((l = r.A.
|
|
283
|
+
? ((l = r.A.Il), (h = { key: i }))
|
|
284
|
+
: ((l = r.A.Ul), (h = { key: i, latitude: e, longitude: n })),
|
|
281
285
|
s.G(l, h)
|
|
282
286
|
);
|
|
283
287
|
}
|
|
284
|
-
|
|
288
|
+
$n(t, i) {
|
|
285
289
|
const e = { group_id: t, status: i };
|
|
286
|
-
return s.G(r.A.
|
|
290
|
+
return s.G(r.A.xl, e);
|
|
287
291
|
}
|
|
288
292
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default class xt {
|
|
2
2
|
constructor(t) {
|
|
3
|
-
this.
|
|
3
|
+
this.Bl = t;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
return null == this.
|
|
5
|
+
Jl(t) {
|
|
6
|
+
return null == this.Bl || this.Bl === t[0];
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
9
|
return new xt(t ? t.event_name : null);
|
|
10
10
|
}
|
|
11
11
|
ss() {
|
|
12
|
-
return this.
|
|
12
|
+
return this.Bl;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import Gt from "./filter-set.js";
|
|
2
|
+
export default class Ht {
|
|
3
3
|
constructor(t, s) {
|
|
4
|
-
(this.
|
|
4
|
+
(this.Bl = t), (this.Gl = s);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
if (null == this.
|
|
6
|
+
Jl(t) {
|
|
7
|
+
if (null == this.Bl || null == this.Gl) return !1;
|
|
8
8
|
const s = t[0],
|
|
9
9
|
r = t[1];
|
|
10
|
-
return s === this.
|
|
10
|
+
return s === this.Bl && this.Gl.Jl(r);
|
|
11
11
|
}
|
|
12
12
|
static fromJson(t) {
|
|
13
|
-
return new
|
|
13
|
+
return new Ht(
|
|
14
14
|
t ? t.event_name : null,
|
|
15
|
-
t ?
|
|
15
|
+
t ? Gt.fromJson(t.property_filters) : null
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
ss() {
|
|
19
|
-
return { e: this.
|
|
19
|
+
return { e: this.Bl, pf: this.Gl.ss() };
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Vt from "./filter.js";
|
|
2
2
|
import { isArray as p } from "../../util/code-utils.js";
|
|
3
|
-
export default class
|
|
3
|
+
export default class Gt {
|
|
4
4
|
constructor(t) {
|
|
5
5
|
this.filters = t;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
Jl(t) {
|
|
8
8
|
let r = !0;
|
|
9
9
|
for (let e = 0; e < this.filters.length; e++) {
|
|
10
10
|
const o = this.filters[e];
|
|
11
11
|
let s = !1;
|
|
12
12
|
for (let r = 0; r < o.length; r++)
|
|
13
|
-
if (o[r].
|
|
13
|
+
if (o[r].Jl(t)) {
|
|
14
14
|
s = !0;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
@@ -27,10 +27,10 @@ export default class kt {
|
|
|
27
27
|
for (let e = 0; e < t.length; e++) {
|
|
28
28
|
const o = [],
|
|
29
29
|
s = t[e];
|
|
30
|
-
for (let t = 0; t < s.length; t++) o.push(
|
|
30
|
+
for (let t = 0; t < s.length; t++) o.push(Vt.fromJson(s[t]));
|
|
31
31
|
r.push(o);
|
|
32
32
|
}
|
|
33
|
-
return new
|
|
33
|
+
return new Gt(r);
|
|
34
34
|
}
|
|
35
35
|
ss() {
|
|
36
36
|
const t = [];
|
|
@@ -42,14 +42,14 @@ export default class kt {
|
|
|
42
42
|
}
|
|
43
43
|
return t;
|
|
44
44
|
}
|
|
45
|
-
static
|
|
45
|
+
static Pn(t) {
|
|
46
46
|
const r = [];
|
|
47
47
|
for (let e = 0; e < t.length; e++) {
|
|
48
48
|
const o = [],
|
|
49
49
|
s = t[e];
|
|
50
|
-
for (let t = 0; t < s.length; t++) o.push(
|
|
50
|
+
for (let t = 0; t < s.length; t++) o.push(Vt.Pn(s[t]));
|
|
51
51
|
r.push(o);
|
|
52
52
|
}
|
|
53
|
-
return new
|
|
53
|
+
return new Gt(r);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { isDate as
|
|
1
|
+
import { isDate as Nt } from "../../util/code-utils.js";
|
|
2
2
|
import {
|
|
3
3
|
convertMsToSeconds as l,
|
|
4
4
|
dateFromUnixTimestamp as h,
|
|
5
|
-
secondsAgo as
|
|
6
|
-
secondsInTheFuture as
|
|
5
|
+
secondsAgo as Qt,
|
|
6
|
+
secondsInTheFuture as Wt
|
|
7
7
|
} from "../../util/date-utils.js";
|
|
8
|
-
export default class
|
|
8
|
+
export default class Vt {
|
|
9
9
|
constructor(t, s, e, i) {
|
|
10
|
-
(this.
|
|
11
|
-
(this.
|
|
10
|
+
(this.Hl = t),
|
|
11
|
+
(this.Ql = s),
|
|
12
12
|
(this.comparator = e),
|
|
13
|
-
(this.
|
|
14
|
-
this.
|
|
15
|
-
this.comparator !==
|
|
16
|
-
this.comparator !==
|
|
17
|
-
this.comparator !==
|
|
18
|
-
this.comparator !==
|
|
19
|
-
(this.
|
|
13
|
+
(this.Xl = i),
|
|
14
|
+
this.Ql === Vt.Kl.Vl &&
|
|
15
|
+
this.comparator !== Vt.Yl.Wl &&
|
|
16
|
+
this.comparator !== Vt.Yl.Zl &&
|
|
17
|
+
this.comparator !== Vt.Yl.Uh &&
|
|
18
|
+
this.comparator !== Vt.Yl.Qh &&
|
|
19
|
+
(this.Xl = h(this.Xl));
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
Jl(t) {
|
|
22
22
|
let s = null;
|
|
23
|
-
switch ((null != t && (s = t[this.
|
|
24
|
-
case
|
|
25
|
-
return null != s && s.valueOf() === this.
|
|
26
|
-
case
|
|
27
|
-
return null == s || s.valueOf() !== this.
|
|
28
|
-
case
|
|
29
|
-
return typeof s == typeof this.
|
|
30
|
-
case
|
|
31
|
-
return this.
|
|
32
|
-
? null != s &&
|
|
33
|
-
: typeof s == typeof this.
|
|
34
|
-
case
|
|
35
|
-
return typeof s == typeof this.
|
|
36
|
-
case
|
|
37
|
-
return this.
|
|
38
|
-
? null != s &&
|
|
39
|
-
: typeof s == typeof this.
|
|
40
|
-
case
|
|
23
|
+
switch ((null != t && (s = t[this.Hl]), this.comparator)) {
|
|
24
|
+
case Vt.Yl.Xh:
|
|
25
|
+
return null != s && s.valueOf() === this.Xl.valueOf();
|
|
26
|
+
case Vt.Yl.Vh:
|
|
27
|
+
return null == s || s.valueOf() !== this.Xl.valueOf();
|
|
28
|
+
case Vt.Yl.Kh:
|
|
29
|
+
return typeof s == typeof this.Xl && s > this.Xl;
|
|
30
|
+
case Vt.Yl.Wl:
|
|
31
|
+
return this.Ql === Vt.Kl.Vl
|
|
32
|
+
? null != s && Nt(s) && Qt(s) <= this.Xl
|
|
33
|
+
: typeof s == typeof this.Xl && s >= this.Xl;
|
|
34
|
+
case Vt.Yl.Yh:
|
|
35
|
+
return typeof s == typeof this.Xl && s < this.Xl;
|
|
36
|
+
case Vt.Yl.Zl:
|
|
37
|
+
return this.Ql === Vt.Kl.Vl
|
|
38
|
+
? null != s && Nt(s) && Qt(s) >= this.Xl
|
|
39
|
+
: typeof s == typeof this.Xl && s <= this.Xl;
|
|
40
|
+
case Vt.Yl.Zh:
|
|
41
41
|
return (
|
|
42
42
|
null != s &&
|
|
43
43
|
"string" == typeof s &&
|
|
44
|
-
typeof s == typeof this.
|
|
45
|
-
null != s.match(this.
|
|
44
|
+
typeof s == typeof this.Xl &&
|
|
45
|
+
null != s.match(this.Xl)
|
|
46
46
|
);
|
|
47
|
-
case
|
|
47
|
+
case Vt.Yl.$h:
|
|
48
48
|
return null != s;
|
|
49
|
-
case
|
|
49
|
+
case Vt.Yl.Eu:
|
|
50
50
|
return null == s;
|
|
51
|
-
case
|
|
52
|
-
return null != s &&
|
|
53
|
-
case
|
|
54
|
-
return null != s &&
|
|
55
|
-
case
|
|
51
|
+
case Vt.Yl.Uh:
|
|
52
|
+
return null != s && Nt(s) && Wt(s) < this.Xl;
|
|
53
|
+
case Vt.Yl.Qh:
|
|
54
|
+
return null != s && Nt(s) && Wt(s) > this.Xl;
|
|
55
|
+
case Vt.Yl.au:
|
|
56
56
|
return (
|
|
57
57
|
null == s ||
|
|
58
|
-
typeof s != typeof this.
|
|
58
|
+
typeof s != typeof this.Xl ||
|
|
59
59
|
"string" != typeof s ||
|
|
60
|
-
null == s.match(this.
|
|
60
|
+
null == s.match(this.Xl)
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
static fromJson(t) {
|
|
66
|
-
return new
|
|
66
|
+
return new Vt(
|
|
67
67
|
t.property_key,
|
|
68
68
|
t.property_type,
|
|
69
69
|
t.comparator,
|
|
@@ -71,28 +71,28 @@ export default class Gt {
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
ss() {
|
|
74
|
-
let t = this.
|
|
74
|
+
let t = this.Xl;
|
|
75
75
|
return (
|
|
76
|
-
|
|
77
|
-
{ k: this.
|
|
76
|
+
Nt(this.Xl) && (t = l(t.valueOf())),
|
|
77
|
+
{ k: this.Hl, t: this.Ql, c: this.comparator, v: t }
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
|
-
static
|
|
81
|
-
return new
|
|
80
|
+
static Pn(t) {
|
|
81
|
+
return new Vt(t.k, t.t, t.c, t.v);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
84
|
+
(Vt.Yl = {
|
|
85
|
+
Xh: 1,
|
|
86
|
+
Vh: 2,
|
|
87
|
+
Kh: 3,
|
|
88
|
+
Wl: 4,
|
|
89
|
+
Yh: 5,
|
|
90
|
+
Zl: 6,
|
|
91
|
+
Zh: 10,
|
|
92
|
+
$h: 11,
|
|
93
|
+
Eu: 12,
|
|
94
|
+
Uh: 15,
|
|
95
|
+
Qh: 16,
|
|
96
|
+
au: 17
|
|
97
97
|
}),
|
|
98
|
-
(
|
|
98
|
+
(Vt.Kl = { Tu: "boolean", Au: "number", _u: "string", Vl: "date" });
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default class
|
|
1
|
+
import Yt from "./trigger-condition.js";
|
|
2
|
+
export default class Zt {
|
|
3
3
|
constructor(t, i) {
|
|
4
4
|
(this.fu = t), (this.du = i);
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
Jl(t) {
|
|
7
7
|
if (null == this.fu) return !1;
|
|
8
|
-
const i =
|
|
8
|
+
const i = Yt.gu(t[0], this.fu);
|
|
9
9
|
if (!i) return !1;
|
|
10
10
|
let r = null == this.du || 0 === this.du.length;
|
|
11
11
|
if (null != this.du)
|
|
@@ -17,7 +17,7 @@ export default class Qt {
|
|
|
17
17
|
return i && r;
|
|
18
18
|
}
|
|
19
19
|
static fromJson(t) {
|
|
20
|
-
return new
|
|
20
|
+
return new Zt(t ? t.id : null, t ? t.buttons : null);
|
|
21
21
|
}
|
|
22
22
|
ss() {
|
|
23
23
|
return this.fu;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default class
|
|
1
|
+
export default class $t {
|
|
2
2
|
constructor(t) {
|
|
3
3
|
this.productId = t;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
Jl(t) {
|
|
6
6
|
return null == this.productId || t[0] === this.productId;
|
|
7
7
|
}
|
|
8
8
|
static fromJson(t) {
|
|
9
|
-
return new
|
|
9
|
+
return new $t(t ? t.product_id : null);
|
|
10
10
|
}
|
|
11
11
|
ss() {
|
|
12
12
|
return this.productId;
|