@braze/web-sdk 5.8.0 → 5.8.1
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 +1 -1
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +22 -22
- package/shared-lib/guid.js +1 -1
- package/shared-lib/indexed-db-adapter.js +18 -18
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +16 -16
- package/src/Banner/banner-provider.js +79 -79
- package/src/Banner/banner.js +9 -9
- package/src/Banner/display/banner-to-html.js +2 -2
- package/src/Banner/get-all-banners.js +2 -2
- package/src/Banner/get-banner.js +2 -2
- package/src/Banner/log-banner-click.js +2 -2
- package/src/Banner/log-banner-impressions.js +4 -4
- package/src/Banner/request-banners-refresh.js +1 -1
- package/src/Banner/subscribe-to-banners-updates.js +5 -5
- package/src/Card/card-manager.js +35 -35
- package/src/Card/display/card-display.js +8 -8
- 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 +1 -1
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +92 -92
- package/src/Card/models/classic-card.js +21 -21
- package/src/Card/models/control-card.js +11 -11
- package/src/Card/models/image-only.js +19 -19
- package/src/Card/util/card-factory.js +39 -39
- package/src/ContentCards/content-cards-provider.js +142 -142
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +4 -4
- package/src/ContentCards/ui/show-content-cards.js +3 -3
- package/src/Core/disable-sdk.js +6 -6
- package/src/Core/enable-sdk.js +5 -5
- package/src/Core/get-device-id.js +2 -2
- package/src/Core/handle-braze-action.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +1 -1
- package/src/Core/log-custom-event.js +5 -5
- package/src/Core/log-purchase.js +4 -4
- package/src/Core/open-session.js +5 -5
- package/src/Core/wipe-data.js +2 -2
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +15 -15
- package/src/FeatureFlags/feature-flags-provider.js +61 -61
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/log-feature-flag-impression.js +4 -4
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +2 -2
- package/src/Feed/feed-provider.js +41 -41
- package/src/Feed/get-cached-feed.js +1 -1
- package/src/Feed/log-feed-displayed.js +1 -1
- package/src/Feed/request-feed-refresh.js +1 -1
- package/src/Feed/subscribe-to-feed-updates.js +1 -1
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/defer-in-app-message.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +6 -6
- package/src/InAppMessage/display/in-app-message-to-html.js +20 -20
- package/src/InAppMessage/display/modal-utils.js +4 -4
- package/src/InAppMessage/in-app-message-factory.js +7 -7
- package/src/InAppMessage/in-app-message-manager.js +89 -89
- package/src/InAppMessage/log-in-app-message-button-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-click.js +5 -5
- package/src/InAppMessage/log-in-app-message-html-click.js +7 -7
- package/src/InAppMessage/log-in-app-message-impression.js +2 -2
- package/src/InAppMessage/models/control-message.js +5 -5
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +20 -20
- package/src/InAppMessage/models/in-app-message-button.js +8 -8
- package/src/InAppMessage/models/in-app-message.js +80 -80
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +29 -29
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +3 -3
- package/src/InAppMessage/ui/show-in-app-message.js +12 -12
- package/src/Push/push-manager-factory.js +1 -1
- package/src/Push/push-manager.js +94 -94
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +17 -17
- package/src/User/user.js +38 -38
- package/src/common/base-feed.js +1 -1
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +5 -5
- package/src/common/feed-display.js +6 -6
- package/src/l10n/l10n-manager-factory.js +1 -1
- package/src/l10n/l10n-manager.js +1 -1
- package/src/managers/auth-manager.js +31 -31
- package/src/managers/braze-instance.js +125 -125
- package/src/managers/device-manager.js +24 -24
- package/src/managers/network-manager.js +149 -149
- package/src/managers/server-config-manager.js +84 -84
- package/src/managers/session-manager.js +27 -27
- package/src/managers/storage-manager-factory.js +12 -12
- package/src/managers/storage-manager.js +83 -83
- package/src/managers/subscription-manager.js +10 -10
- package/src/managers/utils.js +4 -4
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +4 -4
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +3 -3
- package/src/models/push-token.js +8 -8
- package/src/models/request-result.js +3 -3
- package/src/models/server-config.js +31 -31
- package/src/request-controller.js +148 -148
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +2 -2
- package/src/triggers/models/filter-set.js +4 -4
- package/src/triggers/models/filter.js +2 -2
- 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 +2 -2
- package/src/triggers/models/push-click-data.js +1 -1
- package/src/triggers/models/trigger-condition.js +32 -32
- package/src/triggers/models/trigger-events.js +2 -2
- package/src/triggers/models/trigger.js +11 -11
- package/src/triggers/triggers-provider-factory.js +2 -2
- package/src/triggers/triggers-provider.js +72 -72
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/base-device-parser.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +5 -5
- package/src/util/client-hints-parser.js +1 -1
- package/src/util/component-utils.js +1 -1
- package/src/util/dom-utils.js +4 -4
- package/src/util/html-display-utils.js +6 -6
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +6 -6
- package/src/util/request-header-utils.js +21 -21
- package/src/util/user-agent-parser.js +1 -1
- package/src/util/window-utils.js +1 -1
package/src/Core/enable-sdk.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import r from "../managers/braze-instance.js";
|
|
2
2
|
import { logger as N, IndexedDBAdapter as tt } from "../../shared-lib/index.js";
|
|
3
|
-
import ne, { STORAGE_KEYS as
|
|
3
|
+
import ne, { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
4
4
|
export function enableSDK() {
|
|
5
|
-
new ne.se(null, !0).remove(
|
|
6
|
-
const e = tt.
|
|
7
|
-
new tt(e, N).
|
|
5
|
+
new ne.se(null, !0).remove(s.me);
|
|
6
|
+
const e = tt.Ls.Fs;
|
|
7
|
+
new tt(e, N).ge(e.Ms.pe, e.be),
|
|
8
8
|
N.info("enableSDK was called"),
|
|
9
9
|
r.destroy(!1),
|
|
10
|
-
r.
|
|
10
|
+
r.fe(!1);
|
|
11
11
|
}
|
|
@@ -2,9 +2,9 @@ import r from "../managers/braze-instance.js";
|
|
|
2
2
|
import { logger as N } from "../../shared-lib/index.js";
|
|
3
3
|
export function getDeviceId(e) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
|
-
const t = r.
|
|
5
|
+
const t = r.ue();
|
|
6
6
|
if (!t) return;
|
|
7
|
-
const i = t.
|
|
7
|
+
const i = t.ve().id;
|
|
8
8
|
if ("function" != typeof e) return i;
|
|
9
9
|
N.warn(
|
|
10
10
|
"The callback for getDeviceId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getDeviceId()`)",
|
|
@@ -41,7 +41,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
41
41
|
case oo.types.logCustomEvent:
|
|
42
42
|
import("./log-custom-event.js").then(
|
|
43
43
|
({ logCustomEvent: logCustomEvent }) => {
|
|
44
|
-
r.
|
|
44
|
+
r._t()
|
|
45
45
|
? ((t = Array.prototype.slice.call(e)),
|
|
46
46
|
logCustomEvent(...t))
|
|
47
47
|
: N.error(p);
|
|
@@ -51,7 +51,7 @@ export function _handleBrazeAction(o, e, s) {
|
|
|
51
51
|
case oo.types.requestPushPermission:
|
|
52
52
|
import("../Push/request-push-permission.js").then(
|
|
53
53
|
({ requestPushPermission: requestPushPermission }) => {
|
|
54
|
-
r.
|
|
54
|
+
r._t()
|
|
55
55
|
? "Safari" === ro.browser && ro.OS === so.ao
|
|
56
56
|
? window.navigator.standalone && requestPushPermission()
|
|
57
57
|
: requestPushPermission()
|
package/src/Core/is-disabled.js
CHANGED
|
@@ -27,12 +27,12 @@ export function logCustomEvent(t, e) {
|
|
|
27
27
|
);
|
|
28
28
|
if (!o) return !1;
|
|
29
29
|
const i = r.v();
|
|
30
|
-
if (i && i.
|
|
30
|
+
if (i && i.je(t))
|
|
31
31
|
return N.info(`Custom Event "${t}" is blocklisted, ignoring.`), !1;
|
|
32
|
-
const s = c.
|
|
33
|
-
if (s.
|
|
32
|
+
const s = c.ut(d.CustomEvent, { n: t, p: n });
|
|
33
|
+
if (s.tt) {
|
|
34
34
|
N.info(`Logged custom event "${t}".`);
|
|
35
|
-
for (const o of s
|
|
35
|
+
for (const o of s.$e) ot.m().Ce(et.Ee, [t, e], o);
|
|
36
36
|
}
|
|
37
|
-
return s.
|
|
37
|
+
return s.tt;
|
|
38
38
|
}
|
package/src/Core/log-purchase.js
CHANGED
|
@@ -230,10 +230,10 @@ export function logPurchase(e, o, i, n, t) {
|
|
|
230
230
|
const g = r.v();
|
|
231
231
|
if (g && g.Dr(e))
|
|
232
232
|
return N.info(`Purchase "${e}" is blocklisted, ignoring.`), !1;
|
|
233
|
-
const P = c.
|
|
234
|
-
if (P.
|
|
233
|
+
const P = c.ut(d.Pr, { pid: e, c: i, p: s, q: D, pr: a });
|
|
234
|
+
if (P.tt) {
|
|
235
235
|
N.info(`Logged ${D} purchase${D > 1 ? "s" : ""} of "${e}" for ${i} ${s}.`);
|
|
236
|
-
for (const r of P
|
|
236
|
+
for (const r of P.$e) ot.m().Ce(et.Rr, [e, t], r);
|
|
237
237
|
}
|
|
238
|
-
return P.
|
|
238
|
+
return P.tt;
|
|
239
239
|
}
|
package/src/Core/open-session.js
CHANGED
|
@@ -7,19 +7,19 @@ export function openSession() {
|
|
|
7
7
|
const i = r.nn();
|
|
8
8
|
if (!i) return;
|
|
9
9
|
i.openSession();
|
|
10
|
-
const t = tt.
|
|
10
|
+
const t = tt.Ls.Fs,
|
|
11
11
|
o = new tt(t, N);
|
|
12
|
-
o.cr(t.
|
|
12
|
+
o.cr(t.Ms.jr, (r, n) => {
|
|
13
13
|
const e = n.lastClick,
|
|
14
14
|
s = n.trackingString;
|
|
15
15
|
N.info(`Firing push click trigger from ${s} push click at ${e}`);
|
|
16
16
|
const c = i.lr(e, s),
|
|
17
17
|
g = function () {
|
|
18
|
-
ot.m().
|
|
18
|
+
ot.m().Ce(et.hr, [s], c);
|
|
19
19
|
};
|
|
20
|
-
i.br(g, g), o.
|
|
20
|
+
i.br(g, g), o.ge(t.Ms.jr, r);
|
|
21
21
|
}),
|
|
22
|
-
o.
|
|
22
|
+
o.Ns(t.Ms.kr, function (r) {
|
|
23
23
|
i.vr(r);
|
|
24
24
|
});
|
|
25
25
|
}
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -6,10 +6,10 @@ export function wipeData() {
|
|
|
6
6
|
const o = r.j();
|
|
7
7
|
if (null == o) return void N.warn(p);
|
|
8
8
|
o.clearData();
|
|
9
|
-
const t = y(tt.
|
|
9
|
+
const t = y(tt.Ls);
|
|
10
10
|
for (let o = 0; o < t.length; o++) {
|
|
11
11
|
const n = t[o],
|
|
12
|
-
r = tt.
|
|
12
|
+
r = tt.Ls[n];
|
|
13
13
|
new tt(r, N).clearData();
|
|
14
14
|
}
|
|
15
15
|
if (r.rr()) for (const o of r.ar()) o.clearData(!0);
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { logger as N } from "../../shared-lib/index.js";
|
|
2
2
|
import FeatureFlag from "./feature-flag.js";
|
|
3
3
|
export function newFeatureFlagFromJson(e) {
|
|
4
|
-
if (e[FeatureFlag.
|
|
4
|
+
if (e[FeatureFlag.ui.ps] && "boolean" == typeof e[FeatureFlag.ui.Fe])
|
|
5
5
|
return new FeatureFlag(
|
|
6
|
-
e[FeatureFlag.
|
|
7
|
-
e[FeatureFlag.
|
|
8
|
-
e[FeatureFlag.
|
|
9
|
-
e[FeatureFlag.
|
|
6
|
+
e[FeatureFlag.ui.ps],
|
|
7
|
+
e[FeatureFlag.ui.Fe],
|
|
8
|
+
e[FeatureFlag.ui.we],
|
|
9
|
+
e[FeatureFlag.ui.xe],
|
|
10
10
|
);
|
|
11
11
|
N.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.es.ps] && "boolean" == typeof e[FeatureFlag.es.Fe])
|
|
15
15
|
return new FeatureFlag(
|
|
16
|
-
e[FeatureFlag.
|
|
17
|
-
e[FeatureFlag.
|
|
18
|
-
e[FeatureFlag.
|
|
19
|
-
e[FeatureFlag.
|
|
16
|
+
e[FeatureFlag.es.ps],
|
|
17
|
+
e[FeatureFlag.es.Fe],
|
|
18
|
+
e[FeatureFlag.es.we],
|
|
19
|
+
e[FeatureFlag.es.xe],
|
|
20
20
|
);
|
|
21
21
|
N.info(
|
|
22
22
|
`Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`,
|
|
@@ -21,24 +21,24 @@ export default class FeatureFlag {
|
|
|
21
21
|
return this.he(t, this.Te, "number");
|
|
22
22
|
}
|
|
23
23
|
getBooleanProperty(t) {
|
|
24
|
-
return this.he(t, this.
|
|
24
|
+
return this.he(t, this.Ne, "boolean");
|
|
25
25
|
}
|
|
26
26
|
getImageProperty(t) {
|
|
27
|
-
return this.he(t, this.
|
|
27
|
+
return this.he(t, this.Re, "image");
|
|
28
28
|
}
|
|
29
29
|
getJsonProperty(t) {
|
|
30
|
-
return this.he(t, this.
|
|
30
|
+
return this.he(t, this.Se, "jsonobject");
|
|
31
31
|
}
|
|
32
32
|
getTimestampProperty(t) {
|
|
33
|
-
return this.he(t, this.
|
|
33
|
+
return this.he(t, this.Ae, "datetime");
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
bt() {
|
|
36
36
|
const t = {};
|
|
37
37
|
return (
|
|
38
|
-
(t[FeatureFlag.
|
|
39
|
-
(t[FeatureFlag.
|
|
40
|
-
(t[FeatureFlag.
|
|
41
|
-
(t[FeatureFlag.
|
|
38
|
+
(t[FeatureFlag.es.ps] = this.id),
|
|
39
|
+
(t[FeatureFlag.es.Fe] = this.enabled),
|
|
40
|
+
(t[FeatureFlag.es.we] = this.properties),
|
|
41
|
+
(t[FeatureFlag.es.xe] = this.trackingString),
|
|
42
42
|
t
|
|
43
43
|
);
|
|
44
44
|
}
|
|
@@ -54,22 +54,22 @@ export default class FeatureFlag {
|
|
|
54
54
|
Te(t) {
|
|
55
55
|
return "number" === t.type && "number" == typeof t.value;
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
Ne(t) {
|
|
58
58
|
return "boolean" === t.type && "boolean" == typeof t.value;
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
Re(t) {
|
|
61
61
|
return "image" === t.type && "string" == typeof t.value;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
Se(t) {
|
|
64
64
|
return (
|
|
65
65
|
"jsonobject" === t.type &&
|
|
66
66
|
"object" == typeof t.value &&
|
|
67
67
|
t.value.constructor == Object
|
|
68
68
|
);
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
Ae(t) {
|
|
71
71
|
return "datetime" === t.type && "number" == typeof t.value;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
(FeatureFlag.
|
|
75
|
-
(FeatureFlag.
|
|
74
|
+
(FeatureFlag.es = { ps: "id", Fe: "e", we: "pr", xe: "fts" }),
|
|
75
|
+
(FeatureFlag.ui = { ps: "id", Fe: "enabled", we: "properties", xe: "fts" });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger as N } from "../../shared-lib/index.js";
|
|
2
|
-
import
|
|
2
|
+
import t from "../common/base-provider.js";
|
|
3
3
|
import r from "../managers/braze-instance.js";
|
|
4
|
-
import { STORAGE_KEYS as
|
|
4
|
+
import { STORAGE_KEYS as s } from "../managers/storage-manager.js";
|
|
5
5
|
import u from "../managers/subscription-manager.js";
|
|
6
6
|
import { randomInclusive as a } from "../util/math.js";
|
|
7
7
|
import l from "../util/net.js";
|
|
@@ -10,72 +10,72 @@ import {
|
|
|
10
10
|
newFeatureFlagFromSerializedValue as ht,
|
|
11
11
|
} from "./feature-flag-factory.js";
|
|
12
12
|
import h from "../util/request-header-utils.js";
|
|
13
|
-
export default class tr extends
|
|
13
|
+
export default class tr extends t {
|
|
14
14
|
constructor(t, s, e, i) {
|
|
15
15
|
super(),
|
|
16
16
|
(this.B = t),
|
|
17
17
|
(this.S = s),
|
|
18
18
|
(this.C = e),
|
|
19
19
|
(this.T = i),
|
|
20
|
-
(this.
|
|
21
|
-
(this.
|
|
20
|
+
(this.De = []),
|
|
21
|
+
(this.qe = 0),
|
|
22
22
|
(this.B = t),
|
|
23
23
|
(this.S = s),
|
|
24
24
|
(this.C = e),
|
|
25
25
|
(this.T = i),
|
|
26
|
-
(this.
|
|
27
|
-
(this.
|
|
26
|
+
(this.ze = null),
|
|
27
|
+
(this.ke = new u()),
|
|
28
28
|
(this.R = 10),
|
|
29
29
|
(this.I = null),
|
|
30
30
|
(this.q = null),
|
|
31
|
-
r.N(this.
|
|
31
|
+
r.N(this.ke);
|
|
32
32
|
}
|
|
33
33
|
U(t) {
|
|
34
34
|
var s;
|
|
35
35
|
if (
|
|
36
|
-
(null === (s = this.B) || void 0 === s ? void 0 : s.
|
|
36
|
+
(null === (s = this.B) || void 0 === s ? void 0 : s.Be()) &&
|
|
37
37
|
null != t &&
|
|
38
38
|
t.feature_flags
|
|
39
39
|
) {
|
|
40
|
-
this.
|
|
40
|
+
this.De = [];
|
|
41
41
|
for (const s of t.feature_flags) {
|
|
42
42
|
const t = st(s);
|
|
43
|
-
t && this.
|
|
43
|
+
t && this.De.push(t);
|
|
44
44
|
}
|
|
45
|
-
(this.
|
|
45
|
+
(this.qe = new Date().getTime()), this.Me(), this.ke.X(this.De);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
this.C && (
|
|
48
|
+
Ue() {
|
|
49
|
+
let t = {};
|
|
50
|
+
this.C && (t = this.C.ft(s.gt.Xe));
|
|
51
51
|
const e = {};
|
|
52
|
-
for (const
|
|
53
|
-
const i = ht(s
|
|
52
|
+
for (const s in t) {
|
|
53
|
+
const i = ht(t[s]);
|
|
54
54
|
i && (e[i.id] = i);
|
|
55
55
|
}
|
|
56
56
|
return e;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
var
|
|
58
|
+
_e() {
|
|
59
|
+
var t;
|
|
60
60
|
return (
|
|
61
|
-
(null === (
|
|
61
|
+
(null === (t = this.C) || void 0 === t ? void 0 : t.ft(s.gt.Ge)) || {}
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
this.C && this.C.
|
|
64
|
+
He(t) {
|
|
65
|
+
this.C && this.C.Bt(s.gt.Ge, t);
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
return this.
|
|
67
|
+
qt(t) {
|
|
68
|
+
return this.ke.Ft(t);
|
|
69
69
|
}
|
|
70
70
|
refreshFeatureFlags(t, s, e = !1, i = !0) {
|
|
71
71
|
const r = () => {
|
|
72
|
-
"function" == typeof s && s(), this.
|
|
72
|
+
"function" == typeof s && s(), this.ke.X(this.De);
|
|
73
73
|
};
|
|
74
|
-
if (!this.
|
|
74
|
+
if (!this.Je(e))
|
|
75
75
|
return (
|
|
76
|
-
!this.
|
|
76
|
+
!this.ze &&
|
|
77
77
|
this.B &&
|
|
78
|
-
(this.
|
|
78
|
+
(this.ze = this.B.Ke(() => {
|
|
79
79
|
this.refreshFeatureFlags(t, s);
|
|
80
80
|
})),
|
|
81
81
|
void r()
|
|
@@ -84,7 +84,7 @@ export default class tr extends s {
|
|
|
84
84
|
if (!o) return void r();
|
|
85
85
|
i && this.G();
|
|
86
86
|
const n = o.H({}, !0),
|
|
87
|
-
u = o.J(n, h.O.
|
|
87
|
+
u = o.J(n, h.O.Le);
|
|
88
88
|
let f = !1;
|
|
89
89
|
o.V(
|
|
90
90
|
n,
|
|
@@ -92,91 +92,91 @@ export default class tr extends s {
|
|
|
92
92
|
const o = this.S;
|
|
93
93
|
if (!o) return void r();
|
|
94
94
|
const c = new Date().valueOf();
|
|
95
|
-
h.W(this.C, h.O.
|
|
95
|
+
h.W(this.C, h.O.Le, c),
|
|
96
96
|
-1 !== i && u.push(["X-Braze-Req-Tokens-Remaining", i.toString()]),
|
|
97
97
|
l.Y({
|
|
98
98
|
url: `${o.Z()}/feature_flags/sync`,
|
|
99
99
|
headers: u,
|
|
100
100
|
data: n,
|
|
101
|
-
|
|
102
|
-
if (!o.
|
|
103
|
-
o.
|
|
101
|
+
tt: (s) => {
|
|
102
|
+
if (!o.st(n, s, u)) return (f = !0), void r();
|
|
103
|
+
o.it(), this.U(s), (f = !1), "function" == typeof t && t();
|
|
104
104
|
},
|
|
105
105
|
error: (t) => {
|
|
106
|
-
o.
|
|
106
|
+
o.et(t, "retrieving feature flags"), (f = !0), r();
|
|
107
107
|
},
|
|
108
|
-
|
|
108
|
+
nt: (i, r) => {
|
|
109
109
|
let n;
|
|
110
110
|
if (f) {
|
|
111
111
|
let t = this.I;
|
|
112
112
|
(null == t || t < 1e3 * this.R) && (t = 1e3 * this.R),
|
|
113
113
|
(n = Math.min(3e5, a(1e3 * this.R, 3 * t)));
|
|
114
114
|
}
|
|
115
|
-
o.
|
|
115
|
+
o.rt(
|
|
116
116
|
r,
|
|
117
117
|
() => {
|
|
118
118
|
this.refreshFeatureFlags(t, s, e, !0);
|
|
119
119
|
},
|
|
120
|
-
h.O.
|
|
121
|
-
(t) => this.
|
|
120
|
+
h.O.Le,
|
|
121
|
+
(t) => this.ot(t),
|
|
122
122
|
() => this.G(),
|
|
123
123
|
n,
|
|
124
124
|
);
|
|
125
125
|
},
|
|
126
126
|
});
|
|
127
127
|
},
|
|
128
|
-
h.O.
|
|
128
|
+
h.O.Le,
|
|
129
129
|
s,
|
|
130
130
|
);
|
|
131
131
|
}
|
|
132
132
|
G() {
|
|
133
133
|
null != this.q && (clearTimeout(this.q), (this.q = null));
|
|
134
134
|
}
|
|
135
|
-
|
|
135
|
+
ot(t) {
|
|
136
136
|
this.G(), (this.q = t);
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
Je(t) {
|
|
139
139
|
if (!this.B) return !1;
|
|
140
140
|
if (!t) {
|
|
141
|
-
const t = this.B.
|
|
141
|
+
const t = this.B.Oe();
|
|
142
142
|
if (null == t) return !1;
|
|
143
143
|
let s = !1;
|
|
144
144
|
if (!isNaN(t)) {
|
|
145
145
|
if (-1 === t) return N.info("Feature flag refreshes not allowed"), !1;
|
|
146
|
-
s = new Date().getTime() >= (this.
|
|
146
|
+
s = new Date().getTime() >= (this.qe || 0) + 1e3 * t;
|
|
147
147
|
}
|
|
148
148
|
if (!s)
|
|
149
149
|
return (
|
|
150
150
|
N.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
151
151
|
);
|
|
152
152
|
}
|
|
153
|
-
return this.B.
|
|
153
|
+
return this.B.Be();
|
|
154
154
|
}
|
|
155
|
-
|
|
156
|
-
var
|
|
155
|
+
Qe() {
|
|
156
|
+
var t;
|
|
157
157
|
return (
|
|
158
|
-
(null === (
|
|
158
|
+
(null === (t = this.C) || void 0 === t ? void 0 : t.ft(s.gt.Ve)) || null
|
|
159
159
|
);
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
var
|
|
163
|
-
null === (
|
|
164
|
-
void 0 ===
|
|
165
|
-
|
|
161
|
+
We() {
|
|
162
|
+
var t, e;
|
|
163
|
+
null === (t = this.C) ||
|
|
164
|
+
void 0 === t ||
|
|
165
|
+
t.Bt(s.gt.Ve, null === (e = this.T) || void 0 === e ? void 0 : e.St());
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
Ye() {
|
|
168
168
|
var t;
|
|
169
|
-
const s = null === (t = this.T) || void 0 === t ? void 0 : t.
|
|
170
|
-
e = this.
|
|
169
|
+
const s = null === (t = this.T) || void 0 === t ? void 0 : t.St(),
|
|
170
|
+
e = this.Qe();
|
|
171
171
|
return null == e || s === e;
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
Me() {
|
|
174
174
|
if (!this.C) return;
|
|
175
|
-
const
|
|
176
|
-
for (const
|
|
177
|
-
const e =
|
|
178
|
-
s
|
|
175
|
+
const t = {};
|
|
176
|
+
for (const s of this.De) {
|
|
177
|
+
const e = s.bt();
|
|
178
|
+
t[s.id] = e;
|
|
179
179
|
}
|
|
180
|
-
this.C.
|
|
180
|
+
this.C.Bt(s.gt.Xe, t), this.C.Bt(s.gt.Ze, this.qe), this.We();
|
|
181
181
|
}
|
|
182
182
|
}
|
|
@@ -3,7 +3,7 @@ import nr from "./feature-flags-provider-factory.js";
|
|
|
3
3
|
export function getFeatureFlag(t) {
|
|
4
4
|
if (!r.rr()) return;
|
|
5
5
|
const e = r.v();
|
|
6
|
-
if (e && !e.
|
|
7
|
-
const n = nr.m().
|
|
6
|
+
if (e && !e.Be()) return null;
|
|
7
|
+
const n = nr.m().Ue();
|
|
8
8
|
return n[t] ? n[t] : null;
|
|
9
9
|
}
|
|
@@ -7,11 +7,11 @@ export function logFeatureFlagImpression(e) {
|
|
|
7
7
|
if (!e) return !1;
|
|
8
8
|
const t =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
|
-
o = nr.m().
|
|
10
|
+
o = nr.m().Ue();
|
|
11
11
|
if (!o[e]) return N.info(t), !1;
|
|
12
12
|
const n = o[e].trackingString;
|
|
13
13
|
if (!n) return N.info(t), !1;
|
|
14
|
-
const i = nr.m().
|
|
14
|
+
const i = nr.m()._e();
|
|
15
15
|
if (i[n])
|
|
16
16
|
return (
|
|
17
17
|
N.info(
|
|
@@ -19,7 +19,7 @@ export function logFeatureFlagImpression(e) {
|
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(i[n] = !0), nr.m().
|
|
22
|
+
(i[n] = !0), nr.m().He(i);
|
|
23
23
|
const s = { fid: e, fts: n };
|
|
24
|
-
return c.
|
|
24
|
+
return c.ut(d.yr, s).tt;
|
|
25
25
|
}
|
|
@@ -4,9 +4,9 @@ import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
|
4
4
|
export function subscribeToFeatureFlagsUpdates(t) {
|
|
5
5
|
if (!r.rr()) return;
|
|
6
6
|
const e = nr.m();
|
|
7
|
-
if (e.
|
|
7
|
+
if (e.Ye()) {
|
|
8
8
|
const r = getAllFeatureFlags();
|
|
9
9
|
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
|
11
|
-
return e.
|
|
11
|
+
return e.qt(t);
|
|
12
12
|
}
|