@braze/web-sdk 4.7.1 → 4.8.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 +27 -24
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +5 -5
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +24 -24
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +17 -17
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +18 -18
- package/src/Card/card-manager-factory.js +2 -2
- package/src/Card/card-manager.js +47 -41
- package/src/Card/display/card-display.js +70 -67
- package/src/Card/log-card-click.js +1 -1
- package/src/Card/log-card-dismissal.js +1 -1
- package/src/Card/log-card-impressions.js +3 -3
- package/src/Card/models/banner.js +3 -2
- package/src/Card/models/captioned-image.js +6 -5
- package/src/Card/models/card.js +107 -87
- package/src/Card/models/classic-card.js +5 -5
- package/src/Card/models/control-card.js +5 -21
- package/src/Card/types.js +1 -0
- package/src/Card/util/card-factory.js +32 -32
- package/src/ContentCards/content-cards-provider-factory.js +3 -3
- package/src/ContentCards/content-cards-provider.js +283 -175
- package/src/ContentCards/content-cards.js +2 -2
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/log-content-cards-displayed.js +2 -2
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +9 -6
- package/src/ContentCards/types.js +1 -0
- package/src/ContentCards/ui/hide-content-cards.js +2 -2
- package/src/ContentCards/ui/show-content-cards.js +35 -33
- package/src/Core/add-sdk-metadata.js +17 -18
- package/src/Core/change-user.js +12 -14
- package/src/Core/destroy.js +1 -1
- package/src/Core/disable-sdk.js +7 -6
- package/src/Core/enable-sdk.js +4 -4
- package/src/Core/get-device-id.js +7 -6
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +57 -40
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/log-custom-event.js +22 -15
- package/src/Core/log-purchase.js +33 -33
- package/src/Core/open-session.js +17 -15
- package/src/Core/request-immediate-data-flush.js +4 -2
- package/src/Core/set-logger.js +1 -1
- package/src/Core/set-sdk-authentication-signature.js +5 -6
- package/src/Core/subscribe-to-sdk-authentication-failures.js +3 -1
- package/src/Core/toggle-logging.js +1 -1
- package/src/Core/types.js +1 -0
- package/src/Core/wipe-data.js +11 -10
- package/src/FeatureFlags/feature-flag-factory.js +6 -6
- package/src/FeatureFlags/feature-flag.js +17 -17
- package/src/FeatureFlags/feature-flags-provider-factory.js +2 -2
- package/src/FeatureFlags/feature-flags-provider.js +67 -65
- package/src/FeatureFlags/get-all-feature-flags.js +3 -3
- package/src/FeatureFlags/get-feature-flag.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +4 -1
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +57 -46
- package/src/Feed/feed.js +1 -1
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/log-feed-displayed.js +3 -1
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/types.js +1 -0
- package/src/Feed/ui/hide-feed.js +2 -2
- package/src/Feed/ui/show-feed.js +40 -36
- package/src/InAppMessage/display/html-message-to-html.js +125 -119
- package/src/InAppMessage/display/in-app-message-to-html.js +72 -69
- package/src/InAppMessage/display/modal-utils.js +18 -13
- package/src/InAppMessage/in-app-message-factory.js +9 -8
- package/src/InAppMessage/in-app-message-manager-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +122 -108
- package/src/InAppMessage/log-in-app-message-button-click.js +10 -10
- package/src/InAppMessage/log-in-app-message-click.js +9 -9
- package/src/InAppMessage/log-in-app-message-html-click.js +10 -10
- package/src/InAppMessage/log-in-app-message-impression.js +5 -5
- package/src/InAppMessage/models/control-message.js +4 -1
- package/src/InAppMessage/models/full-screen-message.js +35 -37
- package/src/InAppMessage/models/html-message.js +34 -33
- package/src/InAppMessage/models/in-app-message-button.js +23 -16
- package/src/InAppMessage/models/in-app-message.js +147 -105
- package/src/InAppMessage/models/modal-message.js +34 -36
- package/src/InAppMessage/models/slide-up-message.js +25 -27
- package/src/InAppMessage/models/templated-in-app-message.js +12 -7
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/types.js +1 -0
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +4 -4
- package/src/InAppMessage/ui/show-in-app-message.js +95 -89
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -0
- 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 +20 -20
- package/src/Push/push-manager.js +192 -174
- package/src/Push/request-push-permission.js +4 -3
- package/src/Push/types.js +1 -0
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +10 -10
- package/src/User/types.js +1 -0
- package/src/User/user-manager.js +24 -24
- package/src/User/user.js +117 -105
- package/src/common/base-feed.js +7 -7
- package/src/common/base-provider.js +2 -2
- package/src/common/constants.js +6 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +18 -18
- package/src/common/types.js +1 -0
- package/src/l10n/l10n-manager-factory.js +5 -5
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +32 -32
- package/src/managers/braze-instance.js +204 -202
- package/src/managers/device-manager.js +23 -23
- package/src/managers/network-manager.js +96 -82
- package/src/managers/server-config-manager.js +60 -42
- package/src/managers/session-manager.js +41 -41
- package/src/managers/storage-manager-factory.js +15 -15
- package/src/managers/storage-manager.js +165 -155
- package/src/managers/subscription-manager.js +11 -11
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +7 -7
- package/src/models/push-token.js +7 -7
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +20 -20
- package/src/request-controller.js +176 -174
- package/src/triggers/models/custom-event-data.js +6 -6
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +64 -64
- package/src/triggers/models/in-app-message-click-data.js +12 -12
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +9 -9
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +52 -52
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +42 -42
- package/src/triggers/triggers-provider-factory.js +8 -8
- package/src/triggers/triggers-provider.js +171 -168
- package/src/types.js +1 -0
- package/src/ui/js/attach-css.js +3 -3
- package/src/ui/js/load-font-awesome.js +2 -2
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +20 -20
- package/src/util/browser-detector.js +22 -22
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/code-utils.js +1 -1
- package/src/util/color-utils.js +2 -2
- package/src/util/component-utils.js +2 -2
- package/src/util/deprecation-utils.js +1 -1
- package/src/util/device-constants.js +5 -5
- package/src/util/dom-utils.js +2 -2
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +11 -11
- package/src/util/request-header-utils.js +23 -0
- package/src/util/string-utils.js +1 -1
- package/src/util/user-agent-parser.js +20 -20
- package/src/util/validation-utils.js +44 -44
- package/src/util/window-utils.js +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
|
-
import { keys as
|
|
2
|
+
import { keys as oo } from "../util/code-utils.js";
|
|
3
3
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
4
|
+
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
|
|
4
5
|
export function wipeData() {
|
|
5
|
-
if (null == e.l())
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
for (let
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
new r.
|
|
6
|
+
if (null == e.l()) throw new Error(P);
|
|
7
|
+
const o = e.l();
|
|
8
|
+
o && o.clearData();
|
|
9
|
+
const t = oo(r.zt);
|
|
10
|
+
for (let o = 0; o < t.length; o++) {
|
|
11
|
+
const n = t[o],
|
|
12
|
+
s = r.zt[n];
|
|
13
|
+
new r.xt(s, r.j).clearData();
|
|
13
14
|
}
|
|
14
|
-
if (e.rr()) for (const
|
|
15
|
+
if (e.rr()) for (const o of e.gr()) o.clearData(!0);
|
|
15
16
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
2
2
|
import FeatureFlag from "./feature-flag.js";
|
|
3
3
|
export function newFeatureFlagFromJson(e) {
|
|
4
|
-
if (e[FeatureFlag.
|
|
4
|
+
if (e[FeatureFlag.Tt.ns] && "boolean" == typeof e[FeatureFlag.Tt.Fe])
|
|
5
5
|
return new FeatureFlag(
|
|
6
|
-
e[FeatureFlag.
|
|
7
|
-
e[FeatureFlag.
|
|
8
|
-
e[FeatureFlag.
|
|
6
|
+
e[FeatureFlag.Tt.ns],
|
|
7
|
+
e[FeatureFlag.Tt.Fe],
|
|
8
|
+
e[FeatureFlag.Tt.we]
|
|
9
9
|
);
|
|
10
|
-
r.
|
|
10
|
+
r.j.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
|
|
11
11
|
}
|
|
12
12
|
export function newFeatureFlagFromSerializedValue(e) {
|
|
13
13
|
if (e[FeatureFlag.hs.ns] && "boolean" == typeof e[FeatureFlag.hs.Fe])
|
|
@@ -16,7 +16,7 @@ export function newFeatureFlagFromSerializedValue(e) {
|
|
|
16
16
|
e[FeatureFlag.hs.Fe],
|
|
17
17
|
e[FeatureFlag.hs.we]
|
|
18
18
|
);
|
|
19
|
-
r.
|
|
19
|
+
r.j.info(
|
|
20
20
|
`Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`
|
|
21
21
|
);
|
|
22
22
|
}
|
|
@@ -11,26 +11,26 @@ export default class FeatureFlag {
|
|
|
11
11
|
getStringProperty(t) {
|
|
12
12
|
const r = this.properties[t];
|
|
13
13
|
return null == r
|
|
14
|
-
? (this.
|
|
15
|
-
: this.
|
|
14
|
+
? (this.Er(t), null)
|
|
15
|
+
: this.Br(r)
|
|
16
16
|
? r.value
|
|
17
|
-
: (this.
|
|
17
|
+
: (this.Ir("string"), null);
|
|
18
18
|
}
|
|
19
19
|
getNumberProperty(t) {
|
|
20
20
|
const r = this.properties[t];
|
|
21
21
|
return null == r
|
|
22
|
-
? (this.
|
|
23
|
-
: this.
|
|
22
|
+
? (this.Er(t), null)
|
|
23
|
+
: this.Nr(r)
|
|
24
24
|
? r.value
|
|
25
|
-
: (this.
|
|
25
|
+
: (this.Ir("number"), null);
|
|
26
26
|
}
|
|
27
27
|
getBooleanProperty(t) {
|
|
28
28
|
const r = this.properties[t];
|
|
29
29
|
return null == r
|
|
30
|
-
? (this.
|
|
31
|
-
: this.
|
|
30
|
+
? (this.Er(t), null)
|
|
31
|
+
: this.Tr(r)
|
|
32
32
|
? r.value
|
|
33
|
-
: (this.
|
|
33
|
+
: (this.Ir("boolean"), null);
|
|
34
34
|
}
|
|
35
35
|
ss() {
|
|
36
36
|
const t = {};
|
|
@@ -41,21 +41,21 @@ export default class FeatureFlag {
|
|
|
41
41
|
t
|
|
42
42
|
);
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
r.
|
|
46
|
-
}
|
|
47
|
-
yr(t) {
|
|
48
|
-
r.D.info(`${t} not found in feature flag properties.`);
|
|
44
|
+
Ir(t) {
|
|
45
|
+
r.j.info(`Property is not of type ${t}.`);
|
|
49
46
|
}
|
|
50
47
|
Er(t) {
|
|
48
|
+
r.j.info(`${t} not found in feature flag properties.`);
|
|
49
|
+
}
|
|
50
|
+
Br(t) {
|
|
51
51
|
return "string" === t.type && "string" == typeof t.value;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
Nr(t) {
|
|
54
54
|
return "number" === t.type && "number" == typeof t.value;
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
Tr(t) {
|
|
57
57
|
return "boolean" === t.type && "boolean" == typeof t.value;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
(FeatureFlag.hs = { ns: "id", Fe: "e", we: "pr" }),
|
|
61
|
-
(FeatureFlag.
|
|
61
|
+
(FeatureFlag.Tt = { ns: "id", Fe: "enabled", we: "properties" });
|
|
@@ -6,11 +6,11 @@ const ir = {
|
|
|
6
6
|
er: () => (
|
|
7
7
|
ir.o(),
|
|
8
8
|
ir.provider ||
|
|
9
|
-
((ir.provider = new er(e.
|
|
9
|
+
((ir.provider = new er(e.tr(), e.ar(), e.l())), e.dr(ir.provider)),
|
|
10
10
|
ir.provider
|
|
11
11
|
),
|
|
12
12
|
o: () => {
|
|
13
|
-
ir.t || (e.
|
|
13
|
+
ir.t || (e.g(ir), (ir.t = !0));
|
|
14
14
|
},
|
|
15
15
|
destroy: () => {
|
|
16
16
|
(ir.provider = null), (ir.t = !1);
|
|
@@ -1,45 +1,46 @@
|
|
|
1
1
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
2
2
|
import y from "../common/base-provider.js";
|
|
3
3
|
import e from "../managers/braze-instance.js";
|
|
4
|
-
import { STORAGE_KEYS as
|
|
5
|
-
import
|
|
6
|
-
import { randomInclusive as
|
|
7
|
-
import
|
|
4
|
+
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
5
|
+
import E from "../managers/subscription-manager.js";
|
|
6
|
+
import { randomInclusive as D } from "../util/math.js";
|
|
7
|
+
import C from "../util/net.js";
|
|
8
8
|
import {
|
|
9
9
|
newFeatureFlagFromJson as st,
|
|
10
10
|
newFeatureFlagFromSerializedValue as it
|
|
11
11
|
} from "./feature-flag-factory.js";
|
|
12
|
+
import T from "../util/request-header-utils.js";
|
|
12
13
|
export default class er extends y {
|
|
13
14
|
constructor(t, s, i) {
|
|
14
15
|
super(),
|
|
15
|
-
(this.
|
|
16
|
-
(this.
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
25
|
-
(this.
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
28
|
-
e.jt(this.
|
|
16
|
+
(this.wt = t),
|
|
17
|
+
(this.gt = s),
|
|
18
|
+
(this.u = i),
|
|
19
|
+
(this.mi = []),
|
|
20
|
+
(this.pi = 0),
|
|
21
|
+
(this.wt = t),
|
|
22
|
+
(this.gt = s),
|
|
23
|
+
(this.u = i),
|
|
24
|
+
(this.gi = null),
|
|
25
|
+
(this.Fi = new E()),
|
|
26
|
+
(this.wi = 10),
|
|
27
|
+
(this.yi = null),
|
|
28
|
+
(this.ji = null),
|
|
29
|
+
e.jt(this.Fi);
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
if ((!this.
|
|
32
|
-
this.
|
|
31
|
+
Ts(t) {
|
|
32
|
+
if ((!this.wt || this.wt.bi()) && null != t && t.feature_flags) {
|
|
33
|
+
this.mi = [];
|
|
33
34
|
for (const s of t.feature_flags) {
|
|
34
35
|
const t = st(s);
|
|
35
|
-
t && this.
|
|
36
|
+
t && this.mi.push(t);
|
|
36
37
|
}
|
|
37
|
-
(this.
|
|
38
|
+
(this.pi = new Date().getTime()), this.vi(), this.Fi.Et(this.mi);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
Ti() {
|
|
41
42
|
let t = {};
|
|
42
|
-
this.
|
|
43
|
+
this.u && (t = this.u.v(i.k.Di));
|
|
43
44
|
const s = {};
|
|
44
45
|
for (const i in t) {
|
|
45
46
|
const e = it(t[i]);
|
|
@@ -47,84 +48,85 @@ export default class er extends y {
|
|
|
47
48
|
}
|
|
48
49
|
return s;
|
|
49
50
|
}
|
|
50
|
-
|
|
51
|
-
return this.
|
|
51
|
+
hi(t) {
|
|
52
|
+
return this.Fi.lt(t);
|
|
52
53
|
}
|
|
53
54
|
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
54
|
-
if (!this.
|
|
55
|
+
if (!this.Ri(i))
|
|
55
56
|
return (
|
|
56
|
-
!this.
|
|
57
|
-
this.
|
|
58
|
-
(this.
|
|
57
|
+
!this.gi &&
|
|
58
|
+
this.wt &&
|
|
59
|
+
(this.gi = this.wt.Ni(() => {
|
|
59
60
|
this.refreshFeatureFlags(t, s);
|
|
60
61
|
})),
|
|
61
62
|
void ("function" == typeof s && s())
|
|
62
63
|
);
|
|
63
|
-
if ((e && this.
|
|
64
|
-
const r = this.
|
|
65
|
-
h = this.
|
|
64
|
+
if ((e && this.qi(), !this.gt)) return void ("function" == typeof s && s());
|
|
65
|
+
const r = this.gt.Gs({}, !0),
|
|
66
|
+
h = this.gt.Ks(r, T.Qs.xi);
|
|
66
67
|
let o = !1;
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
?
|
|
70
|
-
|
|
68
|
+
this.gt.Vs(r, () => {
|
|
69
|
+
this.gt
|
|
70
|
+
? (T.Xs(this.u, T.Qs.xi, new Date().valueOf()),
|
|
71
|
+
C.Ys({
|
|
72
|
+
url: `${this.gt.Zs()}/feature_flags/sync`,
|
|
71
73
|
headers: h,
|
|
72
74
|
data: r,
|
|
73
|
-
|
|
74
|
-
if (!this.
|
|
75
|
+
O: i => {
|
|
76
|
+
if (!this.gt.ti(r, i, h))
|
|
75
77
|
return (o = !0), void ("function" == typeof s && s());
|
|
76
|
-
this.
|
|
78
|
+
this.gt.si(), this.Ts(i), (o = !1), "function" == typeof t && t();
|
|
77
79
|
},
|
|
78
80
|
error: t => {
|
|
79
|
-
this.
|
|
81
|
+
this.gt.ii(t, "retrieving feature flags"),
|
|
80
82
|
(o = !0),
|
|
81
83
|
"function" == typeof s && s();
|
|
82
84
|
},
|
|
83
|
-
|
|
84
|
-
if (e && o && !this.
|
|
85
|
-
let e = this.
|
|
86
|
-
(null == e || e < 1e3 * this.
|
|
87
|
-
this.
|
|
85
|
+
ei: () => {
|
|
86
|
+
if (e && o && !this.ji) {
|
|
87
|
+
let e = this.yi;
|
|
88
|
+
(null == e || e < 1e3 * this.wi) && (e = 1e3 * this.wi),
|
|
89
|
+
this.zi(Math.min(3e5, D(1e3 * this.wi, 3 * e)), t, s, i);
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
|
-
})
|
|
92
|
+
}))
|
|
91
93
|
: "function" == typeof s && s();
|
|
92
94
|
});
|
|
93
95
|
}
|
|
94
|
-
|
|
95
|
-
null != this.
|
|
96
|
+
qi() {
|
|
97
|
+
null != this.ji && (clearTimeout(this.ji), (this.ji = null));
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
this.
|
|
99
|
-
(this.
|
|
99
|
+
zi(t = 1e3 * this.wi, s, i, e) {
|
|
100
|
+
this.qi(),
|
|
101
|
+
(this.ji = window.setTimeout(() => {
|
|
100
102
|
this.refreshFeatureFlags(s, i, e);
|
|
101
103
|
}, t)),
|
|
102
|
-
(this.
|
|
104
|
+
(this.yi = t);
|
|
103
105
|
}
|
|
104
|
-
|
|
105
|
-
if (!this.
|
|
106
|
+
Ri(t) {
|
|
107
|
+
if (!this.wt) return !1;
|
|
106
108
|
if (!t) {
|
|
107
|
-
const t = parseFloat(this.
|
|
109
|
+
const t = parseFloat(this.wt.Si());
|
|
108
110
|
let s = !1;
|
|
109
111
|
if (!isNaN(t)) {
|
|
110
|
-
if (-1 === t) return r.
|
|
111
|
-
s = new Date().getTime() >= (this.
|
|
112
|
+
if (-1 === t) return r.j.info("Feature flag refreshes not allowed"), !1;
|
|
113
|
+
s = new Date().getTime() >= (this.pi || 0) + 1e3 * t;
|
|
112
114
|
}
|
|
113
115
|
if (!s)
|
|
114
116
|
return (
|
|
115
|
-
r.
|
|
117
|
+
r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`),
|
|
116
118
|
!1
|
|
117
119
|
);
|
|
118
120
|
}
|
|
119
|
-
return this.
|
|
121
|
+
return this.wt.bi();
|
|
120
122
|
}
|
|
121
|
-
|
|
122
|
-
if (!this.
|
|
123
|
+
vi() {
|
|
124
|
+
if (!this.u) return;
|
|
123
125
|
const t = {};
|
|
124
|
-
for (const s of this.
|
|
126
|
+
for (const s of this.mi) {
|
|
125
127
|
const i = s.ss();
|
|
126
128
|
t[s.id] = i;
|
|
127
129
|
}
|
|
128
|
-
this.
|
|
130
|
+
this.u.D(i.k.Di, t), this.u.D(i.k.$i, this.pi);
|
|
129
131
|
}
|
|
130
132
|
}
|
|
@@ -4,9 +4,9 @@ import ir from "./feature-flags-provider-factory.js";
|
|
|
4
4
|
export function getAllFeatureFlags() {
|
|
5
5
|
if (!e.rr()) return;
|
|
6
6
|
const t = [],
|
|
7
|
-
a = e.
|
|
8
|
-
if (a && !a.
|
|
9
|
-
const o = ir.er().
|
|
7
|
+
a = e.tr();
|
|
8
|
+
if (a && !a.bi()) return r.j.info("Feature flags are not enabled."), t;
|
|
9
|
+
const o = ir.er().Ti();
|
|
10
10
|
for (const r in o) t.push(o[r]);
|
|
11
11
|
return t;
|
|
12
12
|
}
|
|
@@ -4,9 +4,9 @@ import FeatureFlag from "./feature-flag.js";
|
|
|
4
4
|
import ir from "./feature-flags-provider-factory.js";
|
|
5
5
|
export function getFeatureFlag(t) {
|
|
6
6
|
if (!e.rr()) return;
|
|
7
|
-
const a = e.
|
|
8
|
-
if (a && !a.
|
|
9
|
-
return r.
|
|
10
|
-
const o = ir.er().
|
|
7
|
+
const a = e.tr();
|
|
8
|
+
if (a && !a.bi())
|
|
9
|
+
return r.j.info("Feature flags are not enabled."), new FeatureFlag(t);
|
|
10
|
+
const o = ir.er().Ti();
|
|
11
11
|
return o[t] ? o[t] : new FeatureFlag(t);
|
|
12
12
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
2
|
import ir from "./feature-flags-provider-factory.js";
|
|
3
|
+
import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
3
4
|
export function subscribeToFeatureFlagsUpdates(r) {
|
|
4
5
|
if (!e.rr()) return;
|
|
5
|
-
|
|
6
|
+
const t = getAllFeatureFlags();
|
|
7
|
+
t && "function" == typeof r && r(t);
|
|
8
|
+
return ir.er().hi(r);
|
|
6
9
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import re from "./feed-provider.js";
|
|
3
|
+
const ie = {
|
|
4
4
|
t: !1,
|
|
5
5
|
provider: null,
|
|
6
6
|
er: () => (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
ie.o(),
|
|
8
|
+
ie.provider || ((ie.provider = new re(e.l(), e.cr())), e.dr(ie.provider)),
|
|
9
|
+
ie.provider
|
|
10
10
|
),
|
|
11
11
|
o: () => {
|
|
12
|
-
|
|
12
|
+
ie.t || (e.g(ie), (ie.t = !0));
|
|
13
13
|
},
|
|
14
14
|
destroy: () => {
|
|
15
|
-
(
|
|
15
|
+
(ie.provider = null), (ie.t = !1);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
export default
|
|
18
|
+
export default ie;
|
|
@@ -2,78 +2,89 @@ import y from "../common/base-provider.js";
|
|
|
2
2
|
import e from "../managers/braze-instance.js";
|
|
3
3
|
import Feed from "./feed.js";
|
|
4
4
|
import {
|
|
5
|
-
newCardFromFeedJson as
|
|
6
|
-
newCardFromSerializedValue as
|
|
5
|
+
newCardFromFeedJson as ht,
|
|
6
|
+
newCardFromSerializedValue as R
|
|
7
7
|
} from "../Card/util/card-factory.js";
|
|
8
8
|
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
9
|
-
import { STORAGE_KEYS as
|
|
10
|
-
import
|
|
11
|
-
export default class
|
|
9
|
+
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
10
|
+
import E from "../managers/subscription-manager.js";
|
|
11
|
+
export default class re extends y {
|
|
12
12
|
constructor(t, s) {
|
|
13
13
|
super(),
|
|
14
|
-
(this.
|
|
14
|
+
(this.u = t),
|
|
15
15
|
(this.Ci = s),
|
|
16
|
-
(this.
|
|
16
|
+
(this.cards = []),
|
|
17
|
+
(this.Ui = null),
|
|
18
|
+
(this.u = t),
|
|
19
|
+
(this.Ci = s),
|
|
20
|
+
(this.yt = new E()),
|
|
17
21
|
e.jt(this.yt),
|
|
18
|
-
this.
|
|
22
|
+
this.Lt();
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
Lt() {
|
|
25
|
+
let t = [];
|
|
26
|
+
this.u && (t = this.u.v(i.k.ki) || []);
|
|
27
|
+
const s = [];
|
|
23
28
|
for (let i = 0; i < t.length; i++) {
|
|
24
|
-
const e =
|
|
29
|
+
const e = R(t[i]);
|
|
25
30
|
null != e && s.push(e);
|
|
26
31
|
}
|
|
27
|
-
(this.
|
|
32
|
+
(this.cards = s), this.u && (this.Ui = w(this.u.v(i.k.Ai)));
|
|
28
33
|
}
|
|
29
|
-
|
|
34
|
+
Bi(t) {
|
|
30
35
|
const s = [];
|
|
31
|
-
let
|
|
32
|
-
const e = this.h.I(o.q.P) || {},
|
|
36
|
+
let e = null,
|
|
33
37
|
r = {};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
this.u && (r = this.u.v(i.k.L) || {});
|
|
39
|
+
const h = {};
|
|
40
|
+
for (let i = 0; i < t.length; i++) {
|
|
41
|
+
e = t[i];
|
|
42
|
+
const o = ht(e);
|
|
43
|
+
if (null != o) {
|
|
44
|
+
const t = o.id;
|
|
45
|
+
t && r[t] && ((o.viewed = !0), (h[t] = !0)), s.push(o);
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
this.
|
|
42
|
-
(this.
|
|
43
|
-
this.h.B(o.q.xi, this._i);
|
|
48
|
+
(this.cards = s),
|
|
49
|
+
this.Rs(),
|
|
50
|
+
(this.Ui = new Date()),
|
|
51
|
+
this.u && (this.u.D(i.k.L, h), this.u.D(i.k.Ai, this.Ui));
|
|
44
52
|
}
|
|
45
|
-
|
|
53
|
+
Rs() {
|
|
54
|
+
if (!this.u) return;
|
|
46
55
|
const t = [];
|
|
47
|
-
for (let s = 0; s < this.
|
|
48
|
-
this.
|
|
56
|
+
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].ss());
|
|
57
|
+
this.u.D(i.k.ki, t);
|
|
49
58
|
}
|
|
50
|
-
|
|
59
|
+
Ts(t) {
|
|
51
60
|
null != t &&
|
|
52
61
|
t.feed &&
|
|
53
|
-
(this.
|
|
54
|
-
this.
|
|
55
|
-
this.yt.
|
|
62
|
+
(this.Lt(),
|
|
63
|
+
this.Bi(t.feed),
|
|
64
|
+
this.yt.Et(new Feed(this.cards.slice(), this.Ui)));
|
|
56
65
|
}
|
|
57
|
-
|
|
58
|
-
this.
|
|
66
|
+
Ei() {
|
|
67
|
+
this.Lt();
|
|
59
68
|
const t = [],
|
|
60
69
|
s = new Date();
|
|
61
|
-
for (let i = 0; i < this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
for (let i = 0; i < this.cards.length; i++) {
|
|
71
|
+
const e = this.cards[i].expiresAt;
|
|
72
|
+
let r = !0;
|
|
73
|
+
null != e && (r = e >= s), r && t.push(this.cards[i]);
|
|
74
|
+
}
|
|
75
|
+
return new Feed(t, this.Ui);
|
|
65
76
|
}
|
|
66
|
-
|
|
67
|
-
this.Ci.requestFeedRefresh();
|
|
77
|
+
Es() {
|
|
78
|
+
this.Ci && this.Ci.requestFeedRefresh();
|
|
68
79
|
}
|
|
69
|
-
|
|
70
|
-
return this.yt.
|
|
80
|
+
hi(t) {
|
|
81
|
+
return this.yt.lt(t);
|
|
71
82
|
}
|
|
72
83
|
clearData(t) {
|
|
73
84
|
null == t && (t = !1),
|
|
74
|
-
(this.
|
|
75
|
-
(this.
|
|
76
|
-
t && (this.
|
|
77
|
-
this.yt.
|
|
85
|
+
(this.cards = []),
|
|
86
|
+
(this.Ui = null),
|
|
87
|
+
t && this.u && (this.u.ri(i.k.ki), this.u.ri(i.k.Ai)),
|
|
88
|
+
this.yt.Et(new Feed(this.cards.slice(), this.Ui));
|
|
78
89
|
}
|
|
79
90
|
}
|
package/src/Feed/feed.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
2
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
3
|
export function logFeedDisplayed() {
|
|
4
|
-
if (e.rr()) return
|
|
4
|
+
if (!e.rr()) return;
|
|
5
|
+
const i = e.ar();
|
|
6
|
+
return i ? i.qr(r.Cr.Ar).O : void 0;
|
|
5
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/Feed/ui/hide-feed.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from "../../managers/braze-instance.js";
|
|
2
|
-
import { destroyFeedHtml as
|
|
2
|
+
import { destroyFeedHtml as k } from "../../common/feed-display.js";
|
|
3
3
|
export function destroyFeed() {
|
|
4
4
|
if (!e.rr()) return;
|
|
5
5
|
const o = document.querySelectorAll(".ab-feed");
|
|
6
|
-
for (let e = 0; e < o.length; e++)
|
|
6
|
+
for (let e = 0; e < o.length; e++) k(o[e]);
|
|
7
7
|
}
|