@braze/web-sdk 6.12.1 → 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 +23 -23
- 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
|
@@ -3,9 +3,9 @@ import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.j
|
|
|
3
3
|
import { toRgba as ae } from "../../util/color-utils.js";
|
|
4
4
|
import { addPassiveEventListener as F } from "../../util/dom-utils.js";
|
|
5
5
|
import { KeyCodes as le } from "../../util/key-codes.js";
|
|
6
|
-
import { IamClickAction as ce, IamOpenTarget as
|
|
6
|
+
import { IamClickAction as ce, IamOpenTarget as bt } from "../constants.js";
|
|
7
7
|
const ie = {
|
|
8
|
-
|
|
8
|
+
Jo: (t) => {
|
|
9
9
|
const o = t.querySelectorAll(".ab-close-button, .ab-message-button");
|
|
10
10
|
let e;
|
|
11
11
|
for (let t = 0; t < o.length; t++) (e = o[t]), (e.tabIndex = 0);
|
|
@@ -14,7 +14,7 @@ const ie = {
|
|
|
14
14
|
s = o[o.length - 1];
|
|
15
15
|
t.addEventListener("keydown", (o) => {
|
|
16
16
|
const a = document.activeElement;
|
|
17
|
-
o.keyCode === le.
|
|
17
|
+
o.keyCode === le.Qo &&
|
|
18
18
|
(o.shiftKey || (a !== s && a !== t)
|
|
19
19
|
? !o.shiftKey ||
|
|
20
20
|
(a !== e && a !== t) ||
|
|
@@ -23,14 +23,14 @@ const ie = {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
Ko: (t, o) => {
|
|
27
27
|
o.setAttribute("role", "dialog"),
|
|
28
28
|
o.setAttribute("aria-modal", "true"),
|
|
29
29
|
t
|
|
30
30
|
? o.setAttribute("aria-labelledby", t)
|
|
31
31
|
: o.setAttribute("aria-label", "Modal Message");
|
|
32
32
|
},
|
|
33
|
-
|
|
33
|
+
Io: (t, o, e) => {
|
|
34
34
|
if (t.buttons && t.buttons.length > 0) {
|
|
35
35
|
const s = document.createElement("div");
|
|
36
36
|
(s.className = "ab-message-buttons"), o.appendChild(s);
|
|
@@ -40,7 +40,7 @@ const ie = {
|
|
|
40
40
|
t.tl(o, () => {
|
|
41
41
|
logInAppMessageButtonClick(s, t),
|
|
42
42
|
s.clickAction === ce.URI &&
|
|
43
|
-
Q(s.uri || "", e || t.openTarget ===
|
|
43
|
+
Q(s.uri || "", e || t.openTarget === bt.BLANK, a);
|
|
44
44
|
}),
|
|
45
45
|
a.stopPropagation(),
|
|
46
46
|
!1
|
|
@@ -54,7 +54,7 @@ const ie = {
|
|
|
54
54
|
let n = e.text;
|
|
55
55
|
"" === e.text && (n = " "),
|
|
56
56
|
a.appendChild(document.createTextNode(n)),
|
|
57
|
-
t.
|
|
57
|
+
t.Oo() ||
|
|
58
58
|
((a.style.backgroundColor = ae(e.backgroundColor)),
|
|
59
59
|
(a.style.color = ae(e.textColor)),
|
|
60
60
|
(a.style.borderColor = ae(e.borderColor))),
|
|
@@ -5,7 +5,7 @@ import InAppMessageButton from "./models/in-app-message-button.js";
|
|
|
5
5
|
import ModalMessage from "./models/modal-message.js";
|
|
6
6
|
import SlideUpMessage from "./models/slide-up-message.js";
|
|
7
7
|
import { logger as b } from "../../shared-lib/index.js";
|
|
8
|
-
import { IamServerTypes as
|
|
8
|
+
import { IamServerTypes as Ot } from "./constants.js";
|
|
9
9
|
export function newInAppMessageFromJson(e) {
|
|
10
10
|
if (!e) return null;
|
|
11
11
|
if (e.is_control) return ControlMessage.fromJson(e);
|
|
@@ -49,7 +49,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
49
49
|
D = e.language,
|
|
50
50
|
E = e.image_alt;
|
|
51
51
|
let G;
|
|
52
|
-
if (o ===
|
|
52
|
+
if (o === Ot.tE || o === Ot.eE)
|
|
53
53
|
G = new ModalMessage(
|
|
54
54
|
s,
|
|
55
55
|
n,
|
|
@@ -82,7 +82,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
82
82
|
D,
|
|
83
83
|
E,
|
|
84
84
|
);
|
|
85
|
-
else if (o ===
|
|
85
|
+
else if (o === Ot.oE)
|
|
86
86
|
G = new FullScreenMessage(
|
|
87
87
|
s,
|
|
88
88
|
n,
|
|
@@ -116,7 +116,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
116
116
|
D,
|
|
117
117
|
E,
|
|
118
118
|
);
|
|
119
|
-
else if (o ===
|
|
119
|
+
else if (o === Ot.RE)
|
|
120
120
|
G = new SlideUpMessage(
|
|
121
121
|
s,
|
|
122
122
|
n,
|
|
@@ -144,7 +144,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
144
144
|
E,
|
|
145
145
|
);
|
|
146
146
|
else {
|
|
147
|
-
if (o !==
|
|
147
|
+
if (o !== Ot.ME && o !== Ot.CE && o !== Ot.DE)
|
|
148
148
|
return void b.error("Ignoring message with unknown type " + o);
|
|
149
149
|
{
|
|
150
150
|
const o = e.message_fields;
|
|
@@ -152,7 +152,7 @@ export function newInAppMessageFromJson(e) {
|
|
|
152
152
|
(G.trusted = e.trusted || !1);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
return (G.
|
|
155
|
+
return (G.Bo = o), G;
|
|
156
156
|
}
|
|
157
157
|
export function buttonsFromSerializedInAppMessage(e) {
|
|
158
158
|
const o = [];
|
|
@@ -5,28 +5,28 @@ import HtmlMessage from "./models/html-message.js";
|
|
|
5
5
|
import InAppMessage from "./models/in-app-message.js";
|
|
6
6
|
import InAppMessageButton from "./models/in-app-message-button.js";
|
|
7
7
|
import v from "../common/event-logger.js";
|
|
8
|
-
import { newInAppMessageFromJson as
|
|
8
|
+
import { newInAppMessageFromJson as It } from "./in-app-message-factory.js";
|
|
9
9
|
import { randomInclusive as a } from "../util/math.js";
|
|
10
10
|
import L from "../models/request-result.js";
|
|
11
11
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
12
12
|
import f from "../managers/subscription-manager.js";
|
|
13
|
-
import
|
|
13
|
+
import Tt from "../triggers/models/trigger.js";
|
|
14
14
|
import { BRAZE_ACTION_URI_REGEX as to } from "../util/validation-utils.js";
|
|
15
15
|
import {
|
|
16
|
-
containsPushPrimerBrazeAction as
|
|
17
|
-
containsUnknownBrazeAction as
|
|
18
|
-
getDecodedBrazeAction as
|
|
19
|
-
ineligibleBrazeActionURLErrorMessage as
|
|
20
|
-
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as
|
|
16
|
+
containsPushPrimerBrazeAction as Dt,
|
|
17
|
+
containsUnknownBrazeAction as St,
|
|
18
|
+
getDecodedBrazeAction as ro,
|
|
19
|
+
ineligibleBrazeActionURLErrorMessage as zt,
|
|
20
|
+
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as Rt,
|
|
21
21
|
} from "../util/braze-actions.js";
|
|
22
|
-
import
|
|
22
|
+
import _t from "../Push/utils/push-utils.js";
|
|
23
23
|
import h from "../util/request-header-utils.js";
|
|
24
24
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
25
25
|
import { FullScreenMessage, ModalMessage, SlideUpMessage } from "./index.js";
|
|
26
26
|
import {
|
|
27
27
|
IamClickAction as ce,
|
|
28
|
-
IamServerTypes as
|
|
29
|
-
IamTiming as
|
|
28
|
+
IamServerTypes as Ot,
|
|
29
|
+
IamTiming as qt,
|
|
30
30
|
} from "./constants.js";
|
|
31
31
|
export default class ea {
|
|
32
32
|
constructor(t, e, s, i) {
|
|
@@ -38,31 +38,31 @@ export default class ea {
|
|
|
38
38
|
(this.C = e),
|
|
39
39
|
(this.j = s),
|
|
40
40
|
(this.Ss = i),
|
|
41
|
-
(this.
|
|
42
|
-
r.S(this.
|
|
43
|
-
(this.
|
|
44
|
-
(this.
|
|
45
|
-
(this.
|
|
46
|
-
(this.
|
|
47
|
-
(this.
|
|
48
|
-
(this.
|
|
41
|
+
(this.So = new f()),
|
|
42
|
+
r.S(this.So),
|
|
43
|
+
(this.Xo = 1e3),
|
|
44
|
+
(this.Uo = 6e4),
|
|
45
|
+
(this.Vo = null),
|
|
46
|
+
(this.Wo = null),
|
|
47
|
+
(this.Yo = null),
|
|
48
|
+
(this.Zo = {});
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
return this.
|
|
50
|
+
ta() {
|
|
51
|
+
return this.So;
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
return this.
|
|
53
|
+
ia(t) {
|
|
54
|
+
return this.So.Ut(t);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
return this.
|
|
56
|
+
oa() {
|
|
57
|
+
return this.Vo;
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
this.
|
|
59
|
+
la(t) {
|
|
60
|
+
this.Vo = t;
|
|
61
61
|
}
|
|
62
62
|
Dt(t, e, s, i) {
|
|
63
63
|
const r = new L();
|
|
64
64
|
let n;
|
|
65
|
-
if (e === p.
|
|
65
|
+
if (e === p.ua || t instanceof ControlMessage) {
|
|
66
66
|
if (!t.js())
|
|
67
67
|
return (
|
|
68
68
|
b.info(
|
|
@@ -70,14 +70,14 @@ export default class ea {
|
|
|
70
70
|
),
|
|
71
71
|
r
|
|
72
72
|
);
|
|
73
|
-
if (this.
|
|
73
|
+
if (this.ma(t.triggerId))
|
|
74
74
|
return (
|
|
75
75
|
b.info(
|
|
76
76
|
"An impression for this in-app message trigger has already been logged. Ignoring analytics event.",
|
|
77
77
|
),
|
|
78
78
|
r
|
|
79
79
|
);
|
|
80
|
-
} else if (e === p.
|
|
80
|
+
} else if (e === p.pa || (t instanceof HtmlMessage && e === p.ha)) {
|
|
81
81
|
if (!t.Yt(i))
|
|
82
82
|
return (
|
|
83
83
|
b.info(
|
|
@@ -90,7 +90,7 @@ export default class ea {
|
|
|
90
90
|
(n =
|
|
91
91
|
t instanceof ControlMessage
|
|
92
92
|
? { trigger_ids: [t.triggerId] }
|
|
93
|
-
: this.
|
|
93
|
+
: this.ca(t)),
|
|
94
94
|
null == n
|
|
95
95
|
? r
|
|
96
96
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
@@ -98,7 +98,7 @@ export default class ea {
|
|
|
98
98
|
v.Dt(e, n))
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
ga(t, e) {
|
|
102
102
|
const s = new L();
|
|
103
103
|
if (!t.Yt())
|
|
104
104
|
return (
|
|
@@ -107,34 +107,34 @@ export default class ea {
|
|
|
107
107
|
),
|
|
108
108
|
s
|
|
109
109
|
);
|
|
110
|
-
const i = this.
|
|
110
|
+
const i = this.ca(e);
|
|
111
111
|
return null == i
|
|
112
112
|
? s
|
|
113
|
-
: t.id === InAppMessageButton.
|
|
113
|
+
: t.id === InAppMessageButton.fa
|
|
114
114
|
? (b.info(
|
|
115
115
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers.",
|
|
116
116
|
),
|
|
117
117
|
s)
|
|
118
|
-
: (null != t.id && (i.bid = t.id), v.Dt(p.
|
|
118
|
+
: (null != t.id && (i.bid = t.id), v.Dt(p.ha, i));
|
|
119
119
|
}
|
|
120
|
-
|
|
120
|
+
da(t) {
|
|
121
121
|
const e = t.messageFields;
|
|
122
122
|
return (null != e && e.is_push_primer) || !1;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
ja(t) {
|
|
125
125
|
if (!(t instanceof InAppMessage)) return;
|
|
126
126
|
const e = (t) => {
|
|
127
127
|
if (!t) return;
|
|
128
|
-
const e =
|
|
129
|
-
if (
|
|
130
|
-
if (
|
|
131
|
-
const t =
|
|
132
|
-
if (!t.
|
|
128
|
+
const e = ro(t);
|
|
129
|
+
if (St(e)) return zt(Rt.ya, "In-App Message");
|
|
130
|
+
if (Dt(e)) {
|
|
131
|
+
const t = _t.va();
|
|
132
|
+
if (!t.ba) return _t.Ia(t.reason, "In-App Message");
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
|
-
if (this.
|
|
136
|
-
const t =
|
|
137
|
-
if (!t.
|
|
135
|
+
if (this.da(t)) {
|
|
136
|
+
const t = _t.va();
|
|
137
|
+
if (!t.ba) return _t.Ia(t.reason, "In-App Message");
|
|
138
138
|
}
|
|
139
139
|
const s = t.buttons || [];
|
|
140
140
|
let i;
|
|
@@ -150,29 +150,29 @@ export default class ea {
|
|
|
150
150
|
? e(t.uri)
|
|
151
151
|
: void 0;
|
|
152
152
|
}
|
|
153
|
-
|
|
154
|
-
e !== this.
|
|
153
|
+
Aa(t, e) {
|
|
154
|
+
e !== this.Yo && this.Ma(), (this.Wo = t), (this.Yo = e);
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
null != this.
|
|
158
|
-
(clearTimeout(this.
|
|
156
|
+
Ma() {
|
|
157
|
+
null != this.Wo &&
|
|
158
|
+
(clearTimeout(this.Wo), (this.Wo = null), (this.Yo = null));
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
Ta(t, e, s, i) {
|
|
161
161
|
const r = this.B;
|
|
162
162
|
if (!r) return;
|
|
163
|
-
this.
|
|
164
|
-
const n = r.
|
|
163
|
+
this.Yo && t.triggerId !== this.Yo && (this.Ma(), h.Ji(this.j, h.it.Da));
|
|
164
|
+
const n = r.ka(!1),
|
|
165
165
|
o = r.Z(n);
|
|
166
166
|
(o.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
167
|
-
null != s && (o.template.data = s.
|
|
168
|
-
const u = r.tt(o, h.it.
|
|
167
|
+
null != s && (o.template.data = s.wa());
|
|
168
|
+
const u = r.tt(o, h.it.Da);
|
|
169
169
|
r.et(
|
|
170
170
|
o,
|
|
171
171
|
(r = -1) => {
|
|
172
172
|
const n = this.B;
|
|
173
173
|
if (!n) return;
|
|
174
174
|
const m = new Date().valueOf();
|
|
175
|
-
h.nt(this.j, h.it.
|
|
175
|
+
h.nt(this.j, h.it.Da, m),
|
|
176
176
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
177
177
|
let p,
|
|
178
178
|
c,
|
|
@@ -183,16 +183,16 @@ export default class ea {
|
|
|
183
183
|
headers: u,
|
|
184
184
|
lt: (e) => {
|
|
185
185
|
if (!n.ut(o, e, u))
|
|
186
|
-
return void ("function" == typeof t.
|
|
186
|
+
return void ("function" == typeof t.Sa && t.Sa());
|
|
187
187
|
if ((n.ct(), null == e || null == e.templated_message)) return;
|
|
188
188
|
const s = e.templated_message;
|
|
189
|
-
if (s.type !==
|
|
190
|
-
const i =
|
|
189
|
+
if (s.type !== Tt.Ba.za) return;
|
|
190
|
+
const i = It(s.data);
|
|
191
191
|
if (null == i) return;
|
|
192
|
-
const r = this.
|
|
192
|
+
const r = this.ja(i);
|
|
193
193
|
if (r)
|
|
194
|
-
return b.error(r), void ("function" == typeof t.
|
|
195
|
-
"function" == typeof t.
|
|
194
|
+
return b.error(r), void ("function" == typeof t.Sa && t.Sa());
|
|
195
|
+
"function" == typeof t.Ra && t.Ra(i);
|
|
196
196
|
},
|
|
197
197
|
error: (e) => {
|
|
198
198
|
(g = !0),
|
|
@@ -200,21 +200,21 @@ export default class ea {
|
|
|
200
200
|
(c = `getting user personalization for message ${t.triggerId}.`);
|
|
201
201
|
},
|
|
202
202
|
ft: (r, o) => {
|
|
203
|
-
if (new Date().valueOf() - t.
|
|
203
|
+
if (new Date().valueOf() - t._a < t.qa) {
|
|
204
204
|
let r = 0;
|
|
205
205
|
if (g) {
|
|
206
|
-
const e = Math.min(t.
|
|
207
|
-
s = this.
|
|
206
|
+
const e = Math.min(t.qa, this.Uo),
|
|
207
|
+
s = this.Xo;
|
|
208
208
|
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
209
209
|
}
|
|
210
210
|
n.yt(
|
|
211
211
|
o,
|
|
212
212
|
() => {
|
|
213
|
-
this.
|
|
213
|
+
this.Ta(t, e, s, r);
|
|
214
214
|
},
|
|
215
|
-
h.it.
|
|
216
|
-
(e) => this.
|
|
217
|
-
() => this.
|
|
215
|
+
h.it.Da,
|
|
216
|
+
(e) => this.Aa(e, t.triggerId),
|
|
217
|
+
() => this.Ma(),
|
|
218
218
|
r,
|
|
219
219
|
);
|
|
220
220
|
}
|
|
@@ -222,19 +222,19 @@ export default class ea {
|
|
|
222
222
|
},
|
|
223
223
|
});
|
|
224
224
|
},
|
|
225
|
-
h.it.
|
|
225
|
+
h.it.Da,
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
ma(t) {
|
|
229
229
|
if (null == t || "" === t) return !1;
|
|
230
230
|
const e = new Date().valueOf(),
|
|
231
|
-
s = this.
|
|
232
|
-
return (null != s && e - s <
|
|
231
|
+
s = this.Zo[t];
|
|
232
|
+
return (null != s && e - s < qt.aE) || ((this.Zo[t] = e), !1);
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
this.
|
|
234
|
+
xa() {
|
|
235
|
+
this.Zo = {};
|
|
236
236
|
}
|
|
237
|
-
|
|
237
|
+
ca(t) {
|
|
238
238
|
if (null == t.triggerId)
|
|
239
239
|
return (
|
|
240
240
|
b.info(
|
|
@@ -245,40 +245,40 @@ export default class ea {
|
|
|
245
245
|
const e = {};
|
|
246
246
|
return null != t.triggerId && (e.trigger_ids = [t.triggerId]), e;
|
|
247
247
|
}
|
|
248
|
-
|
|
248
|
+
Mo(t) {
|
|
249
249
|
return (
|
|
250
250
|
!!this.j &&
|
|
251
251
|
!(
|
|
252
252
|
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
253
253
|
t instanceof ControlMessage
|
|
254
254
|
) &&
|
|
255
|
-
this.j.Pt(s.It.
|
|
255
|
+
this.j.Pt(s.It.Pa, t.qt())
|
|
256
256
|
);
|
|
257
257
|
}
|
|
258
258
|
sa() {
|
|
259
259
|
if (!this.j) return null;
|
|
260
|
-
const t = this.j.St(s.It.
|
|
260
|
+
const t = this.j.St(s.It.Pa);
|
|
261
261
|
if (!t) return null;
|
|
262
262
|
let e;
|
|
263
263
|
switch (t.type) {
|
|
264
|
-
case
|
|
265
|
-
e = FullScreenMessage.
|
|
264
|
+
case Ot.oE:
|
|
265
|
+
e = FullScreenMessage.Ea(t);
|
|
266
266
|
break;
|
|
267
|
-
case
|
|
268
|
-
case
|
|
269
|
-
case
|
|
270
|
-
e = HtmlMessage.
|
|
267
|
+
case Ot.ME:
|
|
268
|
+
case Ot.CE:
|
|
269
|
+
case Ot.DE:
|
|
270
|
+
e = HtmlMessage.Ea(t);
|
|
271
271
|
break;
|
|
272
|
-
case
|
|
273
|
-
case
|
|
274
|
-
e = ModalMessage.
|
|
272
|
+
case Ot.tE:
|
|
273
|
+
case Ot.eE:
|
|
274
|
+
e = ModalMessage.Ea(t);
|
|
275
275
|
break;
|
|
276
|
-
case
|
|
277
|
-
e = SlideUpMessage.
|
|
276
|
+
case Ot.RE:
|
|
277
|
+
e = SlideUpMessage.Ea(t);
|
|
278
278
|
}
|
|
279
|
-
return e && this.
|
|
279
|
+
return e && this.Ga(), e;
|
|
280
280
|
}
|
|
281
|
-
|
|
282
|
-
this.j && this.j.Vt(s.It.
|
|
281
|
+
Ga() {
|
|
282
|
+
this.j && this.j.Vt(s.It.Pa);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
|
-
import { IamStrings as
|
|
2
|
+
import { IamStrings as pr } from "./constants.js";
|
|
3
3
|
import InAppMessage from "./models/in-app-message.js";
|
|
4
4
|
import InAppMessageButton from "./models/in-app-message-button.js";
|
|
5
5
|
import se from "./in-app-message-manager-factory.js";
|
|
6
6
|
import { logger as b } from "../../shared-lib/index.js";
|
|
7
|
-
import
|
|
8
|
-
import { TriggersProviderFactory as
|
|
7
|
+
import gt from "../triggers/models/trigger-events.js";
|
|
8
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
9
9
|
export function logInAppMessageButtonClick(t, o) {
|
|
10
10
|
var e;
|
|
11
11
|
if (!r.rr()) return !1;
|
|
12
12
|
if (!(t instanceof InAppMessageButton))
|
|
13
13
|
return b.error("button must be an InAppMessageButton object"), !1;
|
|
14
|
-
if (!(o instanceof InAppMessage)) return b.error(
|
|
15
|
-
const s = se.ra().
|
|
14
|
+
if (!(o instanceof InAppMessage)) return b.error(pr.EE), !1;
|
|
15
|
+
const s = se.ra().ga(t, o);
|
|
16
16
|
if (s.lt)
|
|
17
|
-
for (let r = 0; r < s.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
for (let r = 0; r < s.Ne.length; r++)
|
|
18
|
+
ft.o().Pe(
|
|
19
|
+
gt.rm,
|
|
20
20
|
[
|
|
21
21
|
o.triggerId,
|
|
22
22
|
null === (e = t.id) || void 0 === e ? void 0 : e.toString(),
|
|
23
23
|
],
|
|
24
|
-
s.
|
|
24
|
+
s.Ne[r],
|
|
25
25
|
);
|
|
26
26
|
return s.lt;
|
|
27
27
|
}
|
|
@@ -2,18 +2,18 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import InAppMessage from "./models/in-app-message.js";
|
|
3
3
|
import se from "./in-app-message-manager-factory.js";
|
|
4
4
|
import { logInAppMessageImpression } from "./log-in-app-message-impression.js";
|
|
5
|
-
import { IamStrings as
|
|
5
|
+
import { IamStrings as pr } from "./constants.js";
|
|
6
6
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
7
|
-
import
|
|
8
|
-
import { TriggersProviderFactory as
|
|
7
|
+
import gt from "../triggers/models/trigger-events.js";
|
|
8
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
9
9
|
export function logInAppMessageClick(s) {
|
|
10
10
|
if (!r.rr()) return !1;
|
|
11
|
-
if (!(s instanceof InAppMessage)) return b.error(
|
|
12
|
-
const e = se.ra().Dt(s, p.
|
|
11
|
+
if (!(s instanceof InAppMessage)) return b.error(pr.EE), !1;
|
|
12
|
+
const e = se.ra().Dt(s, p.pa);
|
|
13
13
|
if (e) {
|
|
14
14
|
s.sm() || logInAppMessageImpression(s);
|
|
15
|
-
for (let r = 0; r < e.
|
|
16
|
-
|
|
15
|
+
for (let r = 0; r < e.Ne.length; r++)
|
|
16
|
+
ft.o().Pe(gt.rm, [s.triggerId], e.Ne[r]);
|
|
17
17
|
}
|
|
18
18
|
return e.lt;
|
|
19
19
|
}
|
|
@@ -2,8 +2,8 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import HtmlMessage from "./models/html-message.js";
|
|
3
3
|
import se from "./in-app-message-manager-factory.js";
|
|
4
4
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
5
|
-
import
|
|
6
|
-
import { TriggersProviderFactory as
|
|
5
|
+
import gt from "../triggers/models/trigger-events.js";
|
|
6
|
+
import { TriggersProviderFactory as ft } from "../triggers/triggers-provider-factory.js";
|
|
7
7
|
export function logInAppMessageHtmlClick(e, t, s) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
9
|
if (!(e instanceof HtmlMessage))
|
|
@@ -13,11 +13,11 @@ export function logInAppMessageHtmlClick(e, t, s) {
|
|
|
13
13
|
),
|
|
14
14
|
!1
|
|
15
15
|
);
|
|
16
|
-
let o = p.
|
|
17
|
-
null != t && (o = p.
|
|
16
|
+
let o = p.pa;
|
|
17
|
+
null != t && (o = p.ha);
|
|
18
18
|
const m = se.ra().Dt(e, o, t, s);
|
|
19
19
|
if (m.lt)
|
|
20
|
-
for (let r = 0; r < m.
|
|
21
|
-
|
|
20
|
+
for (let r = 0; r < m.Ne.length; r++)
|
|
21
|
+
ft.o().Pe(gt.rm, [e.triggerId, t], m.Ne[r]);
|
|
22
22
|
return m.lt;
|
|
23
23
|
}
|
|
@@ -2,12 +2,12 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import ControlMessage from "./models/control-message.js";
|
|
3
3
|
import InAppMessage from "./models/in-app-message.js";
|
|
4
4
|
import se from "./in-app-message-manager-factory.js";
|
|
5
|
-
import { IamStrings as
|
|
5
|
+
import { IamStrings as pr } from "./constants.js";
|
|
6
6
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
7
7
|
export function logInAppMessageImpression(s) {
|
|
8
8
|
if (!r.rr()) return !1;
|
|
9
9
|
if (!(s instanceof InAppMessage || s instanceof ControlMessage))
|
|
10
|
-
return b.error(
|
|
11
|
-
const o = s instanceof ControlMessage ? p.om : p.
|
|
10
|
+
return b.error(pr.EE), !1;
|
|
11
|
+
const o = s instanceof ControlMessage ? p.om : p.ua;
|
|
12
12
|
return se.ra().Dt(s, o).lt;
|
|
13
13
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IamCropType as de,
|
|
3
|
-
IamDismissType as
|
|
3
|
+
IamDismissType as cr,
|
|
4
4
|
IamOrientation as be,
|
|
5
|
-
IamSerializationKeys as
|
|
6
|
-
IamServerTypes as
|
|
5
|
+
IamSerializationKeys as jr,
|
|
6
|
+
IamServerTypes as Ot,
|
|
7
7
|
IamTextAlignment as pe,
|
|
8
8
|
} from "../constants.js";
|
|
9
|
-
import { buttonsFromSerializedInAppMessage as
|
|
9
|
+
import { buttonsFromSerializedInAppMessage as gr } from "../in-app-message-factory.js";
|
|
10
10
|
import InAppMessage from "./in-app-message.js";
|
|
11
11
|
export default class FullScreenMessage extends InAppMessage {
|
|
12
12
|
constructor(
|
|
@@ -42,7 +42,7 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
42
42
|
C,
|
|
43
43
|
D,
|
|
44
44
|
) {
|
|
45
|
-
(p = p ||
|
|
45
|
+
(p = p || cr.MANUAL),
|
|
46
46
|
(k = k || be.PORTRAIT),
|
|
47
47
|
super(
|
|
48
48
|
r,
|
|
@@ -78,44 +78,44 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
78
78
|
C,
|
|
79
79
|
D,
|
|
80
80
|
),
|
|
81
|
-
(this.
|
|
81
|
+
(this.Ao = pe.CENTER);
|
|
82
82
|
}
|
|
83
83
|
qt() {
|
|
84
|
-
return super.qt(
|
|
84
|
+
return super.qt(Ot.oE);
|
|
85
85
|
}
|
|
86
|
-
static
|
|
86
|
+
static Ea(r) {
|
|
87
87
|
return new FullScreenMessage(
|
|
88
|
-
r[
|
|
89
|
-
r[
|
|
90
|
-
r[
|
|
91
|
-
r[
|
|
92
|
-
r[
|
|
93
|
-
r[
|
|
94
|
-
r[
|
|
95
|
-
r[
|
|
96
|
-
r[
|
|
97
|
-
r[
|
|
98
|
-
r[
|
|
99
|
-
r[
|
|
100
|
-
r[
|
|
101
|
-
r[
|
|
102
|
-
r[
|
|
103
|
-
r[
|
|
104
|
-
r[
|
|
105
|
-
r[
|
|
106
|
-
r[
|
|
107
|
-
r[
|
|
108
|
-
r[
|
|
109
|
-
r[
|
|
110
|
-
r[
|
|
111
|
-
|
|
112
|
-
r[
|
|
113
|
-
r[
|
|
114
|
-
r[
|
|
115
|
-
r[
|
|
116
|
-
r[
|
|
117
|
-
r[
|
|
118
|
-
r[
|
|
88
|
+
r[jr.UE],
|
|
89
|
+
r[jr.cE],
|
|
90
|
+
r[jr.Is],
|
|
91
|
+
r[jr.PE],
|
|
92
|
+
r[jr.iE],
|
|
93
|
+
r[jr.URI],
|
|
94
|
+
r[jr.pE],
|
|
95
|
+
r[jr.rE],
|
|
96
|
+
r[jr.mE],
|
|
97
|
+
r[jr.GE],
|
|
98
|
+
r[jr.Bs],
|
|
99
|
+
r[jr.xE],
|
|
100
|
+
r[jr.HE],
|
|
101
|
+
r[jr.FE],
|
|
102
|
+
r[jr.BE],
|
|
103
|
+
r[jr.bE],
|
|
104
|
+
r[jr.gE],
|
|
105
|
+
r[jr.lE],
|
|
106
|
+
r[jr.YE],
|
|
107
|
+
r[jr.hE],
|
|
108
|
+
r[jr.KE],
|
|
109
|
+
r[jr.WE],
|
|
110
|
+
r[jr.XE],
|
|
111
|
+
gr(r[jr.yE]),
|
|
112
|
+
r[jr.dE],
|
|
113
|
+
r[jr.uE],
|
|
114
|
+
r[jr.fE],
|
|
115
|
+
r[jr.CSS],
|
|
116
|
+
r[jr.jE],
|
|
117
|
+
r[jr.LANGUAGE],
|
|
118
|
+
r[jr.Ns],
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
121
|
}
|