@gomusdev/web-components 3.8.0 → 3.8.1
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 +7 -0
- package/dist-js/gomus-webcomponents.iife.js +259 -265
- package/dist-js/gomus-webcomponents.js +259 -265
- package/dist-js/gomus-webcomponents.min.iife.js +20 -20
- package/dist-js/gomus-webcomponents.min.js +3052 -3046
- 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,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.8.1 (2026-06-22)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **ticket-selection:** isolate timeslot picker from foreign-segment quotas
|
|
8
|
+
* **ticket-selection:** scope timeslot picker to the selection's own tickets (TC-01)
|
|
9
|
+
|
|
3
10
|
## 3.8.0 (2026-06-22)
|
|
4
11
|
|
|
5
12
|
### 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,251 @@ 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
|
+
if (!(await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]))).tickets?.length) return;
|
|
32590
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32591
|
+
by_bookable: true,
|
|
32592
|
+
valid_at: tsd.selectedDate.toString(),
|
|
32593
|
+
date_id: segment.dateId
|
|
32594
|
+
}));
|
|
32595
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32596
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32597
|
+
for (const ticket of uiTickets) segment.preCart.addItem(createCartItem(ticket, { time: tsd.selectedTime }));
|
|
32598
|
+
}
|
|
32599
|
+
},
|
|
32600
|
+
"event:admission:day": {
|
|
32601
|
+
name: "event:admission:day",
|
|
32602
|
+
calendarEndpoint: "events",
|
|
32603
|
+
requires: [{
|
|
32604
|
+
kind: "tsd",
|
|
32605
|
+
field: "eventIds"
|
|
32606
|
+
}, {
|
|
32607
|
+
kind: "tsd",
|
|
32608
|
+
field: "selectedDate"
|
|
32609
|
+
}],
|
|
32610
|
+
isCalendarVisible: () => true,
|
|
32611
|
+
isTimeslotsVisible: () => false,
|
|
32612
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32613
|
+
async loadTimeslots() {},
|
|
32614
|
+
async loadProducts(segment) {
|
|
32615
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32616
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32617
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32618
|
+
if (!event.tickets?.length) return;
|
|
32619
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32620
|
+
"by_ticket_ids[]": event.tickets,
|
|
32621
|
+
"by_ticket_types[]": ["normal"],
|
|
32622
|
+
by_bookable: true,
|
|
32623
|
+
valid_at: tsd.selectedDate.toString()
|
|
32624
|
+
}));
|
|
32625
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32626
|
+
const firstQuota = Object.values(quotas)[0];
|
|
32627
|
+
const time = firstQuota ? Object.keys(firstQuota.capacities)[0] : void 0;
|
|
32628
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, time), time);
|
|
32629
|
+
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time }));
|
|
32630
|
+
}
|
|
32631
|
+
},
|
|
32632
|
+
"event:admission:timeslot": {
|
|
32633
|
+
name: "event:admission:timeslot",
|
|
32634
|
+
calendarEndpoint: "events",
|
|
32635
|
+
requires: [
|
|
32636
|
+
{
|
|
32637
|
+
kind: "tsd",
|
|
32638
|
+
field: "eventIds"
|
|
32639
|
+
},
|
|
32640
|
+
{
|
|
32641
|
+
kind: "tsd",
|
|
32642
|
+
field: "selectedDate"
|
|
32643
|
+
},
|
|
32644
|
+
{
|
|
32645
|
+
kind: "tsd",
|
|
32646
|
+
field: "selectedTimeslot"
|
|
32647
|
+
}
|
|
32648
|
+
],
|
|
32649
|
+
isCalendarVisible: () => true,
|
|
32650
|
+
isTimeslotsVisible: (tsd) => Boolean(tsd.selectedDate),
|
|
32651
|
+
isTicketsVisible: (tsd) => Boolean(tsd.selectedDate && tsd.selectedTimeslot),
|
|
32652
|
+
async loadTimeslots(tsd) {
|
|
32653
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate) return;
|
|
32654
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32655
|
+
if (!event.tickets?.length) return;
|
|
32656
|
+
const { quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32657
|
+
"by_ticket_ids[]": event.tickets,
|
|
32658
|
+
by_ticket_type: "time_slot",
|
|
32659
|
+
by_bookable: true,
|
|
32660
|
+
valid_at: tsd.selectedDate.toString()
|
|
32661
|
+
}));
|
|
32662
|
+
loadPickerQuotas(tsd, quotas);
|
|
32663
|
+
},
|
|
32664
|
+
async loadProducts(segment) {
|
|
32665
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32666
|
+
if (!tsd?.eventIds?.length || !tsd.selectedDate || !tsd.selectedTimeslot) return;
|
|
32667
|
+
const event = await shop.asyncFetch(() => shop.getEvent(tsd.eventIds[0]));
|
|
32668
|
+
if (!event.tickets?.length) return;
|
|
32669
|
+
const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
|
|
32670
|
+
"by_ticket_ids[]": event.tickets,
|
|
32671
|
+
by_ticket_type: "time_slot",
|
|
32672
|
+
by_bookable: true,
|
|
32673
|
+
valid_at: tsd.selectedDate.toString()
|
|
32674
|
+
}));
|
|
32675
|
+
shop.capacityManager.addQuotas(quotas);
|
|
32676
|
+
const uiTickets = initUITimeslotTickets(filterAvailabletickets(tickets, tsd.selectedTime), tsd.selectedTime);
|
|
32677
|
+
for (const t of uiTickets) segment.preCart.addItem(createCartItem(t, { time: tsd.selectedTime }));
|
|
32678
|
+
}
|
|
32679
|
+
},
|
|
32680
|
+
"event:price": {
|
|
32681
|
+
name: "event:price",
|
|
32682
|
+
calendarEndpoint: "events",
|
|
32683
|
+
requires: [{
|
|
32684
|
+
kind: "tsd",
|
|
32685
|
+
field: "eventIds"
|
|
32686
|
+
}, {
|
|
32687
|
+
kind: "segment",
|
|
32688
|
+
field: "dateId"
|
|
32689
|
+
}],
|
|
32690
|
+
isCalendarVisible: () => false,
|
|
32691
|
+
isTimeslotsVisible: () => false,
|
|
32692
|
+
isTicketsVisible: (tsd) => Boolean(tsd.eventIds?.length),
|
|
32693
|
+
loadTimeslots: async () => {},
|
|
32694
|
+
async loadProducts(segment) {
|
|
32695
|
+
const tsd = segment.ticketSelectionDetails;
|
|
32696
|
+
if (!tsd?.eventIds?.length || segment.dateId === void 0) return;
|
|
32697
|
+
const date = await shop.asyncFetch(() => shop.getEventDetailsOnDate(tsd.eventIds[0], segment.dateId));
|
|
32698
|
+
if (!date.prices?.length) return;
|
|
32699
|
+
for (const price of date.prices) {
|
|
32700
|
+
const ticket = createUIEventTicket(price, date.id, { event_title: date.event_title });
|
|
32701
|
+
segment.preCart.addItem(createCartItem(ticket, { time: date.start_time }));
|
|
32702
|
+
}
|
|
32703
|
+
if (date.seats) shop.capacityManager.addSeats(date.id, date.seats);
|
|
32704
|
+
}
|
|
32705
|
+
},
|
|
32714
32706
|
"events:admission": {
|
|
32715
32707
|
name: "events:admission",
|
|
32716
32708
|
calendarEndpoint: "events",
|
|
@@ -32961,6 +32953,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
32961
32953
|
set selectedTimeslot(value) {
|
|
32962
32954
|
set(this.#selectedTimeslot, value, true);
|
|
32963
32955
|
}
|
|
32956
|
+
timeslotTicketIds = [];
|
|
32964
32957
|
#selectedTime = /* @__PURE__ */ user_derived(() => this.selectedTimeslot);
|
|
32965
32958
|
get selectedTime() {
|
|
32966
32959
|
return get$2(this.#selectedTime);
|
|
@@ -36341,7 +36334,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36341
36334
|
this.timeslots = [];
|
|
36342
36335
|
return;
|
|
36343
36336
|
}
|
|
36344
|
-
this.timeslots = shop.capacityManager.quotaManager.timeslotsOn(date).map((x) => ({
|
|
36337
|
+
this.timeslots = shop.capacityManager.quotaManager.timeslotsOn(date, this.tsd?.timeslotTicketIds).map((x) => ({
|
|
36345
36338
|
...x,
|
|
36346
36339
|
startAt: x.timeSlot,
|
|
36347
36340
|
timeFormatted: x.timeSlot.substring(11, 16),
|
|
@@ -36363,6 +36356,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
36363
36356
|
const filters = tsd.filters;
|
|
36364
36357
|
const date = tsd.selectedDate;
|
|
36365
36358
|
untrack(async () => {
|
|
36359
|
+
tsd.timeslotTicketIds = [];
|
|
36366
36360
|
if (filters?.length && date) await Promise.all(filters.map((f) => getFilter(f).loadTimeslots(tsd)));
|
|
36367
36361
|
details.recalculateCapacities();
|
|
36368
36362
|
});
|