@braze/web-sdk 6.6.0 → 6.7.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 +253 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +21 -20
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +26 -26
- package/src/Banner/banner-factory.js +11 -1
- package/src/Banner/banner-provider.js +244 -120
- package/src/Banner/banner.js +14 -12
- package/src/Banner/display/banner-to-html.js +23 -16
- package/src/Banner/display/detect-banner-impressions.js +13 -13
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +4 -4
- package/src/Banner/log-banner-click.js +4 -4
- package/src/Banner/log-banner-dismissal.js +23 -0
- package/src/Banner/log-banner-impressions.js +7 -7
- package/src/Banner/request-banners-refresh.js +12 -16
- package/src/Banner/subscribe-to-banners-updates.js +6 -6
- package/src/Banner/ui/insert-banner.js +12 -12
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +33 -33
- package/src/Card/constants.js +1 -1
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +18 -18
- package/src/Card/util/card-factory.js +41 -41
- package/src/ContentCards/content-cards-provider-factory.js +12 -12
- package/src/ContentCards/content-cards-provider.js +151 -151
- package/src/ContentCards/content-cards.js +5 -5
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +6 -6
- package/src/ContentCards/ui/show-content-cards.js +10 -10
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +9 -9
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +8 -8
- package/src/Core/log-purchase.js +5 -5
- package/src/Core/open-session.js +7 -7
- package/src/Core/set-sdk-authentication-signature.js +3 -3
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-provider-factory.js +11 -11
- package/src/DUST/dust-provider.js +255 -255
- package/src/DUST/dust-shared-worker-impl.js +100 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/InAppMessage/constants.js +83 -2
- package/src/InAppMessage/display/html-message-display-utils.js +15 -15
- package/src/InAppMessage/display/html-message-to-html.js +36 -37
- package/src/InAppMessage/display/in-app-message-to-html.js +44 -44
- package/src/InAppMessage/display/modal-utils.js +10 -14
- package/src/InAppMessage/in-app-message-factory.js +16 -20
- package/src/InAppMessage/in-app-message-manager.js +115 -116
- package/src/InAppMessage/log-in-app-message-button-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +56 -49
- package/src/InAppMessage/models/html-message.js +31 -27
- package/src/InAppMessage/models/in-app-message-button.js +12 -12
- package/src/InAppMessage/models/in-app-message.js +202 -256
- package/src/InAppMessage/models/modal-message.js +55 -49
- package/src/InAppMessage/models/slide-up-message.js +57 -51
- package/src/InAppMessage/models/templated-in-app-message.js +10 -10
- package/src/InAppMessage/shared-types.js +1 -0
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +43 -41
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager-factory.js +9 -9
- package/src/Push/push-manager.js +15 -15
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +60 -59
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -1
- package/src/common/content-cards-display.js +38 -38
- package/src/common/event-logger.js +8 -8
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +197 -186
- package/src/managers/constants.js +1 -0
- package/src/managers/device-manager.js +25 -25
- package/src/managers/network-manager.js +155 -155
- package/src/managers/server-config-manager.js +106 -93
- package/src/managers/session-manager.js +37 -33
- package/src/managers/storage-manager-factory.js +33 -28
- package/src/managers/storage-manager.js +192 -170
- package/src/managers/subscription-manager.js +13 -13
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +13 -13
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +9 -9
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +29 -38
- package/src/request-controller.js +160 -164
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +12 -12
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +8 -8
- package/src/triggers/models/trigger-condition.js +58 -58
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +44 -44
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/component-utils.js +3 -3
- package/src/util/dom-utils.js +2 -2
- package/src/util/html-display-utils.js +11 -11
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +8 -8
- package/src/util/request-header-utils.js +25 -25
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +21 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import t from "../common/base-provider.js";
|
|
2
|
-
import { newInAppMessageFromJson as
|
|
3
|
-
import
|
|
2
|
+
import { newInAppMessageFromJson as pt } from "../InAppMessage/in-app-message-factory.js";
|
|
3
|
+
import Ie from "../models/braze-event.js";
|
|
4
4
|
import {
|
|
5
|
-
isArray as
|
|
5
|
+
isArray as g,
|
|
6
6
|
isEqual as ni,
|
|
7
7
|
validateValueIsFromEnum as ta,
|
|
8
8
|
} from "../util/code-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import Jt from "../InAppMessage/models/templated-in-app-message.js";
|
|
11
|
+
import gt from "./models/trigger.js";
|
|
12
12
|
import ot from "./models/trigger-events.js";
|
|
13
13
|
import { logger as E } from "../../shared-lib/index.js";
|
|
14
|
-
export default class
|
|
14
|
+
export default class vr extends t {
|
|
15
15
|
constructor(t, i, s, e, r) {
|
|
16
16
|
super(),
|
|
17
17
|
(this.tg = t),
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
18
|
+
(this.Rs = i),
|
|
19
|
+
(this.C = s),
|
|
20
20
|
(this.Ru = e),
|
|
21
21
|
(this.ig = r),
|
|
22
22
|
(this.tg = t),
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
23
|
+
(this.Rs = i),
|
|
24
|
+
(this.C = s),
|
|
25
25
|
(this.Ru = e),
|
|
26
26
|
(this.ig = r),
|
|
27
27
|
(this.sg = []),
|
|
@@ -35,22 +35,22 @@ export default class gr extends t {
|
|
|
35
35
|
this.gg();
|
|
36
36
|
}
|
|
37
37
|
fg() {
|
|
38
|
-
if (this.
|
|
39
|
-
(this.hg = this.
|
|
40
|
-
(this.ng = this.
|
|
41
|
-
(this.og = this.
|
|
38
|
+
if (this.C) {
|
|
39
|
+
(this.hg = this.C.Rt(s.Tt.oS) || this.hg),
|
|
40
|
+
(this.ng = this.C.Rt(s.Tt.nS) || this.ng),
|
|
41
|
+
(this.og = this.C.Rt(s.Tt.rS) || this.og);
|
|
42
42
|
for (let t = 0; t < this.triggers.length; t++) {
|
|
43
43
|
const i = this.triggers[t];
|
|
44
|
-
i.id && null != this.og[i.id] && i.
|
|
44
|
+
i.id && null != this.og[i.id] && i.md(this.og[i.id]);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
ag() {
|
|
49
|
-
if (!this.
|
|
50
|
-
this.lg = this.
|
|
51
|
-
const t = this.
|
|
49
|
+
if (!this.C) return;
|
|
50
|
+
this.lg = this.C.Rt(s.Tt.sS) || 0;
|
|
51
|
+
const t = this.C.Rt(s.Tt.eS) || [],
|
|
52
52
|
i = [];
|
|
53
|
-
for (let s = 0; s < t.length; s++) i.push(
|
|
53
|
+
for (let s = 0; s < t.length; s++) i.push(gt._u(t[s]));
|
|
54
54
|
(this.triggers = i), this.fg();
|
|
55
55
|
}
|
|
56
56
|
gg() {
|
|
@@ -70,19 +70,19 @@ export default class gr extends t {
|
|
|
70
70
|
h = [];
|
|
71
71
|
for (let r = 0; r < t.length; r++) {
|
|
72
72
|
const n = t[r],
|
|
73
|
-
o = s.
|
|
73
|
+
o = s.gd(n.ma || 0);
|
|
74
74
|
if (o > 0) {
|
|
75
75
|
let t, r;
|
|
76
76
|
h.push(n),
|
|
77
77
|
null != n.ug && (t = n.ug),
|
|
78
|
-
null != n.dg &&
|
|
78
|
+
null != n.dg && Ie.hS(n.dg) && (r = Ie._u(n.dg));
|
|
79
79
|
const l = [];
|
|
80
|
-
if (n.pg &&
|
|
80
|
+
if (n.pg && g(n.pg))
|
|
81
81
|
for (let t = 0; t < n.pg.length; t++) {
|
|
82
82
|
const i = e[n.pg[t]];
|
|
83
83
|
null != i && l.push(i);
|
|
84
84
|
}
|
|
85
|
-
this.eg.push(window.setTimeout(i(s, n.
|
|
85
|
+
this.eg.push(window.setTimeout(i(s, n.ma || 0, t, r, l), o));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
this.ng[s.id].length > h.length &&
|
|
@@ -91,73 +91,73 @@ export default class gr extends t {
|
|
|
91
91
|
0 === this.ng[s.id].length && delete this.ng[s.id]);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
r && this.
|
|
94
|
+
r && this.C && this.C.It(s.Tt.nS, this.ng);
|
|
95
95
|
}
|
|
96
96
|
mg() {
|
|
97
|
-
if (!this.
|
|
97
|
+
if (!this.C) return;
|
|
98
98
|
const t = [];
|
|
99
99
|
for (let i = 0; i < this.triggers.length; i++)
|
|
100
|
-
t.push(this.triggers[i].
|
|
100
|
+
t.push(this.triggers[i].qt());
|
|
101
101
|
(this.lg = new Date().valueOf()),
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
102
|
+
this.C.It(s.Tt.eS, t),
|
|
103
|
+
this.C.It(s.Tt.sS, this.lg);
|
|
104
104
|
}
|
|
105
105
|
bg() {
|
|
106
|
-
if (!this.
|
|
107
|
-
(this.
|
|
106
|
+
if (!this.C) return;
|
|
107
|
+
(this.C.Rt(s.Tt.sS) || 0) > this.lg ? this.ag() : this.fg();
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
I(t) {
|
|
110
110
|
let i = !1;
|
|
111
111
|
if (null != t && t.triggers) {
|
|
112
|
-
this.ig.
|
|
112
|
+
this.ig.fa(), this.fg();
|
|
113
113
|
const e = {},
|
|
114
114
|
r = {};
|
|
115
115
|
this.triggers = [];
|
|
116
116
|
for (let s = 0; s < t.triggers.length; s++) {
|
|
117
|
-
const h =
|
|
117
|
+
const h = gt.fromJson(t.triggers[s]);
|
|
118
118
|
if (h) {
|
|
119
119
|
h.id &&
|
|
120
120
|
null != this.og[h.id] &&
|
|
121
|
-
(h.
|
|
121
|
+
(h.md(this.og[h.id]), (e[h.id] = this.og[h.id])),
|
|
122
122
|
h.id && null != this.ng[h.id] && (r[h.id] = this.ng[h.id]);
|
|
123
|
-
for (let t = 0; t < h.
|
|
124
|
-
if (h.
|
|
123
|
+
for (let t = 0; t < h.ed.length; t++)
|
|
124
|
+
if (h.ed[t].Vc(ot.Ls, null)) {
|
|
125
125
|
i = !0;
|
|
126
126
|
break;
|
|
127
127
|
}
|
|
128
128
|
this.triggers.push(h);
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
ni(this.og, e) || ((this.og = e), this.
|
|
131
|
+
ni(this.og, e) || ((this.og = e), this.C && this.C.It(s.Tt.rS, this.og)),
|
|
132
132
|
ni(this.ng, r) ||
|
|
133
|
-
((this.ng = r), this.
|
|
133
|
+
((this.ng = r), this.C && this.C.It(s.Tt.nS, this.ng)),
|
|
134
134
|
this.mg(),
|
|
135
135
|
i &&
|
|
136
136
|
(E.info("Trigger with test condition found, firing test."),
|
|
137
|
-
this.
|
|
138
|
-
this.
|
|
137
|
+
this.Ee(ot.Ls)),
|
|
138
|
+
this.Ee(ot.OPEN);
|
|
139
139
|
const h = this.sg;
|
|
140
140
|
let n;
|
|
141
141
|
this.sg = [];
|
|
142
142
|
for (let t = 0; t < h.length; t++)
|
|
143
|
-
(n = Array.prototype.slice.call(h[t])), this.
|
|
143
|
+
(n = Array.prototype.slice.call(h[t])), this.Ee(...n);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
cg(t, i, s, e, r) {
|
|
147
147
|
const h = (e) => {
|
|
148
148
|
this.fg();
|
|
149
149
|
const r = new Date().valueOf();
|
|
150
|
-
t.
|
|
151
|
-
(!1 === navigator.onLine && t.type ===
|
|
150
|
+
t.fd(i) ||
|
|
151
|
+
(!1 === navigator.onLine && t.type === gt.la.oa && e.imageUrl
|
|
152
152
|
? E.info(
|
|
153
153
|
`Not showing ${t.type} trigger action ${t.id} due to offline state.`,
|
|
154
154
|
)
|
|
155
|
-
: t.
|
|
156
|
-
? 0 === this.
|
|
155
|
+
: t.dd(r) && this.wg(t, r, s)
|
|
156
|
+
? 0 === this.Rs.Le()
|
|
157
157
|
? E.info(
|
|
158
158
|
`Not displaying trigger ${t.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`,
|
|
159
159
|
)
|
|
160
|
-
: (this.
|
|
160
|
+
: (this.Rs.A([e]), this.yg(t, r))
|
|
161
161
|
: E.info(
|
|
162
162
|
`Not displaying trigger ${t.id} because display time fell outside of the acceptable time window.`,
|
|
163
163
|
));
|
|
@@ -166,14 +166,14 @@ export default class gr extends t {
|
|
|
166
166
|
this.fg();
|
|
167
167
|
const h = r.pop();
|
|
168
168
|
if (null != h)
|
|
169
|
-
if ((this.Tg(h, i, s, e, r), h.
|
|
169
|
+
if ((this.Tg(h, i, s, e, r), h.fd(i))) {
|
|
170
170
|
let t = `Server aborted in-app message display, but the timeout on fallback trigger ${h.id} has already elapsed.`;
|
|
171
171
|
r.length > 0 && (t += " Continuing to fall back."), E.info(t), n();
|
|
172
172
|
} else {
|
|
173
173
|
E.info(
|
|
174
174
|
`Server aborted in-app message display. Falling back to lower priority ${h.type} trigger action ${t.id}.`,
|
|
175
175
|
);
|
|
176
|
-
const n = 1e3 * h.
|
|
176
|
+
const n = 1e3 * h.hd - (new Date().valueOf() - i);
|
|
177
177
|
n > 0
|
|
178
178
|
? this.eg.push(
|
|
179
179
|
window.setTimeout(() => {
|
|
@@ -185,35 +185,35 @@ export default class gr extends t {
|
|
|
185
185
|
};
|
|
186
186
|
let o, l, a;
|
|
187
187
|
switch (t.type) {
|
|
188
|
-
case
|
|
189
|
-
if (((o =
|
|
188
|
+
case gt.la.oa:
|
|
189
|
+
if (((o = pt(t.data)), null == o)) {
|
|
190
190
|
E.error(
|
|
191
191
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
192
192
|
);
|
|
193
193
|
break;
|
|
194
194
|
}
|
|
195
|
-
if (((l = this.ig.
|
|
195
|
+
if (((l = this.ig.Qn(o)), l)) {
|
|
196
196
|
E.error(l), n();
|
|
197
197
|
break;
|
|
198
198
|
}
|
|
199
199
|
h(o);
|
|
200
200
|
break;
|
|
201
|
-
case
|
|
202
|
-
if (((a =
|
|
201
|
+
case gt.la.pd:
|
|
202
|
+
if (((a = Jt.fromJson(t.data, h, n, i, t.ca || 0)), null == a)) {
|
|
203
203
|
E.error(
|
|
204
204
|
`Could not parse trigger data for trigger ${t.id}, ignoring.`,
|
|
205
205
|
);
|
|
206
206
|
break;
|
|
207
207
|
}
|
|
208
|
-
this.ig.
|
|
208
|
+
this.ig.Xo(a, s, e);
|
|
209
209
|
break;
|
|
210
210
|
default:
|
|
211
211
|
E.error(`Trigger ${t.id} was of unexpected type ${t.type}, ignoring.`);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
|
|
214
|
+
Ee(t, i = null, s) {
|
|
215
215
|
if (!ta(ot, t, "Cannot fire trigger action.", "TriggerEvents")) return;
|
|
216
|
-
if (this.Ru && this.Ru.
|
|
216
|
+
if (this.Ru && this.Ru.Ic())
|
|
217
217
|
return (
|
|
218
218
|
E.info(
|
|
219
219
|
"Trigger sync is currently in progress, awaiting sync completion before firing trigger event.",
|
|
@@ -228,15 +228,15 @@ export default class gr extends t {
|
|
|
228
228
|
const o = [];
|
|
229
229
|
for (let s = 0; s < this.triggers.length; s++) {
|
|
230
230
|
const r = this.triggers[s],
|
|
231
|
-
l = e + 1e3 * r.
|
|
231
|
+
l = e + 1e3 * r.hd;
|
|
232
232
|
if (
|
|
233
|
-
r.
|
|
233
|
+
r.dd(l) &&
|
|
234
234
|
(null == r.startTime || r.startTime.valueOf() <= e) &&
|
|
235
235
|
(null == r.endTime || r.endTime.valueOf() >= e)
|
|
236
236
|
) {
|
|
237
237
|
let s = !1;
|
|
238
|
-
for (let e = 0; e < r.
|
|
239
|
-
if (r.
|
|
238
|
+
for (let e = 0; e < r.ed.length; e++)
|
|
239
|
+
if (r.ed[e].Vc(t, i)) {
|
|
240
240
|
s = !0;
|
|
241
241
|
break;
|
|
242
242
|
}
|
|
@@ -260,20 +260,20 @@ export default class gr extends t {
|
|
|
260
260
|
`Firing ${l.type} trigger action ${l.id} from trigger event ${t}.`,
|
|
261
261
|
),
|
|
262
262
|
this.Tg(l, e, t, s, o),
|
|
263
|
-
0 === l.
|
|
263
|
+
0 === l.hd
|
|
264
264
|
? this.cg(l, e, t, s, o)
|
|
265
265
|
: this.eg.push(
|
|
266
266
|
window.setTimeout(() => {
|
|
267
267
|
this.cg(l, e, t, s, o);
|
|
268
|
-
}, 1e3 * l.
|
|
268
|
+
}, 1e3 * l.hd),
|
|
269
269
|
));
|
|
270
270
|
}
|
|
271
271
|
changeUser(t = !1) {
|
|
272
|
-
if (((this.triggers = []), this.
|
|
272
|
+
if (((this.triggers = []), this.C && this.C.Qt(s.Tt.eS), !t)) {
|
|
273
273
|
(this.sg = []), (this.hg = null), (this.og = {}), (this.ng = {});
|
|
274
274
|
for (let t = 0; t < this.eg.length; t++) clearTimeout(this.eg[t]);
|
|
275
275
|
(this.eg = []),
|
|
276
|
-
this.
|
|
276
|
+
this.C && (this.C.Qt(s.Tt.oS), this.C.Qt(s.Tt.rS), this.C.Qt(s.Tt.nS));
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
clearData() {
|
|
@@ -283,32 +283,32 @@ export default class gr extends t {
|
|
|
283
283
|
}
|
|
284
284
|
wg(t, i, s) {
|
|
285
285
|
if (null == this.hg) return !0;
|
|
286
|
-
if (s === ot.
|
|
286
|
+
if (s === ot.Ls)
|
|
287
287
|
return (
|
|
288
288
|
E.info(
|
|
289
289
|
"Ignoring minimum interval between trigger because it is a test type.",
|
|
290
290
|
),
|
|
291
291
|
!0
|
|
292
292
|
);
|
|
293
|
-
let e = t.
|
|
293
|
+
let e = t.ad;
|
|
294
294
|
return null == e && (e = this.tg), i - this.hg >= 1e3 * e;
|
|
295
295
|
}
|
|
296
296
|
Tg(t, i, e, r, h) {
|
|
297
297
|
this.fg(), t.id && (this.ng[t.id] = this.ng[t.id] || []);
|
|
298
298
|
const n = {};
|
|
299
299
|
let o;
|
|
300
|
-
(n.
|
|
300
|
+
(n.ma = i), (n.ug = e), null != r && (o = r.qt()), (n.dg = o);
|
|
301
301
|
const l = [];
|
|
302
302
|
for (const t of h) t.id && l.push(t.id);
|
|
303
303
|
(n.pg = l),
|
|
304
304
|
t.id && this.ng[t.id].push(n),
|
|
305
|
-
this.
|
|
305
|
+
this.C && this.C.It(s.Tt.nS, this.ng);
|
|
306
306
|
}
|
|
307
307
|
yg(t, i) {
|
|
308
308
|
this.fg(),
|
|
309
|
-
t.
|
|
309
|
+
t.md(i),
|
|
310
310
|
(this.hg = i),
|
|
311
311
|
t.id && (this.og[t.id] = i),
|
|
312
|
-
this.
|
|
312
|
+
this.C && (this.C.It(s.Tt.oS, i), this.C.It(s.Tt.rS, this.og));
|
|
313
313
|
}
|
|
314
314
|
}
|
package/src/ui/js/attach-css.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as U } from "../../managers/braze-instance.js";
|
|
2
2
|
export function attachCSS(n, t, o) {
|
|
3
3
|
const c = n || document.querySelector("head"),
|
|
4
|
-
e = `ab-${t}-css-definitions-${"6.
|
|
4
|
+
e = `ab-${t}-css-definitions-${"6.7.1".replace(/\./g, "-")}`;
|
|
5
5
|
if (!c) return;
|
|
6
6
|
const s = c.ownerDocument || document;
|
|
7
7
|
if (null == s.getElementById(e)) {
|
|
8
8
|
const n = s.createElement("style");
|
|
9
9
|
(n.innerHTML = o || ""), (n.id = e);
|
|
10
|
-
const t = r.
|
|
10
|
+
const t = r.er(U.sr);
|
|
11
11
|
null != t && n.setAttribute("nonce", t), c.appendChild(n);
|
|
12
12
|
}
|
|
13
13
|
}
|
package/src/ui/js/feed-css.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attachCSS as Sn } from "./attach-css.js";
|
|
2
|
-
import { loadFontAwesome as
|
|
2
|
+
import { loadFontAwesome as _e } from "./load-font-awesome.js";
|
|
3
3
|
export function attachFeedCSS(t) {
|
|
4
4
|
Sn(
|
|
5
5
|
t,
|
|
@@ -8,5 +8,5 @@ export function attachFeedCSS(t) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
export function setupFeedUI() {
|
|
11
|
-
attachFeedCSS(),
|
|
11
|
+
attachFeedCSS(), _e();
|
|
12
12
|
}
|
package/src/ui/js/iam-css.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { attachCSS as Sn } from "./attach-css.js";
|
|
2
|
-
import { loadFontAwesome as
|
|
2
|
+
import { loadFontAwesome as _e } from "./load-font-awesome.js";
|
|
3
3
|
export function attachInAppMessageCSS(t) {
|
|
4
4
|
Sn(
|
|
5
5
|
t,
|
|
@@ -8,5 +8,5 @@ export function attachInAppMessageCSS(t) {
|
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
export function setupInAppMessageUI() {
|
|
11
|
-
attachInAppMessageCSS(),
|
|
11
|
+
attachInAppMessageCSS(), _e();
|
|
12
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import r, { OPTIONS as
|
|
1
|
+
import r, { OPTIONS as U } from "../../managers/braze-instance.js";
|
|
2
2
|
export function loadFontAwesome() {
|
|
3
|
-
if (r.
|
|
3
|
+
if (r.er(U.Uh)) return;
|
|
4
4
|
const e = "https://use.fontawesome.com/7f85a56ba4.css";
|
|
5
5
|
if (
|
|
6
6
|
!(null !== document.querySelector('link[rel=stylesheet][href="' + e + '"]'))
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { isArray as
|
|
2
|
-
export default class
|
|
1
|
+
import { isArray as g } from "./code-utils.js";
|
|
2
|
+
export default class Ve {
|
|
3
3
|
constructor() {}
|
|
4
|
+
ef() {}
|
|
4
5
|
ff() {}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
static lf(t, e) {
|
|
6
|
+
Fa(t) {}
|
|
7
|
+
static nf(t, e) {
|
|
8
8
|
if (t && e)
|
|
9
|
-
if (((t = t.toLowerCase()),
|
|
10
|
-
for (let r = 0; r < e.
|
|
11
|
-
if (-1 !== t.indexOf(e.
|
|
12
|
-
} else if (-1 !== t.indexOf(e.
|
|
9
|
+
if (((t = t.toLowerCase()), g(e.cf))) {
|
|
10
|
+
for (let r = 0; r < e.cf.length; r++)
|
|
11
|
+
if (-1 !== t.indexOf(e.cf[r].toLowerCase())) return e.identity;
|
|
12
|
+
} else if (-1 !== t.indexOf(e.cf.toLowerCase())) return e.identity;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
@@ -25,11 +25,11 @@ export const BRAZE_ACTIONS = {
|
|
|
25
25
|
properties: { type: "type", eo: "steps", so: "args" },
|
|
26
26
|
};
|
|
27
27
|
export const INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES = {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
Un: "unknownBrazeAction",
|
|
29
|
+
Zc: "noPushPrompt",
|
|
30
30
|
};
|
|
31
31
|
export const ineligibleBrazeActionURLErrorMessage = (t, o) =>
|
|
32
|
-
t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.
|
|
32
|
+
t === INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES.Un
|
|
33
33
|
? `${o} contains an unknown braze action type and will not be displayed.`
|
|
34
34
|
: "";
|
|
35
35
|
export function getDecodedBrazeAction(t) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { Browsers as
|
|
4
|
-
class
|
|
1
|
+
import Si from "./client-hints-parser.js";
|
|
2
|
+
import bi from "./user-agent-parser.js";
|
|
3
|
+
import { Browsers as vi, OperatingSystems as so } from "./device-constants.js";
|
|
4
|
+
class yi {
|
|
5
5
|
constructor() {
|
|
6
6
|
let t;
|
|
7
7
|
(t =
|
|
8
|
-
navigator.userAgent.toLowerCase().includes(
|
|
8
|
+
navigator.userAgent.toLowerCase().includes(vi.Sg.toLowerCase()) ||
|
|
9
9
|
!navigator.userAgentData
|
|
10
|
-
?
|
|
11
|
-
:
|
|
10
|
+
? bi
|
|
11
|
+
: Si),
|
|
12
12
|
(this.vg = new t()),
|
|
13
13
|
(this.userAgent = navigator.userAgent),
|
|
14
|
-
(this.browser = this.vg.
|
|
15
|
-
(this.version = this.vg.
|
|
14
|
+
(this.browser = this.vg.ef()),
|
|
15
|
+
(this.version = this.vg.ff()),
|
|
16
16
|
(this.OS = null),
|
|
17
|
-
this.
|
|
17
|
+
this.Fa().then((t) => (this.OS = t));
|
|
18
18
|
const i = navigator;
|
|
19
19
|
(this.language = (
|
|
20
20
|
i.userLanguage ||
|
|
@@ -23,18 +23,18 @@ class vi {
|
|
|
23
23
|
i.systemLanguage ||
|
|
24
24
|
""
|
|
25
25
|
).toLowerCase()),
|
|
26
|
-
(this.
|
|
26
|
+
(this.il = yi.xg(this.userAgent));
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
return this.browser ===
|
|
28
|
+
IS() {
|
|
29
|
+
return this.browser === vi.Bg;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
Aa() {
|
|
32
32
|
return this.OS || null;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
Fa() {
|
|
35
35
|
return this.OS
|
|
36
36
|
? Promise.resolve(this.OS)
|
|
37
|
-
: this.vg.
|
|
37
|
+
: this.vg.Fa(yi.Og).then((t) => ((this.OS = t), t));
|
|
38
38
|
}
|
|
39
39
|
static xg(t) {
|
|
40
40
|
t = t.toLowerCase();
|
|
@@ -63,33 +63,33 @@ class vi {
|
|
|
63
63
|
return !1;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
{ string: navigator.platform,
|
|
68
|
-
{ string: navigator.platform,
|
|
69
|
-
{ string: navigator.platform,
|
|
70
|
-
{ string: navigator.platform,
|
|
71
|
-
{ string: navigator.platform,
|
|
72
|
-
{ string: navigator.platform,
|
|
73
|
-
{ string: navigator.platform,
|
|
74
|
-
{ string: navigator.platform,
|
|
75
|
-
{ string: navigator.platform,
|
|
66
|
+
yi.Og = [
|
|
67
|
+
{ string: navigator.platform, cf: "Win", identity: so.kg },
|
|
68
|
+
{ string: navigator.platform, cf: "Mac", identity: so.Pg },
|
|
69
|
+
{ string: navigator.platform, cf: "BlackBerry", identity: "BlackBerry" },
|
|
70
|
+
{ string: navigator.platform, cf: "FreeBSD", identity: "FreeBSD" },
|
|
71
|
+
{ string: navigator.platform, cf: "OpenBSD", identity: "OpenBSD" },
|
|
72
|
+
{ string: navigator.platform, cf: "Nintendo", identity: "Nintendo" },
|
|
73
|
+
{ string: navigator.platform, cf: "SunOS", identity: "SunOS" },
|
|
74
|
+
{ string: navigator.platform, cf: "PlayStation", identity: "PlayStation" },
|
|
75
|
+
{ string: navigator.platform, cf: "X11", identity: "X11" },
|
|
76
76
|
{
|
|
77
77
|
string: navigator.userAgent,
|
|
78
|
-
|
|
78
|
+
cf: ["iPhone", "iPad", "iPod"],
|
|
79
79
|
identity: so.co,
|
|
80
80
|
},
|
|
81
|
-
{ string: navigator.platform,
|
|
82
|
-
{ string: navigator.userAgent,
|
|
83
|
-
{ string: navigator.userAgent,
|
|
84
|
-
{ string: navigator.userAgent,
|
|
85
|
-
{ string: navigator.userAgent,
|
|
81
|
+
{ string: navigator.platform, cf: "Pike v", identity: so.co },
|
|
82
|
+
{ string: navigator.userAgent, cf: ["Web0S"], identity: "WebOS" },
|
|
83
|
+
{ string: navigator.userAgent, cf: "Tizen", identity: "Tizen" },
|
|
84
|
+
{ string: navigator.userAgent, cf: "Coolita", identity: "Other Smart TV" },
|
|
85
|
+
{ string: navigator.userAgent, cf: "WhaleTV", identity: "Other Smart TV" },
|
|
86
86
|
{
|
|
87
87
|
string: navigator.platform,
|
|
88
|
-
|
|
88
|
+
cf: ["Linux armv7l", "Android"],
|
|
89
89
|
identity: so.Dg,
|
|
90
90
|
},
|
|
91
|
-
{ string: navigator.userAgent,
|
|
92
|
-
{ string: navigator.platform,
|
|
91
|
+
{ string: navigator.userAgent, cf: ["Android"], identity: so.Dg },
|
|
92
|
+
{ string: navigator.platform, cf: "Linux", identity: "Linux" },
|
|
93
93
|
];
|
|
94
|
-
const ro = new
|
|
95
|
-
export { ro as default,
|
|
94
|
+
const ro = new yi();
|
|
95
|
+
export { ro as default, yi as BrowserDetector };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Browsers as
|
|
3
|
-
export default class
|
|
1
|
+
import Ve from "./base-device-parser.js";
|
|
2
|
+
import { Browsers as vi } from "./device-constants.js";
|
|
3
|
+
export default class Si extends Ve {
|
|
4
4
|
constructor() {
|
|
5
5
|
if (
|
|
6
6
|
(super(),
|
|
@@ -15,17 +15,17 @@ export default class gi extends Oe {
|
|
|
15
15
|
}
|
|
16
16
|
this.OS = null;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
ef() {
|
|
19
19
|
return this.browser;
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
ff() {
|
|
22
22
|
return this.version;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
Fa(t) {
|
|
25
25
|
if (this.OS) return Promise.resolve(this.OS);
|
|
26
26
|
const s = (s) => {
|
|
27
27
|
for (let r = 0; r < t.length; r++) {
|
|
28
|
-
const i =
|
|
28
|
+
const i = Si.nf(s, t[r]);
|
|
29
29
|
if (i) return (this.OS = i), this.OS;
|
|
30
30
|
}
|
|
31
31
|
return s;
|
|
@@ -41,7 +41,7 @@ export default class gi extends Oe {
|
|
|
41
41
|
s = this.userAgentData.brands;
|
|
42
42
|
if (s && s.length)
|
|
43
43
|
for (const r of s) {
|
|
44
|
-
const s = this.
|
|
44
|
+
const s = this.uf(vi),
|
|
45
45
|
i = r.brand.match(s);
|
|
46
46
|
if (i && i.length > 0) {
|
|
47
47
|
(t.browser = i[0]), (t.version = r.version);
|
|
@@ -50,7 +50,7 @@ export default class gi extends Oe {
|
|
|
50
50
|
}
|
|
51
51
|
return t;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
uf(t) {
|
|
54
54
|
const s = [];
|
|
55
55
|
for (const r in t) {
|
|
56
56
|
const i = r;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { addPassiveEventListener as
|
|
1
|
+
import { addPassiveEventListener as F, buildSvg as we } from "./dom-utils.js";
|
|
2
2
|
import { KeyCodes as Ce } from "./key-codes.js";
|
|
3
3
|
export function createCloseButton(t, o, e, r = "ltr") {
|
|
4
4
|
const n = document.createElement("button");
|
|
5
5
|
n.setAttribute("aria-label", t),
|
|
6
6
|
n.setAttribute("role", "button"),
|
|
7
7
|
(n.dir = r),
|
|
8
|
-
|
|
8
|
+
F(n, "touchstart"),
|
|
9
9
|
(n.className = "ab-close-button");
|
|
10
10
|
const l = we(
|
|
11
11
|
"0 0 15 15",
|
|
@@ -16,7 +16,7 @@ export function createCloseButton(t, o, e, r = "ltr") {
|
|
|
16
16
|
n.appendChild(l),
|
|
17
17
|
l.setAttribute("aria-hidden", "true"),
|
|
18
18
|
n.addEventListener("keydown", (t) => {
|
|
19
|
-
(t.keyCode !== Ce.
|
|
19
|
+
(t.keyCode !== Ce.Ao && t.keyCode !== Ce.Lo) ||
|
|
20
20
|
(e(), t.stopPropagation());
|
|
21
21
|
}),
|
|
22
22
|
(n.onclick = (t) => {
|
package/src/util/dom-utils.js
CHANGED
|
@@ -19,7 +19,7 @@ export function _isInView(t, n = !1, e = !1, s = !1) {
|
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
export const DOMUtils = { lp: null, td: _isInView };
|
|
22
|
-
export const DIRECTIONS = { Uo: "up", Vo: "down",
|
|
22
|
+
export const DIRECTIONS = { Uo: "up", Vo: "down", ie: "left", ne: "right" };
|
|
23
23
|
export function supportsPassive() {
|
|
24
24
|
if (null == DOMUtils.lp) {
|
|
25
25
|
DOMUtils.lp = !1;
|
|
@@ -63,7 +63,7 @@ export function detectSwipe(t, n, e) {
|
|
|
63
63
|
const l = s - o.touches[0].clientX,
|
|
64
64
|
u = i - o.touches[0].clientY;
|
|
65
65
|
Math.abs(l) > Math.abs(u) && Math.abs(l) >= 25
|
|
66
|
-
? (((l > 0 && n === DIRECTIONS.
|
|
66
|
+
? (((l > 0 && n === DIRECTIONS.ie) || (l < 0 && n === DIRECTIONS.ne)) &&
|
|
67
67
|
e(o),
|
|
68
68
|
(s = null),
|
|
69
69
|
(i = null))
|