@braze/web-sdk 6.5.0 → 6.7.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 +258 -5
- package/package.json +1 -1
- package/shared-lib/event-types.js +21 -20
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +70 -70
- package/shared-lib/logger.js +7 -7
- package/shared-lib/supported-options.js +26 -25
- package/src/Banner/banner-factory.js +11 -1
- package/src/Banner/banner-provider.js +244 -120
- package/src/Banner/banner.js +14 -12
- package/src/Banner/display/banner-to-html.js +23 -16
- package/src/Banner/display/detect-banner-impressions.js +13 -13
- package/src/Banner/get-all-banners.js +5 -5
- package/src/Banner/get-banner.js +4 -4
- package/src/Banner/log-banner-click.js +4 -4
- package/src/Banner/log-banner-dismissal.js +23 -0
- package/src/Banner/log-banner-impressions.js +7 -7
- package/src/Banner/request-banners-refresh.js +12 -16
- package/src/Banner/subscribe-to-banners-updates.js +6 -6
- package/src/Banner/ui/insert-banner.js +12 -12
- package/src/Card/card-manager-factory.js +5 -5
- package/src/Card/card-manager.js +33 -33
- package/src/Card/constants.js +1 -1
- package/src/Card/display/card-display.js +11 -11
- package/src/Card/log-card-dismissal.js +3 -3
- package/src/Card/log-content-card-click.js +3 -3
- package/src/Card/log-content-card-impressions.js +6 -6
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +73 -73
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +18 -18
- package/src/Card/util/card-factory.js +41 -41
- package/src/ContentCards/content-cards-provider-factory.js +12 -12
- package/src/ContentCards/content-cards-provider.js +151 -151
- package/src/ContentCards/content-cards.js +5 -5
- 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 +6 -6
- package/src/ContentCards/ui/show-content-cards.js +10 -10
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +6 -6
- package/src/Core/disable-sdk.js +9 -8
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +3 -3
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +8 -8
- package/src/Core/log-purchase.js +5 -5
- package/src/Core/open-session.js +7 -7
- 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 +6 -6
- package/src/DUST/dust-provider-factory.js +11 -11
- package/src/DUST/dust-provider.js +255 -255
- package/src/DUST/dust-shared-worker-impl.js +100 -100
- package/src/DUST/dust-worker-bridge.js +27 -27
- package/src/DUST/subscribe-to-dust.js +9 -9
- package/src/FeatureFlags/feature-flag-factory.js +8 -8
- package/src/FeatureFlags/feature-flag.js +9 -9
- package/src/FeatureFlags/feature-flags-provider.js +86 -86
- 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 +5 -5
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/InAppMessage/constants.js +83 -2
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-display-utils.js +15 -15
- package/src/InAppMessage/display/html-message-to-html.js +36 -37
- package/src/InAppMessage/display/in-app-message-to-html.js +44 -44
- package/src/InAppMessage/display/modal-utils.js +10 -14
- package/src/InAppMessage/in-app-message-factory.js +16 -20
- package/src/InAppMessage/in-app-message-manager.js +116 -117
- package/src/InAppMessage/log-in-app-message-button-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-html-click.js +8 -8
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -4
- package/src/InAppMessage/models/full-screen-message.js +56 -49
- package/src/InAppMessage/models/html-message.js +31 -27
- package/src/InAppMessage/models/in-app-message-button.js +12 -12
- package/src/InAppMessage/models/in-app-message.js +202 -256
- package/src/InAppMessage/models/modal-message.js +55 -49
- package/src/InAppMessage/models/slide-up-message.js +57 -51
- package/src/InAppMessage/models/templated-in-app-message.js +10 -10
- package/src/InAppMessage/shared-types.js +1 -0
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +5 -5
- package/src/InAppMessage/ui/remove-all-visible-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +43 -41
- 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 +9 -9
- package/src/Push/push-manager.js +15 -15
- package/src/Push/utils/push-utils.js +15 -15
- package/src/User/user-manager.js +14 -14
- package/src/User/user.js +60 -59
- package/src/common/base-provider.js +1 -1
- package/src/common/constants.js +2 -1
- package/src/common/content-cards-display.js +38 -38
- package/src/common/event-logger.js +8 -8
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/l10n/l10n-manager.js +2 -2
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +197 -182
- package/src/managers/constants.js +1 -0
- package/src/managers/device-manager.js +25 -25
- package/src/managers/network-manager.js +155 -155
- package/src/managers/server-config-manager.js +106 -93
- package/src/managers/session-manager.js +37 -33
- package/src/managers/storage-manager-factory.js +33 -28
- package/src/managers/storage-manager.js +194 -175
- package/src/managers/subscription-manager.js +13 -13
- package/src/managers/utils.js +1 -1
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +13 -13
- package/src/models/device.js +3 -3
- package/src/models/identifier.js +12 -12
- package/src/models/push-token.js +9 -9
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +29 -38
- package/src/request-controller.js +159 -163
- package/src/triggers/models/custom-event-data.js +7 -7
- package/src/triggers/models/custom-event-property-data.js +10 -10
- package/src/triggers/models/filter-set.js +12 -12
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +13 -13
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +10 -10
- package/src/triggers/models/push-click-data.js +8 -8
- package/src/triggers/models/trigger-condition.js +58 -58
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +44 -44
- package/src/triggers/triggers-provider-factory.js +5 -5
- package/src/triggers/triggers-provider.js +70 -70
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/feed-css.js +2 -2
- package/src/ui/js/iam-css.js +2 -2
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +3 -3
- package/src/util/browser-detector.js +37 -37
- package/src/util/client-hints-parser.js +9 -9
- package/src/util/component-utils.js +3 -3
- package/src/util/dom-utils.js +2 -2
- package/src/util/html-display-utils.js +11 -11
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +8 -8
- package/src/util/request-header-utils.js +25 -25
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +21 -21
- package/src/util/window-utils.js +3 -3
|
@@ -2,12 +2,12 @@ import { logger as E } 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";
|
|
5
|
-
import
|
|
5
|
+
import f from "../managers/subscription-manager.js";
|
|
6
6
|
import { randomInclusive as a } from "../util/math.js";
|
|
7
7
|
import {
|
|
8
|
-
REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as
|
|
9
|
-
REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as
|
|
10
|
-
REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as
|
|
8
|
+
REQUEST_BACKOFF_MAX_SLEEP_MS_DEFAULT as c,
|
|
9
|
+
REQUEST_BACKOFF_MIN_SLEEP_MS_DEFAULT as d,
|
|
10
|
+
REQUEST_BACKOFF_SCALE_FACTOR_DEFAULT as m,
|
|
11
11
|
} from "../common/constants.js";
|
|
12
12
|
import l from "../util/net.js";
|
|
13
13
|
import {
|
|
@@ -19,26 +19,26 @@ export default class ar extends t {
|
|
|
19
19
|
constructor(t, s, i, e) {
|
|
20
20
|
super(),
|
|
21
21
|
(this.h = t),
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
22
|
+
(this.B = s),
|
|
23
|
+
(this.C = i),
|
|
24
|
+
(this.j = e),
|
|
25
25
|
(this.Xr = []),
|
|
26
|
-
(this.
|
|
26
|
+
(this.Yr = 0),
|
|
27
27
|
(this.h = t),
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
31
|
-
(this.
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
36
|
-
r.
|
|
37
|
-
}
|
|
38
|
-
|
|
28
|
+
(this.B = s),
|
|
29
|
+
(this.C = i),
|
|
30
|
+
(this.j = e),
|
|
31
|
+
(this.Zr = null),
|
|
32
|
+
(this.ho = new f()),
|
|
33
|
+
(this.D = 10),
|
|
34
|
+
(this.N = null),
|
|
35
|
+
(this.F = null),
|
|
36
|
+
r.S(this.ho);
|
|
37
|
+
}
|
|
38
|
+
I(t) {
|
|
39
39
|
var s;
|
|
40
40
|
if (
|
|
41
|
-
(null === (s = this.h) || void 0 === s ? void 0 : s.
|
|
41
|
+
(null === (s = this.h) || void 0 === s ? void 0 : s.lo()) &&
|
|
42
42
|
null != t &&
|
|
43
43
|
t.feature_flags
|
|
44
44
|
) {
|
|
@@ -47,12 +47,12 @@ export default class ar extends t {
|
|
|
47
47
|
const t = at(s);
|
|
48
48
|
t && this.Xr.push(t);
|
|
49
49
|
}
|
|
50
|
-
(this.
|
|
50
|
+
(this.Yr = new Date().getTime()), this.do(), this.ho.A(this.Xr);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
vo() {
|
|
54
54
|
let t = {};
|
|
55
|
-
this.
|
|
55
|
+
this.C && (t = this.C.Rt(s.Tt.Fo));
|
|
56
56
|
const i = {};
|
|
57
57
|
for (const s in t) {
|
|
58
58
|
const e = ht(t[s]);
|
|
@@ -60,143 +60,143 @@ export default class ar extends t {
|
|
|
60
60
|
}
|
|
61
61
|
return i;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
po() {
|
|
64
64
|
var t;
|
|
65
65
|
return (
|
|
66
|
-
(null === (t = this.
|
|
66
|
+
(null === (t = this.C) || void 0 === t ? void 0 : t.Rt(s.Tt.jo)) || {}
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
this.
|
|
69
|
+
wo(t) {
|
|
70
|
+
this.C && this.C.It(s.Tt.jo, t);
|
|
71
71
|
}
|
|
72
|
-
|
|
73
|
-
return this.
|
|
72
|
+
zt(t) {
|
|
73
|
+
return this.ho.Kt(t);
|
|
74
74
|
}
|
|
75
75
|
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
76
76
|
const r = () => {
|
|
77
|
-
"function" == typeof s && s(), this.
|
|
77
|
+
"function" == typeof s && s(), this.ho.A(this.Xr);
|
|
78
78
|
};
|
|
79
|
-
if (!this.
|
|
79
|
+
if (!this.yo(i))
|
|
80
80
|
return (
|
|
81
|
-
!this.
|
|
81
|
+
!this.Zr &&
|
|
82
82
|
this.h &&
|
|
83
|
-
(this.
|
|
83
|
+
(this.Zr = this.h.bo(() => {
|
|
84
84
|
this.refreshFeatureFlags(t, s);
|
|
85
85
|
})),
|
|
86
86
|
void r()
|
|
87
87
|
);
|
|
88
|
-
const o = this.
|
|
88
|
+
const o = this.B;
|
|
89
89
|
if (!o) return void r();
|
|
90
|
-
e && this.
|
|
91
|
-
const n = o
|
|
92
|
-
|
|
93
|
-
let
|
|
94
|
-
o.
|
|
90
|
+
e && this.Y();
|
|
91
|
+
const n = o.Z({}, !0),
|
|
92
|
+
u = o.tt(n, h.it.Co);
|
|
93
|
+
let f = !1;
|
|
94
|
+
o.et(
|
|
95
95
|
n,
|
|
96
96
|
(e = -1) => {
|
|
97
|
-
const o = this.
|
|
97
|
+
const o = this.B;
|
|
98
98
|
if (!o) return void r();
|
|
99
99
|
const v = new Date().valueOf();
|
|
100
|
-
h.
|
|
101
|
-
-1 !== e &&
|
|
102
|
-
l.
|
|
103
|
-
url: `${o.
|
|
104
|
-
headers:
|
|
100
|
+
h.nt(this.C, h.it.Co, v),
|
|
101
|
+
-1 !== e && u.push(["X-Braze-Req-Tokens-Remaining", e.toString()]),
|
|
102
|
+
l.ot({
|
|
103
|
+
url: `${o.ht()}/feature_flags/sync`,
|
|
104
|
+
headers: u,
|
|
105
105
|
data: n,
|
|
106
|
-
|
|
107
|
-
if (!o.
|
|
108
|
-
o.
|
|
106
|
+
lt: (s) => {
|
|
107
|
+
if (!o.ut(n, s, u)) return (f = !0), void r();
|
|
108
|
+
o.ct(), this.I(s), (f = !1), "function" == typeof t && t();
|
|
109
109
|
},
|
|
110
110
|
error: (t) => {
|
|
111
|
-
o.
|
|
111
|
+
o.dt(t, "retrieving feature flags"), (f = !0), r();
|
|
112
112
|
},
|
|
113
|
-
|
|
114
|
-
var n, l,
|
|
113
|
+
ft: (e, r) => {
|
|
114
|
+
var n, l, u;
|
|
115
115
|
let v;
|
|
116
|
-
if (
|
|
116
|
+
if (f) {
|
|
117
117
|
const t =
|
|
118
|
-
(null === (n = this.h) || void 0 === n ? void 0 : n.
|
|
119
|
-
c,
|
|
120
|
-
s =
|
|
121
|
-
(null === (l = this.h) || void 0 === l ? void 0 : l.it()) ||
|
|
118
|
+
(null === (n = this.h) || void 0 === n ? void 0 : n.vt()) ||
|
|
122
119
|
d,
|
|
120
|
+
s =
|
|
121
|
+
(null === (l = this.h) || void 0 === l ? void 0 : l.gt()) ||
|
|
122
|
+
m,
|
|
123
123
|
i =
|
|
124
|
-
(null === (
|
|
125
|
-
|
|
126
|
-
let e = this.
|
|
124
|
+
(null === (u = this.h) || void 0 === u ? void 0 : u.bt()) ||
|
|
125
|
+
c;
|
|
126
|
+
let e = this.N;
|
|
127
127
|
(null == e || e < t) && (e = t), (v = Math.min(i, a(t, e * s)));
|
|
128
128
|
}
|
|
129
|
-
o.
|
|
129
|
+
o.yt(
|
|
130
130
|
r,
|
|
131
131
|
() => {
|
|
132
132
|
this.refreshFeatureFlags(t, s, i, !0);
|
|
133
133
|
},
|
|
134
|
-
h.
|
|
135
|
-
(t) => this.
|
|
136
|
-
() => this.
|
|
134
|
+
h.it.Co,
|
|
135
|
+
(t) => this.Bt(t),
|
|
136
|
+
() => this.Y(),
|
|
137
137
|
v,
|
|
138
138
|
);
|
|
139
139
|
},
|
|
140
140
|
});
|
|
141
141
|
},
|
|
142
|
-
h.
|
|
142
|
+
h.it.Co,
|
|
143
143
|
s,
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
null != this.
|
|
146
|
+
Y() {
|
|
147
|
+
null != this.F && (clearTimeout(this.F), (this.F = null));
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
this.
|
|
149
|
+
Bt(t) {
|
|
150
|
+
this.Y(), (this.F = t);
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
yo(t) {
|
|
153
153
|
if (!this.h) return !1;
|
|
154
154
|
if (!t) {
|
|
155
|
-
const t = this.h.
|
|
155
|
+
const t = this.h.Ro();
|
|
156
156
|
if (null == t) return !1;
|
|
157
157
|
let s = !1;
|
|
158
158
|
if (!isNaN(t)) {
|
|
159
159
|
if (-1 === t) return E.info("Feature flag refreshes not allowed"), !1;
|
|
160
|
-
s = new Date().getTime() >= (this.
|
|
160
|
+
s = new Date().getTime() >= (this.Yr || 0) + 1e3 * t;
|
|
161
161
|
}
|
|
162
162
|
if (!s)
|
|
163
163
|
return (
|
|
164
164
|
E.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
|
-
return this.h.
|
|
167
|
+
return this.h.lo();
|
|
168
168
|
}
|
|
169
|
-
|
|
169
|
+
To() {
|
|
170
170
|
var t;
|
|
171
171
|
return (
|
|
172
|
-
(null === (t = this.
|
|
172
|
+
(null === (t = this.C) || void 0 === t ? void 0 : t.Rt(s.Tt.Do)) || null
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
|
-
|
|
175
|
+
Io() {
|
|
176
176
|
var t, i;
|
|
177
|
-
null === (t = this.
|
|
177
|
+
null === (t = this.C) ||
|
|
178
178
|
void 0 === t ||
|
|
179
|
-
t.
|
|
179
|
+
t.It(s.Tt.Do, null === (i = this.j) || void 0 === i ? void 0 : i.kt());
|
|
180
180
|
}
|
|
181
|
-
|
|
181
|
+
So() {
|
|
182
182
|
var t;
|
|
183
|
-
const s = null === (t = this.
|
|
184
|
-
i = this.
|
|
183
|
+
const s = null === (t = this.j) || void 0 === t ? void 0 : t.kt(),
|
|
184
|
+
i = this.To();
|
|
185
185
|
return null == i || s === i;
|
|
186
186
|
}
|
|
187
|
-
|
|
188
|
-
if (!this.
|
|
187
|
+
do() {
|
|
188
|
+
if (!this.C) return;
|
|
189
189
|
const t = {};
|
|
190
190
|
for (const s of this.Xr) {
|
|
191
|
-
const i = s.
|
|
191
|
+
const i = s.qt();
|
|
192
192
|
t[s.id] = i;
|
|
193
193
|
}
|
|
194
|
-
this.
|
|
194
|
+
this.C.It(s.Tt.Fo, t), this.C.It(s.Tt.qo, this.Yr), this.Io();
|
|
195
195
|
}
|
|
196
196
|
changeUser() {
|
|
197
|
-
this.
|
|
197
|
+
this.Y();
|
|
198
198
|
}
|
|
199
199
|
clearData() {
|
|
200
|
-
this.
|
|
200
|
+
this.Y();
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -3,7 +3,7 @@ import lr from "./feature-flags-provider-factory.js";
|
|
|
3
3
|
export function getFeatureFlag(t) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const e = r.l();
|
|
6
|
-
if (e && !e.
|
|
7
|
-
const n = lr.o().
|
|
6
|
+
if (e && !e.lo()) return null;
|
|
7
|
+
const n = lr.o().vo();
|
|
8
8
|
return n[t] ? n[t] : null;
|
|
9
9
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { logger as E, EventTypes as
|
|
1
|
+
import { logger as E, 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";
|
|
@@ -7,11 +7,11 @@ export function logFeatureFlagImpression(e) {
|
|
|
7
7
|
if (!e) return !1;
|
|
8
8
|
const t =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
|
-
o = lr.o().
|
|
10
|
+
o = lr.o().vo();
|
|
11
11
|
if (!o[e]) return E.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
13
|
if (!n) return E.info(t), !1;
|
|
14
|
-
const i = lr.o().
|
|
14
|
+
const i = lr.o().po();
|
|
15
15
|
if (i[n])
|
|
16
16
|
return (
|
|
17
17
|
E.info(
|
|
@@ -19,7 +19,7 @@ export function logFeatureFlagImpression(e) {
|
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(i[n] = !0), lr.o().
|
|
22
|
+
(i[n] = !0), lr.o().wo(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
|
-
return v.
|
|
24
|
+
return v.wt(p.xo, s).lt;
|
|
25
25
|
}
|
|
@@ -4,9 +4,9 @@ import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
|
4
4
|
export function subscribeToFeatureFlagsUpdates(t) {
|
|
5
5
|
if (!r.rr()) return;
|
|
6
6
|
const e = lr.o();
|
|
7
|
-
if (e.
|
|
7
|
+
if (e.So()) {
|
|
8
8
|
const r = getAllFeatureFlags();
|
|
9
9
|
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
|
11
|
-
return e.
|
|
11
|
+
return e.zt(t);
|
|
12
12
|
}
|
|
@@ -1,4 +1,85 @@
|
|
|
1
1
|
export const IamStrings = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
EE: "inAppMessage must be an InAppMessage object",
|
|
3
|
+
TE: "ab-pause-scrolling",
|
|
4
|
+
};
|
|
5
|
+
export const IamColors = {
|
|
6
|
+
IE: 4281545523,
|
|
7
|
+
AE: 4294967295,
|
|
8
|
+
_E: 4278219733,
|
|
9
|
+
OE: 4293914607,
|
|
10
|
+
LE: 4283782485,
|
|
11
|
+
SE: 3224580915,
|
|
12
|
+
NE: 4288387995,
|
|
13
|
+
};
|
|
14
|
+
export const IamDisplayFailures = {
|
|
15
|
+
RE: "hd",
|
|
16
|
+
tE: "ias",
|
|
17
|
+
ME: "of",
|
|
18
|
+
eE: "do",
|
|
19
|
+
oE: "umt",
|
|
20
|
+
CE: "tf",
|
|
21
|
+
DE: "te",
|
|
22
|
+
};
|
|
23
|
+
export const IamSlideFrom = { TOP: "TOP", BOTTOM: "BOTTOM" };
|
|
24
|
+
export const IamClickAction = { URI: "URI", NONE: "NONE" };
|
|
25
|
+
export const IamDismissType = { AUTO_DISMISS: "AUTO_DISMISS", MANUAL: "SWIPE" };
|
|
26
|
+
export const IamOpenTarget = { NONE: "NONE", BLANK: "BLANK" };
|
|
27
|
+
export const IamImageStyle = { TOP: "TOP", GRAPHIC: "GRAPHIC" };
|
|
28
|
+
export const IamOrientation = { PORTRAIT: "PORTRAIT", LANDSCAPE: "LANDSCAPE" };
|
|
29
|
+
export const IamTextAlignment = {
|
|
30
|
+
START: "START",
|
|
31
|
+
CENTER: "CENTER",
|
|
32
|
+
END: "END",
|
|
33
|
+
};
|
|
34
|
+
export const IamCropType = {
|
|
35
|
+
CENTER_CROP: "CENTER_CROP",
|
|
36
|
+
FIT_CENTER: "FIT_CENTER",
|
|
37
|
+
};
|
|
38
|
+
export const IamServerTypes = {
|
|
39
|
+
sE: "SLIDEUP",
|
|
40
|
+
aE: "MODAL",
|
|
41
|
+
UE: "MODAL_STYLED",
|
|
42
|
+
cE: "FULL",
|
|
43
|
+
iE: "WEB_HTML",
|
|
44
|
+
PE: "HTML",
|
|
45
|
+
nE: "HTML_FULL",
|
|
46
|
+
};
|
|
47
|
+
export const IamTiming = { gr: 500, pE: 200 };
|
|
48
|
+
export const IAM_SHOW_CLASS = "ab-show";
|
|
49
|
+
export const IAM_HIDE_CLASS = "ab-hide";
|
|
50
|
+
export const IamSerializationKeys = {
|
|
51
|
+
rE: "m",
|
|
52
|
+
mE: "ma",
|
|
53
|
+
GE: "sf",
|
|
54
|
+
Fs: "e",
|
|
55
|
+
FE: "ti",
|
|
56
|
+
HE: "ca",
|
|
57
|
+
URI: "u",
|
|
58
|
+
xE: "oa",
|
|
59
|
+
BE: "dt",
|
|
60
|
+
lE: "d",
|
|
61
|
+
bE: "i",
|
|
62
|
+
ys: "iu",
|
|
63
|
+
gE: "is",
|
|
64
|
+
YE: "ic",
|
|
65
|
+
KE: "ibc",
|
|
66
|
+
XE: "bc",
|
|
67
|
+
dE: "tc",
|
|
68
|
+
hE: "cbc",
|
|
69
|
+
yE: "ai",
|
|
70
|
+
uE: "ao",
|
|
71
|
+
WE: "h",
|
|
72
|
+
fE: "ha",
|
|
73
|
+
jE: "htc",
|
|
74
|
+
kE: "fc",
|
|
75
|
+
vE: "b",
|
|
76
|
+
wE: "ct",
|
|
77
|
+
zE: "o",
|
|
78
|
+
VE: "hi",
|
|
79
|
+
CSS: "css",
|
|
80
|
+
xs: "type",
|
|
81
|
+
qE: "messageFields",
|
|
82
|
+
JE: "me",
|
|
83
|
+
LANGUAGE: "l",
|
|
84
|
+
Ks: "ia",
|
|
4
85
|
};
|
|
@@ -8,6 +8,6 @@ export function deferInAppMessage(e) {
|
|
|
8
8
|
return e instanceof ControlMessage
|
|
9
9
|
? (E.info("Not deferring since this is a ControlMessage."), !1)
|
|
10
10
|
: e instanceof InAppMessage
|
|
11
|
-
? je.ra().
|
|
11
|
+
? je.ra().jn(e)
|
|
12
12
|
: (E.info("Not an instance of InAppMessage, ignoring."), !1);
|
|
13
13
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { parseQueryStringKeyValues as
|
|
1
|
+
import { parseQueryStringKeyValues as lt } from "../../util/url-utils.js";
|
|
2
2
|
import { WindowUtils as no } from "../../util/window-utils.js";
|
|
3
|
+
import { IamOpenTarget as ut } from "../constants.js";
|
|
3
4
|
import { logInAppMessageHtmlClick } from "../log-in-app-message-html-click.js";
|
|
4
|
-
|
|
5
|
-
export const buildHtmlClickHandler = (l, t, i, o) => {
|
|
5
|
+
export const buildHtmlClickHandler = (t, l, i, o) => {
|
|
6
6
|
const r = i.getAttribute("href"),
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
if (null !=
|
|
10
|
-
let
|
|
7
|
+
n = i.onclick;
|
|
8
|
+
return (s) => {
|
|
9
|
+
if (null != n && "function" == typeof n && !1 === n.bind(i)(s)) return;
|
|
10
|
+
let e = lt(r).abButtonId;
|
|
11
11
|
if (
|
|
12
|
-
((null !=
|
|
12
|
+
((null != e && "" !== e) || (e = i.getAttribute("id") || void 0),
|
|
13
13
|
null != r && "" !== r && 0 !== r.indexOf("#"))
|
|
14
14
|
) {
|
|
15
|
-
const
|
|
15
|
+
const n =
|
|
16
16
|
"blank" ===
|
|
17
17
|
(i.getAttribute("target") || "").toLowerCase().replace("_", ""),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
logInAppMessageHtmlClick(
|
|
18
|
+
u = o || t.openTarget === ut.BLANK || n,
|
|
19
|
+
m = () => {
|
|
20
|
+
logInAppMessageHtmlClick(t, e, r), no.openUri(r, u, s);
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
} else logInAppMessageHtmlClick(
|
|
24
|
-
return
|
|
22
|
+
u ? m() : t.tl(l, m);
|
|
23
|
+
} else logInAppMessageHtmlClick(t, e, r || void 0);
|
|
24
|
+
return s.stopPropagation(), !1;
|
|
25
25
|
};
|
|
26
26
|
};
|
|
@@ -1,74 +1,73 @@
|
|
|
1
1
|
import ro from "../../util/browser-detector.js";
|
|
2
|
-
import {
|
|
2
|
+
import { logInAppMessageHtmlClick } from "../index.js";
|
|
3
3
|
import { OperatingSystems as so } from "../../util/device-constants.js";
|
|
4
|
-
import { buildHtmlClickHandler as
|
|
4
|
+
import { buildHtmlClickHandler as ct } from "./html-message-display-utils.js";
|
|
5
5
|
import { attachHtmlToIframeWithNonce as b } from "../../util/html-display-utils.js";
|
|
6
6
|
import { buildBrazeBridge as N } from "../../util/html-display-utils.js";
|
|
7
|
-
|
|
7
|
+
import { IamServerTypes as dt } from "../constants.js";
|
|
8
|
+
export default function ft(t, o, s, e, n) {
|
|
8
9
|
const i = document.createElement("iframe");
|
|
9
10
|
i.setAttribute("title", "Modal Message"),
|
|
10
|
-
|
|
11
|
+
e && (i.style.zIndex = (e + 1).toString());
|
|
11
12
|
if (
|
|
12
13
|
(b(i, t.message, n),
|
|
13
14
|
(i.onload = () => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
if (null !=
|
|
15
|
+
const e = i.contentWindow;
|
|
16
|
+
e.focus();
|
|
17
|
+
const a = e.document.getElementsByTagName("head")[0];
|
|
18
|
+
if (null != a) {
|
|
18
19
|
if (t.Mo()) {
|
|
19
|
-
const
|
|
20
|
-
(
|
|
21
|
-
(
|
|
22
|
-
null != n &&
|
|
23
|
-
|
|
20
|
+
const o = document.createElement("style");
|
|
21
|
+
(o.innerHTML = t.css || ""),
|
|
22
|
+
(o.id = t.Oo() || ""),
|
|
23
|
+
null != n && o.setAttribute("nonce", n),
|
|
24
|
+
a.appendChild(o);
|
|
24
25
|
}
|
|
25
|
-
const
|
|
26
|
-
null !=
|
|
26
|
+
const o = e.document.createElement("base");
|
|
27
|
+
null != o && (o.setAttribute("target", "_parent"), a.appendChild(o));
|
|
27
28
|
}
|
|
28
|
-
const
|
|
29
|
-
|
|
29
|
+
const l = e.document.getElementsByTagName("title");
|
|
30
|
+
l && l.length > 0 && i.setAttribute("title", l[0].textContent || "");
|
|
30
31
|
const r = Object.assign(
|
|
31
32
|
Object.assign(
|
|
32
33
|
{},
|
|
33
|
-
N(i, (
|
|
34
|
+
N(i, (o, s) => t.tl(o, s)),
|
|
34
35
|
),
|
|
35
36
|
{
|
|
36
37
|
closeMessage: function () {
|
|
37
|
-
t.
|
|
38
|
+
t.tl(i);
|
|
38
39
|
},
|
|
39
40
|
logClick: function () {
|
|
40
41
|
logInAppMessageHtmlClick(t, ...arguments);
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
);
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
for (let
|
|
49
|
-
const n = s.document.getElementsByTagName("button");
|
|
50
|
-
for (let e = 0; e < n.length; e++) n[e].onclick = lt(t, i, n[e], o);
|
|
45
|
+
if (((e.appboyBridge = r), (e.brazeBridge = r), t.ko !== dt.PE)) {
|
|
46
|
+
const o = e.document.getElementsByTagName("a");
|
|
47
|
+
for (let e = 0; e < o.length; e++) o[e].onclick = ct(t, i, o[e], s);
|
|
48
|
+
const n = e.document.getElementsByTagName("button");
|
|
49
|
+
for (let o = 0; o < n.length; o++) n[o].onclick = ct(t, i, n[o], s);
|
|
51
50
|
}
|
|
52
|
-
const c =
|
|
51
|
+
const c = e.document.body;
|
|
53
52
|
if (null != c) {
|
|
54
|
-
t.
|
|
55
|
-
const
|
|
56
|
-
(
|
|
57
|
-
(
|
|
58
|
-
c.appendChild(
|
|
53
|
+
t.Bo() && (c.id = t.htmlId || "");
|
|
54
|
+
const o = document.createElement("hidden");
|
|
55
|
+
(o.onclick = r.closeMessage),
|
|
56
|
+
(o.className = "ab-programmatic-close-button"),
|
|
57
|
+
c.appendChild(o);
|
|
59
58
|
}
|
|
60
|
-
|
|
59
|
+
e.dispatchEvent(new CustomEvent("ab.BridgeReady")),
|
|
61
60
|
-1 !== i.className.indexOf("ab-start-hidden") &&
|
|
62
|
-
((i.className = i.className.replace("ab-start-hidden", "")),
|
|
61
|
+
((i.className = i.className.replace("ab-start-hidden", "")), o(i));
|
|
63
62
|
}),
|
|
64
63
|
(i.className =
|
|
65
64
|
"ab-in-app-message ab-start-hidden ab-html-message ab-modal-interactions"),
|
|
66
65
|
ro.OS === so.co)
|
|
67
66
|
) {
|
|
68
|
-
const
|
|
67
|
+
const o = document.createElement("div");
|
|
69
68
|
return (
|
|
70
|
-
(
|
|
69
|
+
(o.className = "ab-ios-scroll-wrapper"), o.appendChild(i), (t.Eo = o), o
|
|
71
70
|
);
|
|
72
71
|
}
|
|
73
|
-
return (t.
|
|
72
|
+
return (t.Eo = i), i;
|
|
74
73
|
}
|