@braze/web-sdk 6.7.1 → 6.9.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 +165 -38
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +2 -2
- package/shared-lib/event-types.js +16 -16
- package/shared-lib/indexed-db-adapter.js +65 -65
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +1 -1
- package/src/Banner/banner-provider.js +67 -59
- package/src/Banner/banner.js +40 -19
- package/src/Banner/dismiss-banner.js +4 -0
- package/src/Banner/display/banner-to-html.js +10 -10
- package/src/Banner/display/destroy-banner-html.js +2 -2
- package/src/Banner/get-all-banners.js +6 -6
- package/src/Banner/get-banner.js +6 -6
- package/src/Banner/index.js +1 -0
- package/src/Banner/log-banner-click.js +7 -7
- package/src/Banner/log-banner-dismissal.js +7 -7
- package/src/Banner/log-banner-impressions.js +27 -18
- package/src/Banner/request-banners-refresh.js +8 -8
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Banner/ui/insert-banner.js +8 -8
- package/src/Card/card-manager.js +31 -31
- package/src/Card/log-card-dismissal.js +2 -2
- package/src/Card/log-content-card-click.js +2 -2
- package/src/Card/log-content-card-impressions.js +4 -4
- package/src/Card/models/captioned-image.js +15 -15
- package/src/Card/models/card.js +89 -89
- package/src/Card/models/classic-card.js +16 -16
- package/src/Card/models/control-card.js +7 -7
- package/src/Card/models/image-only.js +13 -13
- package/src/Card/util/card-factory.js +32 -32
- package/src/ContentCards/content-cards-provider-factory.js +13 -11
- package/src/ContentCards/content-cards-provider.js +105 -105
- package/src/ContentCards/get-cached-content-cards.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +2 -2
- package/src/ContentCards/subscribe-to-content-cards-updates.js +10 -10
- package/src/ContentCards/ui/show-content-cards.js +7 -7
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +5 -5
- package/src/Core/destroy.js +2 -2
- package/src/Core/disable-sdk.js +4 -4
- package/src/Core/enable-sdk.js +4 -4
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +5 -5
- package/src/Core/index.js +1 -0
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-ecommerce-event.js +29 -0
- package/src/Core/log-purchase.js +23 -198
- package/src/Core/open-session.js +10 -10
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +1 -1
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -1
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +6 -6
- package/src/DUST/dust-connection-core.js +1 -0
- package/src/DUST/dust-provider-factory.js +10 -10
- package/src/DUST/dust-provider.js +258 -226
- package/src/DUST/dust-shared-worker-code.js +1 -1
- package/src/DUST/dust-shared-worker-impl.js +97 -103
- package/src/DUST/dust-worker-bridge.js +55 -40
- package/src/DUST/subscribe-to-dust.js +7 -7
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +3 -3
- package/src/FeatureFlags/feature-flags-provider.js +21 -21
- package/src/FeatureFlags/log-feature-flag-impression.js +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/InAppMessage/constants.js +3 -3
- package/src/InAppMessage/defer-in-app-message.js +3 -3
- package/src/InAppMessage/display/html-message-to-html.js +4 -4
- package/src/InAppMessage/display/in-app-message-to-html.js +32 -32
- package/src/InAppMessage/display/modal-utils.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +36 -36
- package/src/InAppMessage/in-app-message-manager.js +35 -35
- package/src/InAppMessage/log-in-app-message-button-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-html-click.js +3 -3
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +9 -9
- package/src/InAppMessage/models/html-message.js +2 -2
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +34 -34
- package/src/InAppMessage/models/modal-message.js +7 -7
- package/src/InAppMessage/models/slide-up-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +20 -20
- package/src/Push/push-manager.js +44 -44
- package/src/User/user-manager.js +19 -19
- package/src/User/user.js +17 -17
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +1 -0
- package/src/common/content-cards-display.js +6 -6
- package/src/common/event-logger.js +3 -3
- package/src/common/properties-base.js +3 -3
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +11 -11
- package/src/managers/braze-instance.js +59 -59
- package/src/managers/device-manager.js +9 -9
- package/src/managers/network-manager.js +65 -63
- package/src/managers/server-config-manager.js +110 -93
- package/src/managers/session-manager.js +20 -20
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +137 -137
- package/src/managers/subscription-manager.js +2 -2
- package/src/managers/utils.js +1 -1
- package/src/models/braze-event.js +2 -2
- package/src/models/identifier.js +5 -5
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +1 -1
- package/src/models/server-config.js +46 -28
- package/src/request-controller.js +124 -124
- 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 +2 -2
- package/src/triggers/models/filter.js +1 -1
- package/src/triggers/models/in-app-message-click-data.js +5 -5
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +2 -2
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +45 -45
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +30 -30
- package/src/triggers/triggers-provider.js +63 -63
- package/src/types.js +5 -1
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/braze-actions.js +6 -6
- package/src/util/browser-detector.js +13 -13
- package/src/util/client-hints-parser.js +5 -5
- package/src/util/code-utils.js +2 -2
- package/src/util/deprecation-utils.js +2 -2
- package/src/util/dom-utils.js +8 -8
- package/src/util/ecommerce-event-validation.js +343 -0
- package/src/util/html-display-utils.js +11 -11
- package/src/util/iso-4217-currency-codes.js +176 -0
- package/src/util/net.js +4 -4
- package/src/util/request-header-utils.js +10 -10
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +15 -15
- package/src/util/validation-utils.js +14 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger as
|
|
1
|
+
import { logger as b } from "../../shared-lib/index.js";
|
|
2
2
|
import t from "../common/base-provider.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
@@ -20,14 +20,14 @@ export default class ar extends t {
|
|
|
20
20
|
super(),
|
|
21
21
|
(this.h = t),
|
|
22
22
|
(this.B = s),
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
23
|
+
(this.j = i),
|
|
24
|
+
(this.C = e),
|
|
25
25
|
(this.Xr = []),
|
|
26
26
|
(this.Yr = 0),
|
|
27
27
|
(this.h = t),
|
|
28
28
|
(this.B = s),
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
29
|
+
(this.j = i),
|
|
30
|
+
(this.C = e),
|
|
31
31
|
(this.Zr = null),
|
|
32
32
|
(this.ho = new f()),
|
|
33
33
|
(this.D = 10),
|
|
@@ -35,7 +35,7 @@ export default class ar extends t {
|
|
|
35
35
|
(this.F = null),
|
|
36
36
|
r.S(this.ho);
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
q(t) {
|
|
39
39
|
var s;
|
|
40
40
|
if (
|
|
41
41
|
(null === (s = this.h) || void 0 === s ? void 0 : s.lo()) &&
|
|
@@ -52,7 +52,7 @@ export default class ar extends t {
|
|
|
52
52
|
}
|
|
53
53
|
vo() {
|
|
54
54
|
let t = {};
|
|
55
|
-
this.
|
|
55
|
+
this.j && (t = this.j.St(s.It.Fo));
|
|
56
56
|
const i = {};
|
|
57
57
|
for (const s in t) {
|
|
58
58
|
const e = ht(t[s]);
|
|
@@ -63,14 +63,14 @@ export default class ar extends t {
|
|
|
63
63
|
po() {
|
|
64
64
|
var t;
|
|
65
65
|
return (
|
|
66
|
-
(null === (t = this.
|
|
66
|
+
(null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.jo)) || {}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
wo(t) {
|
|
70
|
-
this.
|
|
70
|
+
this.j && this.j.Pt(s.It.jo, t);
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
return this.ho.
|
|
72
|
+
Kt(t) {
|
|
73
|
+
return this.ho.Ut(t);
|
|
74
74
|
}
|
|
75
75
|
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
76
76
|
const r = () => {
|
|
@@ -97,7 +97,7 @@ export default class ar extends t {
|
|
|
97
97
|
const o = this.B;
|
|
98
98
|
if (!o) return void r();
|
|
99
99
|
const v = new Date().valueOf();
|
|
100
|
-
h.nt(this.
|
|
100
|
+
h.nt(this.j, h.it.Co, v),
|
|
101
101
|
-1 !== e && u.push(["X-Braze-Req-Tokens-Remaining", e.toString()]),
|
|
102
102
|
l.ot({
|
|
103
103
|
url: `${o.ht()}/feature_flags/sync`,
|
|
@@ -105,7 +105,7 @@ export default class ar extends t {
|
|
|
105
105
|
data: n,
|
|
106
106
|
lt: (s) => {
|
|
107
107
|
if (!o.ut(n, s, u)) return (f = !0), void r();
|
|
108
|
-
o.ct(), this.
|
|
108
|
+
o.ct(), this.q(s), (f = !1), "function" == typeof t && t();
|
|
109
109
|
},
|
|
110
110
|
error: (t) => {
|
|
111
111
|
o.dt(t, "retrieving feature flags"), (f = !0), r();
|
|
@@ -156,12 +156,12 @@ export default class ar extends t {
|
|
|
156
156
|
if (null == t) return !1;
|
|
157
157
|
let s = !1;
|
|
158
158
|
if (!isNaN(t)) {
|
|
159
|
-
if (-1 === t) return
|
|
159
|
+
if (-1 === t) return b.info("Feature flag refreshes not allowed"), !1;
|
|
160
160
|
s = new Date().getTime() >= (this.Yr || 0) + 1e3 * t;
|
|
161
161
|
}
|
|
162
162
|
if (!s)
|
|
163
163
|
return (
|
|
164
|
-
|
|
164
|
+
b.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
return this.h.lo();
|
|
@@ -169,29 +169,29 @@ export default class ar extends t {
|
|
|
169
169
|
To() {
|
|
170
170
|
var t;
|
|
171
171
|
return (
|
|
172
|
-
(null === (t = this.
|
|
172
|
+
(null === (t = this.j) || void 0 === t ? void 0 : t.St(s.It.Do)) || null
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
175
|
Io() {
|
|
176
176
|
var t, i;
|
|
177
|
-
null === (t = this.
|
|
177
|
+
null === (t = this.j) ||
|
|
178
178
|
void 0 === t ||
|
|
179
|
-
t.
|
|
179
|
+
t.Pt(s.It.Do, null === (i = this.C) || void 0 === i ? void 0 : i.$t());
|
|
180
180
|
}
|
|
181
181
|
So() {
|
|
182
182
|
var t;
|
|
183
|
-
const s = null === (t = this.
|
|
183
|
+
const s = null === (t = this.C) || void 0 === t ? void 0 : t.$t(),
|
|
184
184
|
i = this.To();
|
|
185
185
|
return null == i || s === i;
|
|
186
186
|
}
|
|
187
187
|
do() {
|
|
188
|
-
if (!this.
|
|
188
|
+
if (!this.j) return;
|
|
189
189
|
const t = {};
|
|
190
190
|
for (const s of this.Xr) {
|
|
191
191
|
const i = s.qt();
|
|
192
192
|
t[s.id] = i;
|
|
193
193
|
}
|
|
194
|
-
this.
|
|
194
|
+
this.j.Pt(s.It.Fo, t), this.j.Pt(s.It.qo, this.Yr), this.Io();
|
|
195
195
|
}
|
|
196
196
|
changeUser() {
|
|
197
197
|
this.Y();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger as
|
|
1
|
+
import { logger as b, EventTypes as p } from "../../shared-lib/index.js";
|
|
2
2
|
import v from "../common/event-logger.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
4
|
import lr from "./feature-flags-provider-factory.js";
|
|
@@ -8,18 +8,18 @@ export function logFeatureFlagImpression(e) {
|
|
|
8
8
|
const t =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
10
|
o = lr.o().vo();
|
|
11
|
-
if (!o[e]) return
|
|
11
|
+
if (!o[e]) return b.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
|
-
if (!n) return
|
|
13
|
+
if (!n) return b.info(t), !1;
|
|
14
14
|
const i = lr.o().po();
|
|
15
15
|
if (i[n])
|
|
16
16
|
return (
|
|
17
|
-
|
|
17
|
+
b.info(
|
|
18
18
|
"Not logging another feature flag impression. This ID was already logged this session.",
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
22
|
(i[n] = !0), lr.o().wo(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
|
-
return v.
|
|
24
|
+
return v.Dt(p.xo, s).lt;
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ export const IamSerializationKeys = {
|
|
|
51
51
|
rE: "m",
|
|
52
52
|
mE: "ma",
|
|
53
53
|
GE: "sf",
|
|
54
|
-
|
|
54
|
+
Is: "e",
|
|
55
55
|
FE: "ti",
|
|
56
56
|
HE: "ca",
|
|
57
57
|
URI: "u",
|
|
@@ -59,7 +59,7 @@ export const IamSerializationKeys = {
|
|
|
59
59
|
BE: "dt",
|
|
60
60
|
lE: "d",
|
|
61
61
|
bE: "i",
|
|
62
|
-
|
|
62
|
+
Bs: "iu",
|
|
63
63
|
gE: "is",
|
|
64
64
|
YE: "ic",
|
|
65
65
|
KE: "ibc",
|
|
@@ -81,5 +81,5 @@ export const IamSerializationKeys = {
|
|
|
81
81
|
qE: "messageFields",
|
|
82
82
|
JE: "me",
|
|
83
83
|
LANGUAGE: "l",
|
|
84
|
-
|
|
84
|
+
Ns: "ia",
|
|
85
85
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import InAppMessage from "./models/in-app-message.js";
|
|
2
2
|
import r from "../managers/braze-instance.js";
|
|
3
3
|
import ControlMessage from "./models/control-message.js";
|
|
4
|
-
import { logger as
|
|
4
|
+
import { logger as b } from "../../shared-lib/index.js";
|
|
5
5
|
import je from "./in-app-message-manager-factory.js";
|
|
6
6
|
export function deferInAppMessage(e) {
|
|
7
7
|
if (r.rr())
|
|
8
8
|
return e instanceof ControlMessage
|
|
9
|
-
? (
|
|
9
|
+
? (b.info("Not deferring since this is a ControlMessage."), !1)
|
|
10
10
|
: e instanceof InAppMessage
|
|
11
11
|
? je.ra().jn(e)
|
|
12
|
-
: (
|
|
12
|
+
: (b.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -2,15 +2,15 @@ import ro from "../../util/browser-detector.js";
|
|
|
2
2
|
import { logInAppMessageHtmlClick } from "../index.js";
|
|
3
3
|
import { OperatingSystems as so } from "../../util/device-constants.js";
|
|
4
4
|
import { buildHtmlClickHandler as ct } from "./html-message-display-utils.js";
|
|
5
|
-
import { attachHtmlToIframeWithNonce as
|
|
6
|
-
import { buildBrazeBridge as
|
|
5
|
+
import { attachHtmlToIframeWithNonce as N } from "../../util/html-display-utils.js";
|
|
6
|
+
import { buildBrazeBridge as E } from "../../util/html-display-utils.js";
|
|
7
7
|
import { IamServerTypes as dt } from "../constants.js";
|
|
8
8
|
export default function ft(t, o, s, e, n) {
|
|
9
9
|
const i = document.createElement("iframe");
|
|
10
10
|
i.setAttribute("title", "Modal Message"),
|
|
11
11
|
e && (i.style.zIndex = (e + 1).toString());
|
|
12
12
|
if (
|
|
13
|
-
(
|
|
13
|
+
(N(i, t.message, n),
|
|
14
14
|
(i.onload = () => {
|
|
15
15
|
const e = i.contentWindow;
|
|
16
16
|
e.focus();
|
|
@@ -31,7 +31,7 @@ export default function ft(t, o, s, e, n) {
|
|
|
31
31
|
const r = Object.assign(
|
|
32
32
|
Object.assign(
|
|
33
33
|
{},
|
|
34
|
-
|
|
34
|
+
E(i, (o, s) => t.tl(o, s)),
|
|
35
35
|
),
|
|
36
36
|
{
|
|
37
37
|
closeMessage: function () {
|
|
@@ -14,19 +14,19 @@ import { logInAppMessageClick } from "../log-in-app-message-click.js";
|
|
|
14
14
|
import { _handleBrazeAction as Q } from "../../Core/handle-braze-action.js";
|
|
15
15
|
import ft from "./html-message-to-html.js";
|
|
16
16
|
import xe from "./modal-utils.js";
|
|
17
|
-
import { logger as
|
|
17
|
+
import { logger as b, Guid as V } from "../../../shared-lib/index.js";
|
|
18
18
|
import { KeyCodes as Ce } from "../../util/key-codes.js";
|
|
19
19
|
import {
|
|
20
|
-
IamClickAction as
|
|
21
|
-
IamCropType as
|
|
22
|
-
IamDisplayFailures as
|
|
23
|
-
IamImageStyle as
|
|
20
|
+
IamClickAction as Le,
|
|
21
|
+
IamCropType as Me,
|
|
22
|
+
IamDisplayFailures as qe,
|
|
23
|
+
IamImageStyle as Ae,
|
|
24
24
|
IamOpenTarget as ut,
|
|
25
|
-
IamOrientation as
|
|
26
|
-
IamSlideFrom as
|
|
27
|
-
IamTextAlignment as
|
|
25
|
+
IamOrientation as De,
|
|
26
|
+
IamSlideFrom as Ee,
|
|
27
|
+
IamTextAlignment as Fe,
|
|
28
28
|
} from "../constants.js";
|
|
29
|
-
export default function
|
|
29
|
+
export default function Ge(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
30
30
|
if (((e.$o = document.activeElement), e instanceof HtmlMessage))
|
|
31
31
|
return ft(e, o, a, n, i);
|
|
32
32
|
const l = (function (e, o, t, a, n, i = document.body, s = "ltr") {
|
|
@@ -48,7 +48,7 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
48
48
|
document.querySelectorAll(".ab-iam-img-loading").length > 0
|
|
49
49
|
? t(
|
|
50
50
|
`Cannot show in-app message ${e.message} because another message is being shown.`,
|
|
51
|
-
|
|
51
|
+
qe.tE,
|
|
52
52
|
)
|
|
53
53
|
: o(l));
|
|
54
54
|
},
|
|
@@ -61,20 +61,20 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
61
61
|
m && (clearTimeout(m), (m = null)),
|
|
62
62
|
o
|
|
63
63
|
? c()
|
|
64
|
-
:
|
|
64
|
+
: b.error(
|
|
65
65
|
`Cannot show in-app message ${e.message} because the image failed to load.`,
|
|
66
66
|
));
|
|
67
67
|
};
|
|
68
68
|
if (
|
|
69
|
-
(e.imageStyle ===
|
|
70
|
-
e.orientation ===
|
|
69
|
+
(e.imageStyle === Ae.GRAPHIC && (l.className += " graphic"),
|
|
70
|
+
e.orientation === De.LANDSCAPE && (l.className += " landscape"),
|
|
71
71
|
null != e.buttons && 0 === e.buttons.length)
|
|
72
72
|
) {
|
|
73
|
-
e.clickAction !==
|
|
73
|
+
e.clickAction !== Le.NONE && (l.className += " ab-clickable");
|
|
74
74
|
const o = (o) => (
|
|
75
75
|
e.tl(l, () => {
|
|
76
76
|
logInAppMessageClick(e),
|
|
77
|
-
e.clickAction ===
|
|
77
|
+
e.clickAction === Le.URI &&
|
|
78
78
|
Q(e.uri || "", a || e.openTarget === ut.BLANK, o);
|
|
79
79
|
}),
|
|
80
80
|
o.stopPropagation(),
|
|
@@ -98,18 +98,18 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
98
98
|
(u.className = "ab-message-text"),
|
|
99
99
|
(u.dir = s),
|
|
100
100
|
u.setAttribute("role", "article");
|
|
101
|
-
const
|
|
102
|
-
u.className += " " +
|
|
103
|
-
let
|
|
104
|
-
const
|
|
105
|
-
if (((
|
|
101
|
+
const f = (e.messageAlignment || e.Go).toLowerCase();
|
|
102
|
+
u.className += " " + f + "-aligned";
|
|
103
|
+
let p = !1;
|
|
104
|
+
const g = document.createElement("div");
|
|
105
|
+
if (((g.className = "ab-image-area"), e.imageUrl)) {
|
|
106
106
|
const o = document.createElement("img");
|
|
107
107
|
if (
|
|
108
108
|
(o.setAttribute("src", e.imageUrl),
|
|
109
109
|
e.Ho(o),
|
|
110
110
|
0 === document.querySelectorAll(".ab-iam-img-loading").length)
|
|
111
111
|
) {
|
|
112
|
-
|
|
112
|
+
p = !0;
|
|
113
113
|
const e = document.querySelectorAll(".ab-iam-root");
|
|
114
114
|
e && e.length > 0 && e[0].classList.add("ab-iam-img-loading"),
|
|
115
115
|
(m = window.setTimeout(() => {
|
|
@@ -122,15 +122,15 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
122
122
|
r(!1);
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
if (e.cropType ===
|
|
125
|
+
if (e.cropType === Me.CENTER_CROP) {
|
|
126
126
|
const e = document.createElement("div");
|
|
127
127
|
(e.className = "ab-center-cropped-img"),
|
|
128
128
|
e.appendChild(o),
|
|
129
|
-
|
|
130
|
-
} else
|
|
131
|
-
l.appendChild(
|
|
129
|
+
g.appendChild(e);
|
|
130
|
+
} else g.appendChild(o);
|
|
131
|
+
l.appendChild(g), (u.className += " ab-with-image");
|
|
132
132
|
} else if (e.icon) {
|
|
133
|
-
|
|
133
|
+
g.className += " ab-icon-area";
|
|
134
134
|
const o = document.createElement("span");
|
|
135
135
|
(o.className = "ab-icon"),
|
|
136
136
|
e.Mo() ||
|
|
@@ -141,21 +141,21 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
141
141
|
t.appendChild(document.createTextNode(e.icon)),
|
|
142
142
|
t.setAttribute("aria-hidden", "true"),
|
|
143
143
|
o.appendChild(t),
|
|
144
|
-
|
|
145
|
-
l.appendChild(
|
|
144
|
+
g.appendChild(o),
|
|
145
|
+
l.appendChild(g),
|
|
146
146
|
(u.className += " ab-with-icon");
|
|
147
147
|
}
|
|
148
148
|
if ((F(u, "touchstart"), e.header && e.header.length > 0)) {
|
|
149
149
|
const o = document.createElement("h1");
|
|
150
150
|
(o.className = "ab-message-header"), (e.Jo = V.de()), (o.id = e.Jo);
|
|
151
|
-
const t = (e.headerAlignment ||
|
|
151
|
+
const t = (e.headerAlignment || Fe.CENTER).toLowerCase();
|
|
152
152
|
(o.className += " " + t + "-aligned"),
|
|
153
153
|
e.Mo() || (o.style.color = ke(e.headerTextColor)),
|
|
154
154
|
o.appendChild(document.createTextNode(e.header)),
|
|
155
155
|
u.appendChild(o);
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
return u.appendChild(
|
|
157
|
+
const h = e.Ko();
|
|
158
|
+
return u.appendChild(h), l.appendChild(u), p || c(), (e.Eo = l), l;
|
|
159
159
|
})(e, o, t, a, n, s, m);
|
|
160
160
|
if (e instanceof FullScreenMessage || e instanceof ModalMessage) {
|
|
161
161
|
const o = e instanceof FullScreenMessage ? "ab-fullscreen" : "ab-modal";
|
|
@@ -185,7 +185,7 @@ export default function Fe(e, o, t, a, n, i, s = document.body, m = "ltr") {
|
|
|
185
185
|
(l.className += " ab-swiped-right"),
|
|
186
186
|
null != o && null != o.onclick && o.onclick(e);
|
|
187
187
|
}),
|
|
188
|
-
e.slideFrom ===
|
|
188
|
+
e.slideFrom === Ee.TOP
|
|
189
189
|
? ((t = P.Uo), (a = " ab-swiped-up"))
|
|
190
190
|
: ((t = P.Vo), (a = " ab-swiped-down")),
|
|
191
191
|
O(l, t, (e) => {
|
|
@@ -3,7 +3,7 @@ import { logInAppMessageButtonClick } from "../log-in-app-message-button-click.j
|
|
|
3
3
|
import { toRgba as ke } from "../../util/color-utils.js";
|
|
4
4
|
import { addPassiveEventListener as F } from "../../util/dom-utils.js";
|
|
5
5
|
import { KeyCodes as Ce } from "../../util/key-codes.js";
|
|
6
|
-
import { IamClickAction as
|
|
6
|
+
import { IamClickAction as Le, IamOpenTarget as ut } from "../constants.js";
|
|
7
7
|
const xe = {
|
|
8
8
|
Po: (t) => {
|
|
9
9
|
const o = t.querySelectorAll(".ab-close-button, .ab-message-button");
|
|
@@ -39,7 +39,7 @@ const xe = {
|
|
|
39
39
|
const l = (s) => (a) => (
|
|
40
40
|
t.tl(o, () => {
|
|
41
41
|
logInAppMessageButtonClick(s, t),
|
|
42
|
-
s.clickAction ===
|
|
42
|
+
s.clickAction === Le.URI &&
|
|
43
43
|
Q(s.uri || "", e || t.openTarget === ut.BLANK, a);
|
|
44
44
|
}),
|
|
45
45
|
a.stopPropagation(),
|
|
@@ -4,7 +4,7 @@ import HtmlMessage from "./models/html-message.js";
|
|
|
4
4
|
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
|
-
import { logger as
|
|
7
|
+
import { logger as b } from "../../shared-lib/index.js";
|
|
8
8
|
import { IamServerTypes as dt } from "./constants.js";
|
|
9
9
|
export function newInAppMessageFromJson(e) {
|
|
10
10
|
if (!e) return null;
|
|
@@ -27,27 +27,27 @@ export function newInAppMessageFromJson(e) {
|
|
|
27
27
|
g = e.icon_color,
|
|
28
28
|
j = e.icon_bg_color,
|
|
29
29
|
w = e.bg_color,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
let
|
|
38
|
-
null ==
|
|
39
|
-
for (let e = 0; e <
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
(null !=
|
|
47
|
-
((
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
h = e.text_color,
|
|
31
|
+
v = e.close_btn_color,
|
|
32
|
+
x = e.header,
|
|
33
|
+
I = e.text_align_header,
|
|
34
|
+
A = e.header_text_color,
|
|
35
|
+
F = e.frame_color,
|
|
36
|
+
M = [];
|
|
37
|
+
let k = e.btns;
|
|
38
|
+
null == k && (k = []);
|
|
39
|
+
for (let e = 0; e < k.length; e++) M.push(InAppMessageButton.fromJson(k[e]));
|
|
40
|
+
const y = e.crop_type,
|
|
41
|
+
z = e.orientation,
|
|
42
|
+
J = e.animate_in,
|
|
43
|
+
S = e.animate_out;
|
|
44
|
+
let q = e.html_id,
|
|
45
|
+
B = e.css;
|
|
46
|
+
(null != q && "" !== q && null != B && "" !== B) ||
|
|
47
|
+
((q = void 0), (B = void 0));
|
|
48
|
+
const C = e.message_extras,
|
|
49
|
+
D = e.language,
|
|
50
|
+
E = e.image_alt;
|
|
51
51
|
let G;
|
|
52
52
|
if (o === dt.aE || o === dt.UE)
|
|
53
53
|
G = new ModalMessage(
|
|
@@ -66,21 +66,21 @@ export function newInAppMessageFromJson(e) {
|
|
|
66
66
|
g,
|
|
67
67
|
j,
|
|
68
68
|
w,
|
|
69
|
-
b,
|
|
70
69
|
h,
|
|
71
|
-
z,
|
|
72
|
-
J,
|
|
73
70
|
v,
|
|
71
|
+
J,
|
|
72
|
+
S,
|
|
74
73
|
x,
|
|
75
74
|
I,
|
|
76
75
|
A,
|
|
77
76
|
F,
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
M,
|
|
78
|
+
y,
|
|
80
79
|
q,
|
|
81
80
|
B,
|
|
82
81
|
C,
|
|
83
82
|
D,
|
|
83
|
+
E,
|
|
84
84
|
);
|
|
85
85
|
else if (o === dt.cE)
|
|
86
86
|
G = new FullScreenMessage(
|
|
@@ -99,22 +99,22 @@ export function newInAppMessageFromJson(e) {
|
|
|
99
99
|
g,
|
|
100
100
|
j,
|
|
101
101
|
w,
|
|
102
|
-
b,
|
|
103
102
|
h,
|
|
104
|
-
z,
|
|
105
|
-
J,
|
|
106
103
|
v,
|
|
104
|
+
J,
|
|
105
|
+
S,
|
|
107
106
|
x,
|
|
108
107
|
I,
|
|
109
108
|
A,
|
|
110
109
|
F,
|
|
111
|
-
|
|
110
|
+
M,
|
|
112
111
|
y,
|
|
113
|
-
|
|
112
|
+
z,
|
|
114
113
|
q,
|
|
115
114
|
B,
|
|
116
115
|
C,
|
|
117
116
|
D,
|
|
117
|
+
E,
|
|
118
118
|
);
|
|
119
119
|
else if (o === dt.sE)
|
|
120
120
|
G = new SlideUpMessage(
|
|
@@ -133,22 +133,22 @@ export function newInAppMessageFromJson(e) {
|
|
|
133
133
|
g,
|
|
134
134
|
j,
|
|
135
135
|
w,
|
|
136
|
-
b,
|
|
137
136
|
h,
|
|
138
|
-
|
|
137
|
+
v,
|
|
139
138
|
J,
|
|
140
139
|
S,
|
|
141
140
|
q,
|
|
142
141
|
B,
|
|
143
142
|
C,
|
|
144
143
|
D,
|
|
144
|
+
E,
|
|
145
145
|
);
|
|
146
146
|
else {
|
|
147
147
|
if (o !== dt.iE && o !== dt.PE && o !== dt.nE)
|
|
148
|
-
return void
|
|
148
|
+
return void b.error("Ignoring message with unknown type " + o);
|
|
149
149
|
{
|
|
150
150
|
const o = e.message_fields;
|
|
151
|
-
(G = new HtmlMessage(s, r, m, p, u,
|
|
151
|
+
(G = new HtmlMessage(s, r, m, p, u, J, S, F, q, B, o, C)),
|
|
152
152
|
(G.trusted = e.trusted || !1);
|
|
153
153
|
}
|
|
154
154
|
}
|