@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
package/src/Core/change-user.js
CHANGED
|
@@ -2,7 +2,7 @@ import e from "../managers/braze-instance.js";
|
|
|
2
2
|
import { getByteLength as U } from "../util/string-utils.js";
|
|
3
3
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
4
4
|
import { User } from "../User/index.js";
|
|
5
|
-
import { validateStandardString as
|
|
5
|
+
import { validateStandardString as H } from "../util/validation-utils.js";
|
|
6
6
|
export function changeUser(i, t) {
|
|
7
7
|
if (!e.rr()) return;
|
|
8
8
|
if (null == i || 0 === i.length || i != i)
|
|
@@ -11,7 +11,7 @@ export function changeUser(i, t) {
|
|
|
11
11
|
return void r.j.error(
|
|
12
12
|
`Rejected user id "${i}" because it is longer than ${User.lr} bytes.`,
|
|
13
13
|
);
|
|
14
|
-
if (null != t && !
|
|
14
|
+
if (null != t && !H(t, "set signature for new user", "signature")) return;
|
|
15
15
|
const s = e.cr();
|
|
16
16
|
s && s.changeUser(i.toString(), e.gr(), t);
|
|
17
17
|
}
|
package/src/Core/disable-sdk.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
2
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
-
import
|
|
3
|
+
import J, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
4
4
|
export function disableSDK() {
|
|
5
5
|
const a = e.cr();
|
|
6
6
|
a && a.requestImmediateDataFlush();
|
|
7
|
-
const s = new
|
|
7
|
+
const s = new J.ee(null, !0),
|
|
8
8
|
n = "This-cookie-will-expire-in-" + s.ae();
|
|
9
9
|
s.store(i.re, n);
|
|
10
|
-
const o = r.
|
|
11
|
-
new r.
|
|
10
|
+
const o = r.ts.Zt;
|
|
11
|
+
new r.es(o, r.j).setItem(o.rs.se, o.ie, !0),
|
|
12
12
|
r.j.info("disableSDK was called"),
|
|
13
13
|
e.destroy(!1),
|
|
14
14
|
e.ne(!0);
|
package/src/Core/enable-sdk.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
2
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
-
import
|
|
3
|
+
import J, { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
|
-
new
|
|
6
|
-
const a = r.
|
|
7
|
-
new r.
|
|
5
|
+
new J.ee(null, !0).remove(i.re);
|
|
6
|
+
const a = r.ts.Zt;
|
|
7
|
+
new r.es(a, r.j).oe(a.rs.se, a.ie),
|
|
8
8
|
r.j.info("enableSDK was called"),
|
|
9
9
|
e.destroy(!1),
|
|
10
10
|
e.ne(!1);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
2
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
-
export function getDeviceId(
|
|
3
|
+
export function getDeviceId(t) {
|
|
4
4
|
if (!e.rr()) return;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const i = e.te();
|
|
6
|
+
if (!i) return;
|
|
7
|
+
const c = i.ce().id;
|
|
8
|
+
if ("function" != typeof t) return c;
|
|
9
|
+
r.j.warn(
|
|
10
|
+
"The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
|
|
11
|
+
),
|
|
12
|
+
t(c);
|
|
11
13
|
}
|
|
@@ -3,23 +3,23 @@ import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
|
|
|
3
3
|
import e from "../managers/braze-instance.js";
|
|
4
4
|
import {
|
|
5
5
|
BRAZE_ACTIONS as _,
|
|
6
|
-
getDecodedBrazeAction as
|
|
6
|
+
getDecodedBrazeAction as O,
|
|
7
7
|
} from "../util/braze-actions.js";
|
|
8
|
-
import
|
|
9
|
-
import { OperatingSystems as
|
|
8
|
+
import Q from "../util/browser-detector.js";
|
|
9
|
+
import { OperatingSystems as V } from "../util/device-constants.js";
|
|
10
10
|
import {
|
|
11
|
-
BRAZE_ACTION_URI_REGEX as
|
|
12
|
-
isValidBrazeActionJson as
|
|
11
|
+
BRAZE_ACTION_URI_REGEX as W,
|
|
12
|
+
isValidBrazeActionJson as X,
|
|
13
13
|
} from "../util/validation-utils.js";
|
|
14
|
-
import { WindowUtils as
|
|
15
|
-
import { getUser as
|
|
14
|
+
import { WindowUtils as Y } from "../util/window-utils.js";
|
|
15
|
+
import { getUser as Z } from "./get-user.js";
|
|
16
16
|
export function _handleBrazeAction(o, s, t) {
|
|
17
17
|
if (e.rr())
|
|
18
|
-
if (
|
|
19
|
-
const s =
|
|
18
|
+
if (W.test(o)) {
|
|
19
|
+
const s = O(o);
|
|
20
20
|
if (!s) return;
|
|
21
21
|
const t = (o) => {
|
|
22
|
-
if (!
|
|
22
|
+
if (!X(o))
|
|
23
23
|
return void r.j.error(
|
|
24
24
|
`Decoded Braze Action json is invalid: ${JSON.stringify(
|
|
25
25
|
o,
|
|
@@ -52,7 +52,7 @@ export function _handleBrazeAction(o, s, t) {
|
|
|
52
52
|
import("../Push/request-push-permission.js").then(
|
|
53
53
|
({ requestPushPermission: requestPushPermission }) => {
|
|
54
54
|
e.fe()
|
|
55
|
-
? "Safari" ===
|
|
55
|
+
? "Safari" === Q.browser && Q.OS === V.de
|
|
56
56
|
? window.navigator.standalone && requestPushPermission()
|
|
57
57
|
: requestPushPermission()
|
|
58
58
|
: r.j.error(P);
|
|
@@ -66,13 +66,13 @@ export function _handleBrazeAction(o, s, t) {
|
|
|
66
66
|
case _.types.removeFromSubscriptionGroup:
|
|
67
67
|
case _.types.addToCustomAttributeArray:
|
|
68
68
|
case _.types.removeFromCustomAttributeArray:
|
|
69
|
-
if (((t =
|
|
69
|
+
if (((t = Z()), t)) {
|
|
70
70
|
t[a](...Array.prototype.slice.call(s));
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
73
|
case _.types.pe:
|
|
74
74
|
case _.types.je:
|
|
75
|
-
(i = Array.prototype.slice.call(s)),
|
|
75
|
+
(i = Array.prototype.slice.call(s)), Y.openUri(...i);
|
|
76
76
|
break;
|
|
77
77
|
default:
|
|
78
78
|
r.j.info(`Ignoring unknown Braze Action: ${a}`);
|
|
@@ -80,7 +80,7 @@ export function _handleBrazeAction(o, s, t) {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
t(s);
|
|
83
|
-
} else
|
|
83
|
+
} else Y.openUri(o, s, t);
|
|
84
84
|
}
|
|
85
85
|
export function handleBrazeAction(e, o) {
|
|
86
86
|
_handleBrazeAction(e, o);
|
package/src/Core/is-disabled.js
CHANGED
package/src/Core/open-session.js
CHANGED
|
@@ -7,9 +7,9 @@ export function openSession() {
|
|
|
7
7
|
const i = e.cr();
|
|
8
8
|
if (!i) return;
|
|
9
9
|
i.openSession();
|
|
10
|
-
const t = r.
|
|
11
|
-
o = new r.
|
|
12
|
-
o.hr(t.
|
|
10
|
+
const t = r.ts.Zt,
|
|
11
|
+
o = new r.es(t, r.j);
|
|
12
|
+
o.hr(t.rs.kr, (e, s) => {
|
|
13
13
|
const n = s.lastClick,
|
|
14
14
|
c = s.trackingString;
|
|
15
15
|
r.j.info(`Firing push click trigger from ${c} push click at ${n}`);
|
|
@@ -17,9 +17,9 @@ export function openSession() {
|
|
|
17
17
|
f = function () {
|
|
18
18
|
et.er().be(tt.zr, [c], g);
|
|
19
19
|
};
|
|
20
|
-
i.$r(f, f), o.oe(t.
|
|
20
|
+
i.$r(f, f), o.oe(t.rs.kr, e);
|
|
21
21
|
}),
|
|
22
|
-
o.
|
|
22
|
+
o.ss(t.rs.wr, function (r) {
|
|
23
23
|
i.yr(r);
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
|
-
import { validateStandardString as
|
|
2
|
+
import { validateStandardString as H } from "../util/validation-utils.js";
|
|
3
3
|
export function setSdkAuthenticationSignature(t) {
|
|
4
4
|
if (!e.rr()) return !1;
|
|
5
|
-
if ("" === t || !
|
|
5
|
+
if ("" === t || !H(t, "set signature", "signature", !1)) return !1;
|
|
6
6
|
const r = e.Sr();
|
|
7
7
|
return !!r && (r.setSdkAuthenticationSignature(t), !0);
|
|
8
8
|
}
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -3,14 +3,14 @@ import { keys as oo } from "../util/code-utils.js";
|
|
|
3
3
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
4
4
|
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
|
|
5
5
|
export function wipeData() {
|
|
6
|
-
if (null == e.l())
|
|
6
|
+
if (null == e.l()) return void r.j.warn(P);
|
|
7
7
|
const o = e.l();
|
|
8
8
|
o && o.clearData();
|
|
9
|
-
const t = oo(r.
|
|
9
|
+
const t = oo(r.ts);
|
|
10
10
|
for (let o = 0; o < t.length; o++) {
|
|
11
11
|
const n = t[o],
|
|
12
|
-
s = r.
|
|
13
|
-
new r.
|
|
12
|
+
s = r.ts[n];
|
|
13
|
+
new r.es(s, r.j).clearData();
|
|
14
14
|
}
|
|
15
15
|
if (e.rr()) for (const o of e.gr()) o.clearData(!0);
|
|
16
16
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
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.Rt.rt] && "boolean" == typeof e[FeatureFlag.Rt.Fe])
|
|
5
5
|
return new FeatureFlag(
|
|
6
|
-
e[FeatureFlag.
|
|
7
|
-
e[FeatureFlag.
|
|
8
|
-
e[FeatureFlag.
|
|
9
|
-
e[FeatureFlag.
|
|
6
|
+
e[FeatureFlag.Rt.rt],
|
|
7
|
+
e[FeatureFlag.Rt.Fe],
|
|
8
|
+
e[FeatureFlag.Rt.we],
|
|
9
|
+
e[FeatureFlag.Rt.ze],
|
|
10
10
|
);
|
|
11
11
|
r.j.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
|
|
12
12
|
}
|
|
13
13
|
export function newFeatureFlagFromSerializedValue(e) {
|
|
14
|
-
if (e[FeatureFlag.
|
|
14
|
+
if (e[FeatureFlag.it.rt] && "boolean" == typeof e[FeatureFlag.it.Fe])
|
|
15
15
|
return new FeatureFlag(
|
|
16
|
-
e[FeatureFlag.
|
|
17
|
-
e[FeatureFlag.
|
|
18
|
-
e[FeatureFlag.
|
|
19
|
-
e[FeatureFlag.
|
|
16
|
+
e[FeatureFlag.it.rt],
|
|
17
|
+
e[FeatureFlag.it.Fe],
|
|
18
|
+
e[FeatureFlag.it.we],
|
|
19
|
+
e[FeatureFlag.it.ze],
|
|
20
20
|
);
|
|
21
21
|
r.j.info(
|
|
22
22
|
`Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`,
|
|
@@ -34,13 +34,13 @@ export default class FeatureFlag {
|
|
|
34
34
|
? r.value
|
|
35
35
|
: (this.Nr("boolean"), null);
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
tt() {
|
|
38
38
|
const t = {};
|
|
39
39
|
return (
|
|
40
|
-
(t[FeatureFlag.
|
|
41
|
-
(t[FeatureFlag.
|
|
42
|
-
(t[FeatureFlag.
|
|
43
|
-
(t[FeatureFlag.
|
|
40
|
+
(t[FeatureFlag.it.rt] = this.id),
|
|
41
|
+
(t[FeatureFlag.it.Fe] = this.enabled),
|
|
42
|
+
(t[FeatureFlag.it.we] = this.properties),
|
|
43
|
+
(t[FeatureFlag.it.ze] = this.trackingString),
|
|
44
44
|
t
|
|
45
45
|
);
|
|
46
46
|
}
|
|
@@ -60,5 +60,5 @@ export default class FeatureFlag {
|
|
|
60
60
|
return "boolean" === t.type && "boolean" == typeof t.value;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
(FeatureFlag.
|
|
64
|
-
(FeatureFlag.
|
|
63
|
+
(FeatureFlag.it = { rt: "id", Fe: "e", we: "pr", ze: "fts" }),
|
|
64
|
+
(FeatureFlag.Rt = { rt: "id", Fe: "enabled", we: "properties", ze: "fts" });
|
|
@@ -13,29 +13,29 @@ import T from "../util/request-header-utils.js";
|
|
|
13
13
|
export default class er extends y {
|
|
14
14
|
constructor(t, s, i) {
|
|
15
15
|
super(),
|
|
16
|
-
(this.
|
|
17
|
-
(this
|
|
16
|
+
(this.yt = t),
|
|
17
|
+
(this.$t = s),
|
|
18
18
|
(this.u = i),
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
22
|
-
(this
|
|
19
|
+
(this.gi = []),
|
|
20
|
+
(this.pi = 0),
|
|
21
|
+
(this.yt = t),
|
|
22
|
+
(this.$t = s),
|
|
23
23
|
(this.u = i),
|
|
24
24
|
(this.Fi = null),
|
|
25
25
|
(this.wi = new E()),
|
|
26
|
-
(this.
|
|
27
|
-
(this.ji = null),
|
|
26
|
+
(this.ji = 10),
|
|
28
27
|
(this.bi = null),
|
|
29
|
-
|
|
28
|
+
(this.vi = null),
|
|
29
|
+
e.Ht(this.wi);
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
if ((!this.
|
|
33
|
-
this.
|
|
31
|
+
Ss(t) {
|
|
32
|
+
if ((!this.yt || this.yt.yi()) && null != t && t.feature_flags) {
|
|
33
|
+
this.gi = [];
|
|
34
34
|
for (const s of t.feature_flags) {
|
|
35
35
|
const t = st(s);
|
|
36
|
-
t && this.
|
|
36
|
+
t && this.gi.push(t);
|
|
37
37
|
}
|
|
38
|
-
(this.
|
|
38
|
+
(this.pi = new Date().getTime()), this.Ti(), this.wi.Dt(this.gi);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
Di() {
|
|
@@ -56,74 +56,74 @@ export default class er extends y {
|
|
|
56
56
|
this.u && this.u.D(i.k.qi, t);
|
|
57
57
|
}
|
|
58
58
|
ri(t) {
|
|
59
|
-
return this.wi.
|
|
59
|
+
return this.wi.It(t);
|
|
60
60
|
}
|
|
61
61
|
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
62
|
+
const r = () => {
|
|
63
|
+
"function" == typeof s && s(), this.wi.Dt(this.gi);
|
|
64
|
+
};
|
|
62
65
|
if (!this.zi(i))
|
|
63
66
|
return (
|
|
64
67
|
!this.Fi &&
|
|
65
|
-
this.
|
|
66
|
-
(this.Fi = this.
|
|
68
|
+
this.yt &&
|
|
69
|
+
(this.Fi = this.yt.Ci(() => {
|
|
67
70
|
this.refreshFeatureFlags(t, s);
|
|
68
71
|
})),
|
|
69
|
-
void (
|
|
72
|
+
void r()
|
|
70
73
|
);
|
|
71
|
-
if ((e && this.Ii(), !this
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
+
if ((e && this.Ii(), !this.$t)) return void r();
|
|
75
|
+
const h = this.$t.Bs({}, !0),
|
|
76
|
+
a = this.$t.Hs(h, T.Os.Si);
|
|
74
77
|
let o = !1;
|
|
75
|
-
this.
|
|
76
|
-
this
|
|
78
|
+
this.$t.Qs(h, () => {
|
|
79
|
+
this.$t
|
|
77
80
|
? (T.Ws(this.u, T.Os.Si, new Date().valueOf()),
|
|
78
81
|
C.Xs({
|
|
79
|
-
url: `${this.
|
|
80
|
-
headers:
|
|
81
|
-
data:
|
|
82
|
-
O: (
|
|
83
|
-
if (!this.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.Ts(i),
|
|
82
|
+
url: `${this.$t.Ys()}/feature_flags/sync`,
|
|
83
|
+
headers: a,
|
|
84
|
+
data: h,
|
|
85
|
+
O: (s) => {
|
|
86
|
+
if (!this.$t.Zs(h, s, a)) return (o = !0), void r();
|
|
87
|
+
this.$t.ti(),
|
|
88
|
+
this.Ss(s),
|
|
87
89
|
(o = !1),
|
|
88
90
|
T.si(this.u, T.Os.Si, 1),
|
|
89
91
|
"function" == typeof t && t();
|
|
90
92
|
},
|
|
91
93
|
error: (t) => {
|
|
92
|
-
this.
|
|
93
|
-
(o = !0),
|
|
94
|
-
"function" == typeof s && s();
|
|
94
|
+
this.$t.ii(t, "retrieving feature flags"), (o = !0), r();
|
|
95
95
|
},
|
|
96
96
|
ei: () => {
|
|
97
|
-
if (e && o && !this.
|
|
97
|
+
if (e && o && !this.vi) {
|
|
98
98
|
T.hi(this.u, T.Os.Si);
|
|
99
|
-
let e = this.
|
|
100
|
-
(null == e || e < 1e3 * this.
|
|
101
|
-
this.$i(Math.min(3e5, D(1e3 * this.
|
|
99
|
+
let e = this.bi;
|
|
100
|
+
(null == e || e < 1e3 * this.ji) && (e = 1e3 * this.ji),
|
|
101
|
+
this.$i(Math.min(3e5, D(1e3 * this.ji, 3 * e)), t, s, i);
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
}))
|
|
105
|
-
:
|
|
105
|
+
: r();
|
|
106
106
|
});
|
|
107
107
|
}
|
|
108
108
|
Ii() {
|
|
109
|
-
null != this.
|
|
109
|
+
null != this.vi && (clearTimeout(this.vi), (this.vi = null));
|
|
110
110
|
}
|
|
111
|
-
$i(t = 1e3 * this.
|
|
111
|
+
$i(t = 1e3 * this.ji, s, i, e = !1) {
|
|
112
112
|
this.Ii(),
|
|
113
|
-
(this.
|
|
113
|
+
(this.vi = window.setTimeout(() => {
|
|
114
114
|
this.refreshFeatureFlags(s, i, e);
|
|
115
115
|
}, t)),
|
|
116
|
-
(this.
|
|
116
|
+
(this.bi = t);
|
|
117
117
|
}
|
|
118
118
|
zi(t) {
|
|
119
|
-
if (!this.
|
|
119
|
+
if (!this.yt) return !1;
|
|
120
120
|
if (!t) {
|
|
121
|
-
const t = this.
|
|
121
|
+
const t = this.yt.Mi();
|
|
122
122
|
if (null == t) return !1;
|
|
123
123
|
let s = !1;
|
|
124
124
|
if (!isNaN(t)) {
|
|
125
125
|
if (-1 === t) return r.j.info("Feature flag refreshes not allowed"), !1;
|
|
126
|
-
s = new Date().getTime() >= (this.
|
|
126
|
+
s = new Date().getTime() >= (this.pi || 0) + 1e3 * t;
|
|
127
127
|
}
|
|
128
128
|
if (!s)
|
|
129
129
|
return (
|
|
@@ -131,15 +131,15 @@ export default class er extends y {
|
|
|
131
131
|
!1
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
|
-
return this.
|
|
134
|
+
return this.yt.yi();
|
|
135
135
|
}
|
|
136
136
|
Ti() {
|
|
137
137
|
if (!this.u) return;
|
|
138
138
|
const t = {};
|
|
139
|
-
for (const s of this.
|
|
140
|
-
const i = s.
|
|
139
|
+
for (const s of this.gi) {
|
|
140
|
+
const i = s.tt();
|
|
141
141
|
t[s.id] = i;
|
|
142
142
|
}
|
|
143
|
-
this.u.D(i.k.Ri, t), this.u.D(i.k.Ui, this.
|
|
143
|
+
this.u.D(i.k.Ri, t), this.u.D(i.k.Ui, this.pi);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -5,7 +5,7 @@ export function getAllFeatureFlags() {
|
|
|
5
5
|
if (!e.rr()) return;
|
|
6
6
|
const t = [],
|
|
7
7
|
a = e.tr();
|
|
8
|
-
if (a && !a.
|
|
8
|
+
if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), t;
|
|
9
9
|
const o = ir.er().Di();
|
|
10
10
|
for (const r in o) t.push(o[r]);
|
|
11
11
|
return t;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
2
2
|
import e from "../managers/braze-instance.js";
|
|
3
|
-
import FeatureFlag from "./feature-flag.js";
|
|
4
3
|
import ir from "./feature-flags-provider-factory.js";
|
|
5
4
|
export function getFeatureFlag(t) {
|
|
6
5
|
if (!e.rr()) return;
|
|
7
6
|
const a = e.tr();
|
|
8
|
-
if (a && !a.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return o[t] ? o[t] : new FeatureFlag(t);
|
|
7
|
+
if (a && !a.yi()) return r.j.info("Feature flags are not enabled."), null;
|
|
8
|
+
const n = ir.er().Di();
|
|
9
|
+
return n[t] ? n[t] : null;
|
|
12
10
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import e from "../managers/braze-instance.js";
|
|
2
|
-
import
|
|
3
|
-
const
|
|
2
|
+
import ee from "./feed-provider.js";
|
|
3
|
+
const re = {
|
|
4
4
|
t: !1,
|
|
5
5
|
provider: null,
|
|
6
6
|
er: () => (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
re.o(),
|
|
8
|
+
re.provider || ((re.provider = new ee(e.l(), e.cr())), e.dr(re.provider)),
|
|
9
|
+
re.provider
|
|
10
10
|
),
|
|
11
11
|
o: () => {
|
|
12
|
-
|
|
12
|
+
re.t || (e.g(re), (re.t = !0));
|
|
13
13
|
},
|
|
14
14
|
destroy: () => {
|
|
15
|
-
(
|
|
15
|
+
(re.provider = null), (re.t = !1);
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
|
-
export default
|
|
18
|
+
export default re;
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
9
9
|
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
10
10
|
import E from "../managers/subscription-manager.js";
|
|
11
|
-
export default class
|
|
11
|
+
export default class ee extends y {
|
|
12
12
|
constructor(t, s) {
|
|
13
13
|
super(),
|
|
14
14
|
(this.u = t),
|
|
@@ -17,11 +17,11 @@ export default class re extends y {
|
|
|
17
17
|
(this.Ai = null),
|
|
18
18
|
(this.u = t),
|
|
19
19
|
(this.ki = s),
|
|
20
|
-
(this.
|
|
21
|
-
e.
|
|
22
|
-
this.
|
|
20
|
+
(this.Bt = new E()),
|
|
21
|
+
e.Ht(this.Bt),
|
|
22
|
+
this.Yt();
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
Yt() {
|
|
25
25
|
let t = [];
|
|
26
26
|
this.u && (t = this.u.v(i.k.Bi) || []);
|
|
27
27
|
const s = [];
|
|
@@ -46,25 +46,25 @@ export default class re extends y {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
(this.cards = s),
|
|
49
|
-
this.
|
|
49
|
+
this.Ds(),
|
|
50
50
|
(this.Ai = new Date()),
|
|
51
51
|
this.u && (this.u.D(i.k.L, h), this.u.D(i.k.Ei, this.Ai));
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
Ds() {
|
|
54
54
|
if (!this.u) return;
|
|
55
55
|
const t = [];
|
|
56
|
-
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].
|
|
56
|
+
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].tt());
|
|
57
57
|
this.u.D(i.k.Bi, t);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
Ss(t) {
|
|
60
60
|
null != t &&
|
|
61
61
|
t.feed &&
|
|
62
|
-
(this.
|
|
62
|
+
(this.Yt(),
|
|
63
63
|
this.Gi(t.feed),
|
|
64
|
-
this.
|
|
64
|
+
this.Bt.Dt(new Feed(this.cards.slice(), this.Ai)));
|
|
65
65
|
}
|
|
66
66
|
Hi() {
|
|
67
|
-
this.
|
|
67
|
+
this.Yt();
|
|
68
68
|
const t = [],
|
|
69
69
|
s = new Date();
|
|
70
70
|
for (let i = 0; i < this.cards.length; i++) {
|
|
@@ -74,17 +74,17 @@ export default class re extends y {
|
|
|
74
74
|
}
|
|
75
75
|
return new Feed(t, this.Ai);
|
|
76
76
|
}
|
|
77
|
-
|
|
77
|
+
xs() {
|
|
78
78
|
this.ki && this.ki.requestFeedRefresh();
|
|
79
79
|
}
|
|
80
80
|
ri(t) {
|
|
81
|
-
return this.
|
|
81
|
+
return this.Bt.It(t);
|
|
82
82
|
}
|
|
83
83
|
clearData(t) {
|
|
84
84
|
null == t && (t = !1),
|
|
85
85
|
(this.cards = []),
|
|
86
86
|
(this.Ai = null),
|
|
87
87
|
t && this.u && (this.u.ni(i.k.Bi), this.u.ni(i.k.Ei)),
|
|
88
|
-
this.
|
|
88
|
+
this.Bt.Dt(new Feed(this.cards.slice(), this.Ai));
|
|
89
89
|
}
|
|
90
90
|
}
|
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 z } 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++) z(o[e]);
|
|
7
7
|
}
|