@braze/web-sdk 4.3.0 → 4.5.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 +68 -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 +175 -1
- package/src/Card/models/classic-card.js +32 -1
- package/src/Card/models/control-card.js +39 -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 +19 -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 +271 -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,94 @@
|
|
|
1
|
+
import r from "../../shared-lib/braze-shared-lib.js";
|
|
2
|
+
import y from "../common/base-provider.js";
|
|
3
|
+
import e from "../managers/braze-instance.js";
|
|
4
|
+
import { STORAGE_KEYS as o } from "../managers/storage-manager.js";
|
|
5
|
+
import u from "../managers/subscription-manager.js";
|
|
6
|
+
import b from "../util/net.js";
|
|
7
|
+
import {
|
|
8
|
+
newFeatureFlagFromJson as tt,
|
|
9
|
+
newFeatureFlagFromSerializedValue as et
|
|
10
|
+
} from "./feature-flag-factory.js";
|
|
11
|
+
export default class er extends y {
|
|
12
|
+
constructor(t, s, r) {
|
|
13
|
+
super(),
|
|
14
|
+
(this.gt = t),
|
|
15
|
+
(this.vt = s),
|
|
16
|
+
(this.h = r),
|
|
17
|
+
(this.he = new u()),
|
|
18
|
+
e.jt(this.he);
|
|
19
|
+
}
|
|
20
|
+
Rs(t) {
|
|
21
|
+
if (this.gt.ye() && null != t && t.feature_flags) {
|
|
22
|
+
this.De = [];
|
|
23
|
+
for (const e of t.feature_flags) {
|
|
24
|
+
let t = tt(e);
|
|
25
|
+
t && this.De.push(t);
|
|
26
|
+
}
|
|
27
|
+
(this.Ne = new Date().getTime()), this._e(), this.he.St(this.De);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
xe() {
|
|
31
|
+
const t = this.h.I(o.q.ze) || {};
|
|
32
|
+
let e = {};
|
|
33
|
+
for (let s in t) {
|
|
34
|
+
let r = et(t[s]);
|
|
35
|
+
r && (e[r.id] = r);
|
|
36
|
+
}
|
|
37
|
+
return e;
|
|
38
|
+
}
|
|
39
|
+
Ws(t) {
|
|
40
|
+
return this.he.ut(t);
|
|
41
|
+
}
|
|
42
|
+
refreshFeatureFlags(t, e, s) {
|
|
43
|
+
if (!this.Re(s))
|
|
44
|
+
return void (
|
|
45
|
+
this.Se ||
|
|
46
|
+
(this.Se = this.gt.Te(() => {
|
|
47
|
+
this.refreshFeatureFlags(t, e);
|
|
48
|
+
}))
|
|
49
|
+
);
|
|
50
|
+
const r = this.vt.Ps({}, !0),
|
|
51
|
+
i = this.vt.Bs(r, !1, !0);
|
|
52
|
+
this.vt.Gs(r, () => {
|
|
53
|
+
b.Hs({
|
|
54
|
+
url: `${this.vt.Ks()}/feature_flags/sync`,
|
|
55
|
+
headers: i,
|
|
56
|
+
data: r,
|
|
57
|
+
S: s => {
|
|
58
|
+
this.vt.Os(r, s)
|
|
59
|
+
? (this.vt.Qs(), this.Rs(s), "function" == typeof t && t())
|
|
60
|
+
: "function" == typeof e && e();
|
|
61
|
+
},
|
|
62
|
+
error: t => {
|
|
63
|
+
this.vt.Vs(t, "retrieving feature flags"),
|
|
64
|
+
"function" == typeof e && e();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
Re(t) {
|
|
70
|
+
if (!t) {
|
|
71
|
+
const t = parseFloat(this.gt.$e());
|
|
72
|
+
let e = !1;
|
|
73
|
+
if (!isNaN(t)) {
|
|
74
|
+
if (-1 === t) return r.D.info("Feature flag refreshes not allowed"), !1;
|
|
75
|
+
e = new Date().getTime() >= (this.Ne || 0) + 1e3 * t;
|
|
76
|
+
}
|
|
77
|
+
if (!e)
|
|
78
|
+
return (
|
|
79
|
+
r.D.info(`Feature flag refreshes were rate limited to ${t} seconds`),
|
|
80
|
+
!1
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return this.gt.ye();
|
|
84
|
+
}
|
|
85
|
+
_e() {
|
|
86
|
+
const t = {};
|
|
87
|
+
for (let e = 0; e < this.De.length; e++) {
|
|
88
|
+
let s = this.De[e],
|
|
89
|
+
r = s.ss();
|
|
90
|
+
t[s.id] = r;
|
|
91
|
+
}
|
|
92
|
+
this.h.B(o.q.ze, t), this.h.B(o.q.qe, this.Ne);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -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 ir from "./feature-flags-provider-factory.js";
|
|
5
|
+
export function getAllFeatureFlags() {
|
|
6
|
+
if (!e.rr()) return;
|
|
7
|
+
let t = [];
|
|
8
|
+
if (!e.ir().ye()) return r.D.info("Feature flags are not enabled."), t;
|
|
9
|
+
const a = ir.er().xe();
|
|
10
|
+
for (let r in a) t.push(tt(a[r]));
|
|
11
|
+
return t;
|
|
12
|
+
}
|
|
@@ -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
|
+
}
|