@gomusdev/web-components 1.37.1 → 1.39.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.
@@ -56,6 +56,7 @@ export declare class SegmentDetails {
56
56
  ticketGroupIds: number[] | undefined;
57
57
  languageIds: number[] | undefined;
58
58
  catchWordIds: number[] | undefined;
59
+ museumIds: number[] | undefined;
59
60
  constructor(type: TicketSegmentFilter, tsdWrapper: DetailsWrapper<TicketSelectionDetails>);
60
61
  clear(): void;
61
62
  toString(): string;
@@ -1,6 +1,6 @@
1
+ import { TicketSelectionDetails } from '../../../TicketSelectionDetails.svelte.ts';
1
2
  import { DetailsWrapper } from '../../../../../lib/helpers/context.svelte.ts';
2
3
  import { TimeSlot } from '@gomus/types';
3
- import { TicketSelectionDetails } from '../../../TicketSelectionDetails.svelte.ts';
4
4
  export declare class Details {
5
5
  tsd: TicketSelectionDetails | undefined;
6
6
  constructor(tsdWrapper?: DetailsWrapper<TicketSelectionDetails>);
@@ -5634,16 +5634,6 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
5634
5634
  const get2 = ((v) => v);
5635
5635
  return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
5636
5636
  }
5637
- const unique = (array2, toKey) => {
5638
- const valueMap = array2.reduce((acc, item) => {
5639
- const key = toKey ? toKey(item) : item;
5640
- if (acc[key])
5641
- return acc;
5642
- acc[key] = item;
5643
- return acc;
5644
- }, {});
5645
- return Object.values(valueMap);
5646
- };
5647
5637
  const iterate = (count, func, initValue) => {
5648
5638
  let value = initValue;
5649
5639
  for (let i = 1; i <= count; i++) {
@@ -11156,8 +11146,18 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11156
11146
  return totalCap;
11157
11147
  },
11158
11148
  timeslotsOn(date2) {
11159
- const ret2 = this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString()));
11160
- return ret2;
11149
+ const filtered = Object.values(
11150
+ this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString())).reduce(
11151
+ (acc, item) => {
11152
+ if (!acc[item.timeSlot] || item.capacity < acc[item.timeSlot].capacity) {
11153
+ acc[item.timeSlot] = item;
11154
+ }
11155
+ return acc;
11156
+ },
11157
+ {}
11158
+ )
11159
+ );
11160
+ return filtered;
11161
11161
  }
11162
11162
  };
11163
11163
  return ret;
@@ -31006,7 +31006,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31006
31006
  valid_at: tsd.selectedDate?.toString(),
31007
31007
  // @ts-ignore
31008
31008
  "by_ticket_types[]": ["normal"],
31009
- "by_museum_ids[]": tsd.museumIds,
31009
+ "by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
31010
31010
  "by_exhibition_ids[]": tsd.exhibitionIds,
31011
31011
  "by_ticket_ids[]": tsd.ticketIds,
31012
31012
  "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
@@ -31121,7 +31121,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31121
31121
  let dates = await shop.asyncFetch(() => shop.getDates({
31122
31122
  // q?: string
31123
31123
  by_bookable: true,
31124
- "by_museum_ids[]": tsd.museumIds,
31124
+ "by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
31125
31125
  "by_exhibition_ids[]": tsd.exhibitionIds,
31126
31126
  "by_event_ids[]": tsd.eventIds,
31127
31127
  "by_language_ids[]": segment.languageIds,
@@ -31175,7 +31175,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31175
31175
  valid_at: tsd.selectedDate?.toString(),
31176
31176
  // @ts-ignore
31177
31177
  by_ticket_type: "time_slot",
31178
- "by_museum_ids[]": tsd.museumIds,
31178
+ "by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
31179
31179
  "by_exhibition_ids[]": tsd.exhibitionIds,
31180
31180
  "by_ticket_ids[]": tsd.ticketIds,
31181
31181
  "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
@@ -31249,6 +31249,13 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31249
31249
  set catchWordIds(value) {
31250
31250
  set(this.#catchWordIds, value, true);
31251
31251
  }
31252
+ #museumIds = /* @__PURE__ */ state(proxy([]));
31253
+ get museumIds() {
31254
+ return get$2(this.#museumIds);
31255
+ }
31256
+ set museumIds(value) {
31257
+ set(this.#museumIds, value, true);
31258
+ }
31252
31259
  constructor(type, tsdWrapper) {
31253
31260
  this.filters = type;
31254
31261
  this.#ticketSelectionDetails = /* @__PURE__ */ user_derived(() => tsdWrapper.value);
@@ -31278,7 +31285,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31278
31285
  const getSegmentDetails = createGetDetails(KEY);
31279
31286
  function TicketSegment($$anchor, $$props) {
31280
31287
  push($$props, true);
31281
- const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7), query = prop($$props, "query", 7), limit = prop($$props, "limit", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7), languageIds = prop($$props, "languageIds", 7), catchWordIds = prop($$props, "catchWordIds", 7);
31288
+ const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7), query = prop($$props, "query", 7), limit = prop($$props, "limit", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7), languageIds = prop($$props, "languageIds", 7), catchWordIds = prop($$props, "catchWordIds", 7), museumIds = prop($$props, "museumIds", 7);
31282
31289
  if (!filters()) throw new Error("filters is required");
31283
31290
  const tsdWrapper = getTicketSelectionDetails($$props.$$host);
31284
31291
  const tsd = tsdWrapper.value;
@@ -31292,15 +31299,22 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31292
31299
  details.ticketGroupIds = parseIds(ticketGroupIds());
31293
31300
  details.languageIds = parseIds(languageIds());
31294
31301
  details.catchWordIds = parseIds(catchWordIds());
31302
+ details.museumIds = parseIds(museumIds());
31295
31303
  });
31296
31304
  user_effect(() => {
31297
31305
  details.dateId;
31298
31306
  details.filters;
31299
31307
  details.dateId;
31300
31308
  details.ticketGroupIds;
31309
+ details.museumIds;
31310
+ details.languageIds;
31311
+ details.catchWordIds;
31312
+ details.query;
31313
+ details.limit;
31301
31314
  tsd?.selectedTimeslot;
31302
31315
  tsd?.selectedTime;
31303
31316
  tsd?.selectedDate;
31317
+ tsd?.museumIds;
31304
31318
  untrack(() => {
31305
31319
  details.loadTickets();
31306
31320
  });
@@ -31363,6 +31377,13 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31363
31377
  set catchWordIds($$value) {
31364
31378
  catchWordIds($$value);
31365
31379
  flushSync();
31380
+ },
31381
+ get museumIds() {
31382
+ return museumIds();
31383
+ },
31384
+ set museumIds($$value) {
31385
+ museumIds($$value);
31386
+ flushSync();
31366
31387
  }
31367
31388
  };
31368
31389
  return pop($$exports);
@@ -31376,7 +31397,8 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31376
31397
  languageIds: { attribute: "language-ids", reflect: true, type: "String" },
31377
31398
  limit: { attribute: "limit", reflect: true, type: "Number" },
31378
31399
  query: { attribute: "query", reflect: true, type: "String" },
31379
- ticketGroupIds: { attribute: "ticket-group-ids", reflect: true, type: "String" }
31400
+ ticketGroupIds: { attribute: "ticket-group-ids", reflect: true, type: "String" },
31401
+ museumIds: { attribute: "museum-ids", reflect: true, type: "String" }
31380
31402
  },
31381
31403
  [],
31382
31404
  ["details"],
@@ -31673,17 +31695,12 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31673
31695
  let ret = [];
31674
31696
  untrack(() => {
31675
31697
  shop.capacityManager.addQuotas(result.quotas);
31676
- ret = unique(
31677
- shop.capacityManager.quotaManager.timeslotsOn(tsd.selectedDate).map((x) => ({
31678
- startAt: x.timeSlot,
31679
- timeFormatted: x.timeSlot.substring(11, 16),
31680
- capacity: x.capacity,
31681
- totalCapacity: x.totalCapacity,
31682
- available: x.capacity > 0,
31683
- quotaIds: []
31684
- })),
31685
- (x) => x.startAt.toString()
31686
- );
31698
+ ret = shop.capacityManager.quotaManager.timeslotsOn(tsd.selectedDate).map((x) => ({
31699
+ ...x,
31700
+ startAt: x.timeSlot,
31701
+ timeFormatted: x.timeSlot.substring(11, 16),
31702
+ available: x.capacity > 0
31703
+ }));
31687
31704
  });
31688
31705
  return ret;
31689
31706
  }
@@ -5634,16 +5634,6 @@ function min$1(array2, getter) {
5634
5634
  const get2 = ((v) => v);
5635
5635
  return boil(array2, (a2, b) => get2(a2) < get2(b) ? a2 : b);
5636
5636
  }
5637
- const unique = (array2, toKey) => {
5638
- const valueMap = array2.reduce((acc, item) => {
5639
- const key = toKey ? toKey(item) : item;
5640
- if (acc[key])
5641
- return acc;
5642
- acc[key] = item;
5643
- return acc;
5644
- }, {});
5645
- return Object.values(valueMap);
5646
- };
5647
5637
  const iterate = (count, func, initValue) => {
5648
5638
  let value = initValue;
5649
5639
  for (let i = 1; i <= count; i++) {
@@ -11156,8 +11146,18 @@ function createQuotaManager(quotas) {
11156
11146
  return totalCap;
11157
11147
  },
11158
11148
  timeslotsOn(date2) {
11159
- const ret2 = this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString()));
11160
- return ret2;
11149
+ const filtered = Object.values(
11150
+ this.timeslots().filter((x) => x.timeSlot.startsWith(date2.toString())).reduce(
11151
+ (acc, item) => {
11152
+ if (!acc[item.timeSlot] || item.capacity < acc[item.timeSlot].capacity) {
11153
+ acc[item.timeSlot] = item;
11154
+ }
11155
+ return acc;
11156
+ },
11157
+ {}
11158
+ )
11159
+ );
11160
+ return filtered;
11161
11161
  }
11162
11162
  };
11163
11163
  return ret;
@@ -31006,7 +31006,7 @@ async function loadDayTickets(segment) {
31006
31006
  valid_at: tsd.selectedDate?.toString(),
31007
31007
  // @ts-ignore
31008
31008
  "by_ticket_types[]": ["normal"],
31009
- "by_museum_ids[]": tsd.museumIds,
31009
+ "by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
31010
31010
  "by_exhibition_ids[]": tsd.exhibitionIds,
31011
31011
  "by_ticket_ids[]": tsd.ticketIds,
31012
31012
  "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
@@ -31121,7 +31121,7 @@ async function load_Events_ScaledPricesTickets(segment) {
31121
31121
  let dates = await shop.asyncFetch(() => shop.getDates({
31122
31122
  // q?: string
31123
31123
  by_bookable: true,
31124
- "by_museum_ids[]": tsd.museumIds,
31124
+ "by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
31125
31125
  "by_exhibition_ids[]": tsd.exhibitionIds,
31126
31126
  "by_event_ids[]": tsd.eventIds,
31127
31127
  "by_language_ids[]": segment.languageIds,
@@ -31175,7 +31175,7 @@ async function loadTimeslotTickets(segment) {
31175
31175
  valid_at: tsd.selectedDate?.toString(),
31176
31176
  // @ts-ignore
31177
31177
  by_ticket_type: "time_slot",
31178
- "by_museum_ids[]": tsd.museumIds,
31178
+ "by_museum_ids[]": segment.museumIds ?? tsd.museumIds,
31179
31179
  "by_exhibition_ids[]": tsd.exhibitionIds,
31180
31180
  "by_ticket_ids[]": tsd.ticketIds,
31181
31181
  "by_ticket_group_ids[]": segment.ticketGroupIds ?? tsd.ticketGroupIds
@@ -31249,6 +31249,13 @@ class SegmentDetails {
31249
31249
  set catchWordIds(value) {
31250
31250
  set(this.#catchWordIds, value, true);
31251
31251
  }
31252
+ #museumIds = /* @__PURE__ */ state(proxy([]));
31253
+ get museumIds() {
31254
+ return get$2(this.#museumIds);
31255
+ }
31256
+ set museumIds(value) {
31257
+ set(this.#museumIds, value, true);
31258
+ }
31252
31259
  constructor(type, tsdWrapper) {
31253
31260
  this.filters = type;
31254
31261
  this.#ticketSelectionDetails = /* @__PURE__ */ user_derived(() => tsdWrapper.value);
@@ -31278,7 +31285,7 @@ const setSegmentDetails = createSetDetails(KEY);
31278
31285
  const getSegmentDetails = createGetDetails(KEY);
31279
31286
  function TicketSegment($$anchor, $$props) {
31280
31287
  push($$props, true);
31281
- const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7), query = prop($$props, "query", 7), limit = prop($$props, "limit", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7), languageIds = prop($$props, "languageIds", 7), catchWordIds = prop($$props, "catchWordIds", 7);
31288
+ const filters = prop($$props, "filters", 7), dateId = prop($$props, "dateId", 7), query = prop($$props, "query", 7), limit = prop($$props, "limit", 7), ticketGroupIds = prop($$props, "ticketGroupIds", 7), languageIds = prop($$props, "languageIds", 7), catchWordIds = prop($$props, "catchWordIds", 7), museumIds = prop($$props, "museumIds", 7);
31282
31289
  if (!filters()) throw new Error("filters is required");
31283
31290
  const tsdWrapper = getTicketSelectionDetails($$props.$$host);
31284
31291
  const tsd = tsdWrapper.value;
@@ -31292,15 +31299,22 @@ function TicketSegment($$anchor, $$props) {
31292
31299
  details.ticketGroupIds = parseIds(ticketGroupIds());
31293
31300
  details.languageIds = parseIds(languageIds());
31294
31301
  details.catchWordIds = parseIds(catchWordIds());
31302
+ details.museumIds = parseIds(museumIds());
31295
31303
  });
31296
31304
  user_effect(() => {
31297
31305
  details.dateId;
31298
31306
  details.filters;
31299
31307
  details.dateId;
31300
31308
  details.ticketGroupIds;
31309
+ details.museumIds;
31310
+ details.languageIds;
31311
+ details.catchWordIds;
31312
+ details.query;
31313
+ details.limit;
31301
31314
  tsd?.selectedTimeslot;
31302
31315
  tsd?.selectedTime;
31303
31316
  tsd?.selectedDate;
31317
+ tsd?.museumIds;
31304
31318
  untrack(() => {
31305
31319
  details.loadTickets();
31306
31320
  });
@@ -31363,6 +31377,13 @@ function TicketSegment($$anchor, $$props) {
31363
31377
  set catchWordIds($$value) {
31364
31378
  catchWordIds($$value);
31365
31379
  flushSync();
31380
+ },
31381
+ get museumIds() {
31382
+ return museumIds();
31383
+ },
31384
+ set museumIds($$value) {
31385
+ museumIds($$value);
31386
+ flushSync();
31366
31387
  }
31367
31388
  };
31368
31389
  return pop($$exports);
@@ -31376,7 +31397,8 @@ customElements.define("go-ticket-segment", create_custom_element(
31376
31397
  languageIds: { attribute: "language-ids", reflect: true, type: "String" },
31377
31398
  limit: { attribute: "limit", reflect: true, type: "Number" },
31378
31399
  query: { attribute: "query", reflect: true, type: "String" },
31379
- ticketGroupIds: { attribute: "ticket-group-ids", reflect: true, type: "String" }
31400
+ ticketGroupIds: { attribute: "ticket-group-ids", reflect: true, type: "String" },
31401
+ museumIds: { attribute: "museum-ids", reflect: true, type: "String" }
31380
31402
  },
31381
31403
  [],
31382
31404
  ["details"],
@@ -31673,17 +31695,12 @@ let Details$2 = class Details {
31673
31695
  let ret = [];
31674
31696
  untrack(() => {
31675
31697
  shop.capacityManager.addQuotas(result.quotas);
31676
- ret = unique(
31677
- shop.capacityManager.quotaManager.timeslotsOn(tsd.selectedDate).map((x) => ({
31678
- startAt: x.timeSlot,
31679
- timeFormatted: x.timeSlot.substring(11, 16),
31680
- capacity: x.capacity,
31681
- totalCapacity: x.totalCapacity,
31682
- available: x.capacity > 0,
31683
- quotaIds: []
31684
- })),
31685
- (x) => x.startAt.toString()
31686
- );
31698
+ ret = shop.capacityManager.quotaManager.timeslotsOn(tsd.selectedDate).map((x) => ({
31699
+ ...x,
31700
+ startAt: x.timeSlot,
31701
+ timeFormatted: x.timeSlot.substring(11, 16),
31702
+ available: x.capacity > 0
31703
+ }));
31687
31704
  });
31688
31705
  return ret;
31689
31706
  }
@@ -1,4 +1,4 @@
1
- import { Quota, Ticket, TimeSlot } from '@gomus/types';
1
+ import { Quota, Ticket } from '@gomus/types';
2
2
  export declare const dummyShop: readonly ["https://example.com", "dummy_shop_domain", "en"];
3
3
  export declare const mockedTicketsAndQuotas: {
4
4
  tickets: {
@@ -122,7 +122,6 @@ export declare const mockedTicketsAndQuotas: {
122
122
  };
123
123
  };
124
124
  export declare function createMockTicket(ticket?: Partial<Ticket>): Ticket;
125
- export declare function createMockTimeSlot(timeSlot?: Partial<TimeSlot>): TimeSlot;
126
125
  export declare function createMockQuota(quota?: Partial<Quota>): Quota;
127
126
  export declare const response_success: {
128
127
  shop: {
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.37.1",
7
+ "version": "1.39.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",
@@ -1,50 +0,0 @@
1
- import { Quotas, Ticket, Tickets, TimeSlot } from '@gomus/types';
2
- /**
3
- * Transforms a single ticket into an array of formatted time slot entries.
4
- * Each entry represents a specific time when the ticket can be used.
5
- */
6
- export declare function createTimeSlotEntriesFromTicket(ticket: Ticket): TimeSlot[];
7
- /**
8
- * Flattens all tickets into a single chronologically sorted array of time slots.
9
- * This creates the base collection of all possible timeslots across all tickets.
10
- */
11
- export declare function flattenTicketsIntoSlots(tickets: Tickets): TimeSlot[];
12
- /**
13
- * Removes duplicate time slots, keeping only one entry per time.
14
- * When duplicates exist, preserves the one with the highest capacity.
15
- */
16
- export declare function getUniqueSlots(timeSlots: TimeSlot[]): TimeSlot[];
17
- /**
18
- * Filters time slots to only include those that belong to a specific quota,
19
- * and removes duplicate times by keeping the slot with the highest capacity.
20
- *
21
- * This handles cases where the same time slot appears multiple times due to
22
- * multiple tickets sharing the same quota.
23
- */
24
- export declare function filterSlotsByQuota(allTimeSlots: TimeSlot[], quotaId: number): TimeSlot[];
25
- /**
26
- * Processes all quotas and aggregates their time slots into a single collection.
27
- * This step ensures that each quota's constraints are properly applied to the available times.
28
- */
29
- export declare function filterSlots(allTimeSlots: TimeSlot[], quotas: Quotas): TimeSlot[];
30
- /**
31
- * Consolidates time slots by merging multiple entries for the same time into one,
32
- * summing up their capacities to get the total available capacity per time slot.
33
- *
34
- * This final step creates the definitive list of bookable time slots with accurate capacity information.
35
- */
36
- export declare function combineSlots(timeSlots: TimeSlot[]): TimeSlot[];
37
- /**
38
- * Processes tickets and quotas to generate a consolidated list of available timeslots.
39
- *
40
- * This function handles the complex business logic of:
41
- * 1. Extracting all possible timeslots from tickets
42
- * 2. Applying quota constraints to determine actual availability
43
- * 3. Consolidating overlapping time slots and summing their capacities
44
- * 4. Providing a final sorted list of bookable time slots
45
- *
46
- * @param tickets - Collection of ticket types with their individual time slots and capacities
47
- * @param quotas - Booking quotas that constrain which tickets can be booked when
48
- * @returns Sorted array of consolidated time slots with accurate capacity and availability information
49
- */
50
- export declare function generateAvailableTimeSlots(tickets: Tickets, quotas: Quotas): TimeSlot[];