@gomusdev/web-components 4.13.1 → 4.14.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 +548 -423
- package/dist-js/gomus-webcomponents.js +548 -423
- package/dist-js/gomus-webcomponents.min.iife.js +34 -34
- package/dist-js/gomus-webcomponents.min.js +3822 -3748
- package/dist-js/src/components/ticketSelection/filters/_helpers.d.ts +12 -0
- package/dist-js/src/components/ticketSelection/filters/registry.d.ts +1 -1
- package/dist-js/src/components/ticketSelection/filters/spec/tour.spec.d.ts +1 -0
- package/dist-js/src/components/ticketSelection/filters/tour.d.ts +3 -0
- package/dist-js/src/components/ticketSelection/filters/types.d.ts +18 -1
- package/dist-js/src/factories/TourFactories.d.ts +1 -1
- package/dist-js/src/go/cart.d.ts +18 -16
- package/dist-js/src/go/go.d.ts +3 -3
- package/dist-js/src/lib/models/tour/UITour.svelte.d.ts +2 -2
- package/package.json +1 -1
|
@@ -35491,12 +35491,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
35491
35491
|
"events:admission:day",
|
|
35492
35492
|
"events:admission:timeslot",
|
|
35493
35493
|
"events:price",
|
|
35494
|
-
"coupon"
|
|
35494
|
+
"coupon",
|
|
35495
|
+
"tour"
|
|
35495
35496
|
];
|
|
35496
35497
|
//#endregion
|
|
35497
35498
|
//#region src/components/ticketSelection/filters/_helpers.ts
|
|
35498
35499
|
var TWO_HOURS_MS = 7200 * 1e3;
|
|
35499
35500
|
/**
|
|
35501
|
+
* The common tail of every ticket filter's `addToCart`: given the ticket
|
|
35502
|
+
* its loader resolved, build the cart line, reject if the ticket is unavailable
|
|
35503
|
+
* (sold out / unknown → the loader yielded nothing) or the quantity exceeds the
|
|
35504
|
+
* remaining capacity, add the line, and return its uuid. Subtype-agnostic — the
|
|
35505
|
+
* per-filter loader is the only thing that differs.
|
|
35506
|
+
*/
|
|
35507
|
+
function addResolvedTicketToCart(ticket, { id, quantity, time }) {
|
|
35508
|
+
if (!(quantity > 0)) throw new Error(`(go.cart.addItem) 'quantity' must be a positive number`);
|
|
35509
|
+
if (!ticket) throw new Error(`(go.cart.addItem) ticket ${id} not available (sold out or unknown)`);
|
|
35510
|
+
const item = createCartItem(ticket, {
|
|
35511
|
+
quantity,
|
|
35512
|
+
time: time ?? ticket.selectedTime
|
|
35513
|
+
});
|
|
35514
|
+
const { max } = shop.capacityManager.capacity(shop.cart, item, createCart());
|
|
35515
|
+
if (quantity > max) throw new Error(`(go.cart.addItem) only ${max} left for ticket ${id}`);
|
|
35516
|
+
shop.cart.addItem(item);
|
|
35517
|
+
return item.uuid;
|
|
35518
|
+
}
|
|
35519
|
+
/**
|
|
35500
35520
|
* When a segment opts into content attributes (with-content), batch-fetch
|
|
35501
35521
|
* tickets/content for the given tickets and merge each entry's `content` onto
|
|
35502
35522
|
* the matching ticket by id (mirrors the legacy `ticket.content = item.content`).
|
|
@@ -35556,433 +35576,566 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
35556
35576
|
loadPickerQuotas(tsd, quotas);
|
|
35557
35577
|
}
|
|
35558
35578
|
//#endregion
|
|
35559
|
-
//#region src/components/ticketSelection/filters/
|
|
35560
|
-
|
|
35561
|
-
|
|
35562
|
-
|
|
35563
|
-
|
|
35564
|
-
|
|
35565
|
-
|
|
35566
|
-
|
|
35567
|
-
|
|
35568
|
-
|
|
35569
|
-
|
|
35570
|
-
|
|
35571
|
-
|
|
35572
|
-
|
|
35573
|
-
|
|
35574
|
-
|
|
35575
|
-
|
|
35576
|
-
|
|
35577
|
-
|
|
35578
|
-
|
|
35579
|
-
|
|
35580
|
-
|
|
35581
|
-
|
|
35582
|
-
|
|
35583
|
-
|
|
35584
|
-
|
|
35585
|
-
|
|
35586
|
-
|
|
35587
|
-
|
|
35588
|
-
|
|
35589
|
-
|
|
35590
|
-
|
|
35591
|
-
|
|
35592
|
-
|
|
35593
|
-
|
|
35594
|
-
|
|
35595
|
-
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35596
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35597
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
35598
|
-
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
35599
|
-
}));
|
|
35600
|
-
shop.capacityManager.addQuotas(quotas);
|
|
35601
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
35602
|
-
await enrichTicketsWithContent(segment, uiTickets);
|
|
35603
|
-
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
35604
|
-
}
|
|
35579
|
+
//#region src/components/ticketSelection/filters/ticket/timeslot.ts
|
|
35580
|
+
async function loadTimeslotTickets(filters, selectedTime) {
|
|
35581
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35582
|
+
by_bookable: true,
|
|
35583
|
+
by_ticket_type: "time_slot",
|
|
35584
|
+
...filters
|
|
35585
|
+
}));
|
|
35586
|
+
shop.capacityManager.addQuotas(quotas);
|
|
35587
|
+
return initUITimeslotTickets(filterAvailabletickets(tickets, selectedTime), selectedTime);
|
|
35588
|
+
}
|
|
35589
|
+
var filter$12 = {
|
|
35590
|
+
name: "ticket:timeslot",
|
|
35591
|
+
calendarEndpoint: "tickets",
|
|
35592
|
+
apiToken: "time_slot",
|
|
35593
|
+
requires: [{
|
|
35594
|
+
kind: "tsd",
|
|
35595
|
+
field: "selectedDate"
|
|
35596
|
+
}, {
|
|
35597
|
+
kind: "tsd",
|
|
35598
|
+
field: "selectedTimeslot"
|
|
35599
|
+
}],
|
|
35600
|
+
isCalendarVisible: () => true,
|
|
35601
|
+
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
35602
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
35603
|
+
async addToCart(options) {
|
|
35604
|
+
const { id, quantity, time } = options;
|
|
35605
|
+
if (!time) throw new Error(`(go.cart.addItem) ticket:timeslot requires a 'time'`);
|
|
35606
|
+
const ticket = (await loadTimeslotTickets({
|
|
35607
|
+
valid_at: time.slice(0, 10),
|
|
35608
|
+
"by_ticket_ids[]": [id]
|
|
35609
|
+
}, time))[0];
|
|
35610
|
+
return addResolvedTicketToCart(ticket, {
|
|
35611
|
+
id,
|
|
35612
|
+
quantity,
|
|
35613
|
+
time
|
|
35614
|
+
});
|
|
35605
35615
|
},
|
|
35606
|
-
|
|
35607
|
-
|
|
35608
|
-
|
|
35609
|
-
|
|
35610
|
-
|
|
35611
|
-
|
|
35612
|
-
|
|
35613
|
-
|
|
35614
|
-
|
|
35615
|
-
|
|
35616
|
-
|
|
35617
|
-
|
|
35618
|
-
async loadProducts(segment) {
|
|
35619
|
-
const tsd = segment.ticketSelectionDetails;
|
|
35620
|
-
if (!tsd?.selectedDate) return;
|
|
35621
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35622
|
-
by_bookable: true,
|
|
35623
|
-
valid_at: tsd.selectedDate.toString(),
|
|
35624
|
-
"by_ticket_types[]": ["normal"],
|
|
35625
|
-
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35626
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35627
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
35628
|
-
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
35629
|
-
}));
|
|
35630
|
-
shop.capacityManager.addQuotas(quotas);
|
|
35631
|
-
const uiTickets = initUIDayTickets(tickets);
|
|
35632
|
-
await enrichTicketsWithContent(segment, uiTickets);
|
|
35633
|
-
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: ticket.selectedTime }));
|
|
35634
|
-
}
|
|
35616
|
+
async loadTimeslots(tsd) {
|
|
35617
|
+
if (!tsd?.selectedDate) return;
|
|
35618
|
+
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35619
|
+
by_bookable: true,
|
|
35620
|
+
valid_at: tsd.selectedDate.toString(),
|
|
35621
|
+
by_ticket_type: "time_slot",
|
|
35622
|
+
"by_museum_ids[]": tsd.museumIds,
|
|
35623
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35624
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
35625
|
+
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
35626
|
+
}));
|
|
35627
|
+
loadPickerQuotas(tsd, quotas);
|
|
35635
35628
|
},
|
|
35636
|
-
|
|
35637
|
-
|
|
35638
|
-
|
|
35639
|
-
|
|
35640
|
-
|
|
35641
|
-
|
|
35642
|
-
|
|
35643
|
-
|
|
35644
|
-
|
|
35645
|
-
|
|
35646
|
-
|
|
35647
|
-
|
|
35648
|
-
|
|
35649
|
-
|
|
35650
|
-
|
|
35651
|
-
|
|
35652
|
-
|
|
35653
|
-
|
|
35654
|
-
|
|
35655
|
-
|
|
35656
|
-
|
|
35657
|
-
|
|
35629
|
+
async loadProducts(segment) {
|
|
35630
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35631
|
+
if (!tsd?.selectedDate || !tsd.selectedTimeslot) return;
|
|
35632
|
+
const uiTickets = await loadTimeslotTickets({
|
|
35633
|
+
valid_at: tsd.selectedDate.toString(),
|
|
35634
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35635
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35636
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
35637
|
+
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
35638
|
+
}, tsd.selectedTimeslot);
|
|
35639
|
+
await enrichTicketsWithContent(segment, uiTickets);
|
|
35640
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
35641
|
+
}
|
|
35642
|
+
};
|
|
35643
|
+
//#endregion
|
|
35644
|
+
//#region src/components/ticketSelection/filters/ticket/day.ts
|
|
35645
|
+
async function loadDayTickets(filters) {
|
|
35646
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35647
|
+
by_bookable: true,
|
|
35648
|
+
"by_ticket_types[]": ["normal"],
|
|
35649
|
+
...filters
|
|
35650
|
+
}));
|
|
35651
|
+
shop.capacityManager.addQuotas(quotas);
|
|
35652
|
+
return initUIDayTickets(tickets);
|
|
35653
|
+
}
|
|
35654
|
+
var filter$11 = {
|
|
35655
|
+
name: "ticket:day",
|
|
35656
|
+
calendarEndpoint: "tickets",
|
|
35657
|
+
apiToken: "normal",
|
|
35658
|
+
requires: [{
|
|
35659
|
+
kind: "tsd",
|
|
35660
|
+
field: "selectedDate"
|
|
35661
|
+
}],
|
|
35662
|
+
isCalendarVisible: () => true,
|
|
35663
|
+
isTimeslotsVisible: () => false,
|
|
35664
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
35665
|
+
async loadTimeslots() {},
|
|
35666
|
+
async addToCart(options) {
|
|
35667
|
+
const { id, quantity, date } = options;
|
|
35668
|
+
if (!date) throw new Error(`(go.cart.addItem) ticket:day requires a 'date'`);
|
|
35669
|
+
const ticket = (await loadDayTickets({
|
|
35670
|
+
valid_at: date,
|
|
35671
|
+
"by_ticket_ids[]": [id]
|
|
35672
|
+
}))[0];
|
|
35673
|
+
return addResolvedTicketToCart(ticket, {
|
|
35674
|
+
id,
|
|
35675
|
+
quantity
|
|
35676
|
+
});
|
|
35658
35677
|
},
|
|
35659
|
-
|
|
35660
|
-
|
|
35661
|
-
|
|
35662
|
-
|
|
35678
|
+
async loadProducts(segment) {
|
|
35679
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35680
|
+
if (!tsd?.selectedDate) return;
|
|
35681
|
+
const uiTickets = await loadDayTickets({
|
|
35682
|
+
valid_at: tsd.selectedDate.toString(),
|
|
35683
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35684
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35685
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
35686
|
+
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
35687
|
+
});
|
|
35688
|
+
await enrichTicketsWithContent(segment, uiTickets);
|
|
35689
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: ticket.selectedTime }));
|
|
35690
|
+
}
|
|
35691
|
+
};
|
|
35692
|
+
//#endregion
|
|
35693
|
+
//#region src/components/ticketSelection/filters/ticket/annual.ts
|
|
35694
|
+
async function loadAnnualTickets(filters) {
|
|
35695
|
+
const tickets = await shop.asyncFetch(() => shop.tickets({
|
|
35696
|
+
by_bookable: true,
|
|
35697
|
+
"by_ticket_types[]": ["annual"],
|
|
35698
|
+
...filters
|
|
35699
|
+
}));
|
|
35700
|
+
return Object.values(tickets).map((t) => createUITicket(t));
|
|
35701
|
+
}
|
|
35702
|
+
var filter$10 = {
|
|
35703
|
+
name: "ticket:annual",
|
|
35704
|
+
calendarEndpoint: null,
|
|
35705
|
+
apiToken: "annual",
|
|
35706
|
+
requires: [],
|
|
35707
|
+
isCalendarVisible: () => false,
|
|
35708
|
+
isTimeslotsVisible: () => false,
|
|
35709
|
+
isTicketsVisible: () => true,
|
|
35710
|
+
async loadTimeslots() {},
|
|
35711
|
+
async addToCart(options) {
|
|
35712
|
+
const { id, quantity } = options;
|
|
35713
|
+
const ticket = (await loadAnnualTickets({ "by_ticket_ids[]": [id] }))[0];
|
|
35714
|
+
return addResolvedTicketToCart(ticket, {
|
|
35715
|
+
id,
|
|
35716
|
+
quantity
|
|
35717
|
+
});
|
|
35718
|
+
},
|
|
35719
|
+
async loadProducts(segment) {
|
|
35720
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35721
|
+
if (!tsd) return;
|
|
35722
|
+
const uiTickets = await loadAnnualTickets({
|
|
35723
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
35724
|
+
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
35725
|
+
});
|
|
35726
|
+
await enrichTicketsWithContent(segment, uiTickets);
|
|
35727
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket));
|
|
35728
|
+
}
|
|
35729
|
+
};
|
|
35730
|
+
//#endregion
|
|
35731
|
+
//#region src/components/ticketSelection/filters/event/admission.ts
|
|
35732
|
+
var filter$9 = {
|
|
35733
|
+
name: "event:admission",
|
|
35734
|
+
calendarEndpoint: "events",
|
|
35735
|
+
requires: [{
|
|
35736
|
+
kind: "tsd",
|
|
35737
|
+
field: "eventIds"
|
|
35738
|
+
}, {
|
|
35739
|
+
kind: "tsd",
|
|
35740
|
+
field: "selectedDate"
|
|
35741
|
+
}],
|
|
35742
|
+
isCalendarVisible: () => true,
|
|
35743
|
+
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
35744
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
35745
|
+
async loadTimeslots(tsd) {
|
|
35746
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
35747
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
35748
|
+
if (!event.tickets?.length) return;
|
|
35749
|
+
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35750
|
+
"by_ticket_ids[]": event.tickets,
|
|
35751
|
+
by_bookable: true,
|
|
35752
|
+
valid_at: tsd.selectedDate.toString()
|
|
35753
|
+
}));
|
|
35754
|
+
loadPickerQuotas(tsd, quotas);
|
|
35755
|
+
},
|
|
35756
|
+
async loadProducts(segment) {
|
|
35757
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35758
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
35759
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
35760
|
+
if (!event.tickets?.length) return;
|
|
35761
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35762
|
+
"by_ticket_ids[]": event.tickets,
|
|
35763
|
+
by_bookable: true,
|
|
35764
|
+
valid_at: tsd.selectedDate.toString()
|
|
35765
|
+
}));
|
|
35766
|
+
shop.capacityManager.addQuotas(quotas);
|
|
35767
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
35768
|
+
await enrichTicketsWithContent(segment, uiTickets);
|
|
35769
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
35770
|
+
}
|
|
35771
|
+
};
|
|
35772
|
+
//#endregion
|
|
35773
|
+
//#region src/components/ticketSelection/filters/event/admission-day.ts
|
|
35774
|
+
var filter$8 = {
|
|
35775
|
+
name: "event:admission:day",
|
|
35776
|
+
calendarEndpoint: "events",
|
|
35777
|
+
requires: [{
|
|
35778
|
+
kind: "tsd",
|
|
35779
|
+
field: "eventIds"
|
|
35780
|
+
}, {
|
|
35781
|
+
kind: "tsd",
|
|
35782
|
+
field: "selectedDate"
|
|
35783
|
+
}],
|
|
35784
|
+
isCalendarVisible: () => true,
|
|
35785
|
+
isTimeslotsVisible: () => false,
|
|
35786
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
35787
|
+
async loadTimeslots() {},
|
|
35788
|
+
async loadProducts(segment) {
|
|
35789
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35790
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
35791
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
35792
|
+
if (!event.tickets?.length) return;
|
|
35793
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35794
|
+
"by_ticket_ids[]": event.tickets,
|
|
35795
|
+
"by_ticket_types[]": ["normal"],
|
|
35796
|
+
by_bookable: true,
|
|
35797
|
+
valid_at: tsd.selectedDate.toString()
|
|
35798
|
+
}));
|
|
35799
|
+
shop.capacityManager.addQuotas(quotas);
|
|
35800
|
+
const uiTickets = initUIDayTickets(tickets);
|
|
35801
|
+
await enrichTicketsWithContent(segment, uiTickets);
|
|
35802
|
+
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: t.selectedTime }));
|
|
35803
|
+
}
|
|
35804
|
+
};
|
|
35805
|
+
//#endregion
|
|
35806
|
+
//#region src/components/ticketSelection/filters/event/admission-timeslot.ts
|
|
35807
|
+
var filter$7 = {
|
|
35808
|
+
name: "event:admission:timeslot",
|
|
35809
|
+
calendarEndpoint: "events",
|
|
35810
|
+
requires: [
|
|
35811
|
+
{
|
|
35663
35812
|
kind: "tsd",
|
|
35664
35813
|
field: "eventIds"
|
|
35665
|
-
},
|
|
35814
|
+
},
|
|
35815
|
+
{
|
|
35666
35816
|
kind: "tsd",
|
|
35667
35817
|
field: "selectedDate"
|
|
35668
|
-
}],
|
|
35669
|
-
isCalendarVisible: () => true,
|
|
35670
|
-
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
35671
|
-
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
35672
|
-
async loadTimeslots(tsd) {
|
|
35673
|
-
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
35674
|
-
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
35675
|
-
if (!event.tickets?.length) return;
|
|
35676
|
-
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35677
|
-
"by_ticket_ids[]": event.tickets,
|
|
35678
|
-
by_bookable: true,
|
|
35679
|
-
valid_at: tsd.selectedDate.toString()
|
|
35680
|
-
}));
|
|
35681
|
-
loadPickerQuotas(tsd, quotas);
|
|
35682
35818
|
},
|
|
35683
|
-
|
|
35684
|
-
|
|
35685
|
-
|
|
35686
|
-
|
|
35687
|
-
|
|
35819
|
+
{
|
|
35820
|
+
kind: "tsd",
|
|
35821
|
+
field: "selectedTimeslot"
|
|
35822
|
+
}
|
|
35823
|
+
],
|
|
35824
|
+
isCalendarVisible: () => true,
|
|
35825
|
+
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
35826
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
35827
|
+
async loadTimeslots(tsd) {
|
|
35828
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
35829
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
35830
|
+
if (!event.tickets?.length) return;
|
|
35831
|
+
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35832
|
+
"by_ticket_ids[]": event.tickets,
|
|
35833
|
+
by_ticket_type: "time_slot",
|
|
35834
|
+
by_bookable: true,
|
|
35835
|
+
valid_at: tsd.selectedDate.toString()
|
|
35836
|
+
}));
|
|
35837
|
+
loadPickerQuotas(tsd, quotas);
|
|
35838
|
+
},
|
|
35839
|
+
async loadProducts(segment) {
|
|
35840
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35841
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate || !tsd.selectedTimeslot) return;
|
|
35842
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
35843
|
+
if (!event.tickets?.length) return;
|
|
35844
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35845
|
+
"by_ticket_ids[]": event.tickets,
|
|
35846
|
+
by_ticket_type: "time_slot",
|
|
35847
|
+
by_bookable: true,
|
|
35848
|
+
valid_at: tsd.selectedDate.toString()
|
|
35849
|
+
}));
|
|
35850
|
+
shop.capacityManager.addQuotas(quotas);
|
|
35851
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
35852
|
+
await enrichTicketsWithContent(segment, uiTickets);
|
|
35853
|
+
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: tsd.selectedTime }));
|
|
35854
|
+
}
|
|
35855
|
+
};
|
|
35856
|
+
//#endregion
|
|
35857
|
+
//#region src/components/ticketSelection/filters/event/price.ts
|
|
35858
|
+
var filter$6 = {
|
|
35859
|
+
name: "event:price",
|
|
35860
|
+
calendarEndpoint: "events",
|
|
35861
|
+
requires: [{
|
|
35862
|
+
kind: "tsd",
|
|
35863
|
+
field: "eventIds"
|
|
35864
|
+
}, {
|
|
35865
|
+
kind: "segment",
|
|
35866
|
+
field: "dateId"
|
|
35867
|
+
}],
|
|
35868
|
+
isCalendarVisible: () => false,
|
|
35869
|
+
isTimeslotsVisible: () => false,
|
|
35870
|
+
isTicketsVisible: (tsd) => Boolean(tsd.eventIds?.length),
|
|
35871
|
+
loadTimeslots: async () => {},
|
|
35872
|
+
async loadProducts(segment) {
|
|
35873
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35874
|
+
if (!tsd?.eventIds?.length || segment.dateId === void 0) return;
|
|
35875
|
+
const date = await shop.asyncFetch(() => shop.getEventDetailsOnDate(tsd.eventIds[0], segment.dateId));
|
|
35876
|
+
if (!date.prices?.length) return;
|
|
35877
|
+
for (const price of date.prices) {
|
|
35878
|
+
const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title });
|
|
35879
|
+
segment.preCart.addItem(createCartItem(ticket, { time: date.start_time }));
|
|
35880
|
+
}
|
|
35881
|
+
if (date.seats) shop.capacityManager.addSeats(date.id, date.seats);
|
|
35882
|
+
}
|
|
35883
|
+
};
|
|
35884
|
+
//#endregion
|
|
35885
|
+
//#region src/components/ticketSelection/filters/events/admission.ts
|
|
35886
|
+
var filter$5 = {
|
|
35887
|
+
name: "events:admission",
|
|
35888
|
+
calendarEndpoint: "events",
|
|
35889
|
+
requires: [{
|
|
35890
|
+
kind: "tsd",
|
|
35891
|
+
field: "selectedDate"
|
|
35892
|
+
}, {
|
|
35893
|
+
kind: "tsd",
|
|
35894
|
+
field: "selectedTimeslot"
|
|
35895
|
+
}],
|
|
35896
|
+
isCalendarVisible: () => true,
|
|
35897
|
+
isTimeslotsVisible: () => true,
|
|
35898
|
+
isTicketsVisible: () => true,
|
|
35899
|
+
loadTimeslots: (tsd) => loadEventsTimeslots(tsd),
|
|
35900
|
+
async loadProducts(segment) {
|
|
35901
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35902
|
+
if (!tsd?.selectedDate || !tsd.selectedTime) return;
|
|
35903
|
+
const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({
|
|
35904
|
+
by_bookable: true,
|
|
35905
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35906
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35907
|
+
"by_event_ids[]": tsd.eventIds,
|
|
35908
|
+
"by_language_ids[]": segment.languageIds,
|
|
35909
|
+
"by_catch_word_ids[]": segment.catchWordIds,
|
|
35910
|
+
start_at: tsd.selectedDate.toString(),
|
|
35911
|
+
per_page: segment.limit || 30
|
|
35912
|
+
})), tsd.selectedDate.toString(), tsd.selectedTime);
|
|
35913
|
+
for (const date of dates) {
|
|
35914
|
+
if (!date.event_id || !date.start_time) continue;
|
|
35915
|
+
const event = await shop.asyncFetch(() => shop.getEvent(date.event_id));
|
|
35916
|
+
if (!event?.tickets?.length) continue;
|
|
35688
35917
|
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35689
35918
|
"by_ticket_ids[]": event.tickets,
|
|
35690
35919
|
by_bookable: true,
|
|
35691
|
-
valid_at:
|
|
35920
|
+
valid_at: date.start_time.slice(0, 10)
|
|
35692
35921
|
}));
|
|
35693
35922
|
shop.capacityManager.addQuotas(quotas);
|
|
35694
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets,
|
|
35923
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, date.start_time), date.start_time);
|
|
35695
35924
|
await enrichTicketsWithContent(segment, uiTickets);
|
|
35696
|
-
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time:
|
|
35925
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: date.start_time }));
|
|
35697
35926
|
}
|
|
35698
|
-
}
|
|
35699
|
-
|
|
35700
|
-
|
|
35701
|
-
|
|
35702
|
-
|
|
35703
|
-
|
|
35704
|
-
|
|
35705
|
-
|
|
35706
|
-
|
|
35707
|
-
|
|
35708
|
-
|
|
35709
|
-
|
|
35710
|
-
|
|
35711
|
-
|
|
35712
|
-
|
|
35713
|
-
|
|
35714
|
-
|
|
35715
|
-
|
|
35716
|
-
|
|
35717
|
-
|
|
35927
|
+
}
|
|
35928
|
+
};
|
|
35929
|
+
//#endregion
|
|
35930
|
+
//#region src/components/ticketSelection/filters/events/admission-day.ts
|
|
35931
|
+
var filter$4 = {
|
|
35932
|
+
name: "events:admission:day",
|
|
35933
|
+
calendarEndpoint: "events",
|
|
35934
|
+
requires: [{
|
|
35935
|
+
kind: "tsd",
|
|
35936
|
+
field: "selectedDate"
|
|
35937
|
+
}, {
|
|
35938
|
+
kind: "tsd",
|
|
35939
|
+
field: "selectedTimeslot"
|
|
35940
|
+
}],
|
|
35941
|
+
isCalendarVisible: () => true,
|
|
35942
|
+
isTimeslotsVisible: () => true,
|
|
35943
|
+
isTicketsVisible: () => true,
|
|
35944
|
+
loadTimeslots: (tsd) => loadEventsTimeslots(tsd),
|
|
35945
|
+
async loadProducts(segment) {
|
|
35946
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35947
|
+
if (!tsd?.selectedDate || !tsd.selectedTime) return;
|
|
35948
|
+
const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({
|
|
35949
|
+
by_bookable: true,
|
|
35950
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35951
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35952
|
+
"by_event_ids[]": tsd.eventIds,
|
|
35953
|
+
"by_language_ids[]": segment.languageIds,
|
|
35954
|
+
"by_catch_word_ids[]": segment.catchWordIds,
|
|
35955
|
+
start_at: tsd.selectedDate.toString(),
|
|
35956
|
+
per_page: segment.limit || 30
|
|
35957
|
+
})), tsd.selectedDate.toString(), tsd.selectedTime);
|
|
35958
|
+
for (const date of dates) {
|
|
35959
|
+
if (!date.event_id || !date.start_time) continue;
|
|
35960
|
+
const event = await shop.asyncFetch(() => shop.getEvent(date.event_id));
|
|
35961
|
+
if (!event?.tickets?.length) continue;
|
|
35718
35962
|
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35719
35963
|
"by_ticket_ids[]": event.tickets,
|
|
35720
35964
|
"by_ticket_types[]": ["normal"],
|
|
35721
35965
|
by_bookable: true,
|
|
35722
|
-
valid_at:
|
|
35966
|
+
valid_at: date.start_time.slice(0, 10)
|
|
35723
35967
|
}));
|
|
35724
35968
|
shop.capacityManager.addQuotas(quotas);
|
|
35725
|
-
const uiTickets = initUIDayTickets(tickets);
|
|
35969
|
+
const uiTickets = initUIDayTickets(tickets, date.start_time);
|
|
35726
35970
|
await enrichTicketsWithContent(segment, uiTickets);
|
|
35727
35971
|
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: t.selectedTime }));
|
|
35728
35972
|
}
|
|
35729
|
-
}
|
|
35730
|
-
|
|
35731
|
-
|
|
35732
|
-
|
|
35733
|
-
|
|
35734
|
-
|
|
35735
|
-
|
|
35736
|
-
|
|
35737
|
-
|
|
35738
|
-
|
|
35739
|
-
|
|
35740
|
-
|
|
35741
|
-
|
|
35742
|
-
|
|
35743
|
-
|
|
35744
|
-
|
|
35745
|
-
|
|
35746
|
-
|
|
35747
|
-
|
|
35748
|
-
|
|
35749
|
-
|
|
35750
|
-
|
|
35751
|
-
|
|
35752
|
-
|
|
35753
|
-
|
|
35754
|
-
|
|
35755
|
-
|
|
35756
|
-
|
|
35757
|
-
|
|
35758
|
-
|
|
35759
|
-
|
|
35760
|
-
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
|
|
35764
|
-
if (!tsd?.eventIds?.length || !tsd.selectedDate || !tsd.selectedTimeslot) return;
|
|
35765
|
-
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
35766
|
-
if (!event.tickets?.length) return;
|
|
35973
|
+
}
|
|
35974
|
+
};
|
|
35975
|
+
//#endregion
|
|
35976
|
+
//#region src/components/ticketSelection/filters/events/admission-timeslot.ts
|
|
35977
|
+
var filter$3 = {
|
|
35978
|
+
name: "events:admission:timeslot",
|
|
35979
|
+
calendarEndpoint: "events",
|
|
35980
|
+
requires: [{
|
|
35981
|
+
kind: "tsd",
|
|
35982
|
+
field: "selectedDate"
|
|
35983
|
+
}, {
|
|
35984
|
+
kind: "tsd",
|
|
35985
|
+
field: "selectedTimeslot"
|
|
35986
|
+
}],
|
|
35987
|
+
isCalendarVisible: () => true,
|
|
35988
|
+
isTimeslotsVisible: () => true,
|
|
35989
|
+
isTicketsVisible: () => true,
|
|
35990
|
+
loadTimeslots: (tsd) => loadEventsTimeslots(tsd),
|
|
35991
|
+
async loadProducts(segment) {
|
|
35992
|
+
const tsd = segment.ticketSelectionDetails;
|
|
35993
|
+
if (!tsd?.selectedDate || !tsd.selectedTime) return;
|
|
35994
|
+
const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({
|
|
35995
|
+
by_bookable: true,
|
|
35996
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35997
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35998
|
+
"by_event_ids[]": tsd.eventIds,
|
|
35999
|
+
"by_language_ids[]": segment.languageIds,
|
|
36000
|
+
"by_catch_word_ids[]": segment.catchWordIds,
|
|
36001
|
+
start_at: tsd.selectedDate.toString(),
|
|
36002
|
+
per_page: segment.limit || 30
|
|
36003
|
+
})), tsd.selectedDate.toString(), tsd.selectedTime);
|
|
36004
|
+
for (const date of dates) {
|
|
36005
|
+
if (!date.event_id || !date.start_time) continue;
|
|
36006
|
+
const event = await shop.asyncFetch(() => shop.getEvent(date.event_id));
|
|
36007
|
+
if (!event?.tickets?.length) continue;
|
|
35767
36008
|
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35768
36009
|
"by_ticket_ids[]": event.tickets,
|
|
35769
36010
|
by_ticket_type: "time_slot",
|
|
35770
36011
|
by_bookable: true,
|
|
35771
|
-
valid_at:
|
|
36012
|
+
valid_at: date.start_time.slice(0, 10)
|
|
35772
36013
|
}));
|
|
35773
36014
|
shop.capacityManager.addQuotas(quotas);
|
|
35774
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets,
|
|
36015
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, date.start_time), date.start_time);
|
|
35775
36016
|
await enrichTicketsWithContent(segment, uiTickets);
|
|
35776
|
-
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time:
|
|
36017
|
+
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: date.start_time }));
|
|
35777
36018
|
}
|
|
35778
|
-
}
|
|
35779
|
-
|
|
35780
|
-
|
|
35781
|
-
|
|
35782
|
-
|
|
35783
|
-
|
|
35784
|
-
|
|
35785
|
-
|
|
35786
|
-
|
|
35787
|
-
|
|
35788
|
-
|
|
35789
|
-
|
|
35790
|
-
|
|
35791
|
-
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35795
|
-
|
|
35796
|
-
|
|
35797
|
-
|
|
35798
|
-
|
|
36019
|
+
}
|
|
36020
|
+
};
|
|
36021
|
+
//#endregion
|
|
36022
|
+
//#region src/components/ticketSelection/filters/events/price.ts
|
|
36023
|
+
var filter$2 = {
|
|
36024
|
+
name: "events:price",
|
|
36025
|
+
calendarEndpoint: "events",
|
|
36026
|
+
requires: [{
|
|
36027
|
+
kind: "tsd",
|
|
36028
|
+
field: "selectedDate"
|
|
36029
|
+
}, {
|
|
36030
|
+
kind: "tsd",
|
|
36031
|
+
field: "selectedTimeslot"
|
|
36032
|
+
}],
|
|
36033
|
+
isCalendarVisible: () => true,
|
|
36034
|
+
isTimeslotsVisible: () => true,
|
|
36035
|
+
isTicketsVisible: () => true,
|
|
36036
|
+
loadTimeslots: (tsd) => loadEventsTimeslots(tsd),
|
|
36037
|
+
async loadProducts(segment) {
|
|
36038
|
+
const tsd = segment.ticketSelectionDetails;
|
|
36039
|
+
if (!tsd?.selectedDate || !tsd.selectedTime) return;
|
|
36040
|
+
const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({
|
|
36041
|
+
by_bookable: true,
|
|
36042
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
36043
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
36044
|
+
"by_event_ids[]": tsd.eventIds,
|
|
36045
|
+
"by_language_ids[]": segment.languageIds,
|
|
36046
|
+
"by_catch_word_ids[]": segment.catchWordIds,
|
|
36047
|
+
start_at: tsd.selectedDate.toString(),
|
|
36048
|
+
per_page: segment.limit || 30
|
|
36049
|
+
})), tsd.selectedDate.toString(), tsd.selectedTime);
|
|
36050
|
+
const query = segment.query;
|
|
36051
|
+
for (const date of dates) {
|
|
36052
|
+
if (!date.prices?.length) continue;
|
|
36053
|
+
const prices = query ? date.prices.filter((p) => p.title?.includes(query)) : date.prices;
|
|
36054
|
+
for (const price of prices) {
|
|
35799
36055
|
const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title });
|
|
35800
36056
|
segment.preCart.addItem(createCartItem(ticket, { time: date.start_time }));
|
|
35801
36057
|
}
|
|
35802
36058
|
if (date.seats) shop.capacityManager.addSeats(date.id, date.seats);
|
|
35803
36059
|
}
|
|
35804
|
-
}
|
|
35805
|
-
|
|
35806
|
-
|
|
35807
|
-
|
|
35808
|
-
|
|
35809
|
-
|
|
35810
|
-
|
|
35811
|
-
|
|
35812
|
-
|
|
35813
|
-
|
|
35814
|
-
|
|
35815
|
-
|
|
35816
|
-
|
|
35817
|
-
|
|
35818
|
-
|
|
35819
|
-
|
|
35820
|
-
|
|
35821
|
-
|
|
35822
|
-
|
|
35823
|
-
|
|
35824
|
-
|
|
35825
|
-
|
|
35826
|
-
|
|
35827
|
-
|
|
35828
|
-
|
|
35829
|
-
|
|
35830
|
-
|
|
35831
|
-
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35835
|
-
|
|
35836
|
-
|
|
35837
|
-
|
|
35838
|
-
|
|
35839
|
-
|
|
35840
|
-
|
|
35841
|
-
|
|
35842
|
-
|
|
35843
|
-
|
|
35844
|
-
|
|
35845
|
-
|
|
35846
|
-
|
|
35847
|
-
|
|
35848
|
-
"events:admission:day":
|
|
35849
|
-
|
|
35850
|
-
|
|
35851
|
-
|
|
35852
|
-
|
|
35853
|
-
|
|
35854
|
-
}, {
|
|
35855
|
-
kind: "tsd",
|
|
35856
|
-
field: "selectedTimeslot"
|
|
35857
|
-
}],
|
|
35858
|
-
isCalendarVisible: () => true,
|
|
35859
|
-
isTimeslotsVisible: () => true,
|
|
35860
|
-
isTicketsVisible: () => true,
|
|
35861
|
-
loadTimeslots: (tsd) => loadEventsTimeslots(tsd),
|
|
35862
|
-
async loadProducts(segment) {
|
|
35863
|
-
const tsd = segment.ticketSelectionDetails;
|
|
35864
|
-
if (!tsd?.selectedDate || !tsd.selectedTime) return;
|
|
35865
|
-
const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({
|
|
35866
|
-
by_bookable: true,
|
|
35867
|
-
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35868
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35869
|
-
"by_event_ids[]": tsd.eventIds,
|
|
35870
|
-
"by_language_ids[]": segment.languageIds,
|
|
35871
|
-
"by_catch_word_ids[]": segment.catchWordIds,
|
|
35872
|
-
start_at: tsd.selectedDate.toString(),
|
|
35873
|
-
per_page: segment.limit || 30
|
|
35874
|
-
})), tsd.selectedDate.toString(), tsd.selectedTime);
|
|
35875
|
-
for (const date of dates) {
|
|
35876
|
-
if (!date.event_id || !date.start_time) continue;
|
|
35877
|
-
const event = await shop.asyncFetch(() => shop.getEvent(date.event_id));
|
|
35878
|
-
if (!event?.tickets?.length) continue;
|
|
35879
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35880
|
-
"by_ticket_ids[]": event.tickets,
|
|
35881
|
-
"by_ticket_types[]": ["normal"],
|
|
35882
|
-
by_bookable: true,
|
|
35883
|
-
valid_at: date.start_time.slice(0, 10)
|
|
35884
|
-
}));
|
|
35885
|
-
shop.capacityManager.addQuotas(quotas);
|
|
35886
|
-
const uiTickets = initUIDayTickets(tickets, date.start_time);
|
|
35887
|
-
await enrichTicketsWithContent(segment, uiTickets);
|
|
35888
|
-
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: t.selectedTime }));
|
|
35889
|
-
}
|
|
35890
|
-
}
|
|
35891
|
-
},
|
|
35892
|
-
"events:admission:timeslot": {
|
|
35893
|
-
name: "events:admission:timeslot",
|
|
35894
|
-
calendarEndpoint: "events",
|
|
35895
|
-
requires: [{
|
|
35896
|
-
kind: "tsd",
|
|
35897
|
-
field: "selectedDate"
|
|
35898
|
-
}, {
|
|
35899
|
-
kind: "tsd",
|
|
35900
|
-
field: "selectedTimeslot"
|
|
35901
|
-
}],
|
|
35902
|
-
isCalendarVisible: () => true,
|
|
35903
|
-
isTimeslotsVisible: () => true,
|
|
35904
|
-
isTicketsVisible: () => true,
|
|
35905
|
-
loadTimeslots: (tsd) => loadEventsTimeslots(tsd),
|
|
35906
|
-
async loadProducts(segment) {
|
|
35907
|
-
const tsd = segment.ticketSelectionDetails;
|
|
35908
|
-
if (!tsd?.selectedDate || !tsd.selectedTime) return;
|
|
35909
|
-
const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({
|
|
35910
|
-
by_bookable: true,
|
|
35911
|
-
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35912
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35913
|
-
"by_event_ids[]": tsd.eventIds,
|
|
35914
|
-
"by_language_ids[]": segment.languageIds,
|
|
35915
|
-
"by_catch_word_ids[]": segment.catchWordIds,
|
|
35916
|
-
start_at: tsd.selectedDate.toString(),
|
|
35917
|
-
per_page: segment.limit || 30
|
|
35918
|
-
})), tsd.selectedDate.toString(), tsd.selectedTime);
|
|
35919
|
-
for (const date of dates) {
|
|
35920
|
-
if (!date.event_id || !date.start_time) continue;
|
|
35921
|
-
const event = await shop.asyncFetch(() => shop.getEvent(date.event_id));
|
|
35922
|
-
if (!event?.tickets?.length) continue;
|
|
35923
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
35924
|
-
"by_ticket_ids[]": event.tickets,
|
|
35925
|
-
by_ticket_type: "time_slot",
|
|
35926
|
-
by_bookable: true,
|
|
35927
|
-
valid_at: date.start_time.slice(0, 10)
|
|
35928
|
-
}));
|
|
35929
|
-
shop.capacityManager.addQuotas(quotas);
|
|
35930
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, date.start_time), date.start_time);
|
|
35931
|
-
await enrichTicketsWithContent(segment, uiTickets);
|
|
35932
|
-
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: date.start_time }));
|
|
35933
|
-
}
|
|
35934
|
-
}
|
|
35935
|
-
},
|
|
35936
|
-
"events:price": {
|
|
35937
|
-
name: "events:price",
|
|
35938
|
-
calendarEndpoint: "events",
|
|
35939
|
-
requires: [{
|
|
35940
|
-
kind: "tsd",
|
|
35941
|
-
field: "selectedDate"
|
|
35942
|
-
}, {
|
|
35943
|
-
kind: "tsd",
|
|
35944
|
-
field: "selectedTimeslot"
|
|
35945
|
-
}],
|
|
35946
|
-
isCalendarVisible: () => true,
|
|
35947
|
-
isTimeslotsVisible: () => true,
|
|
35948
|
-
isTicketsVisible: () => true,
|
|
35949
|
-
loadTimeslots: (tsd) => loadEventsTimeslots(tsd),
|
|
35950
|
-
async loadProducts(segment) {
|
|
35951
|
-
const tsd = segment.ticketSelectionDetails;
|
|
35952
|
-
if (!tsd?.selectedDate || !tsd.selectedTime) return;
|
|
35953
|
-
const dates = filterDatesInWindow(await shop.asyncFetch(() => shop.getDates({
|
|
35954
|
-
by_bookable: true,
|
|
35955
|
-
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
35956
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
35957
|
-
"by_event_ids[]": tsd.eventIds,
|
|
35958
|
-
"by_language_ids[]": segment.languageIds,
|
|
35959
|
-
"by_catch_word_ids[]": segment.catchWordIds,
|
|
35960
|
-
start_at: tsd.selectedDate.toString(),
|
|
35961
|
-
per_page: segment.limit || 30
|
|
35962
|
-
})), tsd.selectedDate.toString(), tsd.selectedTime);
|
|
35963
|
-
const query = segment.query;
|
|
35964
|
-
for (const date of dates) {
|
|
35965
|
-
if (!date.prices?.length) continue;
|
|
35966
|
-
const prices = query ? date.prices.filter((p) => p.title?.includes(query)) : date.prices;
|
|
35967
|
-
for (const price of prices) {
|
|
35968
|
-
const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title });
|
|
35969
|
-
segment.preCart.addItem(createCartItem(ticket, { time: date.start_time }));
|
|
35970
|
-
}
|
|
35971
|
-
if (date.seats) shop.capacityManager.addSeats(date.id, date.seats);
|
|
35972
|
-
}
|
|
35973
|
-
}
|
|
35974
|
-
},
|
|
35975
|
-
coupon: {
|
|
35976
|
-
name: "coupon",
|
|
36060
|
+
}
|
|
36061
|
+
};
|
|
36062
|
+
//#endregion
|
|
36063
|
+
//#region src/components/ticketSelection/filters/coupon.ts
|
|
36064
|
+
/**
|
|
36065
|
+
* `coupon` — sells the shop's purchasable coupons (German "Wertgutschein" /
|
|
36066
|
+
* gift card). Coupons are fixed-value, standalone products:
|
|
36067
|
+
* no calendar, no timeslots, no capacity. They are always listed, like a
|
|
36068
|
+
* shelf of products.
|
|
36069
|
+
*/
|
|
36070
|
+
var filter$1 = {
|
|
36071
|
+
name: "coupon",
|
|
36072
|
+
calendarEndpoint: null,
|
|
36073
|
+
requires: [],
|
|
36074
|
+
isCalendarVisible: () => false,
|
|
36075
|
+
isTimeslotsVisible: () => false,
|
|
36076
|
+
isTicketsVisible: () => true,
|
|
36077
|
+
loadTimeslots: async () => {},
|
|
36078
|
+
async loadProducts(segment) {
|
|
36079
|
+
const coupons = await shop.asyncFetch(() => shop.getCoupons());
|
|
36080
|
+
for (const coupon of coupons ?? []) segment.preCart.addItem(createCartItem(createUICoupon(coupon)));
|
|
36081
|
+
}
|
|
36082
|
+
};
|
|
36083
|
+
//#endregion
|
|
36084
|
+
//#region src/components/ticketSelection/filters/tour.ts
|
|
36085
|
+
var REQUIRED = [
|
|
36086
|
+
"id",
|
|
36087
|
+
"time",
|
|
36088
|
+
"participants",
|
|
36089
|
+
"languageId",
|
|
36090
|
+
"totalPriceCents",
|
|
36091
|
+
"title"
|
|
36092
|
+
];
|
|
36093
|
+
//#endregion
|
|
36094
|
+
//#region src/components/ticketSelection/filters/registry.ts
|
|
36095
|
+
var REGISTRY = {
|
|
36096
|
+
"ticket:timeslot": filter$12,
|
|
36097
|
+
"ticket:day": filter$11,
|
|
36098
|
+
"ticket:annual": filter$10,
|
|
36099
|
+
"event:admission": filter$9,
|
|
36100
|
+
"event:admission:day": filter$8,
|
|
36101
|
+
"event:admission:timeslot": filter$7,
|
|
36102
|
+
"event:price": filter$6,
|
|
36103
|
+
"events:admission": filter$5,
|
|
36104
|
+
"events:admission:day": filter$4,
|
|
36105
|
+
"events:admission:timeslot": filter$3,
|
|
36106
|
+
"events:price": filter$2,
|
|
36107
|
+
coupon: filter$1,
|
|
36108
|
+
tour: {
|
|
36109
|
+
name: "tour",
|
|
35977
36110
|
calendarEndpoint: null,
|
|
35978
36111
|
requires: [],
|
|
35979
36112
|
isCalendarVisible: () => false,
|
|
35980
36113
|
isTimeslotsVisible: () => false,
|
|
35981
36114
|
isTicketsVisible: () => true,
|
|
35982
|
-
|
|
35983
|
-
async loadProducts(
|
|
35984
|
-
|
|
35985
|
-
|
|
36115
|
+
async loadTimeslots() {},
|
|
36116
|
+
async loadProducts() {},
|
|
36117
|
+
/**
|
|
36118
|
+
* Adds a group-tour booking and returns the cart line's uuid. Every call
|
|
36119
|
+
* appends a NEW line — identical bookings coexist; use the uuid to dedupe or
|
|
36120
|
+
* remove. Tours are not priced by the shop API: `totalPriceCents` is the
|
|
36121
|
+
* integrator-supplied total (incl. mandatory surcharges), verified by the
|
|
36122
|
+
* backend only at checkout.
|
|
36123
|
+
*/
|
|
36124
|
+
async addToCart(options) {
|
|
36125
|
+
const o = options;
|
|
36126
|
+
for (const key of REQUIRED) if (o[key] == null || o[key] === "") throw new Error(`(go.cart.addItem) tour '${key}' is required`);
|
|
36127
|
+
if (!(o.participants > 0)) throw new Error(`(go.cart.addItem) tour 'participants' must be a positive number`);
|
|
36128
|
+
if (o.quantities) {
|
|
36129
|
+
const quantitiesSum = sum(Object.values(o.quantities));
|
|
36130
|
+
if (quantitiesSum !== o.participants) throw new Error(`(go.cart.addItem) tour 'quantities' must sum to 'participants' (${quantitiesSum} !== ${o.participants})`);
|
|
36131
|
+
}
|
|
36132
|
+
const { time, ...attributes } = o;
|
|
36133
|
+
const item = createCartItem(createUITour(attributes), {
|
|
36134
|
+
quantity: 1,
|
|
36135
|
+
time
|
|
36136
|
+
});
|
|
36137
|
+
shop.cart.addItem(item);
|
|
36138
|
+
return item.uuid;
|
|
35986
36139
|
}
|
|
35987
36140
|
}
|
|
35988
36141
|
};
|
|
@@ -38505,41 +38658,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
38505
38658
|
} }, [], []));
|
|
38506
38659
|
//#endregion
|
|
38507
38660
|
//#region src/go/cart.ts
|
|
38508
|
-
|
|
38509
|
-
|
|
38510
|
-
|
|
38511
|
-
"
|
|
38512
|
-
|
|
38513
|
-
|
|
38514
|
-
|
|
38515
|
-
];
|
|
38516
|
-
function validate(options) {
|
|
38517
|
-
for (const key of REQUIRED) if (options[key] == null || options[key] === "") throw new Error(`(go.cart.addTour) '${key}' is required`);
|
|
38518
|
-
if (!(options.participants > 0)) throw new Error(`(go.cart.addTour) 'participants' must be a positive number`);
|
|
38519
|
-
if (options.quantities) {
|
|
38520
|
-
const quantitiesSum = sum(Object.values(options.quantities));
|
|
38521
|
-
if (quantitiesSum !== options.participants) throw new Error(`(go.cart.addTour) 'quantities' must sum to 'participants' (${quantitiesSum} !== ${options.participants})`);
|
|
38522
|
-
}
|
|
38523
|
-
}
|
|
38524
|
-
/**
|
|
38525
|
-
* Adds a group-tour booking to the cart and resolves with the cart line's
|
|
38526
|
-
* uuid. Every call appends a NEW line — identical bookings coexist; use the
|
|
38527
|
-
* returned uuid to deduplicate or remove.
|
|
38528
|
-
*
|
|
38529
|
-
* Tours are not priced by the shop API: `totalPriceCents` is the
|
|
38530
|
-
* integrator-supplied booking total (incl. mandatory surcharges) and is
|
|
38531
|
-
* verified by the backend only at checkout.
|
|
38532
|
-
*/
|
|
38533
|
-
async function addTour(options) {
|
|
38534
|
-
validate(options);
|
|
38535
|
-
if (!shop.cart) throw new Error("(go.cart.addTour) shop not initialized — call go.init first");
|
|
38536
|
-
const { time, ...attributes } = options;
|
|
38537
|
-
const item = createCartItem(createUITour(attributes), {
|
|
38538
|
-
quantity: 1,
|
|
38539
|
-
time
|
|
38540
|
-
});
|
|
38541
|
-
shop.cart.addItem(item);
|
|
38542
|
-
return item.uuid;
|
|
38661
|
+
/** Resolves with the new cart line's uuid. Throws if the filter can't add to
|
|
38662
|
+
* the cart, or on the filter's own validation / availability errors. */
|
|
38663
|
+
async function addItem({ filter, ...options }) {
|
|
38664
|
+
if (!shop.cart) throw new Error("(go.cart.addItem) shop not initialized — call go.init first");
|
|
38665
|
+
const module = getFilter(filter);
|
|
38666
|
+
if (!module?.addToCart) throw new Error(`(go.cart.addItem) filter '${filter}' cannot add to the cart`);
|
|
38667
|
+
return module.addToCart(options);
|
|
38543
38668
|
}
|
|
38544
38669
|
//#endregion
|
|
38545
38670
|
//#region src/go/go.ts
|
|
@@ -38598,9 +38723,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
38598
38723
|
return shop.asyncFetch(() => shop.getCustomerMemberships());
|
|
38599
38724
|
}
|
|
38600
38725
|
},
|
|
38601
|
-
cart: {
|
|
38726
|
+
cart: { addItem: async (options) => {
|
|
38602
38727
|
await ensureShopReady();
|
|
38603
|
-
return
|
|
38728
|
+
return addItem(options);
|
|
38604
38729
|
} }
|
|
38605
38730
|
};
|
|
38606
38731
|
(async () => {
|