@braze/web-sdk 4.9.0 → 5.0.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 +2204 -2230
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -1
- package/shared-lib/event-types.js +9 -9
- package/shared-lib/indexed-db-adapter.js +13 -13
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +8 -8
- package/src/Card/models/captioned-image.js +19 -19
- package/src/Card/models/card.js +95 -94
- package/src/Card/models/classic-card.js +19 -19
- package/src/Card/models/control-card.js +9 -9
- package/src/Card/models/image-only.js +21 -22
- package/src/Card/models/index.js +0 -1
- package/src/Card/util/card-factory.js +39 -39
- package/src/ContentCards/content-cards-provider.js +114 -114
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/index.js +0 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
- package/src/ContentCards/ui/hide-content-cards.js +2 -2
- package/src/ContentCards/ui/show-content-cards.js +14 -14
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.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 +9 -7
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/open-session.js +5 -5
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +4 -4
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +7 -7
- package/src/FeatureFlags/feature-flags-provider.js +50 -50
- package/src/FeatureFlags/get-all-feature-flags.js +1 -1
- package/src/FeatureFlags/get-feature-flag.js +3 -5
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +15 -15
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/ui/hide-feed.js +2 -2
- package/src/Feed/ui/show-feed.js +13 -13
- package/src/InAppMessage/display/html-message-to-html.js +11 -12
- package/src/InAppMessage/display/in-app-message-to-html.js +15 -15
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +38 -38
- package/src/InAppMessage/models/full-screen-message.js +31 -31
- package/src/InAppMessage/models/html-message.js +16 -16
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +46 -46
- package/src/InAppMessage/models/modal-message.js +30 -30
- package/src/InAppMessage/models/slide-up-message.js +26 -26
- package/src/InAppMessage/ui/show-in-app-message.js +9 -9
- 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.js +31 -31
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +8 -8
- package/src/User/user.js +38 -37
- package/src/common/base-feed.js +15 -14
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +32 -32
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/managers/auth-manager.js +6 -6
- package/src/managers/braze-instance.js +84 -92
- package/src/managers/device-manager.js +9 -9
- package/src/managers/network-manager.js +72 -69
- package/src/managers/server-config-manager.js +13 -13
- package/src/managers/session-manager.js +9 -9
- package/src/managers/storage-manager-factory.js +11 -11
- package/src/managers/storage-manager.js +110 -110
- package/src/managers/subscription-manager.js +3 -3
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +1 -1
- package/src/models/server-config.js +6 -6
- package/src/request-controller.js +129 -125
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +31 -31
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +32 -32
- package/src/triggers/triggers-provider.js +55 -55
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +11 -11
- package/src/util/client-hints-parser.js +5 -5
- package/src/util/component-utils.js +2 -2
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +4 -5
- package/src/util/dom-utils.js +5 -5
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +17 -17
- package/src/util/user-agent-parser.js +11 -16
- package/src/util/validation-utils.js +9 -9
- package/src/Card/models/banner.js +0 -31
- package/src/ContentCards/log-content-cards-displayed.js +0 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import e, { OPTIONS as L } from "../../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import Q from "../../util/browser-detector.js";
|
|
3
3
|
import {
|
|
4
4
|
clickElement as Et,
|
|
5
5
|
supportsPassive as Tt,
|
|
6
6
|
} from "../../util/dom-utils.js";
|
|
7
|
-
import { KeyCodes as
|
|
7
|
+
import { KeyCodes as at } from "../../util/key-codes.js";
|
|
8
8
|
import E from "../../managers/subscription-manager.js";
|
|
9
9
|
import { isIFrame as It } from "../utils/in-app-message-utils.js";
|
|
10
10
|
export default class InAppMessage {
|
|
@@ -106,21 +106,21 @@ export default class InAppMessage {
|
|
|
106
106
|
(this.oh = !1),
|
|
107
107
|
(this.Me = null),
|
|
108
108
|
(this.ke = null),
|
|
109
|
-
(this.
|
|
109
|
+
(this.Et = new E()),
|
|
110
110
|
(this.rh = new E()),
|
|
111
111
|
(this.Te = InAppMessage.TextAlignment.CENTER);
|
|
112
112
|
}
|
|
113
113
|
subscribeToClickedEvent(t) {
|
|
114
|
-
return this.
|
|
114
|
+
return this.Et.It(t);
|
|
115
115
|
}
|
|
116
116
|
subscribeToDismissedEvent(t) {
|
|
117
|
-
return this.rh.
|
|
117
|
+
return this.rh.It(t);
|
|
118
118
|
}
|
|
119
119
|
removeSubscription(t) {
|
|
120
|
-
this.
|
|
120
|
+
this.Et.removeSubscription(t), this.rh.removeSubscription(t);
|
|
121
121
|
}
|
|
122
122
|
removeAllSubscriptions() {
|
|
123
|
-
this.
|
|
123
|
+
this.Et.removeAllSubscriptions(), this.rh.removeAllSubscriptions();
|
|
124
124
|
}
|
|
125
125
|
closeMessage() {
|
|
126
126
|
this.ye(this.Me);
|
|
@@ -147,10 +147,10 @@ export default class InAppMessage {
|
|
|
147
147
|
return this.Th;
|
|
148
148
|
}
|
|
149
149
|
p(t) {
|
|
150
|
-
return !this.do && ((this.do = !0), this.
|
|
150
|
+
return !this.do && ((this.do = !0), this.Et.Dt(), !0);
|
|
151
151
|
}
|
|
152
152
|
F() {
|
|
153
|
-
return !this.oh && ((this.oh = !0), this.rh.
|
|
153
|
+
return !this.oh && ((this.oh = !0), this.rh.Dt(), !0);
|
|
154
154
|
}
|
|
155
155
|
hide(t) {
|
|
156
156
|
if (t && t.parentNode) {
|
|
@@ -187,7 +187,7 @@ export default class InAppMessage {
|
|
|
187
187
|
const t = document.getElementById(i);
|
|
188
188
|
t && t.parentNode && t.parentNode.removeChild(t);
|
|
189
189
|
}
|
|
190
|
-
null != e && "Safari" ===
|
|
190
|
+
null != e && "Safari" === Q.browser && (e.scrollTop = E),
|
|
191
191
|
s ? s() : this.F();
|
|
192
192
|
};
|
|
193
193
|
h ? setTimeout(n, InAppMessage.Oh) : n(), this.ke && this.ke.focus();
|
|
@@ -224,7 +224,7 @@ export default class InAppMessage {
|
|
|
224
224
|
}
|
|
225
225
|
static Lh(t) {
|
|
226
226
|
if (
|
|
227
|
-
t.keyCode ===
|
|
227
|
+
t.keyCode === at._h &&
|
|
228
228
|
!e.nn(L.mh) &&
|
|
229
229
|
document.querySelectorAll(".ab-modal-interactions").length > 0
|
|
230
230
|
) {
|
|
@@ -256,39 +256,39 @@ export default class InAppMessage {
|
|
|
256
256
|
}),
|
|
257
257
|
(this.nh = !0));
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
tt(t) {
|
|
260
260
|
const s = {};
|
|
261
261
|
return t
|
|
262
|
-
? ((s[InAppMessage.
|
|
263
|
-
(s[InAppMessage.
|
|
264
|
-
(s[InAppMessage.
|
|
265
|
-
(s[InAppMessage.
|
|
266
|
-
(s[InAppMessage.
|
|
267
|
-
(s[InAppMessage.
|
|
268
|
-
(s[InAppMessage.
|
|
269
|
-
(s[InAppMessage.
|
|
270
|
-
(s[InAppMessage.
|
|
271
|
-
(s[InAppMessage.
|
|
272
|
-
(s[InAppMessage.
|
|
273
|
-
(s[InAppMessage.
|
|
274
|
-
(s[InAppMessage.
|
|
275
|
-
(s[InAppMessage.
|
|
276
|
-
(s[InAppMessage.
|
|
277
|
-
(s[InAppMessage.
|
|
278
|
-
(s[InAppMessage.
|
|
279
|
-
(s[InAppMessage.
|
|
280
|
-
(s[InAppMessage.
|
|
281
|
-
(s[InAppMessage.
|
|
282
|
-
(s[InAppMessage.
|
|
283
|
-
(s[InAppMessage.
|
|
284
|
-
(s[InAppMessage.
|
|
285
|
-
(s[InAppMessage.
|
|
286
|
-
(s[InAppMessage.
|
|
287
|
-
(s[InAppMessage.
|
|
288
|
-
(s[InAppMessage.
|
|
289
|
-
(s[InAppMessage.
|
|
290
|
-
(s[InAppMessage.
|
|
291
|
-
(s[InAppMessage.
|
|
262
|
+
? ((s[InAppMessage.it.ea] = this.message),
|
|
263
|
+
(s[InAppMessage.it.ra] = this.messageAlignment),
|
|
264
|
+
(s[InAppMessage.it.Sh] = this.slideFrom),
|
|
265
|
+
(s[InAppMessage.it.jt] = this.extras),
|
|
266
|
+
(s[InAppMessage.it.sa] = this.triggerId),
|
|
267
|
+
(s[InAppMessage.it.ta] = this.clickAction),
|
|
268
|
+
(s[InAppMessage.it.URI] = this.uri),
|
|
269
|
+
(s[InAppMessage.it.ia] = this.openTarget),
|
|
270
|
+
(s[InAppMessage.it.oa] = this.dismissType),
|
|
271
|
+
(s[InAppMessage.it.pa] = this.duration),
|
|
272
|
+
(s[InAppMessage.it.ma] = this.icon),
|
|
273
|
+
(s[InAppMessage.it.nt] = this.imageUrl),
|
|
274
|
+
(s[InAppMessage.it.na] = this.imageStyle),
|
|
275
|
+
(s[InAppMessage.it.ua] = this.iconColor),
|
|
276
|
+
(s[InAppMessage.it.ca] = this.iconBackgroundColor),
|
|
277
|
+
(s[InAppMessage.it.fa] = this.backgroundColor),
|
|
278
|
+
(s[InAppMessage.it.da] = this.textColor),
|
|
279
|
+
(s[InAppMessage.it.la] = this.closeButtonColor),
|
|
280
|
+
(s[InAppMessage.it.ga] = this.animateIn),
|
|
281
|
+
(s[InAppMessage.it.ja] = this.animateOut),
|
|
282
|
+
(s[InAppMessage.it.xa] = this.header),
|
|
283
|
+
(s[InAppMessage.it.za] = this.headerAlignment),
|
|
284
|
+
(s[InAppMessage.it.ha] = this.headerTextColor),
|
|
285
|
+
(s[InAppMessage.it.va] = this.frameColor),
|
|
286
|
+
(s[InAppMessage.it.wa] = this.buttons),
|
|
287
|
+
(s[InAppMessage.it.ya] = this.cropType),
|
|
288
|
+
(s[InAppMessage.it.Sa] = this.orientation),
|
|
289
|
+
(s[InAppMessage.it.ba] = this.htmlId),
|
|
290
|
+
(s[InAppMessage.it.CSS] = this.css),
|
|
291
|
+
(s[InAppMessage.it.st] = t),
|
|
292
292
|
s)
|
|
293
293
|
: s;
|
|
294
294
|
}
|
|
@@ -347,11 +347,11 @@ export default class InAppMessage {
|
|
|
347
347
|
(InAppMessage.ah = "ab-show"),
|
|
348
348
|
(InAppMessage.Ih = "ab-hide"),
|
|
349
349
|
(InAppMessage.lh = "ab-pause-scrolling"),
|
|
350
|
-
(InAppMessage.
|
|
350
|
+
(InAppMessage.it = {
|
|
351
351
|
ea: "m",
|
|
352
352
|
ra: "ma",
|
|
353
353
|
Sh: "sf",
|
|
354
|
-
|
|
354
|
+
jt: "e",
|
|
355
355
|
sa: "ti",
|
|
356
356
|
ta: "ca",
|
|
357
357
|
URI: "u",
|
|
@@ -359,7 +359,7 @@ export default class InAppMessage {
|
|
|
359
359
|
oa: "dt",
|
|
360
360
|
pa: "d",
|
|
361
361
|
ma: "i",
|
|
362
|
-
|
|
362
|
+
nt: "iu",
|
|
363
363
|
na: "is",
|
|
364
364
|
ua: "ic",
|
|
365
365
|
ca: "ibc",
|
|
@@ -377,6 +377,6 @@ export default class InAppMessage {
|
|
|
377
377
|
Sa: "o",
|
|
378
378
|
ba: "hi",
|
|
379
379
|
CSS: "css",
|
|
380
|
-
|
|
380
|
+
st: "type",
|
|
381
381
|
vo: "messageFields",
|
|
382
382
|
});
|
|
@@ -63,39 +63,39 @@ export default class ModalMessage extends InAppMessage {
|
|
|
63
63
|
),
|
|
64
64
|
(this.Te = InAppMessage.TextAlignment.CENTER);
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
return super.
|
|
66
|
+
tt() {
|
|
67
|
+
return super.tt(ModalMessage.et);
|
|
68
68
|
}
|
|
69
69
|
static an(e) {
|
|
70
70
|
return new ModalMessage(
|
|
71
|
-
e[InAppMessage.
|
|
72
|
-
e[InAppMessage.
|
|
73
|
-
e[InAppMessage.
|
|
74
|
-
e[InAppMessage.
|
|
75
|
-
e[InAppMessage.
|
|
76
|
-
e[InAppMessage.
|
|
77
|
-
e[InAppMessage.
|
|
78
|
-
e[InAppMessage.
|
|
79
|
-
e[InAppMessage.
|
|
80
|
-
e[InAppMessage.
|
|
81
|
-
e[InAppMessage.
|
|
82
|
-
e[InAppMessage.
|
|
83
|
-
e[InAppMessage.
|
|
84
|
-
e[InAppMessage.
|
|
85
|
-
e[InAppMessage.
|
|
86
|
-
e[InAppMessage.
|
|
87
|
-
e[InAppMessage.
|
|
88
|
-
e[InAppMessage.
|
|
89
|
-
e[InAppMessage.
|
|
90
|
-
e[InAppMessage.
|
|
91
|
-
e[InAppMessage.
|
|
92
|
-
e[InAppMessage.
|
|
93
|
-
e[InAppMessage.
|
|
94
|
-
pe(e[InAppMessage.
|
|
95
|
-
e[InAppMessage.
|
|
96
|
-
e[InAppMessage.
|
|
97
|
-
e[InAppMessage.
|
|
71
|
+
e[InAppMessage.it.ea],
|
|
72
|
+
e[InAppMessage.it.ra],
|
|
73
|
+
e[InAppMessage.it.jt],
|
|
74
|
+
e[InAppMessage.it.sa],
|
|
75
|
+
e[InAppMessage.it.ta],
|
|
76
|
+
e[InAppMessage.it.URI],
|
|
77
|
+
e[InAppMessage.it.ia],
|
|
78
|
+
e[InAppMessage.it.oa],
|
|
79
|
+
e[InAppMessage.it.pa],
|
|
80
|
+
e[InAppMessage.it.ma],
|
|
81
|
+
e[InAppMessage.it.nt],
|
|
82
|
+
e[InAppMessage.it.na],
|
|
83
|
+
e[InAppMessage.it.ua],
|
|
84
|
+
e[InAppMessage.it.ca],
|
|
85
|
+
e[InAppMessage.it.fa],
|
|
86
|
+
e[InAppMessage.it.da],
|
|
87
|
+
e[InAppMessage.it.la],
|
|
88
|
+
e[InAppMessage.it.ga],
|
|
89
|
+
e[InAppMessage.it.ja],
|
|
90
|
+
e[InAppMessage.it.xa],
|
|
91
|
+
e[InAppMessage.it.za],
|
|
92
|
+
e[InAppMessage.it.ha],
|
|
93
|
+
e[InAppMessage.it.va],
|
|
94
|
+
pe(e[InAppMessage.it.wa]),
|
|
95
|
+
e[InAppMessage.it.ya],
|
|
96
|
+
e[InAppMessage.it.ba],
|
|
97
|
+
e[InAppMessage.it.CSS],
|
|
98
98
|
);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
ModalMessage.
|
|
101
|
+
ModalMessage.et = InAppMessage.qe.un;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import InAppMessage from "./in-app-message.js";
|
|
2
|
-
import { DOMUtils as
|
|
2
|
+
import { DOMUtils as de } from "../../util/dom-utils.js";
|
|
3
3
|
export default class SlideUpMessage extends InAppMessage {
|
|
4
4
|
constructor(e, t, s, o, i, r, n, d, a, u, p, m, c, l, v, x, f, h, g, I, M) {
|
|
5
5
|
(x = x || InAppMessage.th.Mh),
|
|
@@ -46,39 +46,39 @@ export default class SlideUpMessage extends InAppMessage {
|
|
|
46
46
|
}
|
|
47
47
|
Ah(e) {
|
|
48
48
|
const t = e.getElementsByClassName("ab-in-app-message")[0];
|
|
49
|
-
|
|
49
|
+
de.no(t, !0, !0) ||
|
|
50
50
|
(this.slideFrom === InAppMessage.SlideFrom.TOP
|
|
51
51
|
? (t.style.top = "0px")
|
|
52
52
|
: (t.style.bottom = "0px")),
|
|
53
53
|
super.Ah(e);
|
|
54
54
|
}
|
|
55
|
-
|
|
56
|
-
return super.
|
|
55
|
+
tt() {
|
|
56
|
+
return super.tt(SlideUpMessage.et);
|
|
57
57
|
}
|
|
58
58
|
static an(e) {
|
|
59
59
|
return new SlideUpMessage(
|
|
60
|
-
e[InAppMessage.
|
|
61
|
-
e[InAppMessage.
|
|
62
|
-
e[InAppMessage.
|
|
63
|
-
e[InAppMessage.
|
|
64
|
-
e[InAppMessage.
|
|
65
|
-
e[InAppMessage.
|
|
66
|
-
e[InAppMessage.
|
|
67
|
-
e[InAppMessage.
|
|
68
|
-
e[InAppMessage.
|
|
69
|
-
e[InAppMessage.
|
|
70
|
-
e[InAppMessage.
|
|
71
|
-
e[InAppMessage.
|
|
72
|
-
e[InAppMessage.
|
|
73
|
-
e[InAppMessage.
|
|
74
|
-
e[InAppMessage.
|
|
75
|
-
e[InAppMessage.
|
|
76
|
-
e[InAppMessage.
|
|
77
|
-
e[InAppMessage.
|
|
78
|
-
e[InAppMessage.
|
|
79
|
-
e[InAppMessage.
|
|
80
|
-
e[InAppMessage.
|
|
60
|
+
e[InAppMessage.it.ea],
|
|
61
|
+
e[InAppMessage.it.ra],
|
|
62
|
+
e[InAppMessage.it.Sh],
|
|
63
|
+
e[InAppMessage.it.jt],
|
|
64
|
+
e[InAppMessage.it.sa],
|
|
65
|
+
e[InAppMessage.it.ta],
|
|
66
|
+
e[InAppMessage.it.URI],
|
|
67
|
+
e[InAppMessage.it.ia],
|
|
68
|
+
e[InAppMessage.it.oa],
|
|
69
|
+
e[InAppMessage.it.pa],
|
|
70
|
+
e[InAppMessage.it.ma],
|
|
71
|
+
e[InAppMessage.it.nt],
|
|
72
|
+
e[InAppMessage.it.ua],
|
|
73
|
+
e[InAppMessage.it.ca],
|
|
74
|
+
e[InAppMessage.it.fa],
|
|
75
|
+
e[InAppMessage.it.da],
|
|
76
|
+
e[InAppMessage.it.la],
|
|
77
|
+
e[InAppMessage.it.ga],
|
|
78
|
+
e[InAppMessage.it.ja],
|
|
79
|
+
e[InAppMessage.it.ba],
|
|
80
|
+
e[InAppMessage.it.CSS],
|
|
81
81
|
);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
SlideUpMessage.
|
|
84
|
+
SlideUpMessage.et = InAppMessage.qe.pn;
|
|
@@ -5,17 +5,17 @@ import InAppMessage from "../models/in-app-message.js";
|
|
|
5
5
|
import SlideUpMessage from "../models/slide-up-message.js";
|
|
6
6
|
import se from "../in-app-message-manager-factory.js";
|
|
7
7
|
import me from "../display/get-animation-effect.js";
|
|
8
|
-
import
|
|
8
|
+
import ce from "../display/in-app-message-to-html.js";
|
|
9
9
|
import { logInAppMessageImpression } from "../log-in-app-message-impression.js";
|
|
10
10
|
import {
|
|
11
11
|
ORIENTATION as fe,
|
|
12
|
-
WindowUtils as
|
|
12
|
+
WindowUtils as Y,
|
|
13
13
|
} from "../../util/window-utils.js";
|
|
14
14
|
import { isURIJavascriptOrData as N } from "../../util/url-utils.js";
|
|
15
|
-
import { KeyCodes as
|
|
15
|
+
import { KeyCodes as at } from "../../util/key-codes.js";
|
|
16
16
|
import { setupInAppMessageUI as ss } from "../../ui/js/index.js";
|
|
17
17
|
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
18
|
-
import { toRgba as
|
|
18
|
+
import { toRgba as ie } from "../../util/color-utils.js";
|
|
19
19
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../../common/constants.js";
|
|
20
20
|
import { isIFrame as It } from "../utils/in-app-message-utils.js";
|
|
21
21
|
export function showInAppMessage(s, t, o) {
|
|
@@ -52,8 +52,8 @@ export function showInAppMessage(s, t, o) {
|
|
|
52
52
|
!1
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
|
-
if (
|
|
56
|
-
const e =
|
|
55
|
+
if (Y.ao()) {
|
|
56
|
+
const e = Y.mo();
|
|
57
57
|
if (
|
|
58
58
|
(e === fe.PORTRAIT &&
|
|
59
59
|
s.orientation === InAppMessage.Orientation.LANDSCAPE) ||
|
|
@@ -110,7 +110,7 @@ export function showInAppMessage(s, t, o) {
|
|
|
110
110
|
document.getElementsByTagName("head")[0].appendChild(t);
|
|
111
111
|
}
|
|
112
112
|
const m = s instanceof SlideUpMessage,
|
|
113
|
-
l =
|
|
113
|
+
l = ce(
|
|
114
114
|
s,
|
|
115
115
|
() => {
|
|
116
116
|
import("../../Feed/ui/show-feed.js").then((s) => {
|
|
@@ -122,7 +122,7 @@ export function showInAppMessage(s, t, o) {
|
|
|
122
122
|
const o = document.createElement("div");
|
|
123
123
|
if (
|
|
124
124
|
((o.className = "ab-page-blocker"),
|
|
125
|
-
s.Ae() || (o.style.backgroundColor =
|
|
125
|
+
s.Ae() || (o.style.backgroundColor = ie(s.frameColor)),
|
|
126
126
|
e.nn(L.lo) && (o.style.zIndex = e.nn(L.lo).toString()),
|
|
127
127
|
a.appendChild(o),
|
|
128
128
|
!e.nn(L.mh))
|
|
@@ -159,7 +159,7 @@ export function showInAppMessage(s, t, o) {
|
|
|
159
159
|
It(t) &&
|
|
160
160
|
t.contentWindow &&
|
|
161
161
|
t.contentWindow.addEventListener("keydown", function (s) {
|
|
162
|
-
s.keyCode ===
|
|
162
|
+
s.keyCode === at._h && e.closeMessage();
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
logInAppMessageImpression(s),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
2
|
+
import vt from "./utils/push-utils.js";
|
|
3
3
|
export function isPushPermissionGranted() {
|
|
4
|
-
if (e.rr()) return
|
|
4
|
+
if (e.rr()) return vt.isPushPermissionGranted();
|
|
5
5
|
}
|
package/src/Push/push-manager.js
CHANGED
|
@@ -3,8 +3,8 @@ import ti from "../models/push-token.js";
|
|
|
3
3
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
4
4
|
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
5
5
|
import { User } from "../User/index.js";
|
|
6
|
-
import { WindowUtils as
|
|
7
|
-
import
|
|
6
|
+
import { WindowUtils as Y } from "../util/window-utils.js";
|
|
7
|
+
import vt from "./utils/push-utils.js";
|
|
8
8
|
import { getErrorMessage as ei } from "../util/error-utils.js";
|
|
9
9
|
export default class ea {
|
|
10
10
|
constructor(i, t, e, s, r, n, o, u, h, a) {
|
|
@@ -13,7 +13,7 @@ export default class ea {
|
|
|
13
13
|
(this.fn = e),
|
|
14
14
|
(this.dn = r),
|
|
15
15
|
(this.bn = n),
|
|
16
|
-
(this.
|
|
16
|
+
(this.yt = o),
|
|
17
17
|
(this.yn = u),
|
|
18
18
|
(this.gn = h),
|
|
19
19
|
(this.u = a),
|
|
@@ -23,12 +23,12 @@ export default class ea {
|
|
|
23
23
|
(this.wn = s + "/safari/" + t),
|
|
24
24
|
(this.dn = r || "/service-worker.js"),
|
|
25
25
|
(this.bn = n),
|
|
26
|
-
(this.
|
|
26
|
+
(this.yt = o),
|
|
27
27
|
(this.yn = u || !1),
|
|
28
28
|
(this.gn = h || !1),
|
|
29
29
|
(this.u = a),
|
|
30
|
-
(this.vn =
|
|
31
|
-
(this.Pn =
|
|
30
|
+
(this.vn = vt.kn()),
|
|
31
|
+
(this.Pn = vt.Dn());
|
|
32
32
|
}
|
|
33
33
|
Sn() {
|
|
34
34
|
return this.gn;
|
|
@@ -60,19 +60,19 @@ export default class ea {
|
|
|
60
60
|
t
|
|
61
61
|
);
|
|
62
62
|
})(i);
|
|
63
|
-
let
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
if (null !=
|
|
63
|
+
let n = null,
|
|
64
|
+
o = null;
|
|
65
|
+
const u = i;
|
|
66
|
+
if (null != u.getKey)
|
|
67
67
|
try {
|
|
68
|
-
const i = Array.from(new Uint8Array(
|
|
69
|
-
t = Array.from(new Uint8Array(
|
|
70
|
-
(
|
|
71
|
-
(
|
|
68
|
+
const i = Array.from(new Uint8Array(u.getKey("p256dh"))),
|
|
69
|
+
t = Array.from(new Uint8Array(u.getKey("auth")));
|
|
70
|
+
(n = btoa(String.fromCharCode.apply(null, i))),
|
|
71
|
+
(o = btoa(String.fromCharCode.apply(null, t)));
|
|
72
72
|
} catch (i) {
|
|
73
|
-
|
|
73
|
+
r.j.error(ei(i));
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const h = ((i) => {
|
|
76
76
|
let t;
|
|
77
77
|
return i.options &&
|
|
78
78
|
(t = i.options.applicationServerKey) &&
|
|
@@ -82,9 +82,9 @@ export default class ea {
|
|
|
82
82
|
.replace(/\+/g, "-")
|
|
83
83
|
.replace(/\//g, "_")
|
|
84
84
|
: null;
|
|
85
|
-
})(
|
|
86
|
-
this.hn && this.hn._n(s, t,
|
|
87
|
-
s && "function" == typeof e && e(s,
|
|
85
|
+
})(u);
|
|
86
|
+
this.hn && this.hn._n(s, t, n, o, h),
|
|
87
|
+
s && "function" == typeof e && e(s, n, o);
|
|
88
88
|
}
|
|
89
89
|
xn() {
|
|
90
90
|
this.hn && this.hn.Nn(!0);
|
|
@@ -160,7 +160,7 @@ export default class ea {
|
|
|
160
160
|
this.Un(i, new Date(), e);
|
|
161
161
|
})
|
|
162
162
|
.catch((i) => {
|
|
163
|
-
|
|
163
|
+
vt.isPushBlocked()
|
|
164
164
|
? (r.j.info("Permission for push notifications was denied."),
|
|
165
165
|
"function" == typeof s && s(!1))
|
|
166
166
|
: (r.j.error("Push subscription failed: " + i),
|
|
@@ -188,7 +188,7 @@ export default class ea {
|
|
|
188
188
|
(i.unregister(), r.j.info("Service worker successfully unregistered."));
|
|
189
189
|
}
|
|
190
190
|
subscribe(t, e) {
|
|
191
|
-
if (!
|
|
191
|
+
if (!vt.isPushSupported())
|
|
192
192
|
return r.j.info(ea.qn), void ("function" == typeof e && e(!1));
|
|
193
193
|
if (this.vn) {
|
|
194
194
|
if (!this.yn && null != window.location) {
|
|
@@ -198,7 +198,7 @@ export default class ea {
|
|
|
198
198
|
-1 === i.indexOf(window.location.protocol) &&
|
|
199
199
|
(i = window.location.protocol + "//" + i);
|
|
200
200
|
const t = i.substr(0, i.lastIndexOf("/") + 1);
|
|
201
|
-
if (0 !==
|
|
201
|
+
if (0 !== Y.Cn().indexOf(t))
|
|
202
202
|
return (
|
|
203
203
|
r.j.error(
|
|
204
204
|
"Cannot subscribe to push from a path higher than the service worker location (tried to subscribe from " +
|
|
@@ -210,17 +210,17 @@ export default class ea {
|
|
|
210
210
|
void ("function" == typeof e && e(!0))
|
|
211
211
|
);
|
|
212
212
|
}
|
|
213
|
-
if (
|
|
213
|
+
if (vt.isPushBlocked())
|
|
214
214
|
return void this.Tn(
|
|
215
215
|
"Notifications from this site are blocked. This may be a temporary embargo or a permanent denial.",
|
|
216
216
|
e,
|
|
217
217
|
);
|
|
218
|
-
if (this.
|
|
218
|
+
if (this.yt && !this.yt.En() && 0 === this.yt.li())
|
|
219
219
|
return (
|
|
220
220
|
r.j.info(
|
|
221
221
|
"Waiting for VAPID key from server config before subscribing to push.",
|
|
222
222
|
),
|
|
223
|
-
void this.
|
|
223
|
+
void this.yt.Rn(() => {
|
|
224
224
|
this.subscribe(t, e);
|
|
225
225
|
})
|
|
226
226
|
);
|
|
@@ -230,13 +230,13 @@ export default class ea {
|
|
|
230
230
|
},
|
|
231
231
|
n = () => {
|
|
232
232
|
let i = "Permission for push notifications was ignored.";
|
|
233
|
-
|
|
233
|
+
vt.isPushBlocked() &&
|
|
234
234
|
(i +=
|
|
235
235
|
" The browser has automatically blocked further permission requests for a period (probably 1 week)."),
|
|
236
236
|
r.j.info(i),
|
|
237
237
|
"function" == typeof e && e(!0);
|
|
238
238
|
},
|
|
239
|
-
o =
|
|
239
|
+
o = vt.isPushPermissionGranted(),
|
|
240
240
|
u = () => {
|
|
241
241
|
!o &&
|
|
242
242
|
this.hn &&
|
|
@@ -257,9 +257,9 @@ export default class ea {
|
|
|
257
257
|
.then((n) => {
|
|
258
258
|
let o = null;
|
|
259
259
|
if (
|
|
260
|
-
(this.
|
|
261
|
-
null != this.
|
|
262
|
-
(o = r.On.Fn(this.
|
|
260
|
+
(this.yt &&
|
|
261
|
+
null != this.yt.En() &&
|
|
262
|
+
(o = r.On.Fn(this.yt.En())),
|
|
263
263
|
n)
|
|
264
264
|
) {
|
|
265
265
|
let u,
|
|
@@ -342,7 +342,7 @@ export default class ea {
|
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
unsubscribe(i, t) {
|
|
345
|
-
if (!
|
|
345
|
+
if (!vt.isPushSupported())
|
|
346
346
|
return r.j.info(ea.qn), void ("function" == typeof t && t());
|
|
347
347
|
this.vn
|
|
348
348
|
? navigator.serviceWorker.getRegistration().then((e) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const vt = {
|
|
2
2
|
kn: () =>
|
|
3
3
|
"serviceWorker" in navigator &&
|
|
4
4
|
"undefined" != typeof ServiceWorkerRegistration &&
|
|
@@ -9,28 +9,28 @@ const jt = {
|
|
|
9
9
|
"pushNotification" in window.safari &&
|
|
10
10
|
"function" == typeof window.safari.pushNotification.permission &&
|
|
11
11
|
"function" == typeof window.safari.pushNotification.requestPermission,
|
|
12
|
-
isPushSupported: () =>
|
|
12
|
+
isPushSupported: () => vt.kn() || vt.Dn(),
|
|
13
13
|
isPushBlocked: () => {
|
|
14
14
|
const i =
|
|
15
|
-
|
|
15
|
+
vt.isPushSupported() &&
|
|
16
16
|
"Notification" in window &&
|
|
17
17
|
null != window.Notification &&
|
|
18
18
|
null != window.Notification.permission &&
|
|
19
19
|
"denied" === window.Notification.permission,
|
|
20
20
|
n =
|
|
21
|
-
|
|
21
|
+
vt.isPushSupported() &&
|
|
22
22
|
(!("Notification" in window) || null == window.Notification);
|
|
23
23
|
return i || n;
|
|
24
24
|
},
|
|
25
25
|
isPushPermissionGranted: () =>
|
|
26
|
-
|
|
26
|
+
vt.isPushSupported() &&
|
|
27
27
|
"Notification" in window &&
|
|
28
28
|
null != window.Notification &&
|
|
29
29
|
null != window.Notification.permission &&
|
|
30
30
|
"granted" === window.Notification.permission,
|
|
31
31
|
Gr: () =>
|
|
32
|
-
!
|
|
33
|
-
|
|
34
|
-
!
|
|
32
|
+
!vt.isPushBlocked() &&
|
|
33
|
+
vt.isPushSupported() &&
|
|
34
|
+
!vt.isPushPermissionGranted(),
|
|
35
35
|
};
|
|
36
|
-
export default
|
|
36
|
+
export default vt;
|
package/src/User/user-manager.js
CHANGED
|
@@ -6,7 +6,7 @@ import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
|
6
6
|
import { User } from "../User/index.js";
|
|
7
7
|
export default class bt {
|
|
8
8
|
constructor(t, s) {
|
|
9
|
-
(this.
|
|
9
|
+
(this.yt = t), (this.u = s), (this.yt = t), (this.u = s);
|
|
10
10
|
}
|
|
11
11
|
getUserId() {
|
|
12
12
|
const t = this.u.tu(i.eu.su);
|
|
@@ -24,7 +24,7 @@ export default class bt {
|
|
|
24
24
|
this.u.uu(i.eu.su, new _t(t)), s && this.u.ou(t);
|
|
25
25
|
}
|
|
26
26
|
setCustomUserAttribute(t, s) {
|
|
27
|
-
if (this.
|
|
27
|
+
if (this.yt.hu(t))
|
|
28
28
|
return (
|
|
29
29
|
r.j.info('Custom Attribute "' + t + '" is blocklisted, ignoring.'), !1
|
|
30
30
|
);
|
|
@@ -52,10 +52,10 @@ export default class bt {
|
|
|
52
52
|
this.nu("custom_push_public_key", e, !1, !0),
|
|
53
53
|
this.nu("custom_push_user_auth", u, !1, !0),
|
|
54
54
|
this.nu("custom_push_vapid_public_key", o, !1, !0);
|
|
55
|
-
const h = r.
|
|
56
|
-
n = new r.
|
|
55
|
+
const h = r.ts.Zt,
|
|
56
|
+
n = new r.es(h, r.j),
|
|
57
57
|
l = new ti(t, s, e, u, o);
|
|
58
|
-
this.u.D(i.k.Bn, l.
|
|
58
|
+
this.u.D(i.k.Bn, l.tt()), n.setItem(h.rs.cu, h.ie, !0);
|
|
59
59
|
}
|
|
60
60
|
Nn(t) {
|
|
61
61
|
if (
|
|
@@ -65,9 +65,9 @@ export default class bt {
|
|
|
65
65
|
this.nu("custom_push_vapid_public_key", null, !1, !0),
|
|
66
66
|
t)
|
|
67
67
|
) {
|
|
68
|
-
const t = r.
|
|
69
|
-
s = new r.
|
|
70
|
-
this.u.D(i.k.Bn, !1), s.setItem(t.
|
|
68
|
+
const t = r.ts.Zt,
|
|
69
|
+
s = new r.es(t, r.j);
|
|
70
|
+
this.u.D(i.k.Bn, !1), s.setItem(t.rs.cu, t.ie, !1);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
}
|