@braze/web-sdk 4.8.3 → 4.10.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 +2247 -2071
- 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 +23 -22
- 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 +14 -13
- 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 +9 -7
- 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 +63 -62
- 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 +132 -130
- package/src/managers/device-manager.js +22 -22
- package/src/managers/network-manager.js +103 -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 +134 -131
- package/src/managers/subscription-manager.js +7 -7
- 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 +197 -180
- 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 +65 -61
- 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 +52 -56
- package/src/triggers/models/trigger-events.js +3 -3
- package/src/triggers/models/trigger.js +50 -38
- package/src/triggers/triggers-provider-factory.js +10 -6
- package/src/triggers/triggers-provider.js +204 -186
- 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/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 +28 -22
- 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 +6 -5
- package/src/util/device-constants.js +10 -10
- package/src/util/dom-utils.js +28 -24
- 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 +34 -34
- 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";
|
|
@@ -10,49 +10,52 @@ 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,
|
|
15
|
-
(this.
|
|
13
|
+
export default class Rt {
|
|
14
|
+
constructor(t, e, s, i, r, o, n, h, a, u, c, l) {
|
|
15
|
+
(this.fn = t),
|
|
16
16
|
(this.u = e),
|
|
17
|
-
(this.
|
|
17
|
+
(this.Uo = 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.Bo = h),
|
|
23
|
+
(this.jo = a),
|
|
24
|
+
(this.Do = u),
|
|
25
25
|
(this.appVersion = c),
|
|
26
|
-
(this.
|
|
26
|
+
(this.Xh = l),
|
|
27
|
+
(this.fn = t),
|
|
27
28
|
(this.u = e),
|
|
28
|
-
(this.
|
|
29
|
+
(this.Uo = s),
|
|
29
30
|
(this.ft = i),
|
|
30
31
|
(this._e = r),
|
|
31
32
|
(this.wt = o),
|
|
32
|
-
(this.
|
|
33
|
-
(this.
|
|
34
|
-
(this.
|
|
35
|
-
(this.
|
|
33
|
+
(this.cn = n),
|
|
34
|
+
(this.Bo = 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
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
ii(
|
|
44
|
-
(t.api_key = this.
|
|
41
|
+
Bs(t, e = !1, s = !1) {
|
|
42
|
+
const r = this.fn.ce(!s),
|
|
43
|
+
o = r.Kr(),
|
|
44
|
+
n = this.u.v(i.k.Fa);
|
|
45
|
+
ii(n, o) || (t.device = o),
|
|
46
|
+
(t.api_key = this.cn),
|
|
45
47
|
(t.time = h(new Date().valueOf(), !0));
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
+
const a = this.u.v(i.k.Kh) || [],
|
|
49
|
+
u = this.u.v(i.k.Wh) || "";
|
|
48
50
|
if (
|
|
49
|
-
(this.
|
|
50
|
-
(!ii(
|
|
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),
|
|
55
|
-
(t.
|
|
57
|
+
(t.app_version_code = this.Xh),
|
|
58
|
+
(t.device_id = r.id),
|
|
56
59
|
e)
|
|
57
60
|
) {
|
|
58
61
|
const e = this.ft.getUserId();
|
|
@@ -60,13 +63,13 @@ export default class Pt {
|
|
|
60
63
|
}
|
|
61
64
|
return t;
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
Zs(t, e, i) {
|
|
64
67
|
const o = e.auth_error,
|
|
65
68
|
n = e.error;
|
|
66
69
|
if (!o && !n) return !0;
|
|
67
70
|
if (o) {
|
|
68
71
|
let e;
|
|
69
|
-
this.
|
|
72
|
+
this.Uo.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.Uo.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.Uo.Bh(s),
|
|
87
90
|
!1
|
|
88
91
|
);
|
|
89
92
|
}
|
|
@@ -91,161 +94,163 @@ 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
|
-
s.N(r.q.
|
|
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
|
-
s.N(r.q.
|
|
107
|
+
s.N(r.q.qs, { e: i + ": " + e.response }),
|
|
105
108
|
r.j.info(i),
|
|
106
109
|
!1
|
|
107
110
|
);
|
|
108
|
-
case qt.
|
|
109
|
-
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.
|
|
111
|
+
case qt.Ra:
|
|
112
|
+
o = `The API key "${t.api_key}" is invalid for the baseUrl ${this.Bo}`;
|
|
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
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
let a = this.
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
let
|
|
133
|
-
|
|
128
|
+
$a(t, e, s, i, r = !1) {
|
|
129
|
+
const o = [],
|
|
130
|
+
n = (t) => t || "",
|
|
131
|
+
h = n(this.ft.getUserId());
|
|
132
|
+
let a = this.Jr(t, e);
|
|
133
|
+
const u = [],
|
|
134
|
+
c = [];
|
|
135
|
+
let l,
|
|
136
|
+
f = null;
|
|
134
137
|
if (s.length > 0) {
|
|
135
138
|
const t = [];
|
|
136
139
|
for (const e of s) {
|
|
137
|
-
if (((
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
+
if (((l = e.Kr()), this.Uo.wh())) {
|
|
141
|
+
if (h && !l.user_id) {
|
|
142
|
+
f || (f = {}), f.events || (f.events = []), f.events.push(l);
|
|
140
143
|
continue;
|
|
141
144
|
}
|
|
142
|
-
if (
|
|
143
|
-
|
|
145
|
+
if (n(l.user_id) !== h) {
|
|
146
|
+
c.push(l);
|
|
144
147
|
continue;
|
|
145
148
|
}
|
|
146
149
|
}
|
|
147
|
-
t.push(
|
|
150
|
+
t.push(l);
|
|
148
151
|
}
|
|
149
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
|
-
this.
|
|
157
|
+
e && (this.Uo.wh() && n(e.user_id) !== h ? u.push(e) : t.push(e));
|
|
155
158
|
t.length > 0 && (a.attributes = t);
|
|
156
159
|
}
|
|
157
|
-
if ((this.
|
|
158
|
-
|
|
159
|
-
const t = { requestData:
|
|
160
|
-
|
|
160
|
+
if ((this.Qh(c, u), (a = this.Bs(a, !0, r)), f)) {
|
|
161
|
+
f = this.Bs(f, !1, r);
|
|
162
|
+
const t = { requestData: f, headers: this.Hs(f, T.Os.Na) };
|
|
163
|
+
o.push(t);
|
|
161
164
|
}
|
|
162
|
-
if (a && !this.
|
|
163
|
-
const
|
|
164
|
-
return
|
|
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) };
|
|
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 = be.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
190
|
const r = null != s ? s : this.ft.getUserId();
|
|
188
191
|
return (
|
|
189
192
|
r && (i.user_id = r),
|
|
190
|
-
(i.config = { config_time: this.wt.
|
|
193
|
+
(i.config = { config_time: this.wt.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
|
}
|
|
201
204
|
return s;
|
|
202
205
|
}
|
|
203
|
-
|
|
204
|
-
const r = [["X-Braze-Api-Key", this.
|
|
205
|
-
o = this.
|
|
206
|
+
Hs(t, e, s = !1) {
|
|
207
|
+
const r = [["X-Braze-Api-Key", this.cn]],
|
|
208
|
+
o = this.Ua(e);
|
|
206
209
|
r.push(["X-Braze-Last-Req-Ms-Ago", o]);
|
|
207
|
-
|
|
210
|
+
const n = T.Wa(this.u, e).toString();
|
|
211
|
+
r.push(["X-Braze-Req-Attempt", n]);
|
|
212
|
+
let h = !1;
|
|
208
213
|
if (
|
|
209
214
|
(null != t.respond_with &&
|
|
210
215
|
t.respond_with.triggers &&
|
|
211
|
-
(r.push(["X-Braze-TriggersRequest", "true"]), (
|
|
216
|
+
(r.push(["X-Braze-TriggersRequest", "true"]), (h = !0)),
|
|
212
217
|
null != t.respond_with &&
|
|
213
218
|
t.respond_with.feed &&
|
|
214
|
-
(r.push(["X-Braze-FeedRequest", "true"]), (
|
|
215
|
-
e === T.
|
|
219
|
+
(r.push(["X-Braze-FeedRequest", "true"]), (h = !0)),
|
|
220
|
+
e === T.Os.Ks)
|
|
216
221
|
) {
|
|
217
222
|
r.push(["X-Braze-ContentCardsRequest", "true"]);
|
|
218
|
-
let t = this.u.v(i.k.
|
|
219
|
-
(t && s) || ((t = 0), this.u.D(i.k.
|
|
223
|
+
let t = this.u.v(i.k.Ls);
|
|
224
|
+
(t && s) || ((t = 0), this.u.D(i.k.Ls, t)),
|
|
220
225
|
r.push(["BRAZE-SYNC-RETRY-COUNT", t.toString()]),
|
|
221
|
-
(
|
|
226
|
+
(h = !0);
|
|
222
227
|
}
|
|
223
228
|
if (
|
|
224
|
-
(e === T.
|
|
225
|
-
(r.push(["X-Braze-FeatureFlagsRequest", "true"]), (
|
|
226
|
-
|
|
227
|
-
this.
|
|
229
|
+
(e === T.Os.Si &&
|
|
230
|
+
(r.push(["X-Braze-FeatureFlagsRequest", "true"]), (h = !0)),
|
|
231
|
+
h && r.push(["X-Braze-DataRequest", "true"]),
|
|
232
|
+
this.Uo.wh())
|
|
228
233
|
) {
|
|
229
|
-
const t = this.
|
|
234
|
+
const t = this.Uo.jh();
|
|
230
235
|
null != t && r.push(["X-Braze-Auth-Signature", t]);
|
|
231
236
|
}
|
|
232
237
|
return r;
|
|
233
238
|
}
|
|
234
|
-
|
|
239
|
+
Qs(t, e) {
|
|
235
240
|
const s = t.device;
|
|
236
241
|
s && s.os_version instanceof Promise
|
|
237
|
-
? s.os_version.then(s => {
|
|
242
|
+
? s.os_version.then((s) => {
|
|
238
243
|
(t.device.os_version = s), e();
|
|
239
244
|
})
|
|
240
245
|
: e();
|
|
241
246
|
}
|
|
242
|
-
|
|
243
|
-
this.
|
|
247
|
+
ti() {
|
|
248
|
+
this.Uo.ti();
|
|
244
249
|
}
|
|
245
|
-
|
|
246
|
-
return this.
|
|
250
|
+
Ys() {
|
|
251
|
+
return this.Bo;
|
|
247
252
|
}
|
|
248
253
|
addSdkMetadata(t) {
|
|
249
|
-
for (const e of t) -1 === this.
|
|
254
|
+
for (const e of t) -1 === this.$h.indexOf(e) && this.$h.push(e);
|
|
250
255
|
}
|
|
251
256
|
}
|
|
@@ -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
|
+
Yh() {
|
|
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
|
+
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 = Bt.
|
|
28
|
-
n = new O.
|
|
27
|
+
const a = Bt.Ja(),
|
|
28
|
+
n = new O.Va(e, a && !o, t);
|
|
29
29
|
let c;
|
|
30
|
-
return (c = t ? new O.
|
|
30
|
+
return (c = t ? new O.Ya(e) : new O.Za()), new O(n, c);
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
Ja: 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;
|