@gomusdev/web-components 1.37.1 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-js/components/ticketSelection/subcomponents/timeslots/lib/lib.svelte.d.ts +1 -1
- package/dist-js/gomus-webcomponents.iife.js +18 -23
- package/dist-js/gomus-webcomponents.js +18 -23
- package/dist-js/mocks/ShopMocks.d.ts +1 -2
- package/package.json +1 -1
- package/dist-js/components/ticketSelection/subcomponents/timeslots/lib/generateAvailableTimeSlots.d.ts +0 -50
- package/dist-js/components/ticketSelection/subcomponents/timeslots/lib/generateAvailableTimeSlots.specs.d.ts +0 -1
|
@@ -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
|
|
11160
|
-
|
|
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;
|
|
@@ -31673,17 +31673,12 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
31673
31673
|
let ret = [];
|
|
31674
31674
|
untrack(() => {
|
|
31675
31675
|
shop.capacityManager.addQuotas(result.quotas);
|
|
31676
|
-
ret =
|
|
31677
|
-
|
|
31678
|
-
|
|
31679
|
-
|
|
31680
|
-
|
|
31681
|
-
|
|
31682
|
-
available: x.capacity > 0,
|
|
31683
|
-
quotaIds: []
|
|
31684
|
-
})),
|
|
31685
|
-
(x) => x.startAt.toString()
|
|
31686
|
-
);
|
|
31676
|
+
ret = shop.capacityManager.quotaManager.timeslotsOn(tsd.selectedDate).map((x) => ({
|
|
31677
|
+
...x,
|
|
31678
|
+
startAt: x.timeSlot,
|
|
31679
|
+
timeFormatted: x.timeSlot.substring(11, 16),
|
|
31680
|
+
available: x.capacity > 0
|
|
31681
|
+
}));
|
|
31687
31682
|
});
|
|
31688
31683
|
return ret;
|
|
31689
31684
|
}
|
|
@@ -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
|
|
11160
|
-
|
|
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;
|
|
@@ -31673,17 +31673,12 @@ let Details$2 = class Details {
|
|
|
31673
31673
|
let ret = [];
|
|
31674
31674
|
untrack(() => {
|
|
31675
31675
|
shop.capacityManager.addQuotas(result.quotas);
|
|
31676
|
-
ret =
|
|
31677
|
-
|
|
31678
|
-
|
|
31679
|
-
|
|
31680
|
-
|
|
31681
|
-
|
|
31682
|
-
available: x.capacity > 0,
|
|
31683
|
-
quotaIds: []
|
|
31684
|
-
})),
|
|
31685
|
-
(x) => x.startAt.toString()
|
|
31686
|
-
);
|
|
31676
|
+
ret = shop.capacityManager.quotaManager.timeslotsOn(tsd.selectedDate).map((x) => ({
|
|
31677
|
+
...x,
|
|
31678
|
+
startAt: x.timeSlot,
|
|
31679
|
+
timeFormatted: x.timeSlot.substring(11, 16),
|
|
31680
|
+
available: x.capacity > 0
|
|
31681
|
+
}));
|
|
31687
31682
|
});
|
|
31688
31683
|
return ret;
|
|
31689
31684
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Quota, Ticket
|
|
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
|
@@ -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[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|