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