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