@wix/bookings 1.0.1749 → 1.0.1751
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/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/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/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/{es/context-service-context.d.mts → cjs/context-service.d.ts} +1 -1
- 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 +43 -43
- 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-booking-checkout-context → context-booking-checkout}/runtime.d.ts +0 -0
- /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-booking-checkout-context.d.ts → context-booking-checkout.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-booking-checkout-context.d.mts → context-booking-checkout.d.mts} +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-booking-checkout-context.d.ts → context-booking-checkout.d.ts} +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-booking-checkout-context.d.mts → context-booking-checkout.d.mts} +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
|
@@ -17,20 +17,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// context-service-addons
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
ServiceAddOnsContextProvider: () =>
|
|
24
|
-
default: () =>
|
|
25
|
-
injectAccessTokenGetter: () =>
|
|
20
|
+
// context-service-addons.ts
|
|
21
|
+
var context_service_addons_exports = {};
|
|
22
|
+
__export(context_service_addons_exports, {
|
|
23
|
+
ServiceAddOnsContextProvider: () => Dr,
|
|
24
|
+
default: () => Dr,
|
|
25
|
+
injectAccessTokenGetter: () => Or,
|
|
26
26
|
serviceAddOnsContext: () => $,
|
|
27
|
-
useServiceAddOnsContext: () =>
|
|
27
|
+
useServiceAddOnsContext: () => Tr
|
|
28
28
|
});
|
|
29
|
-
module.exports = __toCommonJS(
|
|
29
|
+
module.exports = __toCommonJS(context_service_addons_exports);
|
|
30
30
|
|
|
31
|
-
// _sdk-exports/context-service-addons
|
|
31
|
+
// _sdk-exports/context-service-addons/runtime.js
|
|
32
32
|
var import_react = require("react");
|
|
33
|
-
var
|
|
33
|
+
var import_service = require("@wix/bookings/context/service");
|
|
34
34
|
var import_services_manager_react = require("@wix/services-manager-react");
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var p = {};
|
|
@@ -83,8 +83,8 @@ var g = (e2) => (t2) => async (n2) => {
|
|
|
83
83
|
};
|
|
84
84
|
var _ = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
|
|
85
85
|
var v = `__metadata`;
|
|
86
|
-
var
|
|
87
|
-
var
|
|
86
|
+
var ee = `edge.wixapis.com`;
|
|
87
|
+
var te = class extends Error {
|
|
88
88
|
message;
|
|
89
89
|
response;
|
|
90
90
|
constructor(e2, t2) {
|
|
@@ -92,24 +92,24 @@ var ee = class extends Error {
|
|
|
92
92
|
}
|
|
93
93
|
async details() {
|
|
94
94
|
let e2 = await this.response.json();
|
|
95
|
-
return
|
|
95
|
+
return ne(this.response.status, e2?.message, e2?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e2 });
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
var
|
|
99
|
-
var
|
|
100
|
-
var
|
|
101
|
-
var
|
|
102
|
-
function
|
|
98
|
+
var ne = (e2, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
99
|
+
var re = (e2) => e2?.method && [`post`, `put`, `patch`].includes(e2.method.toLocaleLowerCase()) && e2.body ? { "Content-Type": `application/json` } : {};
|
|
100
|
+
var ie = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
|
|
101
|
+
var ae = (e2) => e2.__type === `host`;
|
|
102
|
+
function oe(e2, t2) {
|
|
103
103
|
return e2.create(t2);
|
|
104
104
|
}
|
|
105
|
-
var
|
|
106
|
-
function
|
|
107
|
-
return { [
|
|
105
|
+
var se = `x-wix-bi-gateway`;
|
|
106
|
+
function ce(e2, t2, n2) {
|
|
107
|
+
return { [se]: le({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function le(e2) {
|
|
110
110
|
return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function ue(e2) {
|
|
113
113
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
114
114
|
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);
|
|
115
115
|
try {
|
|
@@ -118,82 +118,82 @@ function le(e2) {
|
|
|
118
118
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
var
|
|
122
|
-
function
|
|
123
|
-
return
|
|
121
|
+
var de = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
122
|
+
function y(e2) {
|
|
123
|
+
return ge(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
124
124
|
}
|
|
125
|
-
var
|
|
126
|
-
var
|
|
127
|
-
var
|
|
128
|
-
var
|
|
129
|
-
function
|
|
125
|
+
var fe = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
126
|
+
var pe = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
127
|
+
var me = `$1\0$2`;
|
|
128
|
+
var he = /[^\p{L}\d]+/giu;
|
|
129
|
+
function ge(e2) {
|
|
130
130
|
let t2 = e2.trim();
|
|
131
|
-
t2 = t2.replace(
|
|
131
|
+
t2 = t2.replace(fe, me).replace(pe, me), t2 = t2.replace(he, `\0`);
|
|
132
132
|
let n2 = 0, r2 = t2.length;
|
|
133
133
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
134
134
|
if (n2 === r2) return [];
|
|
135
135
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
136
136
|
return t2.slice(n2, r2).split(/\0/g);
|
|
137
137
|
}
|
|
138
|
-
var
|
|
139
|
-
var
|
|
140
|
-
var
|
|
141
|
-
function
|
|
138
|
+
var _e = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
139
|
+
var ve = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
140
|
+
var ye = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
141
|
+
function be(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
142
142
|
if (typeof e2 != `object` || !e2) throw e2;
|
|
143
|
-
if (
|
|
144
|
-
if (
|
|
145
|
-
if (
|
|
146
|
-
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code:
|
|
147
|
-
return
|
|
143
|
+
if (_e(e2)) return xe(e2, t2, n2);
|
|
144
|
+
if (ve(e2)) return Se(e2);
|
|
145
|
+
if (ye(e2)) {
|
|
146
|
+
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 };
|
|
147
|
+
return b(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
148
148
|
}
|
|
149
|
-
return
|
|
149
|
+
return Ce(e2);
|
|
150
150
|
}
|
|
151
|
-
var
|
|
152
|
-
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 =
|
|
153
|
-
return
|
|
151
|
+
var xe = (e2, t2, n2) => {
|
|
152
|
+
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 };
|
|
153
|
+
return b(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
154
154
|
};
|
|
155
|
-
var
|
|
156
|
-
var
|
|
157
|
-
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 ??
|
|
158
|
-
return
|
|
155
|
+
var b = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
156
|
+
var Se = (e2) => {
|
|
157
|
+
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 };
|
|
158
|
+
return b(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
159
159
|
};
|
|
160
|
-
var
|
|
161
|
-
var
|
|
160
|
+
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 } } });
|
|
161
|
+
var we = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
162
162
|
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
163
163
|
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
164
164
|
let r3 = t2[e3.field];
|
|
165
|
-
if (r3) return { ...e3, field:
|
|
165
|
+
if (r3) return { ...e3, field: x(r3, i2) };
|
|
166
166
|
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
167
167
|
if (s2) {
|
|
168
168
|
let t3 = a2[s2];
|
|
169
|
-
if (t3) return { ...e3, field: e3.field.replace(s2,
|
|
169
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, x(t3, i2)) };
|
|
170
170
|
}
|
|
171
171
|
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
172
172
|
});
|
|
173
173
|
};
|
|
174
|
-
var
|
|
175
|
-
let n2 =
|
|
174
|
+
var x = (e2, t2) => {
|
|
175
|
+
let n2 = Te(e2);
|
|
176
176
|
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
177
177
|
};
|
|
178
|
-
var
|
|
178
|
+
var Te = (e2) => {
|
|
179
179
|
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
180
180
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
181
181
|
};
|
|
182
|
-
function
|
|
183
|
-
return
|
|
182
|
+
function Ee(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
183
|
+
return ue(() => e2({ request: async (e3) => {
|
|
184
184
|
let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
185
185
|
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
186
|
-
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ?
|
|
186
|
+
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? ee : o3}${a3.url}`;
|
|
187
187
|
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
188
188
|
try {
|
|
189
|
-
let e4 =
|
|
189
|
+
let e4 = ce(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
|
|
190
190
|
if (s3.status !== 200) {
|
|
191
191
|
let e5 = null;
|
|
192
192
|
try {
|
|
193
193
|
e5 = await s3.json();
|
|
194
194
|
} catch {
|
|
195
195
|
}
|
|
196
|
-
let t3 =
|
|
196
|
+
let t3 = Oe(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = be(t3);
|
|
197
197
|
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
198
198
|
}
|
|
199
199
|
let l3 = await s3.json();
|
|
@@ -203,18 +203,18 @@ function Te(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
|
203
203
|
}
|
|
204
204
|
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
205
205
|
}
|
|
206
|
-
var
|
|
206
|
+
var De = class extends Error {
|
|
207
207
|
response;
|
|
208
208
|
requestId;
|
|
209
209
|
constructor(e2) {
|
|
210
210
|
super(), this.response = e2.response, this.requestId = e2.requestId;
|
|
211
211
|
}
|
|
212
212
|
};
|
|
213
|
-
var
|
|
214
|
-
var
|
|
215
|
-
function
|
|
213
|
+
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 });
|
|
214
|
+
var ke = `.`;
|
|
215
|
+
function Ae(e2, t2, n2) {
|
|
216
216
|
if (e2 == null) throw Error(`Cannot set value on null or undefined`);
|
|
217
|
-
let r2 =
|
|
217
|
+
let r2 = S(t2), i2 = e2;
|
|
218
218
|
for (let e3 = 0; e3 < r2.length; e3++) {
|
|
219
219
|
let t3 = r2[e3];
|
|
220
220
|
if (e3 === r2.length - 1) {
|
|
@@ -226,21 +226,21 @@ function ke(e2, t2, n2) {
|
|
|
226
226
|
}
|
|
227
227
|
return e2;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
230
|
-
return Array.isArray(e2) ? e2 : e2.split(
|
|
229
|
+
function S(e2) {
|
|
230
|
+
return Array.isArray(e2) ? e2 : e2.split(ke).map((e3) => je(e3) ? Number(e3) : e3);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function je(e2) {
|
|
233
233
|
return /^\d+$/.test(e2);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function Me(e2) {
|
|
236
236
|
let t2 = {};
|
|
237
|
-
for (let [n2, r2] of Object.entries(e2))
|
|
237
|
+
for (let [n2, r2] of Object.entries(e2)) Ne(n2) || Ae(t2, S(n2), r2);
|
|
238
238
|
return t2;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function Ne(e2) {
|
|
241
241
|
return e2 === `__proto__` || e2 === `constructor` || e2 === `prototype`;
|
|
242
242
|
}
|
|
243
|
-
var
|
|
243
|
+
var Pe = class {
|
|
244
244
|
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
245
245
|
NUMERIC_PATTERN = /^\d+$/;
|
|
246
246
|
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
@@ -263,7 +263,7 @@ var Ne = class {
|
|
|
263
263
|
return e2.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
264
264
|
}
|
|
265
265
|
unflatten() {
|
|
266
|
-
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])),
|
|
266
|
+
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])), Me(this.cleanedModifiedFields);
|
|
267
267
|
}
|
|
268
268
|
flatten(e2) {
|
|
269
269
|
let t2 = {};
|
|
@@ -283,12 +283,12 @@ var Ne = class {
|
|
|
283
283
|
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
284
284
|
r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
|
|
285
285
|
}, a2 = (e3, t3) => {
|
|
286
|
-
let i3 = e3 in
|
|
286
|
+
let i3 = e3 in de ? de[e3] : void 0;
|
|
287
287
|
if (i3 && i3 in t3) {
|
|
288
288
|
r2.push(i3), n2 = t3[i3];
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
|
-
let a3 =
|
|
291
|
+
let a3 = Re(e3);
|
|
292
292
|
if (a3 && a3 in t3) {
|
|
293
293
|
r2.push(a3), n2 = t3[a3];
|
|
294
294
|
return;
|
|
@@ -319,28 +319,28 @@ var Ne = class {
|
|
|
319
319
|
return e2.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e2[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
320
320
|
}
|
|
321
321
|
};
|
|
322
|
-
function
|
|
322
|
+
function Fe(e2, t2) {
|
|
323
323
|
let n2 = e2?.modifiedFields;
|
|
324
324
|
if (!n2) return null;
|
|
325
|
-
let r2 =
|
|
325
|
+
let r2 = Ie(n2);
|
|
326
326
|
if (!r2) return null;
|
|
327
327
|
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
328
328
|
e2 = { ...e2, modifiedFields: i2 };
|
|
329
329
|
let o2 = t2(e2), s2 = o2?.modifiedFields;
|
|
330
330
|
if (!s2) return null;
|
|
331
|
-
let c2 =
|
|
331
|
+
let c2 = Le(s2, a2);
|
|
332
332
|
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function Ie(e2) {
|
|
335
335
|
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
336
|
-
let t2 = new
|
|
336
|
+
let t2 = new Pe(e2);
|
|
337
337
|
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
338
338
|
} catch {
|
|
339
339
|
return null;
|
|
340
340
|
}
|
|
341
341
|
return null;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
343
|
+
function Le(e2, t2) {
|
|
344
344
|
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
345
345
|
return t2.flatten(e2);
|
|
346
346
|
} catch {
|
|
@@ -348,10 +348,10 @@ function Ie(e2, t2) {
|
|
|
348
348
|
}
|
|
349
349
|
return null;
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Re(e2) {
|
|
352
352
|
return e2.replace(/[-_\s]+(.)?/g, (e3, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e3) => e3.toLowerCase());
|
|
353
353
|
}
|
|
354
|
-
function
|
|
354
|
+
function C() {
|
|
355
355
|
return { emit(e2, ...t2) {
|
|
356
356
|
for (let n2 = 0, r2 = this.events[e2] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
357
357
|
}, events: {}, on(e2, t2) {
|
|
@@ -360,8 +360,8 @@ function w() {
|
|
|
360
360
|
};
|
|
361
361
|
} };
|
|
362
362
|
}
|
|
363
|
-
var
|
|
364
|
-
function
|
|
363
|
+
var ze = (e2) => e2.__type === `event-definition`;
|
|
364
|
+
function w(e2, t2, n2, r2) {
|
|
365
365
|
let i2;
|
|
366
366
|
if (e2.isDomainEvent) {
|
|
367
367
|
let { deletedEvent: e3, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
@@ -372,14 +372,14 @@ function T(e2, t2, n2, r2) {
|
|
|
372
372
|
let e3 = s2.modifiedFields;
|
|
373
373
|
if (typeof e3 == `object` && e3 && !Array.isArray(e3)) {
|
|
374
374
|
o2 = structuredClone(i2);
|
|
375
|
-
let e4 =
|
|
375
|
+
let e4 = Fe(s2, a2);
|
|
376
376
|
if (e4) return t2(e4);
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
379
|
return t2(a2(o2));
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
381
|
+
function Be(e2) {
|
|
382
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = C();
|
|
383
383
|
return { initModule(e3) {
|
|
384
384
|
return (r2) => {
|
|
385
385
|
let i2 = t2.get(e3.type) ?? [];
|
|
@@ -389,7 +389,7 @@ function ze(e2) {
|
|
|
389
389
|
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 }))];
|
|
390
390
|
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(`, `)}`);
|
|
391
391
|
let l2 = t2.get(r2) ?? [];
|
|
392
|
-
return await Promise.all(l2.map(({ eventDefinition: e4, handler: t3 }) =>
|
|
392
|
+
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 };
|
|
393
393
|
}, async processRequest(e3, t3) {
|
|
394
394
|
let n3 = await e3.text();
|
|
395
395
|
return this.process(n3, t3);
|
|
@@ -408,12 +408,12 @@ function ze(e2) {
|
|
|
408
408
|
let n3 = Array.from(t2.keys()).map((e4) => ({ type: e4 }));
|
|
409
409
|
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(`, `)}`);
|
|
410
410
|
let r2 = t2.get(e3.eventType) ?? [];
|
|
411
|
-
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) =>
|
|
411
|
+
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => w(t3, n4, e3.payload, { instanceId: e3.instanceId, identity: e3.identity })));
|
|
412
412
|
}, apps: { AppInstalled: m(`AppInstalled`)(), AppRemoved: m(`AppRemoved`)() } } };
|
|
413
413
|
}
|
|
414
|
-
var
|
|
415
|
-
function
|
|
416
|
-
let t2 = /* @__PURE__ */ new Map(), n2 =
|
|
414
|
+
var Ve = (e2) => e2.__type === `service-plugin-definition`;
|
|
415
|
+
function He(e2) {
|
|
416
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = C();
|
|
417
417
|
return { initModule(e3) {
|
|
418
418
|
return (r2) => {
|
|
419
419
|
let i2 = t2.get(e3.componentType.toLowerCase()) ?? [];
|
|
@@ -454,43 +454,43 @@ function Ve(e2) {
|
|
|
454
454
|
return s2.transformations.toREST(await c2(s2.transformations.fromREST(e3)));
|
|
455
455
|
} } };
|
|
456
456
|
}
|
|
457
|
-
var
|
|
458
|
-
function
|
|
457
|
+
var T = `X-Wix-Consistent`;
|
|
458
|
+
function Ue(e2) {
|
|
459
459
|
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) => {
|
|
460
|
-
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [
|
|
460
|
+
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?.();
|
|
461
461
|
try {
|
|
462
462
|
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
463
463
|
let e3 = await i3(n3, { ...r3, headers: c3 });
|
|
464
464
|
l3?.handleError(e3, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
465
|
-
let a3 =
|
|
466
|
-
return a3 && (t2[
|
|
465
|
+
let a3 = E(e3);
|
|
466
|
+
return a3 && (t2[T] = a3), e3;
|
|
467
467
|
}
|
|
468
468
|
{
|
|
469
469
|
for (let [e4, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e4, t3);
|
|
470
470
|
let e3 = await i3(n3, r3);
|
|
471
471
|
l3?.handleError(e3, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
472
|
-
let a3 =
|
|
473
|
-
return a3 && (t2[
|
|
472
|
+
let a3 = E(e3);
|
|
473
|
+
return a3 && (t2[T] = a3), e3;
|
|
474
474
|
}
|
|
475
475
|
} catch (e3) {
|
|
476
476
|
throw l3?.handleError(e3, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e3;
|
|
477
477
|
}
|
|
478
|
-
}, { client: c2, initModule: l2 } =
|
|
479
|
-
let i3 = o2(), s3 = await a2(), c3 =
|
|
480
|
-
return u3 && (t2[
|
|
478
|
+
}, { client: c2, initModule: l2 } = He(i2), { client: u2, initModule: d2 } = Be(i2), f2 = async (n3, r3) => {
|
|
479
|
+
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);
|
|
480
|
+
return u3 && (t2[T] = u3), l3;
|
|
481
481
|
}, m2 = (t3, n3) => {
|
|
482
|
-
if (
|
|
483
|
-
if (
|
|
484
|
-
if (
|
|
482
|
+
if (ze(t3)) return d2(t3);
|
|
483
|
+
if (Ve(t3)) return l2(t3);
|
|
484
|
+
if (ae(t3) && e2.host) return oe(t3, e2.host);
|
|
485
485
|
if (typeof t3 == `function`) {
|
|
486
486
|
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
487
487
|
let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
|
|
488
|
-
return
|
|
488
|
+
return Ee(ue(() => _(t3)) ? g(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
|
|
489
489
|
let n4 = new URL(e3, `https://${r3}`);
|
|
490
490
|
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
491
491
|
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
|
|
492
492
|
}
|
|
493
|
-
return
|
|
493
|
+
return ie(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, m2(n4, t3[v])])) : t3;
|
|
494
494
|
}, h2 = (e3) => {
|
|
495
495
|
for (let n3 in e3) t2[n3] = e3[n3];
|
|
496
496
|
};
|
|
@@ -504,24 +504,24 @@ function He(e2) {
|
|
|
504
504
|
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
505
505
|
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
506
506
|
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 }) });
|
|
507
|
-
if (a3.status !== 200) throw new
|
|
507
|
+
if (a3.status !== 200) throw new te(`GraphQL request failed with status ${a3.status}`, a3);
|
|
508
508
|
let { data: o3, errors: s3 } = await a3.json();
|
|
509
509
|
return { data: o3 ?? {}, errors: s3 };
|
|
510
510
|
}, webhooks: u2, servicePlugins: c2 };
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function E(e2) {
|
|
513
513
|
return e2.headers?.get(`X-Wix-Consistent`) ?? e2.headers?.get(`x-wix-consistent`);
|
|
514
514
|
}
|
|
515
|
-
var
|
|
516
|
-
var
|
|
517
|
-
function
|
|
515
|
+
var We = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
516
|
+
var Ge = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
517
|
+
function Ke(e2, t2) {
|
|
518
518
|
return e2?.split(`.`).map((e3) => t2?.[e3] ?? e3).join(`.`);
|
|
519
519
|
}
|
|
520
|
-
var
|
|
520
|
+
var D = `sort.fieldName`;
|
|
521
521
|
function qe(e2, t2, n2) {
|
|
522
|
-
return (e2 ===
|
|
522
|
+
return (e2 === D || e2.endsWith(`.${D}`)) && typeof t2 == `string` ? Ke(t2, n2) : t2;
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function O(e2, t2, n2) {
|
|
525
525
|
let r2 = (e3) => n2.includes(e3), i2 = (e3, n3) => {
|
|
526
526
|
if (Array.isArray(e3)) e3.forEach((e4) => {
|
|
527
527
|
i2(e4, n3);
|
|
@@ -531,144 +531,144 @@ function Je(e2, t2, n2) {
|
|
|
531
531
|
Object.keys(a2).forEach((e4) => {
|
|
532
532
|
let o2 = n3 === `` ? e4 : `${n3}.${e4}`;
|
|
533
533
|
if (r2(o2)) return;
|
|
534
|
-
let s2 =
|
|
534
|
+
let s2 = Je(e4, t2);
|
|
535
535
|
s2 !== e4 && !(s2 in a2) && (a2[s2] = a2[e4], delete a2[e4]), a2[s2] = qe(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
538
|
};
|
|
539
539
|
return i2(e2, ``), e2;
|
|
540
540
|
}
|
|
541
|
-
function
|
|
541
|
+
function Je(e2, t2) {
|
|
542
542
|
let n2;
|
|
543
543
|
return n2 = e2.includes(`.`) ? e2.split(`.`).map((e3) => t2[e3] ?? e3).join(`.`) : t2[e2] ?? e2, n2;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
546
|
-
return
|
|
545
|
+
function Ye(e2, t2 = []) {
|
|
546
|
+
return O(e2, We, t2);
|
|
547
547
|
}
|
|
548
|
-
function
|
|
549
|
-
return
|
|
548
|
+
function Xe(e2, t2 = []) {
|
|
549
|
+
return O(e2, Ge, t2);
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function Ze(e2) {
|
|
552
552
|
return e2 ? new Date(e2) : void 0;
|
|
553
553
|
}
|
|
554
|
-
var
|
|
555
|
-
function
|
|
554
|
+
var k = /* @__PURE__ */ new WeakMap();
|
|
555
|
+
function A() {
|
|
556
556
|
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
557
557
|
}
|
|
558
|
-
function
|
|
558
|
+
function j(e2, t2) {
|
|
559
559
|
let n2 = e2.get(t2);
|
|
560
|
-
return n2 || (n2 =
|
|
560
|
+
return n2 || (n2 = A(), e2.set(t2, n2)), n2;
|
|
561
561
|
}
|
|
562
|
-
function
|
|
563
|
-
return t2 === `*` ? (e2.anyField ??=
|
|
562
|
+
function Qe(e2, t2) {
|
|
563
|
+
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));
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
let t2 =
|
|
565
|
+
function $e(e2) {
|
|
566
|
+
let t2 = A();
|
|
567
567
|
for (let n2 of e2) {
|
|
568
|
-
let e3 = n2.path.split(`.`).reduce(
|
|
568
|
+
let e3 = n2.path.split(`.`).reduce(Qe, t2);
|
|
569
569
|
e3.leaves ??= [], e3.leaves.push(n2);
|
|
570
570
|
}
|
|
571
571
|
return t2;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
574
|
-
let t2 =
|
|
575
|
-
return t2 || (t2 =
|
|
573
|
+
function et(e2) {
|
|
574
|
+
let t2 = k.get(e2);
|
|
575
|
+
return t2 || (t2 = $e(e2), k.set(e2, t2)), t2;
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function M(e2) {
|
|
578
578
|
return typeof e2 == `object` && !!e2;
|
|
579
579
|
}
|
|
580
|
-
function
|
|
581
|
-
return t2 ? Array.isArray(e2) ? e2.map(r2) : e2 : n2 ?
|
|
580
|
+
function tt(e2, { isRepeated: t2, isMap: n2 }, r2) {
|
|
581
|
+
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);
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
583
|
+
function N(e2, t2, n2) {
|
|
584
|
+
M(e2) && P(e2, t2, n2);
|
|
585
585
|
}
|
|
586
|
-
function
|
|
586
|
+
function nt(e2, t2, n2) {
|
|
587
587
|
for (let [r2, i2] of t2) {
|
|
588
588
|
if (!(r2 in e2)) continue;
|
|
589
|
-
if (i2.leaves) for (let t4 of i2.leaves) e2[r2] =
|
|
589
|
+
if (i2.leaves) for (let t4 of i2.leaves) e2[r2] = tt(e2[r2], t4, n2);
|
|
590
590
|
let t3 = e2[r2];
|
|
591
|
-
Array.isArray(t3) ? t3.forEach((e3) =>
|
|
591
|
+
Array.isArray(t3) ? t3.forEach((e3) => N(e3, i2, n2)) : N(t3, i2, n2);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
function
|
|
594
|
+
function rt(e2, t2, n2) {
|
|
595
595
|
for (let [r2, i2] of t2) {
|
|
596
596
|
let t3 = e2[r2];
|
|
597
|
-
|
|
597
|
+
M(t3) && Object.values(t3).forEach((e3) => N(e3, i2, n2));
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
function
|
|
601
|
-
t2 &&
|
|
600
|
+
function P(e2, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
601
|
+
t2 && nt(e2, t2, i2), n2 && rt(e2, n2, i2), r2 && Object.values(e2).forEach((e3) => N(e3, r2, i2));
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
if (!
|
|
605
|
-
for (let { paths: n2, transformFn: r2 } of t2)
|
|
603
|
+
function it(e2, t2) {
|
|
604
|
+
if (!M(e2)) return e2;
|
|
605
|
+
for (let { paths: n2, transformFn: r2 } of t2) P(e2, et(n2), r2);
|
|
606
606
|
return e2;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
609
|
-
return
|
|
608
|
+
function F(e2) {
|
|
609
|
+
return lt(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
610
610
|
}
|
|
611
|
-
var
|
|
612
|
-
var
|
|
613
|
-
var
|
|
614
|
-
var
|
|
615
|
-
function
|
|
611
|
+
var at = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
612
|
+
var ot = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
613
|
+
var st = `$1\0$2`;
|
|
614
|
+
var ct = /[^\p{L}\d]+/giu;
|
|
615
|
+
function lt(e2) {
|
|
616
616
|
let t2 = e2.trim();
|
|
617
|
-
t2 = t2.replace(
|
|
617
|
+
t2 = t2.replace(at, st).replace(ot, st), t2 = t2.replace(ct, `\0`);
|
|
618
618
|
let n2 = 0, r2 = t2.length;
|
|
619
619
|
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
620
620
|
if (n2 === r2) return [];
|
|
621
621
|
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
622
622
|
return t2.slice(n2, r2).split(/\0/g);
|
|
623
623
|
}
|
|
624
|
-
var
|
|
625
|
-
var
|
|
626
|
-
var
|
|
627
|
-
function
|
|
624
|
+
var ut = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
625
|
+
var dt = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
626
|
+
var ft = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
627
|
+
function pt(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
628
628
|
if (typeof e2 != `object` || !e2) throw e2;
|
|
629
|
-
if (
|
|
630
|
-
if (
|
|
631
|
-
if (
|
|
632
|
-
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code:
|
|
633
|
-
return
|
|
629
|
+
if (ut(e2)) return mt(e2, t2, n2);
|
|
630
|
+
if (dt(e2)) return ht(e2);
|
|
631
|
+
if (ft(e2)) {
|
|
632
|
+
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 };
|
|
633
|
+
return I(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
634
634
|
}
|
|
635
|
-
return
|
|
635
|
+
return gt(e2);
|
|
636
636
|
}
|
|
637
|
-
var
|
|
638
|
-
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 =
|
|
639
|
-
return
|
|
637
|
+
var mt = (e2, t2, n2) => {
|
|
638
|
+
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 };
|
|
639
|
+
return I(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
640
640
|
};
|
|
641
|
-
var
|
|
642
|
-
var
|
|
643
|
-
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 ??
|
|
644
|
-
return
|
|
641
|
+
var I = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
642
|
+
var ht = (e2) => {
|
|
643
|
+
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 };
|
|
644
|
+
return I(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
645
645
|
};
|
|
646
|
-
var
|
|
647
|
-
var
|
|
646
|
+
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 } } });
|
|
647
|
+
var _t = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
648
648
|
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
649
649
|
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
650
650
|
let r3 = t2[e3.field];
|
|
651
|
-
if (r3) return { ...e3, field:
|
|
651
|
+
if (r3) return { ...e3, field: vt(r3, i2) };
|
|
652
652
|
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
653
653
|
if (s2) {
|
|
654
654
|
let t3 = a2[s2];
|
|
655
|
-
if (t3) return { ...e3, field: e3.field.replace(s2,
|
|
655
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, vt(t3, i2)) };
|
|
656
656
|
}
|
|
657
657
|
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
658
658
|
});
|
|
659
659
|
};
|
|
660
|
-
var
|
|
661
|
-
let n2 =
|
|
660
|
+
var vt = (e2, t2) => {
|
|
661
|
+
let n2 = yt(e2);
|
|
662
662
|
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
663
663
|
};
|
|
664
|
-
var
|
|
664
|
+
var yt = (e2) => {
|
|
665
665
|
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
666
666
|
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
667
667
|
};
|
|
668
|
-
function
|
|
668
|
+
function bt() {
|
|
669
669
|
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
670
670
|
if (e2) return { initWixModules(t3, n3) {
|
|
671
|
-
return
|
|
671
|
+
return L(() => e2(t3, n3));
|
|
672
672
|
}, fetchWithAuth() {
|
|
673
673
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
674
674
|
}, graphql() {
|
|
@@ -678,10 +678,10 @@ function St() {
|
|
|
678
678
|
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
679
679
|
if (r2) {
|
|
680
680
|
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`);
|
|
681
|
-
return
|
|
681
|
+
return L(() => n2.use(e3));
|
|
682
682
|
}
|
|
683
683
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
684
|
-
return
|
|
684
|
+
return L(() => t2.use(e3));
|
|
685
685
|
}, fetchWithAuth: (e3, n3) => {
|
|
686
686
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
687
687
|
return t2.fetchWithAuth(e3, n3);
|
|
@@ -693,7 +693,7 @@ function St() {
|
|
|
693
693
|
return t2.graphql(e3, n3, r2);
|
|
694
694
|
} };
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function L(e2) {
|
|
697
697
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
698
698
|
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);
|
|
699
699
|
try {
|
|
@@ -702,78 +702,78 @@ function F(e2) {
|
|
|
702
702
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function xt(e2, t2) {
|
|
706
706
|
return (...n2) => {
|
|
707
|
-
let r2 =
|
|
707
|
+
let r2 = bt();
|
|
708
708
|
return r2 ? r2.initWixModules(e2, t2).apply(void 0, n2) : e2.apply(void 0, n2);
|
|
709
709
|
};
|
|
710
710
|
}
|
|
711
|
-
function
|
|
712
|
-
return
|
|
713
|
-
}
|
|
714
|
-
function
|
|
715
|
-
let t2 =
|
|
716
|
-
return
|
|
717
|
-
}
|
|
718
|
-
var
|
|
719
|
-
var
|
|
720
|
-
var
|
|
721
|
-
var
|
|
722
|
-
var
|
|
723
|
-
var
|
|
724
|
-
var
|
|
725
|
-
var
|
|
726
|
-
var
|
|
727
|
-
var
|
|
728
|
-
function
|
|
729
|
-
return
|
|
730
|
-
}
|
|
731
|
-
function
|
|
732
|
-
return
|
|
733
|
-
}
|
|
734
|
-
function
|
|
711
|
+
function St(e2, t2 = false) {
|
|
712
|
+
return xt(e2, t2);
|
|
713
|
+
}
|
|
714
|
+
function Ct(e2) {
|
|
715
|
+
let t2 = It(Pt(e2.host), e2.domainToMappings);
|
|
716
|
+
return Gt(Ht(e2.protoPath, e2.data || {}), t2);
|
|
717
|
+
}
|
|
718
|
+
var wt = [`wix.com`, `editorx.com`];
|
|
719
|
+
var Tt = `_`;
|
|
720
|
+
var Et = `*.`;
|
|
721
|
+
var Dt = RegExp(`\\.(${wt.join(`|`)})$`);
|
|
722
|
+
var Ot = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
723
|
+
var kt = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
724
|
+
var At = `dev.wix-code.com`;
|
|
725
|
+
var jt = /{(.*)}/;
|
|
726
|
+
var Mt = RegExp(`\\.(${Ot.join(`|`)})$`);
|
|
727
|
+
var Nt = RegExp(`.*\\.${At}$`);
|
|
728
|
+
function Pt(e2) {
|
|
729
|
+
return Ft(e2).replace(Dt, `._base_domain_`).replace(Mt, `._api_base_domain_`).replace(Nt, `*.dev.wix-code.com`);
|
|
730
|
+
}
|
|
731
|
+
function Ft(e2) {
|
|
732
|
+
return kt[e2] ?? e2;
|
|
733
|
+
}
|
|
734
|
+
function It(e2, t2) {
|
|
735
735
|
let n2 = t2[e2];
|
|
736
736
|
if (n2) return n2;
|
|
737
|
-
let r2 =
|
|
737
|
+
let r2 = Lt(e2, t2) ?? Rt(e2, t2);
|
|
738
738
|
if (!r2) {
|
|
739
|
-
if (
|
|
740
|
-
let e3 = t2[
|
|
739
|
+
if (Bt(e2)) {
|
|
740
|
+
let e3 = t2[Vt];
|
|
741
741
|
if (e3) return e3;
|
|
742
742
|
}
|
|
743
|
-
let n3 = t2[
|
|
743
|
+
let n3 = t2[Tt];
|
|
744
744
|
if (n3) return n3;
|
|
745
745
|
}
|
|
746
746
|
return r2 ?? [];
|
|
747
747
|
}
|
|
748
|
-
function
|
|
748
|
+
function Lt(e2, t2) {
|
|
749
749
|
return Object.entries(t2).find(([t3]) => {
|
|
750
750
|
let [, ...n2] = e2.split(`.`);
|
|
751
751
|
return n2.join(`.`) === t3;
|
|
752
752
|
})?.[1];
|
|
753
753
|
}
|
|
754
|
-
function
|
|
755
|
-
let [n2] = Object.entries(t2).filter(([t3]) =>
|
|
754
|
+
function Rt(e2, t2) {
|
|
755
|
+
let [n2] = Object.entries(t2).filter(([t3]) => zt(e2, t3)).sort(([e3], [t3]) => t3.length - e3.length);
|
|
756
756
|
if (!n2) return;
|
|
757
757
|
let [, r2] = n2;
|
|
758
758
|
return r2;
|
|
759
759
|
}
|
|
760
|
-
function
|
|
761
|
-
if (!t2.startsWith(
|
|
760
|
+
function zt(e2, t2) {
|
|
761
|
+
if (!t2.startsWith(Et)) return false;
|
|
762
762
|
let n2 = t2.slice(1);
|
|
763
763
|
return e2.length > n2.length && e2.endsWith(n2);
|
|
764
764
|
}
|
|
765
|
-
function
|
|
765
|
+
function Bt(e2) {
|
|
766
766
|
return !!e2.match(/\._base_domain_$/);
|
|
767
767
|
}
|
|
768
|
-
var
|
|
769
|
-
function
|
|
770
|
-
return e2.split(`/`).map((e3) =>
|
|
768
|
+
var Vt = `www._base_domain_`;
|
|
769
|
+
function Ht(e2, t2) {
|
|
770
|
+
return e2.split(`/`).map((e3) => Ut(e3, t2)).join(`/`);
|
|
771
771
|
}
|
|
772
|
-
function
|
|
773
|
-
let n2 = e2.match(
|
|
774
|
-
return r2 ?
|
|
772
|
+
function Ut(e2, t2) {
|
|
773
|
+
let n2 = e2.match(jt) || [], r2 = n2[1];
|
|
774
|
+
return r2 ? Wt(t2, r2, e2, e2.replace(n2[0], ``)) : e2;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Wt(e2, t2, n2, r2) {
|
|
777
777
|
let i2 = e2;
|
|
778
778
|
for (let e3 of t2.split(`.`)) {
|
|
779
779
|
if (!i2) return n2;
|
|
@@ -781,33 +781,33 @@ function Kt(e2, t2, n2, r2) {
|
|
|
781
781
|
}
|
|
782
782
|
return `${i2}${r2}`;
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function Gt(e2, t2) {
|
|
785
785
|
let n2 = t2?.find((t3) => e2.startsWith(t3.destPath));
|
|
786
786
|
return n2 ? n2.srcPath + e2.slice(n2.destPath.length) : e2;
|
|
787
787
|
}
|
|
788
|
-
var
|
|
789
|
-
var
|
|
790
|
-
var
|
|
791
|
-
var
|
|
792
|
-
let e2 =
|
|
793
|
-
if (e2) return { [
|
|
788
|
+
var Kt = `x-wix-linguist`;
|
|
789
|
+
var qt = `00000000-0000-0000-0000-000000000000`;
|
|
790
|
+
var Jt = `false`;
|
|
791
|
+
var Yt = () => {
|
|
792
|
+
let e2 = R(`language`), t2 = R(`locale`);
|
|
793
|
+
if (e2) return { [Kt]: [e2, t2 || e2, Jt, qt].join(`|`) };
|
|
794
794
|
};
|
|
795
|
-
function
|
|
795
|
+
function Xt() {
|
|
796
796
|
let e2 = null, t2 = null;
|
|
797
797
|
return { promise: new Promise((n2, r2) => {
|
|
798
798
|
e2 = n2, t2 = r2;
|
|
799
799
|
}), resolve: e2, reject: t2 };
|
|
800
800
|
}
|
|
801
|
-
var
|
|
802
|
-
var
|
|
803
|
-
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 =
|
|
804
|
-
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language:
|
|
805
|
-
return
|
|
801
|
+
var R = (e2) => typeof window < `u` ? window.commonConfig?.[e2] : void 0;
|
|
802
|
+
var Zt = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host: (t2) => {
|
|
803
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 = $t();
|
|
804
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: R(`language`), locale: R(`locale`), get passThroughHeaders() {
|
|
805
|
+
return Yt();
|
|
806
806
|
} } };
|
|
807
807
|
}, auth: (e3) => {
|
|
808
808
|
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
809
|
-
!e3 &&
|
|
810
|
-
let n2 = false, { resolve: r2, promise: i2 } =
|
|
809
|
+
!e3 && Qt() && (e3 = t2?.getAccessTokenFunction?.());
|
|
810
|
+
let n2 = false, { resolve: r2, promise: i2 } = Xt();
|
|
811
811
|
return { getAuthHeaders: async () => {
|
|
812
812
|
if (!e3 && n2 && (e3 = await i2), !e3) throw Error(`Failed to resolve auth token`);
|
|
813
813
|
return { headers: { Authorization: await e3() } };
|
|
@@ -815,88 +815,88 @@ var $t = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host:
|
|
|
815
815
|
r2(e4);
|
|
816
816
|
}) };
|
|
817
817
|
} });
|
|
818
|
-
function
|
|
818
|
+
function Qt() {
|
|
819
819
|
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
820
820
|
}
|
|
821
|
-
function
|
|
821
|
+
function $t() {
|
|
822
822
|
let e2 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
823
823
|
if (!e2) return;
|
|
824
824
|
let t2 = new URL(e2);
|
|
825
825
|
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
826
826
|
}
|
|
827
|
-
var
|
|
827
|
+
var en = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
828
828
|
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`);
|
|
829
829
|
return e2.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
830
830
|
}, getAccessToken: () => {
|
|
831
831
|
throw Error(`Not implemented`);
|
|
832
832
|
}, observeState: () => ({ disconnect: () => {
|
|
833
833
|
} }) });
|
|
834
|
-
var
|
|
834
|
+
var tn = Zt({ createHost: function(e2) {
|
|
835
835
|
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e2?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e2 || {};
|
|
836
836
|
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
837
|
-
return { channel:
|
|
837
|
+
return { channel: en({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
838
838
|
} };
|
|
839
839
|
} });
|
|
840
|
-
var
|
|
841
|
-
let n2 =
|
|
842
|
-
return
|
|
840
|
+
var nn = ((e2, t2) => {
|
|
841
|
+
let n2 = tn.host({ applicationId: e2, componentId: t2 }), r2 = tn.auth();
|
|
842
|
+
return Ue({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
843
843
|
})(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`);
|
|
844
|
-
function
|
|
844
|
+
function z(e2, t2) {
|
|
845
845
|
for (let n2 of e2) {
|
|
846
846
|
let e3 = n2.addOns.find((e4) => e4.addOnId === t2);
|
|
847
847
|
if (e3) return { group: n2, addOn: e3 };
|
|
848
848
|
}
|
|
849
849
|
return null;
|
|
850
850
|
}
|
|
851
|
-
function
|
|
852
|
-
return
|
|
851
|
+
function rn(e2, t2) {
|
|
852
|
+
return z(e2, t2)?.addOn ?? null;
|
|
853
853
|
}
|
|
854
|
-
function
|
|
855
|
-
return t2.filter((t3) =>
|
|
854
|
+
function B(e2, t2) {
|
|
855
|
+
return t2.filter((t3) => z(e2, t3.id) !== null);
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return n2.filter((n3) =>
|
|
857
|
+
function an(e2, t2, n2) {
|
|
858
|
+
return n2.filter((n3) => z(e2, n3.id)?.group === t2).length;
|
|
859
859
|
}
|
|
860
|
-
function
|
|
860
|
+
function on(e2, t2) {
|
|
861
861
|
return !e2.maxNumberOfAddOns || t2 < e2.maxNumberOfAddOns;
|
|
862
862
|
}
|
|
863
|
-
function
|
|
863
|
+
function sn(e2, t2) {
|
|
864
864
|
return e2.map((n2) => {
|
|
865
|
-
let r2 =
|
|
865
|
+
let r2 = an(e2, n2, t2);
|
|
866
866
|
return { ...n2, addOns: n2.addOns.map((e3) => {
|
|
867
867
|
let n3 = t2.find((t3) => t3.id === e3.addOnId)?.quantity ?? 0;
|
|
868
868
|
return { ...e3, isSelected: n3 > 0, selectedQuantity: n3 };
|
|
869
|
-
}), selectedCount: r2, canSelectMore:
|
|
869
|
+
}), selectedCount: r2, canSelectMore: on(n2, r2) };
|
|
870
870
|
});
|
|
871
871
|
}
|
|
872
|
-
function
|
|
873
|
-
let r2 =
|
|
874
|
-
return r2 ? t2.some((e3) => e3.id === n2) ? true :
|
|
872
|
+
function cn(e2, t2, n2) {
|
|
873
|
+
let r2 = z(e2, n2);
|
|
874
|
+
return r2 ? t2.some((e3) => e3.id === n2) ? true : on(r2.group, an(e2, r2.group, t2)) : false;
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function ln(e2, t2) {
|
|
877
877
|
let n2 = e2.maxQuantity ?? 1;
|
|
878
878
|
return Number.isFinite(t2) ? Math.min(Math.max(Math.trunc(t2), 0), n2) : 0;
|
|
879
879
|
}
|
|
880
|
-
var
|
|
881
|
-
function
|
|
880
|
+
var un = { category: `category`, location: `location`, page: `page`, blob: `b`, resource: `resource`, referral: `referral`, timezone: `timezone`, bookingId: `bookingId`, token: `token`, rescheduleRedirectUrl: `rescheduleRedirectUrl` };
|
|
881
|
+
function V(e2) {
|
|
882
882
|
return e2.addOns ?? [];
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function H(e2, t2) {
|
|
885
885
|
let n2 = { ...e2 };
|
|
886
886
|
return t2.length ? n2.addOns = t2 : delete n2.addOns, n2;
|
|
887
887
|
}
|
|
888
|
-
function
|
|
889
|
-
let n2 =
|
|
890
|
-
return
|
|
888
|
+
function dn(e2, t2) {
|
|
889
|
+
let n2 = V(e2);
|
|
890
|
+
return H(e2, n2.some((e3) => e3.id === t2) ? n2.filter((e3) => e3.id !== t2) : [...n2, { id: t2, quantity: 1 }]);
|
|
891
891
|
}
|
|
892
|
-
function
|
|
893
|
-
let r2 =
|
|
894
|
-
return n2 <= 0 ?
|
|
892
|
+
function fn(e2, t2, n2) {
|
|
893
|
+
let r2 = V(e2);
|
|
894
|
+
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 }]);
|
|
895
895
|
}
|
|
896
|
-
function
|
|
896
|
+
function pn() {
|
|
897
897
|
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
898
898
|
if (e2) return { initWixModules(t3, n3) {
|
|
899
|
-
return
|
|
899
|
+
return U(() => e2(t3, n3));
|
|
900
900
|
}, fetchWithAuth() {
|
|
901
901
|
throw Error(`fetchWithAuth is not available in this context`);
|
|
902
902
|
}, graphql() {
|
|
@@ -906,10 +906,10 @@ function dn() {
|
|
|
906
906
|
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
907
907
|
if (r2) {
|
|
908
908
|
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`);
|
|
909
|
-
return
|
|
909
|
+
return U(() => n2.use(e3));
|
|
910
910
|
}
|
|
911
911
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
912
|
-
return
|
|
912
|
+
return U(() => t2.use(e3));
|
|
913
913
|
}, fetchWithAuth: (e3, n3) => {
|
|
914
914
|
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
915
915
|
return t2.fetchWithAuth(e3, n3);
|
|
@@ -921,7 +921,7 @@ function dn() {
|
|
|
921
921
|
return t2.graphql(e3, n3, r2);
|
|
922
922
|
} };
|
|
923
923
|
}
|
|
924
|
-
function
|
|
924
|
+
function U(e2) {
|
|
925
925
|
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
926
926
|
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);
|
|
927
927
|
try {
|
|
@@ -930,17 +930,17 @@ function G(e2) {
|
|
|
930
930
|
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
931
931
|
}
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function mn(e2, t2) {
|
|
934
934
|
return { ...e2, ...Object.fromEntries(t2.map((t3) => [t3, (...n2) => {
|
|
935
|
-
let r2 =
|
|
935
|
+
let r2 = pn();
|
|
936
936
|
if (!r2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
937
937
|
return r2.initWixModules(e2)[t3].apply(void 0, n2);
|
|
938
938
|
}])) };
|
|
939
939
|
}
|
|
940
|
-
function
|
|
941
|
-
return
|
|
940
|
+
function hn(e2) {
|
|
941
|
+
return mn({ __type: `host`, create: (t2) => Object.entries(e2).reduce((e3, [n2, r2]) => ({ ...e3, [n2]: r2(t2) }), {}) }, Object.keys(e2));
|
|
942
942
|
}
|
|
943
|
-
var
|
|
943
|
+
var gn = class {
|
|
944
944
|
constructor(e2) {
|
|
945
945
|
this.message = e2, this.captureException = () => {
|
|
946
946
|
console.error(this.message);
|
|
@@ -955,42 +955,42 @@ var mn = class {
|
|
|
955
955
|
};
|
|
956
956
|
}
|
|
957
957
|
};
|
|
958
|
-
var
|
|
959
|
-
var
|
|
960
|
-
var
|
|
961
|
-
function
|
|
958
|
+
var _n = (e2) => new gn(e2);
|
|
959
|
+
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.`) });
|
|
960
|
+
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` };
|
|
961
|
+
function yn(e2) {
|
|
962
962
|
try {
|
|
963
|
-
let t2 =
|
|
963
|
+
let t2 = vn.getMonitoringClient?.();
|
|
964
964
|
return t2 && typeof t2[e2] == `function` ? t2 : null;
|
|
965
965
|
} catch {
|
|
966
966
|
return null;
|
|
967
967
|
}
|
|
968
968
|
}
|
|
969
|
-
function
|
|
970
|
-
let a2 =
|
|
969
|
+
function G(e2, { feature: t2, action: n2, level: r2 = `error`, contexts: i2 }) {
|
|
970
|
+
let a2 = yn(`captureException`);
|
|
971
971
|
if (!a2) return;
|
|
972
972
|
let o2 = e2 instanceof Error ? e2 : Error(String(e2));
|
|
973
973
|
a2.captureException(o2, { level: r2, tags: { feature: t2, action: n2 }, ...i2 ? { contexts: i2 } : {} });
|
|
974
974
|
}
|
|
975
|
-
function
|
|
976
|
-
let i2 =
|
|
975
|
+
function bn(e2, { feature: t2, tags: n2 }, r2) {
|
|
976
|
+
let i2 = yn(`startSpanManual`);
|
|
977
977
|
if (!i2) return r2;
|
|
978
978
|
let a2 = i2.startSpanManual({ name: e2, tags: { feature: t2, ...n2 } });
|
|
979
979
|
return r2.then(() => a2.end(), (e3) => a2.fail(e3)), r2;
|
|
980
980
|
}
|
|
981
|
-
var
|
|
981
|
+
var xn = class extends import_react.Component {
|
|
982
982
|
state = { hasError: false };
|
|
983
983
|
static getDerivedStateFromError() {
|
|
984
984
|
return { hasError: true };
|
|
985
985
|
}
|
|
986
986
|
componentDidCatch(e2, t2) {
|
|
987
|
-
|
|
987
|
+
G(e2, { feature: this.props.feature ?? `service`, action: `render`, contexts: { react: { componentStack: t2.componentStack } } });
|
|
988
988
|
}
|
|
989
989
|
render() {
|
|
990
990
|
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
991
991
|
}
|
|
992
992
|
};
|
|
993
|
-
function
|
|
993
|
+
function Sn(e2) {
|
|
994
994
|
let t2 = e2;
|
|
995
995
|
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e3) => {
|
|
996
996
|
t2.__state = { status: `fulfilled`, value: e3 };
|
|
@@ -999,49 +999,49 @@ function bn(e2) {
|
|
|
999
999
|
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
1000
1000
|
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1002
|
+
function K(e2) {
|
|
1003
1003
|
let t2 = Promise.resolve(e2);
|
|
1004
1004
|
return t2.__state = { status: `fulfilled`, value: e2 }, t2;
|
|
1005
1005
|
}
|
|
1006
|
-
var
|
|
1007
|
-
function
|
|
1008
|
-
let r2 =
|
|
1009
|
-
r2 || (r2 = /* @__PURE__ */ new WeakMap(),
|
|
1006
|
+
var Cn = /* @__PURE__ */ new WeakMap();
|
|
1007
|
+
function wn(e2, t2, n2) {
|
|
1008
|
+
let r2 = Cn.get(e2);
|
|
1009
|
+
r2 || (r2 = /* @__PURE__ */ new WeakMap(), Cn.set(e2, r2));
|
|
1010
1010
|
let i2 = r2.get(t2);
|
|
1011
1011
|
i2 || (i2 = /* @__PURE__ */ new WeakMap(), r2.set(t2, i2));
|
|
1012
1012
|
let a2 = i2.get(n2);
|
|
1013
1013
|
if (!a2) {
|
|
1014
1014
|
let r3 = e2;
|
|
1015
|
-
a2 = r3.__state?.status === `fulfilled` ?
|
|
1015
|
+
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);
|
|
1016
1016
|
}
|
|
1017
1017
|
return a2;
|
|
1018
1018
|
}
|
|
1019
|
-
function
|
|
1019
|
+
function q(e2) {
|
|
1020
1020
|
return e2;
|
|
1021
1021
|
}
|
|
1022
|
-
var
|
|
1023
|
-
function
|
|
1022
|
+
var Tn = q(`@wix/site-service-warmup-data`);
|
|
1023
|
+
function En() {
|
|
1024
1024
|
try {
|
|
1025
1025
|
return (0, import_services_manager_react.useGetService)();
|
|
1026
1026
|
} catch {
|
|
1027
1027
|
return null;
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
|
-
function
|
|
1030
|
+
function Dn(e2) {
|
|
1031
1031
|
try {
|
|
1032
|
-
return e2 ? e2(
|
|
1032
|
+
return e2 ? e2(Tn) : null;
|
|
1033
1033
|
} catch {
|
|
1034
1034
|
return null;
|
|
1035
1035
|
}
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1038
|
-
let e2 = En(
|
|
1037
|
+
function On() {
|
|
1038
|
+
let e2 = Dn(En()), t2 = typeof window > `u`;
|
|
1039
1039
|
return { scope: e2 ?? void 0, get: async (n2) => {
|
|
1040
1040
|
if (t2 || !e2) return null;
|
|
1041
1041
|
try {
|
|
1042
1042
|
return await e2.get(n2);
|
|
1043
1043
|
} catch (e3) {
|
|
1044
|
-
return
|
|
1044
|
+
return G(e3, { feature: W.warmup, action: `read`, level: `warning`, contexts: { warmup: { key: n2 } } }), null;
|
|
1045
1045
|
}
|
|
1046
1046
|
}, set: (n2, r2) => {
|
|
1047
1047
|
if (t2 && e2) try {
|
|
@@ -1050,54 +1050,54 @@ function Dn() {
|
|
|
1050
1050
|
}
|
|
1051
1051
|
} };
|
|
1052
1052
|
}
|
|
1053
|
-
var
|
|
1054
|
-
var
|
|
1055
|
-
var
|
|
1056
|
-
function
|
|
1057
|
-
let r2 = { addOnGroups:
|
|
1053
|
+
var J = [];
|
|
1054
|
+
var kn = [];
|
|
1055
|
+
var An = `useServiceAddOnsContext must be used within ServiceAddOnsContextProvider`;
|
|
1056
|
+
function jn({ isLoading: e2, hasError: t2, children: n2 }) {
|
|
1057
|
+
let r2 = { addOnGroups: J, selected: kn, isLoading: e2, hasError: t2, toggleAddOn: () => {
|
|
1058
1058
|
}, setAddOnQuantity: () => {
|
|
1059
1059
|
} };
|
|
1060
1060
|
return (0, import_jsx_runtime.jsx)($.Provider, { value: r2, children: n2 });
|
|
1061
1061
|
}
|
|
1062
|
-
function jn({ children: e2 }) {
|
|
1063
|
-
return (0, import_jsx_runtime.jsx)(An, { isLoading: true, hasError: false, children: e2 });
|
|
1064
|
-
}
|
|
1065
1062
|
function Mn({ children: e2 }) {
|
|
1066
|
-
return (0, import_jsx_runtime.jsx)(
|
|
1063
|
+
return (0, import_jsx_runtime.jsx)(jn, { isLoading: true, hasError: false, children: e2 });
|
|
1064
|
+
}
|
|
1065
|
+
function Nn({ children: e2 }) {
|
|
1066
|
+
return (0, import_jsx_runtime.jsx)(jn, { isLoading: false, hasError: true, children: e2 });
|
|
1067
1067
|
}
|
|
1068
|
-
function
|
|
1068
|
+
function Pn(e2) {
|
|
1069
1069
|
if (!e2) return;
|
|
1070
1070
|
let t2 = ``;
|
|
1071
1071
|
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;
|
|
1072
1072
|
}
|
|
1073
|
-
var
|
|
1074
|
-
function
|
|
1075
|
-
return
|
|
1073
|
+
var Fn = [{ path: `addOnGroupsDetails.addOns.mainMedia.image.urlExpirationDate` }];
|
|
1074
|
+
function In(e2) {
|
|
1075
|
+
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: `` }] } }));
|
|
1076
1076
|
}
|
|
1077
|
-
var
|
|
1078
|
-
function
|
|
1077
|
+
var Ln = `@wix/auto_sdk_bookings_services`;
|
|
1078
|
+
function Rn(e2) {
|
|
1079
1079
|
function t2({ host: t3 }) {
|
|
1080
|
-
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.AddOnGroupsService.ListAddOnGroupsByServiceId`, packageName:
|
|
1080
|
+
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 }]) };
|
|
1081
1081
|
}
|
|
1082
1082
|
return t2;
|
|
1083
1083
|
}
|
|
1084
|
-
var
|
|
1085
|
-
async function
|
|
1086
|
-
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 =
|
|
1084
|
+
var zn = [{ path: `addOnGroupsDetails.addOns.mainMedia.image` }];
|
|
1085
|
+
async function Bn(e2, t2) {
|
|
1086
|
+
let { httpClient: n2, sideEffects: r2 } = arguments[2], i2 = Rn(Ye({ serviceId: e2, groupIds: t2?.groupIds }));
|
|
1087
1087
|
r2?.onSiteCall?.();
|
|
1088
1088
|
try {
|
|
1089
1089
|
let e3 = await n2.request(i2);
|
|
1090
|
-
return r2?.onSuccess?.(e3),
|
|
1090
|
+
return r2?.onSuccess?.(e3), Xe(it(e3.data, [{ transformFn: Pn, paths: zn }]));
|
|
1091
1091
|
} catch (e3) {
|
|
1092
|
-
let t3 =
|
|
1092
|
+
let t3 = pt(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { serviceId: `$[0]`, groupIds: `$[1].groupIds` }, singleArgumentUnchanged: false }, [`serviceId`, `options`]);
|
|
1093
1093
|
throw r2?.onError?.(e3), t3;
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
function
|
|
1097
|
-
return (t2, n2) =>
|
|
1096
|
+
function Vn(e2) {
|
|
1097
|
+
return (t2, n2) => Bn(t2, n2, { httpClient: e2 });
|
|
1098
1098
|
}
|
|
1099
|
-
var
|
|
1100
|
-
function
|
|
1099
|
+
var Hn = St(Vn);
|
|
1100
|
+
function Un(e2, t2) {
|
|
1101
1101
|
let n2 = e2?.value, r2 = e2?.currency;
|
|
1102
1102
|
if (n2 == null || !r2) return null;
|
|
1103
1103
|
let i2 = Number(n2);
|
|
@@ -1105,40 +1105,40 @@ function Hn(e2, t2) {
|
|
|
1105
1105
|
let a2 = i2 % 1 == 0 ? 0 : 2;
|
|
1106
1106
|
return new Intl.NumberFormat(t2, { style: `currency`, currency: r2, currencyDisplay: `symbol`, maximumFractionDigits: a2, minimumFractionDigits: a2 }).format(i2).replace(/\p{Zs}/gu, `\xA0`);
|
|
1107
1107
|
}
|
|
1108
|
-
async function
|
|
1109
|
-
return (await
|
|
1108
|
+
async function Wn(e2) {
|
|
1109
|
+
return (await Hn(e2)).addOnGroupsDetails ?? [];
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1111
|
+
function Gn(e2, t2) {
|
|
1112
1112
|
let n2 = e2.price?.value == null ? null : Number(e2.price.value);
|
|
1113
|
-
return { addOnId: e2.addOnId ?? null, addOnName: e2.nameTranslated ?? e2.name ?? null, addOnPrice:
|
|
1113
|
+
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 };
|
|
1114
1114
|
}
|
|
1115
|
-
function
|
|
1116
|
-
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) =>
|
|
1115
|
+
function Kn(e2, t2) {
|
|
1116
|
+
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 }));
|
|
1117
1117
|
}
|
|
1118
|
-
var
|
|
1119
|
-
function
|
|
1120
|
-
return `${
|
|
1118
|
+
var qn = `bookings-uou`;
|
|
1119
|
+
function Jn(e2, t2) {
|
|
1120
|
+
return `${qn}:addons:${e2}:${t2}`;
|
|
1121
1121
|
}
|
|
1122
|
-
var
|
|
1123
|
-
var
|
|
1124
|
-
var
|
|
1125
|
-
var
|
|
1126
|
-
function
|
|
1122
|
+
var Yn = 5e3;
|
|
1123
|
+
var Xn = 100;
|
|
1124
|
+
var Zn = `wix-warmup-data`;
|
|
1125
|
+
var Y = null;
|
|
1126
|
+
function Qn(e2) {
|
|
1127
1127
|
if (typeof document < `u`) try {
|
|
1128
|
-
let t2 = document.getElementById(
|
|
1129
|
-
return t2 ? (
|
|
1128
|
+
let t2 = document.getElementById(Zn)?.textContent;
|
|
1129
|
+
return t2 ? (Y?.text !== t2 && (Y = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), Y.data[e2] ?? void 0) : void 0;
|
|
1130
1130
|
} catch {
|
|
1131
1131
|
return;
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
var
|
|
1135
|
-
var $n =
|
|
1134
|
+
var X = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
1135
|
+
var $n = X();
|
|
1136
1136
|
var er = /* @__PURE__ */ new WeakMap();
|
|
1137
1137
|
var tr = /* @__PURE__ */ new WeakMap();
|
|
1138
1138
|
function nr(e2) {
|
|
1139
1139
|
if (!e2) return $n;
|
|
1140
1140
|
let t2 = er.get(e2);
|
|
1141
|
-
return t2 || (t2 =
|
|
1141
|
+
return t2 || (t2 = X(), er.set(e2, t2)), t2;
|
|
1142
1142
|
}
|
|
1143
1143
|
function rr({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
1144
1144
|
if (e2 === null) return n2();
|
|
@@ -1159,10 +1159,10 @@ function rr({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
|
1159
1159
|
r2 && i2.invalidatedWarmup.add(e2);
|
|
1160
1160
|
let s2 = !i2.invalidatedWarmup.has(e2);
|
|
1161
1161
|
if (s2) {
|
|
1162
|
-
let t3 =
|
|
1162
|
+
let t3 = Qn(e2);
|
|
1163
1163
|
if (t3 !== void 0) {
|
|
1164
|
-
let n3 =
|
|
1165
|
-
return i2.promises.set(e2, { promise: n3, expiresAt: a2 +
|
|
1164
|
+
let n3 = K(t3);
|
|
1165
|
+
return i2.promises.set(e2, { promise: n3, expiresAt: a2 + Yn }), n3;
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
1168
|
let c2 = (async () => {
|
|
@@ -1172,43 +1172,37 @@ function rr({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
return n2();
|
|
1174
1174
|
})();
|
|
1175
|
-
i2.promises.size >=
|
|
1175
|
+
i2.promises.size >= Xn && i2.promises.delete(i2.promises.keys().next().value);
|
|
1176
1176
|
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
1177
1177
|
return i2.promises.set(e2, l2), c2.then(() => {
|
|
1178
|
-
l2.expiresAt = Date.now() +
|
|
1178
|
+
l2.expiresAt = Date.now() + Yn;
|
|
1179
1179
|
}, () => {
|
|
1180
1180
|
i2.promises.get(e2) === l2 && i2.promises.delete(e2);
|
|
1181
1181
|
}), c2;
|
|
1182
1182
|
}
|
|
1183
1183
|
function ir(e2, t2) {
|
|
1184
|
-
return
|
|
1185
|
-
throw
|
|
1184
|
+
return bn(`service-addons-context-load`, { feature: W.serviceAddOns, tags: { serviceId: e2 } }, Wn(e2)).then((e3) => Kn(e3, t2), (t3) => {
|
|
1185
|
+
throw G(t3, { feature: W.serviceAddOns, action: `fetch-add-on-groups`, level: `warning`, contexts: { service: { serviceId: e2 } } }), t3;
|
|
1186
1186
|
});
|
|
1187
1187
|
}
|
|
1188
1188
|
function ar({ serviceId: e2, locale: t2, warmupData: n2 }) {
|
|
1189
|
-
return rr({ key:
|
|
1189
|
+
return rr({ key: Jn(e2, t2), warmupData: n2, fetchData: () => ir(e2, t2) });
|
|
1190
1190
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
var sr = or(`@wix/viewer-service-business-logger`);
|
|
1195
|
-
function cr(e2) {
|
|
1191
|
+
var or = q(`@wix/site-service-business-logger`);
|
|
1192
|
+
function sr(e2) {
|
|
1196
1193
|
return { evid: 32, src: 16, endpoint: ``, params: e2 };
|
|
1197
1194
|
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
var dr = `appSectionParams`;
|
|
1203
|
-
function Z(e2) {
|
|
1204
|
-
let t2 = e2.searchParams.get(dr);
|
|
1195
|
+
var cr = q(`@wix/site-service-url`);
|
|
1196
|
+
var lr = `appSectionParams`;
|
|
1197
|
+
function ur(e2) {
|
|
1198
|
+
let t2 = e2.searchParams.get(lr);
|
|
1205
1199
|
if (t2 === null) return e2;
|
|
1206
1200
|
let n2 = new URL(e2);
|
|
1207
|
-
n2.searchParams.delete(
|
|
1208
|
-
for (let [e3, r2] of Object.entries(
|
|
1201
|
+
n2.searchParams.delete(lr);
|
|
1202
|
+
for (let [e3, r2] of Object.entries(dr(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
|
|
1209
1203
|
return n2;
|
|
1210
1204
|
}
|
|
1211
|
-
function
|
|
1205
|
+
function dr(e2) {
|
|
1212
1206
|
try {
|
|
1213
1207
|
let t2 = JSON.parse(e2);
|
|
1214
1208
|
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
@@ -1216,16 +1210,16 @@ function fr(e2) {
|
|
|
1216
1210
|
return {};
|
|
1217
1211
|
}
|
|
1218
1212
|
}
|
|
1219
|
-
var
|
|
1220
|
-
var
|
|
1213
|
+
var Z = `bookings-uou:url-change`;
|
|
1214
|
+
var Q = (e2) => {
|
|
1221
1215
|
let t2 = new URL(e2);
|
|
1222
1216
|
return t2.searchParams.sort(), t2.href;
|
|
1223
1217
|
};
|
|
1224
|
-
function
|
|
1218
|
+
function fr(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
1225
1219
|
let r2 = globalThis.window;
|
|
1226
1220
|
if (!r2?.history) return;
|
|
1227
1221
|
let i2 = new URL(r2.location.href);
|
|
1228
|
-
if (
|
|
1222
|
+
if (Q(i2) === Q(e2)) return;
|
|
1229
1223
|
let a2 = { scrollY: r2.scrollY };
|
|
1230
1224
|
if (n2) r2.history.replaceState(a2, ``, e2.href);
|
|
1231
1225
|
else {
|
|
@@ -1236,84 +1230,84 @@ function mr(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
|
1236
1230
|
return;
|
|
1237
1231
|
}
|
|
1238
1232
|
}
|
|
1239
|
-
r2.dispatchEvent(new Event(
|
|
1233
|
+
r2.dispatchEvent(new Event(Z));
|
|
1240
1234
|
}
|
|
1241
|
-
function
|
|
1235
|
+
function pr(e2) {
|
|
1242
1236
|
let t2 = globalThis.window;
|
|
1243
|
-
return t2 ? (t2.addEventListener(
|
|
1244
|
-
t2.removeEventListener(
|
|
1237
|
+
return t2 ? (t2.addEventListener(Z, e2), t2.addEventListener(`popstate`, e2), () => {
|
|
1238
|
+
t2.removeEventListener(Z, e2), t2.removeEventListener(`popstate`, e2);
|
|
1245
1239
|
}) : () => {
|
|
1246
1240
|
};
|
|
1247
1241
|
}
|
|
1248
|
-
var
|
|
1242
|
+
var mr = (e2) => {
|
|
1249
1243
|
try {
|
|
1250
1244
|
return decodeURIComponent(e2);
|
|
1251
1245
|
} catch {
|
|
1252
1246
|
return e2;
|
|
1253
1247
|
}
|
|
1254
1248
|
};
|
|
1255
|
-
function
|
|
1249
|
+
function hr(e2, t2) {
|
|
1256
1250
|
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
1257
|
-
return `./${
|
|
1251
|
+
return `./${mr(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
1258
1252
|
}
|
|
1259
|
-
function
|
|
1260
|
-
let e2 = (0, import_services_manager_react.useService)(
|
|
1261
|
-
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () =>
|
|
1253
|
+
function gr() {
|
|
1254
|
+
let e2 = (0, import_services_manager_react.useService)(cr), t2 = (0, import_react.useCallback)(() => e2.currentUrl, [e2]), n2 = (0, import_react.useSyncExternalStore)(pr, t2, t2), i2 = (0, import_react.useMemo)(() => ur(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
|
|
1255
|
+
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 };
|
|
1262
1256
|
}
|
|
1263
|
-
var
|
|
1257
|
+
var _r = function(e2) {
|
|
1264
1258
|
return e2.BOOK_ONLINE = `bookingsBookOnline`, e2.SERVICE_PAGE = `bookingsServicePage`, e2.CALENDAR_PAGE = `bookingsCalendar`, e2.FORM_PAGE = `bookingsForm`, e2;
|
|
1265
1259
|
}({});
|
|
1266
|
-
var
|
|
1267
|
-
|
|
1268
|
-
var
|
|
1269
|
-
var
|
|
1270
|
-
let t2 = (0, import_services_manager_react.useService)(
|
|
1260
|
+
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` };
|
|
1261
|
+
_r.BOOK_ONLINE;
|
|
1262
|
+
var yr = `new_bookings_server`;
|
|
1263
|
+
var br = (e2) => {
|
|
1264
|
+
let { reportBi: t2 } = (0, import_services_manager_react.useService)(or);
|
|
1271
1265
|
return (0, import_react.useCallback)((n2) => {
|
|
1272
|
-
t2
|
|
1266
|
+
t2({ widget_name: e2, bookingsPlatform: yr, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
1273
1267
|
}, [t2, e2]);
|
|
1274
1268
|
};
|
|
1275
|
-
var
|
|
1276
|
-
let n2 =
|
|
1269
|
+
var xr = (e2, t2 = true) => {
|
|
1270
|
+
let n2 = br(e2), { getParsedUrl: r2 } = gr(), i2 = (0, import_react.useRef)(false);
|
|
1277
1271
|
(0, import_react.useEffect)(() => {
|
|
1278
|
-
t2 && !i2.current && (i2.current = true, n2(
|
|
1272
|
+
t2 && !i2.current && (i2.current = true, n2(sr({ referralInfo: r2().searchParams.get(un.referral) ?? void 0 })));
|
|
1279
1273
|
}, [t2, n2, r2]);
|
|
1280
1274
|
};
|
|
1281
|
-
var
|
|
1282
|
-
var
|
|
1283
|
-
var
|
|
1275
|
+
var Sr = K({ addOnGroups: J, hasError: false });
|
|
1276
|
+
var Cr = (e2) => ({ addOnGroups: e2, hasError: false });
|
|
1277
|
+
var wr = () => ({ addOnGroups: J, hasError: true });
|
|
1284
1278
|
var $ = (0, import_react.createContext)(null);
|
|
1285
|
-
function
|
|
1279
|
+
function Tr() {
|
|
1286
1280
|
let e2 = (0, import_react.useContext)($);
|
|
1287
|
-
if (!e2) throw Error(
|
|
1281
|
+
if (!e2) throw Error(An);
|
|
1288
1282
|
return e2;
|
|
1289
1283
|
}
|
|
1290
|
-
function
|
|
1291
|
-
let { addOnGroups: l2, hasError: u2 } =
|
|
1284
|
+
function Er({ addOnsPromise: e2, isLoading: t2, pickedAddOns: n2, forwardToggleAddOn: i2, forwardSetAddOnQuantity: a2, children: c2 }) {
|
|
1285
|
+
let { addOnGroups: l2, hasError: u2 } = Sn(e2), d2 = (0, import_react.useMemo)(() => B(l2, n2), [l2, n2]), p2 = (0, import_react.useMemo)(() => sn(l2, d2), [l2, d2]), m2 = (0, import_react.useRef)({ source: n2, picks: n2 });
|
|
1292
1286
|
m2.current.source !== n2 && (m2.current = { source: n2, picks: n2 });
|
|
1293
1287
|
let h2 = (e3) => {
|
|
1294
1288
|
let t3 = m2.current;
|
|
1295
|
-
t3.picks =
|
|
1289
|
+
t3.picks = V(e3({ serviceId: ``, addOns: t3.picks }));
|
|
1296
1290
|
}, g2 = (0, import_react.useCallback)(() => {
|
|
1297
|
-
let e3 = m2.current, t3 =
|
|
1291
|
+
let e3 = m2.current, t3 = B(l2, e3.picks);
|
|
1298
1292
|
return e3.picks.filter((e4) => !t3.includes(e4)).forEach((e4) => a2(e4.id, 0)), e3.picks = t3, t3;
|
|
1299
1293
|
}, [l2, a2]), _2 = (0, import_react.useCallback)((e3) => {
|
|
1300
|
-
let n3 =
|
|
1301
|
-
!t2 &&
|
|
1294
|
+
let n3 = B(l2, m2.current.picks);
|
|
1295
|
+
!t2 && cn(l2, n3, e3) && (g2(), i2(e3), h2((t3) => dn(t3, e3)));
|
|
1302
1296
|
}, [t2, l2, g2, i2]), v2 = (0, import_react.useCallback)((e3, n3) => {
|
|
1303
|
-
let r2 = t2 ? null :
|
|
1297
|
+
let r2 = t2 ? null : rn(l2, e3);
|
|
1304
1298
|
if (!r2) return;
|
|
1305
|
-
let i3 =
|
|
1306
|
-
s2 === o2 || o2 === 0 && !
|
|
1307
|
-
}, [t2, l2, g2, a2]),
|
|
1308
|
-
return (0, import_jsx_runtime.jsx)($.Provider, { value:
|
|
1309
|
-
}
|
|
1310
|
-
function
|
|
1311
|
-
let { service: n2, serviceId: r2, hasAddOns: i2, locale: a2, isLoading: s2, bookingsSettingsLoading: c2, selection: u2, toggleAddOn: d2, setAddOnQuantity: p2 } = (0,
|
|
1312
|
-
|
|
1313
|
-
let m2 = (0, import_react.useMemo)(() =>
|
|
1314
|
-
return (0, import_jsx_runtime.jsx)(
|
|
1315
|
-
}
|
|
1316
|
-
var
|
|
1299
|
+
let i3 = B(l2, m2.current.picks), o2 = i3.find((t3) => t3.id === e3)?.quantity ?? 0, s2 = ln(r2, n3);
|
|
1300
|
+
s2 === o2 || o2 === 0 && !cn(l2, i3, e3) || (g2(), a2(e3, s2), h2((t3) => fn(t3, e3, s2)));
|
|
1301
|
+
}, [t2, l2, g2, a2]), ee2 = (0, import_react.useMemo)(() => ({ addOnGroups: p2, selected: d2, isLoading: t2, hasError: u2, toggleAddOn: _2, setAddOnQuantity: v2 }), [p2, d2, t2, u2, _2, v2]);
|
|
1302
|
+
return (0, import_jsx_runtime.jsx)($.Provider, { value: ee2, children: c2 });
|
|
1303
|
+
}
|
|
1304
|
+
function Dr({ children: e2 }) {
|
|
1305
|
+
let { service: n2, serviceId: r2, hasAddOns: i2, locale: a2, isLoading: s2, bookingsSettingsLoading: c2, selection: u2, toggleAddOn: d2, setAddOnQuantity: p2 } = (0, import_service.useServiceContext)();
|
|
1306
|
+
xr(vr.SERVICE_ADD_ONS, !s2 && !c2);
|
|
1307
|
+
let m2 = (0, import_react.useMemo)(() => V(u2), [u2]), h2 = On(), g2 = n2 && i2 && r2 ? r2 : null, _2 = (0, import_react.useMemo)(() => g2 ? wn(ar({ serviceId: g2, locale: a2, warmupData: h2 }), Cr, wr) : Sr, [g2, a2]), v2 = !g2 && !!s2;
|
|
1308
|
+
return (0, import_jsx_runtime.jsx)(xn, { fallback: (0, import_jsx_runtime.jsx)(Nn, { children: e2 }), feature: W.serviceAddOns, children: (0, import_jsx_runtime.jsx)(import_react.Suspense, { fallback: (0, import_jsx_runtime.jsx)(Mn, { children: e2 }), children: (0, import_jsx_runtime.jsx)(Er, { addOnsPromise: _2, isLoading: v2, pickedAddOns: m2, forwardToggleAddOn: d2, forwardSetAddOnQuantity: p2, children: e2 }) }) });
|
|
1309
|
+
}
|
|
1310
|
+
var Or = nn;
|
|
1317
1311
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1318
1312
|
0 && (module.exports = {
|
|
1319
1313
|
ServiceAddOnsContextProvider,
|
|
@@ -1321,4 +1315,4 @@ var Ar = rn;
|
|
|
1321
1315
|
serviceAddOnsContext,
|
|
1322
1316
|
useServiceAddOnsContext
|
|
1323
1317
|
});
|
|
1324
|
-
//# sourceMappingURL=context-service-addons
|
|
1318
|
+
//# sourceMappingURL=context-service-addons.js.map
|