@gomusdev/web-components 1.22.2 → 1.23.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/dist-js/components/cart/mocks/gomusTicketMocks.d.ts +0 -2
- package/dist-js/components/order/components/subcomponents/breakdown/items/Event.svelte.d.ts +1 -0
- package/dist-js/components/ticketSelection/TicketSelectionDetails.svelte.d.ts +1 -1
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/TicketSegmentDetails.svelte.d.ts +4 -919
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/annualTickets.svelte.d.ts +2 -0
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/dayTickets.svelte.d.ts +2 -0
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventScaledPriceTickets.spec.d.ts +1 -0
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventScaledPriceTickets.svelte.d.ts +2 -0
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventTickets.spec.d.ts +1 -0
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/event/eventTickets.svelte.d.ts +2 -0
- package/dist-js/components/ticketSelection/subcomponents/tickets/subcomponents/segment/lib/timeslotTickets.svelte.d.ts +2 -0
- package/dist-js/gomus-webcomponents.iife.js +348 -153
- package/dist-js/gomus-webcomponents.js +348 -153
- package/dist-js/lib/models/capacities/capacities.d.ts +44 -0
- package/dist-js/lib/models/capacities/capacities.spec.d.ts +1 -0
- package/dist-js/lib/models/scalePrice/UIScaledPrice.svelte.d.ts +0 -6
- package/dist-js/lib/models/ticket/UITicket.svelte.d.ts +1 -4
- package/dist-js/lib/stores/shop.svelte.d.ts +45 -54
- package/dist-js/mocks/MSWMocks.d.ts +5 -0
- package/dist-js/mocks/mocks.d.ts +0 -24
- package/package.json +1 -1
|
@@ -5585,6 +5585,11 @@ const isNumber = (value) => {
|
|
|
5585
5585
|
return false;
|
|
5586
5586
|
}
|
|
5587
5587
|
};
|
|
5588
|
+
const boil = (array2, compareFunc) => {
|
|
5589
|
+
if (!array2 || (array2.length ?? 0) === 0)
|
|
5590
|
+
return null;
|
|
5591
|
+
return array2.reduce(compareFunc);
|
|
5592
|
+
};
|
|
5588
5593
|
function sum(array2, fn) {
|
|
5589
5594
|
return (array2 || []).reduce((acc, item) => acc + (fn ? fn(item) : item), 0);
|
|
5590
5595
|
}
|
|
@@ -5602,6 +5607,10 @@ const alphabetical = (array2, getter, dir = "asc") => {
|
|
|
5602
5607
|
const dsc = (a2, b) => `${getter(b)}`.localeCompare(getter(a2));
|
|
5603
5608
|
return array2.slice().sort(dir === "desc" ? dsc : asc);
|
|
5604
5609
|
};
|
|
5610
|
+
function max$1(array2, getter) {
|
|
5611
|
+
const get2 = getter ?? ((v) => v);
|
|
5612
|
+
return boil(array2, (a2, b) => get2(a2) > get2(b) ? a2 : b);
|
|
5613
|
+
}
|
|
5605
5614
|
const iterate = (count, func, initValue) => {
|
|
5606
5615
|
let value = initValue;
|
|
5607
5616
|
for (let i = 1; i <= count; i++) {
|
|
@@ -11985,7 +11994,7 @@ class Shop {
|
|
|
11985
11994
|
const isCacheExpired = this.#fetchStatus[fetchId]?.fetchedAt < Date.now() - options.cache * 1e3;
|
|
11986
11995
|
if (isNotFetchedYet || isCacheExpired) {
|
|
11987
11996
|
this.apiGet(endpoint, query, options.path).then((ret) => {
|
|
11988
|
-
get$2(this.#data)[dataKey] = responseKey === "" ? ret : ret[responseKey];
|
|
11997
|
+
if (ret) get$2(this.#data)[dataKey] = responseKey === "" ? ret : ret[responseKey];
|
|
11989
11998
|
});
|
|
11990
11999
|
}
|
|
11991
12000
|
return get$2(this.#data)[dataKey];
|
|
@@ -12004,6 +12013,12 @@ class Shop {
|
|
|
12004
12013
|
getEvent(id) {
|
|
12005
12014
|
return this.fetchAndCache(`/api/v4/events/${id}`, `single_event_${id}`, "event");
|
|
12006
12015
|
}
|
|
12016
|
+
getTicketCapacities(date2, ticketIds) {
|
|
12017
|
+
return this.apiPost(`/api/v4/tickets/capacities`, {
|
|
12018
|
+
body: { date: date2, ticket_ids: ticketIds },
|
|
12019
|
+
requiredFields: ["date", "ticket_ids"]
|
|
12020
|
+
});
|
|
12021
|
+
}
|
|
12007
12022
|
getEventDetailsOnDate(eventId, dateId) {
|
|
12008
12023
|
return this.fetchAndCache(`/api/v4/events/${eventId}/dates/${dateId}`, `/api/v4/events/${eventId}/dates/${dateId}`, "date");
|
|
12009
12024
|
}
|
|
@@ -15116,7 +15131,7 @@ function wrapInElement(host, tag, props) {
|
|
|
15116
15131
|
host.replaceChildren(element);
|
|
15117
15132
|
return element;
|
|
15118
15133
|
}
|
|
15119
|
-
var root_1$
|
|
15134
|
+
var root_1$e = /* @__PURE__ */ from_html(`<go-all-fields></go-all-fields> <go-form-feedback><go-errors-feedback></go-errors-feedback> <go-success-feedback></go-success-feedback></go-form-feedback> <go-submit>Submit</go-submit>`, 3);
|
|
15120
15135
|
function Form($$anchor, $$props) {
|
|
15121
15136
|
push($$props, true);
|
|
15122
15137
|
let formId = prop($$props, "formId", 7), custom2 = prop($$props, "custom", 7);
|
|
@@ -15158,7 +15173,7 @@ function Form($$anchor, $$props) {
|
|
|
15158
15173
|
var node = first_child(fragment);
|
|
15159
15174
|
{
|
|
15160
15175
|
var consequent = ($$anchor2) => {
|
|
15161
|
-
var fragment_1 = root_1$
|
|
15176
|
+
var fragment_1 = root_1$e();
|
|
15162
15177
|
var go_all_fields = first_child(fragment_1);
|
|
15163
15178
|
var go_form_feedback = sibling(go_all_fields, 2);
|
|
15164
15179
|
sibling(go_form_feedback, 2);
|
|
@@ -15181,7 +15196,7 @@ customElements.define("go-form", create_custom_element(
|
|
|
15181
15196
|
["details"],
|
|
15182
15197
|
false
|
|
15183
15198
|
));
|
|
15184
|
-
var root$
|
|
15199
|
+
var root$9 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
|
|
15185
15200
|
function PasswordReset($$anchor, $$props) {
|
|
15186
15201
|
push($$props, true);
|
|
15187
15202
|
let form;
|
|
@@ -15215,7 +15230,7 @@ function PasswordReset($$anchor, $$props) {
|
|
|
15215
15230
|
flushSync();
|
|
15216
15231
|
}
|
|
15217
15232
|
};
|
|
15218
|
-
var go_form = root$
|
|
15233
|
+
var go_form = root$9();
|
|
15219
15234
|
set_custom_element_data(go_form, "formId", "passwordReset");
|
|
15220
15235
|
template_effect(() => set_custom_element_data(go_form, "custom", custom2()));
|
|
15221
15236
|
bind_this(go_form, ($$value) => form = $$value, () => form);
|
|
@@ -15223,7 +15238,7 @@ function PasswordReset($$anchor, $$props) {
|
|
|
15223
15238
|
return pop($$exports);
|
|
15224
15239
|
}
|
|
15225
15240
|
customElements.define("go-password-reset", create_custom_element(PasswordReset, { custom: {} }, [], [], false));
|
|
15226
|
-
var root$
|
|
15241
|
+
var root$8 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
|
|
15227
15242
|
function SignIn($$anchor, $$props) {
|
|
15228
15243
|
push($$props, true);
|
|
15229
15244
|
let form;
|
|
@@ -15248,7 +15263,7 @@ function SignIn($$anchor, $$props) {
|
|
|
15248
15263
|
onMount(() => {
|
|
15249
15264
|
$$props.$$host.addEventListener("go-submit", signIn);
|
|
15250
15265
|
});
|
|
15251
|
-
var go_form = root$
|
|
15266
|
+
var go_form = root$8();
|
|
15252
15267
|
set_custom_element_data(go_form, "formId", "signIn");
|
|
15253
15268
|
bind_this(go_form, ($$value) => form = $$value, () => form);
|
|
15254
15269
|
append($$anchor, go_form);
|
|
@@ -15263,7 +15278,7 @@ customElements.define("go-sign-in", create_custom_element(
|
|
|
15263
15278
|
[],
|
|
15264
15279
|
false
|
|
15265
15280
|
));
|
|
15266
|
-
var root$
|
|
15281
|
+
var root$7 = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
|
|
15267
15282
|
function SignUp($$anchor, $$props) {
|
|
15268
15283
|
push($$props, true);
|
|
15269
15284
|
Forms.defineForm({
|
|
@@ -15300,7 +15315,7 @@ function SignUp($$anchor, $$props) {
|
|
|
15300
15315
|
onMount(() => {
|
|
15301
15316
|
$$props.$$host.addEventListener("go-submit", signUp);
|
|
15302
15317
|
});
|
|
15303
|
-
var go_form = root$
|
|
15318
|
+
var go_form = root$7();
|
|
15304
15319
|
set_custom_element_data(go_form, "formId", "signUp");
|
|
15305
15320
|
bind_this(go_form, ($$value) => form = $$value, () => form);
|
|
15306
15321
|
append($$anchor, go_form);
|
|
@@ -15345,16 +15360,7 @@ function createUIEventTicket(apiTicket, dateId, options) {
|
|
|
15345
15360
|
...product,
|
|
15346
15361
|
...apiTicket,
|
|
15347
15362
|
...finalOptions,
|
|
15348
|
-
type: "scale"
|
|
15349
|
-
get max_capacity() {
|
|
15350
|
-
return 18;
|
|
15351
|
-
},
|
|
15352
|
-
get min_quantity() {
|
|
15353
|
-
return 0;
|
|
15354
|
-
},
|
|
15355
|
-
get max_quantity() {
|
|
15356
|
-
return 18;
|
|
15357
|
-
}
|
|
15363
|
+
type: "scale"
|
|
15358
15364
|
};
|
|
15359
15365
|
return uiTicket;
|
|
15360
15366
|
}
|
|
@@ -15434,7 +15440,7 @@ function isUITicket(x) {
|
|
|
15434
15440
|
return x.product_type === "Ticket";
|
|
15435
15441
|
}
|
|
15436
15442
|
function createUITicket(apiTicket, options) {
|
|
15437
|
-
const finalOptions = {
|
|
15443
|
+
const finalOptions = { selectedTime: "", ...{} };
|
|
15438
15444
|
const product = { product_type: "Ticket", ...apiTicket };
|
|
15439
15445
|
const _ = { ...apiTicket, ...finalOptions };
|
|
15440
15446
|
const uiTicket = {
|
|
@@ -15460,7 +15466,7 @@ function generateCartItem(cartItem) {
|
|
|
15460
15466
|
switch (type) {
|
|
15461
15467
|
case "Ticket":
|
|
15462
15468
|
if (cartItem.product.ticket_type === "timeslot" && !inTheFuture(cartItem.attributes.time)) return;
|
|
15463
|
-
const ticket = createUITicket(cartItem.product
|
|
15469
|
+
const ticket = createUITicket(cartItem.product);
|
|
15464
15470
|
return createCartItem(ticket, { time: cartItem.time, quantity: cartItem.quantity });
|
|
15465
15471
|
case "Event":
|
|
15466
15472
|
const event = createUIEventTicket(cartItem.product, cartItem.id);
|
|
@@ -15588,7 +15594,7 @@ var root_6$2 = /* @__PURE__ */ from_html(`<li data-go-cart-item-remove=""><butto
|
|
|
15588
15594
|
var root_3$7 = /* @__PURE__ */ from_html(`<li data-go-cart-item=""><article><ul><li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"> </span> <!></li> <li data-go-cart-item-price=""> </li> <li data-go-cart-item-count=""> </li> <!> <li data-go-cart-item-sum=""> </li></ul></article></li>`);
|
|
15589
15595
|
var root_7$4 = /* @__PURE__ */ from_html(`<li data-go-cart-footer-remove=""></li>`);
|
|
15590
15596
|
var root_8$1 = /* @__PURE__ */ from_html(`<a href="javascript:void(0);" class="go-cart-checkout-button" data-testid="checkout-button">Checkout</a>`);
|
|
15591
|
-
var root_1$
|
|
15597
|
+
var root_1$d = /* @__PURE__ */ from_html(`<ol data-testid="cart"><li data-go-cart-header="" data-testid="cart-header"><ul><li data-go-cart-header-title="">Product</li> <li data-go-cart-header-price="">Price</li> <li data-go-cart-header-count="">Count</li> <!> <li data-go-cart-header-sum="">Sum</li></ul></li> <!> <li data-go-cart-footer="" data-testid="cart-footer"><ul><li data-go-cart-footer-title=""></li> <li data-go-cart-footer-price=""></li> <li data-go-cart-footer-count=""></li> <!> <li data-go-cart-footer-sum="" data-go-cart-sum=""> </li></ul></li></ol> <!>`, 1);
|
|
15592
15598
|
function Cart($$anchor, $$props) {
|
|
15593
15599
|
push($$props, true);
|
|
15594
15600
|
const preview = prop($$props, "preview", 7, false);
|
|
@@ -15610,7 +15616,7 @@ function Cart($$anchor, $$props) {
|
|
|
15610
15616
|
var node = first_child(fragment);
|
|
15611
15617
|
{
|
|
15612
15618
|
var consequent_6 = ($$anchor2) => {
|
|
15613
|
-
var fragment_1 = root_1$
|
|
15619
|
+
var fragment_1 = root_1$d();
|
|
15614
15620
|
var ol = first_child(fragment_1);
|
|
15615
15621
|
var li = child(ol);
|
|
15616
15622
|
var ul = child(li);
|
|
@@ -22934,7 +22940,7 @@ function Calendar_prev_button($$anchor, $$props) {
|
|
|
22934
22940
|
return pop($$exports);
|
|
22935
22941
|
}
|
|
22936
22942
|
create_custom_element(Calendar_prev_button, { children: {}, child: {}, id: {}, ref: {}, tabindex: {} }, [], [], true);
|
|
22937
|
-
var root_1$
|
|
22943
|
+
var root_1$c = /* @__PURE__ */ from_html(`<input/>`);
|
|
22938
22944
|
var root_2$d = /* @__PURE__ */ from_html(`<input/>`);
|
|
22939
22945
|
function Hidden_input($$anchor, $$props) {
|
|
22940
22946
|
push($$props, true);
|
|
@@ -22957,7 +22963,7 @@ function Hidden_input($$anchor, $$props) {
|
|
|
22957
22963
|
var node = first_child(fragment);
|
|
22958
22964
|
{
|
|
22959
22965
|
var consequent = ($$anchor2) => {
|
|
22960
|
-
var input = root_1$
|
|
22966
|
+
var input = root_1$c();
|
|
22961
22967
|
attribute_effect(input, () => ({ ...get$2(mergedProps), value: value() }), void 0, void 0, void 0, void 0, true);
|
|
22962
22968
|
append($$anchor2, input);
|
|
22963
22969
|
};
|
|
@@ -25405,7 +25411,7 @@ function Popper_content($$anchor, $$props) {
|
|
|
25405
25411
|
return pop($$exports);
|
|
25406
25412
|
}
|
|
25407
25413
|
create_custom_element(Popper_content, { content: {}, isStatic: {}, onPlaced: {} }, [], [], true);
|
|
25408
|
-
var root_1$
|
|
25414
|
+
var root_1$b = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
25409
25415
|
function Popper_layer_inner($$anchor, $$props) {
|
|
25410
25416
|
push($$props, true);
|
|
25411
25417
|
let popper = prop($$props, "popper", 7), onEscapeKeydown = prop($$props, "onEscapeKeydown", 7), escapeKeydownBehavior = prop($$props, "escapeKeydownBehavior", 7), preventOverflowTextSelection = prop($$props, "preventOverflowTextSelection", 7), id = prop($$props, "id", 7), onPointerDown = prop($$props, "onPointerDown", 7), onPointerUp = prop($$props, "onPointerUp", 7), side = prop($$props, "side", 7), sideOffset = prop($$props, "sideOffset", 7), align = prop($$props, "align", 7), alignOffset = prop($$props, "alignOffset", 7), arrowPadding = prop($$props, "arrowPadding", 7), avoidCollisions = prop($$props, "avoidCollisions", 7), collisionBoundary = prop($$props, "collisionBoundary", 7), collisionPadding = prop($$props, "collisionPadding", 7), sticky = prop($$props, "sticky", 7), hideWhenDetached = prop($$props, "hideWhenDetached", 7), updatePositionStrategy = prop($$props, "updatePositionStrategy", 7), strategy = prop($$props, "strategy", 7), dir = prop($$props, "dir", 7), preventScroll = prop($$props, "preventScroll", 7), wrapperId = prop($$props, "wrapperId", 7), style = prop($$props, "style", 7), onPlaced = prop($$props, "onPlaced", 7), onInteractOutside = prop($$props, "onInteractOutside", 7), onCloseAutoFocus = prop($$props, "onCloseAutoFocus", 7), onOpenAutoFocus = prop($$props, "onOpenAutoFocus", 7), onFocusOutside = prop($$props, "onFocusOutside", 7), interactOutsideBehavior = prop($$props, "interactOutsideBehavior", 7, "close"), loop = prop($$props, "loop", 7), trapFocus = prop($$props, "trapFocus", 7, true), isValidEvent2 = prop($$props, "isValidEvent", 7, () => false), customAnchor = prop($$props, "customAnchor", 7, null), isStatic = prop($$props, "isStatic", 7, false), enabled = prop($$props, "enabled", 7), ref = prop($$props, "ref", 7), tooltip = prop($$props, "tooltip", 7, false), restProps = /* @__PURE__ */ rest_props($$props, [
|
|
@@ -25716,7 +25722,7 @@ function Popper_layer_inner($$anchor, $$props) {
|
|
|
25716
25722
|
const content = ($$anchor2, $$arg0) => {
|
|
25717
25723
|
let floatingProps = () => $$arg0?.().props;
|
|
25718
25724
|
let wrapperProps = () => $$arg0?.().wrapperProps;
|
|
25719
|
-
var fragment_1 = root_1$
|
|
25725
|
+
var fragment_1 = root_1$b();
|
|
25720
25726
|
var node = first_child(fragment_1);
|
|
25721
25727
|
{
|
|
25722
25728
|
var consequent = ($$anchor3) => {
|
|
@@ -28171,7 +28177,7 @@ function Date_field_hidden_input($$anchor, $$props) {
|
|
|
28171
28177
|
}
|
|
28172
28178
|
create_custom_element(Date_field_hidden_input, {}, [], [], true);
|
|
28173
28179
|
var root_2$c = /* @__PURE__ */ from_html(`<div><!></div>`);
|
|
28174
|
-
var root$
|
|
28180
|
+
var root$6 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
28175
28181
|
function Date_field_input($$anchor, $$props) {
|
|
28176
28182
|
const uid = props_id();
|
|
28177
28183
|
push($$props, true);
|
|
@@ -28229,7 +28235,7 @@ function Date_field_input($$anchor, $$props) {
|
|
|
28229
28235
|
flushSync();
|
|
28230
28236
|
}
|
|
28231
28237
|
};
|
|
28232
|
-
var fragment = root$
|
|
28238
|
+
var fragment = root$6();
|
|
28233
28239
|
var node = first_child(fragment);
|
|
28234
28240
|
{
|
|
28235
28241
|
var consequent = ($$anchor2) => {
|
|
@@ -29581,7 +29587,7 @@ var root_2$8 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
|
29581
29587
|
var root_7$3 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
|
|
29582
29588
|
var root_9$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
29583
29589
|
var root_6$1 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
29584
|
-
var root_1$
|
|
29590
|
+
var root_1$a = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
|
|
29585
29591
|
function DatePicker_1($$anchor, $$props) {
|
|
29586
29592
|
push($$props, true);
|
|
29587
29593
|
let dateString = prop($$props, "dateString", 15), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7);
|
|
@@ -29623,7 +29629,7 @@ function DatePicker_1($$anchor, $$props) {
|
|
|
29623
29629
|
set(date2, $$value, true);
|
|
29624
29630
|
},
|
|
29625
29631
|
children: ($$anchor3, $$slotProps) => {
|
|
29626
|
-
var fragment_1 = root_1$
|
|
29632
|
+
var fragment_1 = root_1$a();
|
|
29627
29633
|
var node_1 = first_child(fragment_1);
|
|
29628
29634
|
component(node_1, () => Date_field_label, ($$anchor4, DatePicker_Label) => {
|
|
29629
29635
|
DatePicker_Label($$anchor4, {
|
|
@@ -29831,7 +29837,7 @@ function DatePicker_1($$anchor, $$props) {
|
|
|
29831
29837
|
}
|
|
29832
29838
|
create_custom_element(DatePicker_1, { dateString: {}, labelClass: {}, inputClass: {} }, [], [], true);
|
|
29833
29839
|
var root_2$7 = /* @__PURE__ */ from_html(`<span class="go-field-star" aria-hidden="true">*</span>`);
|
|
29834
|
-
var root_1$
|
|
29840
|
+
var root_1$9 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
|
|
29835
29841
|
var root_3$5 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1);
|
|
29836
29842
|
var root_4$3 = /* @__PURE__ */ from_html(`<label><input/> <span class="go-checkbox-label"><!></span></label>`);
|
|
29837
29843
|
var root_7$2 = /* @__PURE__ */ from_html(`<option> </option>`);
|
|
@@ -29841,7 +29847,7 @@ var root_9$1 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fi
|
|
|
29841
29847
|
function InputAndLabel($$anchor, $$props) {
|
|
29842
29848
|
push($$props, true);
|
|
29843
29849
|
const labelText = ($$anchor2) => {
|
|
29844
|
-
var fragment = root_1$
|
|
29850
|
+
var fragment = root_1$9();
|
|
29845
29851
|
var node = first_child(fragment);
|
|
29846
29852
|
html$2(node, () => purify.sanitize(field().label));
|
|
29847
29853
|
var node_1 = sibling(node, 2);
|
|
@@ -30134,10 +30140,10 @@ create_custom_element(
|
|
|
30134
30140
|
[],
|
|
30135
30141
|
true
|
|
30136
30142
|
);
|
|
30137
|
-
var root_1$
|
|
30143
|
+
var root_1$8 = /* @__PURE__ */ from_html(`<span> </span>`);
|
|
30138
30144
|
var root_3$4 = /* @__PURE__ */ from_html(`<li> </li>`);
|
|
30139
30145
|
var root_2$6 = /* @__PURE__ */ from_html(`<ul class="go-field-errors" role="alert"></ul>`);
|
|
30140
|
-
var root$
|
|
30146
|
+
var root$5 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
|
|
30141
30147
|
function Field($$anchor, $$props) {
|
|
30142
30148
|
push($$props, true);
|
|
30143
30149
|
let key = prop($$props, "key", 7), required = prop($$props, "required", 7, false), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7);
|
|
@@ -30201,7 +30207,7 @@ function Field($$anchor, $$props) {
|
|
|
30201
30207
|
flushSync();
|
|
30202
30208
|
}
|
|
30203
30209
|
};
|
|
30204
|
-
var fragment = root$
|
|
30210
|
+
var fragment = root$5();
|
|
30205
30211
|
var node = first_child(fragment);
|
|
30206
30212
|
InputAndLabel(node, {
|
|
30207
30213
|
get describedById() {
|
|
@@ -30224,7 +30230,7 @@ function Field($$anchor, $$props) {
|
|
|
30224
30230
|
var node_1 = sibling(node, 2);
|
|
30225
30231
|
{
|
|
30226
30232
|
var consequent = ($$anchor2) => {
|
|
30227
|
-
var span = root_1$
|
|
30233
|
+
var span = root_1$8();
|
|
30228
30234
|
var text2 = child(span, true);
|
|
30229
30235
|
reset(span);
|
|
30230
30236
|
template_effect(() => {
|
|
@@ -30271,7 +30277,7 @@ customElements.define("go-field", create_custom_element(
|
|
|
30271
30277
|
["getField"],
|
|
30272
30278
|
false
|
|
30273
30279
|
));
|
|
30274
|
-
var root_1$
|
|
30280
|
+
var root_1$7 = /* @__PURE__ */ from_html(`<go-field></go-field>`, 2);
|
|
30275
30281
|
function AllFields($$anchor, $$props) {
|
|
30276
30282
|
push($$props, true);
|
|
30277
30283
|
let _details = getDetails$1($$props.$$host);
|
|
@@ -30280,7 +30286,7 @@ function AllFields($$anchor, $$props) {
|
|
|
30280
30286
|
var fragment = comment();
|
|
30281
30287
|
var node = first_child(fragment);
|
|
30282
30288
|
each(node, 17, () => get$2(allFields2), index$1, ($$anchor2, field) => {
|
|
30283
|
-
var go_field = root_1$
|
|
30289
|
+
var go_field = root_1$7();
|
|
30284
30290
|
template_effect(() => set_custom_element_data(go_field, "key", get$2(field).key));
|
|
30285
30291
|
template_effect(() => set_custom_element_data(go_field, "required", get$2(field).required));
|
|
30286
30292
|
append($$anchor2, go_field);
|
|
@@ -30293,7 +30299,7 @@ var root_2$5 = /* @__PURE__ */ from_html(`<p aria-live="assertive" class="sr-onl
|
|
|
30293
30299
|
var root_4$2 = /* @__PURE__ */ from_html(`<li> </li>`);
|
|
30294
30300
|
var root_3$3 = /* @__PURE__ */ from_html(`<ul class="go-error-feedback-api-errors"></ul>`);
|
|
30295
30301
|
var root_5 = /* @__PURE__ */ from_html(`<p aria-hidden="true"> </p>`);
|
|
30296
|
-
var root_1$
|
|
30302
|
+
var root_1$6 = /* @__PURE__ */ from_html(`<div><!> <!> <!></div>`);
|
|
30297
30303
|
function ErrorsFeedback($$anchor, $$props) {
|
|
30298
30304
|
push($$props, true);
|
|
30299
30305
|
const _details = getDetails$1($$props.$$host);
|
|
@@ -30310,7 +30316,7 @@ function ErrorsFeedback($$anchor, $$props) {
|
|
|
30310
30316
|
var node = first_child(fragment);
|
|
30311
30317
|
{
|
|
30312
30318
|
var consequent_3 = ($$anchor2) => {
|
|
30313
|
-
var div = root_1$
|
|
30319
|
+
var div = root_1$6();
|
|
30314
30320
|
let classes;
|
|
30315
30321
|
var node_1 = child(div);
|
|
30316
30322
|
{
|
|
@@ -30370,9 +30376,9 @@ function ErrorsFeedback($$anchor, $$props) {
|
|
|
30370
30376
|
pop();
|
|
30371
30377
|
}
|
|
30372
30378
|
customElements.define("go-errors-feedback", create_custom_element(ErrorsFeedback, {}, [], [], false));
|
|
30373
|
-
var root$
|
|
30379
|
+
var root$4 = /* @__PURE__ */ from_html(`<div class="go-form-feedback"><!></div>`);
|
|
30374
30380
|
function FormFeedback($$anchor, $$props) {
|
|
30375
|
-
var div = root$
|
|
30381
|
+
var div = root$4();
|
|
30376
30382
|
var node = child(div);
|
|
30377
30383
|
slot(node, $$props, "default", {});
|
|
30378
30384
|
reset(div);
|
|
@@ -30405,7 +30411,7 @@ customElements.define("go-submit", create_custom_element(
|
|
|
30405
30411
|
[],
|
|
30406
30412
|
false
|
|
30407
30413
|
));
|
|
30408
|
-
var root_1$
|
|
30414
|
+
var root_1$5 = /* @__PURE__ */ from_html(`<div aria-live="assertive"> </div>`);
|
|
30409
30415
|
function SuccessFeedback($$anchor, $$props) {
|
|
30410
30416
|
push($$props, true);
|
|
30411
30417
|
const _details = getDetails$1($$props.$$host);
|
|
@@ -30414,7 +30420,7 @@ function SuccessFeedback($$anchor, $$props) {
|
|
|
30414
30420
|
var node = first_child(fragment);
|
|
30415
30421
|
{
|
|
30416
30422
|
var consequent = ($$anchor2) => {
|
|
30417
|
-
var div = root_1$
|
|
30423
|
+
var div = root_1$5();
|
|
30418
30424
|
let classes;
|
|
30419
30425
|
var text2 = child(div, true);
|
|
30420
30426
|
reset(div);
|
|
@@ -30440,7 +30446,13 @@ function evaluateExpression(expression, data) {
|
|
|
30440
30446
|
console.log(`Error while evaluating when (${expression}) in go-if: ${error.message}`);
|
|
30441
30447
|
}
|
|
30442
30448
|
}
|
|
30443
|
-
const validTicketSelectionFilters = [
|
|
30449
|
+
const validTicketSelectionFilters = [
|
|
30450
|
+
"timeslot",
|
|
30451
|
+
"day",
|
|
30452
|
+
"annual",
|
|
30453
|
+
"event:scaled-price",
|
|
30454
|
+
"event:ticket"
|
|
30455
|
+
];
|
|
30444
30456
|
let lastUId = 0;
|
|
30445
30457
|
class TicketSelectionDetails {
|
|
30446
30458
|
uid = lastUId++;
|
|
@@ -30535,8 +30547,10 @@ class TicketSelectionDetails {
|
|
|
30535
30547
|
return Boolean(this.selectedDate);
|
|
30536
30548
|
case "annual":
|
|
30537
30549
|
return true;
|
|
30538
|
-
case "scaled-price":
|
|
30539
|
-
return
|
|
30550
|
+
case "event:scaled-price":
|
|
30551
|
+
return Boolean(this.selectedDate);
|
|
30552
|
+
case "event:ticket":
|
|
30553
|
+
return Boolean(this.selectedDate);
|
|
30540
30554
|
case "timeslot":
|
|
30541
30555
|
switch (this.mode) {
|
|
30542
30556
|
case "event":
|
|
@@ -30788,6 +30802,67 @@ function Order($$anchor, $$props) {
|
|
|
30788
30802
|
return pop($$exports);
|
|
30789
30803
|
}
|
|
30790
30804
|
customElements.define("go-order", create_custom_element(Order, { token: { attribute: "token", reflect: true, type: "String" } }, [], ["orderDetails"], false));
|
|
30805
|
+
var root_1$4 = /* @__PURE__ */ from_html(`<br/> <span class="go-order-item-quantities"> </span>`, 1);
|
|
30806
|
+
var root$3 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-order-breakdown-count">1</li> <li class="go-order-breakdown-product"><span class="go-order-item-title"> </span> <!> <a class="go-ticket-download" target="_blank">Download</a></li> <li class="go-order-breakdown-item-price"> </li> <li class="go-order-breakdown-passbook"></li></ul></article></li>`);
|
|
30807
|
+
function Event$1($$anchor, $$props) {
|
|
30808
|
+
push($$props, true);
|
|
30809
|
+
let item = prop($$props, "item", 7), orderDetails = prop($$props, "orderDetails", 7);
|
|
30810
|
+
var $$exports = {
|
|
30811
|
+
get item() {
|
|
30812
|
+
return item();
|
|
30813
|
+
},
|
|
30814
|
+
set item($$value) {
|
|
30815
|
+
item($$value);
|
|
30816
|
+
flushSync();
|
|
30817
|
+
},
|
|
30818
|
+
get orderDetails() {
|
|
30819
|
+
return orderDetails();
|
|
30820
|
+
},
|
|
30821
|
+
set orderDetails($$value) {
|
|
30822
|
+
orderDetails($$value);
|
|
30823
|
+
flushSync();
|
|
30824
|
+
}
|
|
30825
|
+
};
|
|
30826
|
+
var li = root$3();
|
|
30827
|
+
var article = child(li);
|
|
30828
|
+
var ul = child(article);
|
|
30829
|
+
var li_1 = sibling(child(ul), 2);
|
|
30830
|
+
var span = child(li_1);
|
|
30831
|
+
var text2 = child(span, true);
|
|
30832
|
+
reset(span);
|
|
30833
|
+
var node = sibling(span, 2);
|
|
30834
|
+
each(node, 17, () => item().attributes.quantities, index$1, ($$anchor2, scalePrice) => {
|
|
30835
|
+
var fragment = root_1$4();
|
|
30836
|
+
var span_1 = sibling(first_child(fragment), 2);
|
|
30837
|
+
var text_1 = child(span_1);
|
|
30838
|
+
reset(span_1);
|
|
30839
|
+
template_effect(() => set_text(text_1, `${get$2(scalePrice).quantity ?? ""} x ${get$2(scalePrice).title ?? ""}`));
|
|
30840
|
+
append($$anchor2, fragment);
|
|
30841
|
+
});
|
|
30842
|
+
var a2 = sibling(node, 2);
|
|
30843
|
+
reset(li_1);
|
|
30844
|
+
var li_2 = sibling(li_1, 2);
|
|
30845
|
+
var text_2 = child(li_2, true);
|
|
30846
|
+
reset(li_2);
|
|
30847
|
+
next(2);
|
|
30848
|
+
reset(ul);
|
|
30849
|
+
reset(article);
|
|
30850
|
+
reset(li);
|
|
30851
|
+
template_effect(
|
|
30852
|
+
($0, $1) => {
|
|
30853
|
+
set_text(text2, item().attributes.title);
|
|
30854
|
+
set_attribute(a2, "href", $0);
|
|
30855
|
+
set_text(text_2, $1);
|
|
30856
|
+
},
|
|
30857
|
+
[
|
|
30858
|
+
() => orderDetails().downloadLink(item()),
|
|
30859
|
+
() => formatCurrency$1(item().price_cents)
|
|
30860
|
+
]
|
|
30861
|
+
);
|
|
30862
|
+
append($$anchor, li);
|
|
30863
|
+
return pop($$exports);
|
|
30864
|
+
}
|
|
30865
|
+
create_custom_element(Event$1, { item: {}, orderDetails: {} }, [], [], true);
|
|
30791
30866
|
var root_4$1 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date"> </span> <span class="go-cart-item-time"> </span>`, 1);
|
|
30792
30867
|
var root_6 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date"> </span>`);
|
|
30793
30868
|
var root_7$1 = /* @__PURE__ */ from_html(`<a class="go-ticket-download" target="_blank">Download</a>`);
|
|
@@ -31012,7 +31087,7 @@ function Breakdown($$anchor, $$props) {
|
|
|
31012
31087
|
var fragment = comment();
|
|
31013
31088
|
var node = first_child(fragment);
|
|
31014
31089
|
{
|
|
31015
|
-
var
|
|
31090
|
+
var consequent_2 = ($$anchor2) => {
|
|
31016
31091
|
var ol = root_1$3();
|
|
31017
31092
|
var node_1 = sibling(child(ol), 2);
|
|
31018
31093
|
each(node_1, 17, () => get$2(order).items, (item) => item.id, ($$anchor3, item) => {
|
|
@@ -31029,8 +31104,33 @@ function Breakdown($$anchor, $$props) {
|
|
|
31029
31104
|
}
|
|
31030
31105
|
});
|
|
31031
31106
|
};
|
|
31107
|
+
var alternate = ($$anchor4) => {
|
|
31108
|
+
var fragment_3 = comment();
|
|
31109
|
+
var node_3 = first_child(fragment_3);
|
|
31110
|
+
{
|
|
31111
|
+
var consequent_1 = ($$anchor5) => {
|
|
31112
|
+
Event$1($$anchor5, {
|
|
31113
|
+
get item() {
|
|
31114
|
+
return get$2(item);
|
|
31115
|
+
},
|
|
31116
|
+
get orderDetails() {
|
|
31117
|
+
return get$2(orderDetails);
|
|
31118
|
+
}
|
|
31119
|
+
});
|
|
31120
|
+
};
|
|
31121
|
+
if_block(
|
|
31122
|
+
node_3,
|
|
31123
|
+
($$render) => {
|
|
31124
|
+
if (get$2(item).type === "Event") $$render(consequent_1);
|
|
31125
|
+
},
|
|
31126
|
+
true
|
|
31127
|
+
);
|
|
31128
|
+
}
|
|
31129
|
+
append($$anchor4, fragment_3);
|
|
31130
|
+
};
|
|
31032
31131
|
if_block(node_2, ($$render) => {
|
|
31033
31132
|
if (get$2(item).type === "Ticket") $$render(consequent);
|
|
31133
|
+
else $$render(alternate, false);
|
|
31034
31134
|
});
|
|
31035
31135
|
}
|
|
31036
31136
|
append($$anchor3, fragment_1);
|
|
@@ -31048,7 +31148,7 @@ function Breakdown($$anchor, $$props) {
|
|
|
31048
31148
|
append($$anchor2, ol);
|
|
31049
31149
|
};
|
|
31050
31150
|
if_block(node, ($$render) => {
|
|
31051
|
-
if (get$2(order)) $$render(
|
|
31151
|
+
if (get$2(order)) $$render(consequent_2);
|
|
31052
31152
|
});
|
|
31053
31153
|
}
|
|
31054
31154
|
append($$anchor, fragment);
|
|
@@ -31270,6 +31370,187 @@ function TicketsSum($$anchor, $$props) {
|
|
|
31270
31370
|
pop();
|
|
31271
31371
|
}
|
|
31272
31372
|
customElements.define("go-tickets-sum", create_custom_element(TicketsSum, {}, [], [], false));
|
|
31373
|
+
function loadAnnualTickets(segment) {
|
|
31374
|
+
const tsd = segment.ticketSelectionDetails;
|
|
31375
|
+
if (!tsd) return [];
|
|
31376
|
+
if (!tsd.filters?.includes("annual")) return [];
|
|
31377
|
+
const tickets = snapshot(shop.tickets({
|
|
31378
|
+
by_bookable: true,
|
|
31379
|
+
// @ts-ignore
|
|
31380
|
+
"by_ticket_types[]": ["annual"],
|
|
31381
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
31382
|
+
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
31383
|
+
}));
|
|
31384
|
+
if (!tickets) return [];
|
|
31385
|
+
segment.tickets = initUITimeslotTickets(tickets);
|
|
31386
|
+
}
|
|
31387
|
+
function loadDayTickets(segment) {
|
|
31388
|
+
const tsd = segment.ticketSelectionDetails;
|
|
31389
|
+
if (!tsd) return [];
|
|
31390
|
+
if (!tsd.filters?.includes("day")) return [];
|
|
31391
|
+
const tickets = snapshot(shop.tickets({
|
|
31392
|
+
by_bookable: true,
|
|
31393
|
+
// @ts-ignore
|
|
31394
|
+
"by_ticket_types[]": ["normal"],
|
|
31395
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
31396
|
+
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
31397
|
+
}));
|
|
31398
|
+
if (!tickets) return [];
|
|
31399
|
+
segment.tickets = initUITimeslotTickets(tickets);
|
|
31400
|
+
}
|
|
31401
|
+
function loadEventScaledPricesTickets(segment) {
|
|
31402
|
+
const tsd = segment.ticketSelectionDetails;
|
|
31403
|
+
if (!tsd) {
|
|
31404
|
+
console.warn("(loadEventScaledPricesTickets) tsd is undefined");
|
|
31405
|
+
segment.tickets = [];
|
|
31406
|
+
return;
|
|
31407
|
+
}
|
|
31408
|
+
if (!tsd.eventIds?.length) {
|
|
31409
|
+
console.warn("(loadEventScaledPricesTickets) eventIds is undefined");
|
|
31410
|
+
segment.tickets = [];
|
|
31411
|
+
return;
|
|
31412
|
+
}
|
|
31413
|
+
if (!segment.filters?.includes("event:scaled-price")) {
|
|
31414
|
+
console.warn("(loadEventScaledPricesTickets) filters should include event:scaled-price");
|
|
31415
|
+
segment.tickets = [];
|
|
31416
|
+
return;
|
|
31417
|
+
}
|
|
31418
|
+
if (!segment.dateId) {
|
|
31419
|
+
console.warn("(loadEventScaledPricesTickets) date-id is not given to the go-ticket-segment");
|
|
31420
|
+
segment.tickets = [];
|
|
31421
|
+
return;
|
|
31422
|
+
}
|
|
31423
|
+
if (tsd.eventIds.length > 1) throw new Error("(loadEventScaledPricesTickets) currently we support only one eventId in go-ticket-selection");
|
|
31424
|
+
const eid = tsd.eventIds[0];
|
|
31425
|
+
const event = snapshot(shop.getEventDetailsOnDate(eid, segment.dateId));
|
|
31426
|
+
segment.tickets = event?.prices.map((t) => createUIEventTicket(t, segment.dateId)) || [];
|
|
31427
|
+
const seats = {
|
|
31428
|
+
max_per_registration: 2,
|
|
31429
|
+
available: 100,
|
|
31430
|
+
overbook: true,
|
|
31431
|
+
...event?.seats
|
|
31432
|
+
};
|
|
31433
|
+
const max_per_registration = seats.max_per_registration || seats.available;
|
|
31434
|
+
segment.contingent = seats.overbook ? max_per_registration : Math.min(seats.available, max_per_registration);
|
|
31435
|
+
}
|
|
31436
|
+
function createCapacities(apiCapacities) {
|
|
31437
|
+
let reservations = {};
|
|
31438
|
+
const ret = {
|
|
31439
|
+
apiData: apiCapacities,
|
|
31440
|
+
reservations,
|
|
31441
|
+
setReservation(ticketId, timeSlot, quantity) {
|
|
31442
|
+
this.reservations[ticketId + ":" + timeSlot] = quantity;
|
|
31443
|
+
},
|
|
31444
|
+
getReservation(ticketId, timeSlot) {
|
|
31445
|
+
return this.reservations[ticketId + ":" + timeSlot] ?? 0;
|
|
31446
|
+
},
|
|
31447
|
+
/**
|
|
31448
|
+
* a flat list of all timeslots and their capacities, considering reservations.
|
|
31449
|
+
*/
|
|
31450
|
+
timeslots() {
|
|
31451
|
+
return Object.entries(this.apiData).flatMap(([quota, cap]) => {
|
|
31452
|
+
return Object.keys(cap.capacities).map((timeSlot) => {
|
|
31453
|
+
const sumReserved = sum(cap.tickets.map((ticket) => this.getReservation(ticket, timeSlot)));
|
|
31454
|
+
return {
|
|
31455
|
+
timeSlot,
|
|
31456
|
+
quota,
|
|
31457
|
+
capacity: cap.capacities[timeSlot] - sumReserved,
|
|
31458
|
+
tickets: cap.tickets
|
|
31459
|
+
};
|
|
31460
|
+
});
|
|
31461
|
+
});
|
|
31462
|
+
},
|
|
31463
|
+
tickets(ticketId) {
|
|
31464
|
+
return this.timeslots().flatMap(
|
|
31465
|
+
(x) => x.tickets.map((ticket) => ({
|
|
31466
|
+
timeslot: x.timeSlot,
|
|
31467
|
+
ticket,
|
|
31468
|
+
quota: x.quota,
|
|
31469
|
+
capacity: x.capacity
|
|
31470
|
+
}))
|
|
31471
|
+
);
|
|
31472
|
+
},
|
|
31473
|
+
ticketsByTimeSlot(timeslot) {
|
|
31474
|
+
return this.timeslots().filter((x) => x.timeSlot === timeslot).flatMap(
|
|
31475
|
+
(x) => x.tickets.map((ticket) => ({
|
|
31476
|
+
timeslot,
|
|
31477
|
+
ticket,
|
|
31478
|
+
quota: x.quota,
|
|
31479
|
+
capacity: x.capacity
|
|
31480
|
+
}))
|
|
31481
|
+
);
|
|
31482
|
+
},
|
|
31483
|
+
ticketCapacityByTicketAndTimeslot(ticketId, timeslot) {
|
|
31484
|
+
const maxCap = max$1(
|
|
31485
|
+
this.ticketsByTimeSlot(timeslot).filter((x) => x.ticket === ticketId),
|
|
31486
|
+
(x) => x.capacity
|
|
31487
|
+
)?.capacity ?? 0;
|
|
31488
|
+
return maxCap;
|
|
31489
|
+
},
|
|
31490
|
+
/**
|
|
31491
|
+
* returns the max capacity of a ticket in all timeslots
|
|
31492
|
+
*/
|
|
31493
|
+
ticketCapacityByTicketId(ticketId) {
|
|
31494
|
+
const maxCap = max$1(
|
|
31495
|
+
this.tickets(ticketId).filter((x) => x.ticket === ticketId),
|
|
31496
|
+
(x) => x.capacity
|
|
31497
|
+
)?.capacity ?? 0;
|
|
31498
|
+
return maxCap;
|
|
31499
|
+
}
|
|
31500
|
+
};
|
|
31501
|
+
return ret;
|
|
31502
|
+
}
|
|
31503
|
+
async function loadEventTickets(segment) {
|
|
31504
|
+
const tsd = segment.ticketSelectionDetails;
|
|
31505
|
+
if (!tsd) {
|
|
31506
|
+
console.warn("(loadEventTickets) tsd is undefined");
|
|
31507
|
+
segment.tickets = [];
|
|
31508
|
+
return;
|
|
31509
|
+
}
|
|
31510
|
+
if (!tsd.eventIds?.length) {
|
|
31511
|
+
console.warn("(loadEventTickets) eventIds is undefined");
|
|
31512
|
+
segment.tickets = [];
|
|
31513
|
+
return;
|
|
31514
|
+
}
|
|
31515
|
+
if (!segment.filters?.includes("event:ticket")) {
|
|
31516
|
+
console.warn("(loadEventTickets) filters should include event:tickets");
|
|
31517
|
+
segment.tickets = [];
|
|
31518
|
+
return;
|
|
31519
|
+
}
|
|
31520
|
+
if (!tsd.selectedDate) {
|
|
31521
|
+
console.warn("(loadEventTickets) selected-date is not given to the go-ticket-selection");
|
|
31522
|
+
segment.tickets = [];
|
|
31523
|
+
return;
|
|
31524
|
+
}
|
|
31525
|
+
if (tsd.eventIds.length > 1) throw new Error("(loadEventTickets) currently we support only one eventId in go-ticket-selection");
|
|
31526
|
+
const eid = tsd.eventIds[0];
|
|
31527
|
+
const event = shop.getEvent(eid);
|
|
31528
|
+
if (!event?.tickets) return;
|
|
31529
|
+
const ticketIds = event.tickets;
|
|
31530
|
+
const tickets = shop.tickets({ by_ticket_ids: ticketIds });
|
|
31531
|
+
const capacitiesRes = await shop.getTicketCapacities(tsd.selectedDate.toString(), ticketIds);
|
|
31532
|
+
if (!tickets || !capacitiesRes) return;
|
|
31533
|
+
const capacities = createCapacities(capacitiesRes.data.data);
|
|
31534
|
+
segment.tickets = tickets.filter((t) => capacities.ticketCapacityByTicketId(t.id) > 0).map((t) => createUITicket(t));
|
|
31535
|
+
segment.preCart = createCart(segment.tickets);
|
|
31536
|
+
}
|
|
31537
|
+
function loadTimeslotTickets(segment) {
|
|
31538
|
+
const tsd = segment.ticketSelectionDetails;
|
|
31539
|
+
if (!tsd) return [];
|
|
31540
|
+
if (!tsd.selectedDate && !tsd.selectedTimeslot && tsd.filters?.includes("timeslot")) return [];
|
|
31541
|
+
const result = snapshot(shop.ticketsAndQuotas({
|
|
31542
|
+
by_bookable: true,
|
|
31543
|
+
valid_at: tsd.selectedDate?.toString(),
|
|
31544
|
+
// @ts-ignore
|
|
31545
|
+
"by_ticket_types[]": ["time_slot"],
|
|
31546
|
+
"by_museum_ids[]": tsd.museumIds,
|
|
31547
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
31548
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
31549
|
+
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
31550
|
+
}));
|
|
31551
|
+
if (!result) return [];
|
|
31552
|
+
segment.tickets = initUITimeslotTickets(result.tickets);
|
|
31553
|
+
}
|
|
31273
31554
|
class TicketSegmentDetails {
|
|
31274
31555
|
#ticketSelectionDetails;
|
|
31275
31556
|
get ticketSelectionDetails() {
|
|
@@ -31324,7 +31605,10 @@ class TicketSegmentDetails {
|
|
|
31324
31605
|
});
|
|
31325
31606
|
});
|
|
31326
31607
|
user_effect(() => {
|
|
31327
|
-
this.
|
|
31608
|
+
this.loadTickets();
|
|
31609
|
+
untrack(() => {
|
|
31610
|
+
this.preCart = createCart(this.tickets, this.contingent);
|
|
31611
|
+
});
|
|
31328
31612
|
});
|
|
31329
31613
|
});
|
|
31330
31614
|
}
|
|
@@ -31335,105 +31619,17 @@ class TicketSegmentDetails {
|
|
|
31335
31619
|
preCart: this.preCart
|
|
31336
31620
|
});
|
|
31337
31621
|
}
|
|
31338
|
-
|
|
31339
|
-
|
|
31340
|
-
|
|
31341
|
-
|
|
31342
|
-
|
|
31343
|
-
|
|
31344
|
-
|
|
31345
|
-
|
|
31346
|
-
|
|
31347
|
-
|
|
31348
|
-
|
|
31349
|
-
return this.scaledPricesTickets;
|
|
31350
|
-
default:
|
|
31351
|
-
const exhaustiveCheck = this.filters;
|
|
31352
|
-
if (exhaustiveCheck) throw new Error(`(TicketGroup) Unhandled case: ${exhaustiveCheck}`);
|
|
31353
|
-
}
|
|
31354
|
-
return [];
|
|
31355
|
-
}
|
|
31356
|
-
get timeslotTickets() {
|
|
31357
|
-
const tsd = this.ticketSelectionDetails;
|
|
31358
|
-
if (!tsd) return [];
|
|
31359
|
-
if (!tsd.selectedDate && !tsd.selectedTimeslot && tsd.filters?.includes("timeslot")) return [];
|
|
31360
|
-
const result = snapshot(shop.ticketsAndQuotas({
|
|
31361
|
-
by_bookable: true,
|
|
31362
|
-
valid_at: tsd.selectedDate?.toString(),
|
|
31363
|
-
// @ts-ignore
|
|
31364
|
-
"by_ticket_types[]": ["time_slot"],
|
|
31365
|
-
"by_museum_ids[]": tsd.museumIds,
|
|
31366
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
31367
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
31368
|
-
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
31369
|
-
}));
|
|
31370
|
-
if (!result) return [];
|
|
31371
|
-
return initUITimeslotTickets(result.tickets);
|
|
31372
|
-
}
|
|
31373
|
-
get annualTickets() {
|
|
31374
|
-
const tsd = this.ticketSelectionDetails;
|
|
31375
|
-
if (!tsd) return [];
|
|
31376
|
-
if (!tsd.filters?.includes("annual")) return [];
|
|
31377
|
-
const tickets = snapshot(shop.tickets({
|
|
31378
|
-
by_bookable: true,
|
|
31379
|
-
// @ts-ignore
|
|
31380
|
-
"by_ticket_types[]": ["annual"],
|
|
31381
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
31382
|
-
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
31383
|
-
}));
|
|
31384
|
-
if (!tickets) return [];
|
|
31385
|
-
return initUITimeslotTickets(tickets);
|
|
31386
|
-
}
|
|
31387
|
-
get dayTickets() {
|
|
31388
|
-
const tsd = this.ticketSelectionDetails;
|
|
31389
|
-
if (!tsd) return [];
|
|
31390
|
-
if (!tsd.filters?.includes("day")) return [];
|
|
31391
|
-
const tickets = snapshot(shop.tickets({
|
|
31392
|
-
by_bookable: true,
|
|
31393
|
-
// @ts-ignore
|
|
31394
|
-
"by_ticket_types[]": ["normal"],
|
|
31395
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
31396
|
-
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
31397
|
-
}));
|
|
31398
|
-
if (!tickets) return [];
|
|
31399
|
-
return initUITimeslotTickets(tickets);
|
|
31400
|
-
}
|
|
31401
|
-
get scaledPricesTickets() {
|
|
31402
|
-
const tsd = this.ticketSelectionDetails;
|
|
31403
|
-
if (!this.ensureScaledPrices()) return [];
|
|
31404
|
-
const eid = tsd.eventIds[0];
|
|
31405
|
-
const event = snapshot(shop.getEventDetailsOnDate(eid, this.dateId));
|
|
31406
|
-
const ret = event?.prices.map((t) => createUIEventTicket(t, this.dateId)) || [];
|
|
31407
|
-
const seats = {
|
|
31408
|
-
max_per_registration: 2,
|
|
31409
|
-
available: 100,
|
|
31410
|
-
overbook: true,
|
|
31411
|
-
...event?.seats
|
|
31412
|
-
};
|
|
31413
|
-
const max_per_registration = seats.max_per_registration || seats.available;
|
|
31414
|
-
this.contingent = seats.overbook ? max_per_registration : Math.min(seats.available, max_per_registration);
|
|
31415
|
-
return ret;
|
|
31416
|
-
}
|
|
31417
|
-
ensureScaledPrices() {
|
|
31418
|
-
const tsd = this.ticketSelectionDetails;
|
|
31419
|
-
if (!tsd) {
|
|
31420
|
-
console.warn("(scaledPricesTickets) tsd is undefined");
|
|
31421
|
-
return false;
|
|
31422
|
-
}
|
|
31423
|
-
if (!tsd.eventIds?.length) {
|
|
31424
|
-
console.warn("(scaledPricesTickets) eventIds is undefined");
|
|
31425
|
-
return false;
|
|
31426
|
-
}
|
|
31427
|
-
if (!this.filters?.includes("scaled-price")) {
|
|
31428
|
-
console.warn("(scaledPricesTickets) filters should include scaled-price");
|
|
31429
|
-
return false;
|
|
31430
|
-
}
|
|
31431
|
-
if (!this.dateId) {
|
|
31432
|
-
console.warn("(scaledPricesTickets) date-id is not given to the go-ticket-segment");
|
|
31433
|
-
return false;
|
|
31434
|
-
}
|
|
31435
|
-
if (tsd.eventIds.length > 1) throw new Error("(scaledPricesTickets) currently we support only one eventId in go-ticket-selection");
|
|
31436
|
-
return true;
|
|
31622
|
+
loadTickets() {
|
|
31623
|
+
const method = {
|
|
31624
|
+
timeslot: loadTimeslotTickets,
|
|
31625
|
+
annual: loadAnnualTickets,
|
|
31626
|
+
day: loadDayTickets,
|
|
31627
|
+
custom: () => {
|
|
31628
|
+
},
|
|
31629
|
+
"event:scaled-price": loadEventScaledPricesTickets,
|
|
31630
|
+
"event:ticket": loadEventTickets
|
|
31631
|
+
}[this.filters];
|
|
31632
|
+
method(this);
|
|
31437
31633
|
}
|
|
31438
31634
|
}
|
|
31439
31635
|
const KEY = "go-ticket-segment";
|
|
@@ -31443,7 +31639,6 @@ function TicketSegment($$anchor, $$props) {
|
|
|
31443
31639
|
push($$props, true);
|
|
31444
31640
|
const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7);
|
|
31445
31641
|
if (!filters()) throw new Error("filters is required");
|
|
31446
|
-
console.log("TicketSegment: ", filters(), "dateId: ", dateId());
|
|
31447
31642
|
const tsdWrapper = getTicketSelectionDetails($$props.$$host);
|
|
31448
31643
|
const details = new TicketSegmentDetails(filters(), tsdWrapper);
|
|
31449
31644
|
setTicketSegmentDetails($$props.$$host, details);
|
|
@@ -31452,7 +31647,6 @@ function TicketSegment($$anchor, $$props) {
|
|
|
31452
31647
|
user_effect(() => {
|
|
31453
31648
|
details.filters = filters();
|
|
31454
31649
|
details.dateId = dateId();
|
|
31455
|
-
console.log("SET DATEID,", dateId());
|
|
31456
31650
|
});
|
|
31457
31651
|
var $$exports = {
|
|
31458
31652
|
details,
|
|
@@ -31871,7 +32065,8 @@ class Calendar {
|
|
|
31871
32065
|
day: "normal",
|
|
31872
32066
|
timeslot: "time_slot",
|
|
31873
32067
|
annual: "annual",
|
|
31874
|
-
"scaled-price": "scaled_price"
|
|
32068
|
+
"event:scaled-price": "scaled_price",
|
|
32069
|
+
"event:ticket": "not implemented"
|
|
31875
32070
|
})[f]);
|
|
31876
32071
|
}
|
|
31877
32072
|
params() {
|