@wix/bookings 1.0.1741 → 1.0.1743
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/runtime.d.ts +2784 -0
- package/_sdk-exports/context-booking-checkout-context/runtime.js +2 -0
- package/_sdk-exports/context-categories-context/runtime.d.ts +144 -0
- package/_sdk-exports/context-categories-context/runtime.js +1 -0
- package/_sdk-exports/context-locations-context/runtime.d.ts +282 -0
- package/_sdk-exports/context-locations-context/runtime.js +1 -0
- package/_sdk-exports/context-service-addons-context/runtime.d.ts +264 -0
- package/_sdk-exports/context-service-addons-context/runtime.js +1 -0
- package/_sdk-exports/context-service-context/runtime.d.ts +3667 -0
- package/_sdk-exports/context-service-context/runtime.js +2 -0
- package/_sdk-exports/context-services-context/runtime.d.ts +2863 -0
- package/_sdk-exports/context-services-context/runtime.js +2 -0
- package/_sdk-exports/context-time-slots-context/runtime.d.ts +660 -0
- package/_sdk-exports/context-time-slots-context/runtime.js +2 -0
- package/build/cjs/context-booking-checkout-context.d.ts +2784 -0
- package/build/cjs/context-booking-checkout-context.js +3940 -0
- package/build/cjs/context-booking-checkout-context.js.map +1 -0
- package/build/cjs/context-categories-context.d.ts +144 -0
- package/build/cjs/context-categories-context.js +1188 -0
- package/build/cjs/context-categories-context.js.map +1 -0
- package/build/cjs/context-locations-context.d.ts +282 -0
- package/build/cjs/context-locations-context.js +1252 -0
- package/build/cjs/context-locations-context.js.map +1 -0
- package/build/cjs/context-service-addons-context.d.ts +264 -0
- package/build/cjs/context-service-addons-context.js +1324 -0
- package/build/cjs/context-service-addons-context.js.map +1 -0
- package/build/cjs/context-service-context.d.ts +3667 -0
- package/build/cjs/context-service-context.js +5336 -0
- package/build/cjs/context-service-context.js.map +1 -0
- package/build/cjs/context-services-context.d.ts +2863 -0
- package/build/cjs/context-services-context.js +2203 -0
- package/build/cjs/context-services-context.js.map +1 -0
- package/build/cjs/context-time-slots-context.d.ts +660 -0
- package/build/cjs/context-time-slots-context.js +2822 -0
- package/build/cjs/context-time-slots-context.js.map +1 -0
- package/build/es/context-booking-checkout-context.d.mts +2784 -0
- package/build/es/context-booking-checkout-context.mjs +3898 -0
- package/build/es/context-booking-checkout-context.mjs.map +1 -0
- package/build/es/context-categories-context.d.mts +144 -0
- package/build/es/context-categories-context.mjs +1157 -0
- package/build/es/context-categories-context.mjs.map +1 -0
- package/build/es/context-locations-context.d.mts +282 -0
- package/build/es/context-locations-context.mjs +1221 -0
- package/build/es/context-locations-context.mjs.map +1 -0
- package/build/es/context-service-addons-context.d.mts +264 -0
- package/build/es/context-service-addons-context.mjs +1294 -0
- package/build/es/context-service-addons-context.mjs.map +1 -0
- package/build/es/context-service-context.d.mts +3667 -0
- package/build/es/context-service-context.mjs +5304 -0
- package/build/es/context-service-context.mjs.map +1 -0
- package/build/es/context-services-context.d.mts +2863 -0
- package/build/es/context-services-context.mjs +2172 -0
- package/build/es/context-services-context.mjs.map +1 -0
- package/build/es/context-time-slots-context.d.mts +660 -0
- package/build/es/context-time-slots-context.mjs +2792 -0
- package/build/es/context-time-slots-context.mjs.map +1 -0
- package/build/internal/cjs/context-booking-checkout-context.d.ts +2784 -0
- package/build/internal/cjs/context-categories-context.d.ts +144 -0
- package/build/internal/cjs/context-locations-context.d.ts +282 -0
- package/build/internal/cjs/context-service-addons-context.d.ts +264 -0
- package/build/internal/cjs/context-service-context.d.ts +3667 -0
- package/build/internal/cjs/context-services-context.d.ts +2863 -0
- package/build/internal/cjs/context-time-slots-context.d.ts +660 -0
- package/build/internal/es/context-booking-checkout-context.d.mts +2784 -0
- package/build/internal/es/context-categories-context.d.mts +144 -0
- package/build/internal/es/context-locations-context.d.mts +282 -0
- package/build/internal/es/context-service-addons-context.d.mts +264 -0
- package/build/internal/es/context-service-context.d.mts +3667 -0
- package/build/internal/es/context-services-context.d.mts +2863 -0
- package/build/internal/es/context-time-slots-context.d.mts +660 -0
- package/context/booking-checkout-context/package.json +3 -0
- package/context/categories-context/package.json +3 -0
- package/context/locations-context/package.json +3 -0
- package/context/service-addons-context/package.json +3 -0
- package/context/service-context/package.json +3 -0
- package/context/services-context/package.json +3 -0
- package/context/time-slots-context/package.json +3 -0
- package/package.json +69 -8
|
@@ -0,0 +1,1221 @@
|
|
|
1
|
+
// _sdk-exports/context-locations-context/runtime.js
|
|
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, useState as c, useSyncExternalStore as l } from "react";
|
|
3
|
+
import { useGetService as u, useService as d } from "@wix/services-manager-react";
|
|
4
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
5
|
+
var p = {};
|
|
6
|
+
function m(e2, t2 = false, n2 = (e3) => e3) {
|
|
7
|
+
return () => ({ __type: `event-definition`, type: e2, isDomainEvent: t2, transformations: n2 });
|
|
8
|
+
}
|
|
9
|
+
var h = (e2) => {
|
|
10
|
+
switch (e2) {
|
|
11
|
+
case `get`:
|
|
12
|
+
case `GET`:
|
|
13
|
+
return `GET`;
|
|
14
|
+
case `post`:
|
|
15
|
+
case `POST`:
|
|
16
|
+
return `POST`;
|
|
17
|
+
case `put`:
|
|
18
|
+
case `PUT`:
|
|
19
|
+
return `PUT`;
|
|
20
|
+
case `delete`:
|
|
21
|
+
case `DELETE`:
|
|
22
|
+
return `DELETE`;
|
|
23
|
+
case `patch`:
|
|
24
|
+
case `PATCH`:
|
|
25
|
+
return `PATCH`;
|
|
26
|
+
case `head`:
|
|
27
|
+
case `HEAD`:
|
|
28
|
+
return `HEAD`;
|
|
29
|
+
case `options`:
|
|
30
|
+
case `OPTIONS`:
|
|
31
|
+
return `OPTIONS`;
|
|
32
|
+
default:
|
|
33
|
+
throw Error(`Unknown method: ${e2}`);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var g = (e2) => (t2) => async (n2) => {
|
|
37
|
+
let r2, i2 = (t3) => {
|
|
38
|
+
if (r2 = e2(n2)(t3), r2.url === void 0) throw Error(`Url was not successfully created for this request, please reach out to support channels for assistance.`);
|
|
39
|
+
let { method: i3, url: a2, params: o2 } = r2;
|
|
40
|
+
return { ...r2, method: h(i3), url: a2, data: r2.data, params: o2 };
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
let e3 = await t2.request(i2);
|
|
44
|
+
if (r2 === void 0) throw Error(`Request options were not created for this request, please reach out to support channels for assistance.`);
|
|
45
|
+
let n3 = Array.isArray(r2.transformResponse) ? r2.transformResponse : [r2.transformResponse], a2 = e3.data;
|
|
46
|
+
return n3.forEach((t3) => {
|
|
47
|
+
t3 && (a2 = t3(e3.data, e3.headers));
|
|
48
|
+
}), a2;
|
|
49
|
+
} catch (e3) {
|
|
50
|
+
throw typeof e3 == `object` && e3 && `response` in e3 && typeof e3.response == `object` && e3.response !== null && `data` in e3.response ? e3.response.data : e3;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var _ = (e2) => e2.__isAmbassador ? true : !!e2().__isAmbassador;
|
|
54
|
+
var v = `__metadata`;
|
|
55
|
+
var y = `edge.wixapis.com`;
|
|
56
|
+
var b = class extends Error {
|
|
57
|
+
message;
|
|
58
|
+
response;
|
|
59
|
+
constructor(e2, t2) {
|
|
60
|
+
super(e2), this.message = e2, this.response = t2;
|
|
61
|
+
}
|
|
62
|
+
async details() {
|
|
63
|
+
let e2 = await this.response.json();
|
|
64
|
+
return x(this.response.status, e2?.message, e2?.details, { requestId: this.response.headers.get(`X-Wix-Request-Id`), details: e2 });
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var x = (e2, t2, n2, r2) => ({ details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2, requestId: r2?.requestId });
|
|
68
|
+
var S = (e2) => e2?.method && [`post`, `put`, `patch`].includes(e2.method.toLocaleLowerCase()) && e2.body ? { "Content-Type": `application/json` } : {};
|
|
69
|
+
var ee = (e2) => e2 && typeof e2 == `object` && !Array.isArray(e2);
|
|
70
|
+
var te = (e2) => e2.__type === `host`;
|
|
71
|
+
function ne(e2, t2) {
|
|
72
|
+
return e2.create(t2);
|
|
73
|
+
}
|
|
74
|
+
var re = `x-wix-bi-gateway`;
|
|
75
|
+
function ie(e2, t2, n2) {
|
|
76
|
+
return { [re]: ae({ environment: `js-sdk${n2 ? `-${n2}` : ``}`, "package-name": e2.packageName ?? t2?.PACKAGE_NAME, "method-fqn": e2.methodFqn, entity: e2.entityFqdn }) };
|
|
77
|
+
}
|
|
78
|
+
function ae(e2) {
|
|
79
|
+
return Object.entries(e2).filter(([e3, t2]) => !!t2).map(([e3, t2]) => `${e3}=${t2}`).join(`,`);
|
|
80
|
+
}
|
|
81
|
+
function C(e2) {
|
|
82
|
+
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
83
|
+
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);
|
|
84
|
+
try {
|
|
85
|
+
return e2();
|
|
86
|
+
} finally {
|
|
87
|
+
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
var w = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
91
|
+
function T(e2) {
|
|
92
|
+
return ue(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
93
|
+
}
|
|
94
|
+
var oe = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
95
|
+
var se = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
96
|
+
var ce = `$1\0$2`;
|
|
97
|
+
var le = /[^\p{L}\d]+/giu;
|
|
98
|
+
function ue(e2) {
|
|
99
|
+
let t2 = e2.trim();
|
|
100
|
+
t2 = t2.replace(oe, ce).replace(se, ce), t2 = t2.replace(le, `\0`);
|
|
101
|
+
let n2 = 0, r2 = t2.length;
|
|
102
|
+
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
103
|
+
if (n2 === r2) return [];
|
|
104
|
+
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
105
|
+
return t2.slice(n2, r2).split(/\0/g);
|
|
106
|
+
}
|
|
107
|
+
var de = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
108
|
+
var fe = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
109
|
+
var pe = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
110
|
+
function me(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
111
|
+
if (typeof e2 != `object` || !e2) throw e2;
|
|
112
|
+
if (de(e2)) return he(e2, t2, n2);
|
|
113
|
+
if (fe(e2)) return ge(e2);
|
|
114
|
+
if (pe(e2)) {
|
|
115
|
+
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: T(n3), data: {} }, requestId: e2.requestId };
|
|
116
|
+
return E(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
117
|
+
}
|
|
118
|
+
return _e(e2);
|
|
119
|
+
}
|
|
120
|
+
var he = (e2, t2, n2) => {
|
|
121
|
+
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = ve(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 };
|
|
122
|
+
return E(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
123
|
+
};
|
|
124
|
+
var E = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
125
|
+
var ge = (e2) => {
|
|
126
|
+
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 ?? T(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 };
|
|
127
|
+
return E(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
128
|
+
};
|
|
129
|
+
var _e = (e2) => E(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: T(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
|
|
130
|
+
var ve = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
131
|
+
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
132
|
+
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
133
|
+
let r3 = t2[e3.field];
|
|
134
|
+
if (r3) return { ...e3, field: D(r3, i2) };
|
|
135
|
+
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
136
|
+
if (s2) {
|
|
137
|
+
let t3 = a2[s2];
|
|
138
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, D(t3, i2)) };
|
|
139
|
+
}
|
|
140
|
+
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
var D = (e2, t2) => {
|
|
144
|
+
let n2 = ye(e2);
|
|
145
|
+
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
146
|
+
};
|
|
147
|
+
var ye = (e2) => {
|
|
148
|
+
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
149
|
+
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
150
|
+
};
|
|
151
|
+
function be(e2, t2, n2, r2, i2, a2, o2, s2, c2, l2, u2) {
|
|
152
|
+
return C(() => e2({ request: async (e3) => {
|
|
153
|
+
let i3 = e3({ host: s2?.HTTPHost || `www.wixapis.com` }), a3 = i3;
|
|
154
|
+
a3.method === `GET` && a3.fallback?.length && (a3.params?.toString().length ?? 0) > 4e3 && (a3 = i3.fallback[0]);
|
|
155
|
+
let o3 = s2?.HTTPHost ?? `www.wixapis.com`, u3 = `https://${l2 ? y : o3}${a3.url}`;
|
|
156
|
+
a3.params && a3.params.toString() && (u3 += `?${a3.params.toString()}`);
|
|
157
|
+
try {
|
|
158
|
+
let e4 = ie(i3, t2, c2), o4 = { method: a3.method, ...a3.data && { body: JSON.stringify(a3.data) }, headers: { ...e4 } }, s3 = await n2(u3, o4);
|
|
159
|
+
if (s3.status !== 200) {
|
|
160
|
+
let e5 = null;
|
|
161
|
+
try {
|
|
162
|
+
e5 = await s3.json();
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
let t3 = Se(s3.status, e5?.message ?? s3.statusText, e5?.details, { requestId: s3.headers.get(`X-Wix-Request-Id`), details: e5 }), n3 = me(t3);
|
|
166
|
+
throw r2?.handleError(n3, { requestOptions: { url: a3.url, method: a3.method, entityFqdn: i3.entityFqdn, methodFqn: i3.methodFqn } }), t3;
|
|
167
|
+
}
|
|
168
|
+
let l3 = await s3.json();
|
|
169
|
+
return { data: a3.migrationOptions?.optInTransformResponse && a3.transformResponse ? Array.isArray(a3.transformResponse) ? a3.transformResponse[0](l3) : a3.transformResponse(l3) : l3, headers: s3.headers, status: s3.status, statusText: s3.statusText };
|
|
170
|
+
} catch (e4) {
|
|
171
|
+
throw e4.message?.includes(`fetch is not defined`) && console.error(`Node.js v18+ is required`), e4;
|
|
172
|
+
}
|
|
173
|
+
}, fetchWithAuth: n2, wixAPIFetch: i2, getActiveToken: a2, getAuthHeaders: o2 }, { validateRequestSchema: u2 }));
|
|
174
|
+
}
|
|
175
|
+
var xe = class extends Error {
|
|
176
|
+
response;
|
|
177
|
+
requestId;
|
|
178
|
+
constructor(e2) {
|
|
179
|
+
super(), this.response = e2.response, this.requestId = e2.requestId;
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
var Se = (e2, t2, n2, r2) => new xe({ response: { data: { details: { ...!n2?.validationError && { applicationError: { description: t2, code: e2, data: r2 } }, ...n2 }, message: t2 }, status: e2 }, requestId: r2?.requestId });
|
|
183
|
+
var Ce = `.`;
|
|
184
|
+
function we(e2, t2, n2) {
|
|
185
|
+
if (e2 == null) throw Error(`Cannot set value on null or undefined`);
|
|
186
|
+
let r2 = Te(t2), i2 = e2;
|
|
187
|
+
for (let e3 = 0; e3 < r2.length; e3++) {
|
|
188
|
+
let t3 = r2[e3];
|
|
189
|
+
if (e3 === r2.length - 1) {
|
|
190
|
+
i2[t3] = n2;
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
let a2 = r2[e3 + 1];
|
|
194
|
+
(!(t3 in i2) || i2[t3] == null || typeof i2[t3] != `object` || i2[t3] === null) && (i2[t3] = typeof a2 == `number` ? [] : {}), i2 = i2[t3];
|
|
195
|
+
}
|
|
196
|
+
return e2;
|
|
197
|
+
}
|
|
198
|
+
function Te(e2) {
|
|
199
|
+
return Array.isArray(e2) ? e2 : e2.split(Ce).map((e3) => Ee(e3) ? Number(e3) : e3);
|
|
200
|
+
}
|
|
201
|
+
function Ee(e2) {
|
|
202
|
+
return /^\d+$/.test(e2);
|
|
203
|
+
}
|
|
204
|
+
function De(e2) {
|
|
205
|
+
let t2 = {};
|
|
206
|
+
for (let [n2, r2] of Object.entries(e2)) Oe(n2) || we(t2, Te(n2), r2);
|
|
207
|
+
return t2;
|
|
208
|
+
}
|
|
209
|
+
function Oe(e2) {
|
|
210
|
+
return e2 === `__proto__` || e2 === `constructor` || e2 === `prototype`;
|
|
211
|
+
}
|
|
212
|
+
var ke = class {
|
|
213
|
+
BRACKET_PATTERN = /\[(\d+)\]/g;
|
|
214
|
+
NUMERIC_PATTERN = /^\d+$/;
|
|
215
|
+
ESCAPED_DOT_PATTERN = /\\\./g;
|
|
216
|
+
ESCAPED_LEFT_BRACKET_PATTERN = /\\\[/g;
|
|
217
|
+
ESCAPED_RIGHT_BRACKET_PATTERN = /\\\]/g;
|
|
218
|
+
SPLIT_PATTERN = /\.|\[(\d+)\]/g;
|
|
219
|
+
DOT_BEFORE_BRACKET_PATTERN = /\.\[/g;
|
|
220
|
+
ESCAPED_DOT_PLACEHOLDER = `__DOT__`;
|
|
221
|
+
ESCAPED_RIGHT_BRACKET_PLACEHOLDER = `__RB__`;
|
|
222
|
+
ESCAPED_LEFT_BRACKET_PLACEHOLDER = `__LB__`;
|
|
223
|
+
modifiedFields;
|
|
224
|
+
cleanedModifiedFields;
|
|
225
|
+
constructor(e2) {
|
|
226
|
+
this.modifiedFields = e2;
|
|
227
|
+
}
|
|
228
|
+
replaceEscapedCharacters(e2) {
|
|
229
|
+
return e2.replace(this.ESCAPED_DOT_PATTERN, this.ESCAPED_DOT_PLACEHOLDER).replace(this.ESCAPED_LEFT_BRACKET_PATTERN, this.ESCAPED_LEFT_BRACKET_PLACEHOLDER).replace(this.ESCAPED_RIGHT_BRACKET_PATTERN, this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER);
|
|
230
|
+
}
|
|
231
|
+
restoreEscapedCharacters(e2) {
|
|
232
|
+
return e2.replace(this.ESCAPED_DOT_PLACEHOLDER, `\\.`).replace(this.ESCAPED_RIGHT_BRACKET_PLACEHOLDER, `\\]`).replace(this.ESCAPED_LEFT_BRACKET_PLACEHOLDER, `\\[`);
|
|
233
|
+
}
|
|
234
|
+
unflatten() {
|
|
235
|
+
return this.cleanedModifiedFields = Object.fromEntries(Object.entries(this.modifiedFields).map(([e2, t2]) => [this.replaceEscapedCharacters(this.bracketToDotNotation(e2)), t2])), De(this.cleanedModifiedFields);
|
|
236
|
+
}
|
|
237
|
+
flatten(e2) {
|
|
238
|
+
let t2 = {};
|
|
239
|
+
for (let n2 of Object.keys(this.cleanedModifiedFields)) {
|
|
240
|
+
let r2 = this.splitPath(n2), i2 = this.navigatePath(e2, r2);
|
|
241
|
+
t2 = { ...t2, ...i2 };
|
|
242
|
+
}
|
|
243
|
+
return Object.fromEntries(Object.entries(t2).map(([e3, t3]) => [this.restoreEscapedCharacters(e3), t3]));
|
|
244
|
+
}
|
|
245
|
+
splitPath(e2) {
|
|
246
|
+
let t2 = [], n2 = 0, r2 = Array.from(e2.matchAll(this.SPLIT_PATTERN));
|
|
247
|
+
for (let i2 of r2) i2.index > n2 && t2.push(e2.substring(n2, i2.index)), i2[1] && t2.push(i2[1]), n2 = i2.index + i2[0].length;
|
|
248
|
+
return n2 < e2.length && t2.push(e2.substring(n2)), t2;
|
|
249
|
+
}
|
|
250
|
+
navigatePath(e2, t2) {
|
|
251
|
+
let n2 = e2, r2 = [], i2 = (e3) => {
|
|
252
|
+
if (!Array.isArray(n2)) throw Error(`Expected array at path ${this.buildPathString(r2)}, but got ${typeof n2}`);
|
|
253
|
+
r2.push(`[${e3}]`), n2 = n2[parseInt(e3, 10)];
|
|
254
|
+
}, a2 = (e3, t3) => {
|
|
255
|
+
let i3 = e3 in w ? w[e3] : void 0;
|
|
256
|
+
if (i3 && i3 in t3) {
|
|
257
|
+
r2.push(i3), n2 = t3[i3];
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
let a3 = Ne(e3);
|
|
261
|
+
if (a3 && a3 in t3) {
|
|
262
|
+
r2.push(a3), n2 = t3[a3];
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
throw Error(`Cannot find key '${e3}' or its transformations at path ${this.buildPathString(r2)}`);
|
|
266
|
+
}, o2 = (e3, t3) => {
|
|
267
|
+
r2.push(e3), n2 = t3[e3];
|
|
268
|
+
};
|
|
269
|
+
for (let e3 of t2) {
|
|
270
|
+
if (this.NUMERIC_PATTERN.test(e3)) {
|
|
271
|
+
i2(e3);
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (typeof n2 != `object` || !n2) throw Error(`Cannot access property '${e3}' on ${typeof n2} at path ${this.buildPathString(r2)}`);
|
|
275
|
+
let t3 = n2;
|
|
276
|
+
if (e3 in n2) {
|
|
277
|
+
o2(e3, t3);
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
a2(e3, t3);
|
|
281
|
+
}
|
|
282
|
+
return { [this.buildPathString(r2)]: n2 };
|
|
283
|
+
}
|
|
284
|
+
buildPathString(e2) {
|
|
285
|
+
return e2.join(`.`).replace(this.DOT_BEFORE_BRACKET_PATTERN, `[`);
|
|
286
|
+
}
|
|
287
|
+
bracketToDotNotation(e2) {
|
|
288
|
+
return e2.replace(this.BRACKET_PATTERN, (t2, n2, r2) => r2 > 0 && e2[r2 - 1] === `\\` ? t2 : `.` + n2);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
function Ae(e2, t2) {
|
|
292
|
+
let n2 = e2?.modifiedFields;
|
|
293
|
+
if (!n2) return null;
|
|
294
|
+
let r2 = je(n2);
|
|
295
|
+
if (!r2) return null;
|
|
296
|
+
let { unflattenedModifiedFields: i2, modifiedFieldsManipulator: a2 } = r2;
|
|
297
|
+
e2 = { ...e2, modifiedFields: i2 };
|
|
298
|
+
let o2 = t2(e2), s2 = o2?.modifiedFields;
|
|
299
|
+
if (!s2) return null;
|
|
300
|
+
let c2 = Me(s2, a2);
|
|
301
|
+
return c2 === null ? null : (o2.modifiedFields = c2, o2);
|
|
302
|
+
}
|
|
303
|
+
function je(e2) {
|
|
304
|
+
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
305
|
+
let t2 = new ke(e2);
|
|
306
|
+
return { unflattenedModifiedFields: t2.unflatten(), modifiedFieldsManipulator: t2 };
|
|
307
|
+
} catch {
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
function Me(e2, t2) {
|
|
313
|
+
if (typeof e2 == `object` && e2 && !Array.isArray(e2)) try {
|
|
314
|
+
return t2.flatten(e2);
|
|
315
|
+
} catch {
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
function Ne(e2) {
|
|
321
|
+
return e2.replace(/[-_\s]+(.)?/g, (e3, t2) => t2 ? t2.toUpperCase() : ``).replace(/^./, (e3) => e3.toLowerCase());
|
|
322
|
+
}
|
|
323
|
+
function Pe() {
|
|
324
|
+
return { emit(e2, ...t2) {
|
|
325
|
+
for (let n2 = 0, r2 = this.events[e2] || [], i2 = r2.length; n2 < i2; n2++) r2[n2](...t2);
|
|
326
|
+
}, events: {}, on(e2, t2) {
|
|
327
|
+
return (this.events[e2] ||= []).push(t2), () => {
|
|
328
|
+
this.events[e2] = this.events[e2]?.filter((e3) => t2 !== e3);
|
|
329
|
+
};
|
|
330
|
+
} };
|
|
331
|
+
}
|
|
332
|
+
var Fe = (e2) => e2.__type === `event-definition`;
|
|
333
|
+
function Ie(e2, t2, n2, r2) {
|
|
334
|
+
let i2;
|
|
335
|
+
if (e2.isDomainEvent) {
|
|
336
|
+
let { deletedEvent: e3, actionEvent: t3, createdEvent: a3, updatedEvent: o3, ...s3 } = n2, c2 = { ...r2, ...s3 };
|
|
337
|
+
i2 = e3 ? e3?.deletedEntity ? { entity: e3?.deletedEntity, metadata: c2 } : { metadata: c2 } : t3 ? { data: t3.body, metadata: c2 } : o3 ? { entity: o3.currentEntity, metadata: c2, ...o3.modifiedFields ? { modifiedFields: o3.modifiedFields } : {} } : { entity: a3?.entity, metadata: c2 };
|
|
338
|
+
} else i2 = { data: n2, metadata: r2 };
|
|
339
|
+
let a2 = e2.transformations ?? ((e3) => e3), o2 = i2, s2 = i2;
|
|
340
|
+
if (s2.modifiedFields) {
|
|
341
|
+
let e3 = s2.modifiedFields;
|
|
342
|
+
if (typeof e3 == `object` && e3 && !Array.isArray(e3)) {
|
|
343
|
+
o2 = structuredClone(i2);
|
|
344
|
+
let e4 = Ae(s2, a2);
|
|
345
|
+
if (e4) return t2(e4);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return t2(a2(o2));
|
|
349
|
+
}
|
|
350
|
+
function Le(e2) {
|
|
351
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Pe();
|
|
352
|
+
return { initModule(e3) {
|
|
353
|
+
return (r2) => {
|
|
354
|
+
let i2 = t2.get(e3.type) ?? [];
|
|
355
|
+
i2.push({ eventDefinition: e3, handler: r2 }), t2.set(e3.type, i2), n2.emit(`registered`, e3);
|
|
356
|
+
};
|
|
357
|
+
}, client: { ...n2, getRegisteredEvents: () => t2, async process(e3, n3 = { expectedEvents: [] }) {
|
|
358
|
+
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 }))];
|
|
359
|
+
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(`, `)}`);
|
|
360
|
+
let l2 = t2.get(r2) ?? [];
|
|
361
|
+
return await Promise.all(l2.map(({ eventDefinition: e4, handler: t3 }) => Ie(e4, t3, o2, { instanceId: a2, identity: i2, accountInfo: s2 }))), { instanceId: a2, eventType: r2, payload: o2, identity: i2, accountInfo: s2 };
|
|
362
|
+
}, async processRequest(e3, t3) {
|
|
363
|
+
let n3 = await e3.text();
|
|
364
|
+
return this.process(n3, t3);
|
|
365
|
+
}, async parseJWT(t3) {
|
|
366
|
+
let n3 = e2();
|
|
367
|
+
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
368
|
+
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3);
|
|
369
|
+
if (!i2) throw Error(`JWT is not valid`);
|
|
370
|
+
if (typeof r2.data != `string`) throw Error(`Unexpected type of JWT data: expected string, got ${typeof r2.data}`);
|
|
371
|
+
let a2 = JSON.parse(r2.data), o2 = a2.eventType, s2 = a2.accountInfo, c2 = a2.instanceId, l2 = a2.identity ? JSON.parse(a2.identity) : void 0;
|
|
372
|
+
return { instanceId: c2, eventType: o2, payload: JSON.parse(a2.data), identity: l2, accountInfo: s2 };
|
|
373
|
+
}, async parseRequest(e3) {
|
|
374
|
+
let t3 = await e3.text();
|
|
375
|
+
return this.parseJWT(t3);
|
|
376
|
+
}, async executeHandlers(e3) {
|
|
377
|
+
let n3 = Array.from(t2.keys()).map((e4) => ({ type: e4 }));
|
|
378
|
+
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(`, `)}`);
|
|
379
|
+
let r2 = t2.get(e3.eventType) ?? [];
|
|
380
|
+
await Promise.all(r2.map(({ eventDefinition: t3, handler: n4 }) => Ie(t3, n4, e3.payload, { instanceId: e3.instanceId, identity: e3.identity })));
|
|
381
|
+
}, apps: { AppInstalled: m(`AppInstalled`)(), AppRemoved: m(`AppRemoved`)() } } };
|
|
382
|
+
}
|
|
383
|
+
var Re = (e2) => e2.__type === `service-plugin-definition`;
|
|
384
|
+
function ze(e2) {
|
|
385
|
+
let t2 = /* @__PURE__ */ new Map(), n2 = Pe();
|
|
386
|
+
return { initModule(e3) {
|
|
387
|
+
return (r2) => {
|
|
388
|
+
let i2 = t2.get(e3.componentType.toLowerCase()) ?? [];
|
|
389
|
+
i2.push({ servicePluginDefinition: e3, implementation: r2 }), t2.set(e3.componentType.toLowerCase(), i2), n2.emit(`registered`, e3);
|
|
390
|
+
};
|
|
391
|
+
}, client: { ...n2, getRegisteredServicePlugins: () => t2, async parseJWT(t3) {
|
|
392
|
+
let n3 = e2();
|
|
393
|
+
if (!n3.decodeJWT) throw Error(`decodeJWT is not supported by the authentication strategy`);
|
|
394
|
+
let { decoded: r2, valid: i2 } = await n3.decodeJWT(t3, true);
|
|
395
|
+
if (!i2) throw Error(`JWT is not valid`);
|
|
396
|
+
if (typeof r2.data != `object` || r2.data === null || !(`metadata` in r2.data) || typeof r2.data.metadata != `object` || r2.data.metadata === null || !(`appExtensionType` in r2.data.metadata) || typeof r2.data.metadata.appExtensionType != `string`) throw Error(`Unexpected JWT data: expected object with metadata.appExtensionType string`);
|
|
397
|
+
return r2.data;
|
|
398
|
+
}, async process(e3) {
|
|
399
|
+
let t3 = await this.parseJWT(e3.body);
|
|
400
|
+
return this.executeHandler(t3, e3.url);
|
|
401
|
+
}, async parseRequest(e3) {
|
|
402
|
+
let t3 = await e3.text();
|
|
403
|
+
return this.parseJWT(t3);
|
|
404
|
+
}, async processRequest(e3) {
|
|
405
|
+
let t3 = await this.parseRequest(e3);
|
|
406
|
+
return this.processParsedRequest(t3, e3.url);
|
|
407
|
+
}, async processParsedRequest(e3, t3) {
|
|
408
|
+
try {
|
|
409
|
+
let n3 = await this.executeHandler(e3, t3);
|
|
410
|
+
return Response.json(n3);
|
|
411
|
+
} catch (e4) {
|
|
412
|
+
if (e4.errorType === `SPI` && e4.applicationCode && e4.httpCode) return Response.json({ applicationError: { code: e4.applicationCode, data: e4.data } }, { status: e4.httpCode });
|
|
413
|
+
throw e4;
|
|
414
|
+
}
|
|
415
|
+
}, async executeHandler(e3, n3) {
|
|
416
|
+
let r2 = e3.metadata.appExtensionType.toLowerCase(), i2 = t2.get(r2) ?? [];
|
|
417
|
+
if (i2.length === 0) throw Error(`No service plugin implementations found for component type ${r2}`);
|
|
418
|
+
if (i2.length > 1) throw Error(`Multiple service plugin implementations found for component type ${r2}. This is currently not supported`);
|
|
419
|
+
let { implementation: a2, servicePluginDefinition: o2 } = i2[0], s2 = o2.methods.find((e4) => n3.endsWith(e4.primaryHttpMappingPath));
|
|
420
|
+
if (!s2) throw Error(`Unexpect request: request url did not match any method: ` + n3);
|
|
421
|
+
let c2 = a2[s2.name];
|
|
422
|
+
if (!c2) throw Error(`Got request for service plugin method ${s2.name} but no implementation was provided. Available methods: ${Object.keys(a2).join(`, `)}`);
|
|
423
|
+
return s2.transformations.toREST(await c2(s2.transformations.fromREST(e3)));
|
|
424
|
+
} } };
|
|
425
|
+
}
|
|
426
|
+
var O = `X-Wix-Consistent`;
|
|
427
|
+
function Be(e2) {
|
|
428
|
+
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) => {
|
|
429
|
+
let i3 = o2(), s3 = await a2(), c3 = { ...r3?.headers ?? {}, ...s3.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [O]: t2[O] } : {} }, l3 = e2.host?.getErrorHandler?.();
|
|
430
|
+
try {
|
|
431
|
+
if (typeof n3 == `string` || n3 instanceof URL) {
|
|
432
|
+
let e3 = await i3(n3, { ...r3, headers: c3 });
|
|
433
|
+
l3?.handleError(e3, { requestOptions: { url: n3.toString(), method: r3?.method } });
|
|
434
|
+
let a3 = k(e3);
|
|
435
|
+
return a3 && (t2[O] = a3), e3;
|
|
436
|
+
}
|
|
437
|
+
{
|
|
438
|
+
for (let [e4, t3] of Object.entries(c3)) typeof t3 == `string` && n3.headers.set(e4, t3);
|
|
439
|
+
let e3 = await i3(n3, r3);
|
|
440
|
+
l3?.handleError(e3, { requestOptions: { url: n3.url, method: r3?.method } });
|
|
441
|
+
let a3 = k(e3);
|
|
442
|
+
return a3 && (t2[O] = a3), e3;
|
|
443
|
+
}
|
|
444
|
+
} catch (e3) {
|
|
445
|
+
throw l3?.handleError(e3, { requestOptions: { url: typeof n3 == `string` || n3 instanceof URL ? n3.toString() : n3.url, method: r3?.method } }), e3;
|
|
446
|
+
}
|
|
447
|
+
}, { client: c2, initModule: l2 } = ze(i2), { client: u2, initModule: d2 } = Le(i2), f2 = async (n3, r3) => {
|
|
448
|
+
let i3 = o2(), s3 = await a2(), c3 = S(r3), l3 = await i3(n3, { ...r3, headers: { ...c3, ...t2, ...s3?.headers, ...r3?.headers, ...e2.host?.essentials?.passThroughHeaders, ...t2[`X-Wix-Consistent`] ? { [O]: t2[O] } : {} } }), u3 = k(l3);
|
|
449
|
+
return u3 && (t2[O] = u3), l3;
|
|
450
|
+
}, m2 = (t3, n3) => {
|
|
451
|
+
if (Fe(t3)) return d2(t3);
|
|
452
|
+
if (Re(t3)) return l2(t3);
|
|
453
|
+
if (te(t3) && e2.host) return ne(t3, e2.host);
|
|
454
|
+
if (typeof t3 == `function`) {
|
|
455
|
+
if (`__type` in t3 && t3.__type === `wix_spi_error`) return t3;
|
|
456
|
+
let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, o3 = e2.useCDN === void 0 ? i2().shouldUseCDN : e2.useCDN;
|
|
457
|
+
return be(C(() => _(t3)) ? g(t3) : t3, n3 ?? {}, f2, e2.host?.getErrorHandler?.(), (e3, t4) => {
|
|
458
|
+
let n4 = new URL(e3, `https://${r3}`);
|
|
459
|
+
return n4.host = r3, n4.protocol = `https`, f2(n4.toString(), t4);
|
|
460
|
+
}, i2().getActiveToken, async () => a2(), { HTTPHost: r3 }, e2.host?.name, o3, e2.validateRequestSchema);
|
|
461
|
+
}
|
|
462
|
+
return ee(t3) ? Object.fromEntries(Object.entries(t3).map(([e3, n4]) => [e3, m2(n4, t3[v])])) : t3;
|
|
463
|
+
}, h2 = (e3) => {
|
|
464
|
+
for (let n3 in e3) t2[n3] = e3[n3];
|
|
465
|
+
};
|
|
466
|
+
return { ...e2.modules ? m2(e2.modules) : {}, get auth() {
|
|
467
|
+
let t3 = i2();
|
|
468
|
+
return t3.getAuthHeaders = t3.getAuthHeaders.bind(void 0, e2.host), t3;
|
|
469
|
+
}, setHeaders: h2, use: m2, enableContext(e3, t3 = { elevated: false }) {
|
|
470
|
+
e3 === `global` ? globalThis.__wix_context__ == null ? t3.elevated ? globalThis.__wix_context__ = { elevatedClient: this } : globalThis.__wix_context__ = { client: this } : t3.elevated ? globalThis.__wix_context__.elevatedClient = this : globalThis.__wix_context__.client = this : t3.elevated ? p.elevatedClient = this : p.client = this;
|
|
471
|
+
}, fetch: (t3, n3) => {
|
|
472
|
+
let r3 = e2.host?.apiBaseUrl ?? `www.wixapis.com`, i3 = new URL(t3, `https://${r3}`);
|
|
473
|
+
return i3.host = r3, i3.protocol = `https`, f2(i3.toString(), n3);
|
|
474
|
+
}, fetchWithAuth: s2, async graphql(t3, n3, r3 = { apiVersion: `alpha` }) {
|
|
475
|
+
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 }) });
|
|
476
|
+
if (a3.status !== 200) throw new b(`GraphQL request failed with status ${a3.status}`, a3);
|
|
477
|
+
let { data: o3, errors: s3 } = await a3.json();
|
|
478
|
+
return { data: o3 ?? {}, errors: s3 };
|
|
479
|
+
}, webhooks: u2, servicePlugins: c2 };
|
|
480
|
+
}
|
|
481
|
+
function k(e2) {
|
|
482
|
+
return e2.headers?.get(`X-Wix-Consistent`) ?? e2.headers?.get(`x-wix-consistent`);
|
|
483
|
+
}
|
|
484
|
+
var Ve = { _id: `id`, _createdDate: `createdDate`, _updatedDate: `updatedDate` };
|
|
485
|
+
var He = { id: `_id`, createdDate: `_createdDate`, updatedDate: `_updatedDate` };
|
|
486
|
+
function Ue(e2, t2) {
|
|
487
|
+
return e2?.split(`.`).map((e3) => t2?.[e3] ?? e3).join(`.`);
|
|
488
|
+
}
|
|
489
|
+
var A = `sort.fieldName`;
|
|
490
|
+
function We(e2, t2, n2) {
|
|
491
|
+
return (e2 === A || e2.endsWith(`.${A}`)) && typeof t2 == `string` ? Ue(t2, n2) : t2;
|
|
492
|
+
}
|
|
493
|
+
function j(e2, t2, n2) {
|
|
494
|
+
let r2 = (e3) => n2.includes(e3), i2 = (e3, n3) => {
|
|
495
|
+
if (Array.isArray(e3)) e3.forEach((e4) => {
|
|
496
|
+
i2(e4, n3);
|
|
497
|
+
});
|
|
498
|
+
else if (typeof e3 == `object` && e3) {
|
|
499
|
+
let a2 = e3;
|
|
500
|
+
Object.keys(a2).forEach((e4) => {
|
|
501
|
+
let o2 = n3 === `` ? e4 : `${n3}.${e4}`;
|
|
502
|
+
if (r2(o2)) return;
|
|
503
|
+
let s2 = Ge(e4, t2);
|
|
504
|
+
s2 !== e4 && !(s2 in a2) && (a2[s2] = a2[e4], delete a2[e4]), a2[s2] = We(o2, a2[s2], t2), i2(a2[s2], o2);
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
return i2(e2, ``), e2;
|
|
509
|
+
}
|
|
510
|
+
function Ge(e2, t2) {
|
|
511
|
+
let n2;
|
|
512
|
+
return n2 = e2.includes(`.`) ? e2.split(`.`).map((e3) => t2[e3] ?? e3).join(`.`) : t2[e2] ?? e2, n2;
|
|
513
|
+
}
|
|
514
|
+
function Ke(e2, t2 = []) {
|
|
515
|
+
return j(e2, Ve, t2);
|
|
516
|
+
}
|
|
517
|
+
function qe(e2, t2 = []) {
|
|
518
|
+
return j(e2, He, t2);
|
|
519
|
+
}
|
|
520
|
+
var M = /* @__PURE__ */ new WeakMap();
|
|
521
|
+
function N() {
|
|
522
|
+
return { leaves: void 0, fields: void 0, mapFields: void 0, anyField: void 0 };
|
|
523
|
+
}
|
|
524
|
+
function Je(e2, t2) {
|
|
525
|
+
let n2 = e2.get(t2);
|
|
526
|
+
return n2 || (n2 = N(), e2.set(t2, n2)), n2;
|
|
527
|
+
}
|
|
528
|
+
function Ye(e2, t2) {
|
|
529
|
+
return t2 === `*` ? (e2.anyField ??= N(), e2.anyField) : t2.endsWith(`{}`) ? (e2.mapFields ??= /* @__PURE__ */ new Map(), Je(e2.mapFields, t2.slice(0, -2))) : (e2.fields ??= /* @__PURE__ */ new Map(), Je(e2.fields, t2));
|
|
530
|
+
}
|
|
531
|
+
function Xe(e2) {
|
|
532
|
+
let t2 = N();
|
|
533
|
+
for (let n2 of e2) {
|
|
534
|
+
let e3 = n2.path.split(`.`).reduce(Ye, t2);
|
|
535
|
+
e3.leaves ??= [], e3.leaves.push(n2);
|
|
536
|
+
}
|
|
537
|
+
return t2;
|
|
538
|
+
}
|
|
539
|
+
function Ze(e2) {
|
|
540
|
+
let t2 = M.get(e2);
|
|
541
|
+
return t2 || (t2 = Xe(e2), M.set(e2, t2)), t2;
|
|
542
|
+
}
|
|
543
|
+
function P(e2) {
|
|
544
|
+
return typeof e2 == `object` && !!e2;
|
|
545
|
+
}
|
|
546
|
+
function Qe(e2, { isRepeated: t2, isMap: n2 }, r2) {
|
|
547
|
+
return t2 ? Array.isArray(e2) ? e2.map(r2) : e2 : n2 ? P(e2) ? Object.fromEntries(Object.entries(e2).map(([e3, t3]) => [e3, r2(t3)])) : e2 : r2(e2);
|
|
548
|
+
}
|
|
549
|
+
function F(e2, t2, n2) {
|
|
550
|
+
P(e2) && tt(e2, t2, n2);
|
|
551
|
+
}
|
|
552
|
+
function $e(e2, t2, n2) {
|
|
553
|
+
for (let [r2, i2] of t2) {
|
|
554
|
+
if (!(r2 in e2)) continue;
|
|
555
|
+
if (i2.leaves) for (let t4 of i2.leaves) e2[r2] = Qe(e2[r2], t4, n2);
|
|
556
|
+
let t3 = e2[r2];
|
|
557
|
+
Array.isArray(t3) ? t3.forEach((e3) => F(e3, i2, n2)) : F(t3, i2, n2);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function et(e2, t2, n2) {
|
|
561
|
+
for (let [r2, i2] of t2) {
|
|
562
|
+
let t3 = e2[r2];
|
|
563
|
+
P(t3) && Object.values(t3).forEach((e3) => F(e3, i2, n2));
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function tt(e2, { fields: t2, mapFields: n2, anyField: r2 }, i2) {
|
|
567
|
+
t2 && $e(e2, t2, i2), n2 && et(e2, n2, i2), r2 && Object.values(e2).forEach((e3) => F(e3, r2, i2));
|
|
568
|
+
}
|
|
569
|
+
function nt(e2, t2) {
|
|
570
|
+
if (!P(e2)) return e2;
|
|
571
|
+
for (let { paths: n2, transformFn: r2 } of t2) tt(e2, Ze(n2), r2);
|
|
572
|
+
return e2;
|
|
573
|
+
}
|
|
574
|
+
function rt(e2) {
|
|
575
|
+
return Object.fromEntries(Object.entries(e2).filter(([, e3]) => e3 !== void 0));
|
|
576
|
+
}
|
|
577
|
+
function I(e2) {
|
|
578
|
+
return ct(e2).map((e3) => e3.toLocaleUpperCase()).join(`_`);
|
|
579
|
+
}
|
|
580
|
+
var it = /([\p{Ll}\d])(\p{Lu})/gu;
|
|
581
|
+
var at = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
|
|
582
|
+
var ot = `$1\0$2`;
|
|
583
|
+
var st = /[^\p{L}\d]+/giu;
|
|
584
|
+
function ct(e2) {
|
|
585
|
+
let t2 = e2.trim();
|
|
586
|
+
t2 = t2.replace(it, ot).replace(at, ot), t2 = t2.replace(st, `\0`);
|
|
587
|
+
let n2 = 0, r2 = t2.length;
|
|
588
|
+
for (; t2.charAt(n2) === `\0`; ) n2++;
|
|
589
|
+
if (n2 === r2) return [];
|
|
590
|
+
for (; t2.charAt(r2 - 1) === `\0`; ) r2--;
|
|
591
|
+
return t2.slice(n2, r2).split(/\0/g);
|
|
592
|
+
}
|
|
593
|
+
var lt = (e2) => `validationError` in (e2.response?.data?.details ?? {});
|
|
594
|
+
var ut = (e2) => `applicationError` in (e2.response?.data?.details ?? {});
|
|
595
|
+
var dt = (e2) => (e2.response?.status ?? -1) >= 400 && (e2.response?.status ?? -1) < 500;
|
|
596
|
+
function ft(e2, t2 = { explicitPathsToArguments: {}, spreadPathsToArguments: {}, singleArgumentUnchanged: false }, n2 = []) {
|
|
597
|
+
if (typeof e2 != `object` || !e2) throw e2;
|
|
598
|
+
if (lt(e2)) return pt(e2, t2, n2);
|
|
599
|
+
if (ut(e2)) return mt(e2);
|
|
600
|
+
if (dt(e2)) {
|
|
601
|
+
let t3 = e2.response?.status, n3 = e2.response?.statusText ?? `UNKNOWN`, r2 = e2.response?.data?.message ?? n3, i2 = { applicationError: { description: n3, code: I(n3), data: {} }, requestId: e2.requestId };
|
|
602
|
+
return L(e2, { message: JSON.stringify({ message: r2, details: i2 }, null, 2), extraProperties: { details: i2, status: t3 } });
|
|
603
|
+
}
|
|
604
|
+
return ht(e2);
|
|
605
|
+
}
|
|
606
|
+
var pt = (e2, t2, n2) => {
|
|
607
|
+
let r2 = e2.response?.data, i2 = e2.requestId, { fieldViolations: a2 } = r2.details.validationError, o2 = gt(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 };
|
|
608
|
+
return L(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: e2.response?.status, requestId: i2 } });
|
|
609
|
+
};
|
|
610
|
+
var L = (e2, { message: t2, extraProperties: n2 }) => Object.assign(e2, { ...n2, message: t2 });
|
|
611
|
+
var mt = (e2) => {
|
|
612
|
+
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 ?? I(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 };
|
|
613
|
+
return L(e2, { message: JSON.stringify({ message: s2, details: c2 }, null, 2), extraProperties: { details: c2, status: t2, requestId: e2.requestId } });
|
|
614
|
+
};
|
|
615
|
+
var ht = (e2) => L(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: I(e2.response?.statusText ?? `UNKNOWN`), ...!e2.response && { runtimeError: e2 } } });
|
|
616
|
+
var gt = ({ spreadPathsToArguments: e2, explicitPathsToArguments: t2, singleArgumentUnchanged: n2 }, r2, i2) => {
|
|
617
|
+
let a2 = { ...e2, ...t2 }, o2 = Object.keys(a2);
|
|
618
|
+
return r2?.filter((e3) => !r2.some((t3) => t3.field.length > e3.field.length && t3.field.startsWith(e3.field) && o2.includes(t3.field))).map((e3) => {
|
|
619
|
+
let r3 = t2[e3.field];
|
|
620
|
+
if (r3) return { ...e3, field: R(r3, i2) };
|
|
621
|
+
let s2 = o2?.sort((e4, t3) => t3.length - e4.length)?.find((t3) => e3.field.startsWith(t3));
|
|
622
|
+
if (s2) {
|
|
623
|
+
let t3 = a2[s2];
|
|
624
|
+
if (t3) return { ...e3, field: e3.field.replace(s2, R(t3, i2)) };
|
|
625
|
+
}
|
|
626
|
+
return n2 ? { ...e3, field: `${i2[0]}.${e3.field}` } : e3;
|
|
627
|
+
});
|
|
628
|
+
};
|
|
629
|
+
var R = (e2, t2) => {
|
|
630
|
+
let n2 = _t(e2);
|
|
631
|
+
return n2 == null ? e2 : e2.replace(`$[${n2}]`, t2[n2]);
|
|
632
|
+
};
|
|
633
|
+
var _t = (e2) => {
|
|
634
|
+
let t2 = e2.match(/\$\[(?<argIndex>\d+)\]/);
|
|
635
|
+
return t2 && t2.groups && Number(t2.groups.argIndex);
|
|
636
|
+
};
|
|
637
|
+
function vt() {
|
|
638
|
+
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
639
|
+
if (e2) return { initWixModules(t3, n3) {
|
|
640
|
+
return z(() => e2(t3, n3));
|
|
641
|
+
}, fetchWithAuth() {
|
|
642
|
+
throw Error(`fetchWithAuth is not available in this context`);
|
|
643
|
+
}, graphql() {
|
|
644
|
+
throw Error(`graphql is not available in this context`);
|
|
645
|
+
} };
|
|
646
|
+
let t2 = typeof $wixContext < `u` ? $wixContext.client : p.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : p.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : p.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : p.elevatedClient;
|
|
647
|
+
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
648
|
+
if (r2) {
|
|
649
|
+
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`);
|
|
650
|
+
return z(() => n2.use(e3));
|
|
651
|
+
}
|
|
652
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
653
|
+
return z(() => t2.use(e3));
|
|
654
|
+
}, fetchWithAuth: (e3, n3) => {
|
|
655
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
656
|
+
return t2.fetchWithAuth(e3, n3);
|
|
657
|
+
}, getAuth() {
|
|
658
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
659
|
+
return t2.auth;
|
|
660
|
+
}, async graphql(e3, n3, r2) {
|
|
661
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
662
|
+
return t2.graphql(e3, n3, r2);
|
|
663
|
+
} };
|
|
664
|
+
}
|
|
665
|
+
function z(e2) {
|
|
666
|
+
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
667
|
+
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);
|
|
668
|
+
try {
|
|
669
|
+
return e2();
|
|
670
|
+
} finally {
|
|
671
|
+
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
function yt(e2, t2) {
|
|
675
|
+
return (...n2) => {
|
|
676
|
+
let r2 = vt();
|
|
677
|
+
return r2 ? r2.initWixModules(e2, t2).apply(void 0, n2) : e2.apply(void 0, n2);
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
function bt(e2, t2 = false) {
|
|
681
|
+
return yt(e2, t2);
|
|
682
|
+
}
|
|
683
|
+
function xt(e2) {
|
|
684
|
+
let t2 = Pt(Mt(e2.host), e2.domainToMappings);
|
|
685
|
+
return Ut(Bt(e2.protoPath, e2.data || {}), t2);
|
|
686
|
+
}
|
|
687
|
+
var St = [`wix.com`, `editorx.com`];
|
|
688
|
+
var Ct = `_`;
|
|
689
|
+
var wt = `*.`;
|
|
690
|
+
var Tt = RegExp(`\\.(${St.join(`|`)})$`);
|
|
691
|
+
var Et = [`42.wixprod.net`, `uw2-edt-1.wixprod.net`, `virginia-edt.wixprod.net`];
|
|
692
|
+
var Dt = { "payments.base44.com": `manage.wix.com`, "create.editorx.com": `editor.editorx.com` };
|
|
693
|
+
var Ot = `dev.wix-code.com`;
|
|
694
|
+
var kt = /{(.*)}/;
|
|
695
|
+
var At = RegExp(`\\.(${Et.join(`|`)})$`);
|
|
696
|
+
var jt = RegExp(`.*\\.${Ot}$`);
|
|
697
|
+
function Mt(e2) {
|
|
698
|
+
return Nt(e2).replace(Tt, `._base_domain_`).replace(At, `._api_base_domain_`).replace(jt, `*.dev.wix-code.com`);
|
|
699
|
+
}
|
|
700
|
+
function Nt(e2) {
|
|
701
|
+
return Dt[e2] ?? e2;
|
|
702
|
+
}
|
|
703
|
+
function Pt(e2, t2) {
|
|
704
|
+
let n2 = t2[e2];
|
|
705
|
+
if (n2) return n2;
|
|
706
|
+
let r2 = Ft(e2, t2) ?? It(e2, t2);
|
|
707
|
+
if (!r2) {
|
|
708
|
+
if (Rt(e2)) {
|
|
709
|
+
let e3 = t2[zt];
|
|
710
|
+
if (e3) return e3;
|
|
711
|
+
}
|
|
712
|
+
let n3 = t2[Ct];
|
|
713
|
+
if (n3) return n3;
|
|
714
|
+
}
|
|
715
|
+
return r2 ?? [];
|
|
716
|
+
}
|
|
717
|
+
function Ft(e2, t2) {
|
|
718
|
+
return Object.entries(t2).find(([t3]) => {
|
|
719
|
+
let [, ...n2] = e2.split(`.`);
|
|
720
|
+
return n2.join(`.`) === t3;
|
|
721
|
+
})?.[1];
|
|
722
|
+
}
|
|
723
|
+
function It(e2, t2) {
|
|
724
|
+
let [n2] = Object.entries(t2).filter(([t3]) => Lt(e2, t3)).sort(([e3], [t3]) => t3.length - e3.length);
|
|
725
|
+
if (!n2) return;
|
|
726
|
+
let [, r2] = n2;
|
|
727
|
+
return r2;
|
|
728
|
+
}
|
|
729
|
+
function Lt(e2, t2) {
|
|
730
|
+
if (!t2.startsWith(wt)) return false;
|
|
731
|
+
let n2 = t2.slice(1);
|
|
732
|
+
return e2.length > n2.length && e2.endsWith(n2);
|
|
733
|
+
}
|
|
734
|
+
function Rt(e2) {
|
|
735
|
+
return !!e2.match(/\._base_domain_$/);
|
|
736
|
+
}
|
|
737
|
+
var zt = `www._base_domain_`;
|
|
738
|
+
function Bt(e2, t2) {
|
|
739
|
+
return e2.split(`/`).map((e3) => Vt(e3, t2)).join(`/`);
|
|
740
|
+
}
|
|
741
|
+
function Vt(e2, t2) {
|
|
742
|
+
let n2 = e2.match(kt) || [], r2 = n2[1];
|
|
743
|
+
return r2 ? Ht(t2, r2, e2, e2.replace(n2[0], ``)) : e2;
|
|
744
|
+
}
|
|
745
|
+
function Ht(e2, t2, n2, r2) {
|
|
746
|
+
let i2 = e2;
|
|
747
|
+
for (let e3 of t2.split(`.`)) {
|
|
748
|
+
if (!i2) return n2;
|
|
749
|
+
i2 = i2[e3];
|
|
750
|
+
}
|
|
751
|
+
return `${i2}${r2}`;
|
|
752
|
+
}
|
|
753
|
+
function Ut(e2, t2) {
|
|
754
|
+
let n2 = t2?.find((t3) => e2.startsWith(t3.destPath));
|
|
755
|
+
return n2 ? n2.srcPath + e2.slice(n2.destPath.length) : e2;
|
|
756
|
+
}
|
|
757
|
+
function Wt(e2) {
|
|
758
|
+
return e2 === `NaN` ? NaN : e2 === `Infinity` ? 1 / 0 : e2 === `-Infinity` ? -1 / 0 : e2;
|
|
759
|
+
}
|
|
760
|
+
function Gt(e2) {
|
|
761
|
+
return e2 && rt({ formatted: e2.formattedAddress, location: e2.geocode, addressLine1: e2.addressLine, addressLine2: e2.addressLine2, streetAddress: e2.streetAddress && { name: e2.streetAddress.name, number: e2.streetAddress.number, apt: e2.streetAddress.apt, formattedAddressLine: e2.streetAddress.formattedAddressLine }, hint: e2.hint, city: e2.city, subdivision: e2.subdivision, country: e2.country, postalCode: e2.postalCode, countryFullname: e2.countryFullname, subdivisionFullname: e2.subdivisionFullname });
|
|
762
|
+
}
|
|
763
|
+
var Kt = `x-wix-linguist`;
|
|
764
|
+
var qt = `00000000-0000-0000-0000-000000000000`;
|
|
765
|
+
var Jt = `false`;
|
|
766
|
+
var Yt = () => {
|
|
767
|
+
let e2 = B(`language`), t2 = B(`locale`);
|
|
768
|
+
if (e2) return { [Kt]: [e2, t2 || e2, Jt, qt].join(`|`) };
|
|
769
|
+
};
|
|
770
|
+
function Xt() {
|
|
771
|
+
let e2 = null, t2 = null;
|
|
772
|
+
return { promise: new Promise((n2, r2) => {
|
|
773
|
+
e2 = n2, t2 = r2;
|
|
774
|
+
}), resolve: e2, reject: t2 };
|
|
775
|
+
}
|
|
776
|
+
var B = (e2) => typeof window < `u` ? window.commonConfig?.[e2] : void 0;
|
|
777
|
+
var Zt = ({ createHost: e2 }) => ({ __type: `host`, create: (e3) => ({}), host: (t2) => {
|
|
778
|
+
let { applicationId: n2, componentId: r2 } = t2 ?? {}, i2 = typeof window < `u` ? window.wixEmbedsAPI : void 0, a2 = e2(t2), o2 = $t();
|
|
779
|
+
return { ...a2, apiBaseUrl: o2, getMonitoringClient: i2?.getMonitoringClientFunction?.(n2, r2), essentials: { language: B(`language`), locale: B(`locale`), get passThroughHeaders() {
|
|
780
|
+
return Yt();
|
|
781
|
+
} } };
|
|
782
|
+
}, auth: (e3) => {
|
|
783
|
+
let t2 = typeof window < `u` ? window.wixEmbedsAPI : void 0;
|
|
784
|
+
!e3 && Qt() && (e3 = t2?.getAccessTokenFunction?.());
|
|
785
|
+
let n2 = false, { resolve: r2, promise: i2 } = Xt();
|
|
786
|
+
return { getAuthHeaders: async () => {
|
|
787
|
+
if (!e3 && n2 && (e3 = await i2), !e3) throw Error(`Failed to resolve auth token`);
|
|
788
|
+
return { headers: { Authorization: await e3() } };
|
|
789
|
+
}, getAccessTokenInjector: () => (n2 = true, (e4) => {
|
|
790
|
+
r2(e4);
|
|
791
|
+
}) };
|
|
792
|
+
} });
|
|
793
|
+
function Qt() {
|
|
794
|
+
return typeof document < `u` && document.currentScript?.tagName === `SCRIPT`;
|
|
795
|
+
}
|
|
796
|
+
function $t() {
|
|
797
|
+
let e2 = (typeof window < `u` ? window.wixEmbedsAPI : void 0)?.getExternalBaseUrl?.();
|
|
798
|
+
if (!e2) return;
|
|
799
|
+
let t2 = new URL(e2);
|
|
800
|
+
return t2?.pathname && t2.pathname !== `/` ? `${t2.hostname}${t2.pathname}` : t2.hostname;
|
|
801
|
+
}
|
|
802
|
+
var en = ({ clientSdk: e2, applicationId: t2 }) => ({ invoke: async ({ namespace: n2, method: r2, args: i2 }) => {
|
|
803
|
+
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`);
|
|
804
|
+
return e2.invoke({ namespace: n2, method: r2, args: i2, applicationId: t2, accessToken: `accessToken` });
|
|
805
|
+
}, getAccessToken: () => {
|
|
806
|
+
throw Error(`Not implemented`);
|
|
807
|
+
}, observeState: () => ({ disconnect: () => {
|
|
808
|
+
} }) });
|
|
809
|
+
var V = Zt({ createHost: function(e2) {
|
|
810
|
+
let t2 = (typeof $wixContext < `u` ? $wixContext.clientSdk : void 0) ?? e2?.clientSdk ?? (typeof window < `u` ? window?.clientSdk : void 0), { applicationId: n2 } = e2 || {};
|
|
811
|
+
if (!n2) throw Error(`"createHost" was called without a required field "applicationId"`);
|
|
812
|
+
return { channel: en({ clientSdk: t2, applicationId: n2 }), close: () => {
|
|
813
|
+
} };
|
|
814
|
+
} });
|
|
815
|
+
var tn = ((e2, t2) => {
|
|
816
|
+
let n2 = V.host({ applicationId: e2, componentId: t2 }), r2 = V.auth();
|
|
817
|
+
return Be({ auth: r2, host: n2 }).enableContext(`module`), r2.getAccessTokenInjector();
|
|
818
|
+
})(`13d21c63-b5ec-5912-8397-c3a5ddb27a97`);
|
|
819
|
+
function nn() {
|
|
820
|
+
let e2 = typeof $wixContext < `u` && $wixContext.initWixModules ? $wixContext.initWixModules : globalThis.__wix_context__ !== void 0 && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
821
|
+
if (e2) return { initWixModules(t3, n3) {
|
|
822
|
+
return H(() => e2(t3, n3));
|
|
823
|
+
}, fetchWithAuth() {
|
|
824
|
+
throw Error(`fetchWithAuth is not available in this context`);
|
|
825
|
+
}, graphql() {
|
|
826
|
+
throw Error(`graphql is not available in this context`);
|
|
827
|
+
} };
|
|
828
|
+
let t2 = typeof $wixContext < `u` ? $wixContext.client : p.client === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.client : p.client, n2 = typeof $wixContext < `u` ? $wixContext.elevatedClient : p.elevatedClient === void 0 ? globalThis.__wix_context__ === void 0 ? void 0 : globalThis.__wix_context__.elevatedClient : p.elevatedClient;
|
|
829
|
+
if (t2 || n2) return { initWixModules(e3, r2) {
|
|
830
|
+
if (r2) {
|
|
831
|
+
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`);
|
|
832
|
+
return H(() => n2.use(e3));
|
|
833
|
+
}
|
|
834
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
835
|
+
return H(() => t2.use(e3));
|
|
836
|
+
}, fetchWithAuth: (e3, n3) => {
|
|
837
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
838
|
+
return t2.fetchWithAuth(e3, n3);
|
|
839
|
+
}, getAuth() {
|
|
840
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
841
|
+
return t2.auth;
|
|
842
|
+
}, async graphql(e3, n3, r2) {
|
|
843
|
+
if (!t2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
844
|
+
return t2.graphql(e3, n3, r2);
|
|
845
|
+
} };
|
|
846
|
+
}
|
|
847
|
+
function H(e2) {
|
|
848
|
+
let t2 = globalThis.__wix_context__, n2 = { client: p.client, elevatedClient: p.elevatedClient }, r2;
|
|
849
|
+
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);
|
|
850
|
+
try {
|
|
851
|
+
return e2();
|
|
852
|
+
} finally {
|
|
853
|
+
globalThis.__wix_context__ = t2, p.client = n2.client, p.elevatedClient = n2.elevatedClient, typeof $wixContext < `u` && ($wixContext.client = r2.client, $wixContext.elevatedClient = r2.elevatedClient);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
function rn(e2, t2) {
|
|
857
|
+
return { ...e2, ...Object.fromEntries(t2.map((t3) => [t3, (...n2) => {
|
|
858
|
+
let r2 = nn();
|
|
859
|
+
if (!r2) throw Error(`Wix context is not available. Make sure to initialize the Wix context before using SDK modules`);
|
|
860
|
+
return r2.initWixModules(e2)[t3].apply(void 0, n2);
|
|
861
|
+
}])) };
|
|
862
|
+
}
|
|
863
|
+
function an(e2) {
|
|
864
|
+
return rn({ __type: `host`, create: (t2) => Object.entries(e2).reduce((e3, [n2, r2]) => ({ ...e3, [n2]: r2(t2) }), {}) }, Object.keys(e2));
|
|
865
|
+
}
|
|
866
|
+
var on = class {
|
|
867
|
+
constructor(e2) {
|
|
868
|
+
this.message = e2, this.captureException = () => {
|
|
869
|
+
console.error(this.message);
|
|
870
|
+
}, this.captureMessage = () => {
|
|
871
|
+
console.error(this.message);
|
|
872
|
+
}, this.startSpan = (e3, t2) => (console.error(this.message), t2(void 0)), this.startSpanManual = () => (console.error(this.message), { end: () => {
|
|
873
|
+
}, fail: () => {
|
|
874
|
+
} }), this.endSpanManual = () => {
|
|
875
|
+
console.error(this.message);
|
|
876
|
+
}, this.addBreadcrumb = () => {
|
|
877
|
+
console.error(this.message);
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
var sn = (e2) => new on(e2);
|
|
882
|
+
var cn = an({ getMonitoringClient: (e2) => () => e2.getMonitoringClient ? e2.getMonitoringClient() : sn(`Host monitoring client is not available on the current host. Make sure to use an updated version of the host initialization package.`) });
|
|
883
|
+
var U = { 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` };
|
|
884
|
+
function W(e2) {
|
|
885
|
+
try {
|
|
886
|
+
let t2 = cn.getMonitoringClient?.();
|
|
887
|
+
return t2 && typeof t2[e2] == `function` ? t2 : null;
|
|
888
|
+
} catch {
|
|
889
|
+
return null;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
function G(e2, { feature: t2, action: n2, level: r2 = `error`, contexts: i2 }) {
|
|
893
|
+
let a2 = W(`captureException`);
|
|
894
|
+
if (!a2) return;
|
|
895
|
+
let o2 = e2 instanceof Error ? e2 : Error(String(e2));
|
|
896
|
+
a2.captureException(o2, { level: r2, tags: { feature: t2, action: n2 }, ...i2 ? { contexts: i2 } : {} });
|
|
897
|
+
}
|
|
898
|
+
function ln(e2, { feature: t2, tags: n2 }, r2) {
|
|
899
|
+
let i2 = W(`startSpanManual`);
|
|
900
|
+
if (!i2) return r2;
|
|
901
|
+
let a2 = i2.startSpanManual({ name: e2, tags: { feature: t2, ...n2 } });
|
|
902
|
+
return r2.then(() => a2.end(), (e3) => a2.fail(e3)), r2;
|
|
903
|
+
}
|
|
904
|
+
var un = class extends e {
|
|
905
|
+
state = { hasError: false };
|
|
906
|
+
static getDerivedStateFromError() {
|
|
907
|
+
return { hasError: true };
|
|
908
|
+
}
|
|
909
|
+
componentDidCatch(e2, t2) {
|
|
910
|
+
G(e2, { feature: this.props.feature ?? `service`, action: `render`, contexts: { react: { componentStack: t2.componentStack } } });
|
|
911
|
+
}
|
|
912
|
+
render() {
|
|
913
|
+
return this.state.hasError ? this.props.fallback : this.props.children;
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
function dn(e2) {
|
|
917
|
+
let t2 = e2;
|
|
918
|
+
if (t2.__state || (t2.__state = { status: `pending` }, t2.then((e3) => {
|
|
919
|
+
t2.__state = { status: `fulfilled`, value: e3 };
|
|
920
|
+
}, (e3) => {
|
|
921
|
+
t2.__state = { status: `rejected`, reason: e3 };
|
|
922
|
+
})), t2.__state.status === `fulfilled`) return t2.__state.value;
|
|
923
|
+
throw t2.__state.status === `rejected` ? t2.__state.reason : t2;
|
|
924
|
+
}
|
|
925
|
+
function K(e2) {
|
|
926
|
+
let t2 = Promise.resolve(e2);
|
|
927
|
+
return t2.__state = { status: `fulfilled`, value: e2 }, t2;
|
|
928
|
+
}
|
|
929
|
+
var fn = /* @__PURE__ */ new WeakMap();
|
|
930
|
+
function pn(e2, t2, n2) {
|
|
931
|
+
let r2 = fn.get(e2);
|
|
932
|
+
r2 || (r2 = /* @__PURE__ */ new WeakMap(), fn.set(e2, r2));
|
|
933
|
+
let i2 = r2.get(t2);
|
|
934
|
+
i2 || (i2 = /* @__PURE__ */ new WeakMap(), r2.set(t2, i2));
|
|
935
|
+
let a2 = i2.get(n2);
|
|
936
|
+
if (!a2) {
|
|
937
|
+
let r3 = e2;
|
|
938
|
+
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);
|
|
939
|
+
}
|
|
940
|
+
return a2;
|
|
941
|
+
}
|
|
942
|
+
function mn(e2) {
|
|
943
|
+
return e2;
|
|
944
|
+
}
|
|
945
|
+
var hn = mn(`@wix/site-service-url`);
|
|
946
|
+
var gn = `appSectionParams`;
|
|
947
|
+
function _n(e2) {
|
|
948
|
+
let t2 = e2.searchParams.get(gn);
|
|
949
|
+
if (t2 === null) return e2;
|
|
950
|
+
let n2 = new URL(e2);
|
|
951
|
+
n2.searchParams.delete(gn);
|
|
952
|
+
for (let [e3, r2] of Object.entries(vn(t2))) typeof r2 == `string` && !n2.searchParams.has(e3) && n2.searchParams.set(e3, r2);
|
|
953
|
+
return n2;
|
|
954
|
+
}
|
|
955
|
+
function vn(e2) {
|
|
956
|
+
try {
|
|
957
|
+
let t2 = JSON.parse(e2);
|
|
958
|
+
return t2 && typeof t2 == `object` && !Array.isArray(t2) ? t2 : {};
|
|
959
|
+
} catch {
|
|
960
|
+
return {};
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
var q = `bookings-uou:url-change`;
|
|
964
|
+
var yn = (e2) => {
|
|
965
|
+
let t2 = new URL(e2);
|
|
966
|
+
return t2.searchParams.sort(), t2.href;
|
|
967
|
+
};
|
|
968
|
+
function bn(e2, { disableScrollToTop: t2, skipHistory: n2 } = {}) {
|
|
969
|
+
let r2 = globalThis.window;
|
|
970
|
+
if (!r2?.history) return;
|
|
971
|
+
let i2 = new URL(r2.location.href);
|
|
972
|
+
if (yn(i2) === yn(e2)) return;
|
|
973
|
+
let a2 = { scrollY: r2.scrollY };
|
|
974
|
+
if (n2) r2.history.replaceState(a2, ``, e2.href);
|
|
975
|
+
else {
|
|
976
|
+
r2.history.replaceState(a2, ``, i2.href);
|
|
977
|
+
try {
|
|
978
|
+
r2.history.pushState(t2 ? a2 : null, ``, e2.href);
|
|
979
|
+
} catch {
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
}
|
|
983
|
+
r2.dispatchEvent(new Event(q));
|
|
984
|
+
}
|
|
985
|
+
function xn(e2) {
|
|
986
|
+
let t2 = globalThis.window;
|
|
987
|
+
return t2 ? (t2.addEventListener(q, e2), t2.addEventListener(`popstate`, e2), () => {
|
|
988
|
+
t2.removeEventListener(q, e2), t2.removeEventListener(`popstate`, e2);
|
|
989
|
+
}) : () => {
|
|
990
|
+
};
|
|
991
|
+
}
|
|
992
|
+
var Sn = (e2) => {
|
|
993
|
+
try {
|
|
994
|
+
return decodeURIComponent(e2);
|
|
995
|
+
} catch {
|
|
996
|
+
return e2;
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
function Cn(e2, t2) {
|
|
1000
|
+
let n2 = t2 ? new URL(t2).pathname : `/`;
|
|
1001
|
+
return `./${Sn(new URL(e2).pathname.replace(n2, ``).replace(/^\/|\/$/g, ``))}`;
|
|
1002
|
+
}
|
|
1003
|
+
function J() {
|
|
1004
|
+
let e2 = d(hn), t2 = r(() => e2.currentUrl, [e2]), n2 = l(xn, t2, t2), i2 = o(() => _n(new URL(n2)), [n2]), a2 = e2.siteUrl.replace(/\/$/, ``);
|
|
1005
|
+
return { pathname: i2.pathname, search: i2.search, searchParams: i2.searchParams, href: i2.href, getParsedUrl: () => _n(new URL(e2.currentUrl)), getRelativeUrl: () => Cn(e2.currentUrl, a2), getExternalBaseUrl: () => a2, pushUrl: bn };
|
|
1006
|
+
}
|
|
1007
|
+
var Y = { category: `category`, location: `location`, page: `page`, blob: `b`, resource: `resource`, referral: `referral`, timezone: `timezone`, bookingId: `bookingId`, token: `token`, rescheduleRedirectUrl: `rescheduleRedirectUrl` };
|
|
1008
|
+
function wn(e2) {
|
|
1009
|
+
return e2;
|
|
1010
|
+
}
|
|
1011
|
+
var Tn = wn(`@wix/site-service-warmup-data`);
|
|
1012
|
+
function En() {
|
|
1013
|
+
try {
|
|
1014
|
+
return u();
|
|
1015
|
+
} catch {
|
|
1016
|
+
return null;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
function Dn(e2) {
|
|
1020
|
+
try {
|
|
1021
|
+
return e2 ? e2(Tn) : null;
|
|
1022
|
+
} catch {
|
|
1023
|
+
return null;
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
function On() {
|
|
1027
|
+
let e2 = Dn(En()), t2 = typeof window > `u`;
|
|
1028
|
+
return { scope: e2 ?? void 0, get: async (n2) => {
|
|
1029
|
+
if (t2 || !e2) return null;
|
|
1030
|
+
try {
|
|
1031
|
+
return await e2.get(n2);
|
|
1032
|
+
} catch (e3) {
|
|
1033
|
+
return G(e3, { feature: U.warmup, action: `read`, level: `warning`, contexts: { warmup: { key: n2 } } }), null;
|
|
1034
|
+
}
|
|
1035
|
+
}, set: (n2, r2) => {
|
|
1036
|
+
if (t2 && e2) try {
|
|
1037
|
+
e2.set(n2, r2);
|
|
1038
|
+
} catch {
|
|
1039
|
+
}
|
|
1040
|
+
} };
|
|
1041
|
+
}
|
|
1042
|
+
var kn = `bookings-uou`;
|
|
1043
|
+
function An() {
|
|
1044
|
+
return `${kn}:locations:all`;
|
|
1045
|
+
}
|
|
1046
|
+
var jn = 5e3;
|
|
1047
|
+
var Mn = 100;
|
|
1048
|
+
var Nn = `wix-warmup-data`;
|
|
1049
|
+
var X = null;
|
|
1050
|
+
function Pn(e2) {
|
|
1051
|
+
if (typeof document < `u`) try {
|
|
1052
|
+
let t2 = document.getElementById(Nn)?.textContent;
|
|
1053
|
+
return t2 ? (X?.text !== t2 && (X = { text: t2, data: JSON.parse(t2).builderComponentsWarmupData ?? {} }), X.data[e2] ?? void 0) : void 0;
|
|
1054
|
+
} catch {
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
var Fn = () => ({ promises: /* @__PURE__ */ new Map(), invalidatedWarmup: /* @__PURE__ */ new Set() });
|
|
1059
|
+
var In = Fn();
|
|
1060
|
+
var Ln = /* @__PURE__ */ new WeakMap();
|
|
1061
|
+
var Rn = /* @__PURE__ */ new WeakMap();
|
|
1062
|
+
function zn(e2) {
|
|
1063
|
+
if (!e2) return In;
|
|
1064
|
+
let t2 = Ln.get(e2);
|
|
1065
|
+
return t2 || (t2 = Fn(), Ln.set(e2, t2)), t2;
|
|
1066
|
+
}
|
|
1067
|
+
function Bn({ key: e2, warmupData: t2, fetchData: n2, refresh: r2 = false }) {
|
|
1068
|
+
if (e2 === null) return n2();
|
|
1069
|
+
if (typeof window > `u`) {
|
|
1070
|
+
let r3 = () => n2().then((n3) => (t2.set(e2, n3), n3)), { scope: i3 } = t2;
|
|
1071
|
+
if (!i3) return r3();
|
|
1072
|
+
let a3 = Rn.get(i3);
|
|
1073
|
+
a3 || (a3 = /* @__PURE__ */ new Map(), Rn.set(i3, a3));
|
|
1074
|
+
let o3 = a3.get(e2);
|
|
1075
|
+
if (o3) return o3;
|
|
1076
|
+
let s3 = r3();
|
|
1077
|
+
return a3.set(e2, s3), s3.catch(() => a3.delete(e2)), s3;
|
|
1078
|
+
}
|
|
1079
|
+
let i2 = zn(t2.scope), a2 = Date.now();
|
|
1080
|
+
for (let [e3, t3] of i2.promises) t3.expiresAt <= a2 && i2.promises.delete(e3);
|
|
1081
|
+
let o2 = i2.promises.get(e2);
|
|
1082
|
+
if (o2 && !r2) return o2.promise;
|
|
1083
|
+
r2 && i2.invalidatedWarmup.add(e2);
|
|
1084
|
+
let s2 = !i2.invalidatedWarmup.has(e2);
|
|
1085
|
+
if (s2) {
|
|
1086
|
+
let t3 = Pn(e2);
|
|
1087
|
+
if (t3 !== void 0) {
|
|
1088
|
+
let n3 = K(t3);
|
|
1089
|
+
return i2.promises.set(e2, { promise: n3, expiresAt: a2 + jn }), n3;
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
let c2 = (async () => {
|
|
1093
|
+
if (s2) {
|
|
1094
|
+
let n3 = await t2.get(e2);
|
|
1095
|
+
if (n3 != null) return n3;
|
|
1096
|
+
}
|
|
1097
|
+
return n2();
|
|
1098
|
+
})();
|
|
1099
|
+
i2.promises.size >= Mn && i2.promises.delete(i2.promises.keys().next().value);
|
|
1100
|
+
let l2 = { promise: c2, expiresAt: 1 / 0 };
|
|
1101
|
+
return i2.promises.set(e2, l2), c2.then(() => {
|
|
1102
|
+
l2.expiresAt = Date.now() + jn;
|
|
1103
|
+
}, () => {
|
|
1104
|
+
i2.promises.get(e2) === l2 && i2.promises.delete(e2);
|
|
1105
|
+
}), c2;
|
|
1106
|
+
}
|
|
1107
|
+
var Vn = [{ path: `businessLocations.locations.business.address.geocode.latitude` }, { path: `businessLocations.locations.business.address.geocode.longitude` }, { path: `businessLocations.locations.custom.address.geocode.latitude` }, { path: `businessLocations.locations.custom.address.geocode.longitude` }, { path: `businessLocations.locations.calculatedAddress.geocode.latitude` }, { path: `businessLocations.locations.calculatedAddress.geocode.longitude` }];
|
|
1108
|
+
function Hn(e2) {
|
|
1109
|
+
return xt(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: `` }] } }));
|
|
1110
|
+
}
|
|
1111
|
+
var Un = `@wix/auto_sdk_bookings_services`;
|
|
1112
|
+
function Wn(e2) {
|
|
1113
|
+
function t2({ host: t3 }) {
|
|
1114
|
+
return { entityFqdn: `wix.bookings.services.v2.service`, method: `POST`, methodFqn: `wix.bookings.services.v2.ServicesService.QueryLocations`, packageName: Un, migrationOptions: { optInTransformResponse: true }, url: Hn({ protoPath: `/v2/services/locations/query`, data: e2, host: t3 }), data: e2, transformResponse: (e3) => nt(e3, [{ transformFn: Wt, paths: Vn }]) };
|
|
1115
|
+
}
|
|
1116
|
+
return t2;
|
|
1117
|
+
}
|
|
1118
|
+
var Gn = [{ path: `businessLocations.locations.calculatedAddress` }, { path: `businessLocations.locations.business.address` }, { path: `businessLocations.locations.custom.address` }];
|
|
1119
|
+
async function Kn(e2) {
|
|
1120
|
+
let { httpClient: t2, sideEffects: n2 } = arguments[1], r2 = Wn(Ke({ filter: e2?.filter }));
|
|
1121
|
+
n2?.onSiteCall?.();
|
|
1122
|
+
try {
|
|
1123
|
+
let e3 = await t2.request(r2);
|
|
1124
|
+
return n2?.onSuccess?.(e3), qe(nt(e3.data, [{ transformFn: Gt, paths: Gn }]));
|
|
1125
|
+
} catch (e3) {
|
|
1126
|
+
let t3 = ft(e3, { spreadPathsToArguments: {}, explicitPathsToArguments: { filter: `$[0].filter` }, singleArgumentUnchanged: false }, [`options`]);
|
|
1127
|
+
throw n2?.onError?.(e3), t3;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
function qn(e2) {
|
|
1131
|
+
return (t2) => Kn(t2, { httpClient: e2 });
|
|
1132
|
+
}
|
|
1133
|
+
var Jn = bt(qn);
|
|
1134
|
+
var Yn = `13d21c63-b5ec-5912-8397-c3a5ddb27a97`;
|
|
1135
|
+
var Xn = function(e2) {
|
|
1136
|
+
return e2.BOOK_ONLINE = `bookingsBookOnline`, e2.SERVICE_PAGE = `bookingsServicePage`, e2.CALENDAR_PAGE = `bookingsCalendar`, e2.FORM_PAGE = `bookingsForm`, e2;
|
|
1137
|
+
}({});
|
|
1138
|
+
function Z(e2) {
|
|
1139
|
+
return e2.business?._id ?? null;
|
|
1140
|
+
}
|
|
1141
|
+
function Q(e2) {
|
|
1142
|
+
return e2.business?.name ?? null;
|
|
1143
|
+
}
|
|
1144
|
+
async function Zn() {
|
|
1145
|
+
let e2 = await Jn({ filter: { services: { appId: Yn, hidden: false } } });
|
|
1146
|
+
return { locations: [...e2.businessLocations?.locations ?? []].sort((e3, t2) => (Q(e3) ?? ``).localeCompare(Q(t2) ?? ``)), hasOtherLocations: !!(e2.customLocations?.exists || e2.customerLocations?.exists) };
|
|
1147
|
+
}
|
|
1148
|
+
function Qn({ isLoading: e2, hasError: t2, refetch: n2, children: r2 }) {
|
|
1149
|
+
let { searchParams: i2 } = J(), a2 = { locations: [], locationItems: [], selectedLocationId: i2.get(Y.location), selectedLocationIndex: -1, selectedLocation: null, selectedLocationName: null, hasOtherLocations: false, hasMultipleLocations: false, isLoading: e2, hasError: t2, refetch: n2, selectLocation: () => {
|
|
1150
|
+
} };
|
|
1151
|
+
return f($.Provider, { value: a2, children: r2 });
|
|
1152
|
+
}
|
|
1153
|
+
function $n({ refetch: e2, children: t2 }) {
|
|
1154
|
+
return f(Qn, { isLoading: true, hasError: false, refetch: e2, children: t2 });
|
|
1155
|
+
}
|
|
1156
|
+
function er({ refetch: e2, children: t2 }) {
|
|
1157
|
+
return f(Qn, { isLoading: false, hasError: true, refetch: e2, children: t2 });
|
|
1158
|
+
}
|
|
1159
|
+
function tr(e2) {
|
|
1160
|
+
return e2;
|
|
1161
|
+
}
|
|
1162
|
+
var nr = tr(`@wix/viewer-service-business-logger`);
|
|
1163
|
+
function rr(e2) {
|
|
1164
|
+
return { evid: 32, src: 16, endpoint: ``, params: e2 };
|
|
1165
|
+
}
|
|
1166
|
+
var ir = { 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` };
|
|
1167
|
+
Xn.BOOK_ONLINE;
|
|
1168
|
+
var ar = `new_bookings_server`;
|
|
1169
|
+
var or = (e2) => {
|
|
1170
|
+
let t2 = d(nr);
|
|
1171
|
+
return r((n2) => {
|
|
1172
|
+
t2.reportBi({ widget_name: e2, bookingsPlatform: ar, is_over_editor: false, ...n2.params, src: n2.src, evid: n2.evid }, { endpoint: n2.endpoint });
|
|
1173
|
+
}, [t2, e2]);
|
|
1174
|
+
};
|
|
1175
|
+
var sr = (e2, t2 = true) => {
|
|
1176
|
+
let n2 = or(e2), { getParsedUrl: r2 } = J(), i2 = s(false);
|
|
1177
|
+
a(() => {
|
|
1178
|
+
t2 && !i2.current && (i2.current = true, n2(rr({ referralInfo: r2().searchParams.get(Y.referral) ?? void 0 })));
|
|
1179
|
+
}, [t2, n2, r2]);
|
|
1180
|
+
};
|
|
1181
|
+
var $ = n(null);
|
|
1182
|
+
var cr = `useLocationsContext must be used within LocationsContextProvider`;
|
|
1183
|
+
function lr() {
|
|
1184
|
+
let e2 = i($);
|
|
1185
|
+
if (!e2) throw Error(cr);
|
|
1186
|
+
return e2;
|
|
1187
|
+
}
|
|
1188
|
+
function ur(e2, t2) {
|
|
1189
|
+
let n2 = Z(e2);
|
|
1190
|
+
return { locationId: n2, locationName: Q(e2), isSelected: n2 != null && n2 === t2 };
|
|
1191
|
+
}
|
|
1192
|
+
var dr = (e2) => ({ ...e2, hasError: false });
|
|
1193
|
+
var fr = () => ({ locations: [], hasOtherLocations: false, hasError: true });
|
|
1194
|
+
function pr({ locationsPromise: e2, initialLocationId: t2, refetch: n2, children: i2 }) {
|
|
1195
|
+
let { locations: c2, hasOtherLocations: l2, hasError: u2 } = dn(e2), { pathname: d2, searchParams: p2, pushUrl: m2, getExternalBaseUrl: h2 } = J(), g2 = p2.get(Y.location), _2 = r((e3) => {
|
|
1196
|
+
let t3 = new URLSearchParams(p2);
|
|
1197
|
+
e3 ? t3.set(Y.location, e3) : t3.delete(Y.location), t3.delete(Y.page);
|
|
1198
|
+
let n3 = t3.toString(), r2 = n3 ? `${d2}?${n3}` : d2;
|
|
1199
|
+
m2(new URL(r2, `${h2()}/`), { disableScrollToTop: true, skipHistory: false });
|
|
1200
|
+
}, [d2, p2, m2, h2]), v2 = s(false);
|
|
1201
|
+
a(() => {
|
|
1202
|
+
v2.current || (v2.current = true, t2 && !p2.get(Y.location) && _2(t2));
|
|
1203
|
+
}, [t2, p2, _2]);
|
|
1204
|
+
let y2 = c2.findIndex((e3) => Z(e3) === g2), b2 = c2.find((e3) => Z(e3) === g2) ?? null, x2 = c2.filter((e3) => Z(e3)).length + +!!l2, S2 = o(() => ({ locations: c2, locationItems: c2.map((e3) => ur(e3, g2)), selectedLocationId: g2, selectedLocationIndex: y2, selectedLocation: b2, selectedLocationName: b2 ? Q(b2) : null, hasOtherLocations: l2, hasMultipleLocations: x2 > 1, isLoading: false, hasError: u2, refetch: n2, selectLocation: _2 }), [c2, g2, y2, b2, l2, u2, x2, n2, _2]);
|
|
1205
|
+
return f($.Provider, { value: S2, children: i2 });
|
|
1206
|
+
}
|
|
1207
|
+
function mr({ initialLocationId: e2, children: n2 }) {
|
|
1208
|
+
sr(ir.LOCATIONS);
|
|
1209
|
+
let i2 = On(), [a2, s2] = c(0), l2 = o(() => pn(Bn({ key: An(), refresh: a2 !== 0, warmupData: i2, fetchData: () => ln(`locations-context-load`, { feature: U.locations }, Zn()) }), dr, fr), [a2]), u2 = r(() => s2((e3) => e3 + 1), []);
|
|
1210
|
+
return f(un, { fallback: f(er, { refetch: u2, children: n2 }), feature: U.locations, children: f(t, { fallback: f($n, { refetch: u2, children: n2 }), children: f(pr, { locationsPromise: l2, initialLocationId: e2, refetch: u2, children: n2 }) }) });
|
|
1211
|
+
}
|
|
1212
|
+
var hr = tn;
|
|
1213
|
+
export {
|
|
1214
|
+
cr as LOCATIONS_CONTEXT_MISSING_PROVIDER_ERROR,
|
|
1215
|
+
mr as LocationsContextProvider,
|
|
1216
|
+
mr as default,
|
|
1217
|
+
hr as injectAccessTokenGetter,
|
|
1218
|
+
$ as locationsContext,
|
|
1219
|
+
lr as useLocationsContext
|
|
1220
|
+
};
|
|
1221
|
+
//# sourceMappingURL=context-locations-context.mjs.map
|