@gomusdev/web-components 4.11.0 → 4.12.0
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/README.md +6 -0
- package/dist-js/gomus-webcomponents.iife.js +89 -9
- package/dist-js/gomus-webcomponents.js +89 -9
- package/dist-js/gomus-webcomponents.min.iife.js +18 -18
- package/dist-js/gomus-webcomponents.min.js +3028 -2972
- package/dist-js/src/components/ticketSelection/subcomponents/calendar/components/Calendar.spec.d.ts +1 -0
- package/dist-js/src/components/ticketSelection/subcomponents/calendar/lib/calendar.spec.d.ts +1 -0
- package/dist-js/src/components/ticketSelection/subcomponents/calendar/lib/calendar.svelte.d.ts +28 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6480,6 +6480,9 @@ createHTML: (html) => {
|
|
|
6480
6480
|
var isObject$2 = (value) => {
|
|
6481
6481
|
return !!value && value.constructor === Object;
|
|
6482
6482
|
};
|
|
6483
|
+
var isFunction$2 = (value) => {
|
|
6484
|
+
return !!(value && value.constructor && value.call && value.apply);
|
|
6485
|
+
};
|
|
6483
6486
|
var isString = (value) => {
|
|
6484
6487
|
return typeof value === "string" || value instanceof String;
|
|
6485
6488
|
};
|
|
@@ -6490,6 +6493,12 @@ createHTML: (html) => {
|
|
|
6490
6493
|
return false;
|
|
6491
6494
|
}
|
|
6492
6495
|
};
|
|
6496
|
+
var isPromise = (value) => {
|
|
6497
|
+
if (!value) return false;
|
|
6498
|
+
if (!value.then) return false;
|
|
6499
|
+
if (!isFunction$2(value.then)) return false;
|
|
6500
|
+
return true;
|
|
6501
|
+
};
|
|
6493
6502
|
//#endregion
|
|
6494
6503
|
//#region ../../node_modules/.pnpm/radash@12.1.1/node_modules/radash/dist/esm/array.mjs
|
|
6495
6504
|
var group = (array, getGroupId) => {
|
|
@@ -37921,6 +37930,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
37921
37930
|
customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"]));
|
|
37922
37931
|
//#endregion
|
|
37923
37932
|
//#region src/components/ticketSelection/subcomponents/calendar/lib/calendar.svelte.ts
|
|
37933
|
+
function describeAvailability(value) {
|
|
37934
|
+
if (typeof value === "string") return `'${value}'`;
|
|
37935
|
+
if (value === null || value === void 0) return String(value);
|
|
37936
|
+
if (isPromise(value)) return "a Promise — the callback must be synchronous";
|
|
37937
|
+
return `a ${typeof value}`;
|
|
37938
|
+
}
|
|
37924
37939
|
var Calendar = class {
|
|
37925
37940
|
#details = /* @__PURE__ */ state();
|
|
37926
37941
|
get details() {
|
|
@@ -37943,6 +37958,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
37943
37958
|
set selected(value) {
|
|
37944
37959
|
set(this.#selected, value, true);
|
|
37945
37960
|
}
|
|
37961
|
+
#availabilityOverride = /* @__PURE__ */ state();
|
|
37962
|
+
get availabilityOverride() {
|
|
37963
|
+
return get$2(this.#availabilityOverride);
|
|
37964
|
+
}
|
|
37965
|
+
set availabilityOverride(value) {
|
|
37966
|
+
set(this.#availabilityOverride, value, true);
|
|
37967
|
+
}
|
|
37968
|
+
#logged = [];
|
|
37946
37969
|
get endpoint() {
|
|
37947
37970
|
return (this.details?.filters?.map((f) => getFilter(f).calendarEndpoint).filter(Boolean) ?? [])[0] ?? null;
|
|
37948
37971
|
}
|
|
@@ -37954,12 +37977,49 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
37954
37977
|
default: return;
|
|
37955
37978
|
}
|
|
37956
37979
|
}
|
|
37980
|
+
/** What gomus makes of a date on its own, ignoring any integrator override. */
|
|
37981
|
+
defaultAvailability(date) {
|
|
37982
|
+
switch (this.dates?.[date.toString()]) {
|
|
37983
|
+
case "unavailable": return "unavailable";
|
|
37984
|
+
case "fully_booked": return "sold_out";
|
|
37985
|
+
default: return "available";
|
|
37986
|
+
}
|
|
37987
|
+
}
|
|
37988
|
+
/** The gomus default, with the integrator's override given the last word. */
|
|
37989
|
+
availability(date) {
|
|
37990
|
+
const defaultAvailability = this.defaultAvailability(date);
|
|
37991
|
+
const override = this.#overrideCallback();
|
|
37992
|
+
if (!override) return defaultAvailability;
|
|
37993
|
+
let returned;
|
|
37994
|
+
try {
|
|
37995
|
+
returned = override(date.toString(), defaultAvailability);
|
|
37996
|
+
} catch (error) {
|
|
37997
|
+
this.#reportOnce("threw", `[go-calendar] the availability-override callback threw (${String(error)}) — using the gomus default instead.`);
|
|
37998
|
+
return defaultAvailability;
|
|
37999
|
+
}
|
|
38000
|
+
if (returned === "pass_through") return defaultAvailability;
|
|
38001
|
+
if (returned === "available" || returned === "sold_out" || returned === "unavailable") return returned;
|
|
38002
|
+
this.#reportOnce("returned", `[go-calendar] the availability-override callback must return 'available', 'sold_out', 'unavailable' or 'pass_through', got ${describeAvailability(returned)} — using the gomus default instead.`);
|
|
38003
|
+
return defaultAvailability;
|
|
38004
|
+
}
|
|
38005
|
+
#overrideCallback() {
|
|
38006
|
+
const source = this.availabilityOverride;
|
|
38007
|
+
if (typeof source === "function") return source;
|
|
38008
|
+
if (!source) return void 0;
|
|
38009
|
+
const candidate = globalThis[source];
|
|
38010
|
+
if (typeof candidate === "function") return candidate;
|
|
38011
|
+
this.#reportOnce(`unresolved:${source}`, `[go-calendar] availability-override="${source}" does not resolve to a function on window — using the gomus defaults.`, console.warn);
|
|
38012
|
+
}
|
|
38013
|
+
#reportOnce(key, message, log = console.error) {
|
|
38014
|
+
if (this.#logged.includes(key)) return;
|
|
38015
|
+
this.#logged.push(key);
|
|
38016
|
+
log(message);
|
|
38017
|
+
}
|
|
37957
38018
|
isDateDisabled(date) {
|
|
37958
|
-
|
|
37959
|
-
return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0;
|
|
38019
|
+
return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0 || this.availability(date) === "unavailable";
|
|
37960
38020
|
}
|
|
37961
38021
|
isDateUnavailable(date) {
|
|
37962
|
-
return this.
|
|
38022
|
+
return this.availability(date) === "sold_out";
|
|
37963
38023
|
}
|
|
37964
38024
|
get apiFilters() {
|
|
37965
38025
|
return this.details?.filters?.map((f) => getFilter(f).apiToken).filter(Boolean);
|
|
@@ -37988,13 +38048,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
37988
38048
|
thisMonth.add({ months: 2 })
|
|
37989
38049
|
];
|
|
37990
38050
|
}
|
|
38051
|
+
#mergedDates(fetchMonth) {
|
|
38052
|
+
return this.fetchPeriod().reduce((all, startAt) => Object.assign(all, fetchMonth(this.params(startAt))), {});
|
|
38053
|
+
}
|
|
37991
38054
|
eventsDates() {
|
|
37992
|
-
|
|
37993
|
-
return this.fetchPeriod().reduce((prev, startAt) => assign(prev, method(this.params(startAt))), {});
|
|
38055
|
+
return this.#mergedDates((params) => shop.calendar(params));
|
|
37994
38056
|
}
|
|
37995
38057
|
ticketsDates() {
|
|
37996
|
-
|
|
37997
|
-
return this.fetchPeriod().reduce((prev, startAt) => assign(prev, method(this.params(startAt))), {});
|
|
38058
|
+
return this.#mergedDates((params) => shop.ticketsCalendar(params));
|
|
37998
38059
|
}
|
|
37999
38060
|
};
|
|
38000
38061
|
//#endregion
|
|
@@ -38226,12 +38287,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
38226
38287
|
//#region src/components/ticketSelection/subcomponents/calendar/components/Calendar.svelte
|
|
38227
38288
|
function Calendar_1($$anchor, $$props) {
|
|
38228
38289
|
push($$props, true);
|
|
38290
|
+
/**
|
|
38291
|
+
* Per-date availability override. As an attribute it names a global function
|
|
38292
|
+
* (`<go-calendar availability-override="shopRule">`); as a property it is the function
|
|
38293
|
+
* itself (`element.availabilityOverride = fn`).
|
|
38294
|
+
*/
|
|
38295
|
+
let availabilityOverride = prop($$props, "availabilityOverride", 7);
|
|
38229
38296
|
const ticketsCalendar = new Calendar();
|
|
38230
38297
|
const details = ticketsCalendar;
|
|
38231
38298
|
const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
|
|
38232
38299
|
const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value);
|
|
38233
38300
|
user_effect(() => {
|
|
38234
38301
|
ticketsCalendar.details = get$2(ticketSelectionDetails);
|
|
38302
|
+
ticketsCalendar.availabilityOverride = availabilityOverride();
|
|
38235
38303
|
});
|
|
38236
38304
|
$$props.$$host.addEventListener("go-date-select", (e) => {
|
|
38237
38305
|
if (get$2(ticketSelectionDetails)) {
|
|
@@ -38239,7 +38307,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
38239
38307
|
get$2(ticketSelectionDetails).selectedTimeslot = void 0;
|
|
38240
38308
|
}
|
|
38241
38309
|
});
|
|
38242
|
-
var $$exports = {
|
|
38310
|
+
var $$exports = {
|
|
38311
|
+
details,
|
|
38312
|
+
get availabilityOverride() {
|
|
38313
|
+
return availabilityOverride();
|
|
38314
|
+
},
|
|
38315
|
+
set availabilityOverride($$value) {
|
|
38316
|
+
availabilityOverride($$value);
|
|
38317
|
+
flushSync();
|
|
38318
|
+
}
|
|
38319
|
+
};
|
|
38243
38320
|
var fragment = comment();
|
|
38244
38321
|
var node = first_child(fragment);
|
|
38245
38322
|
var consequent = ($$anchor) => {
|
|
@@ -38253,7 +38330,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
38253
38330
|
append($$anchor, fragment);
|
|
38254
38331
|
return pop($$exports);
|
|
38255
38332
|
}
|
|
38256
|
-
customElements.define("go-calendar", create_custom_element(Calendar_1, {
|
|
38333
|
+
customElements.define("go-calendar", create_custom_element(Calendar_1, { availabilityOverride: {
|
|
38334
|
+
attribute: "availability-override",
|
|
38335
|
+
type: "String"
|
|
38336
|
+
} }, [], ["details"]));
|
|
38257
38337
|
//#endregion
|
|
38258
38338
|
//#region src/components/ticketSelection/subcomponents/addToCartButton/AddToCartButton.svelte.ts
|
|
38259
38339
|
var Details = class {
|
|
@@ -6479,6 +6479,9 @@ var isArray = Array.isArray;
|
|
|
6479
6479
|
var isObject$2 = (value) => {
|
|
6480
6480
|
return !!value && value.constructor === Object;
|
|
6481
6481
|
};
|
|
6482
|
+
var isFunction$2 = (value) => {
|
|
6483
|
+
return !!(value && value.constructor && value.call && value.apply);
|
|
6484
|
+
};
|
|
6482
6485
|
var isString = (value) => {
|
|
6483
6486
|
return typeof value === "string" || value instanceof String;
|
|
6484
6487
|
};
|
|
@@ -6489,6 +6492,12 @@ var isNumber = (value) => {
|
|
|
6489
6492
|
return false;
|
|
6490
6493
|
}
|
|
6491
6494
|
};
|
|
6495
|
+
var isPromise = (value) => {
|
|
6496
|
+
if (!value) return false;
|
|
6497
|
+
if (!value.then) return false;
|
|
6498
|
+
if (!isFunction$2(value.then)) return false;
|
|
6499
|
+
return true;
|
|
6500
|
+
};
|
|
6492
6501
|
//#endregion
|
|
6493
6502
|
//#region ../../node_modules/.pnpm/radash@12.1.1/node_modules/radash/dist/esm/array.mjs
|
|
6494
6503
|
var group = (array, getGroupId) => {
|
|
@@ -37920,6 +37929,12 @@ delegate(["change"]);
|
|
|
37920
37929
|
customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"]));
|
|
37921
37930
|
//#endregion
|
|
37922
37931
|
//#region src/components/ticketSelection/subcomponents/calendar/lib/calendar.svelte.ts
|
|
37932
|
+
function describeAvailability(value) {
|
|
37933
|
+
if (typeof value === "string") return `'${value}'`;
|
|
37934
|
+
if (value === null || value === void 0) return String(value);
|
|
37935
|
+
if (isPromise(value)) return "a Promise — the callback must be synchronous";
|
|
37936
|
+
return `a ${typeof value}`;
|
|
37937
|
+
}
|
|
37923
37938
|
var Calendar = class {
|
|
37924
37939
|
#details = /* @__PURE__ */ state();
|
|
37925
37940
|
get details() {
|
|
@@ -37942,6 +37957,14 @@ var Calendar = class {
|
|
|
37942
37957
|
set selected(value) {
|
|
37943
37958
|
set(this.#selected, value, true);
|
|
37944
37959
|
}
|
|
37960
|
+
#availabilityOverride = /* @__PURE__ */ state();
|
|
37961
|
+
get availabilityOverride() {
|
|
37962
|
+
return get$2(this.#availabilityOverride);
|
|
37963
|
+
}
|
|
37964
|
+
set availabilityOverride(value) {
|
|
37965
|
+
set(this.#availabilityOverride, value, true);
|
|
37966
|
+
}
|
|
37967
|
+
#logged = [];
|
|
37945
37968
|
get endpoint() {
|
|
37946
37969
|
return (this.details?.filters?.map((f) => getFilter(f).calendarEndpoint).filter(Boolean) ?? [])[0] ?? null;
|
|
37947
37970
|
}
|
|
@@ -37953,12 +37976,49 @@ var Calendar = class {
|
|
|
37953
37976
|
default: return;
|
|
37954
37977
|
}
|
|
37955
37978
|
}
|
|
37979
|
+
/** What gomus makes of a date on its own, ignoring any integrator override. */
|
|
37980
|
+
defaultAvailability(date) {
|
|
37981
|
+
switch (this.dates?.[date.toString()]) {
|
|
37982
|
+
case "unavailable": return "unavailable";
|
|
37983
|
+
case "fully_booked": return "sold_out";
|
|
37984
|
+
default: return "available";
|
|
37985
|
+
}
|
|
37986
|
+
}
|
|
37987
|
+
/** The gomus default, with the integrator's override given the last word. */
|
|
37988
|
+
availability(date) {
|
|
37989
|
+
const defaultAvailability = this.defaultAvailability(date);
|
|
37990
|
+
const override = this.#overrideCallback();
|
|
37991
|
+
if (!override) return defaultAvailability;
|
|
37992
|
+
let returned;
|
|
37993
|
+
try {
|
|
37994
|
+
returned = override(date.toString(), defaultAvailability);
|
|
37995
|
+
} catch (error) {
|
|
37996
|
+
this.#reportOnce("threw", `[go-calendar] the availability-override callback threw (${String(error)}) — using the gomus default instead.`);
|
|
37997
|
+
return defaultAvailability;
|
|
37998
|
+
}
|
|
37999
|
+
if (returned === "pass_through") return defaultAvailability;
|
|
38000
|
+
if (returned === "available" || returned === "sold_out" || returned === "unavailable") return returned;
|
|
38001
|
+
this.#reportOnce("returned", `[go-calendar] the availability-override callback must return 'available', 'sold_out', 'unavailable' or 'pass_through', got ${describeAvailability(returned)} — using the gomus default instead.`);
|
|
38002
|
+
return defaultAvailability;
|
|
38003
|
+
}
|
|
38004
|
+
#overrideCallback() {
|
|
38005
|
+
const source = this.availabilityOverride;
|
|
38006
|
+
if (typeof source === "function") return source;
|
|
38007
|
+
if (!source) return void 0;
|
|
38008
|
+
const candidate = globalThis[source];
|
|
38009
|
+
if (typeof candidate === "function") return candidate;
|
|
38010
|
+
this.#reportOnce(`unresolved:${source}`, `[go-calendar] availability-override="${source}" does not resolve to a function on window — using the gomus defaults.`, console.warn);
|
|
38011
|
+
}
|
|
38012
|
+
#reportOnce(key, message, log = console.error) {
|
|
38013
|
+
if (this.#logged.includes(key)) return;
|
|
38014
|
+
this.#logged.push(key);
|
|
38015
|
+
log(message);
|
|
38016
|
+
}
|
|
37956
38017
|
isDateDisabled(date) {
|
|
37957
|
-
|
|
37958
|
-
return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0;
|
|
38018
|
+
return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0 || this.availability(date) === "unavailable";
|
|
37959
38019
|
}
|
|
37960
38020
|
isDateUnavailable(date) {
|
|
37961
|
-
return this.
|
|
38021
|
+
return this.availability(date) === "sold_out";
|
|
37962
38022
|
}
|
|
37963
38023
|
get apiFilters() {
|
|
37964
38024
|
return this.details?.filters?.map((f) => getFilter(f).apiToken).filter(Boolean);
|
|
@@ -37987,13 +38047,14 @@ var Calendar = class {
|
|
|
37987
38047
|
thisMonth.add({ months: 2 })
|
|
37988
38048
|
];
|
|
37989
38049
|
}
|
|
38050
|
+
#mergedDates(fetchMonth) {
|
|
38051
|
+
return this.fetchPeriod().reduce((all, startAt) => Object.assign(all, fetchMonth(this.params(startAt))), {});
|
|
38052
|
+
}
|
|
37990
38053
|
eventsDates() {
|
|
37991
|
-
|
|
37992
|
-
return this.fetchPeriod().reduce((prev, startAt) => assign(prev, method(this.params(startAt))), {});
|
|
38054
|
+
return this.#mergedDates((params) => shop.calendar(params));
|
|
37993
38055
|
}
|
|
37994
38056
|
ticketsDates() {
|
|
37995
|
-
|
|
37996
|
-
return this.fetchPeriod().reduce((prev, startAt) => assign(prev, method(this.params(startAt))), {});
|
|
38057
|
+
return this.#mergedDates((params) => shop.ticketsCalendar(params));
|
|
37997
38058
|
}
|
|
37998
38059
|
};
|
|
37999
38060
|
//#endregion
|
|
@@ -38225,12 +38286,19 @@ create_custom_element(CalendarUI, { calendarClass: {} }, [], ["details"], { mode
|
|
|
38225
38286
|
//#region src/components/ticketSelection/subcomponents/calendar/components/Calendar.svelte
|
|
38226
38287
|
function Calendar_1($$anchor, $$props) {
|
|
38227
38288
|
push($$props, true);
|
|
38289
|
+
/**
|
|
38290
|
+
* Per-date availability override. As an attribute it names a global function
|
|
38291
|
+
* (`<go-calendar availability-override="shopRule">`); as a property it is the function
|
|
38292
|
+
* itself (`element.availabilityOverride = fn`).
|
|
38293
|
+
*/
|
|
38294
|
+
let availabilityOverride = prop($$props, "availabilityOverride", 7);
|
|
38228
38295
|
const ticketsCalendar = new Calendar();
|
|
38229
38296
|
const details = ticketsCalendar;
|
|
38230
38297
|
const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
|
|
38231
38298
|
const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value);
|
|
38232
38299
|
user_effect(() => {
|
|
38233
38300
|
ticketsCalendar.details = get$2(ticketSelectionDetails);
|
|
38301
|
+
ticketsCalendar.availabilityOverride = availabilityOverride();
|
|
38234
38302
|
});
|
|
38235
38303
|
$$props.$$host.addEventListener("go-date-select", (e) => {
|
|
38236
38304
|
if (get$2(ticketSelectionDetails)) {
|
|
@@ -38238,7 +38306,16 @@ function Calendar_1($$anchor, $$props) {
|
|
|
38238
38306
|
get$2(ticketSelectionDetails).selectedTimeslot = void 0;
|
|
38239
38307
|
}
|
|
38240
38308
|
});
|
|
38241
|
-
var $$exports = {
|
|
38309
|
+
var $$exports = {
|
|
38310
|
+
details,
|
|
38311
|
+
get availabilityOverride() {
|
|
38312
|
+
return availabilityOverride();
|
|
38313
|
+
},
|
|
38314
|
+
set availabilityOverride($$value) {
|
|
38315
|
+
availabilityOverride($$value);
|
|
38316
|
+
flushSync();
|
|
38317
|
+
}
|
|
38318
|
+
};
|
|
38242
38319
|
var fragment = comment();
|
|
38243
38320
|
var node = first_child(fragment);
|
|
38244
38321
|
var consequent = ($$anchor) => {
|
|
@@ -38252,7 +38329,10 @@ function Calendar_1($$anchor, $$props) {
|
|
|
38252
38329
|
append($$anchor, fragment);
|
|
38253
38330
|
return pop($$exports);
|
|
38254
38331
|
}
|
|
38255
|
-
customElements.define("go-calendar", create_custom_element(Calendar_1, {
|
|
38332
|
+
customElements.define("go-calendar", create_custom_element(Calendar_1, { availabilityOverride: {
|
|
38333
|
+
attribute: "availability-override",
|
|
38334
|
+
type: "String"
|
|
38335
|
+
} }, [], ["details"]));
|
|
38256
38336
|
//#endregion
|
|
38257
38337
|
//#region src/components/ticketSelection/subcomponents/addToCartButton/AddToCartButton.svelte.ts
|
|
38258
38338
|
var Details = class {
|