@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
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
attachHtmlToIframeWithNonce as N,
|
|
3
|
+
buildBrazeBridge as E,
|
|
4
|
+
} from "../../util/html-display-utils.js";
|
|
5
|
+
import r, { OPTIONS as U } from "../../managers/braze-instance.js";
|
|
6
|
+
import { retrieveChatConfig } from "../retrieve-chat-config.js";
|
|
7
|
+
import { sendChatMessage } from "../send-chat-message.js";
|
|
8
|
+
import { subscribeToChatMessageReceived } from "../subscribe-to-chat-message-received.js";
|
|
9
|
+
import { subscribeToChatUpdates } from "../subscribe-to-chat-conversation-updated.js";
|
|
10
|
+
import { getChatMessages } from "../get-chat-messages.js";
|
|
11
|
+
import { resetChatConversation } from "../reset-chat-conversation.js";
|
|
12
|
+
import { isChatTurnInProgress } from "../is-chat-turn-in-progress.js";
|
|
13
|
+
import { isChatConversationEnded } from "../is-chat-conversation-ended.js";
|
|
14
|
+
import { isChatTurnErrored } from "../is-chat-turn-errored.js";
|
|
15
|
+
import { handleBrazeAction } from "../../Core/handle-braze-action.js";
|
|
16
|
+
export const CHAT_WIDGET_IFRAME_ID = "braze-chat-widget";
|
|
17
|
+
export function chatWidgetToHtml(e, t, s, o) {
|
|
18
|
+
const a = document.createElement("iframe");
|
|
19
|
+
(a.id = "braze-chat-widget"),
|
|
20
|
+
t && a.setAttribute("nonce", t),
|
|
21
|
+
(a.className = "ab-chat-widget"),
|
|
22
|
+
a.setAttribute("title", "Chat");
|
|
23
|
+
const i = r.er(U.Te),
|
|
24
|
+
n = r.er(U.Ee);
|
|
25
|
+
return (
|
|
26
|
+
i
|
|
27
|
+
? (a.style.zIndex = i.toString())
|
|
28
|
+
: n && (a.style.zIndex = (n - 1).toString()),
|
|
29
|
+
N(a, e, t),
|
|
30
|
+
(a.onload = () => {
|
|
31
|
+
const e = a.contentWindow;
|
|
32
|
+
if (!e) return;
|
|
33
|
+
const t = Object.assign(Object.assign({}, E(a)), {
|
|
34
|
+
retrieveChatConfig: retrieveChatConfig,
|
|
35
|
+
sendChatMessage: sendChatMessage,
|
|
36
|
+
subscribeToChatMessageReceived: (e) =>
|
|
37
|
+
s(subscribeToChatMessageReceived(e)),
|
|
38
|
+
subscribeToChatUpdates: (e) => s(subscribeToChatUpdates(e)),
|
|
39
|
+
getChatMessages: getChatMessages,
|
|
40
|
+
resetChatConversation: resetChatConversation,
|
|
41
|
+
isChatTurnInProgress: isChatTurnInProgress,
|
|
42
|
+
isChatConversationEnded: isChatConversationEnded,
|
|
43
|
+
isChatTurnErrored: isChatTurnErrored,
|
|
44
|
+
handleBrazeAction: handleBrazeAction,
|
|
45
|
+
setChatWidgetBounds: (e, t) => o(a, e, t),
|
|
46
|
+
setChatWidgetOpen: (t) => {
|
|
47
|
+
e.dispatchEvent(
|
|
48
|
+
new CustomEvent("cw:set-open", { detail: { open: t } }),
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
(e.brazeBridge = t),
|
|
53
|
+
(e.appboyBridge = t),
|
|
54
|
+
e.dispatchEvent(new CustomEvent("ab.BridgeReady"));
|
|
55
|
+
}),
|
|
56
|
+
a
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { retrieveChatConfig } from "./retrieve-chat-config.js";
|
|
2
|
+
export { sendChatMessage } from "./send-chat-message.js";
|
|
3
|
+
export { subscribeToChatMessageReceived } from "./subscribe-to-chat-message-received.js";
|
|
4
|
+
export { subscribeToChatUpdates } from "./subscribe-to-chat-conversation-updated.js";
|
|
5
|
+
export { subscribeToChatAction } from "./subscribe-to-chat-action.js";
|
|
6
|
+
export { getChatMessages } from "./get-chat-messages.js";
|
|
7
|
+
export { resetChatConversation } from "./reset-chat-conversation.js";
|
|
8
|
+
export { isChatTurnInProgress } from "./is-chat-turn-in-progress.js";
|
|
9
|
+
export { isChatConversationEnded } from "./is-chat-conversation-ended.js";
|
|
10
|
+
export { isChatTurnErrored } from "./is-chat-turn-errored.js";
|
|
11
|
+
export { automaticallyManageChat } from "./automatically-manage-chat.js";
|
|
12
|
+
export { default as ChatMessage } from "./chat-message.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import { CHAT_BRAZE_ACTION_TYPE as mt } from "./constants.js";
|
|
3
|
+
import { triggerChatAction as pt } from "./trigger-chat-action.js";
|
|
4
|
+
export function registerChatActionHandler() {
|
|
5
|
+
const t = r.br();
|
|
6
|
+
null != t &&
|
|
7
|
+
t.yr(mt, (t) => {
|
|
8
|
+
pt({ type: "user_action", name: t[0], data: t[1] });
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import aa from "./conversational-chat-provider-factory.js";
|
|
3
|
+
export function retrieveChatConfig(o, t) {
|
|
4
|
+
if (!r.rr()) return void ("function" == typeof t && t());
|
|
5
|
+
const n = r.l();
|
|
6
|
+
!n || n.Zi() ? aa.o().En(o, t) : "function" == typeof t && t();
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import { logger as b } from "../../shared-lib/index.js";
|
|
3
|
+
import aa from "./conversational-chat-provider-factory.js";
|
|
4
|
+
export function sendChatMessage(e, s, n, t) {
|
|
5
|
+
if (!r.rr()) return !1;
|
|
6
|
+
const a = r.l();
|
|
7
|
+
if (a && !a.Zi()) return !1;
|
|
8
|
+
if ("string" != typeof e || 0 === e.length)
|
|
9
|
+
return b.error("sendChatMessage requires a non-empty message string."), !1;
|
|
10
|
+
const i = e
|
|
11
|
+
.trim()
|
|
12
|
+
.replace(/\n(\s*\n)+/g, "\n")
|
|
13
|
+
.replace(/ {2,}/g, " ");
|
|
14
|
+
return 0 === i.length
|
|
15
|
+
? (b.error("sendChatMessage requires a non-empty message string."), !1)
|
|
16
|
+
: aa.o().In(i, s, n, t);
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import { logger as b } from "../../shared-lib/index.js";
|
|
3
|
+
import aa from "./conversational-chat-provider-factory.js";
|
|
4
|
+
import { newChatActionEvent as rt } from "./chat-message-factory.js";
|
|
5
|
+
export function triggerChatAction(o) {
|
|
6
|
+
if (!r.rr()) return;
|
|
7
|
+
const t = rt(o);
|
|
8
|
+
null != t
|
|
9
|
+
? aa.o().Un(t)
|
|
10
|
+
: b.info(`Ignoring unrecognized chat action: ${o.type}`);
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ta from "../managers/braze-instance.js";
|
|
2
2
|
import BrazeSdkMetadata from "./braze-sdk-metadata.js";
|
|
3
3
|
import {
|
|
4
4
|
isArray as g,
|
|
5
|
-
validateValueIsFromEnum as
|
|
5
|
+
validateValueIsFromEnum as ra,
|
|
6
6
|
} from "../util/code-utils.js";
|
|
7
7
|
import { logger as b } from "../../shared-lib/index.js";
|
|
8
8
|
export function addSdkMetadata(a) {
|
|
9
|
-
if (!
|
|
10
|
-
const t =
|
|
9
|
+
if (!ta.rr()) return;
|
|
10
|
+
const t = ta.m();
|
|
11
11
|
if (t) {
|
|
12
12
|
if (!g(a))
|
|
13
13
|
return (
|
|
@@ -15,7 +15,7 @@ export function addSdkMetadata(a) {
|
|
|
15
15
|
);
|
|
16
16
|
for (const t of a)
|
|
17
17
|
if (
|
|
18
|
-
!
|
|
18
|
+
!ra(
|
|
19
19
|
BrazeSdkMetadata,
|
|
20
20
|
t,
|
|
21
21
|
"sdkMetadata contained an invalid value.",
|
package/src/Core/change-user.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { getByteLength as
|
|
2
|
+
import { getByteLength as sr } from "../util/string-utils.js";
|
|
3
3
|
import { logger as b } from "../../shared-lib/index.js";
|
|
4
4
|
import { User } from "../User/index.js";
|
|
5
|
-
import { validateStandardString as
|
|
5
|
+
import { validateStandardString as or } from "../util/validation-utils.js";
|
|
6
6
|
export function changeUser(e, i) {
|
|
7
7
|
if (!r.rr()) return;
|
|
8
8
|
if (null == e || 0 === e.length || e != e)
|
|
9
9
|
return void b.error("changeUser requires a non-empty userId.");
|
|
10
|
-
if (
|
|
10
|
+
if (sr(e) > User.Ur)
|
|
11
11
|
return void b.error(
|
|
12
|
-
`Rejected user id "${e}" because it is longer than ${User.
|
|
12
|
+
`Rejected user id "${e}" because it is longer than ${User.Ur} bytes.`,
|
|
13
13
|
);
|
|
14
|
-
if (null != i && !
|
|
14
|
+
if (null != i && !or(i, "set signature for new user", "signature")) return;
|
|
15
15
|
const t = r.nn();
|
|
16
|
-
t && t.changeUser(e.toString(), r
|
|
16
|
+
t && t.changeUser(e.toString(), r.$r(), i);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -4,13 +4,13 @@ import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
|
4
4
|
export function disableSDK() {
|
|
5
5
|
const e = r.nn();
|
|
6
6
|
e && e.requestImmediateDataFlush();
|
|
7
|
-
const n = r.er(U.
|
|
8
|
-
a = new ne.
|
|
9
|
-
i = "This-cookie-will-expire-in-" + a.
|
|
10
|
-
a.store(s.
|
|
7
|
+
const n = r.er(U.xe),
|
|
8
|
+
a = new ne.De(null, !0, n),
|
|
9
|
+
i = "This-cookie-will-expire-in-" + a.Ke();
|
|
10
|
+
a.store(s.Se, i);
|
|
11
11
|
const o = et._s.Xs;
|
|
12
|
-
new et(o, b).setItem(o.Ws.
|
|
12
|
+
new et(o, b).setItem(o.Ws.ke, o.ze, !0),
|
|
13
13
|
b.info("disableSDK was called"),
|
|
14
14
|
r.destroy(!1),
|
|
15
|
-
r.
|
|
15
|
+
r.qe(!0);
|
|
16
16
|
}
|
package/src/Core/enable-sdk.js
CHANGED
|
@@ -2,10 +2,10 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { logger as b, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
3
3
|
import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
|
-
new ne.
|
|
5
|
+
new ne.De(null, !0).remove(s.Se);
|
|
6
6
|
const e = et._s.Xs;
|
|
7
|
-
new et(e, b).
|
|
7
|
+
new et(e, b).Ae(e.Ws.ke, e.ze),
|
|
8
8
|
b.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
|
-
r.
|
|
10
|
+
r.qe(!1);
|
|
11
11
|
}
|
|
@@ -2,9 +2,9 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { logger as b } from "../../shared-lib/index.js";
|
|
3
3
|
export function getDeviceId(e) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t = r.
|
|
5
|
+
const t = r.Ie();
|
|
6
6
|
if (!t) return;
|
|
7
|
-
const i = t.
|
|
7
|
+
const i = t.Ye().id;
|
|
8
8
|
if ("function" != typeof e) return i;
|
|
9
9
|
b.warn(
|
|
10
10
|
"The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
|
|
@@ -3,9 +3,9 @@ import { CoreStrings as R } from "../common/constants.js";
|
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import {
|
|
5
5
|
BRAZE_ACTIONS as oo,
|
|
6
|
-
getDecodedBrazeAction as
|
|
6
|
+
getDecodedBrazeAction as ro,
|
|
7
7
|
} from "../util/braze-actions.js";
|
|
8
|
-
import
|
|
8
|
+
import eo from "../util/browser-detector.js";
|
|
9
9
|
import { OperatingSystems as so } from "../util/device-constants.js";
|
|
10
10
|
import {
|
|
11
11
|
BRAZE_ACTION_URI_REGEX as to,
|
|
@@ -16,7 +16,7 @@ import { getUser as ao } from "./get-user.js";
|
|
|
16
16
|
export function _handleBrazeAction(o, e, s) {
|
|
17
17
|
if (r.rr())
|
|
18
18
|
if (to.test(o)) {
|
|
19
|
-
const e =
|
|
19
|
+
const e = ro(o);
|
|
20
20
|
if (!e) return;
|
|
21
21
|
const s = (o) => {
|
|
22
22
|
if (!io(o))
|
|
@@ -32,8 +32,8 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
32
32
|
i = oo.properties.so,
|
|
33
33
|
n = o[e];
|
|
34
34
|
if (n === oo.types.io) {
|
|
35
|
-
const
|
|
36
|
-
for (const o of
|
|
35
|
+
const r = o[t];
|
|
36
|
+
for (const o of r) s(o);
|
|
37
37
|
} else {
|
|
38
38
|
const e = o[i];
|
|
39
39
|
let s, t;
|
|
@@ -41,7 +41,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
41
41
|
case oo.types.logCustomEvent:
|
|
42
42
|
import("./log-custom-event.js").then(
|
|
43
43
|
({ logCustomEvent: logCustomEvent }) => {
|
|
44
|
-
r.
|
|
44
|
+
r.vr()
|
|
45
45
|
? ((t = Array.prototype.slice.call(e)),
|
|
46
46
|
logCustomEvent(...t))
|
|
47
47
|
: b.error(R.ee);
|
|
@@ -51,8 +51,8 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
51
51
|
case oo.types.requestPushPermission:
|
|
52
52
|
import("../Push/request-push-permission.js").then(
|
|
53
53
|
({ requestPushPermission: requestPushPermission }) => {
|
|
54
|
-
r.
|
|
55
|
-
? "Safari" ===
|
|
54
|
+
r.vr()
|
|
55
|
+
? "Safari" === eo.browser && eo.OS === so.ao
|
|
56
56
|
? window.navigator.standalone && requestPushPermission()
|
|
57
57
|
: requestPushPermission()
|
|
58
58
|
: b.error(R.ee);
|
|
@@ -70,18 +70,25 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
70
70
|
s[n](...Array.prototype.slice.call(e));
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
|
+
case oo.types.co:
|
|
73
74
|
case oo.types.mo:
|
|
74
|
-
case oo.types.uo:
|
|
75
75
|
(t = Array.prototype.slice.call(e)), no.openUri(...t);
|
|
76
76
|
break;
|
|
77
|
-
default:
|
|
78
|
-
|
|
77
|
+
default: {
|
|
78
|
+
const o = r.br(),
|
|
79
|
+
s = null != o ? o.lo(n) : null;
|
|
80
|
+
s
|
|
81
|
+
? r.vr()
|
|
82
|
+
? s(Array.prototype.slice.call(e))
|
|
83
|
+
: b.error(R.ee)
|
|
84
|
+
: b.info(`Ignoring unknown Braze Action: ${n}`);
|
|
85
|
+
}
|
|
79
86
|
}
|
|
80
87
|
}
|
|
81
88
|
};
|
|
82
89
|
s(e);
|
|
83
90
|
} else no.openUri(o, e, s);
|
|
84
91
|
}
|
|
85
|
-
export function handleBrazeAction(o,
|
|
86
|
-
_handleBrazeAction(o,
|
|
92
|
+
export function handleBrazeAction(o, r) {
|
|
93
|
+
_handleBrazeAction(o, r);
|
|
87
94
|
}
|
package/src/Core/is-disabled.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import v from "../common/event-logger.js";
|
|
3
3
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
4
|
-
import
|
|
5
|
-
import { TriggersProviderFactory as
|
|
4
|
+
import gt from "../triggers/models/trigger-events.js";
|
|
5
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
6
6
|
import {
|
|
7
|
-
validateCustomProperties as
|
|
8
|
-
validateCustomString as
|
|
7
|
+
validateCustomProperties as vt,
|
|
8
|
+
validateCustomString as jt,
|
|
9
9
|
} from "../util/validation-utils.js";
|
|
10
10
|
import { CoreStrings as R } from "../common/constants.js";
|
|
11
11
|
export function logCustomEvent(t, e) {
|
|
@@ -17,22 +17,22 @@ export function logCustomEvent(t, e) {
|
|
|
17
17
|
),
|
|
18
18
|
!1
|
|
19
19
|
);
|
|
20
|
-
if (!
|
|
21
|
-
const [o, n] =
|
|
20
|
+
if (!jt(t, "log custom event", "the event name")) return !1;
|
|
21
|
+
const [o, n] = vt(
|
|
22
22
|
e,
|
|
23
|
-
R
|
|
23
|
+
R.$e,
|
|
24
24
|
"eventProperties",
|
|
25
25
|
`log custom event "${t}"`,
|
|
26
26
|
"event",
|
|
27
27
|
);
|
|
28
28
|
if (!o) return !1;
|
|
29
29
|
const i = r.l();
|
|
30
|
-
if (i && i
|
|
30
|
+
if (i && i.Le(t))
|
|
31
31
|
return b.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
|
|
32
32
|
const s = v.Dt(p.CustomEvent, { n: t, p: n });
|
|
33
33
|
if (s.lt) {
|
|
34
34
|
b.info(`Logged custom event "${t}".`);
|
|
35
|
-
for (const o of s.
|
|
35
|
+
for (const o of s.Ne) ft.o().Pe(gt.Be, [t, e], o);
|
|
36
36
|
}
|
|
37
37
|
return s.lt;
|
|
38
38
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventTypes as p, logger as b } 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
|
|
5
|
-
import { TriggersProviderFactory as
|
|
4
|
+
import gt from "../triggers/models/trigger-events.js";
|
|
5
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
6
6
|
import { sanitizeEcommerceEvent as re } from "../util/ecommerce-event-validation.js";
|
|
7
7
|
export function logEcommerceEvent(e) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
@@ -16,14 +16,14 @@ export function logEcommerceEvent(e) {
|
|
|
16
16
|
const o = re(e);
|
|
17
17
|
if (null == o) return !1;
|
|
18
18
|
const t = r.l();
|
|
19
|
-
if (t && t
|
|
19
|
+
if (t && t.Le(e.name))
|
|
20
20
|
return (
|
|
21
21
|
b.info(`The eCommerce event "${e.name}" is blocklisted, ignoring.`), !1
|
|
22
22
|
);
|
|
23
23
|
const n = v.Dt(p.CustomEvent, { n: e.name, p: o });
|
|
24
24
|
if (n.lt) {
|
|
25
25
|
b.info(`Logged eCommerce event "${e.name}".`);
|
|
26
|
-
for (const r of n.
|
|
26
|
+
for (const r of n.Ne) ft.o().Pe(gt.Be, [e.name, e.properties], r);
|
|
27
27
|
}
|
|
28
28
|
return n.lt;
|
|
29
29
|
}
|
package/src/Core/log-purchase.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EventTypes as p, logger as b } from "../../shared-lib/index.js";
|
|
2
|
-
import { isValidIso4217CurrencyCode as
|
|
3
|
-
import { MAX_PURCHASE_QUANTITY as
|
|
2
|
+
import { isValidIso4217CurrencyCode as ur } from "../util/iso-4217-currency-codes.js";
|
|
3
|
+
import { MAX_PURCHASE_QUANTITY as ar } from "../common/constants.js";
|
|
4
4
|
import v from "../common/event-logger.js";
|
|
5
5
|
import r from "../managers/braze-instance.js";
|
|
6
|
-
import
|
|
7
|
-
import { TriggersProviderFactory as
|
|
6
|
+
import gt from "../triggers/models/trigger-events.js";
|
|
7
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
8
8
|
import {
|
|
9
|
-
validateCustomProperties as
|
|
10
|
-
validateCustomString as
|
|
9
|
+
validateCustomProperties as vt,
|
|
10
|
+
validateCustomString as jt,
|
|
11
11
|
} from "../util/validation-utils.js";
|
|
12
12
|
export function logPurchase(e, o, i, n, t) {
|
|
13
13
|
if (!r.rr()) return !1;
|
|
@@ -20,7 +20,7 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
20
20
|
),
|
|
21
21
|
!1
|
|
22
22
|
);
|
|
23
|
-
if (!
|
|
23
|
+
if (!jt(e, "log purchase", "the purchase name")) return !1;
|
|
24
24
|
if (null == o || isNaN(parseFloat(o.toString())))
|
|
25
25
|
return (
|
|
26
26
|
b.error(`logPurchase requires a numeric price, got ${o}, ignoring.`), !1
|
|
@@ -32,19 +32,19 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
32
32
|
!1
|
|
33
33
|
);
|
|
34
34
|
const u = parseInt(n.toString());
|
|
35
|
-
if (u < 1 || u >
|
|
35
|
+
if (u < 1 || u > ar)
|
|
36
36
|
return (
|
|
37
37
|
b.error(
|
|
38
|
-
`logPurchase requires a quantity >1 and <${
|
|
38
|
+
`logPurchase requires a quantity >1 and <${ar}, got ${u}, ignoring.`,
|
|
39
39
|
),
|
|
40
40
|
!1
|
|
41
41
|
);
|
|
42
|
-
if (((i = null != i ? i.toUpperCase() : i), !
|
|
42
|
+
if (((i = null != i ? i.toUpperCase() : i), !ur(i)))
|
|
43
43
|
return (
|
|
44
44
|
b.error(`logPurchase requires a valid currencyCode, got ${i}, ignoring.`),
|
|
45
45
|
!1
|
|
46
46
|
);
|
|
47
|
-
const [a, g] =
|
|
47
|
+
const [a, g] = vt(
|
|
48
48
|
t,
|
|
49
49
|
"logPurchase",
|
|
50
50
|
"purchaseProperties",
|
|
@@ -53,12 +53,12 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
53
53
|
);
|
|
54
54
|
if (!a) return !1;
|
|
55
55
|
const c = r.l();
|
|
56
|
-
if (c && c
|
|
56
|
+
if (c && c.Pr(e))
|
|
57
57
|
return b.info(`Purchase "${e}" is blocklisted, ignoring.`), !1;
|
|
58
|
-
const l = v.Dt(p.
|
|
58
|
+
const l = v.Dt(p.qr, { pid: e, c: i, p: s, q: u, pr: g });
|
|
59
59
|
if (l.lt) {
|
|
60
60
|
b.info(`Logged ${u} purchase${u > 1 ? "s" : ""} of "${e}" for ${i} ${s}.`);
|
|
61
|
-
for (const r of l.
|
|
61
|
+
for (const r of l.Ne) ft.o().Pe(gt.Nr, [e, t], r);
|
|
62
62
|
}
|
|
63
63
|
return l.lt;
|
|
64
64
|
}
|
package/src/Core/open-session.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import { logger as b, IndexedDBAdapter as et } from "../../shared-lib/index.js";
|
|
3
|
-
import
|
|
4
|
-
import { TriggersProviderFactory as
|
|
3
|
+
import gt from "../triggers/models/trigger-events.js";
|
|
4
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
5
5
|
export function openSession() {
|
|
6
6
|
if (!r.rr()) return;
|
|
7
7
|
const i = r.nn();
|
|
@@ -9,17 +9,17 @@ export function openSession() {
|
|
|
9
9
|
i.openSession();
|
|
10
10
|
const t = et._s.Xs,
|
|
11
11
|
o = new et(t, b);
|
|
12
|
-
o.kr(t.Ws.
|
|
12
|
+
o.kr(t.Ws.Fr, (r, n) => {
|
|
13
13
|
const e = n.lastClick,
|
|
14
14
|
s = n.trackingString;
|
|
15
15
|
b.info(`Firing push click trigger from ${s} push click at ${e}`);
|
|
16
|
-
const c = i.
|
|
16
|
+
const c = i.Sr(e, s),
|
|
17
17
|
g = function () {
|
|
18
|
-
|
|
18
|
+
ft.o().Pe(gt.Ar, [s], c);
|
|
19
19
|
};
|
|
20
|
-
i.
|
|
20
|
+
i.Br(g, g), o.Ae(t.Ws.Fr, r);
|
|
21
21
|
}),
|
|
22
|
-
o.Qs(t.Ws.
|
|
23
|
-
i.
|
|
22
|
+
o.Qs(t.Ws.Dr, function (r) {
|
|
23
|
+
i.Er(r);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { validateStandardString as
|
|
2
|
+
import { validateStandardString as or } from "../util/validation-utils.js";
|
|
3
3
|
export function setSdkAuthenticationSignature(t) {
|
|
4
4
|
if (!r.rr()) return !1;
|
|
5
|
-
if ("" === t || !
|
|
6
|
-
const i = r.
|
|
5
|
+
if ("" === t || !or(t, "set signature", "signature", !1)) return !1;
|
|
6
|
+
const i = r.Gr();
|
|
7
7
|
return !!i && (i.setSdkAuthenticationSignature(t), !0);
|
|
8
8
|
}
|
|
@@ -2,7 +2,7 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
export function subscribeToSdkAuthenticationFailures(i) {
|
|
3
3
|
var n;
|
|
4
4
|
if (r.rr())
|
|
5
|
-
return null === (n = r.
|
|
5
|
+
return null === (n = r.Gr()) || void 0 === n
|
|
6
6
|
? void 0
|
|
7
7
|
: n.subscribeToSdkAuthenticationFailures(i);
|
|
8
8
|
}
|
package/src/Core/wipe-data.js
CHANGED