@wix/astro 1.0.31 → 1.0.32

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.
@@ -1,5 +1,629 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
+ // If the importer is in node compatibility mode or this is not an ESM
20
+ // file that has been converted to a CommonJS file using a Babel-
21
+ // compatible transform (i.e. "__esModule" has not been set), then set
22
+ // "default" to the CommonJS "module.exports" for node compatibility.
23
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
+ mod
25
+ ));
26
+
27
+ // ../../node_modules/@wix/monitoring/build/index.cjs
28
+ var require_build = __commonJS({
29
+ "../../node_modules/@wix/monitoring/build/index.cjs"(exports, module) {
30
+ "use strict";
31
+ var __defProp2 = Object.defineProperty;
32
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
33
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
34
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
35
+ var __export = (target, all) => {
36
+ for (var name in all)
37
+ __defProp2(target, name, { get: all[name], enumerable: true });
38
+ };
39
+ var __copyProps2 = (to, from, except, desc) => {
40
+ if (from && typeof from === "object" || typeof from === "function") {
41
+ for (let key of __getOwnPropNames2(from))
42
+ if (!__hasOwnProp2.call(to, key) && key !== except)
43
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
44
+ }
45
+ return to;
46
+ };
47
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
48
+ var index_exports = {};
49
+ __export(index_exports, {
50
+ createFallbackMonitoringClient: () => createFallbackMonitoringClient,
51
+ generateTagsAndContext: () => generateTagsAndContext
52
+ });
53
+ module.exports = __toCommonJS(index_exports);
54
+ var validValue = (value) => value !== void 0 && value !== null && value !== "";
55
+ var pickByValidValues = (obj) => pickBy(obj, validValue);
56
+ function pickBy(object, predicate = (value) => !!value) {
57
+ if (!object) {
58
+ return {};
59
+ }
60
+ const result = {};
61
+ for (const key in object) {
62
+ if (predicate(object[key], key)) {
63
+ result[key] = object[key];
64
+ }
65
+ }
66
+ return result;
67
+ }
68
+ var generateTagsAndContext = (context) => {
69
+ const tags = pickByValidValues({
70
+ "app.id": context.appId,
71
+ "app.version": context.appVersion,
72
+ "app.instanceId": context.appInstanceId,
73
+ "extension.id": context.extensionId,
74
+ "extension.name": context.extensionName,
75
+ "extension.type": context.extensionType,
76
+ platform: context.platform
77
+ });
78
+ const contexts = pickBy(
79
+ {
80
+ "extension.data": pickByValidValues({
81
+ ...context.extensionData
82
+ }),
83
+ site: pickByValidValues({
84
+ url: context.siteUrl,
85
+ id: context.tenantType === "SITE" ? context.tenantId : void 0
86
+ }),
87
+ account: pickByValidValues({
88
+ id: context.tenantType === "ACCOUNT" ? context.tenantId : void 0
89
+ })
90
+ },
91
+ (value) => !!value && Object.keys(value).length > 0
92
+ );
93
+ return {
94
+ tags,
95
+ contexts
96
+ };
97
+ };
98
+ var FallbackMonitoringClient = class {
99
+ constructor(message) {
100
+ this.message = message;
101
+ this.captureException = () => {
102
+ console.error(this.message);
103
+ };
104
+ this.captureMessage = () => {
105
+ console.error(this.message);
106
+ };
107
+ this.startSpan = (spanOptions, callback) => {
108
+ console.error(this.message);
109
+ return callback(void 0);
110
+ };
111
+ this.startSpanManual = () => {
112
+ console.error(this.message);
113
+ return {
114
+ end: () => {
115
+ },
116
+ fail: () => {
117
+ }
118
+ };
119
+ };
120
+ this.endSpanManual = () => {
121
+ console.error(this.message);
122
+ };
123
+ this.addBreadcrumb = () => {
124
+ console.error(this.message);
125
+ };
126
+ }
127
+ };
128
+ var createFallbackMonitoringClient = (message) => {
129
+ return new FallbackMonitoringClient(message);
130
+ };
131
+ }
132
+ });
133
+
134
+ // ../../node_modules/lodash/isObject.js
135
+ var require_isObject = __commonJS({
136
+ "../../node_modules/lodash/isObject.js"(exports, module) {
137
+ "use strict";
138
+ function isObject(value) {
139
+ var type = typeof value;
140
+ return value != null && (type == "object" || type == "function");
141
+ }
142
+ module.exports = isObject;
143
+ }
144
+ });
145
+
146
+ // ../../node_modules/lodash/_freeGlobal.js
147
+ var require_freeGlobal = __commonJS({
148
+ "../../node_modules/lodash/_freeGlobal.js"(exports, module) {
149
+ "use strict";
150
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
151
+ module.exports = freeGlobal;
152
+ }
153
+ });
154
+
155
+ // ../../node_modules/lodash/_root.js
156
+ var require_root = __commonJS({
157
+ "../../node_modules/lodash/_root.js"(exports, module) {
158
+ "use strict";
159
+ var freeGlobal = require_freeGlobal();
160
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
161
+ var root = freeGlobal || freeSelf || Function("return this")();
162
+ module.exports = root;
163
+ }
164
+ });
165
+
166
+ // ../../node_modules/lodash/now.js
167
+ var require_now = __commonJS({
168
+ "../../node_modules/lodash/now.js"(exports, module) {
169
+ "use strict";
170
+ var root = require_root();
171
+ var now = function() {
172
+ return root.Date.now();
173
+ };
174
+ module.exports = now;
175
+ }
176
+ });
177
+
178
+ // ../../node_modules/lodash/_trimmedEndIndex.js
179
+ var require_trimmedEndIndex = __commonJS({
180
+ "../../node_modules/lodash/_trimmedEndIndex.js"(exports, module) {
181
+ "use strict";
182
+ var reWhitespace = /\s/;
183
+ function trimmedEndIndex(string) {
184
+ var index = string.length;
185
+ while (index-- && reWhitespace.test(string.charAt(index))) {
186
+ }
187
+ return index;
188
+ }
189
+ module.exports = trimmedEndIndex;
190
+ }
191
+ });
192
+
193
+ // ../../node_modules/lodash/_baseTrim.js
194
+ var require_baseTrim = __commonJS({
195
+ "../../node_modules/lodash/_baseTrim.js"(exports, module) {
196
+ "use strict";
197
+ var trimmedEndIndex = require_trimmedEndIndex();
198
+ var reTrimStart = /^\s+/;
199
+ function baseTrim(string) {
200
+ return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
201
+ }
202
+ module.exports = baseTrim;
203
+ }
204
+ });
205
+
206
+ // ../../node_modules/lodash/_Symbol.js
207
+ var require_Symbol = __commonJS({
208
+ "../../node_modules/lodash/_Symbol.js"(exports, module) {
209
+ "use strict";
210
+ var root = require_root();
211
+ var Symbol2 = root.Symbol;
212
+ module.exports = Symbol2;
213
+ }
214
+ });
215
+
216
+ // ../../node_modules/lodash/_getRawTag.js
217
+ var require_getRawTag = __commonJS({
218
+ "../../node_modules/lodash/_getRawTag.js"(exports, module) {
219
+ "use strict";
220
+ var Symbol2 = require_Symbol();
221
+ var objectProto = Object.prototype;
222
+ var hasOwnProperty = objectProto.hasOwnProperty;
223
+ var nativeObjectToString = objectProto.toString;
224
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
225
+ function getRawTag(value) {
226
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
227
+ try {
228
+ value[symToStringTag] = void 0;
229
+ var unmasked = true;
230
+ } catch (e) {
231
+ }
232
+ var result = nativeObjectToString.call(value);
233
+ if (unmasked) {
234
+ if (isOwn) {
235
+ value[symToStringTag] = tag;
236
+ } else {
237
+ delete value[symToStringTag];
238
+ }
239
+ }
240
+ return result;
241
+ }
242
+ module.exports = getRawTag;
243
+ }
244
+ });
245
+
246
+ // ../../node_modules/lodash/_objectToString.js
247
+ var require_objectToString = __commonJS({
248
+ "../../node_modules/lodash/_objectToString.js"(exports, module) {
249
+ "use strict";
250
+ var objectProto = Object.prototype;
251
+ var nativeObjectToString = objectProto.toString;
252
+ function objectToString(value) {
253
+ return nativeObjectToString.call(value);
254
+ }
255
+ module.exports = objectToString;
256
+ }
257
+ });
258
+
259
+ // ../../node_modules/lodash/_baseGetTag.js
260
+ var require_baseGetTag = __commonJS({
261
+ "../../node_modules/lodash/_baseGetTag.js"(exports, module) {
262
+ "use strict";
263
+ var Symbol2 = require_Symbol();
264
+ var getRawTag = require_getRawTag();
265
+ var objectToString = require_objectToString();
266
+ var nullTag = "[object Null]";
267
+ var undefinedTag = "[object Undefined]";
268
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
269
+ function baseGetTag(value) {
270
+ if (value == null) {
271
+ return value === void 0 ? undefinedTag : nullTag;
272
+ }
273
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
274
+ }
275
+ module.exports = baseGetTag;
276
+ }
277
+ });
278
+
279
+ // ../../node_modules/lodash/isObjectLike.js
280
+ var require_isObjectLike = __commonJS({
281
+ "../../node_modules/lodash/isObjectLike.js"(exports, module) {
282
+ "use strict";
283
+ function isObjectLike(value) {
284
+ return value != null && typeof value == "object";
285
+ }
286
+ module.exports = isObjectLike;
287
+ }
288
+ });
289
+
290
+ // ../../node_modules/lodash/isSymbol.js
291
+ var require_isSymbol = __commonJS({
292
+ "../../node_modules/lodash/isSymbol.js"(exports, module) {
293
+ "use strict";
294
+ var baseGetTag = require_baseGetTag();
295
+ var isObjectLike = require_isObjectLike();
296
+ var symbolTag = "[object Symbol]";
297
+ function isSymbol(value) {
298
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
299
+ }
300
+ module.exports = isSymbol;
301
+ }
302
+ });
303
+
304
+ // ../../node_modules/lodash/toNumber.js
305
+ var require_toNumber = __commonJS({
306
+ "../../node_modules/lodash/toNumber.js"(exports, module) {
307
+ "use strict";
308
+ var baseTrim = require_baseTrim();
309
+ var isObject = require_isObject();
310
+ var isSymbol = require_isSymbol();
311
+ var NAN = 0 / 0;
312
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
313
+ var reIsBinary = /^0b[01]+$/i;
314
+ var reIsOctal = /^0o[0-7]+$/i;
315
+ var freeParseInt = parseInt;
316
+ function toNumber(value) {
317
+ if (typeof value == "number") {
318
+ return value;
319
+ }
320
+ if (isSymbol(value)) {
321
+ return NAN;
322
+ }
323
+ if (isObject(value)) {
324
+ var other = typeof value.valueOf == "function" ? value.valueOf() : value;
325
+ value = isObject(other) ? other + "" : other;
326
+ }
327
+ if (typeof value != "string") {
328
+ return value === 0 ? value : +value;
329
+ }
330
+ value = baseTrim(value);
331
+ var isBinary = reIsBinary.test(value);
332
+ return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
333
+ }
334
+ module.exports = toNumber;
335
+ }
336
+ });
337
+
338
+ // ../../node_modules/lodash/debounce.js
339
+ var require_debounce = __commonJS({
340
+ "../../node_modules/lodash/debounce.js"(exports, module) {
341
+ "use strict";
342
+ var isObject = require_isObject();
343
+ var now = require_now();
344
+ var toNumber = require_toNumber();
345
+ var FUNC_ERROR_TEXT = "Expected a function";
346
+ var nativeMax = Math.max;
347
+ var nativeMin = Math.min;
348
+ function debounce(func, wait, options) {
349
+ var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
350
+ if (typeof func != "function") {
351
+ throw new TypeError(FUNC_ERROR_TEXT);
352
+ }
353
+ wait = toNumber(wait) || 0;
354
+ if (isObject(options)) {
355
+ leading = !!options.leading;
356
+ maxing = "maxWait" in options;
357
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
358
+ trailing = "trailing" in options ? !!options.trailing : trailing;
359
+ }
360
+ function invokeFunc(time) {
361
+ var args = lastArgs, thisArg = lastThis;
362
+ lastArgs = lastThis = void 0;
363
+ lastInvokeTime = time;
364
+ result = func.apply(thisArg, args);
365
+ return result;
366
+ }
367
+ function leadingEdge(time) {
368
+ lastInvokeTime = time;
369
+ timerId = setTimeout(timerExpired, wait);
370
+ return leading ? invokeFunc(time) : result;
371
+ }
372
+ function remainingWait(time) {
373
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
374
+ return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
375
+ }
376
+ function shouldInvoke(time) {
377
+ var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
378
+ return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
379
+ }
380
+ function timerExpired() {
381
+ var time = now();
382
+ if (shouldInvoke(time)) {
383
+ return trailingEdge(time);
384
+ }
385
+ timerId = setTimeout(timerExpired, remainingWait(time));
386
+ }
387
+ function trailingEdge(time) {
388
+ timerId = void 0;
389
+ if (trailing && lastArgs) {
390
+ return invokeFunc(time);
391
+ }
392
+ lastArgs = lastThis = void 0;
393
+ return result;
394
+ }
395
+ function cancel() {
396
+ if (timerId !== void 0) {
397
+ clearTimeout(timerId);
398
+ }
399
+ lastInvokeTime = 0;
400
+ lastArgs = lastCallTime = lastThis = timerId = void 0;
401
+ }
402
+ function flush() {
403
+ return timerId === void 0 ? result : trailingEdge(now());
404
+ }
405
+ function debounced() {
406
+ var time = now(), isInvoking = shouldInvoke(time);
407
+ lastArgs = arguments;
408
+ lastThis = this;
409
+ lastCallTime = time;
410
+ if (isInvoking) {
411
+ if (timerId === void 0) {
412
+ return leadingEdge(lastCallTime);
413
+ }
414
+ if (maxing) {
415
+ clearTimeout(timerId);
416
+ timerId = setTimeout(timerExpired, wait);
417
+ return invokeFunc(lastCallTime);
418
+ }
419
+ }
420
+ if (timerId === void 0) {
421
+ timerId = setTimeout(timerExpired, wait);
422
+ }
423
+ return result;
424
+ }
425
+ debounced.cancel = cancel;
426
+ debounced.flush = flush;
427
+ return debounced;
428
+ }
429
+ module.exports = debounce;
430
+ }
431
+ });
432
+
433
+ // ../../node_modules/lodash/throttle.js
434
+ var require_throttle = __commonJS({
435
+ "../../node_modules/lodash/throttle.js"(exports, module) {
436
+ "use strict";
437
+ var debounce = require_debounce();
438
+ var isObject = require_isObject();
439
+ var FUNC_ERROR_TEXT = "Expected a function";
440
+ function throttle(func, wait, options) {
441
+ var leading = true, trailing = true;
442
+ if (typeof func != "function") {
443
+ throw new TypeError(FUNC_ERROR_TEXT);
444
+ }
445
+ if (isObject(options)) {
446
+ leading = "leading" in options ? !!options.leading : leading;
447
+ trailing = "trailing" in options ? !!options.trailing : trailing;
448
+ }
449
+ return debounce(func, wait, {
450
+ "leading": leading,
451
+ "maxWait": wait,
452
+ "trailing": trailing
453
+ });
454
+ }
455
+ module.exports = throttle;
456
+ }
457
+ });
458
+
459
+ // ../../node_modules/@wix/monitoring-velo/build/index.cjs
460
+ var require_build2 = __commonJS({
461
+ "../../node_modules/@wix/monitoring-velo/build/index.cjs"(exports, module) {
462
+ "use strict";
463
+ var __create2 = Object.create;
464
+ var __defProp2 = Object.defineProperty;
465
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
466
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
467
+ var __getProtoOf2 = Object.getPrototypeOf;
468
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
469
+ var __export = (target, all) => {
470
+ for (var name in all)
471
+ __defProp2(target, name, { get: all[name], enumerable: true });
472
+ };
473
+ var __copyProps2 = (to, from, except, desc) => {
474
+ if (from && typeof from === "object" || typeof from === "function") {
475
+ for (let key of __getOwnPropNames2(from))
476
+ if (!__hasOwnProp2.call(to, key) && key !== except)
477
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
478
+ }
479
+ return to;
480
+ };
481
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
482
+ // If the importer is in node compatibility mode or this is not an ESM
483
+ // file that has been converted to a CommonJS file using a Babel-
484
+ // compatible transform (i.e. "__esModule" has not been set), then set
485
+ // "default" to the CommonJS "module.exports" for node compatibility.
486
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
487
+ mod
488
+ ));
489
+ var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
490
+ var index_exports = {};
491
+ __export(index_exports, {
492
+ createVeloMonitoringClient: () => createVeloMonitoringClient2
493
+ });
494
+ module.exports = __toCommonJS(index_exports);
495
+ var import_monitoring = require_build();
496
+ var generateId = () => {
497
+ return typeof crypto !== "undefined" && typeof crypto.randomUUID === "function" ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
498
+ const i = 16 * Math.random() | 0;
499
+ return ("x" === e ? i : 3 & i | 8).toString(16);
500
+ });
501
+ };
502
+ var buildMessagePayload = (params) => {
503
+ const { message, level = "INFO", timestamp = Date.now(), tags, req } = params;
504
+ let siteUrl = "";
505
+ if (req) {
506
+ try {
507
+ siteUrl = new URL(req.headers.get("referer") ?? "").origin;
508
+ } catch (e) {
509
+ }
510
+ } else if (typeof document !== "undefined") {
511
+ siteUrl = document.location.origin;
512
+ }
513
+ const sourceLocation = tags?.fileName && {
514
+ file: tags.fileName,
515
+ line: tags.lineNumber ?? 0,
516
+ column: tags.columnNumber ?? 0
517
+ };
518
+ return {
519
+ insertId: generateId(),
520
+ timestamp: new Date(timestamp).toISOString(),
521
+ severity: level.toUpperCase(),
522
+ labels: {
523
+ tenantId: "",
524
+ ...tags?.namespace ? { namespace: tags.namespace } : { namespace: "unknown" },
525
+ ...siteUrl ? { siteUrl } : {}
526
+ },
527
+ operation: {
528
+ id: generateId(),
529
+ ...tags?.producer ? { producer: tags.producer } : { producer: "unknown" }
530
+ },
531
+ ...sourceLocation ? { sourceLocation } : {},
532
+ jsonPayload: {
533
+ message
534
+ }
535
+ };
536
+ };
537
+ var report = (messages, authToken = "", fetch = globalThis.fetch) => {
538
+ fetch("https://www.wixapis.com/wixcode/v1/telemetry/telemetry-messages", {
539
+ method: "POST",
540
+ body: JSON.stringify({ messages }),
541
+ headers: {
542
+ Authorization: authToken
543
+ }
544
+ }).catch(() => {
545
+ });
546
+ };
547
+ var import_throttle = __toESM2(require_throttle(), 1);
548
+ var BatchQueue = class {
549
+ constructor(options) {
550
+ this.options = options;
551
+ this.queue = [];
552
+ this.flushThrottled = (0, import_throttle.default)(
553
+ () => this.flush(),
554
+ options.throttleDuration,
555
+ {
556
+ leading: false
557
+ }
558
+ );
559
+ }
560
+ flush() {
561
+ const events = this.queue.splice(0);
562
+ this.options.flushHandler(events);
563
+ }
564
+ enqueue(payload) {
565
+ this.queue.push(payload);
566
+ if (this.queue.length === this.options.maxBatchSize) {
567
+ this.flushThrottled.cancel();
568
+ this.flush();
569
+ } else {
570
+ this.flushThrottled();
571
+ }
572
+ }
573
+ };
574
+ var VeloClient = class {
575
+ constructor(options) {
576
+ this.options = options;
577
+ this.captureException = (error, captureContext) => {
578
+ };
579
+ this.captureMessage = (message, captureContext = {}) => {
580
+ const { level = "info", tags } = captureContext;
581
+ const messagePayload = buildMessagePayload({
582
+ message,
583
+ level,
584
+ tags,
585
+ req: this.options.req
586
+ });
587
+ this.batchQueue.enqueue(messagePayload);
588
+ };
589
+ this.startSpan = (spanOptions, callback) => {
590
+ return null;
591
+ };
592
+ this.addBreadcrumb = (breadcrumb) => {
593
+ };
594
+ const { getAuthToken, fetch } = options;
595
+ this.batchQueue = new BatchQueue({
596
+ maxBatchSize: 100,
597
+ throttleDuration: 300,
598
+ flushHandler: (messages) => report(messages, getAuthToken(), fetch)
599
+ });
600
+ }
601
+ startSpanManual(spanOptions) {
602
+ return {
603
+ end: () => {
604
+ },
605
+ fail: (error) => {
606
+ }
607
+ };
608
+ }
609
+ endSpanManual(spanOptions) {
610
+ }
611
+ };
612
+ var createVeloMonitoringClient2 = (options) => {
613
+ const { getAuthToken } = options;
614
+ if (!getAuthToken) {
615
+ return (0, import_monitoring.createFallbackMonitoringClient)("Missing getAuthToken");
616
+ }
617
+ return new VeloClient(options);
618
+ };
619
+ }
620
+ });
621
+
1
622
  // src/client-context/setup.ts
2
- import { wixContext } from "@wix/sdk-context";
623
+ import { wixContext as wixContext2 } from "@wix/sdk-context";
624
+
625
+ // ../../node_modules/@wix/headless-site/dist/esm/host-module.js
626
+ var import_monitoring_velo = __toESM(require_build2());
3
627
 
4
628
  // ../../node_modules/@wix/headless-site/dist/esm/headers/common-config-header.js
5
629
  var COMMON_CONFIG_HEADER_NAME = "commonConfig";
@@ -46,6 +670,99 @@ var getPassThroughHeaders = () => {
46
670
  }, {});
47
671
  };
48
672
 
673
+ // ../../node_modules/@wix/sdk-runtime/build/context.js
674
+ import { wixContext } from "@wix/sdk-context";
675
+ function resolveContext() {
676
+ const oldContext = typeof $wixContext !== "undefined" && $wixContext.initWixModules ? $wixContext.initWixModules : typeof globalThis.__wix_context__ !== "undefined" && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
677
+ if (oldContext) {
678
+ return {
679
+ // @ts-expect-error
680
+ initWixModules(modules, elevated) {
681
+ return runWithoutContext(() => oldContext(modules, elevated));
682
+ },
683
+ fetchWithAuth() {
684
+ throw new Error("fetchWithAuth is not available in this context");
685
+ },
686
+ graphql() {
687
+ throw new Error("graphql is not available in this context");
688
+ }
689
+ };
690
+ }
691
+ const contextualClient = typeof $wixContext !== "undefined" ? $wixContext.client : typeof wixContext.client !== "undefined" ? wixContext.client : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.client : void 0;
692
+ const elevatedClient = typeof $wixContext !== "undefined" ? $wixContext.elevatedClient : typeof wixContext.elevatedClient !== "undefined" ? wixContext.elevatedClient : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.elevatedClient : void 0;
693
+ if (!contextualClient && !elevatedClient) {
694
+ return;
695
+ }
696
+ return {
697
+ initWixModules(wixModules, elevated) {
698
+ if (elevated) {
699
+ if (!elevatedClient) {
700
+ throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");
701
+ }
702
+ return runWithoutContext(() => elevatedClient.use(wixModules));
703
+ }
704
+ if (!contextualClient) {
705
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
706
+ }
707
+ return runWithoutContext(() => contextualClient.use(wixModules));
708
+ },
709
+ fetchWithAuth: (urlOrRequest, requestInit) => {
710
+ if (!contextualClient) {
711
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
712
+ }
713
+ return contextualClient.fetchWithAuth(urlOrRequest, requestInit);
714
+ },
715
+ getAuth() {
716
+ if (!contextualClient) {
717
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
718
+ }
719
+ return contextualClient.auth;
720
+ },
721
+ async graphql(query, variables, opts) {
722
+ if (!contextualClient) {
723
+ throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
724
+ }
725
+ return contextualClient.graphql(query, variables, opts);
726
+ }
727
+ };
728
+ }
729
+ function runWithoutContext(fn) {
730
+ const globalContext = globalThis.__wix_context__;
731
+ const moduleContext = {
732
+ client: wixContext.client,
733
+ elevatedClient: wixContext.elevatedClient
734
+ };
735
+ let closureContext;
736
+ globalThis.__wix_context__ = void 0;
737
+ wixContext.client = void 0;
738
+ wixContext.elevatedClient = void 0;
739
+ if (typeof $wixContext !== "undefined") {
740
+ closureContext = {
741
+ client: $wixContext?.client,
742
+ elevatedClient: $wixContext?.elevatedClient
743
+ };
744
+ delete $wixContext.client;
745
+ delete $wixContext.elevatedClient;
746
+ }
747
+ try {
748
+ return fn();
749
+ } finally {
750
+ globalThis.__wix_context__ = globalContext;
751
+ wixContext.client = moduleContext.client;
752
+ wixContext.elevatedClient = moduleContext.elevatedClient;
753
+ if (typeof $wixContext !== "undefined") {
754
+ $wixContext.client = closureContext.client;
755
+ $wixContext.elevatedClient = closureContext.elevatedClient;
756
+ }
757
+ }
758
+ }
759
+
760
+ // ../../node_modules/@wix/headless-site/dist/esm/utils/auth-utils.js
761
+ var resolveAuthToken = () => {
762
+ var _resolveContext;
763
+ return (_resolveContext = resolveContext()) == null ? void 0 : _resolveContext.getAuth().getTokens().accessToken.value;
764
+ };
765
+
49
766
  // ../../node_modules/@wix/headless-site/dist/esm/host-module.js
50
767
  var createHostModule = () => {
51
768
  return {
@@ -59,7 +776,10 @@ var createHostModule = () => {
59
776
  get passThroughHeaders() {
60
777
  return getPassThroughHeaders();
61
778
  }
62
- }
779
+ },
780
+ getMonitoringClient: () => (0, import_monitoring_velo.createVeloMonitoringClient)({
781
+ getAuthToken: () => resolveAuthToken()
782
+ })
63
783
  };
64
784
  }
65
785
  };
@@ -117,7 +837,7 @@ function isCookieValue(value) {
117
837
 
118
838
  // src/client-context/setup.ts
119
839
  function setup(options) {
120
- if (wixContext.client != null) {
840
+ if (wixContext2.client != null) {
121
841
  return;
122
842
  }
123
843
  if (!location.pathname.startsWith("/_wix/extensions/backoffice")) {