@gomusdev/web-components 3.8.0 → 3.8.2
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 +13 -0
- package/dist-js/gomus-webcomponents.iife.js +260 -265
- package/dist-js/gomus-webcomponents.js +260 -265
- package/dist-js/gomus-webcomponents.min.iife.js +20 -20
- package/dist-js/gomus-webcomponents.min.js +3060 -3052
- package/dist-js/src/components/ticketSelection/TicketSelectionDetails.svelte.d.ts +1 -0
- package/dist-js/src/components/ticketSelection/filters/_helpers.d.ts +9 -1
- package/dist-js/src/lib/models/capacity/CapacityManager.d.ts +1 -1
- package/dist-js/src/lib/models/capacity/calculators/quotaManager/QuotaManager.d.ts +1 -1
- package/dist-js/src/lib/stores/shop.svelte.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.8.2 (2026-06-22)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **ticket-selection:** scope event:admission products to the event's own tickets (AR-02, TC-03, TC-08)
|
|
8
|
+
|
|
9
|
+
## 3.8.1 (2026-06-22)
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **ticket-selection:** isolate timeslot picker from foreign-segment quotas
|
|
14
|
+
* **ticket-selection:** scope timeslot picker to the selection's own tickets (TC-01)
|
|
15
|
+
|
|
3
16
|
## 3.8.0 (2026-06-22)
|
|
4
17
|
|
|
5
18
|
### Features
|
|
@@ -12000,8 +12000,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
12000
12000
|
ticketId
|
|
12001
12001
|
}).map((x) => x.totalCapacity)) ?? 0;
|
|
12002
12002
|
},
|
|
12003
|
-
timeslotsOn(date) {
|
|
12004
|
-
|
|
12003
|
+
timeslotsOn(date, ticketIds) {
|
|
12004
|
+
let rows = this.timeslots().filter((x) => x.timeSlot.startsWith(date.toString()));
|
|
12005
|
+
if (ticketIds) rows = rows.filter((x) => x.tickets.some((t) => ticketIds.includes(t)));
|
|
12006
|
+
const bySlot = group(rows, (r) => r.timeSlot);
|
|
12005
12007
|
return Object.values(bySlot).map((slotRows) => {
|
|
12006
12008
|
return max$2(unique(slotRows.flatMap((r) => r.tickets)).map((t) => min$2(slotRows.filter((r) => r.tickets.includes(t)), (r) => r.capacity)).filter((r) => r !== null), (r) => r.capacity) ?? slotRows[0];
|
|
12007
12009
|
}).sort((a, b) => a.timeSlot.localeCompare(b.timeSlot));
|
|
@@ -32424,262 +32426,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32424
32426
|
"coupon"
|
|
32425
32427
|
];
|
|
32426
32428
|
//#endregion
|
|
32427
|
-
//#region src/components/ticketSelection/filters/ticket/timeslot.ts
|
|
32428
|
-
var filter$11 = {
|
|
32429
|
-
name: "ticket:timeslot",
|
|
32430
|
-
calendarEndpoint: "tickets",
|
|
32431
|
-
apiToken: "time_slot",
|
|
32432
|
-
requires: [{
|
|
32433
|
-
kind: "tsd",
|
|
32434
|
-
field: "selectedDate"
|
|
32435
|
-
}, {
|
|
32436
|
-
kind: "tsd",
|
|
32437
|
-
field: "selectedTimeslot"
|
|
32438
|
-
}],
|
|
32439
|
-
isCalendarVisible: () => true,
|
|
32440
|
-
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32441
|
-
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
32442
|
-
async loadTimeslots(tsd) {
|
|
32443
|
-
if (!tsd?.selectedDate) return;
|
|
32444
|
-
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32445
|
-
by_bookable: true,
|
|
32446
|
-
valid_at: tsd.selectedDate.toString(),
|
|
32447
|
-
by_ticket_type: "time_slot",
|
|
32448
|
-
"by_museum_ids[]": tsd.museumIds,
|
|
32449
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
32450
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
32451
|
-
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
32452
|
-
}));
|
|
32453
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32454
|
-
},
|
|
32455
|
-
async loadProducts(segment) {
|
|
32456
|
-
const tsd = segment.ticketSelectionDetails;
|
|
32457
|
-
if (!tsd?.selectedDate || !tsd.selectedTimeslot) return;
|
|
32458
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32459
|
-
by_bookable: true,
|
|
32460
|
-
valid_at: tsd.selectedDate.toString(),
|
|
32461
|
-
by_ticket_type: "time_slot",
|
|
32462
|
-
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
32463
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
32464
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
32465
|
-
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
32466
|
-
}));
|
|
32467
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32468
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32469
|
-
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
32470
|
-
}
|
|
32471
|
-
};
|
|
32472
|
-
//#endregion
|
|
32473
|
-
//#region src/components/ticketSelection/filters/ticket/day.ts
|
|
32474
|
-
var filter$10 = {
|
|
32475
|
-
name: "ticket:day",
|
|
32476
|
-
calendarEndpoint: "tickets",
|
|
32477
|
-
apiToken: "normal",
|
|
32478
|
-
requires: [{
|
|
32479
|
-
kind: "tsd",
|
|
32480
|
-
field: "selectedDate"
|
|
32481
|
-
}],
|
|
32482
|
-
isCalendarVisible: () => true,
|
|
32483
|
-
isTimeslotsVisible: () => false,
|
|
32484
|
-
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32485
|
-
async loadTimeslots() {},
|
|
32486
|
-
async loadProducts(segment) {
|
|
32487
|
-
const tsd = segment.ticketSelectionDetails;
|
|
32488
|
-
if (!tsd?.selectedDate) return;
|
|
32489
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32490
|
-
by_bookable: true,
|
|
32491
|
-
valid_at: tsd.selectedDate.toString(),
|
|
32492
|
-
"by_ticket_types[]": ["normal"],
|
|
32493
|
-
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
32494
|
-
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
32495
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
32496
|
-
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
32497
|
-
}));
|
|
32498
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32499
|
-
const firstQuota = Object.values(quotas)[0];
|
|
32500
|
-
const timeslot = firstQuota ? Object.keys(firstQuota.capacities)[0] : void 0;
|
|
32501
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, timeslot), timeslot);
|
|
32502
|
-
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: timeslot }));
|
|
32503
|
-
}
|
|
32504
|
-
};
|
|
32505
|
-
//#endregion
|
|
32506
|
-
//#region src/components/ticketSelection/filters/ticket/annual.ts
|
|
32507
|
-
var filter$9 = {
|
|
32508
|
-
name: "ticket:annual",
|
|
32509
|
-
calendarEndpoint: null,
|
|
32510
|
-
apiToken: "annual",
|
|
32511
|
-
requires: [],
|
|
32512
|
-
isCalendarVisible: () => false,
|
|
32513
|
-
isTimeslotsVisible: () => false,
|
|
32514
|
-
isTicketsVisible: () => true,
|
|
32515
|
-
async loadTimeslots() {},
|
|
32516
|
-
async loadProducts(segment) {
|
|
32517
|
-
const tsd = segment.ticketSelectionDetails;
|
|
32518
|
-
if (!tsd) return;
|
|
32519
|
-
const tickets = await shop.asyncFetch(() => shop.tickets({
|
|
32520
|
-
by_bookable: true,
|
|
32521
|
-
"by_ticket_types[]": ["annual"],
|
|
32522
|
-
"by_ticket_ids[]": tsd.ticketIds,
|
|
32523
|
-
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
32524
|
-
}));
|
|
32525
|
-
for (const t of Object.values(tickets)) segment.preCart.addItem(createCartItem(createUITicket(t)));
|
|
32526
|
-
}
|
|
32527
|
-
};
|
|
32528
|
-
//#endregion
|
|
32529
|
-
//#region src/components/ticketSelection/filters/event/admission.ts
|
|
32530
|
-
var filter$8 = {
|
|
32531
|
-
name: "event:admission",
|
|
32532
|
-
calendarEndpoint: "events",
|
|
32533
|
-
requires: [{
|
|
32534
|
-
kind: "tsd",
|
|
32535
|
-
field: "eventIds"
|
|
32536
|
-
}, {
|
|
32537
|
-
kind: "tsd",
|
|
32538
|
-
field: "selectedDate"
|
|
32539
|
-
}],
|
|
32540
|
-
isCalendarVisible: () => true,
|
|
32541
|
-
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32542
|
-
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
32543
|
-
async loadTimeslots(tsd) {
|
|
32544
|
-
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32545
|
-
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32546
|
-
if (!event.tickets?.length) return;
|
|
32547
|
-
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32548
|
-
"by_ticket_ids[]": event.tickets,
|
|
32549
|
-
by_bookable: true,
|
|
32550
|
-
valid_at: tsd.selectedDate.toString()
|
|
32551
|
-
}));
|
|
32552
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32553
|
-
},
|
|
32554
|
-
async loadProducts(segment) {
|
|
32555
|
-
const tsd = segment.ticketSelectionDetails;
|
|
32556
|
-
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32557
|
-
if (!(await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]))).tickets?.length) return;
|
|
32558
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32559
|
-
by_bookable: true,
|
|
32560
|
-
valid_at: tsd.selectedDate.toString(),
|
|
32561
|
-
date_id: segment.dateId
|
|
32562
|
-
}));
|
|
32563
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32564
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32565
|
-
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
32566
|
-
}
|
|
32567
|
-
};
|
|
32568
|
-
//#endregion
|
|
32569
|
-
//#region src/components/ticketSelection/filters/event/admission-day.ts
|
|
32570
|
-
var filter$7 = {
|
|
32571
|
-
name: "event:admission:day",
|
|
32572
|
-
calendarEndpoint: "events",
|
|
32573
|
-
requires: [{
|
|
32574
|
-
kind: "tsd",
|
|
32575
|
-
field: "eventIds"
|
|
32576
|
-
}, {
|
|
32577
|
-
kind: "tsd",
|
|
32578
|
-
field: "selectedDate"
|
|
32579
|
-
}],
|
|
32580
|
-
isCalendarVisible: () => true,
|
|
32581
|
-
isTimeslotsVisible: () => false,
|
|
32582
|
-
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32583
|
-
async loadTimeslots() {},
|
|
32584
|
-
async loadProducts(segment) {
|
|
32585
|
-
const tsd = segment.ticketSelectionDetails;
|
|
32586
|
-
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32587
|
-
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32588
|
-
if (!event.tickets?.length) return;
|
|
32589
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32590
|
-
"by_ticket_ids[]": event.tickets,
|
|
32591
|
-
"by_ticket_types[]": ["normal"],
|
|
32592
|
-
by_bookable: true,
|
|
32593
|
-
valid_at: tsd.selectedDate.toString()
|
|
32594
|
-
}));
|
|
32595
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32596
|
-
const firstQuota = Object.values(quotas)[0];
|
|
32597
|
-
const time = firstQuota ? Object.keys(firstQuota.capacities)[0] : void 0;
|
|
32598
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, time), time);
|
|
32599
|
-
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time }));
|
|
32600
|
-
}
|
|
32601
|
-
};
|
|
32602
|
-
//#endregion
|
|
32603
|
-
//#region src/components/ticketSelection/filters/event/admission-timeslot.ts
|
|
32604
|
-
var filter$6 = {
|
|
32605
|
-
name: "event:admission:timeslot",
|
|
32606
|
-
calendarEndpoint: "events",
|
|
32607
|
-
requires: [
|
|
32608
|
-
{
|
|
32609
|
-
kind: "tsd",
|
|
32610
|
-
field: "eventIds"
|
|
32611
|
-
},
|
|
32612
|
-
{
|
|
32613
|
-
kind: "tsd",
|
|
32614
|
-
field: "selectedDate"
|
|
32615
|
-
},
|
|
32616
|
-
{
|
|
32617
|
-
kind: "tsd",
|
|
32618
|
-
field: "selectedTimeslot"
|
|
32619
|
-
}
|
|
32620
|
-
],
|
|
32621
|
-
isCalendarVisible: () => true,
|
|
32622
|
-
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32623
|
-
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
32624
|
-
async loadTimeslots(tsd) {
|
|
32625
|
-
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32626
|
-
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32627
|
-
if (!event.tickets?.length) return;
|
|
32628
|
-
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32629
|
-
"by_ticket_ids[]": event.tickets,
|
|
32630
|
-
by_ticket_type: "time_slot",
|
|
32631
|
-
by_bookable: true,
|
|
32632
|
-
valid_at: tsd.selectedDate.toString()
|
|
32633
|
-
}));
|
|
32634
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32635
|
-
},
|
|
32636
|
-
async loadProducts(segment) {
|
|
32637
|
-
const tsd = segment.ticketSelectionDetails;
|
|
32638
|
-
if (!tsd?.eventIds?.length || !tsd.selectedDate || !tsd.selectedTimeslot) return;
|
|
32639
|
-
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32640
|
-
if (!event.tickets?.length) return;
|
|
32641
|
-
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32642
|
-
"by_ticket_ids[]": event.tickets,
|
|
32643
|
-
by_ticket_type: "time_slot",
|
|
32644
|
-
by_bookable: true,
|
|
32645
|
-
valid_at: tsd.selectedDate.toString()
|
|
32646
|
-
}));
|
|
32647
|
-
shop.capacityManager.addQuotas(quotas);
|
|
32648
|
-
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32649
|
-
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: tsd.selectedTime }));
|
|
32650
|
-
}
|
|
32651
|
-
};
|
|
32652
|
-
//#endregion
|
|
32653
|
-
//#region src/components/ticketSelection/filters/event/price.ts
|
|
32654
|
-
var filter$5 = {
|
|
32655
|
-
name: "event:price",
|
|
32656
|
-
calendarEndpoint: "events",
|
|
32657
|
-
requires: [{
|
|
32658
|
-
kind: "tsd",
|
|
32659
|
-
field: "eventIds"
|
|
32660
|
-
}, {
|
|
32661
|
-
kind: "segment",
|
|
32662
|
-
field: "dateId"
|
|
32663
|
-
}],
|
|
32664
|
-
isCalendarVisible: () => false,
|
|
32665
|
-
isTimeslotsVisible: () => false,
|
|
32666
|
-
isTicketsVisible: (tsd) => Boolean(tsd.eventIds?.length),
|
|
32667
|
-
loadTimeslots: async () => {},
|
|
32668
|
-
async loadProducts(segment) {
|
|
32669
|
-
const tsd = segment.ticketSelectionDetails;
|
|
32670
|
-
if (!tsd?.eventIds?.length || segment.dateId === void 0) return;
|
|
32671
|
-
const date = await shop.asyncFetch(() => shop.getEventDetailsOnDate(tsd.eventIds[0], segment.dateId));
|
|
32672
|
-
if (!date.prices?.length) return;
|
|
32673
|
-
for (const price of date.prices) {
|
|
32674
|
-
const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title });
|
|
32675
|
-
segment.preCart.addItem(createCartItem(ticket, { time: date.start_time }));
|
|
32676
|
-
}
|
|
32677
|
-
if (date.seats) shop.capacityManager.addSeats(date.id, date.seats);
|
|
32678
|
-
}
|
|
32679
|
-
};
|
|
32680
|
-
//#endregion
|
|
32681
32429
|
//#region src/components/ticketSelection/filters/_helpers.ts
|
|
32682
32430
|
var TWO_HOURS_MS = 7200 * 1e3;
|
|
32431
|
+
/**
|
|
32432
|
+
* Load quotas fetched by a filter's loadTimeslots into the shared quota store and
|
|
32433
|
+
* record which ticket ids this selection loaded for its picker. timeslotsOn() reads
|
|
32434
|
+
* tsd.timeslotTicketIds, so only these tickets' slots render — a foreign
|
|
32435
|
+
* segment/selection sharing the store can't leak in. Appends, so multiple active
|
|
32436
|
+
* filters accumulate within one render pass (<go-timeslots> resets the list first).
|
|
32437
|
+
*/
|
|
32438
|
+
function loadPickerQuotas(tsd, quotas) {
|
|
32439
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32440
|
+
tsd.timeslotTicketIds = [...tsd.timeslotTicketIds, ...Object.values(quotas).flatMap((q) => q.ticket_ids)];
|
|
32441
|
+
}
|
|
32683
32442
|
function filterDatesInWindow(dates, selectedDate, selectedTime) {
|
|
32684
32443
|
const selectedMs = Date.parse(selectedTime);
|
|
32685
32444
|
return dates.filter((d) => {
|
|
@@ -32699,18 +32458,252 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32699
32458
|
"by_ticket_ids[]": tsd.ticketIds,
|
|
32700
32459
|
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
32701
32460
|
}));
|
|
32702
|
-
|
|
32461
|
+
loadPickerQuotas(tsd, quotas);
|
|
32703
32462
|
}
|
|
32704
32463
|
//#endregion
|
|
32705
32464
|
//#region src/components/ticketSelection/filters/registry.ts
|
|
32706
32465
|
var REGISTRY = {
|
|
32707
|
-
"ticket:timeslot":
|
|
32708
|
-
|
|
32709
|
-
|
|
32710
|
-
|
|
32711
|
-
|
|
32712
|
-
|
|
32713
|
-
|
|
32466
|
+
"ticket:timeslot": {
|
|
32467
|
+
name: "ticket:timeslot",
|
|
32468
|
+
calendarEndpoint: "tickets",
|
|
32469
|
+
apiToken: "time_slot",
|
|
32470
|
+
requires: [{
|
|
32471
|
+
kind: "tsd",
|
|
32472
|
+
field: "selectedDate"
|
|
32473
|
+
}, {
|
|
32474
|
+
kind: "tsd",
|
|
32475
|
+
field: "selectedTimeslot"
|
|
32476
|
+
}],
|
|
32477
|
+
isCalendarVisible: () => true,
|
|
32478
|
+
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32479
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
32480
|
+
async loadTimeslots(tsd) {
|
|
32481
|
+
if (!tsd?.selectedDate) return;
|
|
32482
|
+
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32483
|
+
by_bookable: true,
|
|
32484
|
+
valid_at: tsd.selectedDate.toString(),
|
|
32485
|
+
by_ticket_type: "time_slot",
|
|
32486
|
+
"by_museum_ids[]": tsd.museumIds,
|
|
32487
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
32488
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
32489
|
+
"by_ticket_group_ids[]": tsd.ticketGroupIds
|
|
32490
|
+
}));
|
|
32491
|
+
loadPickerQuotas(tsd, quotas);
|
|
32492
|
+
},
|
|
32493
|
+
async loadProducts(segment) {
|
|
32494
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32495
|
+
if (!tsd?.selectedDate || !tsd.selectedTimeslot) return;
|
|
32496
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32497
|
+
by_bookable: true,
|
|
32498
|
+
valid_at: tsd.selectedDate.toString(),
|
|
32499
|
+
by_ticket_type: "time_slot",
|
|
32500
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
32501
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
32502
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
32503
|
+
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
32504
|
+
}));
|
|
32505
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32506
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32507
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
32508
|
+
}
|
|
32509
|
+
},
|
|
32510
|
+
"ticket:day": {
|
|
32511
|
+
name: "ticket:day",
|
|
32512
|
+
calendarEndpoint: "tickets",
|
|
32513
|
+
apiToken: "normal",
|
|
32514
|
+
requires: [{
|
|
32515
|
+
kind: "tsd",
|
|
32516
|
+
field: "selectedDate"
|
|
32517
|
+
}],
|
|
32518
|
+
isCalendarVisible: () => true,
|
|
32519
|
+
isTimeslotsVisible: () => false,
|
|
32520
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32521
|
+
async loadTimeslots() {},
|
|
32522
|
+
async loadProducts(segment) {
|
|
32523
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32524
|
+
if (!tsd?.selectedDate) return;
|
|
32525
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32526
|
+
by_bookable: true,
|
|
32527
|
+
valid_at: tsd.selectedDate.toString(),
|
|
32528
|
+
"by_ticket_types[]": ["normal"],
|
|
32529
|
+
"by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
|
|
32530
|
+
"by_exhibition_ids[]": tsd.exhibitionIds,
|
|
32531
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
32532
|
+
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
32533
|
+
}));
|
|
32534
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32535
|
+
const firstQuota = Object.values(quotas)[0];
|
|
32536
|
+
const timeslot = firstQuota ? Object.keys(firstQuota.capacities)[0] : void 0;
|
|
32537
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, timeslot), timeslot);
|
|
32538
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: timeslot }));
|
|
32539
|
+
}
|
|
32540
|
+
},
|
|
32541
|
+
"ticket:annual": {
|
|
32542
|
+
name: "ticket:annual",
|
|
32543
|
+
calendarEndpoint: null,
|
|
32544
|
+
apiToken: "annual",
|
|
32545
|
+
requires: [],
|
|
32546
|
+
isCalendarVisible: () => false,
|
|
32547
|
+
isTimeslotsVisible: () => false,
|
|
32548
|
+
isTicketsVisible: () => true,
|
|
32549
|
+
async loadTimeslots() {},
|
|
32550
|
+
async loadProducts(segment) {
|
|
32551
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32552
|
+
if (!tsd) return;
|
|
32553
|
+
const tickets = await shop.asyncFetch(() => shop.tickets({
|
|
32554
|
+
by_bookable: true,
|
|
32555
|
+
"by_ticket_types[]": ["annual"],
|
|
32556
|
+
"by_ticket_ids[]": tsd.ticketIds,
|
|
32557
|
+
"by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
|
|
32558
|
+
}));
|
|
32559
|
+
for (const t of Object.values(tickets)) segment.preCart.addItem(createCartItem(createUITicket(t)));
|
|
32560
|
+
}
|
|
32561
|
+
},
|
|
32562
|
+
"event:admission": {
|
|
32563
|
+
name: "event:admission",
|
|
32564
|
+
calendarEndpoint: "events",
|
|
32565
|
+
requires: [{
|
|
32566
|
+
kind: "tsd",
|
|
32567
|
+
field: "eventIds"
|
|
32568
|
+
}, {
|
|
32569
|
+
kind: "tsd",
|
|
32570
|
+
field: "selectedDate"
|
|
32571
|
+
}],
|
|
32572
|
+
isCalendarVisible: () => true,
|
|
32573
|
+
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32574
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
32575
|
+
async loadTimeslots(tsd) {
|
|
32576
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32577
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32578
|
+
if (!event.tickets?.length) return;
|
|
32579
|
+
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32580
|
+
"by_ticket_ids[]": event.tickets,
|
|
32581
|
+
by_bookable: true,
|
|
32582
|
+
valid_at: tsd.selectedDate.toString()
|
|
32583
|
+
}));
|
|
32584
|
+
loadPickerQuotas(tsd, quotas);
|
|
32585
|
+
},
|
|
32586
|
+
async loadProducts(segment) {
|
|
32587
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32588
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32589
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32590
|
+
if (!event.tickets?.length) return;
|
|
32591
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32592
|
+
"by_ticket_ids[]": event.tickets,
|
|
32593
|
+
by_bookable: true,
|
|
32594
|
+
valid_at: tsd.selectedDate.toString()
|
|
32595
|
+
}));
|
|
32596
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32597
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32598
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
32599
|
+
}
|
|
32600
|
+
},
|
|
32601
|
+
"event:admission:day": {
|
|
32602
|
+
name: "event:admission:day",
|
|
32603
|
+
calendarEndpoint: "events",
|
|
32604
|
+
requires: [{
|
|
32605
|
+
kind: "tsd",
|
|
32606
|
+
field: "eventIds"
|
|
32607
|
+
}, {
|
|
32608
|
+
kind: "tsd",
|
|
32609
|
+
field: "selectedDate"
|
|
32610
|
+
}],
|
|
32611
|
+
isCalendarVisible: () => true,
|
|
32612
|
+
isTimeslotsVisible: () => false,
|
|
32613
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32614
|
+
async loadTimeslots() {},
|
|
32615
|
+
async loadProducts(segment) {
|
|
32616
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32617
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32618
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32619
|
+
if (!event.tickets?.length) return;
|
|
32620
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32621
|
+
"by_ticket_ids[]": event.tickets,
|
|
32622
|
+
"by_ticket_types[]": ["normal"],
|
|
32623
|
+
by_bookable: true,
|
|
32624
|
+
valid_at: tsd.selectedDate.toString()
|
|
32625
|
+
}));
|
|
32626
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32627
|
+
const firstQuota = Object.values(quotas)[0];
|
|
32628
|
+
const time = firstQuota ? Object.keys(firstQuota.capacities)[0] : void 0;
|
|
32629
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, time), time);
|
|
32630
|
+
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time }));
|
|
32631
|
+
}
|
|
32632
|
+
},
|
|
32633
|
+
"event:admission:timeslot": {
|
|
32634
|
+
name: "event:admission:timeslot",
|
|
32635
|
+
calendarEndpoint: "events",
|
|
32636
|
+
requires: [
|
|
32637
|
+
{
|
|
32638
|
+
kind: "tsd",
|
|
32639
|
+
field: "eventIds"
|
|
32640
|
+
},
|
|
32641
|
+
{
|
|
32642
|
+
kind: "tsd",
|
|
32643
|
+
field: "selectedDate"
|
|
32644
|
+
},
|
|
32645
|
+
{
|
|
32646
|
+
kind: "tsd",
|
|
32647
|
+
field: "selectedTimeslot"
|
|
32648
|
+
}
|
|
32649
|
+
],
|
|
32650
|
+
isCalendarVisible: () => true,
|
|
32651
|
+
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32652
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
32653
|
+
async loadTimeslots(tsd) {
|
|
32654
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32655
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32656
|
+
if (!event.tickets?.length) return;
|
|
32657
|
+
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32658
|
+
"by_ticket_ids[]": event.tickets,
|
|
32659
|
+
by_ticket_type: "time_slot",
|
|
32660
|
+
by_bookable: true,
|
|
32661
|
+
valid_at: tsd.selectedDate.toString()
|
|
32662
|
+
}));
|
|
32663
|
+
loadPickerQuotas(tsd, quotas);
|
|
32664
|
+
},
|
|
32665
|
+
async loadProducts(segment) {
|
|
32666
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32667
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate || !tsd.selectedTimeslot) return;
|
|
32668
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32669
|
+
if (!event.tickets?.length) return;
|
|
32670
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32671
|
+
"by_ticket_ids[]": event.tickets,
|
|
32672
|
+
by_ticket_type: "time_slot",
|
|
32673
|
+
by_bookable: true,
|
|
32674
|
+
valid_at: tsd.selectedDate.toString()
|
|
32675
|
+
}));
|
|
32676
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32677
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32678
|
+
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: tsd.selectedTime }));
|
|
32679
|
+
}
|
|
32680
|
+
},
|
|
32681
|
+
"event:price": {
|
|
32682
|
+
name: "event:price",
|
|
32683
|
+
calendarEndpoint: "events",
|
|
32684
|
+
requires: [{
|
|
32685
|
+
kind: "tsd",
|
|
32686
|
+
field: "eventIds"
|
|
32687
|
+
}, {
|
|
32688
|
+
kind: "segment",
|
|
32689
|
+
field: "dateId"
|
|
32690
|
+
}],
|
|
32691
|
+
isCalendarVisible: () => false,
|
|
32692
|
+
isTimeslotsVisible: () => false,
|
|
32693
|
+
isTicketsVisible: (tsd) => Boolean(tsd.eventIds?.length),
|
|
32694
|
+
loadTimeslots: async () => {},
|
|
32695
|
+
async loadProducts(segment) {
|
|
32696
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32697
|
+
if (!tsd?.eventIds?.length || segment.dateId === void 0) return;
|
|
32698
|
+
const date = await shop.asyncFetch(() => shop.getEventDetailsOnDate(tsd.eventIds[0], segment.dateId));
|
|
32699
|
+
if (!date.prices?.length) return;
|
|
32700
|
+
for (const price of date.prices) {
|
|
32701
|
+
const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title });
|
|
32702
|
+
segment.preCart.addItem(createCartItem(ticket, { time: date.start_time }));
|
|
32703
|
+
}
|
|
32704
|
+
if (date.seats) shop.capacityManager.addSeats(date.id, date.seats);
|
|
32705
|
+
}
|
|
32706
|
+
},
|
|
32714
32707
|
"events:admission": {
|
|
32715
32708
|
name: "events:admission",
|
|
32716
32709
|
calendarEndpoint: "events",
|
|
@@ -32961,6 +32954,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32961
32954
|
set selectedTimeslot(value) {
|
|
32962
32955
|
set(this.#selectedTimeslot, value, true);
|
|
32963
32956
|
}
|
|
32957
|
+
timeslotTicketIds = [];
|
|
32964
32958
|
#selectedTime = /* @__PURE__ */ user_derived(() => this.selectedTimeslot);
|
|
32965
32959
|
get selectedTime() {
|
|
32966
32960
|
return get$2(this.#selectedTime);
|
|
@@ -36341,7 +36335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36341
36335
|
this.timeslots = [];
|
|
36342
36336
|
return;
|
|
36343
36337
|
}
|
|
36344
|
-
this.timeslots = shop.capacityManager.quotaManager.timeslotsOn(date).map((x) => ({
|
|
36338
|
+
this.timeslots = shop.capacityManager.quotaManager.timeslotsOn(date, this.tsd?.timeslotTicketIds).map((x) => ({
|
|
36345
36339
|
...x,
|
|
36346
36340
|
startAt: x.timeSlot,
|
|
36347
36341
|
timeFormatted: x.timeSlot.substring(11, 16),
|
|
@@ -36363,6 +36357,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36363
36357
|
const filters = tsd.filters;
|
|
36364
36358
|
const date = tsd.selectedDate;
|
|
36365
36359
|
untrack(async () => {
|
|
36360
|
+
tsd.timeslotTicketIds = [];
|
|
36366
36361
|
if (filters?.length && date) await Promise.all(filters.map((f) => getFilter(f).loadTimeslots(tsd)));
|
|
36367
36362
|
details.recalculateCapacities();
|
|
36368
36363
|
});
|