@wix/bookings 1.0.1750 → 1.0.1752
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/_sdk-exports/{context-booking-checkout-context → context-booking-checkout}/runtime.d.ts +10 -0
- package/_sdk-exports/context-booking-checkout/runtime.js +2 -0
- package/_sdk-exports/context-categories/runtime.js +1 -0
- package/_sdk-exports/context-locations/runtime.js +1 -0
- package/_sdk-exports/{context-service-context → context-service}/runtime.d.ts +1 -1
- package/_sdk-exports/{context-service-context → context-service}/runtime.js +2 -2
- package/_sdk-exports/context-service-addons/runtime.js +1 -0
- package/_sdk-exports/context-services/runtime.js +2 -0
- package/_sdk-exports/context-time-slots/runtime.js +2 -0
- package/build/{internal/es/context-booking-checkout-context.d.mts → cjs/context-booking-checkout.d.ts} +10 -0
- package/build/cjs/{context-booking-checkout-context.js → context-booking-checkout.js} +909 -925
- package/build/cjs/context-booking-checkout.js.map +1 -0
- package/build/cjs/{context-categories-context.js → context-categories.js} +287 -293
- package/build/cjs/context-categories.js.map +1 -0
- package/build/cjs/{context-locations-context.js → context-locations.js} +362 -368
- package/build/cjs/context-locations.js.map +1 -0
- package/build/cjs/{context-service-addons-context.js → context-service-addons.js} +424 -430
- package/build/cjs/context-service-addons.js.map +1 -0
- package/build/cjs/{context-service-context.d.ts → context-service.d.ts} +1 -1
- package/build/cjs/{context-service-context.js → context-service.js} +964 -977
- package/build/cjs/context-service.js.map +1 -0
- package/build/cjs/{context-services-context.js → context-services.js} +600 -611
- package/build/cjs/context-services.js.map +1 -0
- package/build/cjs/{context-time-slots-context.js → context-time-slots.js} +1187 -1195
- package/build/cjs/context-time-slots.js.map +1 -0
- package/build/{cjs/context-booking-checkout-context.d.ts → es/context-booking-checkout.d.mts} +10 -0
- package/build/es/{context-booking-checkout-context.mjs → context-booking-checkout.mjs} +906 -922
- package/build/es/context-booking-checkout.mjs.map +1 -0
- package/build/es/{context-categories-context.mjs → context-categories.mjs} +283 -289
- package/build/es/context-categories.mjs.map +1 -0
- package/build/es/{context-locations-context.mjs → context-locations.mjs} +358 -364
- package/build/es/context-locations.mjs.map +1 -0
- package/build/es/{context-service-addons-context.mjs → context-service-addons.mjs} +417 -423
- package/build/es/context-service-addons.mjs.map +1 -0
- package/build/{internal/cjs/context-service-context.d.ts → es/context-service.d.mts} +1 -1
- package/build/es/{context-service-context.mjs → context-service.mjs} +960 -973
- package/build/es/context-service.mjs.map +1 -0
- package/build/es/{context-services-context.mjs → context-services.mjs} +596 -607
- package/build/es/context-services.mjs.map +1 -0
- package/build/es/{context-time-slots-context.mjs → context-time-slots.mjs} +1181 -1189
- package/build/es/context-time-slots.mjs.map +1 -0
- package/build/internal/cjs/{context-booking-checkout-context.d.ts → context-booking-checkout.d.ts} +10 -0
- package/build/internal/{es/context-service-context.d.mts → cjs/context-service.d.ts} +1 -1
- package/build/{es/context-booking-checkout-context.d.mts → internal/es/context-booking-checkout.d.mts} +10 -0
- package/build/{es/context-service-context.d.mts → internal/es/context-service.d.mts} +1 -1
- package/context/booking-checkout/package.json +3 -0
- package/context/categories/package.json +3 -0
- package/context/locations/package.json +3 -0
- package/context/service/package.json +3 -0
- package/context/service-addons/package.json +3 -0
- package/context/services/package.json +3 -0
- package/context/time-slots/package.json +3 -0
- package/package.json +37 -37
- package/_sdk-exports/context-booking-checkout-context/runtime.js +0 -2
- package/_sdk-exports/context-categories-context/runtime.js +0 -1
- package/_sdk-exports/context-locations-context/runtime.js +0 -1
- package/_sdk-exports/context-service-addons-context/runtime.js +0 -1
- package/_sdk-exports/context-services-context/runtime.js +0 -2
- package/_sdk-exports/context-time-slots-context/runtime.js +0 -2
- package/build/cjs/context-booking-checkout-context.js.map +0 -1
- package/build/cjs/context-categories-context.js.map +0 -1
- package/build/cjs/context-locations-context.js.map +0 -1
- package/build/cjs/context-service-addons-context.js.map +0 -1
- package/build/cjs/context-service-context.js.map +0 -1
- package/build/cjs/context-services-context.js.map +0 -1
- package/build/cjs/context-time-slots-context.js.map +0 -1
- package/build/es/context-booking-checkout-context.mjs.map +0 -1
- package/build/es/context-categories-context.mjs.map +0 -1
- package/build/es/context-locations-context.mjs.map +0 -1
- package/build/es/context-service-addons-context.mjs.map +0 -1
- package/build/es/context-service-context.mjs.map +0 -1
- package/build/es/context-services-context.mjs.map +0 -1
- package/build/es/context-time-slots-context.mjs.map +0 -1
- package/context/booking-checkout-context/package.json +0 -3
- package/context/categories-context/package.json +0 -3
- package/context/locations-context/package.json +0 -3
- package/context/service-addons-context/package.json +0 -3
- package/context/service-context/package.json +0 -3
- package/context/services-context/package.json +0 -3
- package/context/time-slots-context/package.json +0 -3
- /package/_sdk-exports/{context-categories-context → context-categories}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-locations-context → context-locations}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-service-addons-context → context-service-addons}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-services-context → context-services}/runtime.d.ts +0 -0
- /package/_sdk-exports/{context-time-slots-context → context-time-slots}/runtime.d.ts +0 -0
- /package/build/cjs/{context-categories-context.d.ts → context-categories.d.ts} +0 -0
- /package/build/cjs/{context-locations-context.d.ts → context-locations.d.ts} +0 -0
- /package/build/cjs/{context-service-addons-context.d.ts → context-service-addons.d.ts} +0 -0
- /package/build/cjs/{context-services-context.d.ts → context-services.d.ts} +0 -0
- /package/build/cjs/{context-time-slots-context.d.ts → context-time-slots.d.ts} +0 -0
- /package/build/es/{context-categories-context.d.mts → context-categories.d.mts} +0 -0
- /package/build/es/{context-locations-context.d.mts → context-locations.d.mts} +0 -0
- /package/build/es/{context-service-addons-context.d.mts → context-service-addons.d.mts} +0 -0
- /package/build/es/{context-services-context.d.mts → context-services.d.mts} +0 -0
- /package/build/es/{context-time-slots-context.d.mts → context-time-slots.d.mts} +0 -0
- /package/build/internal/cjs/{context-categories-context.d.ts → context-categories.d.ts} +0 -0
- /package/build/internal/cjs/{context-locations-context.d.ts → context-locations.d.ts} +0 -0
- /package/build/internal/cjs/{context-service-addons-context.d.ts → context-service-addons.d.ts} +0 -0
- /package/build/internal/cjs/{context-services-context.d.ts → context-services.d.ts} +0 -0
- /package/build/internal/cjs/{context-time-slots-context.d.ts → context-time-slots.d.ts} +0 -0
- /package/build/internal/es/{context-categories-context.d.mts → context-categories.d.mts} +0 -0
- /package/build/internal/es/{context-locations-context.d.mts → context-locations.d.mts} +0 -0
- /package/build/internal/es/{context-service-addons-context.d.mts → context-service-addons.d.mts} +0 -0
- /package/build/internal/es/{context-services-context.d.mts → context-services.d.mts} +0 -0
- /package/build/internal/es/{context-time-slots-context.d.mts → context-time-slots.d.mts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// _sdk-exports/context-service-addons
|
|
1
|
+
// _sdk-exports/context-service-addons/runtime.js
|
|
2
2
|
import { Component as e, Suspense as t, createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useSyncExternalStore as c } from "react";
|
|
3
|
-
import { useServiceContext as l } from "@wix/bookings/context/service
|
|
3
|
+
import { useServiceContext as l } from "@wix/bookings/context/service";
|
|
4
4
|
import { useGetService as u, useService as d } from "@wix/services-manager-react";
|
|
5
5
|
import { jsx as f } from "react/jsx-runtime";
|
|
6
6
|
var p = {};
|
|
@@ -53,8 +53,8 @@ var g = (e2) => (t2) => async (n2) => {
|
|
|
53
53
|
};
|
|
54
54
|
var _ = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
|
|
55
55
|
var v = `__metadata`;
|
|
56
|
-
var
|
|
57
|
-
var
|
|
56
|
+
var ee = `edge.wixapis.com`;
|
|
57
|
+
var te = class extends Error {
|
|
58
58
|
message;
|
|
59
59
|
response;
|
|
60
60
|
constructor(e2, t2) {
|
|
@@ -62,24 +62,24 @@ var ee = class extends Error {
|
|
|
62
62
|
}
|
|
63
63
|
async details() {
|
|
64
64
|
let e2 = await this.response.json();
|
|
65
|
-
return
|
|
65
|
+
return ne(this.response.status, e2?.message, e2?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e2 });
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var
|
|
72
|
-
function
|
|
68
|
+
var ne = (e2, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
69
|
+
var re = (e2) => e2?.method && [`post`, `put`, `patch`].includes(e2.method.toLocaleLowerCase()) && e2.body ? { "Content-Type": `application/json` } : {};
|
|
70
|
+
var ie = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
|
|
71
|
+
var ae = (e2) => e2.__type === `host`;
|
|
72
|
+
function oe(e2, t2) {
|
|
73
73
|
return e2.create(t2);
|
|
74
74
|
}
|
|
75
|
-
var
|
|
76
|
-
function
|
|
77
|
-
return { [
|
|
75
|
+
var se = `x-wix-bi-gateway`;
|
|
76
|
+
function ce(e2, t2, n2) {
|
|
77
|
+
return { [se]: le({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function le(e2) {
|
|
80
80
|
return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function ue(e2) {
|
|
83
83
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
84
84
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
85
85
|
try {
|
|
@@ -88,82 +88,82 @@ function le(e2) {
|
|
|
88
88
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
var
|
|
92
|
-
function
|
|
93
|
-
return
|
|
91
|
+
var de = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
92
|
+
function y(e2) {
|
|
93
|
+
return ge(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
94
94
|
}
|
|
95
|
-
var
|
|
96
|
-
var
|
|
97
|
-
var
|
|
98
|
-
var
|
|
99
|
-
function
|
|
95
|
+
var fe = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
96
|
+
var pe = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
97
|
+
var me = `$1\0$2`;
|
|
98
|
+
var he = /[^\p{L}\d]+/giu;
|
|
99
|
+
function ge(e2) {
|
|
100
100
|
let t2 = e2.trim();
|
|
101
|
-
t2 = t2.replace(
|
|
101
|
+
t2 = t2.replace(fe, me).replace(pe, me), t2 = t2.replace(he, `\0`);
|
|
102
102
|
let n2 = 0, r2 = t2.length;
|
|
103
103
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
104
104
|
if (n2 === r2) return [];
|
|
105
105
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
106
106
|
return t2.slice(n2, r2).split(/\0/g);
|
|
107
107
|
}
|
|
108
|
-
var
|
|
109
|
-
var
|
|
110
|
-
var
|
|
111
|
-
function
|
|
108
|
+
var _e = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
109
|
+
var ve = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
110
|
+
var ye = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
111
|
+
function be(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
112
112
|
if (typeof e2 != `object` || !e2) throw e2;
|
|
113
|
-
if (
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
116
|
-
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code:
|
|
117
|
-
return
|
|
113
|
+
if (_e(e2)) return xe(e2, t2, n2);
|
|
114
|
+
if (ve(e2)) return Se(e2);
|
|
115
|
+
if (ye(e2)) {
|
|
116
|
+
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: y(n3), data: {} }, requestId: e2.requestId };
|
|
117
|
+
return b(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
118
118
|
}
|
|
119
|
-
return
|
|
119
|
+
return Ce(e2);
|
|
120
120
|
}
|
|
121
|
-
var
|
|
122
|
-
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 =
|
|
123
|
-
return
|
|
121
|
+
var xe = (e2, t2, n2) => {
|
|
122
|
+
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = we(t2, a2, n2)?.sort((e3, t3) => e3.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e3, description: t3 }) => `"${e3}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
123
|
+
return b(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
124
124
|
};
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ??
|
|
128
|
-
return
|
|
125
|
+
var b = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
126
|
+
var Se = (e2) => {
|
|
127
|
+
let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ?? y(n2), o2 = e2.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e2.requestId };
|
|
128
|
+
return b(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
129
129
|
};
|
|
130
|
-
var
|
|
131
|
-
var
|
|
130
|
+
var Ce = (e2) => b(e2, { message: e2.requestId ? `System error occurred, request-id: ${e2.requestId}` : `System error occurred: ${JSON.stringify(e2)}`, extraProperties: { requestId: e2.requestId, status: e2.response?.status, code: y(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
|
|
131
|
+
var we = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
132
132
|
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
133
133
|
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
134
134
|
let r3 = t2[e3.field];
|
|
135
|
-
if (r3) return { ...e3, field:
|
|
135
|
+
if (r3) return { ...e3, field: x(r3, i2) };
|
|
136
136
|
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
137
137
|
if (s2) {
|
|
138
138
|
let t3 = a2[s2];
|
|
139
|
-
if (t3) return { ...e3, field: e3.field.replace(s2,
|
|
139
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, x(t3, i2)) };
|
|
140
140
|
}
|
|
141
141
|
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
142
142
|
});
|
|
143
143
|
};
|
|
144
|
-
var
|
|
145
|
-
let n2 =
|
|
144
|
+
var x = (e2, t2) => {
|
|
145
|
+
let n2 = Te(e2);
|
|
146
146
|
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
147
147
|
};
|
|
148
|
-
var
|
|
148
|
+
var Te = (e2) => {
|
|
149
149
|
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
150
150
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
151
151
|
};
|
|
152
|
-
function
|
|
153
|
-
return
|
|
152
|
+
function Ee(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
153
|
+
return ue(() => e2({ request: async (e3) => {
|
|
154
154
|
let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
155
155
|
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
156
|
-
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ?
|
|
156
|
+
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? ee : o3}${a3.url}`;
|
|
157
157
|
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
158
158
|
try {
|
|
159
|
-
let e4 =
|
|
159
|
+
let e4 = ce(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
|
|
160
160
|
if (s3.status !== 200) {
|
|
161
161
|
let e5 = null;
|
|
162
162
|
try {
|
|
163
163
|
e5 = await s3.json();
|
|
164
164
|
} catch {
|
|
165
165
|
}
|
|
166
|
-
let t3 =
|
|
166
|
+
let t3 = Oe(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = be(t3);
|
|
167
167
|
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
168
168
|
}
|
|
169
169
|
let l3 = await s3.json();
|
|
@@ -173,18 +173,18 @@ function Te(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
|
173
173
|
}
|
|
174
174
|
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
175
175
|
}
|
|
176
|
-
var
|
|
176
|
+
var De = class extends Error {
|
|
177
177
|
response;
|
|
178
178
|
requestId;
|
|
179
179
|
constructor(e2) {
|
|
180
180
|
super(), this.response = e2.response, this.requestId = e2.requestId;
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
var
|
|
184
|
-
var
|
|
185
|
-
function
|
|
183
|
+
var Oe = (e2, t2, n2, r2) => new De({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2 }, status: e2 }, requestId: r2?.requestId });
|
|
184
|
+
var ke = `.`;
|
|
185
|
+
function Ae(e2, t2, n2) {
|
|
186
186
|
if (e2 == null) throw Error(`Cannot set value on null or undefined`);
|
|
187
|
-
let r2 =
|
|
187
|
+
let r2 = S(t2), i2 = e2;
|
|
188
188
|
for (let e3 = 0; e3 < r2.length; e3++) {
|
|
189
189
|
let t3 = r2[e3];
|
|
190
190
|
if (e3 === r2.length - 1) {
|
|
@@ -196,21 +196,21 @@ function ke(e2, t2, n2) {
|
|
|
196
196
|
}
|
|
197
197
|
return e2;
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
return Array.isArray(e2) ? e2 : e2.split(
|
|
199
|
+
function S(e2) {
|
|
200
|
+
return Array.isArray(e2) ? e2 : e2.split(ke).map((e3) => je(e3) ? Number(e3) : e3);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
202
|
+
function je(e2) {
|
|
203
203
|
return /^\d+$/.test(e2);
|
|
204
204
|
}
|
|
205
|
-
function
|
|
205
|
+
function Me(e2) {
|
|
206
206
|
let t2 = {};
|
|
207
|
-
for (let [n2, r2] of Object.entries(e2))
|
|
207
|
+
for (let [n2, r2] of Object.entries(e2)) Ne(n2) || Ae(t2, S(n2), r2);
|
|
208
208
|
return t2;
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function Ne(e2) {
|
|
211
211
|
return e2 === `__proto__` || e2 === `constructor` || e2 === `prototype`;
|
|
212
212
|
}
|
|
213
|
-
var
|
|
213
|
+
var Pe = class {
|
|
214
214
|
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
215
215
|
NUMERIC_PATTERN = /^\d+$/;
|
|
216
216
|
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
@@ -233,7 +233,7 @@ var Ne = class {
|
|
|
233
233
|
return e2.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
234
234
|
}
|
|
235
235
|
unflatten() {
|
|
236
|
-
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])),
|
|
236
|
+
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])), Me(this.cleanedModifiedFields);
|
|
237
237
|
}
|
|
238
238
|
flatten(e2) {
|
|
239
239
|
let t2 = {};
|
|
@@ -253,12 +253,12 @@ var Ne = class {
|
|
|
253
253
|
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
254
254
|
r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
|
|
255
255
|
}, a2 = (e3, t3) => {
|
|
256
|
-
let i3 = e3 in
|
|
256
|
+
let i3 = e3 in de ? de[e3] : void 0;
|
|
257
257
|
if (i3 && i3 in t3) {
|
|
258
258
|
r2.push(i3), n2 = t3[i3];
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
|
-
let a3 =
|
|
261
|
+
let a3 = Re(e3);
|
|
262
262
|
if (a3 && a3 in t3) {
|
|
263
263
|
r2.push(a3), n2 = t3[a3];
|
|
264
264
|
return;
|
|
@@ -289,28 +289,28 @@ var Ne = class {
|
|
|
289
289
|
return e2.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e2[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
290
290
|
}
|
|
291
291
|
};
|
|
292
|
-
function
|
|
292
|
+
function Fe(e2, t2) {
|
|
293
293
|
let n2 = e2?.modifiedFields;
|
|
294
294
|
if (!n2) return null;
|
|
295
|
-
let r2 =
|
|
295
|
+
let r2 = Ie(n2);
|
|
296
296
|
if (!r2) return null;
|
|
297
297
|
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
298
298
|
e2 = { ...e2, modifiedFields: i2 };
|
|
299
299
|
let o2 = t2(e2), s2 = o2?.modifiedFields;
|
|
300
300
|
if (!s2) return null;
|
|
301
|
-
let c2 =
|
|
301
|
+
let c2 = Le(s2, a2);
|
|
302
302
|
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function Ie(e2) {
|
|
305
305
|
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
306
|
-
let t2 = new
|
|
306
|
+
let t2 = new Pe(e2);
|
|
307
307
|
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
308
308
|
} catch {
|
|
309
309
|
return null;
|
|
310
310
|
}
|
|
311
311
|
return null;
|
|
312
312
|
}
|
|
313
|
-
function
|
|
313
|
+
function Le(e2, t2) {
|
|
314
314
|
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
315
315
|
return t2.flatten(e2);
|
|
316
316
|
} catch {
|
|
@@ -318,10 +318,10 @@ function Ie(e2, t2) {
|
|
|
318
318
|
}
|
|
319
319
|
return null;
|
|
320
320
|
}
|
|
321
|
-
function
|
|
321
|
+
function Re(e2) {
|
|
322
322
|
return e2.replace(/[-_\s]+(.)?/g, (e3, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e3) => e3.toLowerCase());
|
|
323
323
|
}
|
|
324
|
-
function
|
|
324
|
+
function C() {
|
|
325
325
|
return { emit(e2, ...t2) {
|
|
326
326
|
for (let n2 = 0, r2 = this.events[e2] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
327
327
|
}, events: {}, on(e2, t2) {
|
|
@@ -330,8 +330,8 @@ function w() {
|
|
|
330
330
|
};
|
|
331
331
|
} };
|
|
332
332
|
}
|
|
333
|
-
var
|
|
334
|
-
function
|
|
333
|
+
var ze = (e2) => e2.__type === `event-definition`;
|
|
334
|
+
function w(e2, t2, n2, r2) {
|
|
335
335
|
let i2;
|
|
336
336
|
if (e2.isDomainEvent) {
|
|
337
337
|
let { deletedEvent: e3, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
@@ -342,14 +342,14 @@ function T(e2, t2, n2, r2) {
|
|
|
342
342
|
let e3 = s2.modifiedFields;
|
|
343
343
|
if (typeof e3 == `object` && e3 && !Array.isArray(e3)) {
|
|
344
344
|
o2 = structuredClone(i2);
|
|
345
|
-
let e4 =
|
|
345
|
+
let e4 = Fe(s2, a2);
|
|
346
346
|
if (e4) return t2(e4);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
return t2(a2(o2));
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
351
|
+
function Be(e2) {
|
|
352
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = C();
|
|
353
353
|
return { initModule(e3) {
|
|
354
354
|
return (r2) => {
|
|
355
355
|
let i2 = t2.get(e3.type) ?? [];
|
|
@@ -359,7 +359,7 @@ function ze(e2) {
|
|
|
359
359
|
let { eventType: r2, identity: i2, instanceId: a2, payload: o2, accountInfo: s2 } = await this.parseJWT(e3), c2 = [...n3.expectedEvents, ...Array.from(t2.keys()).map((e4) => ({ type: e4 }))];
|
|
360
360
|
if (c2.length > 0 && !c2.some(({ type: e4 }) => e4 === r2)) throw Error(`Unexpected event type: ${r2}. Expected one of: ${c2.map((e4) => e4.type).join(`, `)}`);
|
|
361
361
|
let l2 = t2.get(r2) ?? [];
|
|
362
|
-
return await Promise.all(l2.map(({ eventDefinition: e4, handler: t3 }) =>
|
|
362
|
+
return await Promise.all(l2.map(({ eventDefinition: e4, handler: t3 }) => w(e4, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
|
|
363
363
|
}, async processRequest(e3, t3) {
|
|
364
364
|
let n3 = await e3.text();
|
|
365
365
|
return this.process(n3, t3);
|
|
@@ -378,12 +378,12 @@ function ze(e2) {
|
|
|
378
378
|
let n3 = Array.from(t2.keys()).map((e4) => ({ type: e4 }));
|
|
379
379
|
if (n3.length > 0 && !n3.some(({ type: t3 }) => t3 === e3.eventType)) throw Error(`Unexpected event type: ${e3.eventType}. Expected one of: ${n3.map((e4) => e4.type).join(`, `)}`);
|
|
380
380
|
let r2 = t2.get(e3.eventType) ?? [];
|
|
381
|
-
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) =>
|
|
381
|
+
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => w(t3, n4, e3.payload, { instanceId: e3.instanceId, identity: e3.identity })));
|
|
382
382
|
}, apps: { AppInstalled: m(`AppInstalled`)(), AppRemoved: m(`AppRemoved`)() } } };
|
|
383
383
|
}
|
|
384
|
-
var
|
|
385
|
-
function
|
|
386
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
384
|
+
var Ve = (e2) => e2.__type === `service-plugin-definition`;
|
|
385
|
+
function He(e2) {
|
|
386
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = C();
|
|
387
387
|
return { initModule(e3) {
|
|
388
388
|
return (r2) => {
|
|
389
389
|
let i2 = t2.get(e3.componentType.toLowerCase()) ?? [];
|
|
@@ -424,43 +424,43 @@ function Ve(e2) {
|
|
|
424
424
|
return s2.transformations.toREST(await c2(s2.transformations.fromREST(e3)));
|
|
425
425
|
} } };
|
|
426
426
|
}
|
|
427
|
-
var
|
|
428
|
-
function
|
|
427
|
+
var T = `X-Wix-Consistent`;
|
|
428
|
+
function Ue(e2) {
|
|
429
429
|
let t2 = e2.headers || { Authorization: `` }, n2 = { getAuthHeaders: (e3) => Promise.resolve({ headers: {} }) }, r2 = e2.auth, i2 = typeof r2 == `function` ? r2 : () => r2 ?? n2, a2 = () => i2().getAuthHeaders(e2.host), o2 = () => e2.fetch ?? fetch, s2 = async (n3, r3) => {
|
|
430
|
-
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [
|
|
430
|
+
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [T]: t2[T] } : {} }, l3 = e2.host?.getErrorHandler?.();
|
|
431
431
|
try {
|
|
432
432
|
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
433
433
|
let e3 = await i3(n3, { ...r3, headers: c3 });
|
|
434
434
|
l3?.handleError(e3, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
435
|
-
let a3 =
|
|
436
|
-
return a3 && (t2[
|
|
435
|
+
let a3 = E(e3);
|
|
436
|
+
return a3 && (t2[T] = a3), e3;
|
|
437
437
|
}
|
|
438
438
|
{
|
|
439
439
|
for (let [e4, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e4, t3);
|
|
440
440
|
let e3 = await i3(n3, r3);
|
|
441
441
|
l3?.handleError(e3, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
442
|
-
let a3 =
|
|
443
|
-
return a3 && (t2[
|
|
442
|
+
let a3 = E(e3);
|
|
443
|
+
return a3 && (t2[T] = a3), e3;
|
|
444
444
|
}
|
|
445
445
|
} catch (e3) {
|
|
446
446
|
throw l3?.handleError(e3, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e3;
|
|
447
447
|
}
|
|
448
|
-
}, { client: c2, initModule: l2 } =
|
|
449
|
-
let i3 = o2(), s3 = await a2(), c3 =
|
|
450
|
-
return u3 && (t2[
|
|
448
|
+
}, { client: c2, initModule: l2 } = He(i2), { client: u2, initModule: d2 } = Be(i2), f2 = async (n3, r3) => {
|
|
449
|
+
let i3 = o2(), s3 = await a2(), c3 = re(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [T]: t2[T] } : {} } }), u3 = E(l3);
|
|
450
|
+
return u3 && (t2[T] = u3), l3;
|
|
451
451
|
}, m2 = (t3, n3) => {
|
|
452
|
-
if (
|
|
453
|
-
if (
|
|
454
|
-
if (
|
|
452
|
+
if (ze(t3)) return d2(t3);
|
|
453
|
+
if (Ve(t3)) return l2(t3);
|
|
454
|
+
if (ae(t3) && e2.host) return oe(t3, e2.host);
|
|
455
455
|
if (typeof t3 == `function`) {
|
|
456
456
|
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
457
457
|
let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
|
|
458
|
-
return
|
|
458
|
+
return Ee(ue(() => _(t3)) ? g(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
|
|
459
459
|
let n4 = new URL(e3, `https://${r3}`);
|
|
460
460
|
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
461
461
|
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
|
|
462
462
|
}
|
|
463
|
-
return
|
|
463
|
+
return ie(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, m2(n4, t3[v])])) : t3;
|
|
464
464
|
}, h2 = (e3) => {
|
|
465
465
|
for (let n3 in e3) t2[n3] = e3[n3];
|
|
466
466
|
};
|
|
@@ -474,24 +474,24 @@ function He(e2) {
|
|
|
474
474
|
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
475
475
|
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
476
476
|
let i3 = e2?.host?.apiBaseUrl ?? `www.wixapis.com`, a3 = await f2(`https://${i3}/graphql/${r3.apiVersion}`, { method: `POST`, headers: { "Content-Type": `application/json` }, body: JSON.stringify({ query: t3, variables: n3 }) });
|
|
477
|
-
if (a3.status !== 200) throw new
|
|
477
|
+
if (a3.status !== 200) throw new te(`GraphQL request failed with status ${a3.status}`, a3);
|
|
478
478
|
let { data: o3, errors: s3 } = await a3.json();
|
|
479
479
|
return { data: o3 ?? {}, errors: s3 };
|
|
480
480
|
}, webhooks: u2, servicePlugins: c2 };
|
|
481
481
|
}
|
|
482
|
-
function
|
|
482
|
+
function E(e2) {
|
|
483
483
|
return e2.headers?.get(`X-Wix-Consistent`) ?? e2.headers?.get(`x-wix-consistent`);
|
|
484
484
|
}
|
|
485
|
-
var
|
|
486
|
-
var
|
|
487
|
-
function
|
|
485
|
+
var We = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
486
|
+
var Ge = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
487
|
+
function Ke(e2, t2) {
|
|
488
488
|
return e2?.split(`.`).map((e3) => t2?.[e3] ?? e3).join(`.`);
|
|
489
489
|
}
|
|
490
|
-
var
|
|
490
|
+
var D = `sort.fieldName`;
|
|
491
491
|
function qe(e2, t2, n2) {
|
|
492
|
-
return (e2 ===
|
|
492
|
+
return (e2 === D || e2.endsWith(`.${D}`)) && typeof t2 == `string` ? Ke(t2, n2) : t2;
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function O(e2, t2, n2) {
|
|
495
495
|
let r2 = (e3) => n2.includes(e3), i2 = (e3, n3) => {
|
|
496
496
|
if (Array.isArray(e3)) e3.forEach((e4) => {
|
|
497
497
|
i2(e4, n3);
|
|
@@ -501,144 +501,144 @@ function Je(e2, t2, n2) {
|
|
|
501
501
|
Object.keys(a2).forEach((e4) => {
|
|
502
502
|
let o2 = n3 === `` ? e4 : `${n3}.${e4}`;
|
|
503
503
|
if (r2(o2)) return;
|
|
504
|
-
let s2 =
|
|
504
|
+
let s2 = Je(e4, t2);
|
|
505
505
|
s2 !== e4 && !(s2 in a2) && (a2[s2] = a2[e4], delete a2[e4]), a2[s2] = qe(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
508
|
};
|
|
509
509
|
return i2(e2, ``), e2;
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function Je(e2, t2) {
|
|
512
512
|
let n2;
|
|
513
513
|
return n2 = e2.includes(`.`) ? e2.split(`.`).map((e3) => t2[e3] ?? e3).join(`.`) : t2[e2] ?? e2, n2;
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
515
|
+
function Ye(e2, t2 = []) {
|
|
516
|
+
return O(e2, We, t2);
|
|
517
517
|
}
|
|
518
|
-
function
|
|
519
|
-
return
|
|
518
|
+
function Xe(e2, t2 = []) {
|
|
519
|
+
return O(e2, Ge, t2);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function Ze(e2) {
|
|
522
522
|
return e2 ? new Date(e2) : void 0;
|
|
523
523
|
}
|
|
524
|
-
var
|
|
525
|
-
function
|
|
524
|
+
var k = /* @__PURE__ */ new WeakMap();
|
|
525
|
+
function A() {
|
|
526
526
|
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function j(e2, t2) {
|
|
529
529
|
let n2 = e2.get(t2);
|
|
530
|
-
return n2 || (n2 =
|
|
530
|
+
return n2 || (n2 = A(), e2.set(t2, n2)), n2;
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
return t2 === `*` ? (e2.anyField ??=
|
|
532
|
+
function Qe(e2, t2) {
|
|
533
|
+
return t2 === `*` ? (e2.anyField ??= A(), e2.anyField) : t2.endsWith(`{}`) ? (e2.mapFields ??= /* @__PURE__ */ new Map(), j(e2.mapFields, t2.slice(0, -2))) : (e2.fields ??= /* @__PURE__ */ new Map(), j(e2.fields, t2));
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
let t2 =
|
|
535
|
+
function $e(e2) {
|
|
536
|
+
let t2 = A();
|
|
537
537
|
for (let n2 of e2) {
|
|
538
|
-
let e3 = n2.path.split(`.`).reduce(
|
|
538
|
+
let e3 = n2.path.split(`.`).reduce(Qe, t2);
|
|
539
539
|
e3.leaves ??= [], e3.leaves.push(n2);
|
|
540
540
|
}
|
|
541
541
|
return t2;
|
|
542
542
|
}
|
|
543
|
-
function
|
|
544
|
-
let t2 =
|
|
545
|
-
return t2 || (t2 =
|
|
543
|
+
function et(e2) {
|
|
544
|
+
let t2 = k.get(e2);
|
|
545
|
+
return t2 || (t2 = $e(e2), k.set(e2, t2)), t2;
|
|
546
546
|
}
|
|
547
|
-
function
|
|
547
|
+
function M(e2) {
|
|
548
548
|
return typeof e2 == `object` && !!e2;
|
|
549
549
|
}
|
|
550
|
-
function
|
|
551
|
-
return t2 ? Array.isArray(e2) ? e2.map(r2) : e2 : n2 ?
|
|
550
|
+
function tt(e2, { isRepeated: t2, isMap: n2 }, r2) {
|
|
551
|
+
return t2 ? Array.isArray(e2) ? e2.map(r2) : e2 : n2 ? M(e2) ? Object.fromEntries(Object.entries(e2).map(([e3, t3]) => [e3, r2(t3)])) : e2 : r2(e2);
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
553
|
+
function N(e2, t2, n2) {
|
|
554
|
+
M(e2) && P(e2, t2, n2);
|
|
555
555
|
}
|
|
556
|
-
function
|
|
556
|
+
function nt(e2, t2, n2) {
|
|
557
557
|
for (let [r2, i2] of t2) {
|
|
558
558
|
if (!(r2 in e2)) continue;
|
|
559
|
-
if (i2.leaves) for (let t4 of i2.leaves) e2[r2] =
|
|
559
|
+
if (i2.leaves) for (let t4 of i2.leaves) e2[r2] = tt(e2[r2], t4, n2);
|
|
560
560
|
let t3 = e2[r2];
|
|
561
|
-
Array.isArray(t3) ? t3.forEach((e3) =>
|
|
561
|
+
Array.isArray(t3) ? t3.forEach((e3) => N(e3, i2, n2)) : N(t3, i2, n2);
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
|
-
function
|
|
564
|
+
function rt(e2, t2, n2) {
|
|
565
565
|
for (let [r2, i2] of t2) {
|
|
566
566
|
let t3 = e2[r2];
|
|
567
|
-
|
|
567
|
+
M(t3) && Object.values(t3).forEach((e3) => N(e3, i2, n2));
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
t2 &&
|
|
570
|
+
function P(e2, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
571
|
+
t2 && nt(e2, t2, i2), n2 && rt(e2, n2, i2), r2 && Object.values(e2).forEach((e3) => N(e3, r2, i2));
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
if (!
|
|
575
|
-
for (let { paths: n2, transformFn: r2 } of t2)
|
|
573
|
+
function it(e2, t2) {
|
|
574
|
+
if (!M(e2)) return e2;
|
|
575
|
+
for (let { paths: n2, transformFn: r2 } of t2) P(e2, et(n2), r2);
|
|
576
576
|
return e2;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
579
|
-
return
|
|
578
|
+
function F(e2) {
|
|
579
|
+
return lt(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
580
580
|
}
|
|
581
|
-
var
|
|
582
|
-
var
|
|
583
|
-
var
|
|
584
|
-
var
|
|
585
|
-
function
|
|
581
|
+
var at = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
582
|
+
var ot = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
583
|
+
var st = `$1\0$2`;
|
|
584
|
+
var ct = /[^\p{L}\d]+/giu;
|
|
585
|
+
function lt(e2) {
|
|
586
586
|
let t2 = e2.trim();
|
|
587
|
-
t2 = t2.replace(
|
|
587
|
+
t2 = t2.replace(at, st).replace(ot, st), t2 = t2.replace(ct, `\0`);
|
|
588
588
|
let n2 = 0, r2 = t2.length;
|
|
589
589
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
590
590
|
if (n2 === r2) return [];
|
|
591
591
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
592
592
|
return t2.slice(n2, r2).split(/\0/g);
|
|
593
593
|
}
|
|
594
|
-
var
|
|
595
|
-
var
|
|
596
|
-
var
|
|
597
|
-
function
|
|
594
|
+
var ut = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
595
|
+
var dt = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
596
|
+
var ft = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
597
|
+
function pt(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
598
598
|
if (typeof e2 != `object` || !e2) throw e2;
|
|
599
|
-
if (
|
|
600
|
-
if (
|
|
601
|
-
if (
|
|
602
|
-
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code:
|
|
603
|
-
return
|
|
599
|
+
if (ut(e2)) return mt(e2, t2, n2);
|
|
600
|
+
if (dt(e2)) return ht(e2);
|
|
601
|
+
if (ft(e2)) {
|
|
602
|
+
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: F(n3), data: {} }, requestId: e2.requestId };
|
|
603
|
+
return I(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
604
604
|
}
|
|
605
|
-
return
|
|
605
|
+
return gt(e2);
|
|
606
606
|
}
|
|
607
|
-
var
|
|
608
|
-
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 =
|
|
609
|
-
return
|
|
607
|
+
var mt = (e2, t2, n2) => {
|
|
608
|
+
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = _t(t2, a2, n2)?.sort((e3, t3) => e3.field < t3.field ? -1 : 1), s2 = `INVALID_ARGUMENT: ${o2?.map(({ field: e3, description: t3 }) => `"${e3}" ${t3}`)?.join(`, `)}`, c2 = { validationError: { fieldViolations: o2 }, requestId: i2 };
|
|
609
|
+
return I(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
610
610
|
};
|
|
611
|
-
var
|
|
612
|
-
var
|
|
613
|
-
let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ??
|
|
614
|
-
return
|
|
611
|
+
var I = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
612
|
+
var ht = (e2) => {
|
|
613
|
+
let t2 = e2.response?.status, n2 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n2, i2 = e2.response?.data?.details?.applicationError?.description ?? n2, a2 = e2.response?.data?.details?.applicationError?.code ?? F(n2), o2 = e2.response?.data?.details?.applicationError?.data ?? {}, s2 = r2 === i2 ? r2 : `${r2}: ${i2}`, c2 = { applicationError: { description: i2, code: a2, data: o2 }, requestId: e2.requestId };
|
|
614
|
+
return I(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
615
615
|
};
|
|
616
|
-
var
|
|
617
|
-
var
|
|
616
|
+
var gt = (e2) => I(e2, { message: e2.requestId ? `System error occurred, request-id: ${e2.requestId}` : `System error occurred: ${JSON.stringify(e2)}`, extraProperties: { requestId: e2.requestId, status: e2.response?.status, code: F(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
|
|
617
|
+
var _t = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
618
618
|
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
619
619
|
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
620
620
|
let r3 = t2[e3.field];
|
|
621
|
-
if (r3) return { ...e3, field:
|
|
621
|
+
if (r3) return { ...e3, field: vt(r3, i2) };
|
|
622
622
|
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
623
623
|
if (s2) {
|
|
624
624
|
let t3 = a2[s2];
|
|
625
|
-
if (t3) return { ...e3, field: e3.field.replace(s2,
|
|
625
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, vt(t3, i2)) };
|
|
626
626
|
}
|
|
627
627
|
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
628
628
|
});
|
|
629
629
|
};
|
|
630
|
-
var
|
|
631
|
-
let n2 =
|
|
630
|
+
var vt = (e2, t2) => {
|
|
631
|
+
let n2 = yt(e2);
|
|
632
632
|
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
633
633
|
};
|
|
634
|
-
var
|
|
634
|
+
var yt = (e2) => {
|
|
635
635
|
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
636
636
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
637
637
|
};
|
|
638
|
-
function
|
|
638
|
+
function bt() {
|
|
639
639
|
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
640
640
|
if (e2) return { initWixModules(t3, n3) {
|
|
641
|
-
return
|
|
641
|
+
return L(() => e2(t3, n3));
|
|
642
642
|
}, fetchWithAuth() {
|
|
643
643
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
644
644
|
}, graphql() {
|
|
@@ -648,10 +648,10 @@ function St() {
|
|
|
648
648
|
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
649
649
|
if (r2) {
|
|
650
650
|
if (!n2) throw 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`);
|
|
651
|
-
return
|
|
651
|
+
return L(() => n2.use(e3));
|
|
652
652
|
}
|
|
653
653
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
654
|
-
return
|
|
654
|
+
return L(() => t2.use(e3));
|
|
655
655
|
}, fetchWithAuth: (e3, n3) => {
|
|
656
656
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
657
657
|
return t2.fetchWithAuth(e3, n3);
|
|
@@ -663,7 +663,7 @@ function St() {
|
|
|
663
663
|
return t2.graphql(e3, n3, r2);
|
|
664
664
|
} };
|
|
665
665
|
}
|
|
666
|
-
function
|
|
666
|
+
function L(e2) {
|
|
667
667
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
668
668
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
669
669
|
try {
|
|
@@ -672,78 +672,78 @@ function F(e2) {
|
|
|
672
672
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function xt(e2, t2) {
|
|
676
676
|
return (...n2) => {
|
|
677
|
-
let r2 =
|
|
677
|
+
let r2 = bt();
|
|
678
678
|
return r2 ? r2.initWixModules(e2, t2).apply(void 0, n2) : e2.apply(void 0, n2);
|
|
679
679
|
};
|
|
680
680
|
}
|
|
681
|
-
function
|
|
682
|
-
return
|
|
683
|
-
}
|
|
684
|
-
function
|
|
685
|
-
let t2 =
|
|
686
|
-
return
|
|
687
|
-
}
|
|
688
|
-
var
|
|
689
|
-
var
|
|
690
|
-
var
|
|
691
|
-
var
|
|
692
|
-
var
|
|
693
|
-
var
|
|
694
|
-
var
|
|
695
|
-
var
|
|
696
|
-
var
|
|
697
|
-
var
|
|
698
|
-
function
|
|
699
|
-
return
|
|
700
|
-
}
|
|
701
|
-
function
|
|
702
|
-
return
|
|
703
|
-
}
|
|
704
|
-
function
|
|
681
|
+
function St(e2, t2 = false) {
|
|
682
|
+
return xt(e2, t2);
|
|
683
|
+
}
|
|
684
|
+
function Ct(e2) {
|
|
685
|
+
let t2 = It(Pt(e2.host), e2.domainToMappings);
|
|
686
|
+
return Gt(Ht(e2.protoPath, e2.data || {}), t2);
|
|
687
|
+
}
|
|
688
|
+
var wt = [`wix.com`, `editorx.com`];
|
|
689
|
+
var Tt = `_`;
|
|
690
|
+
var Et = `*.`;
|
|
691
|
+
var Dt = RegExp(`\\.(${wt.join(`|`)})$`);
|
|
692
|
+
var Ot = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
693
|
+
var kt = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
694
|
+
var At = `dev.wix-code.com`;
|
|
695
|
+
var jt = /{(.*)}/;
|
|
696
|
+
var Mt = RegExp(`\\.(${Ot.join(`|`)})$`);
|
|
697
|
+
var Nt = RegExp(`.*\\.${At}$`);
|
|
698
|
+
function Pt(e2) {
|
|
699
|
+
return Ft(e2).replace(Dt, `._base_domain_`).replace(Mt, `._api_base_domain_`).replace(Nt, `*.dev.wix-code.com`);
|
|
700
|
+
}
|
|
701
|
+
function Ft(e2) {
|
|
702
|
+
return kt[e2] ?? e2;
|
|
703
|
+
}
|
|
704
|
+
function It(e2, t2) {
|
|
705
705
|
let n2 = t2[e2];
|
|
706
706
|
if (n2) return n2;
|
|
707
|
-
let r2 =
|
|
707
|
+
let r2 = Lt(e2, t2) ?? Rt(e2, t2);
|
|
708
708
|
if (!r2) {
|
|
709
|
-
if (
|
|
710
|
-
let e3 = t2[
|
|
709
|
+
if (Bt(e2)) {
|
|
710
|
+
let e3 = t2[Vt];
|
|
711
711
|
if (e3) return e3;
|
|
712
712
|
}
|
|
713
|
-
let n3 = t2[
|
|
713
|
+
let n3 = t2[Tt];
|
|
714
714
|
if (n3) return n3;
|
|
715
715
|
}
|
|
716
716
|
return r2 ?? [];
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Lt(e2, t2) {
|
|
719
719
|
return Object.entries(t2).find(([t3]) => {
|
|
720
720
|
let [, ...n2] = e2.split(`.`);
|
|
721
721
|
return n2.join(`.`) === t3;
|
|
722
722
|
})?.[1];
|
|
723
723
|
}
|
|
724
|
-
function
|
|
725
|
-
let [n2] = Object.entries(t2).filter(([t3]) =>
|
|
724
|
+
function Rt(e2, t2) {
|
|
725
|
+
let [n2] = Object.entries(t2).filter(([t3]) => zt(e2, t3)).sort(([e3], [t3]) => t3.length - e3.length);
|
|
726
726
|
if (!n2) return;
|
|
727
727
|
let [, r2] = n2;
|
|
728
728
|
return r2;
|
|
729
729
|
}
|
|
730
|
-
function
|
|
731
|
-
if (!t2.startsWith(
|
|
730
|
+
function zt(e2, t2) {
|
|
731
|
+
if (!t2.startsWith(Et)) return false;
|
|
732
732
|
let n2 = t2.slice(1);
|
|
733
733
|
return e2.length > n2.length && e2.endsWith(n2);
|
|
734
734
|
}
|
|
735
|
-
function
|
|
735
|
+
function Bt(e2) {
|
|
736
736
|
return !!e2.match(/\._base_domain_$/);
|
|
737
737
|
}
|
|
738
|
-
var
|
|
739
|
-
function
|
|
740
|
-
return e2.split(`/`).map((e3) =>
|
|
738
|
+
var Vt = `www._base_domain_`;
|
|
739
|
+
function Ht(e2, t2) {
|
|
740
|
+
return e2.split(`/`).map((e3) => Ut(e3, t2)).join(`/`);
|
|
741
741
|
}
|
|
742
|
-
function
|
|
743
|
-
let n2 = e2.match(
|
|
744
|
-
return r2 ?
|
|
742
|
+
function Ut(e2, t2) {
|
|
743
|
+
let n2 = e2.match(jt) || [], r2 = n2[1];
|
|
744
|
+
return r2 ? Wt(t2, r2, e2, e2.replace(n2[0], ``)) : e2;
|
|
745
745
|
}
|
|
746
|
-
function
|
|
746
|
+
function Wt(e2, t2, n2, r2) {
|
|
747
747
|
let i2 = e2;
|
|
748
748
|
for (let e3 of t2.split(`.`)) {
|
|
749
749
|
if (!i2) return n2;
|
|
@@ -751,33 +751,33 @@ function Kt(e2, t2, n2, r2) {
|
|
|
751
751
|
}
|
|
752
752
|
return `${i2}${r2}`;
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Gt(e2, t2) {
|
|
755
755
|
let n2 = t2?.find((t3) => e2.startsWith(t3.destPath));
|
|
756
756
|
return n2 ? n2.srcPath + e2.slice(n2.destPath.length) : e2;
|
|
757
757
|
}
|
|
758
|
-
var
|
|
759
|
-
var
|
|
760
|
-
var
|
|
761
|
-
var
|
|
762
|
-
let e2 =
|
|
763
|
-
if (e2) return { [
|
|
758
|
+
var Kt = `x-wix-linguist`;
|
|
759
|
+
var qt = `00000000-0000-0000-0000-000000000000`;
|
|
760
|
+
var Jt = `false`;
|
|
761
|
+
var Yt = () => {
|
|
762
|
+
let e2 = R(`language`), t2 = R(`locale`);
|
|
763
|
+
if (e2) return { [Kt]: [e2, t2 || e2, Jt, qt].join(`|`) };
|
|
764
764
|
};
|
|
765
|
-
function
|
|
765
|
+
function Xt() {
|
|
766
766
|
let e2 = null, t2 = null;
|
|
767
767
|
return { promise: new Promise((n2, r2) => {
|
|
768
768
|
e2 = n2, t2 = r2;
|
|
769
769
|
}), resolve: e2, reject: t2 };
|
|
770
770
|
}
|
|
771
|
-
var
|
|
772
|
-
var
|
|
773
|
-
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 =
|
|
774
|
-
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language:
|
|
775
|
-
return
|
|
771
|
+
var R = (e2) => typeof window < `u` ? window.commonConfig?.[e2] : void 0;
|
|
772
|
+
var Zt = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host: (t2) => {
|
|
773
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 = $t();
|
|
774
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: R(`language`), locale: R(`locale`), get passThroughHeaders() {
|
|
775
|
+
return Yt();
|
|
776
776
|
} } };
|
|
777
777
|
}, auth: (e3) => {
|
|
778
778
|
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
779
|
-
!e3 &&
|
|
780
|
-
let n2 = false, { resolve: r2, promise: i2 } =
|
|
779
|
+
!e3 && Qt() && (e3 = t2?.getAccessTokenFunction?.());
|
|
780
|
+
let n2 = false, { resolve: r2, promise: i2 } = Xt();
|
|
781
781
|
return { getAuthHeaders: async () => {
|
|
782
782
|
if (!e3 && n2 && (e3 = await i2), !e3) throw Error(`Failed to resolve auth token`);
|
|
783
783
|
return { headers: { Authorization: await e3() } };
|
|
@@ -785,88 +785,88 @@ var $t = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host:
|
|
|
785
785
|
r2(e4);
|
|
786
786
|
}) };
|
|
787
787
|
} });
|
|
788
|
-
function
|
|
788
|
+
function Qt() {
|
|
789
789
|
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function $t() {
|
|
792
792
|
let e2 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
793
793
|
if (!e2) return;
|
|
794
794
|
let t2 = new URL(e2);
|
|
795
795
|
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
796
796
|
}
|
|
797
|
-
var
|
|
797
|
+
var en = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
798
798
|
if (!e2) throw Error(`Wix Site SDK only works in a Wix site environment. Learn more: https://dev.wix.com/docs/sdk/host-modules/site/introduction`);
|
|
799
799
|
return e2.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
800
800
|
}, getAccessToken: () => {
|
|
801
801
|
throw Error(`Not implemented`);
|
|
802
802
|
}, observeState: () => ({ disconnect: () => {
|
|
803
803
|
} }) });
|
|
804
|
-
var
|
|
804
|
+
var tn = Zt({ createHost: function(e2) {
|
|
805
805
|
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e2?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e2 || {};
|
|
806
806
|
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
807
|
-
return { channel:
|
|
807
|
+
return { channel: en({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
808
808
|
} };
|
|
809
809
|
} });
|
|
810
|
-
var
|
|
811
|
-
let n2 =
|
|
812
|
-
return
|
|
810
|
+
var nn = ((e2, t2) => {
|
|
811
|
+
let n2 = tn.host({ applicationId: e2, componentId: t2 }), r2 = tn.auth();
|
|
812
|
+
return Ue({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
813
813
|
})(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`);
|
|
814
|
-
function
|
|
814
|
+
function z(e2, t2) {
|
|
815
815
|
for (let n2 of e2) {
|
|
816
816
|
let e3 = n2.addOns.find((e4) => e4.addOnId === t2);
|
|
817
817
|
if (e3) return { group: n2, addOn: e3 };
|
|
818
818
|
}
|
|
819
819
|
return null;
|
|
820
820
|
}
|
|
821
|
-
function
|
|
822
|
-
return
|
|
821
|
+
function rn(e2, t2) {
|
|
822
|
+
return z(e2, t2)?.addOn ?? null;
|
|
823
823
|
}
|
|
824
|
-
function
|
|
825
|
-
return t2.filter((t3) =>
|
|
824
|
+
function B(e2, t2) {
|
|
825
|
+
return t2.filter((t3) => z(e2, t3.id) !== null);
|
|
826
826
|
}
|
|
827
|
-
function
|
|
828
|
-
return n2.filter((n3) =>
|
|
827
|
+
function an(e2, t2, n2) {
|
|
828
|
+
return n2.filter((n3) => z(e2, n3.id)?.group === t2).length;
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function on(e2, t2) {
|
|
831
831
|
return !e2.maxNumberOfAddOns || t2 < e2.maxNumberOfAddOns;
|
|
832
832
|
}
|
|
833
|
-
function
|
|
833
|
+
function sn(e2, t2) {
|
|
834
834
|
return e2.map((n2) => {
|
|
835
|
-
let r2 =
|
|
835
|
+
let r2 = an(e2, n2, t2);
|
|
836
836
|
return { ...n2, addOns: n2.addOns.map((e3) => {
|
|
837
837
|
let n3 = t2.find((t3) => t3.id === e3.addOnId)?.quantity ?? 0;
|
|
838
838
|
return { ...e3, isSelected: n3 > 0, selectedQuantity: n3 };
|
|
839
|
-
}), selectedCount: r2, canSelectMore:
|
|
839
|
+
}), selectedCount: r2, canSelectMore: on(n2, r2) };
|
|
840
840
|
});
|
|
841
841
|
}
|
|
842
|
-
function
|
|
843
|
-
let r2 =
|
|
844
|
-
return r2 ? t2.some((e3) => e3.id === n2) ? true :
|
|
842
|
+
function cn(e2, t2, n2) {
|
|
843
|
+
let r2 = z(e2, n2);
|
|
844
|
+
return r2 ? t2.some((e3) => e3.id === n2) ? true : on(r2.group, an(e2, r2.group, t2)) : false;
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function ln(e2, t2) {
|
|
847
847
|
let n2 = e2.maxQuantity ?? 1;
|
|
848
848
|
return Number.isFinite(t2) ? Math.min(Math.max(Math.trunc(t2), 0), n2) : 0;
|
|
849
849
|
}
|
|
850
|
-
var
|
|
851
|
-
function
|
|
850
|
+
var un = { category: `category`, location: `location`, page: `page`, blob: `b`, resource: `resource`, referral: `referral`, timezone: `timezone`, bookingId: `bookingId`, token: `token`, rescheduleRedirectUrl: `rescheduleRedirectUrl` };
|
|
851
|
+
function V(e2) {
|
|
852
852
|
return e2.addOns ?? [];
|
|
853
853
|
}
|
|
854
|
-
function
|
|
854
|
+
function H(e2, t2) {
|
|
855
855
|
let n2 = { ...e2 };
|
|
856
856
|
return t2.length ? n2.addOns = t2 : delete n2.addOns, n2;
|
|
857
857
|
}
|
|
858
|
-
function
|
|
859
|
-
let n2 =
|
|
860
|
-
return
|
|
858
|
+
function dn(e2, t2) {
|
|
859
|
+
let n2 = V(e2);
|
|
860
|
+
return H(e2, n2.some((e3) => e3.id === t2) ? n2.filter((e3) => e3.id !== t2) : [...n2, { id: t2, quantity: 1 }]);
|
|
861
861
|
}
|
|
862
|
-
function
|
|
863
|
-
let r2 =
|
|
864
|
-
return n2 <= 0 ?
|
|
862
|
+
function fn(e2, t2, n2) {
|
|
863
|
+
let r2 = V(e2);
|
|
864
|
+
return n2 <= 0 ? H(e2, r2.filter((e3) => e3.id !== t2)) : H(e2, r2.some((e3) => e3.id === t2) ? r2.map((e3) => e3.id === t2 ? { ...e3, quantity: n2 } : e3) : [...r2, { id: t2, quantity: n2 }]);
|
|
865
865
|
}
|
|
866
|
-
function
|
|
866
|
+
function pn() {
|
|
867
867
|
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
868
868
|
if (e2) return { initWixModules(t3, n3) {
|
|
869
|
-
return
|
|
869
|
+
return U(() => e2(t3, n3));
|
|
870
870
|
}, fetchWithAuth() {
|
|
871
871
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
872
872
|
}, graphql() {
|
|
@@ -876,10 +876,10 @@ function dn() {
|
|
|
876
876
|
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
877
877
|
if (r2) {
|
|
878
878
|
if (!n2) throw 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`);
|
|
879
|
-
return
|
|
879
|
+
return U(() => n2.use(e3));
|
|
880
880
|
}
|
|
881
881
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
882
|
-
return
|
|
882
|
+
return U(() => t2.use(e3));
|
|
883
883
|
}, fetchWithAuth: (e3, n3) => {
|
|
884
884
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
885
885
|
return t2.fetchWithAuth(e3, n3);
|
|
@@ -891,7 +891,7 @@ function dn() {
|
|
|
891
891
|
return t2.graphql(e3, n3, r2);
|
|
892
892
|
} };
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function U(e2) {
|
|
895
895
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
896
896
|
globalThis.__wix_context__ = void 0, p.client = void 0, p.elevatedClient = void 0, typeof $wixContext < `u` && (r2 = { client: $wixContext?.client, elevatedClient: $wixContext?.elevatedClient }, delete $wixContext.client, delete $wixContext.elevatedClient);
|
|
897
897
|
try {
|
|
@@ -900,17 +900,17 @@ function G(e2) {
|
|
|
900
900
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
901
901
|
}
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function mn(e2, t2) {
|
|
904
904
|
return { ...e2, ...Object.fromEntries(t2.map((t3) => [t3, (...n2) => {
|
|
905
|
-
let r2 =
|
|
905
|
+
let r2 = pn();
|
|
906
906
|
if (!r2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
907
907
|
return r2.initWixModules(e2)[t3].apply(void 0, n2);
|
|
908
908
|
}])) };
|
|
909
909
|
}
|
|
910
|
-
function
|
|
911
|
-
return
|
|
910
|
+
function hn(e2) {
|
|
911
|
+
return mn({ __type: `host`, create: (t2) => Object.entries(e2).reduce((e3, [n2, r2]) => ({ ...e3, [n2]: r2(t2) }), {}) }, Object.keys(e2));
|
|
912
912
|
}
|
|
913
|
-
var
|
|
913
|
+
var gn = class {
|
|
914
914
|
constructor(e2) {
|
|
915
915
|
this.message = e2, this.captureException = () => {
|
|
916
916
|
console.error(this.message);
|
|
@@ -925,42 +925,42 @@ var mn = class {
|
|
|
925
925
|
};
|
|
926
926
|
}
|
|
927
927
|
};
|
|
928
|
-
var
|
|
929
|
-
var
|
|
930
|
-
var
|
|
931
|
-
function
|
|
928
|
+
var _n = (e2) => new gn(e2);
|
|
929
|
+
var vn = hn({ getMonitoringClient: (e2) => () => e2.getMonitoringClient ? e2.getMonitoringClient() : _n(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
|
|
930
|
+
var W = { service: `service`, services: `services`, categories: `categories`, locations: `locations`, sessions: `sessions`, timeSlots: `time-slots`, serviceAddOns: `service-addons`, bookingsSettings: `bookings-settings`, serviceCta: `service-cta`, preferences: `preferences`, bookingSummary: `booking-summary`, bookingCheckout: `booking-checkout`, formValues: `form-values`, paymentOptions: `payment-options`, seo: `seo`, warmup: `warmup`, reschedule: `reschedule` };
|
|
931
|
+
function yn(e2) {
|
|
932
932
|
try {
|
|
933
|
-
let t2 =
|
|
933
|
+
let t2 = vn.getMonitoringClient?.();
|
|
934
934
|
return t2 && typeof t2[e2] == `function` ? t2 : null;
|
|
935
935
|
} catch {
|
|
936
936
|
return null;
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
|
-
function
|
|
940
|
-
let a2 =
|
|
939
|
+
function G(e2, { feature: t2, action: n2, level: r2 = `error`, contexts: i2 }) {
|
|
940
|
+
let a2 = yn(`captureException`);
|
|
941
941
|
if (!a2) return;
|
|
942
942
|
let o2 = e2 instanceof Error ? e2 : Error(String(e2));
|
|
943
943
|
a2.captureException(o2, { level: r2, tags: { feature: t2, action: n2 }, ...i2 ? { contexts: i2 } : {} });
|
|
944
944
|
}
|
|
945
|
-
function
|
|
946
|
-
let i2 =
|
|
945
|
+
function bn(e2, { feature: t2, tags: n2 }, r2) {
|
|
946
|
+
let i2 = yn(`startSpanManual`);
|
|
947
947
|
if (!i2) return r2;
|
|
948
948
|
let a2 = i2.startSpanManual({ name: e2, tags: { feature: t2, ...n2 } });
|
|
949
949
|
return r2.then(() => a2.end(), (e3) => a2.fail(e3)), r2;
|
|
950
950
|
}
|
|
951
|
-
var
|
|
951
|
+
var xn = class extends e {
|
|
952
952
|
state = { hasError: false };
|
|
953
953
|
static getDerivedStateFromError() {
|
|
954
954
|
return { hasError: true };
|
|
955
955
|
}
|
|
956
956
|
componentDidCatch(e2, t2) {
|
|
957
|
-
|
|
957
|
+
G(e2, { feature: this.props.feature ?? `service`, action: `render`, contexts: { react: { componentStack: t2.componentStack } } });
|
|
958
958
|
}
|
|
959
959
|
render() {
|
|
960
960
|
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
961
961
|
}
|
|
962
962
|
};
|
|
963
|
-
function
|
|
963
|
+
function Sn(e2) {
|
|
964
964
|
let t2 = e2;
|
|
965
965
|
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e3) => {
|
|
966
966
|
t2.__state = { status: `fulfilled`, value: e3 };
|
|
@@ -969,49 +969,49 @@ function bn(e2) {
|
|
|
969
969
|
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
970
970
|
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
971
971
|
}
|
|
972
|
-
function
|
|
972
|
+
function K(e2) {
|
|
973
973
|
let t2 = Promise.resolve(e2);
|
|
974
974
|
return t2.__state = { status: `fulfilled`, value: e2 }, t2;
|
|
975
975
|
}
|
|
976
|
-
var
|
|
977
|
-
function
|
|
978
|
-
let r2 =
|
|
979
|
-
r2 || (r2 = /* @__PURE__ */ new WeakMap(),
|
|
976
|
+
var Cn = /* @__PURE__ */ new WeakMap();
|
|
977
|
+
function wn(e2, t2, n2) {
|
|
978
|
+
let r2 = Cn.get(e2);
|
|
979
|
+
r2 || (r2 = /* @__PURE__ */ new WeakMap(), Cn.set(e2, r2));
|
|
980
980
|
let i2 = r2.get(t2);
|
|
981
981
|
i2 || (i2 = /* @__PURE__ */ new WeakMap(), r2.set(t2, i2));
|
|
982
982
|
let a2 = i2.get(n2);
|
|
983
983
|
if (!a2) {
|
|
984
984
|
let r3 = e2;
|
|
985
|
-
a2 = r3.__state?.status === `fulfilled` ?
|
|
985
|
+
a2 = r3.__state?.status === `fulfilled` ? K(t2(r3.__state.value)) : r3.__state?.status === `rejected` ? K(n2(r3.__state.reason)) : e2.then(t2, n2), i2.set(n2, a2);
|
|
986
986
|
}
|
|
987
987
|
return a2;
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function q(e2) {
|
|
990
990
|
return e2;
|
|
991
991
|
}
|
|
992
|
-
var
|
|
993
|
-
function
|
|
992
|
+
var Tn = q(`@wix/site-service-warmup-data`);
|
|
993
|
+
function En() {
|
|
994
994
|
try {
|
|
995
995
|
return u();
|
|
996
996
|
} catch {
|
|
997
997
|
return null;
|
|
998
998
|
}
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function Dn(e2) {
|
|
1001
1001
|
try {
|
|
1002
|
-
return e2 ? e2(
|
|
1002
|
+
return e2 ? e2(Tn) : null;
|
|
1003
1003
|
} catch {
|
|
1004
1004
|
return null;
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
function
|
|
1008
|
-
let e2 = En(
|
|
1007
|
+
function On() {
|
|
1008
|
+
let e2 = Dn(En()), t2 = typeof window > `u`;
|
|
1009
1009
|
return { scope: e2 ?? void 0, get: async (n2) => {
|
|
1010
1010
|
if (t2 || !e2) return null;
|
|
1011
1011
|
try {
|
|
1012
1012
|
return await e2.get(n2);
|
|
1013
1013
|
} catch (e3) {
|
|
1014
|
-
return
|
|
1014
|
+
return G(e3, { feature: W.warmup, action: `read`, level: `warning`, contexts: { warmup: { key: n2 } } }), null;
|
|
1015
1015
|
}
|
|
1016
1016
|
}, set: (n2, r2) => {
|
|
1017
1017
|
if (t2 && e2) try {
|
|
@@ -1020,54 +1020,54 @@ function Dn() {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
} };
|
|
1022
1022
|
}
|
|
1023
|
-
var
|
|
1024
|
-
var
|
|
1025
|
-
var
|
|
1026
|
-
function
|
|
1027
|
-
let r2 = { addOnGroups:
|
|
1023
|
+
var J = [];
|
|
1024
|
+
var kn = [];
|
|
1025
|
+
var An = `useServiceAddOnsContext must be used within ServiceAddOnsContextProvider`;
|
|
1026
|
+
function jn({ isLoading: e2, hasError: t2, children: n2 }) {
|
|
1027
|
+
let r2 = { addOnGroups: J, selected: kn, isLoading: e2, hasError: t2, toggleAddOn: () => {
|
|
1028
1028
|
}, setAddOnQuantity: () => {
|
|
1029
1029
|
} };
|
|
1030
1030
|
return f($.Provider, { value: r2, children: n2 });
|
|
1031
1031
|
}
|
|
1032
|
-
function jn({ children: e2 }) {
|
|
1033
|
-
return f(An, { isLoading: true, hasError: false, children: e2 });
|
|
1034
|
-
}
|
|
1035
1032
|
function Mn({ children: e2 }) {
|
|
1036
|
-
return f(
|
|
1033
|
+
return f(jn, { isLoading: true, hasError: false, children: e2 });
|
|
1034
|
+
}
|
|
1035
|
+
function Nn({ children: e2 }) {
|
|
1036
|
+
return f(jn, { isLoading: false, hasError: true, children: e2 });
|
|
1037
1037
|
}
|
|
1038
|
-
function
|
|
1038
|
+
function Pn(e2) {
|
|
1039
1039
|
if (!e2) return;
|
|
1040
1040
|
let t2 = ``;
|
|
1041
1041
|
return (e2.filename || e2.altText) && (t2 = `/${encodeURIComponent(e2.filename || e2.altText)}`), e2.id ? `wix:image://v1/${e2.id}${t2}#originWidth=${e2.width}&originHeight=${e2.height}` : e2.url;
|
|
1042
1042
|
}
|
|
1043
|
-
var
|
|
1044
|
-
function
|
|
1045
|
-
return
|
|
1043
|
+
var Fn = [{ path: `addOnGroupsDetails.addOns.mainMedia.image.urlExpirationDate` }];
|
|
1044
|
+
function In(e2) {
|
|
1045
|
+
return Ct(Object.assign(e2, { domainToMappings: { "*.dev.wix-code.com": [{ srcPath: `/_api/services-2`, destPath: `` }, { srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "www.wixapis.com": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }, { srcPath: `/bookings/services/v2/bulk/services`, destPath: `/v2/bulk/services` }], "manage._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "editor._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "blocks._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], "create.editorx": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }, { srcPath: `/_api/bookings/v2/bulk/services`, destPath: `/v2/bulk/services` }], _: [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "www._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "bo._base_domain_": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "wixbo.ai": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "wix-bo.com": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "editor.wixapps.net": [{ srcPath: `/_api/bookings/v2/services`, destPath: `/v2/services` }], "api._api_base_domain_": [{ srcPath: `/services-2`, destPath: `` }] } }));
|
|
1046
1046
|
}
|
|
1047
|
-
var
|
|
1048
|
-
function
|
|
1047
|
+
var Ln = `@wix/auto_sdk_bookings_services`;
|
|
1048
|
+
function Rn(e2) {
|
|
1049
1049
|
function t2({ host: t3 }) {
|
|
1050
|
-
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.AddOnGroupsService.ListAddOnGroupsByServiceId`, packageName:
|
|
1050
|
+
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.AddOnGroupsService.ListAddOnGroupsByServiceId`, packageName: Ln, migrationOptions: { optInTransformResponse: true }, url: In({ protoPath: `/v2/services/add-on-groups/list-add-on-groups-by-service-id`, data: e2, host: t3 }), data: e2, transformResponse: (e3) => it(e3, [{ transformFn: Ze, paths: Fn }]) };
|
|
1051
1051
|
}
|
|
1052
1052
|
return t2;
|
|
1053
1053
|
}
|
|
1054
|
-
var
|
|
1055
|
-
async function
|
|
1056
|
-
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 =
|
|
1054
|
+
var zn = [{ path: `addOnGroupsDetails.addOns.mainMedia.image` }];
|
|
1055
|
+
async function Bn(e2, t2) {
|
|
1056
|
+
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 = Rn(Ye({ serviceId: e2, groupIds: t2?.groupIds }));
|
|
1057
1057
|
r2?.onSiteCall?.();
|
|
1058
1058
|
try {
|
|
1059
1059
|
let e3 = await n2.request(i2);
|
|
1060
|
-
return r2?.onSuccess?.(e3),
|
|
1060
|
+
return r2?.onSuccess?.(e3), Xe(it(e3.data, [{ transformFn: Pn, paths: zn }]));
|
|
1061
1061
|
} catch (e3) {
|
|
1062
|
-
let t3 =
|
|
1062
|
+
let t3 = pt(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { serviceId: `$[0]`, groupIds: `$[1].groupIds` }, singleArgumentUnchanged: false }, [`serviceId`, `options`]);
|
|
1063
1063
|
throw r2?.onError?.(e3), t3;
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1067
|
-
return (t2, n2) =>
|
|
1066
|
+
function Vn(e2) {
|
|
1067
|
+
return (t2, n2) => Bn(t2, n2, { httpClient: e2 });
|
|
1068
1068
|
}
|
|
1069
|
-
var
|
|
1070
|
-
function
|
|
1069
|
+
var Hn = St(Vn);
|
|
1070
|
+
function Un(e2, t2) {
|
|
1071
1071
|
let n2 = e2?.value, r2 = e2?.currency;
|
|
1072
1072
|
if (n2 == null || !r2) return null;
|
|
1073
1073
|
let i2 = Number(n2);
|
|
@@ -1075,40 +1075,40 @@ function Hn(e2, t2) {
|
|
|
1075
1075
|
let a2 = i2 % 1 == 0 ? 0 : 2;
|
|
1076
1076
|
return new Intl.NumberFormat(t2, { style: `currency`, currency: r2, currencyDisplay: `symbol`, maximumFractionDigits: a2, minimumFractionDigits: a2 }).format(i2).replace(/\p{Zs}/gu, `\xA0`);
|
|
1077
1077
|
}
|
|
1078
|
-
async function
|
|
1079
|
-
return (await
|
|
1078
|
+
async function Wn(e2) {
|
|
1079
|
+
return (await Hn(e2)).addOnGroupsDetails ?? [];
|
|
1080
1080
|
}
|
|
1081
|
-
function
|
|
1081
|
+
function Gn(e2, t2) {
|
|
1082
1082
|
let n2 = e2.price?.value == null ? null : Number(e2.price.value);
|
|
1083
|
-
return { addOnId: e2.addOnId ?? null, addOnName: e2.nameTranslated ?? e2.name ?? null, addOnPrice:
|
|
1083
|
+
return { addOnId: e2.addOnId ?? null, addOnName: e2.nameTranslated ?? e2.name ?? null, addOnPrice: Un(e2.price, t2), addOnPriceValue: n2 != null && Number.isFinite(n2) ? n2 : null, addOnCurrency: e2.price?.currency ?? null, durationInMinutes: e2.durationInMinutes ?? null, maxQuantity: e2.maxQuantity ?? null, isSelected: false, selectedQuantity: 0 };
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1086
|
-
return e2.map((e3) => ({ groupId: e3.groupId ?? null, groupName: e3.groupNameTranslated ?? e3.groupName ?? null, prompt: e3.promptTranslated ?? e3.prompt ?? null, maxNumberOfAddOns: e3.maxNumberOfAddOns ?? null, addOns: (e3.addOns ?? []).map((e4) =>
|
|
1085
|
+
function Kn(e2, t2) {
|
|
1086
|
+
return e2.map((e3) => ({ groupId: e3.groupId ?? null, groupName: e3.groupNameTranslated ?? e3.groupName ?? null, prompt: e3.promptTranslated ?? e3.prompt ?? null, maxNumberOfAddOns: e3.maxNumberOfAddOns ?? null, addOns: (e3.addOns ?? []).map((e4) => Gn(e4, t2)), selectedCount: 0, canSelectMore: true }));
|
|
1087
1087
|
}
|
|
1088
|
-
var
|
|
1089
|
-
function
|
|
1090
|
-
return `${
|
|
1088
|
+
var qn = `bookings-uou`;
|
|
1089
|
+
function Jn(e2, t2) {
|
|
1090
|
+
return `${qn}:addons:${e2}:${t2}`;
|
|
1091
1091
|
}
|
|
1092
|
-
var
|
|
1093
|
-
var
|
|
1094
|
-
var
|
|
1095
|
-
var
|
|
1096
|
-
function
|
|
1092
|
+
var Yn = 5e3;
|
|
1093
|
+
var Xn = 100;
|
|
1094
|
+
var Zn = `wix-warmup-data`;
|
|
1095
|
+
var Y = null;
|
|
1096
|
+
function Qn(e2) {
|
|
1097
1097
|
if (typeof document < `u`) try {
|
|
1098
|
-
let t2 = document.getElementById(
|
|
1099
|
-
return t2 ? (
|
|
1098
|
+
let t2 = document.getElementById(Zn)?.textContent;
|
|
1099
|
+
return t2 ? (Y?.text !== t2 && (Y = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Y.data[e2] ?? void 0) : void 0;
|
|
1100
1100
|
} catch {
|
|
1101
1101
|
return;
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
-
var
|
|
1105
|
-
var $n =
|
|
1104
|
+
var X = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
1105
|
+
var $n = X();
|
|
1106
1106
|
var er = /* @__PURE__ */ new WeakMap();
|
|
1107
1107
|
var tr = /* @__PURE__ */ new WeakMap();
|
|
1108
1108
|
function nr(e2) {
|
|
1109
1109
|
if (!e2) return $n;
|
|
1110
1110
|
let t2 = er.get(e2);
|
|
1111
|
-
return t2 || (t2 =
|
|
1111
|
+
return t2 || (t2 = X(), er.set(e2, t2)), t2;
|
|
1112
1112
|
}
|
|
1113
1113
|
function rr({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
1114
1114
|
if (e2 === null) return n2();
|
|
@@ -1129,10 +1129,10 @@ function rr({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
|
1129
1129
|
r2 && i2.invalidatedWarmup.add(e2);
|
|
1130
1130
|
let s2 = !i2.invalidatedWarmup.has(e2);
|
|
1131
1131
|
if (s2) {
|
|
1132
|
-
let t3 =
|
|
1132
|
+
let t3 = Qn(e2);
|
|
1133
1133
|
if (t3 !== void 0) {
|
|
1134
|
-
let n3 =
|
|
1135
|
-
return i2.promises.set(e2, { promise: n3, expiresAt: a2 +
|
|
1134
|
+
let n3 = K(t3);
|
|
1135
|
+
return i2.promises.set(e2, { promise: n3, expiresAt: a2 + Yn }), n3;
|
|
1136
1136
|
}
|
|
1137
1137
|
}
|
|
1138
1138
|
let c2 = (async () => {
|
|
@@ -1142,43 +1142,37 @@ function rr({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
|
1142
1142
|
}
|
|
1143
1143
|
return n2();
|
|
1144
1144
|
})();
|
|
1145
|
-
i2.promises.size >=
|
|
1145
|
+
i2.promises.size >= Xn && i2.promises.delete(i2.promises.keys().next().value);
|
|
1146
1146
|
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
1147
1147
|
return i2.promises.set(e2, l2), c2.then(() => {
|
|
1148
|
-
l2.expiresAt = Date.now() +
|
|
1148
|
+
l2.expiresAt = Date.now() + Yn;
|
|
1149
1149
|
}, () => {
|
|
1150
1150
|
i2.promises.get(e2) === l2 && i2.promises.delete(e2);
|
|
1151
1151
|
}), c2;
|
|
1152
1152
|
}
|
|
1153
1153
|
function ir(e2, t2) {
|
|
1154
|
-
return
|
|
1155
|
-
throw
|
|
1154
|
+
return bn(`service-addons-context-load`, { feature: W.serviceAddOns, tags: { serviceId: e2 } }, Wn(e2)).then((e3) => Kn(e3, t2), (t3) => {
|
|
1155
|
+
throw G(t3, { feature: W.serviceAddOns, action: `fetch-add-on-groups`, level: `warning`, contexts: { service: { serviceId: e2 } } }), t3;
|
|
1156
1156
|
});
|
|
1157
1157
|
}
|
|
1158
1158
|
function ar({ serviceId: e2, locale: t2, warmupData: n2 }) {
|
|
1159
|
-
return rr({ key:
|
|
1159
|
+
return rr({ key: Jn(e2, t2), warmupData: n2, fetchData: () => ir(e2, t2) });
|
|
1160
1160
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1164
|
-
var sr = or(`@wix/viewer-service-business-logger`);
|
|
1165
|
-
function cr(e2) {
|
|
1161
|
+
var or = q(`@wix/site-service-business-logger`);
|
|
1162
|
+
function sr(e2) {
|
|
1166
1163
|
return { evid: 32, src: 16, endpoint: ``, params: e2 };
|
|
1167
1164
|
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
var dr = `appSectionParams`;
|
|
1173
|
-
function Z(e2) {
|
|
1174
|
-
let t2 = e2.searchParams.get(dr);
|
|
1165
|
+
var cr = q(`@wix/site-service-url`);
|
|
1166
|
+
var lr = `appSectionParams`;
|
|
1167
|
+
function ur(e2) {
|
|
1168
|
+
let t2 = e2.searchParams.get(lr);
|
|
1175
1169
|
if (t2 === null) return e2;
|
|
1176
1170
|
let n2 = new URL(e2);
|
|
1177
|
-
n2.searchParams.delete(
|
|
1178
|
-
for (let [e3, r2] of Object.entries(
|
|
1171
|
+
n2.searchParams.delete(lr);
|
|
1172
|
+
for (let [e3, r2] of Object.entries(dr(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
|
|
1179
1173
|
return n2;
|
|
1180
1174
|
}
|
|
1181
|
-
function
|
|
1175
|
+
function dr(e2) {
|
|
1182
1176
|
try {
|
|
1183
1177
|
let t2 = JSON.parse(e2);
|
|
1184
1178
|
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
@@ -1186,16 +1180,16 @@ function fr(e2) {
|
|
|
1186
1180
|
return {};
|
|
1187
1181
|
}
|
|
1188
1182
|
}
|
|
1189
|
-
var
|
|
1190
|
-
var
|
|
1183
|
+
var Z = `bookings-uou:url-change`;
|
|
1184
|
+
var Q = (e2) => {
|
|
1191
1185
|
let t2 = new URL(e2);
|
|
1192
1186
|
return t2.searchParams.sort(), t2.href;
|
|
1193
1187
|
};
|
|
1194
|
-
function
|
|
1188
|
+
function fr(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
1195
1189
|
let r2 = globalThis.window;
|
|
1196
1190
|
if (!r2?.history) return;
|
|
1197
1191
|
let i2 = new URL(r2.location.href);
|
|
1198
|
-
if (
|
|
1192
|
+
if (Q(i2) === Q(e2)) return;
|
|
1199
1193
|
let a2 = { scrollY: r2.scrollY };
|
|
1200
1194
|
if (n2) r2.history.replaceState(a2, ``, e2.href);
|
|
1201
1195
|
else {
|
|
@@ -1206,89 +1200,89 @@ function mr(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
|
1206
1200
|
return;
|
|
1207
1201
|
}
|
|
1208
1202
|
}
|
|
1209
|
-
r2.dispatchEvent(new Event(
|
|
1203
|
+
r2.dispatchEvent(new Event(Z));
|
|
1210
1204
|
}
|
|
1211
|
-
function
|
|
1205
|
+
function pr(e2) {
|
|
1212
1206
|
let t2 = globalThis.window;
|
|
1213
|
-
return t2 ? (t2.addEventListener(
|
|
1214
|
-
t2.removeEventListener(
|
|
1207
|
+
return t2 ? (t2.addEventListener(Z, e2), t2.addEventListener(`popstate`, e2), () => {
|
|
1208
|
+
t2.removeEventListener(Z, e2), t2.removeEventListener(`popstate`, e2);
|
|
1215
1209
|
}) : () => {
|
|
1216
1210
|
};
|
|
1217
1211
|
}
|
|
1218
|
-
var
|
|
1212
|
+
var mr = (e2) => {
|
|
1219
1213
|
try {
|
|
1220
1214
|
return decodeURIComponent(e2);
|
|
1221
1215
|
} catch {
|
|
1222
1216
|
return e2;
|
|
1223
1217
|
}
|
|
1224
1218
|
};
|
|
1225
|
-
function
|
|
1219
|
+
function hr(e2, t2) {
|
|
1226
1220
|
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
1227
|
-
return `./${
|
|
1221
|
+
return `./${mr(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
1228
1222
|
}
|
|
1229
|
-
function
|
|
1230
|
-
let e2 = d(
|
|
1231
|
-
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () =>
|
|
1223
|
+
function gr() {
|
|
1224
|
+
let e2 = d(cr), t2 = r(() => e2.currentUrl, [e2]), n2 = c(pr, t2, t2), i2 = o(() => ur(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
|
|
1225
|
+
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => ur(new URL(e2.currentUrl)), getRelativeUrl: () => hr(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: fr };
|
|
1232
1226
|
}
|
|
1233
|
-
var
|
|
1227
|
+
var _r = function(e2) {
|
|
1234
1228
|
return e2.BOOK_ONLINE = `bookingsBookOnline`, e2.SERVICE_PAGE = `bookingsServicePage`, e2.CALENDAR_PAGE = `bookingsCalendar`, e2.FORM_PAGE = `bookingsForm`, e2;
|
|
1235
1229
|
}({});
|
|
1236
|
-
var
|
|
1237
|
-
|
|
1238
|
-
var
|
|
1239
|
-
var
|
|
1240
|
-
let t2 = d(
|
|
1230
|
+
var vr = { SERVICES: `services_context`, SERVICE: `service_context`, TIME_SLOTS: `time_slots_context`, BOOKING_CHECKOUT: `booking_checkout_context`, CATEGORIES: `categories_context`, LOCATIONS: `locations_context`, SERVICE_ADD_ONS: `service_addons_context`, PREFERENCES: `preferences_context` };
|
|
1231
|
+
_r.BOOK_ONLINE;
|
|
1232
|
+
var yr = `new_bookings_server`;
|
|
1233
|
+
var br = (e2) => {
|
|
1234
|
+
let { reportBi: t2 } = d(or);
|
|
1241
1235
|
return r((n2) => {
|
|
1242
|
-
t2
|
|
1236
|
+
t2({ widget_name: e2, bookingsPlatform: yr, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
1243
1237
|
}, [t2, e2]);
|
|
1244
1238
|
};
|
|
1245
|
-
var
|
|
1246
|
-
let n2 =
|
|
1239
|
+
var xr = (e2, t2 = true) => {
|
|
1240
|
+
let n2 = br(e2), { getParsedUrl: r2 } = gr(), i2 = s(false);
|
|
1247
1241
|
a(() => {
|
|
1248
|
-
t2 && !i2.current && (i2.current = true, n2(
|
|
1242
|
+
t2 && !i2.current && (i2.current = true, n2(sr({ referralInfo: r2().searchParams.get(un.referral) ?? void 0 })));
|
|
1249
1243
|
}, [t2, n2, r2]);
|
|
1250
1244
|
};
|
|
1251
|
-
var
|
|
1252
|
-
var
|
|
1253
|
-
var
|
|
1245
|
+
var Sr = K({ addOnGroups: J, hasError: false });
|
|
1246
|
+
var Cr = (e2) => ({ addOnGroups: e2, hasError: false });
|
|
1247
|
+
var wr = () => ({ addOnGroups: J, hasError: true });
|
|
1254
1248
|
var $ = n(null);
|
|
1255
|
-
function
|
|
1249
|
+
function Tr() {
|
|
1256
1250
|
let e2 = i($);
|
|
1257
|
-
if (!e2) throw Error(
|
|
1251
|
+
if (!e2) throw Error(An);
|
|
1258
1252
|
return e2;
|
|
1259
1253
|
}
|
|
1260
|
-
function
|
|
1261
|
-
let { addOnGroups: l2, hasError: u2 } =
|
|
1254
|
+
function Er({ addOnsPromise: e2, isLoading: t2, pickedAddOns: n2, forwardToggleAddOn: i2, forwardSetAddOnQuantity: a2, children: c2 }) {
|
|
1255
|
+
let { addOnGroups: l2, hasError: u2 } = Sn(e2), d2 = o(() => B(l2, n2), [l2, n2]), p2 = o(() => sn(l2, d2), [l2, d2]), m2 = s({ source: n2, picks: n2 });
|
|
1262
1256
|
m2.current.source !== n2 && (m2.current = { source: n2, picks: n2 });
|
|
1263
1257
|
let h2 = (e3) => {
|
|
1264
1258
|
let t3 = m2.current;
|
|
1265
|
-
t3.picks =
|
|
1259
|
+
t3.picks = V(e3({ serviceId: ``, addOns: t3.picks }));
|
|
1266
1260
|
}, g2 = r(() => {
|
|
1267
|
-
let e3 = m2.current, t3 =
|
|
1261
|
+
let e3 = m2.current, t3 = B(l2, e3.picks);
|
|
1268
1262
|
return e3.picks.filter((e4) => !t3.includes(e4)).forEach((e4) => a2(e4.id, 0)), e3.picks = t3, t3;
|
|
1269
1263
|
}, [l2, a2]), _2 = r((e3) => {
|
|
1270
|
-
let n3 =
|
|
1271
|
-
!t2 &&
|
|
1264
|
+
let n3 = B(l2, m2.current.picks);
|
|
1265
|
+
!t2 && cn(l2, n3, e3) && (g2(), i2(e3), h2((t3) => dn(t3, e3)));
|
|
1272
1266
|
}, [t2, l2, g2, i2]), v2 = r((e3, n3) => {
|
|
1273
|
-
let r2 = t2 ? null :
|
|
1267
|
+
let r2 = t2 ? null : rn(l2, e3);
|
|
1274
1268
|
if (!r2) return;
|
|
1275
|
-
let i3 =
|
|
1276
|
-
s2 === o2 || o2 === 0 && !
|
|
1277
|
-
}, [t2, l2, g2, a2]),
|
|
1278
|
-
return f($.Provider, { value:
|
|
1269
|
+
let i3 = B(l2, m2.current.picks), o2 = i3.find((t3) => t3.id === e3)?.quantity ?? 0, s2 = ln(r2, n3);
|
|
1270
|
+
s2 === o2 || o2 === 0 && !cn(l2, i3, e3) || (g2(), a2(e3, s2), h2((t3) => fn(t3, e3, s2)));
|
|
1271
|
+
}, [t2, l2, g2, a2]), ee2 = o(() => ({ addOnGroups: p2, selected: d2, isLoading: t2, hasError: u2, toggleAddOn: _2, setAddOnQuantity: v2 }), [p2, d2, t2, u2, _2, v2]);
|
|
1272
|
+
return f($.Provider, { value: ee2, children: c2 });
|
|
1279
1273
|
}
|
|
1280
|
-
function
|
|
1274
|
+
function Dr({ children: e2 }) {
|
|
1281
1275
|
let { service: n2, serviceId: r2, hasAddOns: i2, locale: a2, isLoading: s2, bookingsSettingsLoading: c2, selection: u2, toggleAddOn: d2, setAddOnQuantity: p2 } = l();
|
|
1282
|
-
|
|
1283
|
-
let m2 = o(() =>
|
|
1284
|
-
return f(
|
|
1276
|
+
xr(vr.SERVICE_ADD_ONS, !s2 && !c2);
|
|
1277
|
+
let m2 = o(() => V(u2), [u2]), h2 = On(), g2 = n2 && i2 && r2 ? r2 : null, _2 = o(() => g2 ? wn(ar({ serviceId: g2, locale: a2, warmupData: h2 }), Cr, wr) : Sr, [g2, a2]), v2 = !g2 && !!s2;
|
|
1278
|
+
return f(xn, { fallback: f(Nn, { children: e2 }), feature: W.serviceAddOns, children: f(t, { fallback: f(Mn, { children: e2 }), children: f(Er, { addOnsPromise: _2, isLoading: v2, pickedAddOns: m2, forwardToggleAddOn: d2, forwardSetAddOnQuantity: p2, children: e2 }) }) });
|
|
1285
1279
|
}
|
|
1286
|
-
var
|
|
1280
|
+
var Or = nn;
|
|
1287
1281
|
export {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1282
|
+
Dr as ServiceAddOnsContextProvider,
|
|
1283
|
+
Dr as default,
|
|
1284
|
+
Or as injectAccessTokenGetter,
|
|
1291
1285
|
$ as serviceAddOnsContext,
|
|
1292
|
-
|
|
1286
|
+
Tr as useServiceAddOnsContext
|
|
1293
1287
|
};
|
|
1294
|
-
//# sourceMappingURL=context-service-addons
|
|
1288
|
+
//# sourceMappingURL=context-service-addons.mjs.map
|