@braze/web-sdk 4.2.1 → 4.4.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 +57 -6
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +8 -1
- package/shared-lib/encoding-utils.js +12 -1
- package/shared-lib/event-types.js +32 -1
- package/shared-lib/guid.js +10 -1
- package/shared-lib/indexed-db-adapter.js +315 -1
- package/shared-lib/logger.js +38 -1
- package/shared-lib/supported-options.js +26 -1
- package/src/Card/card-manager-factory.js +14 -1
- package/src/Card/card-manager.js +72 -1
- package/src/Card/display/card-display.js +134 -1
- package/src/Card/index.js +5 -1
- package/src/Card/log-card-click.js +11 -1
- package/src/Card/log-card-dismissal.js +11 -1
- package/src/Card/log-card-impressions.js +13 -1
- package/src/Card/log-content-card-impressions.js +4 -1
- package/src/Card/models/banner.js +30 -1
- package/src/Card/models/captioned-image.js +32 -1
- package/src/Card/models/card.js +174 -1
- package/src/Card/models/classic-card.js +32 -1
- package/src/Card/models/control-card.js +38 -1
- package/src/Card/models/index.js +5 -1
- package/src/Card/util/card-factory.js +104 -1
- package/src/ContentCards/content-cards-provider-factory.js +20 -1
- package/src/ContentCards/content-cards-provider.js +283 -1
- package/src/ContentCards/content-cards.js +24 -1
- package/src/ContentCards/get-cached-content-cards.js +5 -1
- package/src/ContentCards/index.js +8 -1
- package/src/ContentCards/log-content-cards-displayed.js +5 -1
- package/src/ContentCards/request-content-cards-refresh.js +5 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +14 -1
- package/src/ContentCards/ui/hide-content-cards.js +8 -1
- package/src/ContentCards/ui/show-content-cards.js +72 -1
- package/src/ContentCards/ui/toggle-content-cards.js +8 -1
- package/src/Core/add-sdk-metadata.js +27 -1
- package/src/Core/braze-sdk-metadata.js +10 -1
- package/src/Core/change-user.js +19 -1
- package/src/Core/destroy.js +5 -1
- package/src/Core/device-properties.js +9 -1
- package/src/Core/disable-sdk.js +10 -1
- package/src/Core/enable-sdk.js +8 -1
- package/src/Core/get-device-id.js +10 -1
- package/src/Core/get-user.js +4 -1
- package/src/Core/handle-braze-action.js +64 -1
- package/src/Core/index.js +23 -1
- package/src/Core/initialize.js +4 -1
- package/src/Core/is-disabled.js +4 -1
- package/src/Core/log-custom-event.js +36 -1
- package/src/Core/log-purchase.js +245 -1
- package/src/Core/open-session.js +23 -1
- package/src/Core/remove-all-subscriptions.js +4 -1
- package/src/Core/remove-subscription.js +4 -1
- package/src/Core/request-immediate-data-flush.js +4 -1
- package/src/Core/set-logger.js +4 -1
- package/src/Core/set-sdk-authentication-signature.js +9 -1
- package/src/Core/subscribe-to-sdk-authentication-failures.js +4 -1
- package/src/Core/toggle-logging.js +4 -1
- package/src/Core/wipe-data.js +15 -1
- package/src/FeatureFlags/feature-flag-factory.js +14 -0
- package/src/FeatureFlags/feature-flag.js +16 -0
- package/src/FeatureFlags/feature-flags-provider-factory.js +19 -0
- package/src/FeatureFlags/feature-flags-provider.js +94 -0
- package/src/FeatureFlags/get-all-feature-flags.js +12 -0
- package/src/FeatureFlags/get-feature-flag.js +12 -0
- package/src/FeatureFlags/index.js +4 -0
- package/src/FeatureFlags/refresh-feature-flags.js +9 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +6 -0
- package/src/Feed/feed-provider-factory.js +18 -1
- package/src/Feed/feed-provider.js +79 -1
- package/src/Feed/feed.js +20 -1
- package/src/Feed/get-cached-feed.js +5 -1
- package/src/Feed/index.js +8 -1
- package/src/Feed/log-feed-displayed.js +5 -1
- package/src/Feed/request-feed-refresh.js +5 -1
- package/src/Feed/subscribe-to-feed-updates.js +5 -1
- package/src/Feed/ui/hide-feed.js +7 -1
- package/src/Feed/ui/show-feed.js +89 -1
- package/src/Feed/ui/toggle-feed.js +8 -1
- package/src/InAppMessage/display/get-animation-effect.js +19 -1
- package/src/InAppMessage/display/html-message-to-html.js +223 -1
- package/src/InAppMessage/display/in-app-message-to-html.js +152 -1
- package/src/InAppMessage/display/modal-utils.js +68 -1
- package/src/InAppMessage/in-app-message-factory.js +145 -1
- package/src/InAppMessage/in-app-message-manager-factory.js +16 -1
- package/src/InAppMessage/in-app-message-manager.js +189 -1
- package/src/InAppMessage/index.js +14 -1
- package/src/InAppMessage/log-in-app-message-button-click.js +19 -1
- package/src/InAppMessage/log-in-app-message-click.js +16 -1
- package/src/InAppMessage/log-in-app-message-html-click.js +23 -1
- package/src/InAppMessage/log-in-app-message-impression.js +13 -1
- package/src/InAppMessage/models/control-message.js +8 -1
- package/src/InAppMessage/models/full-screen-message.js +71 -1
- package/src/InAppMessage/models/html-message.js +54 -1
- package/src/InAppMessage/models/in-app-message-button.js +40 -1
- package/src/InAppMessage/models/in-app-message.js +267 -1
- package/src/InAppMessage/models/modal-message.js +68 -1
- package/src/InAppMessage/models/slide-up-message.js +58 -1
- package/src/InAppMessage/models/templated-in-app-message.js +14 -1
- package/src/InAppMessage/subscribe-to-in-app-message.js +10 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +15 -1
- package/src/InAppMessage/ui/show-in-app-message.js +170 -1
- package/src/Push/index.js +5 -1
- package/src/Push/is-push-blocked.js +5 -1
- package/src/Push/is-push-permission-granted.js +5 -1
- package/src/Push/is-push-supported.js +5 -1
- package/src/Push/push-manager-factory.js +30 -1
- package/src/Push/push-manager.js +360 -1
- package/src/Push/request-push-permission.js +8 -1
- package/src/Push/unregister-push.js +5 -1
- package/src/Push/utils/push-utils.js +34 -1
- package/src/User/index.js +1 -1
- package/src/User/user-manager.js +70 -1
- package/src/User/user.js +278 -1
- package/src/common/base-feed.js +25 -1
- package/src/common/base-provider.js +6 -1
- package/src/common/constants.js +5 -1
- package/src/common/event-logger.js +24 -1
- package/src/common/feed-display.js +200 -1
- package/src/common/translations.js +148 -1
- package/src/index.js +9 -1
- package/src/l10n/l10n-manager-factory.js +22 -1
- package/src/l10n/l10n-manager.js +21 -1
- package/src/managers/auth-manager.js +48 -1
- package/src/managers/braze-instance.js +307 -1
- package/src/managers/device-manager.js +80 -1
- package/src/managers/network-manager.js +219 -1
- package/src/managers/server-config-manager.js +88 -1
- package/src/managers/session-manager.js +68 -1
- package/src/managers/storage-manager-factory.js +35 -1
- package/src/managers/storage-manager.js +394 -1
- package/src/managers/subscription-manager.js +25 -1
- package/src/models/backend-errors.js +8 -1
- package/src/models/braze-event.js +41 -1
- package/src/models/braze-sdk-metadata.js +10 -1
- package/src/models/device.js +26 -1
- package/src/models/identifier.js +20 -1
- package/src/models/push-token.js +22 -1
- package/src/models/request-result.js +8 -1
- package/src/models/server-config.js +32 -1
- package/src/request-controller.js +288 -1
- package/src/triggers/models/custom-event-data.js +14 -1
- package/src/triggers/models/custom-event-property-data.js +21 -1
- package/src/triggers/models/filter-set.js +55 -1
- package/src/triggers/models/filter.js +98 -1
- package/src/triggers/models/in-app-message-click-data.js +25 -1
- package/src/triggers/models/purchase-data.js +14 -1
- package/src/triggers/models/purchase-property-data.js +21 -1
- package/src/triggers/models/push-click-data.js +15 -1
- package/src/triggers/models/trigger-condition.js +109 -1
- package/src/triggers/models/trigger-events.js +8 -1
- package/src/triggers/models/trigger.js +110 -1
- package/src/triggers/triggers-provider-factory.js +30 -1
- package/src/triggers/triggers-provider.js +307 -1
- package/src/ui/js/attach-css.js +12 -1
- package/src/ui/js/feed-css.js +12 -1
- package/src/ui/js/iam-css.js +12 -1
- package/src/ui/js/index.js +3 -1
- package/src/ui/js/load-font-awesome.js +13 -1
- package/src/util/base-device-parser.js +14 -1
- package/src/util/braze-actions.js +79 -1
- package/src/util/browser-detector.js +85 -1
- package/src/util/client-hints-parser.js +60 -1
- package/src/util/code-utils.js +92 -1
- package/src/util/color-utils.js +23 -1
- package/src/util/component-utils.js +26 -1
- package/src/util/date-utils.js +27 -1
- package/src/util/deprecation-utils.js +5 -1
- package/src/util/device-constants.js +14 -1
- package/src/util/dom-utils.js +87 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/math.js +5 -1
- package/src/util/net.js +75 -1
- package/src/util/string-utils.js +22 -1
- package/src/util/url-utils.js +23 -1
- package/src/util/user-agent-parser.js +85 -1
- package/src/util/validation-utils.js +136 -1
- package/src/util/window-utils.js +35 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import r from "../../shared-lib/braze-shared-lib.js";
|
|
2
|
+
import e from "../managers/braze-instance.js";
|
|
3
|
+
import { newFeatureFlagFromJson as tt } from "./feature-flag-factory.js";
|
|
4
|
+
import ee from "./feature-flag.js";
|
|
5
|
+
import ir from "./feature-flags-provider-factory.js";
|
|
6
|
+
export function getFeatureFlag(a) {
|
|
7
|
+
if (!e.rr()) return;
|
|
8
|
+
if (!e.ir().ye())
|
|
9
|
+
return r.D.info("Feature flags are not enabled."), new ee(a);
|
|
10
|
+
const t = ir.er().xe();
|
|
11
|
+
return t[a] ? tt(t[a]) : new ee(a);
|
|
12
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { refreshFeatureFlags } from "./refresh-feature-flags.js";
|
|
2
|
+
export { getFeatureFlag } from "./get-feature-flag.js";
|
|
3
|
+
export { subscribeToFeatureFlagsUpdates } from "./subscribe-to-feature-flags-updates.js";
|
|
4
|
+
export { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import e from "../managers/braze-instance.js";
|
|
2
|
+
import ir from "./feature-flags-provider-factory.js";
|
|
3
|
+
function tr(r, t, a) {
|
|
4
|
+
if (e.rr()) return ir.er().refreshFeatureFlags(r, t, a);
|
|
5
|
+
}
|
|
6
|
+
export function refreshFeatureFlags(r, e) {
|
|
7
|
+
tr(r, e);
|
|
8
|
+
}
|
|
9
|
+
export default tr;
|
|
@@ -1 +1,18 @@
|
|
|
1
|
-
import e from"../managers/braze-instance.js";
|
|
1
|
+
import e from "../managers/braze-instance.js";
|
|
2
|
+
import re from "./feed-provider.js";
|
|
3
|
+
const ie = {
|
|
4
|
+
t: !1,
|
|
5
|
+
provider: null,
|
|
6
|
+
er: () => (
|
|
7
|
+
ie.o(),
|
|
8
|
+
ie.provider || ((ie.provider = new re(e.l(), e.mr())), e.ar(ie.provider)),
|
|
9
|
+
ie.provider
|
|
10
|
+
),
|
|
11
|
+
o: () => {
|
|
12
|
+
ie.t || (e.u(ie), (ie.t = !0));
|
|
13
|
+
},
|
|
14
|
+
destroy: () => {
|
|
15
|
+
(ie.provider = null), (ie.t = !1);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export default ie;
|
|
@@ -1 +1,79 @@
|
|
|
1
|
-
import y from"../common/base-provider.js";
|
|
1
|
+
import y from "../common/base-provider.js";
|
|
2
|
+
import e from "../managers/braze-instance.js";
|
|
3
|
+
import Feed from "./feed.js";
|
|
4
|
+
import {
|
|
5
|
+
newCardFromFeedJson as st,
|
|
6
|
+
newCardFromSerializedValue as S
|
|
7
|
+
} from "../Card/util/card-factory.js";
|
|
8
|
+
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
9
|
+
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
10
|
+
import u from "../managers/subscription-manager.js";
|
|
11
|
+
export default class re extends y {
|
|
12
|
+
constructor(t, s) {
|
|
13
|
+
super(),
|
|
14
|
+
(this.h = t),
|
|
15
|
+
(this.si = s),
|
|
16
|
+
(this.yt = new u()),
|
|
17
|
+
e.jt(this.yt),
|
|
18
|
+
this.zt();
|
|
19
|
+
}
|
|
20
|
+
zt() {
|
|
21
|
+
const t = this.h.I(o.q.ei) || [],
|
|
22
|
+
s = [];
|
|
23
|
+
for (let i = 0; i < t.length; i++) {
|
|
24
|
+
const e = S(t[i]);
|
|
25
|
+
null != e && s.push(e);
|
|
26
|
+
}
|
|
27
|
+
(this.Zt = s), (this.ri = w(this.h.I(o.q.hi)));
|
|
28
|
+
}
|
|
29
|
+
oi(t) {
|
|
30
|
+
const s = [];
|
|
31
|
+
let i = null;
|
|
32
|
+
const e = this.h.I(o.q.P) || {},
|
|
33
|
+
r = {};
|
|
34
|
+
for (let h = 0; h < t.length; h++) {
|
|
35
|
+
i = t[h];
|
|
36
|
+
const o = st(i);
|
|
37
|
+
null != o && (e[o.id] && ((o.viewed = !0), (r[o.id] = !0)), s.push(o));
|
|
38
|
+
}
|
|
39
|
+
this.h.B(o.q.P, r),
|
|
40
|
+
(this.Zt = s),
|
|
41
|
+
this.Ss(),
|
|
42
|
+
(this.ri = new Date()),
|
|
43
|
+
this.h.B(o.q.hi, this.ri);
|
|
44
|
+
}
|
|
45
|
+
Ss() {
|
|
46
|
+
const t = [];
|
|
47
|
+
for (let s = 0; s < this.Zt.length; s++) t.push(this.Zt[s].ss());
|
|
48
|
+
this.h.B(o.q.ei, t);
|
|
49
|
+
}
|
|
50
|
+
Rs(t) {
|
|
51
|
+
null != t &&
|
|
52
|
+
t.feed &&
|
|
53
|
+
(this.zt(),
|
|
54
|
+
this.oi(t.feed),
|
|
55
|
+
this.yt.St(new Feed(this.Zt.slice(), this.ri)));
|
|
56
|
+
}
|
|
57
|
+
ai() {
|
|
58
|
+
this.zt();
|
|
59
|
+
const t = [],
|
|
60
|
+
s = new Date();
|
|
61
|
+
for (let i = 0; i < this.Zt.length; i++)
|
|
62
|
+
(null == this.Zt[i].expiresAt || this.Zt[i].expiresAt >= s) &&
|
|
63
|
+
t.push(this.Zt[i]);
|
|
64
|
+
return new Feed(t, this.ri);
|
|
65
|
+
}
|
|
66
|
+
Is() {
|
|
67
|
+
this.si.requestFeedRefresh();
|
|
68
|
+
}
|
|
69
|
+
Ws(t) {
|
|
70
|
+
return this.yt.ut(t);
|
|
71
|
+
}
|
|
72
|
+
clearData(t) {
|
|
73
|
+
null == t && (t = !1),
|
|
74
|
+
(this.Zt = []),
|
|
75
|
+
(this.ri = null),
|
|
76
|
+
t && (this.h.Xs(o.q.ei), this.h.Xs(o.q.hi)),
|
|
77
|
+
this.yt.St(new Feed(this.Zt.slice(), this.ri));
|
|
78
|
+
}
|
|
79
|
+
}
|
package/src/Feed/feed.js
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
import x from"../common/base-feed.js";
|
|
1
|
+
import x from "../common/base-feed.js";
|
|
2
|
+
import { logCardClick, logCardImpressions } from "../Card/index.js";
|
|
3
|
+
import { requestFeedRefresh } from "./request-feed-refresh.js";
|
|
4
|
+
export default class Feed extends x {
|
|
5
|
+
constructor(r, e) {
|
|
6
|
+
super(r, e);
|
|
7
|
+
}
|
|
8
|
+
logCardImpressions(r) {
|
|
9
|
+
logCardImpressions(r, !1);
|
|
10
|
+
}
|
|
11
|
+
logCardClick(r) {
|
|
12
|
+
logCardClick(r, !1);
|
|
13
|
+
}
|
|
14
|
+
sr() {
|
|
15
|
+
requestFeedRefresh();
|
|
16
|
+
}
|
|
17
|
+
dr() {
|
|
18
|
+
return !1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import e from"../managers/braze-instance.js";
|
|
1
|
+
import e from "../managers/braze-instance.js";
|
|
2
|
+
import ie from "./feed-provider-factory.js";
|
|
3
|
+
export function getCachedFeed() {
|
|
4
|
+
if (e.rr()) return ie.er().ai();
|
|
5
|
+
}
|
package/src/Feed/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export{default as Feed}from"./feed.js";
|
|
1
|
+
export { default as Feed } from "./feed.js";
|
|
2
|
+
export { getCachedFeed } from "./get-cached-feed.js";
|
|
3
|
+
export { destroyFeed } from "./ui/hide-feed.js";
|
|
4
|
+
export { logFeedDisplayed } from "./log-feed-displayed.js";
|
|
5
|
+
export { requestFeedRefresh } from "./request-feed-refresh.js";
|
|
6
|
+
export { showFeed } from "./ui/show-feed.js";
|
|
7
|
+
export { subscribeToFeedUpdates } from "./subscribe-to-feed-updates.js";
|
|
8
|
+
export { toggleFeed } from "./ui/toggle-feed.js";
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import e from"../managers/braze-instance.js";
|
|
1
|
+
import e from "../managers/braze-instance.js";
|
|
2
|
+
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
+
export function logFeedDisplayed() {
|
|
4
|
+
if (e.rr()) return e.nr().yr(r.qr.Fr).S;
|
|
5
|
+
}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import e from"../managers/braze-instance.js";
|
|
1
|
+
import e from "../managers/braze-instance.js";
|
|
2
|
+
import ie from "./feed-provider-factory.js";
|
|
3
|
+
export function requestFeedRefresh() {
|
|
4
|
+
if (e.rr()) return ie.er().Is();
|
|
5
|
+
}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
import e from"../managers/braze-instance.js";
|
|
1
|
+
import e from "../managers/braze-instance.js";
|
|
2
|
+
import ie from "./feed-provider-factory.js";
|
|
3
|
+
export function subscribeToFeedUpdates(r) {
|
|
4
|
+
if (e.rr()) return ie.er().Ws(r);
|
|
5
|
+
}
|
package/src/Feed/ui/hide-feed.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
import e from"../../managers/braze-instance.js";
|
|
1
|
+
import e from "../../managers/braze-instance.js";
|
|
2
|
+
import { destroyFeedHtml as z } from "../../common/feed-display.js";
|
|
3
|
+
export function destroyFeed() {
|
|
4
|
+
if (!e.rr()) return;
|
|
5
|
+
const o = document.querySelectorAll(".ab-feed");
|
|
6
|
+
for (let e = 0; e < o.length; e++) z(o[e]);
|
|
7
|
+
}
|
package/src/Feed/ui/show-feed.js
CHANGED
|
@@ -1 +1,89 @@
|
|
|
1
|
-
import e,{OPTIONS as T
|
|
1
|
+
import e, { OPTIONS as T } from "../../managers/braze-instance.js";
|
|
2
|
+
import {
|
|
3
|
+
destroyFeedHtml as z,
|
|
4
|
+
detectFeedImpressions as q,
|
|
5
|
+
feedToHtml as I,
|
|
6
|
+
LAST_REQUESTED_REFRESH_DATA_ATTRIBUTE as L,
|
|
7
|
+
refreshFeed as M,
|
|
8
|
+
registerFeedSubscriptionId as $,
|
|
9
|
+
updateFeedCards as k
|
|
10
|
+
} from "../../common/feed-display.js";
|
|
11
|
+
import { Feed, logFeedDisplayed, subscribeToFeedUpdates } from "../index.js";
|
|
12
|
+
import ie from "../feed-provider-factory.js";
|
|
13
|
+
import { intersection as te } from "../../util/code-utils.js";
|
|
14
|
+
import { setCardHeight as A } from "../../Card/display/card-display.js";
|
|
15
|
+
import { setupFeedUI as B } from "../../ui/js/index.js";
|
|
16
|
+
import r from "../../../shared-lib/braze-shared-lib.js";
|
|
17
|
+
export function showFeed(t, n, o) {
|
|
18
|
+
if (!e.rr()) return;
|
|
19
|
+
B();
|
|
20
|
+
const s = (e, t) => {
|
|
21
|
+
if (null == t) return e;
|
|
22
|
+
const n = [];
|
|
23
|
+
for (let e = 0; e < t.length; e++) n.push(t[e].toLowerCase());
|
|
24
|
+
const o = [];
|
|
25
|
+
for (let t = 0; t < e.length; t++) {
|
|
26
|
+
const r = [];
|
|
27
|
+
for (let n = 0; n < e[t].categories.length; n++)
|
|
28
|
+
r.push(e[t].categories[n].toLowerCase());
|
|
29
|
+
te(r, n).length > 0 && o.push(e[t]);
|
|
30
|
+
}
|
|
31
|
+
return o;
|
|
32
|
+
},
|
|
33
|
+
i = e.nn(T.tn) || e.nn(T.en) || !1;
|
|
34
|
+
let l = !1;
|
|
35
|
+
null == t && ((t = document.body), (l = !0));
|
|
36
|
+
let a = !1,
|
|
37
|
+
f = null;
|
|
38
|
+
null == n
|
|
39
|
+
? ((f = ie.er().ai()),
|
|
40
|
+
k(f, s(f.cards, o), f.lastUpdated, null, i),
|
|
41
|
+
(a = !0))
|
|
42
|
+
: (f = new Feed(s(n, o), new Date()));
|
|
43
|
+
const u = I(f, i);
|
|
44
|
+
if (a) {
|
|
45
|
+
(null == f.lastUpdated ||
|
|
46
|
+
new Date().valueOf() - f.lastUpdated.valueOf() > Feed.ur) &&
|
|
47
|
+
(r.D.info(
|
|
48
|
+
`Cached feed was older than max TTL of ${Feed.ur} ms, requesting an update from the server.`
|
|
49
|
+
),
|
|
50
|
+
M(f, u));
|
|
51
|
+
const e = new Date().valueOf(),
|
|
52
|
+
t = subscribeToFeedUpdates(function(t) {
|
|
53
|
+
const n = u.querySelectorAll(".ab-refresh-button")[0];
|
|
54
|
+
if (null != n) {
|
|
55
|
+
let t = 500;
|
|
56
|
+
const o = parseInt(u.getAttribute(L));
|
|
57
|
+
isNaN(o)
|
|
58
|
+
? (t -= new Date().valueOf() - e)
|
|
59
|
+
: (t -= new Date().valueOf() - o),
|
|
60
|
+
setTimeout(function() {
|
|
61
|
+
n.className = n.className.replace(/fa-spin/g, "");
|
|
62
|
+
}, Math.max(t, 0));
|
|
63
|
+
}
|
|
64
|
+
k(f, s(t.cards, o), t.lastUpdated, u, i);
|
|
65
|
+
});
|
|
66
|
+
$(t, u);
|
|
67
|
+
}
|
|
68
|
+
const m = e => {
|
|
69
|
+
const t = e.querySelectorAll(".ab-feed");
|
|
70
|
+
let n = null;
|
|
71
|
+
for (let o = 0; o < t.length; o++) t[o].parentNode === e && (n = t[o]);
|
|
72
|
+
null != n ? (z(n), n.parentNode.replaceChild(u, n)) : e.appendChild(u),
|
|
73
|
+
setTimeout(function() {
|
|
74
|
+
u.className = u.className.replace("ab-hide", "ab-show");
|
|
75
|
+
}, 0),
|
|
76
|
+
l && u.focus(),
|
|
77
|
+
logFeedDisplayed(),
|
|
78
|
+
q(f, u),
|
|
79
|
+
A(f.cards, e);
|
|
80
|
+
};
|
|
81
|
+
var c;
|
|
82
|
+
null != t
|
|
83
|
+
? m(t)
|
|
84
|
+
: (window.onload =
|
|
85
|
+
((c = window.onload),
|
|
86
|
+
function() {
|
|
87
|
+
"function" == typeof c && c(), m(document.body);
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
import e from"../../managers/braze-instance.js";
|
|
1
|
+
import e from "../../managers/braze-instance.js";
|
|
2
|
+
import { destroyFeed, showFeed } from "../index.js";
|
|
3
|
+
export function toggleFeed(o, n, r) {
|
|
4
|
+
e.rr() &&
|
|
5
|
+
(document.querySelectorAll(".ab-feed").length > 0
|
|
6
|
+
? destroyFeed()
|
|
7
|
+
: showFeed(o, n, r));
|
|
8
|
+
}
|
|
@@ -1 +1,19 @@
|
|
|
1
|
-
import FullScreenMessage from"../models/full-screen-message.js";
|
|
1
|
+
import FullScreenMessage from "../models/full-screen-message.js";
|
|
2
|
+
import HtmlMessage from "../models/html-message.js";
|
|
3
|
+
import ModalMessage from "../models/modal-message.js";
|
|
4
|
+
import SlideUpMessage from "../models/slide-up-message.js";
|
|
5
|
+
export default function se(e) {
|
|
6
|
+
let s = "";
|
|
7
|
+
return (
|
|
8
|
+
e.animateIn && (s += " ab-animate-in"),
|
|
9
|
+
e.animateOut && (s += " ab-animate-out"),
|
|
10
|
+
e instanceof FullScreenMessage
|
|
11
|
+
? (s += " ab-effect-fullscreen")
|
|
12
|
+
: e instanceof HtmlMessage
|
|
13
|
+
? (s += " ab-effect-html")
|
|
14
|
+
: e instanceof ModalMessage
|
|
15
|
+
? (s += " ab-effect-modal")
|
|
16
|
+
: e instanceof SlideUpMessage && (s += " ab-effect-slide"),
|
|
17
|
+
s
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -1 +1,223 @@
|
|
|
1
|
-
import{attachInAppMessageCSS as nt
|
|
1
|
+
import { attachInAppMessageCSS as nt } from "../../ui/js/iam-css.js";
|
|
2
|
+
import ot from "../../util/browser-detector.js";
|
|
3
|
+
import { logInAppMessageHtmlClick } from "../log-in-app-message-html-click.js";
|
|
4
|
+
import { getUser as Q } from "../../Core/get-user.js";
|
|
5
|
+
import { InAppMessage } from "../index.js";
|
|
6
|
+
import { keys as rr } from "../../util/code-utils.js";
|
|
7
|
+
import { OperatingSystems as rt } from "../../util/device-constants.js";
|
|
8
|
+
import { parseQueryStringKeyValues as it } from "../../util/url-utils.js";
|
|
9
|
+
import { WindowUtils as H } from "../../util/window-utils.js";
|
|
10
|
+
export default function ut(t, n, e, o, s, r) {
|
|
11
|
+
const i = document.createElement("iframe");
|
|
12
|
+
i.setAttribute("title", "Modal Message"), s && (i.style.zIndex = s + 1);
|
|
13
|
+
const u = n => {
|
|
14
|
+
const e = n.getAttribute("href"),
|
|
15
|
+
s = n.onclick;
|
|
16
|
+
return r => {
|
|
17
|
+
if (null != s && "function" == typeof s && !1 === s()) return;
|
|
18
|
+
let u = it(e).abButtonId;
|
|
19
|
+
if (
|
|
20
|
+
((null != u && "" !== u) || (u = n.getAttribute("id")),
|
|
21
|
+
null != e && "" !== e && 0 !== e.indexOf("#"))
|
|
22
|
+
) {
|
|
23
|
+
const s =
|
|
24
|
+
"blank" ===
|
|
25
|
+
(n.getAttribute("target") || "").toLowerCase().replace("_", ""),
|
|
26
|
+
c = o || t.openTarget === InAppMessage.OpenTarget.BLANK || s,
|
|
27
|
+
a = () => {
|
|
28
|
+
logInAppMessageHtmlClick(t, u, e), H.openUri(e, c, r);
|
|
29
|
+
};
|
|
30
|
+
c ? a() : t.on(i, a);
|
|
31
|
+
} else logInAppMessageHtmlClick(t, u, e);
|
|
32
|
+
return r.stopPropagation(), !1;
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
c = (t, n, e) => {
|
|
36
|
+
const o = `([\\w]+)\\s*=\\s*document.createElement\\(['"]${e}['"]\\)`,
|
|
37
|
+
s = t.match(new RegExp(o));
|
|
38
|
+
if (s) {
|
|
39
|
+
const e = `${s[1]}.setAttribute("nonce", "${n}")`;
|
|
40
|
+
return `${t.slice(0, s.index + s[0].length)};${e};${t.slice(
|
|
41
|
+
s.index + s[0].length
|
|
42
|
+
)}`;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
if (
|
|
47
|
+
((i.onload = () => {
|
|
48
|
+
let o = null;
|
|
49
|
+
if (null != r) {
|
|
50
|
+
(o = document.createElement("html")), (o.innerHTML = t.message);
|
|
51
|
+
const n = o.getElementsByTagName("style");
|
|
52
|
+
for (let t = 0; t < n.length; t++) n[t].setAttribute("nonce", r);
|
|
53
|
+
const e = o.getElementsByTagName("script");
|
|
54
|
+
for (let t = 0; t < e.length; t++) {
|
|
55
|
+
e[t].setAttribute("nonce", r),
|
|
56
|
+
(e[t].innerHTML = e[t].innerHTML.replace(
|
|
57
|
+
/<style>/g,
|
|
58
|
+
`<style nonce='${r}'>`
|
|
59
|
+
));
|
|
60
|
+
const n = c(e[t].innerHTML, r, "script");
|
|
61
|
+
n && (e[t].innerHTML = n);
|
|
62
|
+
const o = c(e[t].innerHTML, r, "style");
|
|
63
|
+
o && (e[t].innerHTML = o);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
i.contentWindow.focus(),
|
|
67
|
+
i.contentWindow.document.write(o ? o.innerHTML : t.message);
|
|
68
|
+
const s = i.contentWindow.document.getElementsByTagName("head")[0];
|
|
69
|
+
if (null != s) {
|
|
70
|
+
if ((nt(s), t.sn())) {
|
|
71
|
+
const n = document.createElement("style");
|
|
72
|
+
(n.innerHTML = t.css),
|
|
73
|
+
(n.id = t.rn()),
|
|
74
|
+
null != r && n.setAttribute("nonce", r),
|
|
75
|
+
s.appendChild(n);
|
|
76
|
+
}
|
|
77
|
+
const n = i.contentWindow.document.createElement("base");
|
|
78
|
+
n.setAttribute("target", "_parent"), s.appendChild(n);
|
|
79
|
+
}
|
|
80
|
+
const a = i.contentWindow.document.getElementsByTagName("title");
|
|
81
|
+
a.length > 0 && i.setAttribute("title", a[0].textContent);
|
|
82
|
+
const l = {
|
|
83
|
+
closeMessage: function() {
|
|
84
|
+
t.on(i);
|
|
85
|
+
},
|
|
86
|
+
logClick: function() {
|
|
87
|
+
const n = [t, ...arguments];
|
|
88
|
+
logInAppMessageHtmlClick.apply(t, Array.prototype.slice.call(n));
|
|
89
|
+
},
|
|
90
|
+
display: {},
|
|
91
|
+
web: {}
|
|
92
|
+
},
|
|
93
|
+
requestPushPermission = function() {
|
|
94
|
+
return function() {
|
|
95
|
+
const t = arguments;
|
|
96
|
+
import("../../Push/request-push-permission.js").then(n => {
|
|
97
|
+
n.requestPushPermission.apply(
|
|
98
|
+
null,
|
|
99
|
+
Array.prototype.slice.call(t)
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
m = {
|
|
105
|
+
requestImmediateDataFlush: async function() {
|
|
106
|
+
const t = arguments,
|
|
107
|
+
n = await import("../../Core/request-immediate-data-flush.js");
|
|
108
|
+
n.requestImmediateDataFlush.apply(
|
|
109
|
+
null,
|
|
110
|
+
Array.prototype.slice.call(t)
|
|
111
|
+
);
|
|
112
|
+
},
|
|
113
|
+
logCustomEvent: async function() {
|
|
114
|
+
const t = arguments,
|
|
115
|
+
n = await import("../../Core/log-custom-event.js");
|
|
116
|
+
n.logCustomEvent.apply(null, Array.prototype.slice.call(t));
|
|
117
|
+
},
|
|
118
|
+
logPurchase: async function() {
|
|
119
|
+
const t = arguments,
|
|
120
|
+
n = await import("../../Core/log-purchase.js");
|
|
121
|
+
n.logPurchase.apply(null, Array.prototype.slice.call(t));
|
|
122
|
+
},
|
|
123
|
+
unregisterPush: async function() {
|
|
124
|
+
const t = arguments,
|
|
125
|
+
n = await import("../../Push/unregister-push.js");
|
|
126
|
+
n.unregisterPush.apply(null, Array.prototype.slice.call(t));
|
|
127
|
+
},
|
|
128
|
+
requestPushPermission: requestPushPermission(),
|
|
129
|
+
changeUser: async function() {
|
|
130
|
+
const t = arguments,
|
|
131
|
+
n = await import("../../Core/change-user.js");
|
|
132
|
+
n.changeUser.apply(null, Array.prototype.slice.call(t));
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
f = function(t) {
|
|
136
|
+
return function() {
|
|
137
|
+
m[t].apply(null, Array.prototype.slice.call(arguments));
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
for (const t of rr(m)) l[t] = f(t);
|
|
141
|
+
const p = [
|
|
142
|
+
"setFirstName",
|
|
143
|
+
"setLastName",
|
|
144
|
+
"setEmail",
|
|
145
|
+
"setGender",
|
|
146
|
+
"setDateOfBirth",
|
|
147
|
+
"setCountry",
|
|
148
|
+
"setHomeCity",
|
|
149
|
+
"setEmailNotificationSubscriptionType",
|
|
150
|
+
"setLanguage",
|
|
151
|
+
"addAlias",
|
|
152
|
+
"setPushNotificationSubscriptionType",
|
|
153
|
+
"setPhoneNumber",
|
|
154
|
+
"setCustomUserAttribute",
|
|
155
|
+
"addToCustomAttributeArray",
|
|
156
|
+
"removeFromCustomAttributeArray",
|
|
157
|
+
"incrementCustomUserAttribute",
|
|
158
|
+
"setCustomLocationAttribute",
|
|
159
|
+
"addToSubscriptionGroup",
|
|
160
|
+
"removeFromSubscriptionGroup"
|
|
161
|
+
],
|
|
162
|
+
d = function(t) {
|
|
163
|
+
return function() {
|
|
164
|
+
const n = Q();
|
|
165
|
+
n[t].apply(n, Array.prototype.slice.call(arguments));
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
y = {};
|
|
169
|
+
for (let t = 0; t < p.length; t++) y[p[t]] = d(p[t]);
|
|
170
|
+
l.getUser = function() {
|
|
171
|
+
return y;
|
|
172
|
+
};
|
|
173
|
+
const b = { showFeed: n },
|
|
174
|
+
g = function(n) {
|
|
175
|
+
return function() {
|
|
176
|
+
const e = arguments;
|
|
177
|
+
t.on(i, function() {
|
|
178
|
+
b[n].apply(null, Array.prototype.slice.call(e));
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
for (const t of rr(b)) l.display[t] = g(t);
|
|
183
|
+
const h = { registerAppboyPushMessages: requestPushPermission() },
|
|
184
|
+
A = function(t) {
|
|
185
|
+
return function() {
|
|
186
|
+
h[t].apply(null, Array.prototype.slice.call(arguments));
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
for (const t of rr(h)) l.web[t] = A(t);
|
|
190
|
+
if (
|
|
191
|
+
((i.contentWindow.appboyBridge = l),
|
|
192
|
+
(i.contentWindow.brazeBridge = l),
|
|
193
|
+
t.un !== InAppMessage.es.cn)
|
|
194
|
+
) {
|
|
195
|
+
const t = i.contentWindow.document.getElementsByTagName("a");
|
|
196
|
+
for (let n = 0; n < t.length; n++) t[n].onclick = u(t[n]);
|
|
197
|
+
const n = i.contentWindow.document.getElementsByTagName("button");
|
|
198
|
+
for (let t = 0; t < n.length; t++) n[t].onclick = u(n[t]);
|
|
199
|
+
}
|
|
200
|
+
const j = i.contentWindow.document.body;
|
|
201
|
+
if (null != j) {
|
|
202
|
+
t.an() && (j.id = t.htmlId);
|
|
203
|
+
const n = document.createElement("hidden");
|
|
204
|
+
(n.onclick = l.closeMessage),
|
|
205
|
+
(n.className = "ab-programmatic-close-button"),
|
|
206
|
+
j.appendChild(n);
|
|
207
|
+
}
|
|
208
|
+
i.contentWindow.dispatchEvent(new CustomEvent("ab.BridgeReady")),
|
|
209
|
+
-1 !== i.className.indexOf("ab-start-hidden") &&
|
|
210
|
+
((i.className = i.className.replace("ab-start-hidden", "")), e(i)),
|
|
211
|
+
document.activeElement !== i && i.focus();
|
|
212
|
+
}),
|
|
213
|
+
(i.className =
|
|
214
|
+
"ab-in-app-message ab-start-hidden ab-html-message ab-modal-interactions"),
|
|
215
|
+
ot.OS === rt.ln)
|
|
216
|
+
) {
|
|
217
|
+
const n = document.createElement("div");
|
|
218
|
+
return (
|
|
219
|
+
(n.className = "ab-ios-scroll-wrapper"), n.appendChild(i), (t.mn = n), n
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
return (t.mn = i), i;
|
|
223
|
+
}
|