@braze/web-sdk 4.9.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2204 -2230
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -1
- package/shared-lib/event-types.js +9 -9
- package/shared-lib/indexed-db-adapter.js +13 -13
- package/shared-lib/logger.js +2 -2
- package/shared-lib/supported-options.js +8 -8
- package/src/Card/models/captioned-image.js +19 -19
- package/src/Card/models/card.js +95 -94
- package/src/Card/models/classic-card.js +19 -19
- package/src/Card/models/control-card.js +9 -9
- package/src/Card/models/image-only.js +21 -22
- package/src/Card/models/index.js +0 -1
- package/src/Card/util/card-factory.js +39 -39
- package/src/ContentCards/content-cards-provider.js +114 -114
- package/src/ContentCards/get-cached-content-cards.js +1 -1
- package/src/ContentCards/index.js +0 -1
- package/src/ContentCards/request-content-cards-refresh.js +1 -1
- package/src/ContentCards/subscribe-to-content-cards-updates.js +3 -3
- package/src/ContentCards/ui/hide-content-cards.js +2 -2
- package/src/ContentCards/ui/show-content-cards.js +14 -14
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/change-user.js +2 -2
- package/src/Core/disable-sdk.js +4 -4
- package/src/Core/enable-sdk.js +4 -4
- package/src/Core/get-device-id.js +9 -7
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +2 -2
- package/src/Core/open-session.js +5 -5
- package/src/Core/set-sdk-authentication-signature.js +2 -2
- package/src/Core/wipe-data.js +4 -4
- package/src/FeatureFlags/feature-flag-factory.js +10 -10
- package/src/FeatureFlags/feature-flag.js +7 -7
- package/src/FeatureFlags/feature-flags-provider.js +50 -50
- package/src/FeatureFlags/get-all-feature-flags.js +1 -1
- package/src/FeatureFlags/get-feature-flag.js +3 -5
- package/src/Feed/feed-provider-factory.js +8 -8
- package/src/Feed/feed-provider.js +15 -15
- package/src/Feed/get-cached-feed.js +2 -2
- package/src/Feed/request-feed-refresh.js +2 -2
- package/src/Feed/subscribe-to-feed-updates.js +2 -2
- package/src/Feed/ui/hide-feed.js +2 -2
- package/src/Feed/ui/show-feed.js +13 -13
- package/src/InAppMessage/display/html-message-to-html.js +11 -12
- package/src/InAppMessage/display/in-app-message-to-html.js +15 -15
- package/src/InAppMessage/display/modal-utils.js +8 -8
- package/src/InAppMessage/in-app-message-factory.js +4 -4
- package/src/InAppMessage/in-app-message-manager.js +38 -38
- package/src/InAppMessage/models/full-screen-message.js +31 -31
- package/src/InAppMessage/models/html-message.js +16 -16
- package/src/InAppMessage/models/in-app-message-button.js +5 -5
- package/src/InAppMessage/models/in-app-message.js +46 -46
- package/src/InAppMessage/models/modal-message.js +30 -30
- package/src/InAppMessage/models/slide-up-message.js +26 -26
- package/src/InAppMessage/ui/show-in-app-message.js +9 -9
- package/src/Push/is-push-blocked.js +2 -2
- package/src/Push/is-push-permission-granted.js +2 -2
- package/src/Push/is-push-supported.js +2 -2
- package/src/Push/push-manager.js +31 -31
- package/src/Push/utils/push-utils.js +9 -9
- package/src/User/user-manager.js +8 -8
- package/src/User/user.js +38 -37
- package/src/common/base-feed.js +15 -14
- package/src/common/base-provider.js +1 -1
- package/src/common/event-logger.js +2 -2
- package/src/common/feed-display.js +32 -32
- package/src/l10n/l10n-manager-factory.js +9 -9
- package/src/managers/auth-manager.js +6 -6
- package/src/managers/braze-instance.js +84 -92
- package/src/managers/device-manager.js +9 -9
- package/src/managers/network-manager.js +72 -69
- package/src/managers/server-config-manager.js +13 -13
- package/src/managers/session-manager.js +9 -9
- package/src/managers/storage-manager-factory.js +11 -11
- package/src/managers/storage-manager.js +110 -110
- package/src/managers/subscription-manager.js +3 -3
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +7 -7
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +1 -1
- package/src/models/server-config.js +6 -6
- package/src/request-controller.js +129 -125
- package/src/triggers/models/custom-event-data.js +1 -1
- package/src/triggers/models/custom-event-property-data.js +6 -6
- package/src/triggers/models/filter-set.js +8 -8
- package/src/triggers/models/filter.js +31 -31
- package/src/triggers/models/in-app-message-click-data.js +1 -1
- package/src/triggers/models/purchase-data.js +1 -1
- package/src/triggers/models/purchase-property-data.js +4 -4
- package/src/triggers/models/push-click-data.js +3 -3
- package/src/triggers/models/trigger-condition.js +30 -30
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +32 -32
- package/src/triggers/triggers-provider.js +55 -55
- package/src/ui/js/attach-css.js +1 -1
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +4 -4
- package/src/ui/js/load-font-awesome.js +1 -1
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +11 -11
- package/src/util/client-hints-parser.js +5 -5
- package/src/util/component-utils.js +2 -2
- package/src/util/date-utils.js +2 -2
- package/src/util/device-constants.js +4 -5
- package/src/util/dom-utils.js +5 -5
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +17 -17
- package/src/util/user-agent-parser.js +11 -16
- package/src/util/validation-utils.js +9 -9
- package/src/Card/models/banner.js +0 -31
- package/src/ContentCards/log-content-cards-displayed.js +0 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import qt from "../models/backend-errors.js";
|
|
2
|
-
import
|
|
2
|
+
import ue from "../models/braze-event.js";
|
|
3
3
|
import {
|
|
4
4
|
convertMsToSeconds as h,
|
|
5
5
|
convertSecondsToMs as Xt,
|
|
@@ -10,31 +10,33 @@ import r from "../../shared-lib/braze-shared-lib.js";
|
|
|
10
10
|
import { STORAGE_KEYS as i } from "./storage-manager.js";
|
|
11
11
|
import T from "../util/request-header-utils.js";
|
|
12
12
|
import { LAST_REQUEST_TO_ENDPOINT_MS_AGO_DEFAULT as Ht } from "../common/constants.js";
|
|
13
|
-
export default class
|
|
14
|
-
constructor(t, e, s, i, r, o, n,
|
|
13
|
+
export default class Rt {
|
|
14
|
+
constructor(t, e, s, i, r, o, n, h, a, u, c, l) {
|
|
15
15
|
(this.fn = t),
|
|
16
16
|
(this.u = e),
|
|
17
|
-
(this.
|
|
18
|
-
(this.
|
|
17
|
+
(this.Mo = s),
|
|
18
|
+
(this.wt = i),
|
|
19
19
|
(this._e = r),
|
|
20
|
-
(this.
|
|
20
|
+
(this.yt = o),
|
|
21
21
|
(this.cn = n),
|
|
22
|
-
(this.Uo =
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
22
|
+
(this.Uo = h),
|
|
23
|
+
(this.jo = a),
|
|
24
|
+
(this.Do = u),
|
|
25
25
|
(this.appVersion = c),
|
|
26
|
+
(this.Xh = l),
|
|
26
27
|
(this.fn = t),
|
|
27
28
|
(this.u = e),
|
|
28
|
-
(this.
|
|
29
|
-
(this.
|
|
29
|
+
(this.Mo = s),
|
|
30
|
+
(this.wt = i),
|
|
30
31
|
(this._e = r),
|
|
31
|
-
(this.
|
|
32
|
+
(this.yt = o),
|
|
32
33
|
(this.cn = n),
|
|
33
|
-
(this.Uo =
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
34
|
+
(this.Uo = h),
|
|
35
|
+
(this.jo = a),
|
|
36
|
+
(this.Do = u),
|
|
36
37
|
(this.appVersion = c),
|
|
37
|
-
(this.
|
|
38
|
+
(this.Xh = l),
|
|
39
|
+
(this.$h = ["npm"]);
|
|
38
40
|
}
|
|
39
41
|
Bs(t, e = !1, s = !1) {
|
|
40
42
|
const r = this.fn.ce(!s),
|
|
@@ -43,19 +45,20 @@ export default class Pt {
|
|
|
43
45
|
ii(n, o) || (t.device = o),
|
|
44
46
|
(t.api_key = this.cn),
|
|
45
47
|
(t.time = h(new Date().valueOf(), !0));
|
|
46
|
-
const a = this.u.v(i.k.
|
|
47
|
-
u = this.u.v(i.k.
|
|
48
|
+
const a = this.u.v(i.k.Kh) || [],
|
|
49
|
+
u = this.u.v(i.k.Wh) || "";
|
|
48
50
|
if (
|
|
49
|
-
(this.
|
|
50
|
-
(!ii(a, this
|
|
51
|
-
(t.sdk_metadata = this
|
|
52
|
-
(t.sdk_version = this.
|
|
53
|
-
this.
|
|
51
|
+
(this.$h.length > 0 &&
|
|
52
|
+
(!ii(a, this.$h) || u !== this._e.Yh()) &&
|
|
53
|
+
(t.sdk_metadata = this.$h),
|
|
54
|
+
(t.sdk_version = this.jo),
|
|
55
|
+
this.Do && (t.sdk_flavor = this.Do),
|
|
54
56
|
(t.app_version = this.appVersion),
|
|
57
|
+
(t.app_version_code = this.Xh),
|
|
55
58
|
(t.device_id = r.id),
|
|
56
59
|
e)
|
|
57
60
|
) {
|
|
58
|
-
const e = this.
|
|
61
|
+
const e = this.wt.getUserId();
|
|
59
62
|
null != e && (t.user_id = e);
|
|
60
63
|
}
|
|
61
64
|
return t;
|
|
@@ -66,7 +69,7 @@ export default class Pt {
|
|
|
66
69
|
if (!o && !n) return !0;
|
|
67
70
|
if (o) {
|
|
68
71
|
let e;
|
|
69
|
-
this.
|
|
72
|
+
this.Mo.Hh();
|
|
70
73
|
const s = { errorCode: o.error_code };
|
|
71
74
|
for (const t of i)
|
|
72
75
|
p(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]);
|
|
@@ -78,12 +81,12 @@ export default class Pt {
|
|
|
78
81
|
n
|
|
79
82
|
? ((s.reason = n), (e = `due to ${n}`))
|
|
80
83
|
: (e = `with error code ${o.error_code}.`),
|
|
81
|
-
this.
|
|
84
|
+
this.Mo.wh() ||
|
|
82
85
|
(e +=
|
|
83
86
|
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
|
|
84
87
|
r.j.error(`SDK Authentication failed ${e}`),
|
|
85
|
-
this
|
|
86
|
-
this.
|
|
88
|
+
this.Qh(t.events || [], t.attributes || []),
|
|
89
|
+
this.Mo.Bh(s),
|
|
87
90
|
!1
|
|
88
91
|
);
|
|
89
92
|
}
|
|
@@ -91,42 +94,42 @@ export default class Pt {
|
|
|
91
94
|
let i,
|
|
92
95
|
o = n;
|
|
93
96
|
switch (o) {
|
|
94
|
-
case qt.
|
|
97
|
+
case qt.Vh:
|
|
95
98
|
return (
|
|
96
99
|
(i = "Received successful response with empty body."),
|
|
97
100
|
s.N(r.q.qs, { e: i }),
|
|
98
101
|
r.j.info(i),
|
|
99
102
|
!1
|
|
100
103
|
);
|
|
101
|
-
case qt.
|
|
104
|
+
case qt.Zh:
|
|
102
105
|
return (
|
|
103
106
|
(i = "Received successful response with invalid JSON"),
|
|
104
107
|
s.N(r.q.qs, { e: i + ": " + e.response }),
|
|
105
108
|
r.j.info(i),
|
|
106
109
|
!1
|
|
107
110
|
);
|
|
108
|
-
case qt.
|
|
111
|
+
case qt.Ra:
|
|
109
112
|
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Uo}`;
|
|
110
113
|
break;
|
|
111
|
-
case qt.
|
|
114
|
+
case qt.Xa:
|
|
112
115
|
o =
|
|
113
116
|
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
|
|
114
117
|
break;
|
|
115
|
-
case qt.
|
|
118
|
+
case qt.Ea:
|
|
116
119
|
o = "No device identifier. Please contact support@braze.com";
|
|
117
120
|
}
|
|
118
121
|
r.j.error("Backend error: " + o);
|
|
119
122
|
}
|
|
120
123
|
return !1;
|
|
121
124
|
}
|
|
122
|
-
|
|
125
|
+
Pa(t, e, s, i) {
|
|
123
126
|
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i);
|
|
124
127
|
}
|
|
125
|
-
|
|
128
|
+
$a(t, e, s, i, r = !1) {
|
|
126
129
|
const o = [],
|
|
127
130
|
n = (t) => t || "",
|
|
128
|
-
|
|
129
|
-
let
|
|
131
|
+
h = n(this.wt.getUserId());
|
|
132
|
+
let a = this.Jr(t, e);
|
|
130
133
|
const u = [],
|
|
131
134
|
c = [];
|
|
132
135
|
let l,
|
|
@@ -134,67 +137,67 @@ export default class Pt {
|
|
|
134
137
|
if (s.length > 0) {
|
|
135
138
|
const t = [];
|
|
136
139
|
for (const e of s) {
|
|
137
|
-
if (((l = e.Kr()), this.
|
|
138
|
-
if (
|
|
140
|
+
if (((l = e.Kr()), this.Mo.wh())) {
|
|
141
|
+
if (h && !l.user_id) {
|
|
139
142
|
f || (f = {}), f.events || (f.events = []), f.events.push(l);
|
|
140
143
|
continue;
|
|
141
144
|
}
|
|
142
|
-
if (n(l.user_id) !==
|
|
145
|
+
if (n(l.user_id) !== h) {
|
|
143
146
|
c.push(l);
|
|
144
147
|
continue;
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
150
|
t.push(l);
|
|
148
151
|
}
|
|
149
|
-
t.length > 0 && (
|
|
152
|
+
t.length > 0 && (a.events = t);
|
|
150
153
|
}
|
|
151
154
|
if (i.length > 0) {
|
|
152
155
|
const t = [];
|
|
153
156
|
for (const e of i)
|
|
154
|
-
e && (this.
|
|
155
|
-
t.length > 0 && (
|
|
157
|
+
e && (this.Mo.wh() && n(e.user_id) !== h ? u.push(e) : t.push(e));
|
|
158
|
+
t.length > 0 && (a.attributes = t);
|
|
156
159
|
}
|
|
157
|
-
if ((this
|
|
160
|
+
if ((this.Qh(c, u), (a = this.Bs(a, !0, r)), f)) {
|
|
158
161
|
f = this.Bs(f, !1, r);
|
|
159
|
-
const t = { requestData: f, headers: this.Hs(f, T.Os.
|
|
162
|
+
const t = { requestData: f, headers: this.Hs(f, T.Os.Na) };
|
|
160
163
|
o.push(t);
|
|
161
164
|
}
|
|
162
|
-
if (
|
|
163
|
-
const d = { requestData:
|
|
165
|
+
if (a && !this.Pa(a.events, a.attributes, t, e)) return f ? o : null;
|
|
166
|
+
const d = { requestData: a, headers: this.Hs(a, T.Os.Na) };
|
|
164
167
|
return o.push(d), o;
|
|
165
168
|
}
|
|
166
|
-
|
|
169
|
+
Qh(t, e) {
|
|
167
170
|
if (t) {
|
|
168
171
|
const e = [];
|
|
169
172
|
for (const s of t) {
|
|
170
|
-
const t =
|
|
173
|
+
const t = ue.fromJson(s);
|
|
171
174
|
(t.time = Xt(t.time)), e.push(t);
|
|
172
175
|
}
|
|
173
176
|
this.u.bo(e);
|
|
174
177
|
}
|
|
175
|
-
if (e) for (const t of e) this.u.
|
|
178
|
+
if (e) for (const t of e) this.u.Ha(t);
|
|
176
179
|
}
|
|
177
180
|
ii(t, e) {
|
|
178
181
|
let s = "HTTP error ";
|
|
179
182
|
null != t && (s += t + " "), (s += e), r.j.error(s);
|
|
180
183
|
}
|
|
181
184
|
qr(t) {
|
|
182
|
-
return s.N(r.q.
|
|
185
|
+
return s.N(r.q.Ka, { n: t });
|
|
183
186
|
}
|
|
184
187
|
Jr(t, e, s) {
|
|
185
188
|
const i = {};
|
|
186
189
|
t && (i.feed = !0), e && (i.triggers = !0);
|
|
187
|
-
const r = null != s ? s : this.
|
|
190
|
+
const r = null != s ? s : this.wt.getUserId();
|
|
188
191
|
return (
|
|
189
192
|
r && (i.user_id = r),
|
|
190
|
-
(i.config = { config_time: this.
|
|
193
|
+
(i.config = { config_time: this.yt.li() }),
|
|
191
194
|
{ respond_with: i }
|
|
192
195
|
);
|
|
193
196
|
}
|
|
194
|
-
|
|
197
|
+
Ua(t) {
|
|
195
198
|
const e = new Date().valueOf();
|
|
196
199
|
let s = Ht.toString();
|
|
197
|
-
const i = T.
|
|
200
|
+
const i = T.La(this.u, t);
|
|
198
201
|
if (-1 !== i) {
|
|
199
202
|
s = (e - i).toString();
|
|
200
203
|
}
|
|
@@ -202,33 +205,33 @@ export default class Pt {
|
|
|
202
205
|
}
|
|
203
206
|
Hs(t, e, s = !1) {
|
|
204
207
|
const r = [["X-Braze-Api-Key", this.cn]],
|
|
205
|
-
o = this.
|
|
208
|
+
o = this.Ua(e);
|
|
206
209
|
r.push(["X-Braze-Last-Req-Ms-Ago", o]);
|
|
207
|
-
const n = T.
|
|
210
|
+
const n = T.Wa(this.u, e).toString();
|
|
208
211
|
r.push(["X-Braze-Req-Attempt", n]);
|
|
209
|
-
let
|
|
212
|
+
let h = !1;
|
|
210
213
|
if (
|
|
211
214
|
(null != t.respond_with &&
|
|
212
215
|
t.respond_with.triggers &&
|
|
213
|
-
(r.push(["X-Braze-TriggersRequest", "true"]), (
|
|
216
|
+
(r.push(["X-Braze-TriggersRequest", "true"]), (h = !0)),
|
|
214
217
|
null != t.respond_with &&
|
|
215
218
|
t.respond_with.feed &&
|
|
216
|
-
(r.push(["X-Braze-FeedRequest", "true"]), (
|
|
219
|
+
(r.push(["X-Braze-FeedRequest", "true"]), (h = !0)),
|
|
217
220
|
e === T.Os.Ks)
|
|
218
221
|
) {
|
|
219
222
|
r.push(["X-Braze-ContentCardsRequest", "true"]);
|
|
220
|
-
let t = this.u.v(i.k.
|
|
221
|
-
(t && s) || ((t = 0), this.u.D(i.k.
|
|
223
|
+
let t = this.u.v(i.k.zs);
|
|
224
|
+
(t && s) || ((t = 0), this.u.D(i.k.zs, t)),
|
|
222
225
|
r.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]),
|
|
223
|
-
(
|
|
226
|
+
(h = !0);
|
|
224
227
|
}
|
|
225
228
|
if (
|
|
226
229
|
(e === T.Os.Si &&
|
|
227
|
-
(r.push(["X-Braze-FeatureFlagsRequest", "true"]), (
|
|
228
|
-
|
|
229
|
-
this.
|
|
230
|
+
(r.push(["X-Braze-FeatureFlagsRequest", "true"]), (h = !0)),
|
|
231
|
+
h && r.push(["X-Braze-DataRequest", "true"]),
|
|
232
|
+
this.Mo.wh())
|
|
230
233
|
) {
|
|
231
|
-
const t = this.
|
|
234
|
+
const t = this.Mo.jh();
|
|
232
235
|
null != t && r.push(["X-Braze-Auth-Signature", t]);
|
|
233
236
|
}
|
|
234
237
|
return r;
|
|
@@ -242,12 +245,12 @@ export default class Pt {
|
|
|
242
245
|
: e();
|
|
243
246
|
}
|
|
244
247
|
ti() {
|
|
245
|
-
this.
|
|
248
|
+
this.Mo.ti();
|
|
246
249
|
}
|
|
247
250
|
Ys() {
|
|
248
251
|
return this.Uo;
|
|
249
252
|
}
|
|
250
253
|
addSdkMetadata(t) {
|
|
251
|
-
for (const e of t) -1 === this.
|
|
254
|
+
for (const e of t) -1 === this.$h.indexOf(e) && this.$h.push(e);
|
|
252
255
|
}
|
|
253
256
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT as Vt,
|
|
8
8
|
CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Gt,
|
|
9
9
|
} from "../common/constants.js";
|
|
10
|
-
export default class
|
|
10
|
+
export default class jt {
|
|
11
11
|
constructor(t) {
|
|
12
12
|
(this.u = t),
|
|
13
13
|
(this.u = t),
|
|
@@ -46,24 +46,24 @@ export default class Mt {
|
|
|
46
46
|
let r = !1;
|
|
47
47
|
null != t.ml.enabled && this.oi() !== t.ml.enabled && (r = !0);
|
|
48
48
|
let n = !1;
|
|
49
|
-
null != t.
|
|
49
|
+
null != t.gi.enabled && this.yi() !== t.gi.enabled && (n = !0),
|
|
50
50
|
(this.rl = t),
|
|
51
|
-
this.u.D(i.k.hl, t.
|
|
52
|
-
s && this.tl.
|
|
53
|
-
r && this.el.
|
|
54
|
-
n && this.sl.
|
|
51
|
+
this.u.D(i.k.hl, t.tt()),
|
|
52
|
+
s && this.tl.Dt(),
|
|
53
|
+
r && this.el.Dt(),
|
|
54
|
+
n && this.sl.Dt();
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
Rn(t) {
|
|
59
|
-
const e = this.tl.
|
|
59
|
+
const e = this.tl.It(t);
|
|
60
60
|
return this.il && this.tl.removeSubscription(this.il), (this.il = e), e;
|
|
61
61
|
}
|
|
62
62
|
Ps(t) {
|
|
63
|
-
return this.el.
|
|
63
|
+
return this.el.It(t);
|
|
64
64
|
}
|
|
65
65
|
Ci(t) {
|
|
66
|
-
return this.sl.
|
|
66
|
+
return this.sl.It(t);
|
|
67
67
|
}
|
|
68
68
|
ge(t) {
|
|
69
69
|
return -1 !== this.ll().cl.indexOf(t);
|
|
@@ -97,12 +97,12 @@ export default class Mt {
|
|
|
97
97
|
const t = this.ll().ml.rate_limit;
|
|
98
98
|
return null == t.refill_rate ? Gt : t.refill_rate <= 0 ? -1 : t.refill_rate;
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
return this.ll().
|
|
100
|
+
yi() {
|
|
101
|
+
return this.ll().gi.enabled && null == this.Mi()
|
|
102
102
|
? (s.N(r.q.qs, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
103
|
-
: this.ll().
|
|
103
|
+
: this.ll().gi.enabled || !1;
|
|
104
104
|
}
|
|
105
105
|
Mi() {
|
|
106
|
-
return this.ll().
|
|
106
|
+
return this.ll().gi.refresh_rate_limit;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
2
|
-
import
|
|
2
|
+
import ue from "../models/braze-event.js";
|
|
3
3
|
import _t from "../models/identifier.js";
|
|
4
4
|
import { convertMsToSeconds as h } from "../util/date-utils.js";
|
|
5
5
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
6
6
|
export default class Dt {
|
|
7
7
|
constructor(s, t, i, e) {
|
|
8
8
|
(this.u = s),
|
|
9
|
-
(this.
|
|
10
|
-
(this.
|
|
9
|
+
(this.wt = t),
|
|
10
|
+
(this.yt = i),
|
|
11
11
|
(this.wl = e),
|
|
12
12
|
(this.u = s),
|
|
13
|
-
(this.
|
|
14
|
-
(this.
|
|
13
|
+
(this.wt = t),
|
|
14
|
+
(this.yt = i),
|
|
15
15
|
(this.Sl = 1e3),
|
|
16
16
|
(null == e || isNaN(e)) && (e = 1800),
|
|
17
17
|
e < this.Sl / 1e3 &&
|
|
@@ -26,15 +26,15 @@ export default class Dt {
|
|
|
26
26
|
(this.wl = e);
|
|
27
27
|
}
|
|
28
28
|
jl(s, t) {
|
|
29
|
-
return new
|
|
29
|
+
return new ue(this.wt.getUserId(), r.q.xl, s, t.iu, { d: h(s - t.vl) });
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
Yh() {
|
|
32
32
|
const s = this.u.tu(i.eu.Dl);
|
|
33
33
|
return null == s ? null : s.iu;
|
|
34
34
|
}
|
|
35
35
|
El() {
|
|
36
36
|
const s = new Date().valueOf(),
|
|
37
|
-
t = this.
|
|
37
|
+
t = this.yt.dl(),
|
|
38
38
|
e = this.u.v(i.k.zl);
|
|
39
39
|
if (null != e && null == t) return !1;
|
|
40
40
|
let n = !1;
|
|
@@ -61,7 +61,7 @@ export default class Dt {
|
|
|
61
61
|
}
|
|
62
62
|
(n += ". Will expire " + t.valueOf()), r.j.info(n);
|
|
63
63
|
const l = new _t(r.Z.Y(), t);
|
|
64
|
-
this.u.Hl(new
|
|
64
|
+
this.u.Hl(new ue(this.wt.getUserId(), r.q.Wl, s, l.iu)),
|
|
65
65
|
this.u.uu(i.eu.Dl, l);
|
|
66
66
|
return null == this.u.v(i.k.zl) && this.u.D(i.k.zl, s), l.iu;
|
|
67
67
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import J, { STORAGE_KEYS as i } from "./storage-manager.js";
|
|
2
2
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const Mt = {
|
|
4
|
+
xo: function (e, o = !1) {
|
|
5
5
|
let t = !1;
|
|
6
6
|
try {
|
|
7
7
|
if (localStorage && localStorage.getItem)
|
|
8
8
|
try {
|
|
9
|
-
localStorage.setItem(i.k.
|
|
10
|
-
localStorage.getItem(i.k.
|
|
11
|
-
(localStorage.removeItem(i.k.
|
|
9
|
+
localStorage.setItem(i.k.Qa, "true"),
|
|
10
|
+
localStorage.getItem(i.k.Qa) &&
|
|
11
|
+
(localStorage.removeItem(i.k.Qa), (t = !0));
|
|
12
12
|
} catch (e) {
|
|
13
13
|
if (
|
|
14
14
|
!(
|
|
@@ -24,12 +24,12 @@ const Bt = {
|
|
|
24
24
|
} catch (e) {
|
|
25
25
|
r.j.info("Local Storage not supported!");
|
|
26
26
|
}
|
|
27
|
-
const a =
|
|
28
|
-
n = new
|
|
27
|
+
const a = Mt.Ga(),
|
|
28
|
+
n = new J.Ja(e, a && !o, t);
|
|
29
29
|
let c;
|
|
30
|
-
return (c = t ? new
|
|
30
|
+
return (c = t ? new J.Va(e) : new J.Ya()), new J(n, c);
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
Ga: function () {
|
|
33
33
|
return (
|
|
34
34
|
navigator.cookieEnabled ||
|
|
35
35
|
("cookie" in document &&
|
|
@@ -39,4 +39,4 @@ const Bt = {
|
|
|
39
39
|
);
|
|
40
40
|
},
|
|
41
41
|
};
|
|
42
|
-
export default
|
|
42
|
+
export default Mt;
|