@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
|
@@ -2,88 +2,88 @@ import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
|
2
2
|
import { Guid as V, logger as b } from "../../shared-lib/index.js";
|
|
3
3
|
export const REFRESH_LOCK_TTL_MS = 2e3;
|
|
4
4
|
export const CONFIG_POLL_INTERVAL_MS = 100;
|
|
5
|
-
const
|
|
5
|
+
const wt = [s.It.Re, s.It._e, s.It.Fe, s.It.Me];
|
|
6
6
|
export function isConfigExpired(t) {
|
|
7
7
|
return !!t && Math.floor(new Date().valueOf() / 1e3) >= t;
|
|
8
8
|
}
|
|
9
9
|
export function isConfigUsable(t) {
|
|
10
|
-
return Boolean(t.
|
|
10
|
+
return Boolean(t.Oe && t.host) && !isConfigExpired(t.expiration);
|
|
11
11
|
}
|
|
12
|
-
export default class
|
|
12
|
+
export default class xt {
|
|
13
13
|
constructor(t) {
|
|
14
|
-
(this.j = t), (this.j = t), (this.
|
|
14
|
+
(this.j = t), (this.j = t), (this.Ue = null), (this.Ge = null);
|
|
15
15
|
}
|
|
16
16
|
read() {
|
|
17
17
|
return this.j
|
|
18
18
|
? {
|
|
19
|
-
|
|
20
|
-
host: this.j.St(s.It.
|
|
21
|
-
|
|
22
|
-
expiration: this.j.St(s.It.
|
|
19
|
+
Oe: this.j.St(s.It.Re),
|
|
20
|
+
host: this.j.St(s.It._e),
|
|
21
|
+
He: this.j.St(s.It.Fe),
|
|
22
|
+
expiration: this.j.St(s.It.Me),
|
|
23
23
|
}
|
|
24
|
-
: {
|
|
24
|
+
: { Oe: null, host: null, He: null, expiration: null };
|
|
25
25
|
}
|
|
26
26
|
write(t) {
|
|
27
27
|
const i = this.j;
|
|
28
28
|
i &&
|
|
29
|
-
(i.Pt(s.It.
|
|
30
|
-
i.Pt(s.It.
|
|
31
|
-
t.
|
|
32
|
-
t.expiration ? i.Pt(s.It.
|
|
29
|
+
(i.Pt(s.It.Re, t.Oe),
|
|
30
|
+
i.Pt(s.It._e, t.host),
|
|
31
|
+
t.He ? i.Pt(s.It.Fe, t.He) : i.Vt(s.It.Fe),
|
|
32
|
+
t.expiration ? i.Pt(s.It.Me, t.expiration) : i.Vt(s.It.Me));
|
|
33
33
|
}
|
|
34
34
|
clear() {
|
|
35
35
|
const t = this.j;
|
|
36
|
-
t && (t.Vt(s.It.
|
|
36
|
+
t && (t.Vt(s.It.Re), t.Vt(s.It._e), t.Vt(s.It.Fe), t.Vt(s.It.Me));
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
Ve() {
|
|
39
39
|
const t = this.j;
|
|
40
40
|
if (!t) return V.de();
|
|
41
|
-
const i = t.St(s.It.
|
|
41
|
+
const i = t.St(s.It.We),
|
|
42
42
|
e = new Date().valueOf();
|
|
43
43
|
if (i && "number" == typeof i.e && i.e > e) return null;
|
|
44
44
|
const n = V.de();
|
|
45
|
-
t.Pt(s.It.
|
|
46
|
-
const r = t.St(s.It.
|
|
45
|
+
t.Pt(s.It.We, { t: n, e: e + 2e3 });
|
|
46
|
+
const r = t.St(s.It.We);
|
|
47
47
|
return r && r.t === n ? n : null;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
Je(t) {
|
|
50
50
|
const i = this.j;
|
|
51
51
|
if (!i) return;
|
|
52
|
-
const e = i.St(s.It.
|
|
53
|
-
(e && e.t !== t) || i.Vt(s.It.
|
|
52
|
+
const e = i.St(s.It.We);
|
|
53
|
+
(e && e.t !== t) || i.Vt(s.It.We);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
if (this.
|
|
55
|
+
Qe(t, i) {
|
|
56
|
+
if (this.Ue || null !== this.Ge) return !1;
|
|
57
57
|
const e = this.read();
|
|
58
58
|
if (isConfigUsable(e)) return t(e), !0;
|
|
59
59
|
const s = new Date().valueOf() + 2e3,
|
|
60
60
|
n = () => {
|
|
61
61
|
const e = this.read();
|
|
62
|
-
if (isConfigUsable(e)) return this.
|
|
62
|
+
if (isConfigUsable(e)) return this.Xe(), void t(e);
|
|
63
63
|
new Date().valueOf() >= s &&
|
|
64
|
-
(this.
|
|
64
|
+
(this.Xe(),
|
|
65
65
|
b.info(
|
|
66
66
|
"Timed out waiting for another tab to refresh real-time messaging configuration",
|
|
67
67
|
),
|
|
68
68
|
i());
|
|
69
69
|
};
|
|
70
70
|
return (
|
|
71
|
-
(this.
|
|
71
|
+
(this.Ue = (t) => {
|
|
72
72
|
if (t.key)
|
|
73
|
-
for (let i = 0; i <
|
|
74
|
-
if (0 === t.key.indexOf(
|
|
73
|
+
for (let i = 0; i < wt.length; i++)
|
|
74
|
+
if (0 === t.key.indexOf(wt[i])) return void n();
|
|
75
75
|
}),
|
|
76
|
-
window.addEventListener("storage", this.
|
|
77
|
-
(this.
|
|
76
|
+
window.addEventListener("storage", this.Ue),
|
|
77
|
+
(this.Ge = window.setInterval(n, 100)),
|
|
78
78
|
!0
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
this.
|
|
83
|
-
(window.removeEventListener("storage", this.
|
|
84
|
-
null !== this.
|
|
81
|
+
Xe() {
|
|
82
|
+
this.Ue &&
|
|
83
|
+
(window.removeEventListener("storage", this.Ue), (this.Ue = null)),
|
|
84
|
+
null !== this.Ge && (window.clearInterval(this.Ge), (this.Ge = null));
|
|
85
85
|
}
|
|
86
86
|
destroy() {
|
|
87
|
-
this.
|
|
87
|
+
this.Xe();
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
2
2
|
export const MESSAGE_CLAIM_WINDOW_MS = 500;
|
|
3
|
-
const
|
|
4
|
-
export default class
|
|
3
|
+
const Mt = ["ccr", "ffr", "tgr"];
|
|
4
|
+
export default class At {
|
|
5
5
|
constructor(t) {
|
|
6
6
|
(this.j = t), (this.j = t);
|
|
7
7
|
}
|
|
@@ -10,7 +10,7 @@ export default class at {
|
|
|
10
10
|
if (
|
|
11
11
|
!r ||
|
|
12
12
|
!(function (t) {
|
|
13
|
-
for (const r of
|
|
13
|
+
for (const r of Mt) if (r === t) return !0;
|
|
14
14
|
return !1;
|
|
15
15
|
})(t)
|
|
16
16
|
)
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import dr from "./dust-provider.js";
|
|
3
|
+
const nt = {
|
|
4
4
|
i: !1,
|
|
5
5
|
provider: null,
|
|
6
6
|
o: () => {
|
|
7
|
-
if ((
|
|
7
|
+
if ((nt.t(), !nt.provider)) {
|
|
8
8
|
const t = r.er("dustHost");
|
|
9
|
-
(
|
|
10
|
-
r.v(
|
|
11
|
-
|
|
9
|
+
(nt.provider = new dr(r.m(), r.p(), r.l(), t)),
|
|
10
|
+
r.v(nt.provider),
|
|
11
|
+
nt.provider.Hr();
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return nt.provider;
|
|
14
14
|
},
|
|
15
15
|
t: () => {
|
|
16
|
-
|
|
16
|
+
nt.i || (r.g(nt), (nt.i = !0));
|
|
17
17
|
},
|
|
18
18
|
destroy: () => {
|
|
19
|
-
|
|
19
|
+
nt.provider && nt.provider.destroy(), (nt.provider = null), (nt.i = !1);
|
|
20
20
|
},
|
|
21
21
|
};
|
|
22
|
-
export default
|
|
22
|
+
export default nt;
|