@braze/web-sdk 4.8.3 → 4.9.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 +121 -6
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +7 -7
- package/shared-lib/encoding-utils.js +4 -4
- package/shared-lib/event-types.js +22 -21
- package/shared-lib/guid.js +7 -7
- package/shared-lib/indexed-db-adapter.js +172 -135
- package/shared-lib/logger.js +26 -26
- package/shared-lib/supported-options.js +15 -15
- package/shared-lib/types.js +1 -0
- package/src/Card/card-manager-factory.js +1 -1
- package/src/Card/card-manager.js +2 -2
- package/src/Card/display/card-display.js +5 -4
- package/src/Card/models/banner.js +10 -10
- package/src/Card/models/captioned-image.js +7 -7
- package/src/Card/models/card.js +37 -36
- package/src/Card/models/classic-card.js +7 -7
- package/src/Card/models/control-card.js +3 -3
- package/src/Card/models/image-only.js +32 -0
- package/src/Card/models/index.js +1 -0
- package/src/Card/util/card-factory.js +16 -16
- package/src/ContentCards/content-cards-provider-factory.js +1 -1
- package/src/ContentCards/content-cards-provider.js +102 -102
- 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 +15 -12
- package/src/Core/add-sdk-metadata.js +2 -2
- package/src/Core/braze-sdk-metadata.js +1 -1
- package/src/Core/change-user.js +1 -1
- package/src/Core/device-properties.js +1 -1
- package/src/Core/disable-sdk.js +10 -7
- package/src/Core/enable-sdk.js +5 -2
- package/src/Core/get-device-id.js +3 -3
- package/src/Core/get-user.js +1 -1
- package/src/Core/handle-braze-action.js +14 -14
- package/src/Core/is-disabled.js +1 -1
- package/src/Core/log-custom-event.js +4 -4
- package/src/Core/log-purchase.js +9 -9
- package/src/Core/open-session.js +10 -10
- package/src/FeatureFlags/feature-flag-factory.js +5 -3
- package/src/FeatureFlags/feature-flag.js +17 -14
- package/src/FeatureFlags/feature-flags-provider-factory.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +56 -43
- package/src/FeatureFlags/get-all-feature-flags.js +2 -2
- package/src/FeatureFlags/get-feature-flag.js +2 -2
- package/src/FeatureFlags/index.js +1 -0
- package/src/FeatureFlags/log-feature-flag-impression.js +23 -0
- package/src/FeatureFlags/subscribe-to-feature-flags-updates.js +1 -1
- package/src/Feed/feed-provider-factory.js +1 -1
- package/src/Feed/feed-provider.js +20 -20
- 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 +13 -10
- package/src/InAppMessage/defer-in-app-message.js +13 -0
- package/src/InAppMessage/display/get-animation-effect.js +1 -1
- package/src/InAppMessage/display/html-message-to-html.js +47 -47
- package/src/InAppMessage/display/in-app-message-to-html.js +92 -91
- package/src/InAppMessage/display/modal-utils.js +16 -16
- package/src/InAppMessage/get-deferred-in-app-message.js +5 -0
- package/src/InAppMessage/in-app-message-factory.js +77 -57
- package/src/InAppMessage/in-app-message-manager-factory.js +6 -6
- package/src/InAppMessage/in-app-message-manager.js +121 -82
- package/src/InAppMessage/index.js +2 -0
- package/src/InAppMessage/log-in-app-message-button-click.js +17 -9
- package/src/InAppMessage/log-in-app-message-click.js +4 -4
- package/src/InAppMessage/log-in-app-message-html-click.js +6 -6
- package/src/InAppMessage/log-in-app-message-impression.js +3 -3
- package/src/InAppMessage/models/full-screen-message.js +65 -29
- package/src/InAppMessage/models/html-message.js +32 -13
- package/src/InAppMessage/models/in-app-message-button.js +7 -7
- package/src/InAppMessage/models/in-app-message.js +203 -134
- package/src/InAppMessage/models/modal-message.js +64 -29
- package/src/InAppMessage/models/slide-up-message.js +52 -24
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/subscribe-to-in-app-message.js +2 -2
- package/src/InAppMessage/ui/automatically-show-in-app-messages.js +6 -6
- package/src/InAppMessage/ui/show-in-app-message.js +49 -47
- package/src/InAppMessage/utils/in-app-message-utils.js +1 -1
- 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 +19 -19
- package/src/Push/push-manager.js +131 -131
- package/src/Push/request-push-permission.js +2 -2
- package/src/Push/unregister-push.js +2 -2
- package/src/Push/utils/push-utils.js +12 -10
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +57 -57
- package/src/common/base-feed.js +1 -1
- package/src/common/constants.js +1 -0
- package/src/common/event-logger.js +6 -6
- package/src/common/feed-display.js +34 -34
- package/src/common/translations.js +33 -33
- package/src/l10n/l10n-manager-factory.js +8 -8
- package/src/l10n/l10n-manager.js +6 -2
- package/src/l10n/types.js +1 -0
- package/src/managers/auth-manager.js +29 -29
- package/src/managers/braze-instance.js +125 -125
- package/src/managers/device-manager.js +20 -20
- package/src/managers/network-manager.js +100 -98
- package/src/managers/server-config-manager.js +23 -23
- package/src/managers/session-manager.js +5 -5
- package/src/managers/storage-manager-factory.js +9 -9
- package/src/managers/storage-manager.js +132 -129
- package/src/managers/subscription-manager.js +8 -8
- package/src/models/backend-errors.js +6 -6
- package/src/models/braze-event.js +11 -11
- package/src/models/braze-sdk-metadata.js +1 -1
- package/src/models/device.js +2 -2
- package/src/models/identifier.js +1 -1
- package/src/models/push-token.js +5 -5
- package/src/models/server-config.js +7 -7
- package/src/request-controller.js +191 -178
- package/src/triggers/models/custom-event-data.js +4 -4
- package/src/triggers/models/custom-event-property-data.js +7 -7
- package/src/triggers/models/filter-set.js +5 -5
- package/src/triggers/models/filter.js +64 -60
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +4 -4
- package/src/triggers/models/purchase-property-data.js +6 -6
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +55 -59
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +47 -35
- package/src/triggers/triggers-provider-factory.js +10 -6
- package/src/triggers/triggers-provider.js +203 -185
- package/src/triggers/types.js +1 -0
- package/src/ui/js/attach-css.js +5 -4
- package/src/ui/js/feed-css.js +5 -5
- package/src/ui/js/iam-css.js +5 -5
- 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 +35 -30
- package/src/util/browser-detector.js +30 -31
- package/src/util/client-hints-parser.js +30 -24
- package/src/util/code-utils.js +22 -21
- package/src/util/color-utils.js +19 -13
- package/src/util/component-utils.js +4 -4
- package/src/util/date-utils.js +4 -3
- package/src/util/device-constants.js +10 -10
- package/src/util/dom-utils.js +32 -28
- package/src/util/error-utils.js +1 -1
- package/src/util/key-codes.js +1 -1
- package/src/util/net.js +53 -57
- package/src/util/request-header-utils.js +34 -11
- package/src/util/string-utils.js +14 -14
- package/src/util/types.js +1 -0
- package/src/util/url-utils.js +1 -4
- package/src/util/user-agent-parser.js +39 -39
- package/src/util/validation-utils.js +32 -32
- package/src/util/window-utils.js +11 -12
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import qt from "../models/backend-errors.js";
|
|
2
|
-
import
|
|
2
|
+
import be from "../models/braze-event.js";
|
|
3
3
|
import {
|
|
4
4
|
convertMsToSeconds as h,
|
|
5
|
-
convertSecondsToMs as Xt
|
|
5
|
+
convertSecondsToMs as Xt,
|
|
6
6
|
} from "../util/date-utils.js";
|
|
7
7
|
import s from "../common/event-logger.js";
|
|
8
8
|
import { isArray as p, isEqual as ii } from "../util/code-utils.js";
|
|
@@ -12,47 +12,47 @@ 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
13
|
export default class Pt {
|
|
14
14
|
constructor(t, e, s, i, r, o, n, a, h, u, c) {
|
|
15
|
-
(this.
|
|
15
|
+
(this.fn = t),
|
|
16
16
|
(this.u = e),
|
|
17
|
-
(this.
|
|
17
|
+
(this.Do = s),
|
|
18
18
|
(this.ft = i),
|
|
19
19
|
(this._e = r),
|
|
20
20
|
(this.wt = o),
|
|
21
|
-
(this.
|
|
22
|
-
(this.
|
|
23
|
-
(this.
|
|
24
|
-
(this.
|
|
21
|
+
(this.cn = n),
|
|
22
|
+
(this.Uo = a),
|
|
23
|
+
(this.Mo = h),
|
|
24
|
+
(this.jo = u),
|
|
25
25
|
(this.appVersion = c),
|
|
26
|
-
(this.
|
|
26
|
+
(this.fn = t),
|
|
27
27
|
(this.u = e),
|
|
28
|
-
(this.
|
|
28
|
+
(this.Do = s),
|
|
29
29
|
(this.ft = i),
|
|
30
30
|
(this._e = r),
|
|
31
31
|
(this.wt = o),
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
32
|
+
(this.cn = n),
|
|
33
|
+
(this.Uo = a),
|
|
34
|
+
(this.Mo = h),
|
|
35
|
+
(this.jo = u),
|
|
36
36
|
(this.appVersion = c),
|
|
37
|
-
(this.
|
|
37
|
+
(this.Ra = ["npm"]);
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ii(
|
|
44
|
-
(t.api_key = this.
|
|
39
|
+
Bs(t, e = !1, s = !1) {
|
|
40
|
+
const r = this.fn.ce(!s),
|
|
41
|
+
o = r.Kr(),
|
|
42
|
+
n = this.u.v(i.k.Ca);
|
|
43
|
+
ii(n, o) || (t.device = o),
|
|
44
|
+
(t.api_key = this.cn),
|
|
45
45
|
(t.time = h(new Date().valueOf(), !0));
|
|
46
|
-
const
|
|
47
|
-
|
|
46
|
+
const a = this.u.v(i.k.Xa) || [],
|
|
47
|
+
u = this.u.v(i.k.Ea) || "";
|
|
48
48
|
if (
|
|
49
|
-
(this.
|
|
50
|
-
(!ii(
|
|
51
|
-
(t.sdk_metadata = this.
|
|
52
|
-
(t.sdk_version = this.
|
|
53
|
-
this.
|
|
49
|
+
(this.Ra.length > 0 &&
|
|
50
|
+
(!ii(a, this.Ra) || u !== this._e.Pa()) &&
|
|
51
|
+
(t.sdk_metadata = this.Ra),
|
|
52
|
+
(t.sdk_version = this.Mo),
|
|
53
|
+
this.jo && (t.sdk_flavor = this.jo),
|
|
54
54
|
(t.app_version = this.appVersion),
|
|
55
|
-
(t.device_id =
|
|
55
|
+
(t.device_id = r.id),
|
|
56
56
|
e)
|
|
57
57
|
) {
|
|
58
58
|
const e = this.ft.getUserId();
|
|
@@ -60,13 +60,13 @@ export default class Pt {
|
|
|
60
60
|
}
|
|
61
61
|
return t;
|
|
62
62
|
}
|
|
63
|
-
|
|
63
|
+
Zs(t, e, i) {
|
|
64
64
|
const o = e.auth_error,
|
|
65
65
|
n = e.error;
|
|
66
66
|
if (!o && !n) return !0;
|
|
67
67
|
if (o) {
|
|
68
68
|
let e;
|
|
69
|
-
this.
|
|
69
|
+
this.Do.Hh();
|
|
70
70
|
const s = { errorCode: o.error_code };
|
|
71
71
|
for (const t of i)
|
|
72
72
|
p(t) && "X-Braze-Auth-Signature" === t[0] && (s.signature = t[1]);
|
|
@@ -78,12 +78,12 @@ export default class Pt {
|
|
|
78
78
|
n
|
|
79
79
|
? ((s.reason = n), (e = `due to ${n}`))
|
|
80
80
|
: (e = `with error code ${o.error_code}.`),
|
|
81
|
-
this.
|
|
81
|
+
this.Do.wh() ||
|
|
82
82
|
(e +=
|
|
83
83
|
' Please use the "enableSdkAuthentication" initialization option to enable authentication.'),
|
|
84
84
|
r.j.error(`SDK Authentication failed ${e}`),
|
|
85
|
-
this
|
|
86
|
-
this.
|
|
85
|
+
this.$a(t.events || [], t.attributes || []),
|
|
86
|
+
this.Do.Bh(s),
|
|
87
87
|
!1
|
|
88
88
|
);
|
|
89
89
|
}
|
|
@@ -91,161 +91,163 @@ export default class Pt {
|
|
|
91
91
|
let i,
|
|
92
92
|
o = n;
|
|
93
93
|
switch (o) {
|
|
94
|
-
case qt.
|
|
94
|
+
case qt.Na:
|
|
95
95
|
return (
|
|
96
96
|
(i = "Received successful response with empty body."),
|
|
97
|
-
s.N(r.q.
|
|
97
|
+
s.N(r.q.qs, { e: i }),
|
|
98
98
|
r.j.info(i),
|
|
99
99
|
!1
|
|
100
100
|
);
|
|
101
|
-
case qt.
|
|
101
|
+
case qt.Ha:
|
|
102
102
|
return (
|
|
103
103
|
(i = "Received successful response with invalid JSON"),
|
|
104
|
-
s.N(r.q.
|
|
104
|
+
s.N(r.q.qs, { e: i + ": " + e.response }),
|
|
105
105
|
r.j.info(i),
|
|
106
106
|
!1
|
|
107
107
|
);
|
|
108
|
-
case qt.
|
|
109
|
-
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.
|
|
108
|
+
case qt.Ka:
|
|
109
|
+
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Uo}`;
|
|
110
110
|
break;
|
|
111
|
-
case qt.
|
|
111
|
+
case qt.Ua:
|
|
112
112
|
o =
|
|
113
113
|
"Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.";
|
|
114
114
|
break;
|
|
115
|
-
case qt.
|
|
115
|
+
case qt.La:
|
|
116
116
|
o = "No device identifier. Please contact support@braze.com";
|
|
117
117
|
}
|
|
118
118
|
r.j.error("Backend error: " + o);
|
|
119
119
|
}
|
|
120
120
|
return !1;
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
Wa(t, e, s, i) {
|
|
123
123
|
return !!((t && 0 !== t.length) || (e && 0 !== e.length) || s || i);
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
let
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
let
|
|
133
|
-
|
|
125
|
+
Ya(t, e, s, i, r = !1) {
|
|
126
|
+
const o = [],
|
|
127
|
+
n = (t) => t || "",
|
|
128
|
+
a = n(this.ft.getUserId());
|
|
129
|
+
let h = this.Jr(t, e);
|
|
130
|
+
const u = [],
|
|
131
|
+
c = [];
|
|
132
|
+
let l,
|
|
133
|
+
f = null;
|
|
134
134
|
if (s.length > 0) {
|
|
135
135
|
const t = [];
|
|
136
136
|
for (const e of s) {
|
|
137
|
-
if (((
|
|
138
|
-
if (
|
|
139
|
-
|
|
137
|
+
if (((l = e.Kr()), this.Do.wh())) {
|
|
138
|
+
if (a && !l.user_id) {
|
|
139
|
+
f || (f = {}), f.events || (f.events = []), f.events.push(l);
|
|
140
140
|
continue;
|
|
141
141
|
}
|
|
142
|
-
if (
|
|
143
|
-
|
|
142
|
+
if (n(l.user_id) !== a) {
|
|
143
|
+
c.push(l);
|
|
144
144
|
continue;
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
-
t.push(
|
|
147
|
+
t.push(l);
|
|
148
148
|
}
|
|
149
|
-
t.length > 0 && (
|
|
149
|
+
t.length > 0 && (h.events = t);
|
|
150
150
|
}
|
|
151
151
|
if (i.length > 0) {
|
|
152
152
|
const t = [];
|
|
153
153
|
for (const e of i)
|
|
154
|
-
this.
|
|
155
|
-
t.length > 0 && (
|
|
154
|
+
e && (this.Do.wh() && n(e.user_id) !== a ? u.push(e) : t.push(e));
|
|
155
|
+
t.length > 0 && (h.attributes = t);
|
|
156
156
|
}
|
|
157
|
-
if ((this
|
|
158
|
-
|
|
159
|
-
const t = { requestData:
|
|
160
|
-
|
|
157
|
+
if ((this.$a(c, u), (h = this.Bs(h, !0, r)), f)) {
|
|
158
|
+
f = this.Bs(f, !1, r);
|
|
159
|
+
const t = { requestData: f, headers: this.Hs(f, T.Os.Ja) };
|
|
160
|
+
o.push(t);
|
|
161
161
|
}
|
|
162
|
-
if (
|
|
163
|
-
const
|
|
164
|
-
return
|
|
162
|
+
if (h && !this.Wa(h.events, h.attributes, t, e)) return f ? o : null;
|
|
163
|
+
const d = { requestData: h, headers: this.Hs(h, T.Os.Ja) };
|
|
164
|
+
return o.push(d), o;
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
$a(t, e) {
|
|
167
167
|
if (t) {
|
|
168
168
|
const e = [];
|
|
169
169
|
for (const s of t) {
|
|
170
|
-
const t =
|
|
170
|
+
const t = be.fromJson(s);
|
|
171
171
|
(t.time = Xt(t.time)), e.push(t);
|
|
172
172
|
}
|
|
173
173
|
this.u.bo(e);
|
|
174
174
|
}
|
|
175
|
-
if (e) for (const t of e) this.u.
|
|
175
|
+
if (e) for (const t of e) this.u.Qa(t);
|
|
176
176
|
}
|
|
177
177
|
ii(t, e) {
|
|
178
178
|
let s = "HTTP error ";
|
|
179
179
|
null != t && (s += t + " "), (s += e), r.j.error(s);
|
|
180
180
|
}
|
|
181
181
|
qr(t) {
|
|
182
|
-
return s.N(r.q.
|
|
182
|
+
return s.N(r.q.Va, { n: t });
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
Jr(t, e, s) {
|
|
185
185
|
const i = {};
|
|
186
186
|
t && (i.feed = !0), e && (i.triggers = !0);
|
|
187
187
|
const r = null != s ? s : this.ft.getUserId();
|
|
188
188
|
return (
|
|
189
189
|
r && (i.user_id = r),
|
|
190
|
-
(i.config = { config_time: this.wt.
|
|
190
|
+
(i.config = { config_time: this.wt.li() }),
|
|
191
191
|
{ respond_with: i }
|
|
192
192
|
);
|
|
193
193
|
}
|
|
194
|
-
|
|
194
|
+
Za(t) {
|
|
195
195
|
const e = new Date().valueOf();
|
|
196
196
|
let s = Ht.toString();
|
|
197
|
-
const i = T.
|
|
197
|
+
const i = T.Ga(this.u, t);
|
|
198
198
|
if (-1 !== i) {
|
|
199
199
|
s = (e - i).toString();
|
|
200
200
|
}
|
|
201
201
|
return s;
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
const r = [["X-Braze-Api-Key", this.
|
|
205
|
-
o = this.
|
|
203
|
+
Hs(t, e, s = !1) {
|
|
204
|
+
const r = [["X-Braze-Api-Key", this.cn]],
|
|
205
|
+
o = this.Za(e);
|
|
206
206
|
r.push(["X-Braze-Last-Req-Ms-Ago", o]);
|
|
207
|
-
|
|
207
|
+
const n = T.Xh(this.u, e).toString();
|
|
208
|
+
r.push(["X-Braze-Req-Attempt", n]);
|
|
209
|
+
let a = !1;
|
|
208
210
|
if (
|
|
209
211
|
(null != t.respond_with &&
|
|
210
212
|
t.respond_with.triggers &&
|
|
211
|
-
(r.push(["X-Braze-TriggersRequest", "true"]), (
|
|
213
|
+
(r.push(["X-Braze-TriggersRequest", "true"]), (a = !0)),
|
|
212
214
|
null != t.respond_with &&
|
|
213
215
|
t.respond_with.feed &&
|
|
214
|
-
(r.push(["X-Braze-FeedRequest", "true"]), (
|
|
215
|
-
e === T.
|
|
216
|
+
(r.push(["X-Braze-FeedRequest", "true"]), (a = !0)),
|
|
217
|
+
e === T.Os.Ks)
|
|
216
218
|
) {
|
|
217
219
|
r.push(["X-Braze-ContentCardsRequest", "true"]);
|
|
218
|
-
let t = this.u.v(i.k.
|
|
219
|
-
(t && s) || ((t = 0), this.u.D(i.k.
|
|
220
|
+
let t = this.u.v(i.k.Ls);
|
|
221
|
+
(t && s) || ((t = 0), this.u.D(i.k.Ls, t)),
|
|
220
222
|
r.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]),
|
|
221
|
-
(
|
|
223
|
+
(a = !0);
|
|
222
224
|
}
|
|
223
225
|
if (
|
|
224
|
-
(e === T.
|
|
225
|
-
(r.push(["X-Braze-FeatureFlagsRequest", "true"]), (
|
|
226
|
-
|
|
227
|
-
this.
|
|
226
|
+
(e === T.Os.Si &&
|
|
227
|
+
(r.push(["X-Braze-FeatureFlagsRequest", "true"]), (a = !0)),
|
|
228
|
+
a && r.push(["X-Braze-DataRequest", "true"]),
|
|
229
|
+
this.Do.wh())
|
|
228
230
|
) {
|
|
229
|
-
const t = this.
|
|
231
|
+
const t = this.Do.jh();
|
|
230
232
|
null != t && r.push(["X-Braze-Auth-Signature", t]);
|
|
231
233
|
}
|
|
232
234
|
return r;
|
|
233
235
|
}
|
|
234
|
-
|
|
236
|
+
Qs(t, e) {
|
|
235
237
|
const s = t.device;
|
|
236
238
|
s && s.os_version instanceof Promise
|
|
237
|
-
? s.os_version.then(s => {
|
|
239
|
+
? s.os_version.then((s) => {
|
|
238
240
|
(t.device.os_version = s), e();
|
|
239
241
|
})
|
|
240
242
|
: e();
|
|
241
243
|
}
|
|
242
|
-
|
|
243
|
-
this.
|
|
244
|
+
ti() {
|
|
245
|
+
this.Do.ti();
|
|
244
246
|
}
|
|
245
|
-
|
|
246
|
-
return this.
|
|
247
|
+
Ys() {
|
|
248
|
+
return this.Uo;
|
|
247
249
|
}
|
|
248
250
|
addSdkMetadata(t) {
|
|
249
|
-
for (const e of t) -1 === this.
|
|
251
|
+
for (const e of t) -1 === this.Ra.indexOf(e) && this.Ra.push(e);
|
|
250
252
|
}
|
|
251
253
|
}
|
|
@@ -5,7 +5,7 @@ import s from "../common/event-logger.js";
|
|
|
5
5
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
6
6
|
import {
|
|
7
7
|
CONTENT_CARDS_RATE_LIMIT_CAPACITY_DEFAULT as Vt,
|
|
8
|
-
CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Gt
|
|
8
|
+
CONTENT_CARDS_RATE_LIMIT_REFILL_RATE_DEFAULT as Gt,
|
|
9
9
|
} from "../common/constants.js";
|
|
10
10
|
export default class Mt {
|
|
11
11
|
constructor(t) {
|
|
@@ -20,11 +20,11 @@ export default class Mt {
|
|
|
20
20
|
ll() {
|
|
21
21
|
if (null == this.rl) {
|
|
22
22
|
const t = this.u.v(i.k.hl);
|
|
23
|
-
this.rl = null != t ? Kt.
|
|
23
|
+
this.rl = null != t ? Kt.Yn(t) : new Kt();
|
|
24
24
|
}
|
|
25
25
|
return this.rl;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
li() {
|
|
28
28
|
return this.ll().ol;
|
|
29
29
|
}
|
|
30
30
|
ul(t) {
|
|
@@ -39,14 +39,14 @@ export default class Mt {
|
|
|
39
39
|
e.messaging_session_timeout,
|
|
40
40
|
e.vapid_public_key,
|
|
41
41
|
e.content_cards,
|
|
42
|
-
e.feature_flags
|
|
42
|
+
e.feature_flags,
|
|
43
43
|
);
|
|
44
44
|
let s = !1;
|
|
45
|
-
null != t.al && this.
|
|
45
|
+
null != t.al && this.En() !== t.al && (s = !0);
|
|
46
46
|
let r = !1;
|
|
47
|
-
null != t.ml.enabled && this.
|
|
47
|
+
null != t.ml.enabled && this.oi() !== t.ml.enabled && (r = !0);
|
|
48
48
|
let n = !1;
|
|
49
|
-
null != t.
|
|
49
|
+
null != t.pi.enabled && this.vi() !== t.pi.enabled && (n = !0),
|
|
50
50
|
(this.rl = t),
|
|
51
51
|
this.u.D(i.k.hl, t.ss()),
|
|
52
52
|
s && this.tl.Et(),
|
|
@@ -55,14 +55,14 @@ export default class Mt {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
Rn(t) {
|
|
59
59
|
const e = this.tl.lt(t);
|
|
60
60
|
return this.il && this.tl.removeSubscription(this.il), (this.il = e), e;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
Ps(t) {
|
|
63
63
|
return this.el.lt(t);
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
Ci(t) {
|
|
66
66
|
return this.sl.lt(t);
|
|
67
67
|
}
|
|
68
68
|
ge(t) {
|
|
@@ -77,32 +77,32 @@ export default class Mt {
|
|
|
77
77
|
dl() {
|
|
78
78
|
return this.ll().bl;
|
|
79
79
|
}
|
|
80
|
-
|
|
80
|
+
En() {
|
|
81
81
|
return this.ll().al;
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
oi() {
|
|
84
84
|
return this.ll().ml.enabled || !1;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
$s() {
|
|
87
87
|
const t = this.ll().ml.rate_limit;
|
|
88
88
|
return !(!t || null == t.enabled) && t.enabled;
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
if (!this
|
|
90
|
+
di() {
|
|
91
|
+
if (!this.$s()) return -1;
|
|
92
92
|
const t = this.ll().ml.rate_limit;
|
|
93
93
|
return null == t.capacity ? Vt : t.capacity <= 0 ? -1 : t.capacity;
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
if (!this
|
|
95
|
+
mi() {
|
|
96
|
+
if (!this.$s()) return -1;
|
|
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().
|
|
102
|
-
? (s.N(r.q.
|
|
103
|
-
: this.ll().
|
|
100
|
+
vi() {
|
|
101
|
+
return this.ll().pi.enabled && null == this.Mi()
|
|
102
|
+
? (s.N(r.q.qs, { e: "Missing feature flag refresh_rate_limit." }), !1)
|
|
103
|
+
: this.ll().pi.enabled || !1;
|
|
104
104
|
}
|
|
105
|
-
|
|
106
|
-
return this.ll().
|
|
105
|
+
Mi() {
|
|
106
|
+
return this.ll().pi.refresh_rate_limit;
|
|
107
107
|
}
|
|
108
108
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
2
|
-
import
|
|
2
|
+
import be 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";
|
|
@@ -20,15 +20,15 @@ export default class Dt {
|
|
|
20
20
|
e +
|
|
21
21
|
"s is too small, using the minimum session timeout of " +
|
|
22
22
|
this.Sl / 1e3 +
|
|
23
|
-
"s instead."
|
|
23
|
+
"s instead.",
|
|
24
24
|
),
|
|
25
25
|
(e = this.Sl / 1e3)),
|
|
26
26
|
(this.wl = e);
|
|
27
27
|
}
|
|
28
28
|
jl(s, t) {
|
|
29
|
-
return new
|
|
29
|
+
return new be(this.ft.getUserId(), r.q.xl, s, t.iu, { d: h(s - t.vl) });
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
Pa() {
|
|
32
32
|
const s = this.u.tu(i.eu.Dl);
|
|
33
33
|
return null == s ? null : s.iu;
|
|
34
34
|
}
|
|
@@ -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 be(this.ft.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
1
|
import O, { STORAGE_KEYS as i } from "./storage-manager.js";
|
|
2
2
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
3
3
|
const Bt = {
|
|
4
|
-
|
|
4
|
+
qo: 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.ec, "true"),
|
|
10
|
+
localStorage.getItem(i.k.ec) &&
|
|
11
|
+
(localStorage.removeItem(i.k.ec), (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 = Bt.
|
|
28
|
-
n = new O.
|
|
27
|
+
const a = Bt.oc(),
|
|
28
|
+
n = new O.tc(e, a && !o, t);
|
|
29
29
|
let c;
|
|
30
|
-
return (c = t ? new O.
|
|
30
|
+
return (c = t ? new O.rc(e) : new O.ac()), new O(n, c);
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
oc: function () {
|
|
33
33
|
return (
|
|
34
34
|
navigator.cookieEnabled ||
|
|
35
35
|
("cookie" in document &&
|
|
@@ -37,6 +37,6 @@ const Bt = {
|
|
|
37
37
|
(document.cookie = "test").indexOf.call(document.cookie, "test") >
|
|
38
38
|
-1))
|
|
39
39
|
);
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
41
|
};
|
|
42
42
|
export default Bt;
|