@gomusdev/web-components 4.11.0 → 4.13.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 +12 -0
- package/dist-js/gomus-webcomponents.iife.js +200 -26
- package/dist-js/gomus-webcomponents.js +200 -26
- package/dist-js/gomus-webcomponents.min.iife.js +35 -35
- package/dist-js/gomus-webcomponents.min.js +6122 -5996
- 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/dist-js/src/lib/stores/shop.svelte.d.ts +1 -3
- package/dist-js/src/lib/stores/shop.translate.spec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6377,6 +6377,18 @@ function warnOnInvalidLocale(locale) {
|
|
|
6377
6377
|
console.warn(`[go] Invalid locale "${locale}" — not a valid BCP 47 language tag (use "de", "de-CH", "en", …). Price and date formatting will throw.`);
|
|
6378
6378
|
}
|
|
6379
6379
|
}
|
|
6380
|
+
var defaultTranslations_default = {
|
|
6381
|
+
en: {
|
|
6382
|
+
"quantity.remove": "Remove item",
|
|
6383
|
+
"quantity.remove.label": "✕",
|
|
6384
|
+
"cart.item.remove": "✕"
|
|
6385
|
+
},
|
|
6386
|
+
de: {
|
|
6387
|
+
"quantity.remove": "Artikel entfernen",
|
|
6388
|
+
"quantity.remove.label": "✕",
|
|
6389
|
+
"cart.item.remove": "✕"
|
|
6390
|
+
}
|
|
6391
|
+
};
|
|
6380
6392
|
//#endregion
|
|
6381
6393
|
//#region src/lib/helpers/urls.ts
|
|
6382
6394
|
var ANGULAR_URLS = {
|
|
@@ -6479,6 +6491,9 @@ var isArray = Array.isArray;
|
|
|
6479
6491
|
var isObject$2 = (value) => {
|
|
6480
6492
|
return !!value && value.constructor === Object;
|
|
6481
6493
|
};
|
|
6494
|
+
var isFunction$2 = (value) => {
|
|
6495
|
+
return !!(value && value.constructor && value.call && value.apply);
|
|
6496
|
+
};
|
|
6482
6497
|
var isString = (value) => {
|
|
6483
6498
|
return typeof value === "string" || value instanceof String;
|
|
6484
6499
|
};
|
|
@@ -6489,6 +6504,12 @@ var isNumber = (value) => {
|
|
|
6489
6504
|
return false;
|
|
6490
6505
|
}
|
|
6491
6506
|
};
|
|
6507
|
+
var isPromise = (value) => {
|
|
6508
|
+
if (!value) return false;
|
|
6509
|
+
if (!value.then) return false;
|
|
6510
|
+
if (!isFunction$2(value.then)) return false;
|
|
6511
|
+
return true;
|
|
6512
|
+
};
|
|
6492
6513
|
//#endregion
|
|
6493
6514
|
//#region ../../node_modules/.pnpm/radash@12.1.1/node_modules/radash/dist/esm/array.mjs
|
|
6494
6515
|
var group = (array, getGroupId) => {
|
|
@@ -13713,6 +13734,7 @@ var NOT_SIGNED_IN = { error: {
|
|
|
13713
13734
|
success: false,
|
|
13714
13735
|
errors: ["Not signed in"]
|
|
13715
13736
|
} };
|
|
13737
|
+
var defaultTranslations = defaultTranslations_default;
|
|
13716
13738
|
var Shop = class {
|
|
13717
13739
|
type;
|
|
13718
13740
|
#data = /* @__PURE__ */ state(proxy({
|
|
@@ -13780,7 +13802,10 @@ var Shop = class {
|
|
|
13780
13802
|
return this.shop?.config.donations;
|
|
13781
13803
|
}
|
|
13782
13804
|
get translations() {
|
|
13783
|
-
return
|
|
13805
|
+
return {
|
|
13806
|
+
...defaultTranslations[(this.locale ?? "en").toLowerCase().split(/[-_]/)[0]] ?? defaultTranslations.en,
|
|
13807
|
+
...this.shop?.translations
|
|
13808
|
+
};
|
|
13784
13809
|
}
|
|
13785
13810
|
get currency() {
|
|
13786
13811
|
return this.shop?.config.currency;
|
|
@@ -15743,23 +15768,34 @@ function canDecrement(value, { floor = 0 }) {
|
|
|
15743
15768
|
}
|
|
15744
15769
|
//#endregion
|
|
15745
15770
|
//#region src/components/shared/quantityStepper/QuantityStepper.svelte
|
|
15746
|
-
var root$50 = /* @__PURE__ */ from_html(`<div class="go-quantity-stepper" role="group"><button type="button"
|
|
15771
|
+
var root$50 = /* @__PURE__ */ from_html(`<div class="go-quantity-stepper" role="group"><button type="button" tabindex="-1"><span aria-hidden="true"> </span></button> <input class="go-quantity-stepper-value" type="text" role="spinbutton" inputmode="numeric" autocomplete="off"/> <button type="button" class="go-quantity-stepper-button go-quantity-stepper-increment" tabindex="-1"><span aria-hidden="true">+</span></button></div>`);
|
|
15747
15772
|
function QuantityStepper($$anchor, $$props) {
|
|
15748
15773
|
const inputId = props_id();
|
|
15749
15774
|
push($$props, true);
|
|
15750
|
-
let value = prop($$props, "value", 7), min = prop($$props, "min", 7), max = prop($$props, "max", 7), floor = prop($$props, "floor", 7, 0), label = prop($$props, "label", 7), decreaseLabel = prop($$props, "decreaseLabel", 7), increaseLabel = prop($$props, "increaseLabel", 7), onChange = prop($$props, "onChange", 7);
|
|
15751
|
-
const
|
|
15775
|
+
let value = prop($$props, "value", 7), min = prop($$props, "min", 7), max = prop($$props, "max", 7), floor = prop($$props, "floor", 7, 0), label = prop($$props, "label", 7), decreaseLabel = prop($$props, "decreaseLabel", 7), increaseLabel = prop($$props, "increaseLabel", 7), onDecrementBelowMin = prop($$props, "onDecrementBelowMin", 7), removeAriaLabel = prop($$props, "removeAriaLabel", 7), removeLabel = prop($$props, "removeLabel", 7, "✕"), onChange = prop($$props, "onChange", 7);
|
|
15776
|
+
const removeMode = /* @__PURE__ */ user_derived(() => onDecrementBelowMin() != null);
|
|
15777
|
+
const removeBottom = /* @__PURE__ */ user_derived(() => Math.max(min(), 1));
|
|
15778
|
+
const bounds = /* @__PURE__ */ user_derived(() => get$2(removeMode) ? {
|
|
15779
|
+
min: get$2(removeBottom),
|
|
15780
|
+
max: max(),
|
|
15781
|
+
floor: get$2(removeBottom)
|
|
15782
|
+
} : {
|
|
15752
15783
|
min: min(),
|
|
15753
15784
|
max: max(),
|
|
15754
15785
|
floor: floor()
|
|
15755
|
-
})
|
|
15786
|
+
});
|
|
15787
|
+
const atRemove = /* @__PURE__ */ user_derived(() => get$2(removeMode) && value() <= get$2(removeBottom));
|
|
15756
15788
|
let inputEl;
|
|
15757
15789
|
let invalid = /* @__PURE__ */ state(false);
|
|
15758
|
-
const decDisabled = /* @__PURE__ */ user_derived(() => !canDecrement(value(), get$2(bounds)));
|
|
15790
|
+
const decDisabled = /* @__PURE__ */ user_derived(() => !get$2(atRemove) && !canDecrement(value(), get$2(bounds)));
|
|
15759
15791
|
const incDisabled = /* @__PURE__ */ user_derived(() => !canIncrement(value(), get$2(bounds)));
|
|
15760
15792
|
function emit(next) {
|
|
15761
15793
|
if (next !== value()) onChange()(next);
|
|
15762
15794
|
}
|
|
15795
|
+
function pressDecrement() {
|
|
15796
|
+
if (get$2(atRemove)) onDecrementBelowMin()();
|
|
15797
|
+
else stepDown();
|
|
15798
|
+
}
|
|
15763
15799
|
function stepDown() {
|
|
15764
15800
|
if (canDecrement(value(), get$2(bounds))) emit(decrement(value(), get$2(bounds)));
|
|
15765
15801
|
}
|
|
@@ -15767,7 +15803,14 @@ function QuantityStepper($$anchor, $$props) {
|
|
|
15767
15803
|
if (canIncrement(value(), get$2(bounds))) emit(increment(value(), get$2(bounds)));
|
|
15768
15804
|
}
|
|
15769
15805
|
function commitTyped() {
|
|
15770
|
-
const
|
|
15806
|
+
const raw = parseInt(inputEl.value, 10);
|
|
15807
|
+
if (get$2(removeMode) && (!Number.isFinite(raw) || raw <= 0)) {
|
|
15808
|
+
set(invalid, false);
|
|
15809
|
+
inputEl.value = String(value());
|
|
15810
|
+
onDecrementBelowMin()();
|
|
15811
|
+
return;
|
|
15812
|
+
}
|
|
15813
|
+
const next = clampTyped(raw, get$2(bounds));
|
|
15771
15814
|
set(invalid, false);
|
|
15772
15815
|
inputEl.value = String(next);
|
|
15773
15816
|
emit(next);
|
|
@@ -15788,7 +15831,7 @@ function QuantityStepper($$anchor, $$props) {
|
|
|
15788
15831
|
break;
|
|
15789
15832
|
case "Home":
|
|
15790
15833
|
e.preventDefault();
|
|
15791
|
-
emit(
|
|
15834
|
+
emit(get$2(bounds).floor);
|
|
15792
15835
|
break;
|
|
15793
15836
|
case "End":
|
|
15794
15837
|
e.preventDefault();
|
|
@@ -15850,6 +15893,27 @@ function QuantityStepper($$anchor, $$props) {
|
|
|
15850
15893
|
increaseLabel($$value);
|
|
15851
15894
|
flushSync();
|
|
15852
15895
|
},
|
|
15896
|
+
get onDecrementBelowMin() {
|
|
15897
|
+
return onDecrementBelowMin();
|
|
15898
|
+
},
|
|
15899
|
+
set onDecrementBelowMin($$value) {
|
|
15900
|
+
onDecrementBelowMin($$value);
|
|
15901
|
+
flushSync();
|
|
15902
|
+
},
|
|
15903
|
+
get removeAriaLabel() {
|
|
15904
|
+
return removeAriaLabel();
|
|
15905
|
+
},
|
|
15906
|
+
set removeAriaLabel($$value) {
|
|
15907
|
+
removeAriaLabel($$value);
|
|
15908
|
+
flushSync();
|
|
15909
|
+
},
|
|
15910
|
+
get removeLabel() {
|
|
15911
|
+
return removeLabel();
|
|
15912
|
+
},
|
|
15913
|
+
set removeLabel($$value = "✕") {
|
|
15914
|
+
removeLabel($$value);
|
|
15915
|
+
flushSync();
|
|
15916
|
+
},
|
|
15853
15917
|
get onChange() {
|
|
15854
15918
|
return onChange();
|
|
15855
15919
|
},
|
|
@@ -15860,6 +15924,11 @@ function QuantityStepper($$anchor, $$props) {
|
|
|
15860
15924
|
};
|
|
15861
15925
|
var div = root$50();
|
|
15862
15926
|
var button = child(div);
|
|
15927
|
+
let classes;
|
|
15928
|
+
var span = child(button);
|
|
15929
|
+
var text = child(span, true);
|
|
15930
|
+
reset(span);
|
|
15931
|
+
reset(button);
|
|
15863
15932
|
var input = sibling(button, 2);
|
|
15864
15933
|
remove_input_defaults(input);
|
|
15865
15934
|
bind_this(input, ($$value) => inputEl = $$value, () => inputEl);
|
|
@@ -15867,21 +15936,23 @@ function QuantityStepper($$anchor, $$props) {
|
|
|
15867
15936
|
reset(div);
|
|
15868
15937
|
template_effect(() => {
|
|
15869
15938
|
set_attribute(div, "aria-label", label());
|
|
15870
|
-
|
|
15939
|
+
classes = set_class(button, 1, "go-quantity-stepper-button go-quantity-stepper-decrement", null, classes, { "go-quantity-stepper-remove": get$2(atRemove) });
|
|
15940
|
+
set_attribute(button, "title", get$2(atRemove) ? removeAriaLabel() : decreaseLabel());
|
|
15871
15941
|
set_attribute(button, "aria-controls", inputId);
|
|
15872
15942
|
set_attribute(button, "aria-disabled", get$2(decDisabled));
|
|
15943
|
+
set_text(text, get$2(atRemove) ? removeLabel() : "−");
|
|
15873
15944
|
set_attribute(input, "id", inputId);
|
|
15874
15945
|
set_attribute(input, "aria-label", label());
|
|
15875
15946
|
set_value(input, value());
|
|
15876
15947
|
set_attribute(input, "aria-valuenow", value());
|
|
15877
|
-
set_attribute(input, "aria-valuemin",
|
|
15948
|
+
set_attribute(input, "aria-valuemin", get$2(bounds).floor);
|
|
15878
15949
|
set_attribute(input, "aria-valuemax", max());
|
|
15879
15950
|
set_attribute(input, "aria-invalid", get$2(invalid) ? "true" : void 0);
|
|
15880
15951
|
set_attribute(button_1, "title", increaseLabel());
|
|
15881
15952
|
set_attribute(button_1, "aria-controls", inputId);
|
|
15882
15953
|
set_attribute(button_1, "aria-disabled", get$2(incDisabled));
|
|
15883
15954
|
});
|
|
15884
|
-
delegated("click", button,
|
|
15955
|
+
delegated("click", button, pressDecrement);
|
|
15885
15956
|
delegated("input", input, onInput);
|
|
15886
15957
|
delegated("change", input, commitTyped);
|
|
15887
15958
|
event("blur", input, commitTyped);
|
|
@@ -15904,6 +15975,9 @@ create_custom_element(QuantityStepper, {
|
|
|
15904
15975
|
label: {},
|
|
15905
15976
|
decreaseLabel: {},
|
|
15906
15977
|
increaseLabel: {},
|
|
15978
|
+
onDecrementBelowMin: {},
|
|
15979
|
+
removeAriaLabel: {},
|
|
15980
|
+
removeLabel: {},
|
|
15907
15981
|
onChange: {}
|
|
15908
15982
|
}, [], [], { mode: "open" });
|
|
15909
15983
|
//#endregion
|
|
@@ -15944,8 +16018,12 @@ function QuantityControl($$anchor, $$props) {
|
|
|
15944
16018
|
* `min_persons`) a hard bottom on both controls: the backend does not enforce it,
|
|
15945
16019
|
* so the UI must (Angular-shop parity).
|
|
15946
16020
|
*/
|
|
16021
|
+
/**
|
|
16022
|
+
* Cart-only: when set, the stepper's `−` at the order minimum removes the line instead of
|
|
16023
|
+
* stepping (fires this). Presence turns the behaviour on; the legacy `<select>` ignores it.
|
|
16024
|
+
*/
|
|
15947
16025
|
/** Emits the next committed quantity. The control never mutates anything itself. */
|
|
15948
|
-
let value = prop($$props, "value", 7), min = prop($$props, "min", 7), max = prop($$props, "max", 7), label = prop($$props, "label", 7), floor = prop($$props, "floor", 7, 0), deselectable = prop($$props, "deselectable", 7, true), onChange = prop($$props, "onChange", 7);
|
|
16026
|
+
let value = prop($$props, "value", 7), min = prop($$props, "min", 7), max = prop($$props, "max", 7), label = prop($$props, "label", 7), floor = prop($$props, "floor", 7, 0), deselectable = prop($$props, "deselectable", 7, true), onDecrementBelowMin = prop($$props, "onDecrementBelowMin", 7), onChange = prop($$props, "onChange", 7);
|
|
15949
16027
|
const useStepper = /* @__PURE__ */ user_derived(() => configStore.config.quantityStepper);
|
|
15950
16028
|
var $$exports = {
|
|
15951
16029
|
get value() {
|
|
@@ -15990,6 +16068,13 @@ function QuantityControl($$anchor, $$props) {
|
|
|
15990
16068
|
deselectable($$value);
|
|
15991
16069
|
flushSync();
|
|
15992
16070
|
},
|
|
16071
|
+
get onDecrementBelowMin() {
|
|
16072
|
+
return onDecrementBelowMin();
|
|
16073
|
+
},
|
|
16074
|
+
set onDecrementBelowMin($$value) {
|
|
16075
|
+
onDecrementBelowMin($$value);
|
|
16076
|
+
flushSync();
|
|
16077
|
+
},
|
|
15993
16078
|
get onChange() {
|
|
15994
16079
|
return onChange();
|
|
15995
16080
|
},
|
|
@@ -16005,6 +16090,8 @@ function QuantityControl($$anchor, $$props) {
|
|
|
16005
16090
|
let $0 = /* @__PURE__ */ user_derived(() => deselectable() ? 0 : min());
|
|
16006
16091
|
let $1 = /* @__PURE__ */ user_derived(() => shop.t("quantity.decrease"));
|
|
16007
16092
|
let $2 = /* @__PURE__ */ user_derived(() => shop.t("quantity.increase"));
|
|
16093
|
+
let $3 = /* @__PURE__ */ user_derived(() => shop.t("quantity.remove"));
|
|
16094
|
+
let $4 = /* @__PURE__ */ user_derived(() => shop.t("quantity.remove.label"));
|
|
16008
16095
|
QuantityStepper($$anchor, {
|
|
16009
16096
|
get value() {
|
|
16010
16097
|
return value();
|
|
@@ -16027,6 +16114,15 @@ function QuantityControl($$anchor, $$props) {
|
|
|
16027
16114
|
get increaseLabel() {
|
|
16028
16115
|
return get$2($2);
|
|
16029
16116
|
},
|
|
16117
|
+
get onDecrementBelowMin() {
|
|
16118
|
+
return onDecrementBelowMin();
|
|
16119
|
+
},
|
|
16120
|
+
get removeAriaLabel() {
|
|
16121
|
+
return get$2($3);
|
|
16122
|
+
},
|
|
16123
|
+
get removeLabel() {
|
|
16124
|
+
return get$2($4);
|
|
16125
|
+
},
|
|
16030
16126
|
get onChange() {
|
|
16031
16127
|
return onChange();
|
|
16032
16128
|
}
|
|
@@ -16067,6 +16163,7 @@ create_custom_element(QuantityControl, {
|
|
|
16067
16163
|
label: {},
|
|
16068
16164
|
floor: {},
|
|
16069
16165
|
deselectable: {},
|
|
16166
|
+
onDecrementBelowMin: {},
|
|
16070
16167
|
onChange: {}
|
|
16071
16168
|
}, [], [], { mode: "open" });
|
|
16072
16169
|
//#endregion
|
|
@@ -18061,7 +18158,7 @@ var root_1$15 = /* @__PURE__ */ from_html(`<span class="go-cart-item-price-disco
|
|
|
18061
18158
|
var root_2$11 = /* @__PURE__ */ from_html(`<span data-testid="cart-item-participant-count"> </span>`);
|
|
18062
18159
|
var root_3$8 = /* @__PURE__ */ from_html(`<span data-testid="cart-item-voucher-quantity"> </span>`);
|
|
18063
18160
|
var root_4$4 = /* @__PURE__ */ from_html(`<span> </span>`);
|
|
18064
|
-
var root_5$3 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button class="go-cart-remove"
|
|
18161
|
+
var root_5$3 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button class="go-cart-remove"> </button></li>`);
|
|
18065
18162
|
var root_6$2 = /* @__PURE__ */ from_html(`<ul class="go-sub-tickets" role="list"></ul>`);
|
|
18066
18163
|
var root_7$2 = /* @__PURE__ */ from_html(`<article class="go-cart-item-content"><ul><li class="go-cart-item-title-container"><!></li> <li class="go-cart-item-price"><!></li> <li class="go-cart-item-count"><!></li> <!> <li class="go-cart-item-sum"> </li></ul></article> <!>`, 1);
|
|
18067
18164
|
function Item$1($$anchor, $$props) {
|
|
@@ -18230,7 +18327,8 @@ function Item$1($$anchor, $$props) {
|
|
|
18230
18327
|
return get$2($1);
|
|
18231
18328
|
},
|
|
18232
18329
|
floor: 1,
|
|
18233
|
-
onChange: updateQuantity
|
|
18330
|
+
onChange: updateQuantity,
|
|
18331
|
+
onDecrementBelowMin: del
|
|
18234
18332
|
});
|
|
18235
18333
|
}
|
|
18236
18334
|
};
|
|
@@ -18245,8 +18343,13 @@ function Item$1($$anchor, $$props) {
|
|
|
18245
18343
|
var consequent_8 = ($$anchor) => {
|
|
18246
18344
|
var li_3 = root_5$3();
|
|
18247
18345
|
var button = child(li_3);
|
|
18346
|
+
var text_6 = child(button, true);
|
|
18347
|
+
reset(button);
|
|
18248
18348
|
reset(li_3);
|
|
18249
|
-
template_effect(($0
|
|
18349
|
+
template_effect(($0, $1) => {
|
|
18350
|
+
set_attribute(button, "aria-label", $0);
|
|
18351
|
+
set_text(text_6, $1);
|
|
18352
|
+
}, [() => shop.t("cart.item.aria.removeItem"), () => shop.t("cart.item.remove")]);
|
|
18250
18353
|
delegated("click", button, del);
|
|
18251
18354
|
append($$anchor, li_3);
|
|
18252
18355
|
};
|
|
@@ -18254,7 +18357,7 @@ function Item$1($$anchor, $$props) {
|
|
|
18254
18357
|
if (!preview()) $$render(consequent_8);
|
|
18255
18358
|
});
|
|
18256
18359
|
var li_4 = sibling(node_4, 2);
|
|
18257
|
-
var
|
|
18360
|
+
var text_7 = child(li_4, true);
|
|
18258
18361
|
reset(li_4);
|
|
18259
18362
|
reset(ul);
|
|
18260
18363
|
reset(article);
|
|
@@ -18288,7 +18391,7 @@ function Item$1($$anchor, $$props) {
|
|
|
18288
18391
|
if_block(node_5, ($$render) => {
|
|
18289
18392
|
if (get$2(mantleProduct)) $$render(consequent_9);
|
|
18290
18393
|
});
|
|
18291
|
-
template_effect(($0) => set_text(
|
|
18394
|
+
template_effect(($0) => set_text(text_7, $0), [() => formatCurrency(displayItem().total_price_cents)]);
|
|
18292
18395
|
append($$anchor, fragment_1);
|
|
18293
18396
|
};
|
|
18294
18397
|
if_block(node, ($$render) => {
|
|
@@ -37920,6 +38023,12 @@ delegate(["change"]);
|
|
|
37920
38023
|
customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"]));
|
|
37921
38024
|
//#endregion
|
|
37922
38025
|
//#region src/components/ticketSelection/subcomponents/calendar/lib/calendar.svelte.ts
|
|
38026
|
+
function describeAvailability(value) {
|
|
38027
|
+
if (typeof value === "string") return `'${value}'`;
|
|
38028
|
+
if (value === null || value === void 0) return String(value);
|
|
38029
|
+
if (isPromise(value)) return "a Promise — the callback must be synchronous";
|
|
38030
|
+
return `a ${typeof value}`;
|
|
38031
|
+
}
|
|
37923
38032
|
var Calendar = class {
|
|
37924
38033
|
#details = /* @__PURE__ */ state();
|
|
37925
38034
|
get details() {
|
|
@@ -37942,6 +38051,14 @@ var Calendar = class {
|
|
|
37942
38051
|
set selected(value) {
|
|
37943
38052
|
set(this.#selected, value, true);
|
|
37944
38053
|
}
|
|
38054
|
+
#availabilityOverride = /* @__PURE__ */ state();
|
|
38055
|
+
get availabilityOverride() {
|
|
38056
|
+
return get$2(this.#availabilityOverride);
|
|
38057
|
+
}
|
|
38058
|
+
set availabilityOverride(value) {
|
|
38059
|
+
set(this.#availabilityOverride, value, true);
|
|
38060
|
+
}
|
|
38061
|
+
#logged = [];
|
|
37945
38062
|
get endpoint() {
|
|
37946
38063
|
return (this.details?.filters?.map((f) => getFilter(f).calendarEndpoint).filter(Boolean) ?? [])[0] ?? null;
|
|
37947
38064
|
}
|
|
@@ -37953,12 +38070,49 @@ var Calendar = class {
|
|
|
37953
38070
|
default: return;
|
|
37954
38071
|
}
|
|
37955
38072
|
}
|
|
38073
|
+
/** What gomus makes of a date on its own, ignoring any integrator override. */
|
|
38074
|
+
defaultAvailability(date) {
|
|
38075
|
+
switch (this.dates?.[date.toString()]) {
|
|
38076
|
+
case "unavailable": return "unavailable";
|
|
38077
|
+
case "fully_booked": return "sold_out";
|
|
38078
|
+
default: return "available";
|
|
38079
|
+
}
|
|
38080
|
+
}
|
|
38081
|
+
/** The gomus default, with the integrator's override given the last word. */
|
|
38082
|
+
availability(date) {
|
|
38083
|
+
const defaultAvailability = this.defaultAvailability(date);
|
|
38084
|
+
const override = this.#overrideCallback();
|
|
38085
|
+
if (!override) return defaultAvailability;
|
|
38086
|
+
let returned;
|
|
38087
|
+
try {
|
|
38088
|
+
returned = override(date.toString(), defaultAvailability);
|
|
38089
|
+
} catch (error) {
|
|
38090
|
+
this.#reportOnce("threw", `[go-calendar] the availability-override callback threw (${String(error)}) — using the gomus default instead.`);
|
|
38091
|
+
return defaultAvailability;
|
|
38092
|
+
}
|
|
38093
|
+
if (returned === "pass_through") return defaultAvailability;
|
|
38094
|
+
if (returned === "available" || returned === "sold_out" || returned === "unavailable") return returned;
|
|
38095
|
+
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.`);
|
|
38096
|
+
return defaultAvailability;
|
|
38097
|
+
}
|
|
38098
|
+
#overrideCallback() {
|
|
38099
|
+
const source = this.availabilityOverride;
|
|
38100
|
+
if (typeof source === "function") return source;
|
|
38101
|
+
if (!source) return void 0;
|
|
38102
|
+
const candidate = globalThis[source];
|
|
38103
|
+
if (typeof candidate === "function") return candidate;
|
|
38104
|
+
this.#reportOnce(`unresolved:${source}`, `[go-calendar] availability-override="${source}" does not resolve to a function on window — using the gomus defaults.`, console.warn);
|
|
38105
|
+
}
|
|
38106
|
+
#reportOnce(key, message, log = console.error) {
|
|
38107
|
+
if (this.#logged.includes(key)) return;
|
|
38108
|
+
this.#logged.push(key);
|
|
38109
|
+
log(message);
|
|
38110
|
+
}
|
|
37956
38111
|
isDateDisabled(date) {
|
|
37957
|
-
|
|
37958
|
-
return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0;
|
|
38112
|
+
return date.compare($ad063034c8620db8$export$d0bdf45af03a6ea3($ad063034c8620db8$export$aa8b41735afcabd2())) < 0 || this.availability(date) === "unavailable";
|
|
37959
38113
|
}
|
|
37960
38114
|
isDateUnavailable(date) {
|
|
37961
|
-
return this.
|
|
38115
|
+
return this.availability(date) === "sold_out";
|
|
37962
38116
|
}
|
|
37963
38117
|
get apiFilters() {
|
|
37964
38118
|
return this.details?.filters?.map((f) => getFilter(f).apiToken).filter(Boolean);
|
|
@@ -37987,13 +38141,14 @@ var Calendar = class {
|
|
|
37987
38141
|
thisMonth.add({ months: 2 })
|
|
37988
38142
|
];
|
|
37989
38143
|
}
|
|
38144
|
+
#mergedDates(fetchMonth) {
|
|
38145
|
+
return this.fetchPeriod().reduce((all, startAt) => Object.assign(all, fetchMonth(this.params(startAt))), {});
|
|
38146
|
+
}
|
|
37990
38147
|
eventsDates() {
|
|
37991
|
-
|
|
37992
|
-
return this.fetchPeriod().reduce((prev, startAt) => assign(prev, method(this.params(startAt))), {});
|
|
38148
|
+
return this.#mergedDates((params) => shop.calendar(params));
|
|
37993
38149
|
}
|
|
37994
38150
|
ticketsDates() {
|
|
37995
|
-
|
|
37996
|
-
return this.fetchPeriod().reduce((prev, startAt) => assign(prev, method(this.params(startAt))), {});
|
|
38151
|
+
return this.#mergedDates((params) => shop.ticketsCalendar(params));
|
|
37997
38152
|
}
|
|
37998
38153
|
};
|
|
37999
38154
|
//#endregion
|
|
@@ -38225,12 +38380,19 @@ create_custom_element(CalendarUI, { calendarClass: {} }, [], ["details"], { mode
|
|
|
38225
38380
|
//#region src/components/ticketSelection/subcomponents/calendar/components/Calendar.svelte
|
|
38226
38381
|
function Calendar_1($$anchor, $$props) {
|
|
38227
38382
|
push($$props, true);
|
|
38383
|
+
/**
|
|
38384
|
+
* Per-date availability override. As an attribute it names a global function
|
|
38385
|
+
* (`<go-calendar availability-override="shopRule">`); as a property it is the function
|
|
38386
|
+
* itself (`element.availabilityOverride = fn`).
|
|
38387
|
+
*/
|
|
38388
|
+
let availabilityOverride = prop($$props, "availabilityOverride", 7);
|
|
38228
38389
|
const ticketsCalendar = new Calendar();
|
|
38229
38390
|
const details = ticketsCalendar;
|
|
38230
38391
|
const _ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
|
|
38231
38392
|
const ticketSelectionDetails = /* @__PURE__ */ user_derived(() => _ticketSelectionDetails.value);
|
|
38232
38393
|
user_effect(() => {
|
|
38233
38394
|
ticketsCalendar.details = get$2(ticketSelectionDetails);
|
|
38395
|
+
ticketsCalendar.availabilityOverride = availabilityOverride();
|
|
38234
38396
|
});
|
|
38235
38397
|
$$props.$$host.addEventListener("go-date-select", (e) => {
|
|
38236
38398
|
if (get$2(ticketSelectionDetails)) {
|
|
@@ -38238,7 +38400,16 @@ function Calendar_1($$anchor, $$props) {
|
|
|
38238
38400
|
get$2(ticketSelectionDetails).selectedTimeslot = void 0;
|
|
38239
38401
|
}
|
|
38240
38402
|
});
|
|
38241
|
-
var $$exports = {
|
|
38403
|
+
var $$exports = {
|
|
38404
|
+
details,
|
|
38405
|
+
get availabilityOverride() {
|
|
38406
|
+
return availabilityOverride();
|
|
38407
|
+
},
|
|
38408
|
+
set availabilityOverride($$value) {
|
|
38409
|
+
availabilityOverride($$value);
|
|
38410
|
+
flushSync();
|
|
38411
|
+
}
|
|
38412
|
+
};
|
|
38242
38413
|
var fragment = comment();
|
|
38243
38414
|
var node = first_child(fragment);
|
|
38244
38415
|
var consequent = ($$anchor) => {
|
|
@@ -38252,7 +38423,10 @@ function Calendar_1($$anchor, $$props) {
|
|
|
38252
38423
|
append($$anchor, fragment);
|
|
38253
38424
|
return pop($$exports);
|
|
38254
38425
|
}
|
|
38255
|
-
customElements.define("go-calendar", create_custom_element(Calendar_1, {
|
|
38426
|
+
customElements.define("go-calendar", create_custom_element(Calendar_1, { availabilityOverride: {
|
|
38427
|
+
attribute: "availability-override",
|
|
38428
|
+
type: "String"
|
|
38429
|
+
} }, [], ["details"]));
|
|
38256
38430
|
//#endregion
|
|
38257
38431
|
//#region src/components/ticketSelection/subcomponents/addToCartButton/AddToCartButton.svelte.ts
|
|
38258
38432
|
var Details = class {
|