@braze/web-sdk 4.8.0 → 4.8.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 +6 -3
- package/package.json +1 -1
- package/shared-lib/braze-shared-lib.js +1 -1
- package/shared-lib/encoding-utils.js +1 -1
- package/shared-lib/event-types.js +11 -11
- package/shared-lib/indexed-db-adapter.js +67 -67
- package/shared-lib/logger.js +7 -7
- package/src/Card/card-manager.js +1 -1
- package/src/ContentCards/ui/show-content-cards.js +1 -1
- package/src/Core/disable-sdk.js +5 -4
- package/src/Core/enable-sdk.js +1 -1
- package/src/Core/is-disabled.js +1 -1
- package/src/FeatureFlags/feature-flags-provider.js +12 -12
- package/src/Feed/ui/show-feed.js +1 -1
- package/src/InAppMessage/in-app-message-manager.js +40 -34
- package/src/InAppMessage/log-in-app-message-button-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-click.js +2 -2
- package/src/InAppMessage/log-in-app-message-html-click.js +1 -1
- package/src/InAppMessage/models/in-app-message-button.js +4 -4
- package/src/InAppMessage/models/in-app-message.js +13 -13
- package/src/InAppMessage/models/slide-up-message.js +2 -2
- package/src/InAppMessage/models/templated-in-app-message.js +8 -8
- package/src/InAppMessage/ui/show-in-app-message.js +2 -2
- package/src/Push/push-manager.js +82 -81
- package/src/Push/utils/push-utils.js +4 -4
- package/src/User/user-manager.js +4 -4
- package/src/User/user.js +5 -5
- package/src/common/feed-display.js +82 -72
- package/src/l10n/l10n-manager-factory.js +7 -7
- package/src/managers/auth-manager.js +18 -15
- package/src/managers/braze-instance.js +125 -109
- package/src/managers/device-manager.js +40 -35
- package/src/managers/network-manager.js +90 -81
- package/src/managers/server-config-manager.js +36 -34
- package/src/managers/session-manager.js +44 -37
- package/src/managers/storage-manager-factory.js +23 -16
- package/src/managers/storage-manager.js +251 -239
- package/src/managers/subscription-manager.js +10 -7
- package/src/managers/types.js +1 -0
- package/src/models/backend-errors.js +5 -5
- package/src/models/braze-event.js +10 -4
- package/src/models/device.js +10 -18
- package/src/models/identifier.js +10 -11
- package/src/models/push-token.js +14 -9
- package/src/models/request-result.js +2 -2
- package/src/models/server-config.js +32 -16
- package/src/models/types.js +1 -0
- package/src/request-controller.js +109 -109
- package/src/triggers/models/custom-event-data.js +6 -6
- package/src/triggers/models/custom-event-property-data.js +9 -9
- package/src/triggers/models/filter-set.js +9 -9
- package/src/triggers/models/filter.js +60 -60
- package/src/triggers/models/in-app-message-click-data.js +9 -9
- package/src/triggers/models/purchase-data.js +3 -3
- package/src/triggers/models/purchase-property-data.js +7 -7
- package/src/triggers/models/push-click-data.js +6 -6
- package/src/triggers/models/trigger-condition.js +46 -46
- package/src/triggers/models/trigger-events.js +1 -1
- package/src/triggers/models/trigger.js +27 -27
- package/src/triggers/triggers-provider.js +126 -126
- package/src/ui/js/attach-css.js +1 -1
- package/src/util/base-device-parser.js +2 -2
- package/src/util/braze-actions.js +4 -4
- package/src/util/browser-detector.js +18 -18
- package/src/util/client-hints-parser.js +6 -6
- package/src/util/device-constants.js +6 -6
- package/src/util/dom-utils.js +5 -5
- package/src/util/error-utils.js +2 -0
- package/src/util/net.js +1 -1
- package/src/util/request-header-utils.js +9 -9
- package/src/util/user-agent-parser.js +21 -21
- package/src/util/window-utils.js +1 -1
|
@@ -52,75 +52,89 @@ const L = {
|
|
|
52
52
|
};
|
|
53
53
|
class Wt {
|
|
54
54
|
constructor() {
|
|
55
|
-
(this.
|
|
56
|
-
(this.
|
|
57
|
-
(this.
|
|
58
|
-
(this.
|
|
59
|
-
(this.
|
|
60
|
-
(this.
|
|
61
|
-
(this.
|
|
62
|
-
(this.
|
|
63
|
-
(this.
|
|
55
|
+
(this.Xr = ""),
|
|
56
|
+
(this.Ro = ""),
|
|
57
|
+
(this.Mo = void 0),
|
|
58
|
+
(this.jo = null),
|
|
59
|
+
(this.Zr = null),
|
|
60
|
+
(this.gt = null),
|
|
61
|
+
(this.Ci = null),
|
|
62
|
+
(this.wt = null),
|
|
63
|
+
(this._e = null),
|
|
64
|
+
(this.u = null),
|
|
65
|
+
(this.ft = null),
|
|
66
|
+
(this.Do = ""),
|
|
67
|
+
(this.Uo = !1),
|
|
68
|
+
(this.Bo = !1),
|
|
69
|
+
(this.Wo = new E()),
|
|
70
|
+
(this.zo = new E()),
|
|
71
|
+
(this.options = {}),
|
|
72
|
+
(this.Vo = []),
|
|
73
|
+
(this.Go = []),
|
|
74
|
+
(this.Se = []),
|
|
75
|
+
(this.Ro = "4.8.1");
|
|
64
76
|
}
|
|
65
|
-
|
|
66
|
-
this.
|
|
77
|
+
Ko(t) {
|
|
78
|
+
this.Wo.lt(t);
|
|
67
79
|
}
|
|
68
80
|
Nh(t) {
|
|
69
|
-
this.
|
|
81
|
+
this.zo.lt(t);
|
|
70
82
|
}
|
|
71
83
|
initialize(t, s) {
|
|
72
84
|
if (this.ue())
|
|
73
85
|
return (
|
|
74
86
|
r.j.info("Braze has already been initialized with an API key."), !0
|
|
75
87
|
);
|
|
76
|
-
this.
|
|
88
|
+
this.options = s || {};
|
|
77
89
|
let e = this.nn(L.Ao);
|
|
78
|
-
const n = ct(Z.
|
|
90
|
+
const n = ct(Z.jn());
|
|
79
91
|
if (
|
|
80
92
|
(n && "true" === n.brazeLogging && (e = !0),
|
|
81
93
|
r.j.init(e),
|
|
82
|
-
r.j.info(
|
|
94
|
+
r.j.info(
|
|
95
|
+
`Initialization Options: ${JSON.stringify(this.options, null, 2)}`
|
|
96
|
+
),
|
|
83
97
|
null == t || "" === t || "string" != typeof t)
|
|
84
98
|
)
|
|
85
99
|
return r.j.error("Braze requires a valid API key to be initialized."), !1;
|
|
86
|
-
this.
|
|
100
|
+
this.Xr = t;
|
|
87
101
|
let o = this.nn(L.Eo);
|
|
88
102
|
if (null == o || "" === o || "string" != typeof o)
|
|
89
103
|
return r.j.error("Braze requires a valid baseUrl to be initialized."), !1;
|
|
90
104
|
!1 === /^https?:/.test(o) && (o = `https://${o}`);
|
|
91
|
-
|
|
105
|
+
const h = o;
|
|
92
106
|
if (
|
|
93
107
|
((o = document.createElement("a")),
|
|
94
108
|
(o.href = h),
|
|
95
109
|
"/" === o.pathname && (o = `${o}api/v3`),
|
|
96
|
-
(this.
|
|
97
|
-
V
|
|
110
|
+
(this.Do = o.toString()),
|
|
111
|
+
V.Ho && !this.nn(L.ho))
|
|
98
112
|
)
|
|
99
113
|
return (
|
|
100
114
|
r.j.info("Ignoring activity from crawler bot " + navigator.userAgent),
|
|
101
|
-
(this.
|
|
115
|
+
(this.Bo = !0),
|
|
102
116
|
!1
|
|
103
117
|
);
|
|
104
118
|
const a = this.nn(L._o) || !1;
|
|
105
119
|
if (
|
|
106
|
-
((this.
|
|
120
|
+
((this.u = Bt.$o(t, a)), a && this.u.qo(t), new O.ee(null, !0).wr(i.ne))
|
|
107
121
|
)
|
|
108
122
|
return (
|
|
109
123
|
r.j.info("Ignoring all activity due to previous opt out"),
|
|
110
|
-
(this.
|
|
124
|
+
(this.Bo = !0),
|
|
111
125
|
!1
|
|
112
126
|
);
|
|
113
|
-
for (const t of oo(this.
|
|
114
|
-
-1 === Lt(r.
|
|
127
|
+
for (const t of oo(this.options))
|
|
128
|
+
-1 === Lt(r.xo).indexOf(t) &&
|
|
115
129
|
r.j.warn(`Ignoring unknown initialization option '${t}'.`);
|
|
116
130
|
const l = ["mparticle", "wordpress", "tealium"];
|
|
117
131
|
if (null != this.nn(L.Po)) {
|
|
118
132
|
const t = this.nn(L.Po);
|
|
119
133
|
-1 !== l.indexOf(t)
|
|
120
|
-
? (this.
|
|
134
|
+
? (this.Mo = t)
|
|
121
135
|
: r.j.error("Invalid sdk flavor passed: " + t);
|
|
122
136
|
}
|
|
123
|
-
let u = this.nn(r.
|
|
137
|
+
let u = this.nn(r.xo.Io);
|
|
124
138
|
if (null != u)
|
|
125
139
|
if (p(u)) {
|
|
126
140
|
const t = [];
|
|
@@ -137,46 +151,46 @@ class Wt {
|
|
|
137
151
|
"devicePropertyAllowlist must be an array. Defaulting to all properties."
|
|
138
152
|
),
|
|
139
153
|
(u = null);
|
|
140
|
-
(this.
|
|
141
|
-
(this.
|
|
142
|
-
(this.
|
|
143
|
-
(this.
|
|
154
|
+
(this.Zr = new Ot(this.u, u)),
|
|
155
|
+
(this.wt = new Mt(this.u)),
|
|
156
|
+
(this.ft = new bt(this.wt, this.u)),
|
|
157
|
+
(this._e = new Dt(this.u, this.ft, this.wt, this.nn(L.wo)));
|
|
144
158
|
const f = new E();
|
|
145
159
|
return (
|
|
146
|
-
(this.
|
|
160
|
+
(this.jo = new jt(this.u, this.nn(L.So), f)),
|
|
147
161
|
this.jt(f),
|
|
148
|
-
(this.
|
|
149
|
-
this.
|
|
150
|
-
this.
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
153
|
-
this.
|
|
154
|
-
this.
|
|
155
|
-
this.
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
158
|
-
this.
|
|
162
|
+
(this.gt = new Pt(
|
|
163
|
+
this.Zr,
|
|
164
|
+
this.u,
|
|
165
|
+
this.jo,
|
|
166
|
+
this.ft,
|
|
167
|
+
this._e,
|
|
168
|
+
this.wt,
|
|
169
|
+
this.Xr,
|
|
170
|
+
this.Do,
|
|
171
|
+
this.Ro,
|
|
172
|
+
this.Mo || "",
|
|
159
173
|
this.nn(L.To)
|
|
160
174
|
)),
|
|
161
|
-
(this.
|
|
162
|
-
this.
|
|
163
|
-
this.
|
|
164
|
-
this.
|
|
165
|
-
this.
|
|
166
|
-
this.
|
|
167
|
-
this.
|
|
168
|
-
this.
|
|
175
|
+
(this.Ci = new Rt(
|
|
176
|
+
this.Xr,
|
|
177
|
+
this.Do,
|
|
178
|
+
this._e,
|
|
179
|
+
this.Zr,
|
|
180
|
+
this.ft,
|
|
181
|
+
this.wt,
|
|
182
|
+
this.u,
|
|
169
183
|
t => {
|
|
170
184
|
if (this.ue()) for (const i of this.gr()) i.Ts(t);
|
|
171
185
|
},
|
|
172
|
-
this.
|
|
173
|
-
this.
|
|
186
|
+
this.jo,
|
|
187
|
+
this.gt
|
|
174
188
|
)),
|
|
175
|
-
this.
|
|
189
|
+
this.Ci.initialize(),
|
|
176
190
|
r.j.info(
|
|
177
191
|
`Initialized for the Braze backend at "${this.nn(
|
|
178
192
|
L.Eo
|
|
179
|
-
)}" with API key "${this.
|
|
193
|
+
)}" with API key "${this.Xr}".`
|
|
180
194
|
),
|
|
181
195
|
null != this.nn(L.Oo) &&
|
|
182
196
|
z(
|
|
@@ -185,128 +199,130 @@ class Wt {
|
|
|
185
199
|
"allowUserSuppliedJavascript"
|
|
186
200
|
),
|
|
187
201
|
et.init(),
|
|
188
|
-
this.
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
202
|
+
this.wt.Ni(() => {
|
|
203
|
+
this.Uo &&
|
|
204
|
+
this.wt &&
|
|
205
|
+
this.wt.bi() &&
|
|
191
206
|
import("../FeatureFlags/refresh-feature-flags.js").then(t => {
|
|
192
|
-
if (!this.
|
|
207
|
+
if (!this.Uo) return;
|
|
193
208
|
(0, t.default)();
|
|
194
209
|
});
|
|
195
210
|
}),
|
|
196
|
-
this.
|
|
197
|
-
this.
|
|
198
|
-
this.
|
|
211
|
+
this.Ci.pr(() => {
|
|
212
|
+
this.Uo &&
|
|
213
|
+
this.wt &&
|
|
214
|
+
this.wt.bi() &&
|
|
199
215
|
import("../FeatureFlags/refresh-feature-flags.js").then(t => {
|
|
200
|
-
if (!this.
|
|
216
|
+
if (!this.Uo) return;
|
|
201
217
|
(0, t.default)(null, null, !0);
|
|
202
218
|
});
|
|
203
219
|
}),
|
|
204
|
-
this.
|
|
205
|
-
(this.
|
|
220
|
+
this.Wo.Et(this.options),
|
|
221
|
+
(this.Uo = !0),
|
|
206
222
|
!0
|
|
207
223
|
);
|
|
208
224
|
}
|
|
209
225
|
destroy(t) {
|
|
210
226
|
if ((r.j.destroy(), this.ue())) {
|
|
211
|
-
this.
|
|
212
|
-
for (const t of this.
|
|
213
|
-
this.
|
|
214
|
-
for (const t of this.
|
|
215
|
-
(this.
|
|
227
|
+
this.zo.Et(), this.zo.removeAllSubscriptions();
|
|
228
|
+
for (const t of this.Vo) t.destroy();
|
|
229
|
+
this.Vo = [];
|
|
230
|
+
for (const t of this.Go) t.clearData(!1);
|
|
231
|
+
(this.Go = []),
|
|
216
232
|
this.removeAllSubscriptions(),
|
|
217
|
-
(this.
|
|
218
|
-
this.
|
|
219
|
-
(this.
|
|
220
|
-
(this.
|
|
221
|
-
(this.
|
|
222
|
-
(this.
|
|
223
|
-
(this.
|
|
224
|
-
(this.
|
|
225
|
-
(this.
|
|
226
|
-
(this.
|
|
227
|
-
(this.
|
|
228
|
-
(this.
|
|
229
|
-
(this.
|
|
230
|
-
t && (this.
|
|
233
|
+
(this.Se = []),
|
|
234
|
+
null != this.Ci && this.Ci.destroy(),
|
|
235
|
+
(this.Ci = null),
|
|
236
|
+
(this.jo = null),
|
|
237
|
+
(this.Zr = null),
|
|
238
|
+
(this.gt = null),
|
|
239
|
+
(this.wt = null),
|
|
240
|
+
(this._e = null),
|
|
241
|
+
(this.ft = null),
|
|
242
|
+
(this.options = {}),
|
|
243
|
+
(this.Mo = void 0),
|
|
244
|
+
(this.Uo = !1),
|
|
245
|
+
(this.Bo = !1),
|
|
246
|
+
t && (this.u = null);
|
|
231
247
|
}
|
|
232
248
|
}
|
|
233
249
|
rr() {
|
|
234
|
-
if (this.
|
|
250
|
+
if (this.Jo()) return !1;
|
|
235
251
|
if (!this.ue()) throw new Error(P);
|
|
236
252
|
return !0;
|
|
237
253
|
}
|
|
238
254
|
ea() {
|
|
239
|
-
return this.
|
|
255
|
+
return this.Xr;
|
|
240
256
|
}
|
|
241
257
|
Sr() {
|
|
242
|
-
return this.
|
|
258
|
+
return this.jo;
|
|
243
259
|
}
|
|
244
260
|
Zs() {
|
|
245
|
-
return this.
|
|
261
|
+
return this.Do;
|
|
246
262
|
}
|
|
247
263
|
ie() {
|
|
248
|
-
return this.
|
|
264
|
+
return this.Zr;
|
|
249
265
|
}
|
|
250
266
|
ar() {
|
|
251
|
-
return this.
|
|
267
|
+
return this.gt;
|
|
252
268
|
}
|
|
253
269
|
nn(t) {
|
|
254
|
-
return this.
|
|
270
|
+
return this.options[t];
|
|
255
271
|
}
|
|
256
272
|
gr() {
|
|
257
|
-
return this.
|
|
273
|
+
return this.Go;
|
|
258
274
|
}
|
|
259
275
|
cr() {
|
|
260
|
-
return this.
|
|
276
|
+
return this.Ci;
|
|
261
277
|
}
|
|
262
278
|
tr() {
|
|
263
|
-
return this.
|
|
279
|
+
return this.wt;
|
|
264
280
|
}
|
|
265
281
|
aa() {
|
|
266
|
-
return this.
|
|
282
|
+
return this._e;
|
|
267
283
|
}
|
|
268
284
|
l() {
|
|
269
|
-
return this.
|
|
285
|
+
return this.u;
|
|
270
286
|
}
|
|
271
287
|
jr() {
|
|
272
|
-
if (this.
|
|
288
|
+
if (this.ft && this.Ci) return new User(this.ft, this.Ci);
|
|
273
289
|
}
|
|
274
290
|
ir() {
|
|
275
|
-
return this.
|
|
291
|
+
return this.ft;
|
|
276
292
|
}
|
|
277
293
|
nr() {
|
|
278
294
|
return !0 === this.nn(L.Co) || !0 === this.nn(L.Oo);
|
|
279
295
|
}
|
|
280
296
|
g(t) {
|
|
281
297
|
let i = !1;
|
|
282
|
-
for (const s of this.
|
|
283
|
-
i || this.
|
|
298
|
+
for (const s of this.Vo) s === t && (i = !0);
|
|
299
|
+
i || this.Vo.push(t);
|
|
284
300
|
}
|
|
285
301
|
dr(t) {
|
|
286
302
|
let i = !1;
|
|
287
|
-
for (const s of this.
|
|
288
|
-
t instanceof y && !i && this.
|
|
303
|
+
for (const s of this.Go) s.constructor === t.constructor && (i = !0);
|
|
304
|
+
t instanceof y && !i && this.Go.push(t);
|
|
289
305
|
}
|
|
290
306
|
jt(t) {
|
|
291
|
-
t instanceof E && this.
|
|
307
|
+
t instanceof E && this.Se.push(t);
|
|
292
308
|
}
|
|
293
309
|
removeAllSubscriptions() {
|
|
294
|
-
if (this.rr()) for (const t of this.
|
|
310
|
+
if (this.rr()) for (const t of this.Se) t.removeAllSubscriptions();
|
|
295
311
|
}
|
|
296
312
|
removeSubscription(t) {
|
|
297
|
-
if (this.rr()) for (const i of this.
|
|
313
|
+
if (this.rr()) for (const i of this.Se) i.removeSubscription(t);
|
|
298
314
|
}
|
|
299
315
|
ae(t) {
|
|
300
|
-
this.
|
|
316
|
+
this.Bo = t;
|
|
301
317
|
}
|
|
302
318
|
ue() {
|
|
303
|
-
return this.
|
|
319
|
+
return this.Uo;
|
|
304
320
|
}
|
|
305
|
-
|
|
306
|
-
return this.
|
|
321
|
+
Jo() {
|
|
322
|
+
return this.Bo;
|
|
307
323
|
}
|
|
308
324
|
Us() {
|
|
309
|
-
return this.
|
|
325
|
+
return this.Ro;
|
|
310
326
|
}
|
|
311
327
|
}
|
|
312
328
|
const e = new Wt();
|
|
@@ -1,77 +1,82 @@
|
|
|
1
1
|
import V from "../util/browser-detector.js";
|
|
2
|
-
import
|
|
2
|
+
import xt from "../models/device.js";
|
|
3
3
|
import DeviceProperties from "../Core/device-properties.js";
|
|
4
4
|
import _t from "../models/identifier.js";
|
|
5
5
|
import r from "../../shared-lib/braze-shared-lib.js";
|
|
6
6
|
import { STORAGE_KEYS as i } from "../managers/storage-manager.js";
|
|
7
7
|
import { values as Lt } from "../util/code-utils.js";
|
|
8
|
+
import { getErrorMessage as ei } from "../util/error-utils.js";
|
|
8
9
|
export default class Ot {
|
|
9
|
-
constructor(
|
|
10
|
-
(this.
|
|
10
|
+
constructor(t, e) {
|
|
11
|
+
(this.u = t),
|
|
12
|
+
(this.Qo = e),
|
|
13
|
+
(this.u = t),
|
|
14
|
+
null == e && (e = Lt(DeviceProperties)),
|
|
15
|
+
(this.Qo = e);
|
|
11
16
|
}
|
|
12
17
|
te() {
|
|
13
|
-
let
|
|
14
|
-
null ==
|
|
15
|
-
const
|
|
16
|
-
for (let
|
|
17
|
-
|
|
18
|
-
switch (r) {
|
|
18
|
+
let t = this.u.tu(i.eu.Xo);
|
|
19
|
+
null == t && ((t = new _t(r.Z.Y())), this.u.uu(i.eu.Xo, t));
|
|
20
|
+
const e = new xt(t.iu);
|
|
21
|
+
for (let t = 0; t < this.Qo.length; t++) {
|
|
22
|
+
switch (this.Qo[t]) {
|
|
19
23
|
case DeviceProperties.BROWSER:
|
|
20
|
-
|
|
24
|
+
e.browser = V.browser;
|
|
21
25
|
break;
|
|
22
26
|
case DeviceProperties.BROWSER_VERSION:
|
|
23
|
-
|
|
27
|
+
e.Yo = V.version;
|
|
24
28
|
break;
|
|
25
29
|
case DeviceProperties.OS:
|
|
26
|
-
|
|
30
|
+
e.os = this.Zo();
|
|
27
31
|
break;
|
|
28
32
|
case DeviceProperties.RESOLUTION:
|
|
29
|
-
|
|
33
|
+
e.sa = screen.width + "x" + screen.height;
|
|
30
34
|
break;
|
|
31
35
|
case DeviceProperties.LANGUAGE:
|
|
32
|
-
|
|
36
|
+
e.language = V.language;
|
|
33
37
|
break;
|
|
34
38
|
case DeviceProperties.TIME_ZONE:
|
|
35
|
-
|
|
39
|
+
e.timeZone = this.oa(new Date());
|
|
36
40
|
break;
|
|
37
41
|
case DeviceProperties.USER_AGENT:
|
|
38
|
-
|
|
42
|
+
e.userAgent = V.userAgent;
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
|
-
return
|
|
45
|
+
return e;
|
|
42
46
|
}
|
|
43
|
-
|
|
44
|
-
if (V.
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
+
Zo() {
|
|
48
|
+
if (V.ca()) return V.ca();
|
|
49
|
+
const t = this.u.v(i.k.la);
|
|
50
|
+
return t && t.os_version ? t.os_version : V.Zo();
|
|
47
51
|
}
|
|
48
|
-
|
|
52
|
+
oa(t) {
|
|
53
|
+
let e = !1;
|
|
49
54
|
if ("undefined" != typeof Intl && "function" == typeof Intl.DateTimeFormat)
|
|
50
55
|
try {
|
|
51
56
|
if ("function" == typeof Intl.DateTimeFormat().resolvedOptions) {
|
|
52
|
-
const
|
|
53
|
-
if (null !=
|
|
57
|
+
const t = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
58
|
+
if (null != t && "" !== t) return t;
|
|
54
59
|
}
|
|
55
60
|
} catch (t) {
|
|
56
61
|
r.j.info(
|
|
57
62
|
"Intl.DateTimeFormat threw an error, cannot detect user's time zone:" +
|
|
58
|
-
t
|
|
63
|
+
ei(t)
|
|
59
64
|
),
|
|
60
|
-
(e =
|
|
65
|
+
(e = !0);
|
|
61
66
|
}
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
return this.
|
|
67
|
+
if (e) return "";
|
|
68
|
+
const s = t.getTimezoneOffset();
|
|
69
|
+
return this.fa(s);
|
|
65
70
|
}
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
r =
|
|
71
|
+
fa(t) {
|
|
72
|
+
const e = Math.trunc(t / 60),
|
|
73
|
+
r = Math.trunc(t % 60);
|
|
69
74
|
let s = "GMT";
|
|
70
75
|
return (
|
|
71
|
-
0 !==
|
|
72
|
-
((s +=
|
|
76
|
+
0 !== t &&
|
|
77
|
+
((s += t < 0 ? "+" : "-"),
|
|
73
78
|
(s +=
|
|
74
|
-
("00" + Math.abs(
|
|
79
|
+
("00" + Math.abs(e)).slice(-2) +
|
|
75
80
|
":" +
|
|
76
81
|
("00" + Math.abs(r)).slice(-2))),
|
|
77
82
|
s
|