@braze/web-sdk 5.5.0 → 5.6.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 +109 -7
- package/package.json +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +33 -31
- package/shared-lib/guid.js +3 -3
- package/shared-lib/indexed-db-adapter.js +20 -20
- package/shared-lib/logger.js +18 -18
- package/shared-lib/supported-options.js +24 -24
- package/src/Banner/banner-factory.js +14 -0
- package/src/Banner/banner-provider-factory.js +19 -0
- package/src/Banner/banner-provider.js +198 -0
- package/src/Banner/banner.js +30 -0
- package/src/Banner/display/banner-to-html.js +57 -0
- package/src/Banner/display/destroy-banner-html.js +7 -0
- package/src/Banner/display/detect-banner-impressions.js +28 -0
- package/src/Banner/get-all-banners.js +13 -0
- package/src/Banner/get-banner.js +19 -0
- package/src/Banner/index.js +7 -0
- package/src/Banner/log-banner-click.js +22 -0
- package/src/Banner/log-banner-impressions.js +31 -0
- package/src/Banner/request-banners-refresh.js +35 -0
- package/src/Banner/subscribe-to-banners-updates.js +23 -0
- package/src/Banner/types.js +1 -0
- package/src/Banner/ui/insert-banner.js +24 -0
- package/src/Card/card-manager-factory.js +10 -10
- package/src/Card/card-manager.js +54 -52
- package/src/Card/display/card-display.js +77 -91
- package/src/Card/log-card-click.js +6 -6
- package/src/Card/log-card-dismissal.js +6 -5
- package/src/Card/log-card-impressions.js +11 -11
- package/src/Card/models/captioned-image.js +21 -21
- package/src/Card/models/card.js +99 -99
- 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 +58 -58
- package/src/ContentCards/content-cards-provider-factory.js +14 -14
- package/src/ContentCards/content-cards-provider.js +261 -263
- package/src/ContentCards/content-cards.js +5 -5
- package/src/ContentCards/get-cached-content-cards.js +3 -3
- package/src/ContentCards/request-content-cards-refresh.js +4 -4
- package/src/ContentCards/subscribe-to-content-cards-updates.js +13 -13
- package/src/ContentCards/ui/hide-content-cards.js +7 -7
- package/src/ContentCards/ui/show-content-cards.js +52 -52
- package/src/ContentCards/ui/toggle-content-cards.js +4 -4
- package/src/Core/add-sdk-metadata.js +9 -9
- package/src/Core/change-user.js +14 -14
- package/src/Core/destroy.js +3 -3
- package/src/Core/disable-sdk.js +13 -13
- package/src/Core/enable-sdk.js +9 -9
- package/src/Core/get-device-id.js +10 -10
- package/src/Core/get-user.js +2 -2
- package/src/Core/handle-braze-action.js +53 -53
- package/src/Core/initialize.js +2 -2
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/is-initialized.js +2 -2
- package/src/Core/log-custom-event.js +27 -27
- package/src/Core/log-purchase.js +38 -38
- package/src/Core/open-session.js +18 -18
- package/src/Core/remove-all-subscriptions.js +2 -2
- package/src/Core/remove-subscription.js +3 -3
- package/src/Core/request-immediate-data-flush.js +5 -5
- package/src/Core/set-logger.js +2 -2
- package/src/Core/set-sdk-authentication-signature.js +6 -6
- package/src/Core/subscribe-to-sdk-authentication-failures.js +5 -5
- package/src/Core/toggle-logging.js +2 -2
- package/src/Core/wipe-data.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +13 -13
- package/src/FeatureFlags/feature-flag.js +10 -10
- package/src/FeatureFlags/feature-flags-provider-factory.js +13 -14
- package/src/FeatureFlags/feature-flags-provider.js +118 -116
- package/src/FeatureFlags/get-all-feature-flags.js +10 -10
- package/src/FeatureFlags/get-feature-flag.js +9 -9
- package/src/FeatureFlags/log-feature-flag-impression.js +18 -18
- package/src/FeatureFlags/refresh-feature-flags.js +6 -6
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +9 -9
- package/src/Feed/feed-provider-factory.js +12 -12
- package/src/Feed/feed-provider.js +59 -59
- package/src/Feed/feed.js +4 -4
- package/src/Feed/get-cached-feed.js +3 -3
- package/src/Feed/log-feed-displayed.js +5 -5
- package/src/Feed/request-feed-refresh.js +3 -3
- package/src/Feed/subscribe-to-feed-updates.js +4 -4
- package/src/Feed/ui/hide-feed.js +5 -5
- package/src/Feed/ui/show-feed.js +53 -53
- package/src/Feed/ui/toggle-feed.js +4 -4
- package/src/InAppMessage/defer-in-app-message.js +9 -9
- package/src/InAppMessage/display/html-message-display-utils.js +18 -164
- package/src/InAppMessage/display/html-message-to-html.js +55 -62
- package/src/InAppMessage/display/in-app-message-to-html.js +74 -74
- package/src/InAppMessage/display/modal-utils.js +17 -17
- package/src/InAppMessage/get-deferred-in-app-message.js +2 -2
- package/src/InAppMessage/in-app-message-factory.js +61 -61
- package/src/InAppMessage/in-app-message-manager-factory.js +9 -9
- package/src/InAppMessage/in-app-message-manager.js +158 -156
- package/src/InAppMessage/log-in-app-message-button-click.js +16 -16
- package/src/InAppMessage/log-in-app-message-click.js +11 -11
- package/src/InAppMessage/log-in-app-message-html-click.js +15 -15
- package/src/InAppMessage/log-in-app-message-impression.js +6 -6
- package/src/InAppMessage/models/control-message.js +15 -8
- package/src/InAppMessage/models/full-screen-message.js +34 -34
- package/src/InAppMessage/models/html-message.js +23 -23
- package/src/InAppMessage/models/in-app-message-button.js +10 -10
- package/src/InAppMessage/models/in-app-message.js +155 -155
- package/src/InAppMessage/models/modal-message.js +33 -33
- package/src/InAppMessage/models/slide-up-message.js +35 -35
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +3 -3
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +103 -103
- 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 +25 -25
- package/src/Push/push-manager.js +176 -176
- package/src/Push/request-push-permission.js +8 -8
- package/src/Push/unregister-push.js +4 -4
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +38 -38
- package/src/User/user.js +95 -92
- package/src/common/base-feed.js +9 -9
- package/src/common/base-provider.js +2 -2
- package/src/common/constants.js +1 -0
- package/src/common/detect-impression.js +18 -0
- package/src/common/event-logger.js +22 -22
- package/src/common/feed-display.js +53 -53
- package/src/index.js +1 -0
- package/src/l10n/l10n-manager-factory.js +15 -15
- package/src/l10n/l10n-manager.js +4 -4
- package/src/managers/auth-manager.js +38 -38
- package/src/managers/braze-instance.js +212 -212
- package/src/managers/device-manager.js +30 -30
- package/src/managers/network-manager.js +234 -235
- package/src/managers/server-config-manager.js +99 -83
- package/src/managers/session-manager.js +46 -50
- package/src/managers/storage-manager-factory.js +13 -13
- package/src/managers/storage-manager.js +182 -180
- package/src/managers/subscription-manager.js +12 -12
- package/src/managers/utils.js +4 -4
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +9 -9
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +15 -15
- package/src/models/push-token.js +10 -10
- package/src/models/request-result.js +4 -4
- package/src/models/server-config.js +38 -34
- package/src/request-controller.js +228 -228
- package/src/triggers/models/custom-event-data.js +5 -5
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +10 -10
- package/src/triggers/models/filter.js +66 -66
- package/src/triggers/models/in-app-message-click-data.js +10 -10
- package/src/triggers/models/purchase-data.js +2 -2
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +5 -5
- package/src/triggers/models/trigger-condition.js +46 -46
- package/src/triggers/models/trigger-events.js +4 -4
- package/src/triggers/models/trigger.js +33 -33
- package/src/triggers/triggers-provider-factory.js +16 -16
- package/src/triggers/triggers-provider.js +156 -154
- package/src/ui/js/attach-css.js +7 -7
- package/src/ui/js/banner-css.js +11 -0
- package/src/ui/js/feed-css.js +4 -4
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/index.js +1 -0
- package/src/ui/js/load-font-awesome.js +8 -8
- package/src/util/base-device-parser.js +9 -9
- package/src/util/braze-actions.js +32 -32
- package/src/util/browser-detector.js +31 -30
- package/src/util/client-hints-parser.js +10 -10
- package/src/util/code-utils.js +5 -5
- package/src/util/component-utils.js +5 -5
- package/src/util/deprecation-utils.js +3 -3
- package/src/util/device-constants.js +1 -1
- package/src/util/dom-utils.js +13 -13
- package/src/util/html-display-utils.js +158 -0
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +21 -21
- package/src/util/request-header-utils.js +31 -30
- package/src/util/string-utils.js +2 -2
- package/src/util/user-agent-parser.js +18 -18
- package/src/util/validation-utils.js +89 -85
- package/src/util/window-utils.js +3 -3
|
@@ -1,177 +1,179 @@
|
|
|
1
|
-
import { logger as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { STORAGE_KEYS as
|
|
5
|
-
import
|
|
6
|
-
import { randomInclusive as
|
|
7
|
-
import
|
|
1
|
+
import { logger as N } from "../../shared-lib/index.js";
|
|
2
|
+
import s from "../common/base-provider.js";
|
|
3
|
+
import r from "../managers/braze-instance.js";
|
|
4
|
+
import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
5
|
+
import u from "../managers/subscription-manager.js";
|
|
6
|
+
import { randomInclusive as a } from "../util/math.js";
|
|
7
|
+
import l from "../util/net.js";
|
|
8
8
|
import {
|
|
9
|
-
newFeatureFlagFromJson as
|
|
10
|
-
newFeatureFlagFromSerializedValue as
|
|
9
|
+
newFeatureFlagFromJson as ht,
|
|
10
|
+
newFeatureFlagFromSerializedValue as at,
|
|
11
11
|
} from "./feature-flag-factory.js";
|
|
12
|
-
import
|
|
13
|
-
export default class
|
|
14
|
-
constructor(t, s, i,
|
|
12
|
+
import h from "../util/request-header-utils.js";
|
|
13
|
+
export default class tr extends s {
|
|
14
|
+
constructor(t, s, i, e) {
|
|
15
15
|
super(),
|
|
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
|
-
(this.
|
|
29
|
-
(this.
|
|
30
|
-
(this.
|
|
31
|
-
|
|
16
|
+
(this.B = t),
|
|
17
|
+
(this.S = s),
|
|
18
|
+
(this.C = i),
|
|
19
|
+
(this.T = e),
|
|
20
|
+
(this.Gi = []),
|
|
21
|
+
(this.Hi = 0),
|
|
22
|
+
(this.B = t),
|
|
23
|
+
(this.S = s),
|
|
24
|
+
(this.C = i),
|
|
25
|
+
(this.T = e),
|
|
26
|
+
(this.Ki = null),
|
|
27
|
+
(this.Oi = new u()),
|
|
28
|
+
(this.R = 10),
|
|
29
|
+
(this.I = null),
|
|
30
|
+
(this.q = null),
|
|
31
|
+
r.N(this.Oi);
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
U(t) {
|
|
34
34
|
var s;
|
|
35
35
|
if (
|
|
36
|
-
(null === (s = this.
|
|
36
|
+
(null === (s = this.B) || void 0 === s ? void 0 : s.Qi()) &&
|
|
37
37
|
null != t &&
|
|
38
38
|
t.feature_flags
|
|
39
39
|
) {
|
|
40
|
-
this.
|
|
40
|
+
this.Gi = [];
|
|
41
41
|
for (const s of t.feature_flags) {
|
|
42
|
-
const t =
|
|
43
|
-
t && this.
|
|
42
|
+
const t = ht(s);
|
|
43
|
+
t && this.Gi.push(t);
|
|
44
44
|
}
|
|
45
|
-
(this.
|
|
45
|
+
(this.Hi = new Date().getTime()), this.Vi(), this.Oi.X(this.Gi);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
this.
|
|
51
|
-
const
|
|
52
|
-
for (const
|
|
53
|
-
const e =
|
|
54
|
-
e && (
|
|
48
|
+
Wi() {
|
|
49
|
+
let s = {};
|
|
50
|
+
this.C && (s = this.C.ps(t.bs.Yi));
|
|
51
|
+
const i = {};
|
|
52
|
+
for (const t in s) {
|
|
53
|
+
const e = at(s[t]);
|
|
54
|
+
e && (i[e.id] = e);
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return i;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
var
|
|
60
|
-
return (
|
|
58
|
+
Zi() {
|
|
59
|
+
var s;
|
|
60
|
+
return (
|
|
61
|
+
(null === (s = this.C) || void 0 === s ? void 0 : s.ps(t.bs.we)) || {}
|
|
62
|
+
);
|
|
61
63
|
}
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
+
je(s) {
|
|
65
|
+
this.C && this.C.js(t.bs.we, s);
|
|
64
66
|
}
|
|
65
|
-
|
|
66
|
-
return this.
|
|
67
|
+
Fs(t) {
|
|
68
|
+
return this.Oi.Ns(t);
|
|
67
69
|
}
|
|
68
70
|
refreshFeatureFlags(t, s, i = !1, e = !0) {
|
|
69
71
|
const r = () => {
|
|
70
|
-
"function" == typeof s && s(), this.
|
|
72
|
+
"function" == typeof s && s(), this.Oi.X(this.Gi);
|
|
71
73
|
};
|
|
72
|
-
if (!this.
|
|
74
|
+
if (!this.Ce(i))
|
|
73
75
|
return (
|
|
74
|
-
!this.
|
|
75
|
-
this.
|
|
76
|
-
(this.
|
|
76
|
+
!this.Ki &&
|
|
77
|
+
this.B &&
|
|
78
|
+
(this.Ki = this.B.Re(() => {
|
|
77
79
|
this.refreshFeatureFlags(t, s);
|
|
78
80
|
})),
|
|
79
81
|
void r()
|
|
80
82
|
);
|
|
81
|
-
const
|
|
82
|
-
if (!
|
|
83
|
-
e && this.
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
(
|
|
90
|
-
if (!this
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
-1 !==
|
|
94
|
-
|
|
95
|
-
url: `${this
|
|
96
|
-
headers:
|
|
97
|
-
data:
|
|
98
|
-
|
|
99
|
-
if (!this
|
|
100
|
-
this
|
|
101
|
-
this.
|
|
102
|
-
(
|
|
103
|
-
|
|
83
|
+
const o = this.S;
|
|
84
|
+
if (!o) return void r();
|
|
85
|
+
e && this.G();
|
|
86
|
+
const n = o.H({}, !0),
|
|
87
|
+
u = o.J(n, h.O.De);
|
|
88
|
+
let f = !1;
|
|
89
|
+
o.V(
|
|
90
|
+
n,
|
|
91
|
+
(o = -1) => {
|
|
92
|
+
if (!this.S) return void r();
|
|
93
|
+
const c = new Date().valueOf();
|
|
94
|
+
h.W(this.C, h.O.De, c),
|
|
95
|
+
-1 !== o && u.push(["X-Braze-Req-Tokens-Remaining", o.toString()]),
|
|
96
|
+
l.Y({
|
|
97
|
+
url: `${this.S.Z()}/feature_flags/sync`,
|
|
98
|
+
headers: u,
|
|
99
|
+
data: n,
|
|
100
|
+
ss: (s) => {
|
|
101
|
+
if (!this.S.ts(n, s, u)) return (f = !0), void r();
|
|
102
|
+
this.S.es(),
|
|
103
|
+
this.U(s),
|
|
104
|
+
(f = !1),
|
|
105
|
+
h.ns(this.C, h.O.De, 1),
|
|
104
106
|
"function" == typeof t && t();
|
|
105
107
|
},
|
|
106
108
|
error: (t) => {
|
|
107
|
-
this
|
|
109
|
+
this.S.rs(t, "retrieving feature flags"), (f = !0), r();
|
|
108
110
|
},
|
|
109
|
-
|
|
110
|
-
if (e &&
|
|
111
|
-
|
|
112
|
-
let e = this.
|
|
113
|
-
(null == e || e < 1e3 * this.
|
|
114
|
-
this.
|
|
111
|
+
os: () => {
|
|
112
|
+
if (e && f && !this.q) {
|
|
113
|
+
h.hs(this.C, h.O.De);
|
|
114
|
+
let e = this.I;
|
|
115
|
+
(null == e || e < 1e3 * this.R) && (e = 1e3 * this.R),
|
|
116
|
+
this.ls(Math.min(3e5, a(1e3 * this.R, 3 * e)), t, s, i);
|
|
115
117
|
}
|
|
116
118
|
},
|
|
117
119
|
});
|
|
118
120
|
},
|
|
119
|
-
|
|
121
|
+
h.O.De,
|
|
120
122
|
s,
|
|
121
123
|
);
|
|
122
124
|
}
|
|
123
|
-
|
|
124
|
-
null != this.
|
|
125
|
+
G() {
|
|
126
|
+
null != this.q && (clearTimeout(this.q), (this.q = null));
|
|
125
127
|
}
|
|
126
|
-
|
|
127
|
-
this.
|
|
128
|
-
(this.
|
|
128
|
+
ls(t = 1e3 * this.R, s, i, e = !1) {
|
|
129
|
+
this.G(),
|
|
130
|
+
(this.q = window.setTimeout(() => {
|
|
129
131
|
this.refreshFeatureFlags(s, i, e);
|
|
130
132
|
}, t)),
|
|
131
|
-
(this.
|
|
133
|
+
(this.I = t);
|
|
132
134
|
}
|
|
133
|
-
|
|
134
|
-
if (!this.
|
|
135
|
+
Ce(t) {
|
|
136
|
+
if (!this.B) return !1;
|
|
135
137
|
if (!t) {
|
|
136
|
-
const t = this.
|
|
138
|
+
const t = this.B.Se();
|
|
137
139
|
if (null == t) return !1;
|
|
138
140
|
let s = !1;
|
|
139
141
|
if (!isNaN(t)) {
|
|
140
|
-
if (-1 === t) return
|
|
141
|
-
s = new Date().getTime() >= (this.
|
|
142
|
+
if (-1 === t) return N.info("Feature flag refreshes not allowed"), !1;
|
|
143
|
+
s = new Date().getTime() >= (this.Hi || 0) + 1e3 * t;
|
|
142
144
|
}
|
|
143
145
|
if (!s)
|
|
144
146
|
return (
|
|
145
|
-
|
|
147
|
+
N.info(`Feature flag refreshes were rate limited to ${t} seconds`), !1
|
|
146
148
|
);
|
|
147
149
|
}
|
|
148
|
-
return this.
|
|
150
|
+
return this.B.Qi();
|
|
149
151
|
}
|
|
150
|
-
|
|
151
|
-
var
|
|
152
|
+
qe() {
|
|
153
|
+
var s;
|
|
152
154
|
return (
|
|
153
|
-
(null === (
|
|
155
|
+
(null === (s = this.C) || void 0 === s ? void 0 : s.ps(t.bs.xe)) || null
|
|
154
156
|
);
|
|
155
157
|
}
|
|
156
|
-
|
|
157
|
-
var
|
|
158
|
-
null === (
|
|
159
|
-
void 0 ===
|
|
160
|
-
|
|
158
|
+
ze() {
|
|
159
|
+
var s, i;
|
|
160
|
+
null === (s = this.C) ||
|
|
161
|
+
void 0 === s ||
|
|
162
|
+
s.js(t.bs.xe, null === (i = this.T) || void 0 === i ? void 0 : i.Ss());
|
|
161
163
|
}
|
|
162
|
-
|
|
164
|
+
$e() {
|
|
163
165
|
var t;
|
|
164
|
-
const s = null === (t = this.
|
|
165
|
-
i = this.
|
|
166
|
+
const s = null === (t = this.T) || void 0 === t ? void 0 : t.Ss(),
|
|
167
|
+
i = this.qe();
|
|
166
168
|
return null == i || s === i;
|
|
167
169
|
}
|
|
168
|
-
|
|
169
|
-
if (!this.
|
|
170
|
-
const
|
|
171
|
-
for (const
|
|
172
|
-
const i =
|
|
173
|
-
t
|
|
170
|
+
Vi() {
|
|
171
|
+
if (!this.C) return;
|
|
172
|
+
const s = {};
|
|
173
|
+
for (const t of this.Gi) {
|
|
174
|
+
const i = t.Bs();
|
|
175
|
+
s[t.id] = i;
|
|
174
176
|
}
|
|
175
|
-
this.
|
|
177
|
+
this.C.js(t.bs.Yi, s), this.C.js(t.bs.ke, this.Hi), this.ze();
|
|
176
178
|
}
|
|
177
179
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { logger as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { logger as N } from "../../shared-lib/index.js";
|
|
2
|
+
import r from "../managers/braze-instance.js";
|
|
3
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
4
4
|
export function getAllFeatureFlags() {
|
|
5
|
-
if (!
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
10
|
-
for (const r in
|
|
11
|
-
return
|
|
5
|
+
if (!r.rr()) return;
|
|
6
|
+
const e = [],
|
|
7
|
+
t = r.v();
|
|
8
|
+
if (t && !t.Qi()) return N.info("Feature flags are not enabled."), e;
|
|
9
|
+
const n = nr.m().Wi();
|
|
10
|
+
for (const r in n) e.push(n[r]);
|
|
11
|
+
return e;
|
|
12
12
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { logger as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
export function getFeatureFlag(
|
|
5
|
-
if (!
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const
|
|
9
|
-
return
|
|
1
|
+
import { logger as N } from "../../shared-lib/index.js";
|
|
2
|
+
import r from "../managers/braze-instance.js";
|
|
3
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
4
|
+
export function getFeatureFlag(e) {
|
|
5
|
+
if (!r.rr()) return;
|
|
6
|
+
const t = r.v();
|
|
7
|
+
if (t && !t.Qi()) return N.info("Feature flags are not enabled."), null;
|
|
8
|
+
const n = nr.m().Wi();
|
|
9
|
+
return n[e] ? n[e] : null;
|
|
10
10
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { logger as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
export function logFeatureFlagImpression(
|
|
6
|
-
if (!
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
1
|
+
import { logger as N, EventTypes as d } from "../../shared-lib/index.js";
|
|
2
|
+
import c from "../common/event-logger.js";
|
|
3
|
+
import r from "../managers/braze-instance.js";
|
|
4
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
5
|
+
export function logFeatureFlagImpression(e) {
|
|
6
|
+
if (!r.rr()) return;
|
|
7
|
+
if (!e) return !1;
|
|
8
|
+
const t =
|
|
9
9
|
"Not logging a feature flag impression. The feature flag was not part of any matching experiment.",
|
|
10
|
-
|
|
11
|
-
if (!
|
|
12
|
-
const
|
|
13
|
-
if (!
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
10
|
+
o = nr.m().Wi();
|
|
11
|
+
if (!o[e]) return N.info(t), !1;
|
|
12
|
+
const n = o[e].trackingString;
|
|
13
|
+
if (!n) return N.info(t), !1;
|
|
14
|
+
const i = nr.m().Zi();
|
|
15
|
+
if (i[n])
|
|
16
16
|
return (
|
|
17
|
-
|
|
17
|
+
N.info(
|
|
18
18
|
"Not logging another feature flag impression. This ID was already logged this session.",
|
|
19
19
|
),
|
|
20
20
|
!1
|
|
21
21
|
);
|
|
22
|
-
(
|
|
23
|
-
const
|
|
24
|
-
return
|
|
22
|
+
(i[n] = !0), nr.m().je(i);
|
|
23
|
+
const s = { fid: e, fts: n };
|
|
24
|
+
return c.ds(d.yr, s).ss;
|
|
25
25
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
function
|
|
4
|
-
if (
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
3
|
+
function ar(e, t, a = !1) {
|
|
4
|
+
if (r.rr()) return nr.m().refreshFeatureFlags(e, t, a);
|
|
5
5
|
}
|
|
6
6
|
export function refreshFeatureFlags(r, e) {
|
|
7
|
-
|
|
7
|
+
ar(r, e);
|
|
8
8
|
}
|
|
9
|
-
export default
|
|
9
|
+
export default ar;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import nr from "./feature-flags-provider-factory.js";
|
|
3
3
|
import { getAllFeatureFlags } from "./get-all-feature-flags.js";
|
|
4
|
-
export function subscribeToFeatureFlagsUpdates(
|
|
5
|
-
if (!
|
|
6
|
-
const
|
|
7
|
-
if (
|
|
8
|
-
const
|
|
9
|
-
|
|
4
|
+
export function subscribeToFeatureFlagsUpdates(t) {
|
|
5
|
+
if (!r.rr()) return;
|
|
6
|
+
const e = nr.m();
|
|
7
|
+
if (e.$e()) {
|
|
8
|
+
const r = getAllFeatureFlags();
|
|
9
|
+
r && "function" == typeof t && t(r);
|
|
10
10
|
}
|
|
11
|
-
return
|
|
11
|
+
return e.Fs(t);
|
|
12
12
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import re from "./feed-provider.js";
|
|
3
|
+
const ie = {
|
|
4
|
+
l: !1,
|
|
5
5
|
provider: null,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
m: () => (
|
|
7
|
+
ie.p(),
|
|
8
|
+
ie.provider || ((ie.provider = new re(r.j(), r.nn())), r._(ie.provider)),
|
|
9
|
+
ie.provider
|
|
10
10
|
),
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
p: () => {
|
|
12
|
+
ie.l || (r.h(ie), (ie.l = !0));
|
|
13
13
|
},
|
|
14
14
|
destroy: () => {
|
|
15
|
-
(
|
|
15
|
+
(ie.provider = null), (ie.l = !1);
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
|
-
export default
|
|
18
|
+
export default ie;
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import s from "../common/base-provider.js";
|
|
2
|
+
import r from "../managers/braze-instance.js";
|
|
3
3
|
import Feed from "./feed.js";
|
|
4
4
|
import {
|
|
5
|
-
newCardFromFeedJson as
|
|
6
|
-
newCardFromSerializedValue as
|
|
5
|
+
newCardFromFeedJson as lt,
|
|
6
|
+
newCardFromSerializedValue as tt,
|
|
7
7
|
} from "../Card/util/card-factory.js";
|
|
8
|
-
import { rehydrateDateAfterJsonization as
|
|
9
|
-
import { STORAGE_KEYS as
|
|
10
|
-
import
|
|
11
|
-
export default class
|
|
8
|
+
import { rehydrateDateAfterJsonization as V } from "../util/date-utils.js";
|
|
9
|
+
import { STORAGE_KEYS as t } from "../managers/storage-manager.js";
|
|
10
|
+
import u from "../managers/subscription-manager.js";
|
|
11
|
+
export default class re extends s {
|
|
12
12
|
constructor(t, s) {
|
|
13
13
|
super(),
|
|
14
|
-
(this.
|
|
15
|
-
(this.
|
|
14
|
+
(this.C = t),
|
|
15
|
+
(this.Ue = s),
|
|
16
16
|
(this.cards = []),
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
19
|
-
(this.
|
|
20
|
-
(this.
|
|
21
|
-
|
|
22
|
-
this.
|
|
17
|
+
(this.Ae = null),
|
|
18
|
+
(this.C = t),
|
|
19
|
+
(this.Ue = s),
|
|
20
|
+
(this.Ms = new u()),
|
|
21
|
+
r.N(this.Ms),
|
|
22
|
+
this.Xs();
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
this.
|
|
27
|
-
const
|
|
28
|
-
for (let
|
|
29
|
-
const e =
|
|
30
|
-
null != e &&
|
|
24
|
+
Xs() {
|
|
25
|
+
let s = [];
|
|
26
|
+
this.C && (s = this.C.ps(t.bs.Be) || []);
|
|
27
|
+
const i = [];
|
|
28
|
+
for (let t = 0; t < s.length; t++) {
|
|
29
|
+
const e = tt(s[t]);
|
|
30
|
+
null != e && i.push(e);
|
|
31
31
|
}
|
|
32
|
-
(this.cards =
|
|
32
|
+
(this.cards = i), this.C && (this.Ae = V(this.C.ps(t.bs.Ge)));
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
this.
|
|
39
|
-
const
|
|
40
|
-
for (let
|
|
41
|
-
|
|
42
|
-
const o =
|
|
34
|
+
He(s) {
|
|
35
|
+
const i = [];
|
|
36
|
+
let e = null,
|
|
37
|
+
r = {};
|
|
38
|
+
this.C && (r = this.C.ps(t.bs.Ct) || {});
|
|
39
|
+
const h = {};
|
|
40
|
+
for (let t = 0; t < s.length; t++) {
|
|
41
|
+
e = s[t];
|
|
42
|
+
const o = lt(e);
|
|
43
43
|
if (null != o) {
|
|
44
44
|
const t = o.id;
|
|
45
|
-
t &&
|
|
45
|
+
t && r[t] && ((o.viewed = !0), (h[t] = !0)), i.push(o);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
(this.cards =
|
|
49
|
-
this.
|
|
50
|
-
(this.
|
|
51
|
-
this.
|
|
48
|
+
(this.cards = i),
|
|
49
|
+
this.Ri(),
|
|
50
|
+
(this.Ae = new Date()),
|
|
51
|
+
this.C && (this.C.js(t.bs.Ct, h), this.C.js(t.bs.Ge, this.Ae));
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
var
|
|
55
|
-
const
|
|
56
|
-
for (let t = 0; t < this.cards.length; t++)
|
|
57
|
-
null === (
|
|
53
|
+
Ri() {
|
|
54
|
+
var s;
|
|
55
|
+
const i = [];
|
|
56
|
+
for (let t = 0; t < this.cards.length; t++) i.push(this.cards[t].Bs());
|
|
57
|
+
null === (s = this.C) || void 0 === s || s.js(t.bs.Be, i);
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
U(t) {
|
|
60
60
|
null != t &&
|
|
61
61
|
t.feed &&
|
|
62
|
-
(this.
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
62
|
+
(this.Xs(),
|
|
63
|
+
this.He(t.feed),
|
|
64
|
+
this.Ms.X(new Feed(this.cards.slice(), this.Ae)));
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
this.
|
|
66
|
+
Je() {
|
|
67
|
+
this.Xs();
|
|
68
68
|
const t = [],
|
|
69
69
|
s = new Date();
|
|
70
70
|
for (let i = 0; i < this.cards.length; i++) {
|
|
@@ -72,19 +72,19 @@ export default class ee extends y {
|
|
|
72
72
|
let r = !0;
|
|
73
73
|
null != e && (r = e >= s), r && t.push(this.cards[i]);
|
|
74
74
|
}
|
|
75
|
-
return new Feed(t, this.
|
|
75
|
+
return new Feed(t, this.Ae);
|
|
76
76
|
}
|
|
77
|
-
|
|
78
|
-
this.
|
|
77
|
+
zi() {
|
|
78
|
+
this.Ue && this.Ue.requestFeedRefresh();
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
return this.
|
|
80
|
+
Fs(t) {
|
|
81
|
+
return this.Ms.Ns(t);
|
|
82
82
|
}
|
|
83
|
-
clearData(
|
|
84
|
-
null ==
|
|
83
|
+
clearData(s) {
|
|
84
|
+
null == s && (s = !1),
|
|
85
85
|
(this.cards = []),
|
|
86
|
-
(this.
|
|
87
|
-
|
|
88
|
-
this.
|
|
86
|
+
(this.Ae = null),
|
|
87
|
+
s && this.C && (this.C.Ls(t.bs.Be), this.C.Ls(t.bs.Ge)),
|
|
88
|
+
this.Ms.X(new Feed(this.cards.slice(), this.Ae));
|
|
89
89
|
}
|
|
90
90
|
}
|
package/src/Feed/feed.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import rr from "../common/base-feed.js";
|
|
2
2
|
import { logCardClick, logCardImpressions } from "../Card/index.js";
|
|
3
3
|
import { requestFeedRefresh } from "./request-feed-refresh.js";
|
|
4
|
-
export default class Feed extends
|
|
4
|
+
export default class Feed extends rr {
|
|
5
5
|
constructor(r, e) {
|
|
6
6
|
super(r, e);
|
|
7
7
|
}
|
|
@@ -11,10 +11,10 @@ export default class Feed extends x {
|
|
|
11
11
|
logCardClick(r) {
|
|
12
12
|
return logCardClick(r, !1);
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
dr() {
|
|
15
15
|
requestFeedRefresh();
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
ur() {
|
|
18
18
|
return !1;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import r from "../managers/braze-instance.js";
|
|
2
|
+
import ie from "./feed-provider-factory.js";
|
|
3
3
|
export function getCachedFeed() {
|
|
4
|
-
if (
|
|
4
|
+
if (r.rr()) return ie.m().Je();
|
|
5
5
|
}
|