@braze/web-sdk 6.12.0 → 6.13.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 +240 -3
- package/package.json +1 -1
- package/shared-lib/event-types.js +18 -18
- package/shared-lib/indexed-db-adapter.js +58 -58
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +25 -24
- package/src/ConversationalChat/automatically-manage-chat.js +5 -0
- package/src/ConversationalChat/chat-message-factory.js +25 -0
- package/src/ConversationalChat/chat-message.js +33 -0
- package/src/ConversationalChat/constants.js +1 -0
- package/src/ConversationalChat/conversational-chat-provider-factory.js +26 -0
- package/src/ConversationalChat/conversational-chat-provider.js +372 -0
- package/src/ConversationalChat/display/chat-widget-manager.js +113 -0
- package/src/ConversationalChat/display/chat-widget-to-html.js +58 -0
- package/src/ConversationalChat/get-chat-messages.js +7 -0
- package/src/ConversationalChat/index.js +12 -0
- package/src/ConversationalChat/is-chat-conversation-ended.js +7 -0
- package/src/ConversationalChat/is-chat-turn-errored.js +7 -0
- package/src/ConversationalChat/is-chat-turn-in-progress.js +7 -0
- package/src/ConversationalChat/register-chat-action-handler.js +10 -0
- package/src/ConversationalChat/reset-chat-conversation.js +5 -0
- package/src/ConversationalChat/retrieve-chat-config.js +7 -0
- package/src/ConversationalChat/send-chat-message.js +17 -0
- package/src/ConversationalChat/subscribe-to-chat-action.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-conversation-updated.js +5 -0
- package/src/ConversationalChat/subscribe-to-chat-message-received.js +5 -0
- package/src/ConversationalChat/trigger-chat-action.js +11 -0
- package/src/ConversationalChat/types.js +1 -0
- package/src/Core/add-sdk-metadata.js +5 -5
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +6 -6
- package/src/Core/enable-sdk.js +3 -3
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +20 -13
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +9 -9
- package/src/Core/log-ecommerce-event.js +4 -4
- package/src/Core/log-purchase.js +14 -14
- package/src/Core/open-session.js +8 -8
- 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 +1 -1
- package/src/DUST/dust-config-store.js +35 -35
- package/src/DUST/dust-message-dedup.js +3 -3
- package/src/DUST/dust-provider-factory.js +10 -10
- package/src/DUST/dust-provider.js +234 -234
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +2 -2
- package/src/FeatureFlags/feature-flag.js +4 -4
- package/src/FeatureFlags/feature-flags-provider-factory.js +11 -11
- package/src/FeatureFlags/feature-flags-provider.js +38 -38
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +3 -3
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/refresh-feature-flags.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +13 -13
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +7 -7
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +92 -92
- package/src/InAppMessage/log-in-app-message-button-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +39 -39
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +2 -2
- package/src/InAppMessage/models/in-app-message.js +102 -102
- package/src/InAppMessage/models/modal-message.js +38 -38
- package/src/InAppMessage/models/slide-up-message.js +34 -34
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- 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/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +27 -24
- 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 +15 -15
- package/src/Push/push-manager.js +13 -13
- package/src/Push/register-push.js +2 -2
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push-token-on-server.js +3 -3
- package/src/Push/unregister-push.js +3 -3
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +9 -9
- package/src/User/user.js +50 -50
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +22 -22
- package/src/common/event-logger.js +3 -3
- package/src/index.js +2 -9
- package/src/l10n/l10n-manager-factory.js +4 -4
- package/src/l10n/l10n-manager.js +6 -6
- package/src/managers/auth-manager.js +28 -28
- package/src/managers/braze-action-manager.js +14 -0
- package/src/managers/braze-instance.js +159 -151
- package/src/managers/device-manager.js +26 -26
- package/src/managers/network-manager.js +120 -120
- package/src/managers/server-config-manager.js +95 -86
- package/src/managers/session-manager.js +25 -25
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +129 -124
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +5 -5
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +8 -8
- package/src/models/push-token.js +6 -6
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +27 -27
- package/src/request-controller.js +117 -117
- package/src/standard-index.js +9 -0
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +5 -5
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +31 -31
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +5 -5
- package/src/triggers/models/push-click-data.js +4 -4
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +36 -36
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +128 -128
- package/src/types.js +2 -2
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/chat-widget-css.js +11 -0
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +7 -7
- package/src/util/braze-actions.js +5 -5
- package/src/util/browser-detector.js +41 -41
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/component-utils.js +1 -1
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +8 -8
- package/src/util/ecommerce-event-validation.js +13 -13
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +82 -44
- package/src/util/request-header-utils.js +26 -24
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/validation-utils.js +29 -21
- package/src/util/window-utils.js +3 -3
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import nt from "./dust-provider-factory.js";
|
|
3
3
|
export function subscribeToDust() {
|
|
4
4
|
const t = r.l(),
|
|
5
5
|
n = r.nn();
|
|
6
6
|
if (!t || !n) return null;
|
|
7
|
-
const o =
|
|
7
|
+
const o = nt.o(),
|
|
8
8
|
s = () => {
|
|
9
9
|
if (!o.Et()) {
|
|
10
|
-
o.
|
|
10
|
+
o.Dh();
|
|
11
11
|
const r = n.rn(() => {
|
|
12
|
-
t
|
|
12
|
+
t.Ih() && o.Gh();
|
|
13
13
|
});
|
|
14
|
-
return r && o.Lt(r), o.
|
|
14
|
+
return r && o.Lt(r), o.Uh() && o.Nh(), r;
|
|
15
15
|
}
|
|
16
16
|
return o.Et();
|
|
17
17
|
};
|
|
18
18
|
return (
|
|
19
19
|
t.Tr(() => {
|
|
20
|
-
r.
|
|
20
|
+
r.vr() && (t.Ih() ? (o.Gh(), s()) : (o.Fh(), o.Uh() && o.jh()));
|
|
21
21
|
}),
|
|
22
|
-
t
|
|
22
|
+
t.Ih() ? s() : null
|
|
23
23
|
);
|
|
24
24
|
}
|
|
@@ -5,8 +5,8 @@ export function newFeatureFlagFromJson(e) {
|
|
|
5
5
|
return new FeatureFlag(
|
|
6
6
|
e[FeatureFlag.ei.qs],
|
|
7
7
|
e[FeatureFlag.ei.Jr],
|
|
8
|
-
e[FeatureFlag.ei.Nr],
|
|
9
8
|
e[FeatureFlag.ei.Or],
|
|
9
|
+
e[FeatureFlag.ei.Vr],
|
|
10
10
|
);
|
|
11
11
|
b.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
|
|
12
12
|
}
|
|
@@ -15,8 +15,8 @@ export function newFeatureFlagFromSerializedValue(e) {
|
|
|
15
15
|
return new FeatureFlag(
|
|
16
16
|
e[FeatureFlag.bs.qs],
|
|
17
17
|
e[FeatureFlag.bs.Jr],
|
|
18
|
-
e[FeatureFlag.bs.Nr],
|
|
19
18
|
e[FeatureFlag.bs.Or],
|
|
19
|
+
e[FeatureFlag.bs.Vr],
|
|
20
20
|
);
|
|
21
21
|
b.info(
|
|
22
22
|
`Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`,
|
|
@@ -14,11 +14,11 @@ export default class FeatureFlag extends D {
|
|
|
14
14
|
return (
|
|
15
15
|
(s[FeatureFlag.bs.qs] = this.id),
|
|
16
16
|
(s[FeatureFlag.bs.Jr] = this.enabled),
|
|
17
|
-
(s[FeatureFlag.bs.
|
|
18
|
-
(s[FeatureFlag.bs.
|
|
17
|
+
(s[FeatureFlag.bs.Or] = this.properties),
|
|
18
|
+
(s[FeatureFlag.bs.Vr] = this.trackingString),
|
|
19
19
|
s
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
(FeatureFlag.bs = { qs: "id", Jr: "e",
|
|
24
|
-
(FeatureFlag.ei = { qs: "id", Jr: "enabled",
|
|
23
|
+
(FeatureFlag.bs = { qs: "id", Jr: "e", Or: "pr", Vr: "fts" }),
|
|
24
|
+
(FeatureFlag.ei = { qs: "id", Jr: "enabled", Or: "properties", Vr: "fts" });
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import lr from "./feature-flags-provider.js";
|
|
3
|
+
const fr = {
|
|
4
4
|
i: !1,
|
|
5
5
|
provider: null,
|
|
6
6
|
o: () => (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
((
|
|
10
|
-
r.v(
|
|
7
|
+
fr.t(),
|
|
8
|
+
fr.provider ||
|
|
9
|
+
((fr.provider = new lr(r.l(), r.m(), r.p(), r.u())),
|
|
10
|
+
r.v(fr.provider),
|
|
11
11
|
r.ar("ffr", () => {
|
|
12
12
|
var r;
|
|
13
|
-
null === (r =
|
|
13
|
+
null === (r = fr.provider) ||
|
|
14
14
|
void 0 === r ||
|
|
15
15
|
r.refreshFeatureFlags(void 0, void 0, !1, !0, "dust");
|
|
16
16
|
})),
|
|
17
|
-
|
|
17
|
+
fr.provider
|
|
18
18
|
),
|
|
19
19
|
t: () => {
|
|
20
|
-
|
|
20
|
+
fr.i || (r.g(fr), (fr.i = !0));
|
|
21
21
|
},
|
|
22
22
|
destroy: () => {
|
|
23
|
-
(
|
|
23
|
+
(fr.provider = null), (fr.i = !1);
|
|
24
24
|
},
|
|
25
25
|
};
|
|
26
|
-
export default
|
|
26
|
+
export default fr;
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
} from "../common/constants.js";
|
|
12
12
|
import l from "../util/net.js";
|
|
13
13
|
import {
|
|
14
|
-
newFeatureFlagFromJson as
|
|
15
|
-
newFeatureFlagFromSerializedValue as
|
|
14
|
+
newFeatureFlagFromJson as Ft,
|
|
15
|
+
newFeatureFlagFromSerializedValue as yt,
|
|
16
16
|
} from "./feature-flag-factory.js";
|
|
17
17
|
import h from "../util/request-header-utils.js";
|
|
18
|
-
export default class
|
|
18
|
+
export default class lr extends t {
|
|
19
19
|
constructor(t, s, i, e) {
|
|
20
20
|
super(),
|
|
21
21
|
(this.h = t),
|
|
@@ -23,64 +23,64 @@ export default class ar extends t {
|
|
|
23
23
|
(this.j = i),
|
|
24
24
|
(this.C = e),
|
|
25
25
|
(this.Rr = []),
|
|
26
|
-
(this.
|
|
26
|
+
(this.Xr = 0),
|
|
27
27
|
(this.h = t),
|
|
28
28
|
(this.B = s),
|
|
29
29
|
(this.j = i),
|
|
30
30
|
(this.C = e),
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
31
|
+
(this.Kr = null),
|
|
32
|
+
(this.Lr = new f()),
|
|
33
33
|
(this.D = 10),
|
|
34
34
|
(this.N = null),
|
|
35
35
|
(this.F = null),
|
|
36
|
-
r.S(this.
|
|
36
|
+
r.S(this.Lr);
|
|
37
37
|
}
|
|
38
38
|
q(t) {
|
|
39
39
|
var s;
|
|
40
40
|
if (
|
|
41
|
-
(null === (s = this.h) || void 0 === s ? void 0 : s.
|
|
41
|
+
(null === (s = this.h) || void 0 === s ? void 0 : s.Qr()) &&
|
|
42
42
|
null != t &&
|
|
43
43
|
t.feature_flags
|
|
44
44
|
) {
|
|
45
45
|
this.Rr = [];
|
|
46
46
|
for (const s of t.feature_flags) {
|
|
47
|
-
const t =
|
|
47
|
+
const t = Ft(s);
|
|
48
48
|
t && this.Rr.push(t);
|
|
49
49
|
}
|
|
50
|
-
(this.
|
|
50
|
+
(this.Xr = new Date().getTime()), this.Yr(), this.Lr.A(this.Rr);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
Zr() {
|
|
54
54
|
let t = {};
|
|
55
|
-
this.j && (t = this.j.St(s.It.
|
|
55
|
+
this.j && (t = this.j.St(s.It.ho));
|
|
56
56
|
const i = {};
|
|
57
57
|
for (const s in t) {
|
|
58
|
-
const e =
|
|
58
|
+
const e = yt(t[s]);
|
|
59
59
|
e && (i[e.id] = e);
|
|
60
60
|
}
|
|
61
61
|
return i;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
uo() {
|
|
64
64
|
var t;
|
|
65
65
|
return (
|
|
66
|
-
(null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.
|
|
66
|
+
(null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.do)) || {}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
this.j && this.j.Pt(s.It.
|
|
69
|
+
vo(t) {
|
|
70
|
+
this.j && this.j.Pt(s.It.do, t);
|
|
71
71
|
}
|
|
72
72
|
Kt(t) {
|
|
73
|
-
return this.
|
|
73
|
+
return this.Lr.Ut(t);
|
|
74
74
|
}
|
|
75
75
|
refreshFeatureFlags(t, s, i = !1, e = !0, r = "sdk") {
|
|
76
76
|
const o = () => {
|
|
77
|
-
"function" == typeof s && s(), this.
|
|
77
|
+
"function" == typeof s && s(), this.Lr.A(this.Rr);
|
|
78
78
|
};
|
|
79
|
-
if (!this.
|
|
79
|
+
if (!this.Fo(i, r))
|
|
80
80
|
return (
|
|
81
|
-
!this.
|
|
81
|
+
!this.Kr &&
|
|
82
82
|
this.h &&
|
|
83
|
-
(this.
|
|
83
|
+
(this.Kr = this.h.po(() => {
|
|
84
84
|
this.refreshFeatureFlags(t, s, !1, !0, r);
|
|
85
85
|
})),
|
|
86
86
|
void o()
|
|
@@ -89,7 +89,7 @@ export default class ar extends t {
|
|
|
89
89
|
if (!n) return void o();
|
|
90
90
|
e && this.Y();
|
|
91
91
|
const u = n.Z({}, !0),
|
|
92
|
-
f = n.tt(u, h.it.
|
|
92
|
+
f = n.tt(u, h.it.jo, r);
|
|
93
93
|
let v = !1;
|
|
94
94
|
n.et(
|
|
95
95
|
u,
|
|
@@ -97,7 +97,7 @@ export default class ar extends t {
|
|
|
97
97
|
const n = this.B;
|
|
98
98
|
if (!n) return void o();
|
|
99
99
|
const g = new Date().valueOf();
|
|
100
|
-
h.nt(this.j, h.it.
|
|
100
|
+
h.nt(this.j, h.it.jo, g),
|
|
101
101
|
-1 !== e && f.push(["X-Braze-Req-Tokens-Remaining", e.toString()]),
|
|
102
102
|
l.ot({
|
|
103
103
|
url: `${n.ht()}/feature_flags/sync`,
|
|
@@ -131,7 +131,7 @@ export default class ar extends t {
|
|
|
131
131
|
() => {
|
|
132
132
|
this.refreshFeatureFlags(t, s, i, !0, r);
|
|
133
133
|
},
|
|
134
|
-
h.it.
|
|
134
|
+
h.it.jo,
|
|
135
135
|
(t) => this.Bt(t),
|
|
136
136
|
() => this.Y(),
|
|
137
137
|
g,
|
|
@@ -139,7 +139,7 @@ export default class ar extends t {
|
|
|
139
139
|
},
|
|
140
140
|
});
|
|
141
141
|
},
|
|
142
|
-
h.it.
|
|
142
|
+
h.it.jo,
|
|
143
143
|
s,
|
|
144
144
|
);
|
|
145
145
|
}
|
|
@@ -149,49 +149,49 @@ export default class ar extends t {
|
|
|
149
149
|
Bt(t) {
|
|
150
150
|
this.Y(), (this.F = t);
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
Fo(t, s = "sdk") {
|
|
153
153
|
if (!this.h) return !1;
|
|
154
154
|
if (!t && "dust" !== s) {
|
|
155
|
-
const t = this.h.
|
|
155
|
+
const t = this.h.wo();
|
|
156
156
|
if (null == t) return !1;
|
|
157
157
|
let s = !1;
|
|
158
158
|
if (!isNaN(t)) {
|
|
159
159
|
if (-1 === t) return b.info("Feature flag refreshes not allowed"), !1;
|
|
160
|
-
s = new Date().getTime() >= (this.
|
|
160
|
+
s = new Date().getTime() >= (this.Xr || 0) + 1e3 * t;
|
|
161
161
|
}
|
|
162
162
|
if (!s)
|
|
163
163
|
return (
|
|
164
164
|
b.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
return this.h.
|
|
167
|
+
return this.h.Qr();
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
yo() {
|
|
170
170
|
var t;
|
|
171
171
|
return (
|
|
172
|
-
(null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.
|
|
172
|
+
(null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.bo)) || null
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
Co() {
|
|
176
176
|
var t, i;
|
|
177
177
|
null === (t = this.j) ||
|
|
178
178
|
void 0 === t ||
|
|
179
|
-
t.Pt(s.It.
|
|
179
|
+
t.Pt(s.It.bo, null === (i = this.C) || void 0 === i ? void 0 : i.$t());
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
Ro() {
|
|
182
182
|
var t;
|
|
183
183
|
const s = null === (t = this.C) || void 0 === t ? void 0 : t.$t(),
|
|
184
|
-
i = this.
|
|
184
|
+
i = this.yo();
|
|
185
185
|
return null == i || s === i;
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
Yr() {
|
|
188
188
|
if (!this.j) return;
|
|
189
189
|
const t = {};
|
|
190
190
|
for (const s of this.Rr) {
|
|
191
191
|
const i = s.qt();
|
|
192
192
|
t[s.id] = i;
|
|
193
193
|
}
|
|
194
|
-
this.j.Pt(s.It.
|
|
194
|
+
this.j.Pt(s.It.ho, t), this.j.Pt(s.It.To, this.Xr), this.Co();
|
|
195
195
|
}
|
|
196
196
|
changeUser() {
|
|
197
197
|
this.Y();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import fr from "./feature-flags-provider-factory.js";
|
|
3
3
|
export function getAllFeatureFlags() {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const t = [],
|
|
6
6
|
e = r.l();
|
|
7
|
-
if (e && !e.
|
|
8
|
-
const n =
|
|
7
|
+
if (e && !e.Qr()) return t;
|
|
8
|
+
const n = fr.o().Zr();
|
|
9
9
|
for (const r in n) t.push(n[r]);
|
|
10
10
|
return t;
|
|
11
11
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import fr from "./feature-flags-provider-factory.js";
|
|
3
3
|
export function getFeatureFlag(t) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const e = r.l();
|
|
6
|
-
if (e && !e.
|
|
7
|
-
const n =
|
|
6
|
+
if (e && !e.Qr()) return null;
|
|
7
|
+
const n = fr.o().Zr();
|
|
8
8
|
return n[t] ? n[t] : null;
|
|
9
9
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
2
2
|
import v from "../common/event-logger.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
|
-
import
|
|
4
|
+
import fr from "./feature-flags-provider-factory.js";
|
|
5
5
|
export function logFeatureFlagImpression(e) {
|
|
6
6
|
if (!r.rr()) return;
|
|
7
7
|
if (!e) return !1;
|
|
8
8
|
const t =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
|
-
o =
|
|
10
|
+
o = fr.o().Zr();
|
|
11
11
|
if (!o[e]) return b.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
13
|
if (!n) return b.info(t), !1;
|
|
14
|
-
const i =
|
|
14
|
+
const i = fr.o().uo();
|
|
15
15
|
if (i[n])
|
|
16
16
|
return (
|
|
17
17
|
b.info(
|
|
@@ -19,7 +19,7 @@ export function logFeatureFlagImpression(e) {
|
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(i[n] = !0),
|
|
22
|
+
(i[n] = !0), fr.o().vo(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
24
|
return v.Dt(p.xo, s).lt;
|
|
25
25
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
if (r.rr()) return
|
|
2
|
+
import fr from "./feature-flags-provider-factory.js";
|
|
3
|
+
function mr(e, t, a = !1) {
|
|
4
|
+
if (r.rr()) return fr.o().refreshFeatureFlags(e, t, a);
|
|
5
5
|
}
|
|
6
6
|
export function refreshFeatureFlags(r, e) {
|
|
7
|
-
|
|
7
|
+
mr(r, e);
|
|
8
8
|
}
|
|
9
|
-
export default
|
|
9
|
+
export default mr;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import fr from "./feature-flags-provider-factory.js";
|
|
3
3
|
import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
4
4
|
export function subscribeToFeatureFlagsUpdates(t) {
|
|
5
5
|
if (!r.rr()) return;
|
|
6
|
-
const e =
|
|
7
|
-
if (e.
|
|
6
|
+
const e = fr.o();
|
|
7
|
+
if (e.Ro()) {
|
|
8
8
|
const r = getAllFeatureFlags();
|
|
9
9
|
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
|
@@ -8,6 +8,6 @@ export function deferInAppMessage(e) {
|
|
|
8
8
|
return e instanceof ControlMessage
|
|
9
9
|
? (b.info("Not deferring since this is a ControlMessage."), !1)
|
|
10
10
|
: e instanceof InAppMessage
|
|
11
|
-
? se.ra().
|
|
11
|
+
? se.ra().Mo(e)
|
|
12
12
|
: (b.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { parseQueryStringKeyValues as
|
|
1
|
+
import { parseQueryStringKeyValues as kt } from "../../util/url-utils.js";
|
|
2
2
|
import { WindowUtils as no } from "../../util/window-utils.js";
|
|
3
|
-
import { IamOpenTarget as
|
|
3
|
+
import { IamOpenTarget as bt } from "../constants.js";
|
|
4
4
|
import { logInAppMessageHtmlClick } from "../log-in-app-message-html-click.js";
|
|
5
5
|
export const buildHtmlClickHandler = (t, l, i, o) => {
|
|
6
6
|
const r = i.getAttribute("href"),
|
|
7
7
|
n = i.onclick;
|
|
8
8
|
return (s) => {
|
|
9
9
|
if (null != n && "function" == typeof n && !1 === n.bind(i)(s)) return;
|
|
10
|
-
let e =
|
|
10
|
+
let e = kt(r).abButtonId;
|
|
11
11
|
if (
|
|
12
12
|
((null != e && "" !== e) || (e = i.getAttribute("id") || void 0),
|
|
13
13
|
null != r && "" !== r && 0 !== r.indexOf("#"))
|
|
@@ -15,7 +15,7 @@ export const buildHtmlClickHandler = (t, l, i, o) => {
|
|
|
15
15
|
const n =
|
|
16
16
|
"blank" ===
|
|
17
17
|
(i.getAttribute("target") || "").toLowerCase().replace("_", ""),
|
|
18
|
-
u = o || t.openTarget ===
|
|
18
|
+
u = o || t.openTarget === bt.BLANK || n,
|
|
19
19
|
m = () => {
|
|
20
20
|
logInAppMessageHtmlClick(t, e, r), no.openUri(r, u, s);
|
|
21
21
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import eo from "../../util/browser-detector.js";
|
|
2
2
|
import { logInAppMessageHtmlClick } from "../index.js";
|
|
3
3
|
import { OperatingSystems as so } from "../../util/device-constants.js";
|
|
4
|
-
import { buildHtmlClickHandler as
|
|
4
|
+
import { buildHtmlClickHandler as Ct } from "./html-message-display-utils.js";
|
|
5
5
|
import { attachHtmlToIframeWithNonce as N } from "../../util/html-display-utils.js";
|
|
6
6
|
import { buildBrazeBridge as E } from "../../util/html-display-utils.js";
|
|
7
|
-
import { IamServerTypes as
|
|
8
|
-
export default function
|
|
7
|
+
import { IamServerTypes as Ot } from "../constants.js";
|
|
8
|
+
export default function Bt(t, o, s, e, n) {
|
|
9
9
|
const i = document.createElement("iframe");
|
|
10
10
|
i.setAttribute("title", "Modal Message"),
|
|
11
11
|
e && (i.style.zIndex = (e + 1).toString());
|
|
@@ -16,10 +16,10 @@ export default function jt(t, o, s, e, n) {
|
|
|
16
16
|
e.focus();
|
|
17
17
|
const a = e.document.getElementsByTagName("head")[0];
|
|
18
18
|
if (null != a) {
|
|
19
|
-
if (t.
|
|
19
|
+
if (t.Oo()) {
|
|
20
20
|
const o = document.createElement("style");
|
|
21
21
|
(o.innerHTML = t.css || ""),
|
|
22
|
-
(o.id = t.
|
|
22
|
+
(o.id = t.ko() || ""),
|
|
23
23
|
null != n && o.setAttribute("nonce", n),
|
|
24
24
|
a.appendChild(o);
|
|
25
25
|
}
|
|
@@ -42,15 +42,15 @@ export default function jt(t, o, s, e, n) {
|
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
);
|
|
45
|
-
if (((e.appboyBridge = r), (e.brazeBridge = r), t.
|
|
45
|
+
if (((e.appboyBridge = r), (e.brazeBridge = r), t.Bo !== Ot.CE)) {
|
|
46
46
|
const o = e.document.getElementsByTagName("a");
|
|
47
|
-
for (let e = 0; e < o.length; e++) o[e].onclick =
|
|
47
|
+
for (let e = 0; e < o.length; e++) o[e].onclick = Ct(t, i, o[e], s);
|
|
48
48
|
const n = e.document.getElementsByTagName("button");
|
|
49
|
-
for (let o = 0; o < n.length; o++) n[o].onclick =
|
|
49
|
+
for (let o = 0; o < n.length; o++) n[o].onclick = Ct(t, i, n[o], s);
|
|
50
50
|
}
|
|
51
51
|
const c = e.document.body;
|
|
52
52
|
if (null != c) {
|
|
53
|
-
t.
|
|
53
|
+
t.Eo() && (c.id = t.htmlId || "");
|
|
54
54
|
const o = document.createElement("hidden");
|
|
55
55
|
(o.onclick = r.closeMessage),
|
|
56
56
|
(o.className = "ab-programmatic-close-button"),
|
|
@@ -62,12 +62,12 @@ export default function jt(t, o, s, e, n) {
|
|
|
62
62
|
}),
|
|
63
63
|
(i.className =
|
|
64
64
|
"ab-in-app-message ab-start-hidden ab-html-message ab-modal-interactions"),
|
|
65
|
-
|
|
65
|
+
eo.OS === so.ao)
|
|
66
66
|
) {
|
|
67
67
|
const o = document.createElement("div");
|
|
68
68
|
return (
|
|
69
|
-
(o.className = "ab-ios-scroll-wrapper"), o.appendChild(i), (t.
|
|
69
|
+
(o.className = "ab-ios-scroll-wrapper"), o.appendChild(i), (t._o = o), o
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
|
-
return (t.
|
|
72
|
+
return (t._o = i), i;
|
|
73
73
|
}
|
|
@@ -12,7 +12,7 @@ import ModalMessage from "../models/modal-message.js";
|
|
|
12
12
|
import SlideUpMessage from "../models/slide-up-message.js";
|
|
13
13
|
import { logInAppMessageClick } from "../log-in-app-message-click.js";
|
|
14
14
|
import { _handleBrazeAction as Q } from "../../Core/handle-braze-action.js";
|
|
15
|
-
import
|
|
15
|
+
import Bt from "./html-message-to-html.js";
|
|
16
16
|
import ie from "./modal-utils.js";
|
|
17
17
|
import { Guid as V } from "../../../shared-lib/index.js";
|
|
18
18
|
import { KeyCodes as le } from "../../util/key-codes.js";
|
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
IamClickAction as ce,
|
|
21
21
|
IamCropType as de,
|
|
22
22
|
IamImageStyle as ue,
|
|
23
|
-
IamOpenTarget as
|
|
23
|
+
IamOpenTarget as bt,
|
|
24
24
|
IamOrientation as be,
|
|
25
25
|
IamSlideFrom as fe,
|
|
26
26
|
IamTextAlignment as pe,
|
|
27
27
|
} from "../constants.js";
|
|
28
28
|
export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
29
29
|
if (((e.$o = document.activeElement), e instanceof HtmlMessage))
|
|
30
|
-
return
|
|
30
|
+
return Bt(e, o, a, n, i);
|
|
31
31
|
const l = (function (e, o, t, a, n, i = document.body, s = "ltr") {
|
|
32
32
|
let m = null;
|
|
33
33
|
const l = document.createElement("div");
|
|
@@ -37,7 +37,7 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
37
37
|
e.zo() &&
|
|
38
38
|
((l.className += " ab-modal-interactions"),
|
|
39
39
|
l.setAttribute("tabindex", "-1")),
|
|
40
|
-
e.
|
|
40
|
+
e.Oo() ||
|
|
41
41
|
((l.style.color = ae(e.textColor)),
|
|
42
42
|
(l.style.backgroundColor = ae(e.backgroundColor)),
|
|
43
43
|
te(e.backgroundColor) && (l.className += " ab-no-shadow"));
|
|
@@ -77,19 +77,19 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
77
77
|
e.tl(l, () => {
|
|
78
78
|
logInAppMessageClick(e),
|
|
79
79
|
e.clickAction === ce.URI &&
|
|
80
|
-
Q(e.uri || "", a || e.openTarget ===
|
|
80
|
+
Q(e.uri || "", a || e.openTarget === bt.BLANK, o);
|
|
81
81
|
}),
|
|
82
82
|
o.stopPropagation(),
|
|
83
83
|
!1
|
|
84
84
|
);
|
|
85
85
|
(l.onclick = o),
|
|
86
86
|
l.addEventListener("keydown", (e) => {
|
|
87
|
-
if (e.keyCode === le.Lo || e.keyCode === le.
|
|
87
|
+
if (e.keyCode === le.Lo || e.keyCode === le.qo) return o(e);
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
const d = T(
|
|
91
91
|
"Close Message",
|
|
92
|
-
e.
|
|
92
|
+
e.Oo() ? void 0 : ae(e.closeButtonColor),
|
|
93
93
|
() => {
|
|
94
94
|
e.tl(l);
|
|
95
95
|
},
|
|
@@ -100,7 +100,7 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
100
100
|
(u.className = "ab-message-text"),
|
|
101
101
|
(u.dir = s),
|
|
102
102
|
u.setAttribute("role", "article");
|
|
103
|
-
const b = (e.messageAlignment || e.
|
|
103
|
+
const b = (e.messageAlignment || e.Ao).toLowerCase();
|
|
104
104
|
u.className += " " + b + "-aligned";
|
|
105
105
|
let f = !1;
|
|
106
106
|
const p = document.createElement("div");
|
|
@@ -108,7 +108,7 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
108
108
|
const o = document.createElement("img");
|
|
109
109
|
if (
|
|
110
110
|
(o.setAttribute("src", e.imageUrl),
|
|
111
|
-
e.
|
|
111
|
+
e.Do(o),
|
|
112
112
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
113
113
|
) {
|
|
114
114
|
f = !0;
|
|
@@ -135,7 +135,7 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
135
135
|
p.className += " ab-icon-area";
|
|
136
136
|
const o = document.createElement("span");
|
|
137
137
|
(o.className = "ab-icon"),
|
|
138
|
-
e.
|
|
138
|
+
e.Oo() ||
|
|
139
139
|
((o.style.backgroundColor = ae(e.iconBackgroundColor)),
|
|
140
140
|
(o.style.color = ae(e.iconColor)));
|
|
141
141
|
const t = document.createElement("i");
|
|
@@ -149,22 +149,22 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
149
149
|
}
|
|
150
150
|
if ((F(u, "touchstart"), e.header && e.header.length > 0)) {
|
|
151
151
|
const o = document.createElement("h1");
|
|
152
|
-
(o.className = "ab-message-header"), (e.
|
|
152
|
+
(o.className = "ab-message-header"), (e.Go = V.de()), (o.id = e.Go);
|
|
153
153
|
const t = (e.headerAlignment || pe.CENTER).toLowerCase();
|
|
154
154
|
(o.className += " " + t + "-aligned"),
|
|
155
|
-
e.
|
|
155
|
+
e.Oo() || (o.style.color = ae(e.headerTextColor)),
|
|
156
156
|
o.appendChild(document.createTextNode(e.header)),
|
|
157
157
|
u.appendChild(o);
|
|
158
158
|
}
|
|
159
|
-
const g = e.
|
|
160
|
-
return u.appendChild(g), l.appendChild(u), f || c(), (e.
|
|
159
|
+
const g = e.Ho();
|
|
160
|
+
return u.appendChild(g), l.appendChild(u), f || c(), (e._o = l), l;
|
|
161
161
|
})(e, o, t, a, n, s, m);
|
|
162
162
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
163
163
|
const o = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
164
164
|
(l.className += ` ${o} ab-centered`),
|
|
165
|
-
ie.
|
|
166
|
-
ie.
|
|
167
|
-
ie.
|
|
165
|
+
ie.Io(e, l, a),
|
|
166
|
+
ie.Jo(l),
|
|
167
|
+
ie.Ko(e.Go, l);
|
|
168
168
|
} else if (e instanceof SlideUpMessage) {
|
|
169
169
|
(l.className += " ab-slideup"),
|
|
170
170
|
l.setAttribute("tabindex", "0"),
|
|
@@ -174,7 +174,7 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
174
174
|
const t = oe(
|
|
175
175
|
"0 0 11.38 19.44",
|
|
176
176
|
"M11.38 9.72l-9.33 9.72L0 17.3l7.27-7.58L0 2.14 2.05 0l9.33 9.72z",
|
|
177
|
-
e.
|
|
177
|
+
e.Oo() ? void 0 : ae(e.closeButtonColor),
|
|
178
178
|
);
|
|
179
179
|
t.setAttribute("class", `ab-chevron ${m}`), o.appendChild(t);
|
|
180
180
|
}
|
|
@@ -188,8 +188,8 @@ export default function ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
188
188
|
null != o && null != o.onclick && o.onclick(e);
|
|
189
189
|
}),
|
|
190
190
|
e.slideFrom === fe.TOP
|
|
191
|
-
? ((t = P.
|
|
192
|
-
: ((t = P.
|
|
191
|
+
? ((t = P.No), (a = " ab-swiped-up"))
|
|
192
|
+
: ((t = P.Po), (a = " ab-swiped-down")),
|
|
193
193
|
O(l, t, (e) => {
|
|
194
194
|
(l.className += a), null != o && null != o.onclick && o.onclick(e);
|
|
195
195
|
});
|