@braze/web-sdk 4.9.0 → 4.10.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 +2296 -2235
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -8
- package/shared-lib/encoding-utils.js +1 -12
- package/shared-lib/event-types.js +1 -34
- package/shared-lib/guid.js +1 -10
- package/shared-lib/indexed-db-adapter.js +1 -352
- package/shared-lib/logger.js +1 -38
- package/shared-lib/supported-options.js +1 -26
- package/shared-lib/types.js +1 -1
- package/src/Card/card-manager-factory.js +1 -14
- package/src/Card/card-manager.js +1 -78
- package/src/Card/display/card-display.js +1 -138
- package/src/Card/index.js +1 -6
- package/src/Card/log-card-click.js +1 -11
- package/src/Card/log-card-dismissal.js +1 -11
- package/src/Card/log-card-impressions.js +1 -13
- package/src/Card/log-content-card-click.js +1 -4
- package/src/Card/log-content-card-impressions.js +1 -4
- package/src/Card/models/banner.js +1 -31
- package/src/Card/models/captioned-image.js +1 -33
- package/src/Card/models/card.js +1 -196
- package/src/Card/models/classic-card.js +1 -32
- package/src/Card/models/control-card.js +1 -23
- package/src/Card/models/image-only.js +1 -32
- package/src/Card/models/index.js +1 -6
- package/src/Card/types.js +1 -1
- package/src/Card/util/card-factory.js +1 -104
- package/src/ContentCards/content-cards-provider-factory.js +1 -20
- package/src/ContentCards/content-cards-provider.js +1 -391
- package/src/ContentCards/content-cards.js +1 -24
- package/src/ContentCards/get-cached-content-cards.js +1 -5
- package/src/ContentCards/index.js +1 -8
- package/src/ContentCards/log-content-cards-displayed.js +1 -5
- package/src/ContentCards/request-content-cards-refresh.js +1 -5
- package/src/ContentCards/subscribe-to-content-cards-updates.js +1 -17
- package/src/ContentCards/types.js +1 -1
- package/src/ContentCards/ui/hide-content-cards.js +1 -8
- package/src/ContentCards/ui/show-content-cards.js +1 -77
- package/src/ContentCards/ui/toggle-content-cards.js +1 -8
- package/src/Core/add-sdk-metadata.js +1 -26
- package/src/Core/braze-sdk-metadata.js +1 -10
- package/src/Core/change-user.js +1 -17
- package/src/Core/destroy.js +1 -5
- package/src/Core/device-properties.js +1 -9
- package/src/Core/disable-sdk.js +1 -15
- package/src/Core/enable-sdk.js +1 -11
- package/src/Core/get-device-id.js +1 -11
- package/src/Core/get-user.js +1 -4
- package/src/Core/handle-braze-action.js +1 -87
- package/src/Core/index.js +1 -23
- package/src/Core/initialize.js +1 -4
- package/src/Core/is-disabled.js +1 -4
- package/src/Core/log-custom-event.js +1 -38
- package/src/Core/log-purchase.js +1 -245
- package/src/Core/open-session.js +1 -25
- package/src/Core/remove-all-subscriptions.js +1 -4
- package/src/Core/remove-subscription.js +1 -4
- package/src/Core/request-immediate-data-flush.js +1 -6
- package/src/Core/set-logger.js +1 -4
- package/src/Core/set-sdk-authentication-signature.js +1 -8
- package/src/Core/subscribe-to-sdk-authentication-failures.js +1 -6
- package/src/Core/toggle-logging.js +1 -4
- package/src/Core/types.js +1 -1
- package/src/Core/wipe-data.js +1 -16
- package/src/FeatureFlags/feature-flag-factory.js +1 -24
- package/src/FeatureFlags/feature-flag.js +1 -64
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -19
- package/src/FeatureFlags/feature-flags-provider.js +1 -145
- package/src/FeatureFlags/get-all-feature-flags.js +1 -12
- package/src/FeatureFlags/get-feature-flag.js +1 -12
- package/src/FeatureFlags/index.js +1 -6
- package/src/FeatureFlags/log-feature-flag-impression.js +1 -23
- package/src/FeatureFlags/refresh-feature-flags.js +1 -9
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -9
- package/src/FeatureFlags/types.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -18
- package/src/Feed/feed-provider.js +1 -90
- package/src/Feed/feed.js +1 -20
- package/src/Feed/get-cached-feed.js +1 -5
- package/src/Feed/index.js +1 -8
- package/src/Feed/log-feed-displayed.js +1 -7
- package/src/Feed/request-feed-refresh.js +1 -5
- package/src/Feed/subscribe-to-feed-updates.js +1 -5
- package/src/Feed/types.js +1 -1
- package/src/Feed/ui/hide-feed.js +1 -7
- package/src/Feed/ui/show-feed.js +1 -96
- package/src/Feed/ui/toggle-feed.js +1 -8
- package/src/InAppMessage/defer-in-app-message.js +1 -13
- package/src/InAppMessage/display/get-animation-effect.js +1 -19
- package/src/InAppMessage/display/html-message-to-html.js +1 -244
- package/src/InAppMessage/display/in-app-message-to-html.js +1 -188
- package/src/InAppMessage/display/modal-utils.js +1 -73
- package/src/InAppMessage/get-deferred-in-app-message.js +1 -5
- package/src/InAppMessage/in-app-message-factory.js +1 -166
- package/src/InAppMessage/in-app-message-manager-factory.js +1 -16
- package/src/InAppMessage/in-app-message-manager.js +1 -248
- package/src/InAppMessage/index.js +1 -16
- package/src/InAppMessage/log-in-app-message-button-click.js +1 -27
- package/src/InAppMessage/log-in-app-message-click.js +1 -19
- package/src/InAppMessage/log-in-app-message-html-click.js +1 -23
- package/src/InAppMessage/log-in-app-message-impression.js +1 -13
- package/src/InAppMessage/models/control-message.js +1 -11
- package/src/InAppMessage/models/full-screen-message.js +1 -105
- package/src/InAppMessage/models/html-message.js +1 -68
- package/src/InAppMessage/models/in-app-message-button.js +1 -47
- package/src/InAppMessage/models/in-app-message.js +1 -382
- package/src/InAppMessage/models/modal-message.js +1 -101
- package/src/InAppMessage/models/slide-up-message.js +1 -84
- package/src/InAppMessage/models/templated-in-app-message.js +1 -19
- package/src/InAppMessage/subscribe-to-in-app-message.js +1 -10
- package/src/InAppMessage/types.js +1 -1
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +1 -15
- package/src/InAppMessage/ui/show-in-app-message.js +1 -181
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- package/src/Push/index.js +1 -5
- package/src/Push/is-push-blocked.js +1 -5
- package/src/Push/is-push-permission-granted.js +1 -5
- package/src/Push/is-push-supported.js +1 -5
- package/src/Push/push-manager-factory.js +1 -30
- package/src/Push/push-manager.js +1 -387
- package/src/Push/request-push-permission.js +1 -9
- package/src/Push/types.js +1 -1
- package/src/Push/unregister-push.js +1 -5
- package/src/Push/utils/push-utils.js +1 -36
- package/src/User/index.js +1 -1
- package/src/User/types.js +1 -1
- package/src/User/user-manager.js +1 -73
- package/src/User/user.js +1 -301
- package/src/common/base-feed.js +1 -28
- package/src/common/base-provider.js +1 -6
- package/src/common/constants.js +1 -14
- package/src/common/event-logger.js +1 -31
- package/src/common/feed-display.js +1 -210
- package/src/common/translations.js +1 -148
- package/src/common/types.js +1 -1
- package/src/index.js +1 -9
- package/src/l10n/l10n-manager-factory.js +1 -22
- package/src/l10n/l10n-manager.js +1 -25
- package/src/l10n/types.js +1 -1
- package/src/managers/auth-manager.js +1 -51
- package/src/managers/braze-instance.js +1 -329
- package/src/managers/device-manager.js +1 -85
- package/src/managers/network-manager.js +1 -253
- package/src/managers/server-config-manager.js +1 -108
- package/src/managers/session-manager.js +1 -75
- package/src/managers/storage-manager-factory.js +1 -42
- package/src/managers/storage-manager.js +1 -419
- package/src/managers/subscription-manager.js +1 -28
- package/src/managers/types.js +1 -1
- package/src/models/backend-errors.js +1 -8
- package/src/models/braze-event.js +1 -47
- package/src/models/braze-sdk-metadata.js +1 -10
- package/src/models/device.js +1 -18
- package/src/models/identifier.js +1 -19
- package/src/models/push-token.js +1 -27
- package/src/models/request-result.js +1 -8
- package/src/models/server-config.js +1 -48
- package/src/models/types.js +1 -1
- package/src/request-controller.js +1 -307
- package/src/triggers/models/custom-event-data.js +1 -14
- package/src/triggers/models/custom-event-property-data.js +1 -21
- package/src/triggers/models/filter-set.js +1 -55
- package/src/triggers/models/filter.js +1 -102
- package/src/triggers/models/in-app-message-click-data.js +1 -25
- package/src/triggers/models/purchase-data.js +1 -14
- package/src/triggers/models/purchase-property-data.js +1 -21
- package/src/triggers/models/push-click-data.js +1 -15
- package/src/triggers/models/trigger-condition.js +1 -105
- package/src/triggers/models/trigger-events.js +1 -8
- package/src/triggers/models/trigger.js +1 -122
- package/src/triggers/triggers-provider-factory.js +1 -34
- package/src/triggers/triggers-provider.js +1 -326
- package/src/triggers/types.js +1 -1
- package/src/types.js +1 -1
- package/src/ui/js/attach-css.js +1 -13
- package/src/ui/js/feed-css.js +1 -12
- package/src/ui/js/iam-css.js +1 -12
- package/src/ui/js/index.js +1 -3
- package/src/ui/js/load-font-awesome.js +1 -13
- package/src/util/base-device-parser.js +1 -14
- package/src/util/braze-actions.js +1 -84
- package/src/util/browser-detector.js +1 -84
- package/src/util/client-hints-parser.js +1 -66
- package/src/util/code-utils.js +1 -100
- package/src/util/color-utils.js +1 -29
- package/src/util/component-utils.js +1 -26
- package/src/util/date-utils.js +1 -28
- package/src/util/deprecation-utils.js +1 -5
- package/src/util/device-constants.js +1 -14
- package/src/util/dom-utils.js +1 -91
- package/src/util/error-utils.js +1 -2
- package/src/util/key-codes.js +1 -1
- package/src/util/math.js +1 -5
- package/src/util/net.js +1 -71
- package/src/util/request-header-utils.js +1 -46
- package/src/util/string-utils.js +1 -22
- package/src/util/types.js +1 -1
- package/src/util/url-utils.js +1 -20
- package/src/util/user-agent-parser.js +1 -85
- package/src/util/validation-utils.js +1 -217
- package/src/util/window-utils.js +1 -34
package/src/Core/open-session.js
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
-
import tt from "../triggers/models/trigger-events.js";
|
|
4
|
-
import { TriggersProviderFactory as et } from "../triggers/triggers-provider-factory.js";
|
|
5
|
-
export function openSession() {
|
|
6
|
-
if (!e.rr()) return;
|
|
7
|
-
const i = e.cr();
|
|
8
|
-
if (!i) return;
|
|
9
|
-
i.openSession();
|
|
10
|
-
const t = r.zt.Ft,
|
|
11
|
-
o = new r.xt(t, r.j);
|
|
12
|
-
o.hr(t.Jt.kr, (e, s) => {
|
|
13
|
-
const n = s.lastClick,
|
|
14
|
-
c = s.trackingString;
|
|
15
|
-
r.j.info(`Firing push click trigger from ${c} push click at ${n}`);
|
|
16
|
-
const g = i.vr(n, c),
|
|
17
|
-
f = function () {
|
|
18
|
-
et.er().be(tt.zr, [c], g);
|
|
19
|
-
};
|
|
20
|
-
i.$r(f, f), o.oe(t.Jt.kr, e);
|
|
21
|
-
}),
|
|
22
|
-
o.Mt(t.Jt.wr, function (r) {
|
|
23
|
-
i.yr(r);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";import tt from"../triggers/models/trigger-events.js";import{TriggersProviderFactory as et}from"../triggers/triggers-provider-factory.js";export function openSession(){if(!e.rr())return;const i=e.cr();if(!i)return;i.openSession();const t=r.zt.Ft,o=new r.xt(t,r.j);o.hr(t.Jt.kr,((e,s)=>{const n=s.lastClick,c=s.trackingString;r.j.info(`Firing push click trigger from ${c} push click at ${n}`);const g=i.vr(n,c),f=function(){et.er().be(tt.zr,[c],g)};i.$r(f,f),o.oe(t.Jt.kr,e)})),o.Mt(t.Jt.wr,(function(r){i.yr(r)}))}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
export function requestImmediateDataFlush(t) {
|
|
3
|
-
if (!e.rr()) return;
|
|
4
|
-
const r = e.cr();
|
|
5
|
-
r && r.requestImmediateDataFlush(t);
|
|
6
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";export function requestImmediateDataFlush(t){if(!e.rr())return;const r=e.cr();r&&r.requestImmediateDataFlush(t)}
|
package/src/Core/set-logger.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import { validateStandardString as J } from "../util/validation-utils.js";
|
|
3
|
-
export function setSdkAuthenticationSignature(t) {
|
|
4
|
-
if (!e.rr()) return !1;
|
|
5
|
-
if ("" === t || !J(t, "set signature", "signature", !1)) return !1;
|
|
6
|
-
const r = e.Sr();
|
|
7
|
-
return !!r && (r.setSdkAuthenticationSignature(t), !0);
|
|
8
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import{validateStandardString as J}from"../util/validation-utils.js";export function setSdkAuthenticationSignature(t){if(!e.rr())return!1;if(""===t||!J(t,"set signature","signature",!1))return!1;const r=e.Sr();return!!r&&(r.setSdkAuthenticationSignature(t),!0)}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
export function subscribeToSdkAuthenticationFailures(r) {
|
|
3
|
-
if (!e.rr()) return;
|
|
4
|
-
const n = e.Sr();
|
|
5
|
-
return n ? n.subscribeToSdkAuthenticationFailures(r) : void 0;
|
|
6
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";export function subscribeToSdkAuthenticationFailures(r){if(!e.rr())return;const n=e.Sr();return n?n.subscribeToSdkAuthenticationFailures(r):void 0}
|
package/src/Core/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|
package/src/Core/wipe-data.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import { keys as oo } from "../util/code-utils.js";
|
|
3
|
-
import r from "../../shared-lib/braze-shared-lib.js";
|
|
4
|
-
import { BRAZE_MUST_BE_INITIALIZED_ERROR as P } from "../common/constants.js";
|
|
5
|
-
export function wipeData() {
|
|
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();
|
|
14
|
-
}
|
|
15
|
-
if (e.rr()) for (const o of e.gr()) o.clearData(!0);
|
|
16
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import{keys as oo}from"../util/code-utils.js";import r from"../../shared-lib/braze-shared-lib.js";import{BRAZE_MUST_BE_INITIALIZED_ERROR as P}from"../common/constants.js";export function wipeData(){if(null==e.l())throw new Error(P);const o=e.l();o&&o.clearData();const t=oo(r.zt);for(let o=0;o<t.length;o++){const n=t[o],s=r.zt[n];new r.xt(s,r.j).clearData()}if(e.rr())for(const o of e.gr())o.clearData(!0)}
|
|
@@ -1,24 +1 @@
|
|
|
1
|
-
import r from
|
|
2
|
-
import FeatureFlag from "./feature-flag.js";
|
|
3
|
-
export function newFeatureFlagFromJson(e) {
|
|
4
|
-
if (e[FeatureFlag.Tt.ns] && "boolean" == typeof e[FeatureFlag.Tt.Fe])
|
|
5
|
-
return new FeatureFlag(
|
|
6
|
-
e[FeatureFlag.Tt.ns],
|
|
7
|
-
e[FeatureFlag.Tt.Fe],
|
|
8
|
-
e[FeatureFlag.Tt.we],
|
|
9
|
-
e[FeatureFlag.Tt.ze],
|
|
10
|
-
);
|
|
11
|
-
r.j.info(`Unable to create feature flag from ${JSON.stringify(e, null, 2)}`);
|
|
12
|
-
}
|
|
13
|
-
export function newFeatureFlagFromSerializedValue(e) {
|
|
14
|
-
if (e[FeatureFlag.hs.ns] && "boolean" == typeof e[FeatureFlag.hs.Fe])
|
|
15
|
-
return new FeatureFlag(
|
|
16
|
-
e[FeatureFlag.hs.ns],
|
|
17
|
-
e[FeatureFlag.hs.Fe],
|
|
18
|
-
e[FeatureFlag.hs.we],
|
|
19
|
-
e[FeatureFlag.hs.ze],
|
|
20
|
-
);
|
|
21
|
-
r.j.info(
|
|
22
|
-
`Unable to deserialize feature flag from ${JSON.stringify(e, null, 2)}`,
|
|
23
|
-
);
|
|
24
|
-
}
|
|
1
|
+
import r from"../../shared-lib/braze-shared-lib.js";import FeatureFlag from"./feature-flag.js";export function newFeatureFlagFromJson(e){if(e[FeatureFlag.Tt.ns]&&"boolean"==typeof e[FeatureFlag.Tt.Fe])return new FeatureFlag(e[FeatureFlag.Tt.ns],e[FeatureFlag.Tt.Fe],e[FeatureFlag.Tt.we],e[FeatureFlag.Tt.ze]);r.j.info(`Unable to create feature flag from ${JSON.stringify(e,null,2)}`)}export function newFeatureFlagFromSerializedValue(e){if(e[FeatureFlag.hs.ns]&&"boolean"==typeof e[FeatureFlag.hs.Fe])return new FeatureFlag(e[FeatureFlag.hs.ns],e[FeatureFlag.hs.Fe],e[FeatureFlag.hs.we],e[FeatureFlag.hs.ze]);r.j.info(`Unable to deserialize feature flag from ${JSON.stringify(e,null,2)}`)}
|
|
@@ -1,64 +1 @@
|
|
|
1
|
-
import r from
|
|
2
|
-
export default class FeatureFlag {
|
|
3
|
-
constructor(t, r = !1, e = {}, s) {
|
|
4
|
-
(this.id = t),
|
|
5
|
-
(this.enabled = r),
|
|
6
|
-
(this.properties = e),
|
|
7
|
-
(this.trackingString = s),
|
|
8
|
-
(this.id = t),
|
|
9
|
-
(this.enabled = r),
|
|
10
|
-
(this.properties = e),
|
|
11
|
-
(this.trackingString = s);
|
|
12
|
-
}
|
|
13
|
-
getStringProperty(t) {
|
|
14
|
-
const r = this.properties[t];
|
|
15
|
-
return null == r
|
|
16
|
-
? (this.Er(t), null)
|
|
17
|
-
: this.Ir(r)
|
|
18
|
-
? r.value
|
|
19
|
-
: (this.Nr("string"), null);
|
|
20
|
-
}
|
|
21
|
-
getNumberProperty(t) {
|
|
22
|
-
const r = this.properties[t];
|
|
23
|
-
return null == r
|
|
24
|
-
? (this.Er(t), null)
|
|
25
|
-
: this.Tr(r)
|
|
26
|
-
? r.value
|
|
27
|
-
: (this.Nr("number"), null);
|
|
28
|
-
}
|
|
29
|
-
getBooleanProperty(t) {
|
|
30
|
-
const r = this.properties[t];
|
|
31
|
-
return null == r
|
|
32
|
-
? (this.Er(t), null)
|
|
33
|
-
: this.Ar(r)
|
|
34
|
-
? r.value
|
|
35
|
-
: (this.Nr("boolean"), null);
|
|
36
|
-
}
|
|
37
|
-
ss() {
|
|
38
|
-
const t = {};
|
|
39
|
-
return (
|
|
40
|
-
(t[FeatureFlag.hs.ns] = this.id),
|
|
41
|
-
(t[FeatureFlag.hs.Fe] = this.enabled),
|
|
42
|
-
(t[FeatureFlag.hs.we] = this.properties),
|
|
43
|
-
(t[FeatureFlag.hs.ze] = this.trackingString),
|
|
44
|
-
t
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
Nr(t) {
|
|
48
|
-
r.j.info(`Property is not of type ${t}.`);
|
|
49
|
-
}
|
|
50
|
-
Er(t) {
|
|
51
|
-
r.j.info(`${t} not found in feature flag properties.`);
|
|
52
|
-
}
|
|
53
|
-
Ir(t) {
|
|
54
|
-
return "string" === t.type && "string" == typeof t.value;
|
|
55
|
-
}
|
|
56
|
-
Tr(t) {
|
|
57
|
-
return "number" === t.type && "number" == typeof t.value;
|
|
58
|
-
}
|
|
59
|
-
Ar(t) {
|
|
60
|
-
return "boolean" === t.type && "boolean" == typeof t.value;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
(FeatureFlag.hs = { ns: "id", Fe: "e", we: "pr", ze: "fts" }),
|
|
64
|
-
(FeatureFlag.Tt = { ns: "id", Fe: "enabled", we: "properties", ze: "fts" });
|
|
1
|
+
import r from"../../shared-lib/braze-shared-lib.js";export default class FeatureFlag{constructor(t,r=!1,e={},s){this.id=t,this.enabled=r,this.properties=e,this.trackingString=s,this.id=t,this.enabled=r,this.properties=e,this.trackingString=s}getStringProperty(t){const r=this.properties[t];return null==r?(this.Er(t),null):this.Ir(r)?r.value:(this.Nr("string"),null)}getNumberProperty(t){const r=this.properties[t];return null==r?(this.Er(t),null):this.Tr(r)?r.value:(this.Nr("number"),null)}getBooleanProperty(t){const r=this.properties[t];return null==r?(this.Er(t),null):this.Ar(r)?r.value:(this.Nr("boolean"),null)}ss(){const t={};return t[FeatureFlag.hs.ns]=this.id,t[FeatureFlag.hs.Fe]=this.enabled,t[FeatureFlag.hs.we]=this.properties,t[FeatureFlag.hs.ze]=this.trackingString,t}Nr(t){r.j.info(`Property is not of type ${t}.`)}Er(t){r.j.info(`${t} not found in feature flag properties.`)}Ir(t){return"string"===t.type&&"string"==typeof t.value}Tr(t){return"number"===t.type&&"number"==typeof t.value}Ar(t){return"boolean"===t.type&&"boolean"==typeof t.value}}FeatureFlag.hs={ns:"id",Fe:"e",we:"pr",ze:"fts"},FeatureFlag.Tt={ns:"id",Fe:"enabled",we:"properties",ze:"fts"};
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import er from "./feature-flags-provider.js";
|
|
3
|
-
const ir = {
|
|
4
|
-
t: !1,
|
|
5
|
-
provider: null,
|
|
6
|
-
er: () => (
|
|
7
|
-
ir.o(),
|
|
8
|
-
ir.provider ||
|
|
9
|
-
((ir.provider = new er(e.tr(), e.ar(), e.l())), e.dr(ir.provider)),
|
|
10
|
-
ir.provider
|
|
11
|
-
),
|
|
12
|
-
o: () => {
|
|
13
|
-
ir.t || (e.g(ir), (ir.t = !0));
|
|
14
|
-
},
|
|
15
|
-
destroy: () => {
|
|
16
|
-
(ir.provider = null), (ir.t = !1);
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
export default ir;
|
|
1
|
+
import e from"../managers/braze-instance.js";import er from"./feature-flags-provider.js";const ir={t:!1,provider:null,er:()=>(ir.o(),ir.provider||(ir.provider=new er(e.tr(),e.ar(),e.l()),e.dr(ir.provider)),ir.provider),o:()=>{ir.t||(e.g(ir),ir.t=!0)},destroy:()=>{ir.provider=null,ir.t=!1}};export default ir;
|
|
@@ -1,145 +1 @@
|
|
|
1
|
-
import r from
|
|
2
|
-
import y from "../common/base-provider.js";
|
|
3
|
-
import e from "../managers/braze-instance.js";
|
|
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
|
-
import {
|
|
9
|
-
newFeatureFlagFromJson as st,
|
|
10
|
-
newFeatureFlagFromSerializedValue as it,
|
|
11
|
-
} from "./feature-flag-factory.js";
|
|
12
|
-
import T from "../util/request-header-utils.js";
|
|
13
|
-
export default class er extends y {
|
|
14
|
-
constructor(t, s, i) {
|
|
15
|
-
super(),
|
|
16
|
-
(this.wt = t),
|
|
17
|
-
(this.gt = s),
|
|
18
|
-
(this.u = i),
|
|
19
|
-
(this.pi = []),
|
|
20
|
-
(this.gi = 0),
|
|
21
|
-
(this.wt = t),
|
|
22
|
-
(this.gt = s),
|
|
23
|
-
(this.u = i),
|
|
24
|
-
(this.Fi = null),
|
|
25
|
-
(this.wi = new E()),
|
|
26
|
-
(this.yi = 10),
|
|
27
|
-
(this.ji = null),
|
|
28
|
-
(this.bi = null),
|
|
29
|
-
e.jt(this.wi);
|
|
30
|
-
}
|
|
31
|
-
Ts(t) {
|
|
32
|
-
if ((!this.wt || this.wt.vi()) && null != t && t.feature_flags) {
|
|
33
|
-
this.pi = [];
|
|
34
|
-
for (const s of t.feature_flags) {
|
|
35
|
-
const t = st(s);
|
|
36
|
-
t && this.pi.push(t);
|
|
37
|
-
}
|
|
38
|
-
(this.gi = new Date().getTime()), this.Ti(), this.wi.Et(this.pi);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
Di() {
|
|
42
|
-
let t = {};
|
|
43
|
-
this.u && (t = this.u.v(i.k.Ri));
|
|
44
|
-
const s = {};
|
|
45
|
-
for (const i in t) {
|
|
46
|
-
const e = it(t[i]);
|
|
47
|
-
e && (s[e.id] = e);
|
|
48
|
-
}
|
|
49
|
-
return s;
|
|
50
|
-
}
|
|
51
|
-
Ni() {
|
|
52
|
-
var t;
|
|
53
|
-
return (null === (t = this.u) || void 0 === t ? void 0 : t.v(i.k.qi)) || {};
|
|
54
|
-
}
|
|
55
|
-
xi(t) {
|
|
56
|
-
this.u && this.u.D(i.k.qi, t);
|
|
57
|
-
}
|
|
58
|
-
ri(t) {
|
|
59
|
-
return this.wi.lt(t);
|
|
60
|
-
}
|
|
61
|
-
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
62
|
-
if (!this.zi(i))
|
|
63
|
-
return (
|
|
64
|
-
!this.Fi &&
|
|
65
|
-
this.wt &&
|
|
66
|
-
(this.Fi = this.wt.Ci(() => {
|
|
67
|
-
this.refreshFeatureFlags(t, s);
|
|
68
|
-
})),
|
|
69
|
-
void ("function" == typeof s && s())
|
|
70
|
-
);
|
|
71
|
-
if ((e && this.Ii(), !this.gt)) return void ("function" == typeof s && s());
|
|
72
|
-
const r = this.gt.Bs({}, !0),
|
|
73
|
-
h = this.gt.Hs(r, T.Os.Si);
|
|
74
|
-
let o = !1;
|
|
75
|
-
this.gt.Qs(r, () => {
|
|
76
|
-
this.gt
|
|
77
|
-
? (T.Ws(this.u, T.Os.Si, new Date().valueOf()),
|
|
78
|
-
C.Xs({
|
|
79
|
-
url: `${this.gt.Ys()}/feature_flags/sync`,
|
|
80
|
-
headers: h,
|
|
81
|
-
data: r,
|
|
82
|
-
O: (i) => {
|
|
83
|
-
if (!this.gt.Zs(r, i, h))
|
|
84
|
-
return (o = !0), void ("function" == typeof s && s());
|
|
85
|
-
this.gt.ti(),
|
|
86
|
-
this.Ts(i),
|
|
87
|
-
(o = !1),
|
|
88
|
-
T.si(this.u, T.Os.Si, 1),
|
|
89
|
-
"function" == typeof t && t();
|
|
90
|
-
},
|
|
91
|
-
error: (t) => {
|
|
92
|
-
this.gt.ii(t, "retrieving feature flags"),
|
|
93
|
-
(o = !0),
|
|
94
|
-
"function" == typeof s && s();
|
|
95
|
-
},
|
|
96
|
-
ei: () => {
|
|
97
|
-
if (e && o && !this.bi) {
|
|
98
|
-
T.hi(this.u, T.Os.Si);
|
|
99
|
-
let e = this.ji;
|
|
100
|
-
(null == e || e < 1e3 * this.yi) && (e = 1e3 * this.yi),
|
|
101
|
-
this.$i(Math.min(3e5, D(1e3 * this.yi, 3 * e)), t, s, i);
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
}))
|
|
105
|
-
: "function" == typeof s && s();
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
Ii() {
|
|
109
|
-
null != this.bi && (clearTimeout(this.bi), (this.bi = null));
|
|
110
|
-
}
|
|
111
|
-
$i(t = 1e3 * this.yi, s, i, e = !1) {
|
|
112
|
-
this.Ii(),
|
|
113
|
-
(this.bi = window.setTimeout(() => {
|
|
114
|
-
this.refreshFeatureFlags(s, i, e);
|
|
115
|
-
}, t)),
|
|
116
|
-
(this.ji = t);
|
|
117
|
-
}
|
|
118
|
-
zi(t) {
|
|
119
|
-
if (!this.wt) return !1;
|
|
120
|
-
if (!t) {
|
|
121
|
-
const t = this.wt.Mi();
|
|
122
|
-
if (null == t) return !1;
|
|
123
|
-
let s = !1;
|
|
124
|
-
if (!isNaN(t)) {
|
|
125
|
-
if (-1 === t) return r.j.info("Feature flag refreshes not allowed"), !1;
|
|
126
|
-
s = new Date().getTime() >= (this.gi || 0) + 1e3 * t;
|
|
127
|
-
}
|
|
128
|
-
if (!s)
|
|
129
|
-
return (
|
|
130
|
-
r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`),
|
|
131
|
-
!1
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
return this.wt.vi();
|
|
135
|
-
}
|
|
136
|
-
Ti() {
|
|
137
|
-
if (!this.u) return;
|
|
138
|
-
const t = {};
|
|
139
|
-
for (const s of this.pi) {
|
|
140
|
-
const i = s.ss();
|
|
141
|
-
t[s.id] = i;
|
|
142
|
-
}
|
|
143
|
-
this.u.D(i.k.Ri, t), this.u.D(i.k.Ui, this.gi);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
1
|
+
import r from"../../shared-lib/braze-shared-lib.js";import y from"../common/base-provider.js";import e from"../managers/braze-instance.js";import{STORAGE_KEYS as i}from"../managers/storage-manager.js";import E from"../managers/subscription-manager.js";import{randomInclusive as D}from"../util/math.js";import C from"../util/net.js";import{newFeatureFlagFromJson as st,newFeatureFlagFromSerializedValue as it}from"./feature-flag-factory.js";import T from"../util/request-header-utils.js";export default class er extends y{constructor(t,s,i){super(),this.wt=t,this.gt=s,this.u=i,this.pi=[],this.gi=0,this.wt=t,this.gt=s,this.u=i,this.Fi=null,this.wi=new E,this.yi=10,this.ji=null,this.bi=null,e.jt(this.wi)}Ts(t){if((!this.wt||this.wt.vi())&&null!=t&&t.feature_flags){this.pi=[];for(const s of t.feature_flags){const t=st(s);t&&this.pi.push(t)}this.gi=(new Date).getTime(),this.Ti(),this.wi.Et(this.pi)}}Di(){let t={};this.u&&(t=this.u.v(i.k.Ri));const s={};for(const i in t){const e=it(t[i]);e&&(s[e.id]=e)}return s}Ni(){var t;return(null===(t=this.u)||void 0===t?void 0:t.v(i.k.qi))||{}}xi(t){this.u&&this.u.D(i.k.qi,t)}ri(t){return this.wi.lt(t)}refreshFeatureFlags(t,s,i=!1,e=!0){if(!this.zi(i))return!this.Fi&&this.wt&&(this.Fi=this.wt.Ci((()=>{this.refreshFeatureFlags(t,s)}))),void("function"==typeof s&&s());if(e&&this.Ii(),!this.gt)return void("function"==typeof s&&s());const r=this.gt.Bs({},!0),h=this.gt.Hs(r,T.Os.Si);let o=!1;this.gt.Qs(r,(()=>{this.gt?(T.Ws(this.u,T.Os.Si,(new Date).valueOf()),C.Xs({url:`${this.gt.Ys()}/feature_flags/sync`,headers:h,data:r,O:i=>{if(!this.gt.Zs(r,i,h))return o=!0,void("function"==typeof s&&s());this.gt.ti(),this.Ts(i),o=!1,T.si(this.u,T.Os.Si,1),"function"==typeof t&&t()},error:t=>{this.gt.ii(t,"retrieving feature flags"),o=!0,"function"==typeof s&&s()},ei:()=>{if(e&&o&&!this.bi){T.hi(this.u,T.Os.Si);let e=this.ji;(null==e||e<1e3*this.yi)&&(e=1e3*this.yi),this.$i(Math.min(3e5,D(1e3*this.yi,3*e)),t,s,i)}}})):"function"==typeof s&&s()}))}Ii(){null!=this.bi&&(clearTimeout(this.bi),this.bi=null)}$i(t=1e3*this.yi,s,i,e=!1){this.Ii(),this.bi=window.setTimeout((()=>{this.refreshFeatureFlags(s,i,e)}),t),this.ji=t}zi(t){if(!this.wt)return!1;if(!t){const t=this.wt.Mi();if(null==t)return!1;let s=!1;if(!isNaN(t)){if(-1===t)return r.j.info("Feature flag refreshes not allowed"),!1;s=(new Date).getTime()>=(this.gi||0)+1e3*t}if(!s)return r.j.info(`Feature flag refreshes were rate limited to ${t} seconds`),!1}return this.wt.vi()}Ti(){if(!this.u)return;const t={};for(const s of this.pi){const i=s.ss();t[s.id]=i}this.u.D(i.k.Ri,t),this.u.D(i.k.Ui,this.gi)}}
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import r from
|
|
2
|
-
import e from "../managers/braze-instance.js";
|
|
3
|
-
import ir from "./feature-flags-provider-factory.js";
|
|
4
|
-
export function getAllFeatureFlags() {
|
|
5
|
-
if (!e.rr()) return;
|
|
6
|
-
const t = [],
|
|
7
|
-
a = e.tr();
|
|
8
|
-
if (a && !a.vi()) return r.j.info("Feature flags are not enabled."), t;
|
|
9
|
-
const o = ir.er().Di();
|
|
10
|
-
for (const r in o) t.push(o[r]);
|
|
11
|
-
return t;
|
|
12
|
-
}
|
|
1
|
+
import r from"../../shared-lib/braze-shared-lib.js";import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";export function getAllFeatureFlags(){if(!e.rr())return;const t=[],a=e.tr();if(a&&!a.vi())return r.j.info("Feature flags are not enabled."),t;const o=ir.er().Di();for(const r in o)t.push(o[r]);return t}
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import r from
|
|
2
|
-
import e from "../managers/braze-instance.js";
|
|
3
|
-
import FeatureFlag from "./feature-flag.js";
|
|
4
|
-
import ir from "./feature-flags-provider-factory.js";
|
|
5
|
-
export function getFeatureFlag(t) {
|
|
6
|
-
if (!e.rr()) return;
|
|
7
|
-
const a = e.tr();
|
|
8
|
-
if (a && !a.vi())
|
|
9
|
-
return r.j.info("Feature flags are not enabled."), new FeatureFlag(t);
|
|
10
|
-
const o = ir.er().Di();
|
|
11
|
-
return o[t] ? o[t] : new FeatureFlag(t);
|
|
12
|
-
}
|
|
1
|
+
import r from"../../shared-lib/braze-shared-lib.js";import e from"../managers/braze-instance.js";import FeatureFlag from"./feature-flag.js";import ir from"./feature-flags-provider-factory.js";export function getFeatureFlag(t){if(!e.rr())return;const a=e.tr();if(a&&!a.vi())return r.j.info("Feature flags are not enabled."),new FeatureFlag(t);const o=ir.er().Di();return o[t]?o[t]:new FeatureFlag(t)}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { refreshFeatureFlags } from "./refresh-feature-flags.js";
|
|
3
|
-
export { getFeatureFlag } from "./get-feature-flag.js";
|
|
4
|
-
export { subscribeToFeatureFlagsUpdates } from "./subscribe-to-feature-flags-updates.js";
|
|
5
|
-
export { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
6
|
-
export { logFeatureFlagImpression } from "./log-feature-flag-impression.js";
|
|
1
|
+
export{default as FeatureFlag}from"./feature-flag.js";export{refreshFeatureFlags}from"./refresh-feature-flags.js";export{getFeatureFlag}from"./get-feature-flag.js";export{subscribeToFeatureFlagsUpdates}from"./subscribe-to-feature-flags-updates.js";export{getAllFeatureFlags}from"./get-all-feature-flags.js";export{logFeatureFlagImpression}from"./log-feature-flag-impression.js";
|
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import r from
|
|
2
|
-
import s from "../common/event-logger.js";
|
|
3
|
-
import e from "../managers/braze-instance.js";
|
|
4
|
-
import ir from "./feature-flags-provider-factory.js";
|
|
5
|
-
export function logFeatureFlagImpression(t) {
|
|
6
|
-
if (!e.rr()) return;
|
|
7
|
-
if (!t) return !1;
|
|
8
|
-
const o = ir.er().Di();
|
|
9
|
-
if (!o[t]) return !1;
|
|
10
|
-
const n = o[t].trackingString;
|
|
11
|
-
if (!n)
|
|
12
|
-
return (
|
|
13
|
-
r.j.info(
|
|
14
|
-
"Not logging a feature flag impression. The feature flag was not part of any matching campaign.",
|
|
15
|
-
),
|
|
16
|
-
!1
|
|
17
|
-
);
|
|
18
|
-
const a = ir.er().Ni();
|
|
19
|
-
if (a[n]) return !1;
|
|
20
|
-
(a[n] = !0), ir.er().xi(a);
|
|
21
|
-
const i = { fid: t, fts: n };
|
|
22
|
-
return s.N(r.q.Fr, i).O;
|
|
23
|
-
}
|
|
1
|
+
import r from"../../shared-lib/braze-shared-lib.js";import s from"../common/event-logger.js";import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";export function logFeatureFlagImpression(t){if(!e.rr())return;if(!t)return!1;const o=ir.er().Di();if(!o[t])return!1;const n=o[t].trackingString;if(!n)return r.j.info("Not logging a feature flag impression. The feature flag was not part of any matching campaign."),!1;const a=ir.er().Ni();if(a[n])return!1;a[n]=!0,ir.er().xi(a);const i={fid:t,fts:n};return s.N(r.q.Fr,i).O}
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import ir from "./feature-flags-provider-factory.js";
|
|
3
|
-
function tr(r, t, a = !1) {
|
|
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
|
+
import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";function tr(r,t,a=!1){if(e.rr())return ir.er().refreshFeatureFlags(r,t,a)}export function refreshFeatureFlags(r,e){tr(r,e)}export default tr;
|
|
@@ -1,9 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import ir from "./feature-flags-provider-factory.js";
|
|
3
|
-
import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
4
|
-
export function subscribeToFeatureFlagsUpdates(r) {
|
|
5
|
-
if (!e.rr()) return;
|
|
6
|
-
const t = getAllFeatureFlags();
|
|
7
|
-
t && "function" == typeof r && r(t);
|
|
8
|
-
return ir.er().ri(r);
|
|
9
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import ir from"./feature-flags-provider-factory.js";import{getAllFeatureFlags}from"./get-all-feature-flags.js";export function subscribeToFeatureFlagsUpdates(r){if(!e.rr())return;const t=getAllFeatureFlags();t&&"function"==typeof r&&r(t);return ir.er().ri(r)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
import e from
|
|
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.cr())), e.dr(ie.provider)),
|
|
9
|
-
ie.provider
|
|
10
|
-
),
|
|
11
|
-
o: () => {
|
|
12
|
-
ie.t || (e.g(ie), (ie.t = !0));
|
|
13
|
-
},
|
|
14
|
-
destroy: () => {
|
|
15
|
-
(ie.provider = null), (ie.t = !1);
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
export default ie;
|
|
1
|
+
import e from"../managers/braze-instance.js";import re from"./feed-provider.js";const ie={t:!1,provider:null,er:()=>(ie.o(),ie.provider||(ie.provider=new re(e.l(),e.cr()),e.dr(ie.provider)),ie.provider),o:()=>{ie.t||(e.g(ie),ie.t=!0)},destroy:()=>{ie.provider=null,ie.t=!1}};export default ie;
|
|
@@ -1,90 +1 @@
|
|
|
1
|
-
import y from
|
|
2
|
-
import e from "../managers/braze-instance.js";
|
|
3
|
-
import Feed from "./feed.js";
|
|
4
|
-
import {
|
|
5
|
-
newCardFromFeedJson as ht,
|
|
6
|
-
newCardFromSerializedValue as R,
|
|
7
|
-
} from "../Card/util/card-factory.js";
|
|
8
|
-
import { rehydrateDateAfterJsonization as w } from "../util/date-utils.js";
|
|
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
|
-
constructor(t, s) {
|
|
13
|
-
super(),
|
|
14
|
-
(this.u = t),
|
|
15
|
-
(this.ki = s),
|
|
16
|
-
(this.cards = []),
|
|
17
|
-
(this.Ai = null),
|
|
18
|
-
(this.u = t),
|
|
19
|
-
(this.ki = s),
|
|
20
|
-
(this.yt = new E()),
|
|
21
|
-
e.jt(this.yt),
|
|
22
|
-
this.Lt();
|
|
23
|
-
}
|
|
24
|
-
Lt() {
|
|
25
|
-
let t = [];
|
|
26
|
-
this.u && (t = this.u.v(i.k.Bi) || []);
|
|
27
|
-
const s = [];
|
|
28
|
-
for (let i = 0; i < t.length; i++) {
|
|
29
|
-
const e = R(t[i]);
|
|
30
|
-
null != e && s.push(e);
|
|
31
|
-
}
|
|
32
|
-
(this.cards = s), this.u && (this.Ai = w(this.u.v(i.k.Ei)));
|
|
33
|
-
}
|
|
34
|
-
Gi(t) {
|
|
35
|
-
const s = [];
|
|
36
|
-
let e = null,
|
|
37
|
-
r = {};
|
|
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
|
-
}
|
|
47
|
-
}
|
|
48
|
-
(this.cards = s),
|
|
49
|
-
this.Rs(),
|
|
50
|
-
(this.Ai = new Date()),
|
|
51
|
-
this.u && (this.u.D(i.k.L, h), this.u.D(i.k.Ei, this.Ai));
|
|
52
|
-
}
|
|
53
|
-
Rs() {
|
|
54
|
-
if (!this.u) return;
|
|
55
|
-
const t = [];
|
|
56
|
-
for (let s = 0; s < this.cards.length; s++) t.push(this.cards[s].ss());
|
|
57
|
-
this.u.D(i.k.Bi, t);
|
|
58
|
-
}
|
|
59
|
-
Ts(t) {
|
|
60
|
-
null != t &&
|
|
61
|
-
t.feed &&
|
|
62
|
-
(this.Lt(),
|
|
63
|
-
this.Gi(t.feed),
|
|
64
|
-
this.yt.Et(new Feed(this.cards.slice(), this.Ai)));
|
|
65
|
-
}
|
|
66
|
-
Hi() {
|
|
67
|
-
this.Lt();
|
|
68
|
-
const t = [],
|
|
69
|
-
s = new Date();
|
|
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.Ai);
|
|
76
|
-
}
|
|
77
|
-
Ms() {
|
|
78
|
-
this.ki && this.ki.requestFeedRefresh();
|
|
79
|
-
}
|
|
80
|
-
ri(t) {
|
|
81
|
-
return this.yt.lt(t);
|
|
82
|
-
}
|
|
83
|
-
clearData(t) {
|
|
84
|
-
null == t && (t = !1),
|
|
85
|
-
(this.cards = []),
|
|
86
|
-
(this.Ai = null),
|
|
87
|
-
t && this.u && (this.u.ni(i.k.Bi), this.u.ni(i.k.Ei)),
|
|
88
|
-
this.yt.Et(new Feed(this.cards.slice(), this.Ai));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
import y from"../common/base-provider.js";import e from"../managers/braze-instance.js";import Feed from"./feed.js";import{newCardFromFeedJson as ht,newCardFromSerializedValue as R}from"../Card/util/card-factory.js";import{rehydrateDateAfterJsonization as w}from"../util/date-utils.js";import{STORAGE_KEYS as i}from"../managers/storage-manager.js";import E from"../managers/subscription-manager.js";export default class re extends y{constructor(t,s){super(),this.u=t,this.ki=s,this.cards=[],this.Ai=null,this.u=t,this.ki=s,this.yt=new E,e.jt(this.yt),this.Lt()}Lt(){let t=[];this.u&&(t=this.u.v(i.k.Bi)||[]);const s=[];for(let i=0;i<t.length;i++){const e=R(t[i]);null!=e&&s.push(e)}this.cards=s,this.u&&(this.Ai=w(this.u.v(i.k.Ei)))}Gi(t){const s=[];let e=null,r={};this.u&&(r=this.u.v(i.k.L)||{});const h={};for(let i=0;i<t.length;i++){e=t[i];const o=ht(e);if(null!=o){const t=o.id;t&&r[t]&&(o.viewed=!0,h[t]=!0),s.push(o)}}this.cards=s,this.Rs(),this.Ai=new Date,this.u&&(this.u.D(i.k.L,h),this.u.D(i.k.Ei,this.Ai))}Rs(){if(!this.u)return;const t=[];for(let s=0;s<this.cards.length;s++)t.push(this.cards[s].ss());this.u.D(i.k.Bi,t)}Ts(t){null!=t&&t.feed&&(this.Lt(),this.Gi(t.feed),this.yt.Et(new Feed(this.cards.slice(),this.Ai)))}Hi(){this.Lt();const t=[],s=new Date;for(let i=0;i<this.cards.length;i++){const e=this.cards[i].expiresAt;let r=!0;null!=e&&(r=e>=s),r&&t.push(this.cards[i])}return new Feed(t,this.Ai)}Ms(){this.ki&&this.ki.requestFeedRefresh()}ri(t){return this.yt.lt(t)}clearData(t){null==t&&(t=!1),this.cards=[],this.Ai=null,t&&this.u&&(this.u.ni(i.k.Bi),this.u.ni(i.k.Ei)),this.yt.Et(new Feed(this.cards.slice(),this.Ai))}}
|
package/src/Feed/feed.js
CHANGED
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import x from
|
|
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
|
-
return logCardClick(r, !1);
|
|
13
|
-
}
|
|
14
|
-
sr() {
|
|
15
|
-
requestFeedRefresh();
|
|
16
|
-
}
|
|
17
|
-
ur() {
|
|
18
|
-
return !1;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import x from"../common/base-feed.js";import{logCardClick,logCardImpressions}from"../Card/index.js";import{requestFeedRefresh}from"./request-feed-refresh.js";export default class Feed extends x{constructor(r,e){super(r,e)}logCardImpressions(r){logCardImpressions(r,!1)}logCardClick(r){return logCardClick(r,!1)}sr(){requestFeedRefresh()}ur(){return!1}}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import ie from "./feed-provider-factory.js";
|
|
3
|
-
export function getCachedFeed() {
|
|
4
|
-
if (e.rr()) return ie.er().Hi();
|
|
5
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import ie from"./feed-provider-factory.js";export function getCachedFeed(){if(e.rr())return ie.er().Hi()}
|
package/src/Feed/index.js
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
export
|
|
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
|
+
export{default as Feed}from"./feed.js";export{getCachedFeed}from"./get-cached-feed.js";export{destroyFeed}from"./ui/hide-feed.js";export{logFeedDisplayed}from"./log-feed-displayed.js";export{requestFeedRefresh}from"./request-feed-refresh.js";export{showFeed}from"./ui/show-feed.js";export{subscribeToFeedUpdates}from"./subscribe-to-feed-updates.js";export{toggleFeed}from"./ui/toggle-feed.js";
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
-
export function logFeedDisplayed() {
|
|
4
|
-
if (!e.rr()) return;
|
|
5
|
-
const i = e.ar();
|
|
6
|
-
return i ? i.qr(r.Cr.Br).O : void 0;
|
|
7
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import r from"../../shared-lib/braze-shared-lib.js";export function logFeedDisplayed(){if(!e.rr())return;const i=e.ar();return i?i.qr(r.Cr.Br).O:void 0}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import ie from "./feed-provider-factory.js";
|
|
3
|
-
export function requestFeedRefresh() {
|
|
4
|
-
if (e.rr()) return ie.er().Ms();
|
|
5
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import ie from"./feed-provider-factory.js";export function requestFeedRefresh(){if(e.rr())return ie.er().Ms()}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import e from
|
|
2
|
-
import ie from "./feed-provider-factory.js";
|
|
3
|
-
export function subscribeToFeedUpdates(r) {
|
|
4
|
-
if (e.rr()) return ie.er().ri(r);
|
|
5
|
-
}
|
|
1
|
+
import e from"../managers/braze-instance.js";import ie from"./feed-provider-factory.js";export function subscribeToFeedUpdates(r){if(e.rr())return ie.er().ri(r)}
|