@braze/web-sdk 6.10.2 → 6.12.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 +61 -6
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +3 -3
- package/shared-lib/event-types.js +12 -12
- package/shared-lib/indexed-db-adapter.js +52 -52
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +10 -10
- package/src/Core/logout.js +2 -2
- package/src/DUST/dust-config-store.js +89 -0
- package/src/DUST/dust-connection-core.js +7 -21
- package/src/DUST/dust-message-dedup.js +33 -0
- package/src/DUST/dust-provider.js +367 -397
- package/src/DUST/dust-tab-identity.js +30 -0
- package/src/DUST/index.js +7 -9
- package/src/DUST/subscribe-to-dust.js +5 -5
- package/src/FeatureFlags/feature-flag-factory.js +4 -4
- package/src/FeatureFlags/feature-flag.js +5 -5
- package/src/FeatureFlags/feature-flags-provider-factory.js +8 -1
- package/src/FeatureFlags/feature-flags-provider.js +74 -74
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +3 -3
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/InAppMessage/constants.js +39 -47
- package/src/InAppMessage/defer-in-app-message.js +2 -2
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +4 -4
- package/src/InAppMessage/display/html-message-to-html.js +10 -10
- package/src/InAppMessage/display/in-app-message-to-html.js +68 -66
- package/src/InAppMessage/display/modal-utils.js +14 -14
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager-factory.js +5 -5
- package/src/InAppMessage/in-app-message-manager.js +101 -80
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +25 -25
- package/src/InAppMessage/models/html-message.js +14 -14
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +100 -98
- package/src/InAppMessage/models/modal-message.js +23 -23
- package/src/InAppMessage/models/slide-up-message.js +29 -29
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +2 -2
- package/src/InAppMessage/ui/show-in-app-message.js +42 -40
- package/src/Push/index.js +1 -0
- 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 +6 -6
- package/src/Push/push-manager.js +228 -185
- package/src/Push/register-push.js +9 -0
- package/src/Push/unregister-push-token-on-server.js +4 -4
- package/src/Push/utils/push-utils.js +16 -16
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +36 -36
- package/src/common/constants.js +1 -1
- package/src/common/content-cards-display.js +21 -21
- package/src/common/event-logger.js +2 -2
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/l10n/l10n-manager.js +5 -5
- package/src/managers/auth-manager.js +1 -1
- package/src/managers/braze-instance.js +70 -66
- package/src/managers/device-manager.js +12 -12
- package/src/managers/network-manager.js +118 -118
- package/src/managers/server-config-manager.js +84 -84
- package/src/managers/session-manager.js +10 -10
- package/src/managers/storage-manager-factory.js +4 -4
- package/src/managers/storage-manager.js +138 -136
- package/src/managers/subscription-manager.js +1 -1
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +6 -6
- package/src/models/push-token.js +6 -6
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +91 -91
- package/src/triggers/models/filter.js +58 -58
- package/src/triggers/models/in-app-message-click-data.js +4 -4
- package/src/triggers/models/push-click-data.js +2 -2
- package/src/triggers/models/trigger-condition.js +35 -35
- package/src/triggers/models/trigger.js +37 -37
- package/src/triggers/triggers-provider-factory.js +3 -3
- package/src/triggers/triggers-provider.js +61 -53
- package/src/types.js +1 -1
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +4 -4
- package/src/util/component-utils.js +4 -4
- package/src/util/dom-utils.js +5 -5
- package/src/util/ecommerce-event-validation.js +77 -48
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +20 -20
- package/src/util/string-utils.js +5 -0
- package/src/util/user-agent-parser.js +15 -15
- package/src/util/validation-utils.js +9 -9
- package/src/util/window-utils.js +2 -2
- package/src/DUST/dust-shared-worker-code.js +0 -2
- package/src/DUST/dust-shared-worker-impl.js +0 -234
- package/src/DUST/dust-worker-bridge.js +0 -151
|
@@ -5,25 +5,29 @@ 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 yt } 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 vt 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
|
|
16
|
+
containsPushPrimerBrazeAction as It,
|
|
17
|
+
containsUnknownBrazeAction as At,
|
|
18
18
|
getDecodedBrazeAction as eo,
|
|
19
|
-
ineligibleBrazeActionURLErrorMessage as
|
|
20
|
-
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as
|
|
19
|
+
ineligibleBrazeActionURLErrorMessage as Mt,
|
|
20
|
+
INELIGIBLE_BRAZE_ACTION_URL_ERROR_TYPES as Tt,
|
|
21
21
|
} from "../util/braze-actions.js";
|
|
22
|
-
import
|
|
22
|
+
import Dt 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
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
IamClickAction as ce,
|
|
28
|
+
IamServerTypes as gt,
|
|
29
|
+
IamTiming as kt,
|
|
30
|
+
} from "./constants.js";
|
|
27
31
|
export default class ea {
|
|
28
32
|
constructor(t, e, s, i) {
|
|
29
33
|
(this.B = t),
|
|
@@ -36,11 +40,12 @@ export default class ea {
|
|
|
36
40
|
(this.Ss = i),
|
|
37
41
|
(this.In = new f()),
|
|
38
42
|
r.S(this.In),
|
|
39
|
-
(this.
|
|
43
|
+
(this.Tn = 1e3),
|
|
40
44
|
(this.Dn = 6e4),
|
|
45
|
+
(this.zn = null),
|
|
46
|
+
(this.Bn = null),
|
|
41
47
|
(this._n = null),
|
|
42
|
-
(this.qn =
|
|
43
|
-
(this.xn = null);
|
|
48
|
+
(this.qn = {});
|
|
44
49
|
}
|
|
45
50
|
Pn() {
|
|
46
51
|
return this.In;
|
|
@@ -49,15 +54,15 @@ export default class ea {
|
|
|
49
54
|
return this.In.Ut(t);
|
|
50
55
|
}
|
|
51
56
|
Gn() {
|
|
52
|
-
return this.
|
|
57
|
+
return this.zn;
|
|
53
58
|
}
|
|
54
59
|
Nn(t) {
|
|
55
|
-
this.
|
|
60
|
+
this.zn = t;
|
|
56
61
|
}
|
|
57
62
|
Dt(t, e, s, i) {
|
|
58
63
|
const r = new L();
|
|
59
64
|
let n;
|
|
60
|
-
if (e === p.
|
|
65
|
+
if (e === p.On || t instanceof ControlMessage) {
|
|
61
66
|
if (!t.js())
|
|
62
67
|
return (
|
|
63
68
|
b.info(
|
|
@@ -65,7 +70,14 @@ export default class ea {
|
|
|
65
70
|
),
|
|
66
71
|
r
|
|
67
72
|
);
|
|
68
|
-
|
|
73
|
+
if (this.Xn(t.triggerId))
|
|
74
|
+
return (
|
|
75
|
+
b.info(
|
|
76
|
+
"An impression for this in-app message trigger has already been logged. Ignoring analytics event.",
|
|
77
|
+
),
|
|
78
|
+
r
|
|
79
|
+
);
|
|
80
|
+
} else if (e === p.Hn || (t instanceof HtmlMessage && e === p.Jn)) {
|
|
69
81
|
if (!t.Yt(i))
|
|
70
82
|
return (
|
|
71
83
|
b.info(
|
|
@@ -78,7 +90,7 @@ export default class ea {
|
|
|
78
90
|
(n =
|
|
79
91
|
t instanceof ControlMessage
|
|
80
92
|
? { trigger_ids: [t.triggerId] }
|
|
81
|
-
: this.
|
|
93
|
+
: this.Kn(t)),
|
|
82
94
|
null == n
|
|
83
95
|
? r
|
|
84
96
|
: (t.messageExtras && (n.message_extras = t.messageExtras),
|
|
@@ -86,7 +98,7 @@ export default class ea {
|
|
|
86
98
|
v.Dt(e, n))
|
|
87
99
|
);
|
|
88
100
|
}
|
|
89
|
-
|
|
101
|
+
Ln(t, e) {
|
|
90
102
|
const s = new L();
|
|
91
103
|
if (!t.Yt())
|
|
92
104
|
return (
|
|
@@ -95,125 +107,134 @@ export default class ea {
|
|
|
95
107
|
),
|
|
96
108
|
s
|
|
97
109
|
);
|
|
98
|
-
const i = this.
|
|
110
|
+
const i = this.Kn(e);
|
|
99
111
|
return null == i
|
|
100
112
|
? s
|
|
101
|
-
: t.id === InAppMessageButton.
|
|
113
|
+
: t.id === InAppMessageButton.Qn
|
|
102
114
|
? (b.info(
|
|
103
115
|
"This in-app message button does not have a tracking id. Not logging event to Braze servers.",
|
|
104
116
|
),
|
|
105
117
|
s)
|
|
106
|
-
: (null != t.id && (i.bid = t.id), v.Dt(p.
|
|
118
|
+
: (null != t.id && (i.bid = t.id), v.Dt(p.Jn, i));
|
|
107
119
|
}
|
|
108
|
-
|
|
120
|
+
Un(t) {
|
|
109
121
|
const e = t.messageFields;
|
|
110
122
|
return (null != e && e.is_push_primer) || !1;
|
|
111
123
|
}
|
|
112
|
-
|
|
124
|
+
Vn(t) {
|
|
113
125
|
if (!(t instanceof InAppMessage)) return;
|
|
114
126
|
const e = (t) => {
|
|
115
127
|
if (!t) return;
|
|
116
128
|
const e = eo(t);
|
|
117
|
-
if (
|
|
118
|
-
if (
|
|
119
|
-
const t =
|
|
120
|
-
if (!t.
|
|
129
|
+
if (At(e)) return Mt(Tt.Wn, "In-App Message");
|
|
130
|
+
if (It(e)) {
|
|
131
|
+
const t = Dt.Yn();
|
|
132
|
+
if (!t.Zn) return Dt.So(t.reason, "In-App Message");
|
|
121
133
|
}
|
|
122
134
|
};
|
|
123
|
-
if (this.
|
|
124
|
-
const t =
|
|
125
|
-
if (!t.
|
|
135
|
+
if (this.Un(t)) {
|
|
136
|
+
const t = Dt.Yn();
|
|
137
|
+
if (!t.Zn) return Dt.So(t.reason, "In-App Message");
|
|
126
138
|
}
|
|
127
139
|
const s = t.buttons || [];
|
|
128
140
|
let i;
|
|
129
141
|
for (const t of s)
|
|
130
142
|
if (
|
|
131
|
-
t.clickAction ===
|
|
143
|
+
t.clickAction === ce.URI &&
|
|
132
144
|
t.uri &&
|
|
133
145
|
to.test(t.uri) &&
|
|
134
146
|
((i = e(t.uri)), i)
|
|
135
147
|
)
|
|
136
148
|
return i;
|
|
137
|
-
return t.clickAction ===
|
|
149
|
+
return t.clickAction === ce.URI && t.uri && to.test(t.uri)
|
|
138
150
|
? e(t.uri)
|
|
139
151
|
: void 0;
|
|
140
152
|
}
|
|
141
|
-
|
|
142
|
-
e !== this.
|
|
153
|
+
Ro(t, e) {
|
|
154
|
+
e !== this._n && this._o(), (this.Bn = t), (this._n = e);
|
|
143
155
|
}
|
|
144
156
|
_o() {
|
|
145
|
-
null != this.
|
|
146
|
-
(clearTimeout(this.
|
|
157
|
+
null != this.Bn &&
|
|
158
|
+
(clearTimeout(this.Bn), (this.Bn = null), (this._n = null));
|
|
147
159
|
}
|
|
148
|
-
|
|
160
|
+
Po(t, e, s, i) {
|
|
149
161
|
const r = this.B;
|
|
150
162
|
if (!r) return;
|
|
151
|
-
this.
|
|
152
|
-
const n = r.
|
|
163
|
+
this._n && t.triggerId !== this._n && (this._o(), h.Ji(this.j, h.it.Xo));
|
|
164
|
+
const n = r.Qo(!1),
|
|
153
165
|
o = r.Z(n);
|
|
154
166
|
(o.template = { trigger_id: t.triggerId, trigger_event_type: e }),
|
|
155
|
-
null != s && (o.template.data = s.
|
|
156
|
-
const u = r.tt(o, h.it.
|
|
167
|
+
null != s && (o.template.data = s.Uo());
|
|
168
|
+
const u = r.tt(o, h.it.Xo);
|
|
157
169
|
r.et(
|
|
158
170
|
o,
|
|
159
171
|
(r = -1) => {
|
|
160
172
|
const n = this.B;
|
|
161
173
|
if (!n) return;
|
|
162
174
|
const m = new Date().valueOf();
|
|
163
|
-
h.nt(this.j, h.it.
|
|
175
|
+
h.nt(this.j, h.it.Xo, m),
|
|
164
176
|
-1 !== r && u.push(["X-Braze-Req-Tokens-Remaining", r.toString()]);
|
|
165
|
-
let
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
let p,
|
|
178
|
+
c,
|
|
179
|
+
g = !1;
|
|
168
180
|
l.ot({
|
|
169
181
|
url: `${n.ht()}/template/`,
|
|
170
182
|
data: o,
|
|
171
183
|
headers: u,
|
|
172
184
|
lt: (e) => {
|
|
173
185
|
if (!n.ut(o, e, u))
|
|
174
|
-
return void ("function" == typeof t.
|
|
186
|
+
return void ("function" == typeof t.Vo && t.Vo());
|
|
175
187
|
if ((n.ct(), null == e || null == e.templated_message)) return;
|
|
176
188
|
const s = e.templated_message;
|
|
177
|
-
if (s.type !==
|
|
178
|
-
const i =
|
|
189
|
+
if (s.type !== vt.Yo.Wo) return;
|
|
190
|
+
const i = yt(s.data);
|
|
179
191
|
if (null == i) return;
|
|
180
|
-
const r = this.
|
|
192
|
+
const r = this.Vn(i);
|
|
181
193
|
if (r)
|
|
182
|
-
return b.error(r), void ("function" == typeof t.
|
|
183
|
-
"function" == typeof t.
|
|
194
|
+
return b.error(r), void ("function" == typeof t.Vo && t.Vo());
|
|
195
|
+
"function" == typeof t.Zo && t.Zo(i);
|
|
184
196
|
},
|
|
185
197
|
error: (e) => {
|
|
186
|
-
(
|
|
187
|
-
(
|
|
188
|
-
(
|
|
198
|
+
(g = !0),
|
|
199
|
+
(p = e),
|
|
200
|
+
(c = `getting user personalization for message ${t.triggerId}.`);
|
|
189
201
|
},
|
|
190
202
|
ft: (r, o) => {
|
|
191
|
-
if (new Date().valueOf() - t.
|
|
203
|
+
if (new Date().valueOf() - t.ta < t.ia) {
|
|
192
204
|
let r = 0;
|
|
193
|
-
if (
|
|
194
|
-
const e = Math.min(t.
|
|
195
|
-
s = this.
|
|
205
|
+
if (g) {
|
|
206
|
+
const e = Math.min(t.ia, this.Dn),
|
|
207
|
+
s = this.Tn;
|
|
196
208
|
null == i && (i = s), (r = Math.min(e, a(s, 3 * i)));
|
|
197
209
|
}
|
|
198
210
|
n.yt(
|
|
199
211
|
o,
|
|
200
212
|
() => {
|
|
201
|
-
this.
|
|
213
|
+
this.Po(t, e, s, r);
|
|
202
214
|
},
|
|
203
|
-
h.it.
|
|
204
|
-
(e) => this.
|
|
215
|
+
h.it.Xo,
|
|
216
|
+
(e) => this.Ro(e, t.triggerId),
|
|
205
217
|
() => this._o(),
|
|
206
218
|
r,
|
|
207
219
|
);
|
|
208
220
|
}
|
|
209
|
-
|
|
221
|
+
g && n.dt(p, c);
|
|
210
222
|
},
|
|
211
223
|
});
|
|
212
224
|
},
|
|
213
|
-
h.it.
|
|
225
|
+
h.it.Xo,
|
|
214
226
|
);
|
|
215
227
|
}
|
|
216
|
-
|
|
228
|
+
Xn(t) {
|
|
229
|
+
if (null == t || "" === t) return !1;
|
|
230
|
+
const e = new Date().valueOf(),
|
|
231
|
+
s = this.qn[t];
|
|
232
|
+
return (null != s && e - s < kt.aE) || ((this.qn[t] = e), !1);
|
|
233
|
+
}
|
|
234
|
+
oa() {
|
|
235
|
+
this.qn = {};
|
|
236
|
+
}
|
|
237
|
+
Kn(t) {
|
|
217
238
|
if (null == t.triggerId)
|
|
218
239
|
return (
|
|
219
240
|
b.info(
|
|
@@ -224,40 +245,40 @@ export default class ea {
|
|
|
224
245
|
const e = {};
|
|
225
246
|
return null != t.triggerId && (e.trigger_ids = [t.triggerId]), e;
|
|
226
247
|
}
|
|
227
|
-
|
|
248
|
+
An(t) {
|
|
228
249
|
return (
|
|
229
250
|
!!this.j &&
|
|
230
251
|
!(
|
|
231
252
|
!(t && t instanceof InAppMessage && t.constructor !== InAppMessage) ||
|
|
232
253
|
t instanceof ControlMessage
|
|
233
254
|
) &&
|
|
234
|
-
this.j.Pt(s.It.
|
|
255
|
+
this.j.Pt(s.It.la, t.qt())
|
|
235
256
|
);
|
|
236
257
|
}
|
|
237
258
|
sa() {
|
|
238
259
|
if (!this.j) return null;
|
|
239
|
-
const t = this.j.St(s.It.
|
|
260
|
+
const t = this.j.St(s.It.la);
|
|
240
261
|
if (!t) return null;
|
|
241
262
|
let e;
|
|
242
263
|
switch (t.type) {
|
|
243
|
-
case
|
|
244
|
-
e = FullScreenMessage.
|
|
264
|
+
case gt.oE:
|
|
265
|
+
e = FullScreenMessage.ua(t);
|
|
245
266
|
break;
|
|
246
|
-
case
|
|
247
|
-
case
|
|
248
|
-
case
|
|
249
|
-
e = HtmlMessage.
|
|
267
|
+
case gt.ME:
|
|
268
|
+
case gt.CE:
|
|
269
|
+
case gt.DE:
|
|
270
|
+
e = HtmlMessage.ua(t);
|
|
250
271
|
break;
|
|
251
|
-
case
|
|
252
|
-
case
|
|
253
|
-
e = ModalMessage.
|
|
272
|
+
case gt.tE:
|
|
273
|
+
case gt.eE:
|
|
274
|
+
e = ModalMessage.ua(t);
|
|
254
275
|
break;
|
|
255
|
-
case
|
|
256
|
-
e = SlideUpMessage.
|
|
276
|
+
case gt.RE:
|
|
277
|
+
e = SlideUpMessage.ua(t);
|
|
257
278
|
}
|
|
258
|
-
return e && this.
|
|
279
|
+
return e && this.ma(), e;
|
|
259
280
|
}
|
|
260
|
-
|
|
261
|
-
this.j && this.j.Vt(s.It.
|
|
281
|
+
ma() {
|
|
282
|
+
this.j && this.j.Vt(s.It.la);
|
|
262
283
|
}
|
|
263
284
|
}
|
|
@@ -2,7 +2,7 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { IamStrings as mr } 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
|
-
import
|
|
5
|
+
import se from "./in-app-message-manager-factory.js";
|
|
6
6
|
import { logger as b } from "../../shared-lib/index.js";
|
|
7
7
|
import ot from "../triggers/models/trigger-events.js";
|
|
8
8
|
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
@@ -12,7 +12,7 @@ export function logInAppMessageButtonClick(t, o) {
|
|
|
12
12
|
if (!(t instanceof InAppMessageButton))
|
|
13
13
|
return b.error("button must be an InAppMessageButton object"), !1;
|
|
14
14
|
if (!(o instanceof InAppMessage)) return b.error(mr.EE), !1;
|
|
15
|
-
const s =
|
|
15
|
+
const s = se.ra().Ln(t, o);
|
|
16
16
|
if (s.lt)
|
|
17
17
|
for (let r = 0; r < s.Ce.length; r++)
|
|
18
18
|
rt.o().Ee(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import InAppMessage from "./models/in-app-message.js";
|
|
3
|
-
import
|
|
3
|
+
import se from "./in-app-message-manager-factory.js";
|
|
4
4
|
import { logInAppMessageImpression } from "./log-in-app-message-impression.js";
|
|
5
5
|
import { IamStrings as mr } from "./constants.js";
|
|
6
6
|
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
@@ -9,7 +9,7 @@ import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-fac
|
|
|
9
9
|
export function logInAppMessageClick(s) {
|
|
10
10
|
if (!r.rr()) return !1;
|
|
11
11
|
if (!(s instanceof InAppMessage)) return b.error(mr.EE), !1;
|
|
12
|
-
const e =
|
|
12
|
+
const e = se.ra().Dt(s, p.Hn);
|
|
13
13
|
if (e) {
|
|
14
14
|
s.sm() || logInAppMessageImpression(s);
|
|
15
15
|
for (let r = 0; r < e.Ce.length; r++)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import HtmlMessage from "./models/html-message.js";
|
|
3
|
-
import
|
|
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
5
|
import ot from "../triggers/models/trigger-events.js";
|
|
6
6
|
import { TriggersProviderFactory as rt } from "../triggers/triggers-provider-factory.js";
|
|
@@ -13,9 +13,9 @@ export function logInAppMessageHtmlClick(e, t, s) {
|
|
|
13
13
|
),
|
|
14
14
|
!1
|
|
15
15
|
);
|
|
16
|
-
let o = p.
|
|
17
|
-
null != t && (o = p.
|
|
18
|
-
const m =
|
|
16
|
+
let o = p.Hn;
|
|
17
|
+
null != t && (o = p.Jn);
|
|
18
|
+
const m = se.ra().Dt(e, o, t, s);
|
|
19
19
|
if (m.lt)
|
|
20
20
|
for (let r = 0; r < m.Ce.length; r++)
|
|
21
21
|
rt.o().Ee(ot.rm, [e.triggerId, t], m.Ce[r]);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
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
|
-
import
|
|
4
|
+
import se from "./in-app-message-manager-factory.js";
|
|
5
5
|
import { IamStrings as mr } 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
10
|
return b.error(mr.EE), !1;
|
|
11
|
-
const o = s instanceof ControlMessage ? p.om : p.
|
|
12
|
-
return
|
|
11
|
+
const o = s instanceof ControlMessage ? p.om : p.On;
|
|
12
|
+
return se.ra().Dt(s, o).lt;
|
|
13
13
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
IamCropType as
|
|
2
|
+
IamCropType as de,
|
|
3
3
|
IamDismissType as pr,
|
|
4
|
-
IamOrientation as
|
|
4
|
+
IamOrientation as be,
|
|
5
5
|
IamSerializationKeys as cr,
|
|
6
|
-
IamServerTypes as
|
|
7
|
-
IamTextAlignment as
|
|
6
|
+
IamServerTypes as gt,
|
|
7
|
+
IamTextAlignment as pe,
|
|
8
8
|
} from "../constants.js";
|
|
9
9
|
import { buttonsFromSerializedInAppMessage as ur } from "../in-app-message-factory.js";
|
|
10
10
|
import InAppMessage from "./in-app-message.js";
|
|
@@ -43,7 +43,7 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
43
43
|
D,
|
|
44
44
|
) {
|
|
45
45
|
(p = p || pr.MANUAL),
|
|
46
|
-
(k = k ||
|
|
46
|
+
(k = k || be.PORTRAIT),
|
|
47
47
|
super(
|
|
48
48
|
r,
|
|
49
49
|
s,
|
|
@@ -70,7 +70,7 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
70
70
|
w,
|
|
71
71
|
y,
|
|
72
72
|
S,
|
|
73
|
-
(b = b ||
|
|
73
|
+
(b = b || de.CENTER_CROP),
|
|
74
74
|
k,
|
|
75
75
|
q,
|
|
76
76
|
A,
|
|
@@ -78,42 +78,42 @@ export default class FullScreenMessage extends InAppMessage {
|
|
|
78
78
|
C,
|
|
79
79
|
D,
|
|
80
80
|
),
|
|
81
|
-
(this.
|
|
81
|
+
(this.qo = pe.CENTER);
|
|
82
82
|
}
|
|
83
83
|
qt() {
|
|
84
|
-
return super.qt(
|
|
84
|
+
return super.qt(gt.oE);
|
|
85
85
|
}
|
|
86
|
-
static
|
|
86
|
+
static ua(r) {
|
|
87
87
|
return new FullScreenMessage(
|
|
88
|
-
r[cr.
|
|
89
|
-
r[cr.
|
|
88
|
+
r[cr.UE],
|
|
89
|
+
r[cr.cE],
|
|
90
90
|
r[cr.Is],
|
|
91
|
-
r[cr.
|
|
92
|
-
r[cr.
|
|
91
|
+
r[cr.PE],
|
|
92
|
+
r[cr.iE],
|
|
93
93
|
r[cr.URI],
|
|
94
|
+
r[cr.pE],
|
|
95
|
+
r[cr.rE],
|
|
96
|
+
r[cr.mE],
|
|
97
|
+
r[cr.GE],
|
|
98
|
+
r[cr.Bs],
|
|
94
99
|
r[cr.xE],
|
|
100
|
+
r[cr.HE],
|
|
101
|
+
r[cr.FE],
|
|
95
102
|
r[cr.BE],
|
|
96
|
-
r[cr.lE],
|
|
97
103
|
r[cr.bE],
|
|
98
|
-
r[cr.Bs],
|
|
99
104
|
r[cr.gE],
|
|
105
|
+
r[cr.lE],
|
|
100
106
|
r[cr.YE],
|
|
107
|
+
r[cr.hE],
|
|
101
108
|
r[cr.KE],
|
|
109
|
+
r[cr.WE],
|
|
102
110
|
r[cr.XE],
|
|
111
|
+
ur(r[cr.yE]),
|
|
103
112
|
r[cr.dE],
|
|
104
|
-
r[cr.hE],
|
|
105
|
-
r[cr.yE],
|
|
106
113
|
r[cr.uE],
|
|
107
|
-
r[cr.WE],
|
|
108
114
|
r[cr.fE],
|
|
109
|
-
r[cr.jE],
|
|
110
|
-
r[cr.kE],
|
|
111
|
-
ur(r[cr.vE]),
|
|
112
|
-
r[cr.wE],
|
|
113
|
-
r[cr.zE],
|
|
114
|
-
r[cr.VE],
|
|
115
115
|
r[cr.CSS],
|
|
116
|
-
r[cr.
|
|
116
|
+
r[cr.jE],
|
|
117
117
|
r[cr.LANGUAGE],
|
|
118
118
|
r[cr.Ns],
|
|
119
119
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IamDismissType as pr,
|
|
3
3
|
IamSerializationKeys as cr,
|
|
4
|
-
IamServerTypes as
|
|
4
|
+
IamServerTypes as gt,
|
|
5
5
|
} from "../constants.js";
|
|
6
6
|
import InAppMessage from "./in-app-message.js";
|
|
7
7
|
export default class HtmlMessage extends InAppMessage {
|
|
@@ -47,30 +47,30 @@ export default class HtmlMessage extends InAppMessage {
|
|
|
47
47
|
return !1;
|
|
48
48
|
}
|
|
49
49
|
Yt(i) {
|
|
50
|
-
if (this.
|
|
50
|
+
if (this.Oo === gt.ME) {
|
|
51
51
|
if (this.rd) return !1;
|
|
52
52
|
this.rd = !0;
|
|
53
53
|
}
|
|
54
54
|
return this.ti.A(i), !0;
|
|
55
55
|
}
|
|
56
56
|
qt() {
|
|
57
|
-
const i = super.qt(
|
|
58
|
-
return (i[cr.
|
|
57
|
+
const i = super.qt(gt.ME);
|
|
58
|
+
return (i[cr.wE] = this.messageFields), i;
|
|
59
59
|
}
|
|
60
|
-
static
|
|
60
|
+
static ua(i) {
|
|
61
61
|
return new HtmlMessage(
|
|
62
|
-
i[cr.
|
|
62
|
+
i[cr.UE],
|
|
63
63
|
i[cr.Is],
|
|
64
|
-
i[cr.
|
|
65
|
-
i[cr.
|
|
64
|
+
i[cr.PE],
|
|
65
|
+
i[cr.rE],
|
|
66
|
+
i[cr.mE],
|
|
66
67
|
i[cr.lE],
|
|
67
|
-
i[cr.
|
|
68
|
-
i[cr.
|
|
69
|
-
i[cr.
|
|
70
|
-
i[cr.VE],
|
|
68
|
+
i[cr.YE],
|
|
69
|
+
i[cr.XE],
|
|
70
|
+
i[cr.fE],
|
|
71
71
|
i[cr.CSS],
|
|
72
|
-
i[cr.
|
|
73
|
-
i[cr.
|
|
72
|
+
i[cr.wE],
|
|
73
|
+
i[cr.jE],
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import f from "../../managers/subscription-manager.js";
|
|
2
|
-
import { IamColors as ss, IamClickAction as
|
|
2
|
+
import { IamColors as ss, IamClickAction as ce } from "../constants.js";
|
|
3
3
|
export default class InAppMessageButton {
|
|
4
4
|
constructor(s, t, i, r, h, e, n) {
|
|
5
5
|
(this.text = s),
|
|
@@ -13,9 +13,9 @@ export default class InAppMessageButton {
|
|
|
13
13
|
(this.backgroundColor = t || ss._E),
|
|
14
14
|
(this.textColor = i || ss.AE),
|
|
15
15
|
(this.borderColor = r || this.backgroundColor),
|
|
16
|
-
(this.clickAction = h ||
|
|
16
|
+
(this.clickAction = h || ce.NONE),
|
|
17
17
|
(this.uri = e),
|
|
18
|
-
null == n && (n = InAppMessageButton.
|
|
18
|
+
null == n && (n = InAppMessageButton.Qn),
|
|
19
19
|
(this.id = n),
|
|
20
20
|
(this.rd = !1),
|
|
21
21
|
(this.ti = new f());
|
|
@@ -44,4 +44,4 @@ export default class InAppMessageButton {
|
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
InAppMessageButton.
|
|
47
|
+
InAppMessageButton.Qn = -1;
|