@gomusdev/web-components 3.12.0 → 4.1.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/README.md +46 -0
- package/dist-js/components/cart/components/SubRow.svelte.d.ts +1 -0
- package/dist-js/components/shared/quantityStepper/QuantityControl.svelte.d.ts +1 -0
- package/dist-js/gomus-webcomponents.css +141 -3
- package/dist-js/gomus-webcomponents.iife.js +21070 -20669
- package/dist-js/gomus-webcomponents.js +21070 -20669
- package/dist-js/gomus-webcomponents.min.css +1 -1
- package/dist-js/gomus-webcomponents.min.iife.js +37 -37
- package/dist-js/gomus-webcomponents.min.js +18577 -18313
- package/dist-js/src/components/shared/quantityStepper/QuantityControl.spec.d.ts +1 -0
- package/dist-js/src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/SegmentDetails.svelte.d.ts +20 -0
- package/dist-js/src/factories/CartItemFactories.d.ts +86 -0
- package/dist-js/src/factories/QuotaFactories.d.ts +16 -0
- package/dist-js/src/factories/TicketFactories.d.ts +42 -0
- package/dist-js/src/lib/models/capacity/CapacityManager.d.ts +4 -2
- package/dist-js/src/lib/models/capacity/calculators/mantle.d.ts +34 -0
- package/dist-js/src/lib/models/capacity/calculators/mantle.spec.d.ts +1 -0
- package/dist-js/src/lib/models/capacity/calculators/quotaManager/QuotaManager.d.ts +2 -1
- package/dist-js/src/lib/models/capacity/calculators/quotas.d.ts +23 -0
- package/dist-js/src/lib/models/cart/CartItem.d.ts +29 -1
- package/dist-js/src/lib/models/cart/cart.svelte.d.ts +40 -0
- package/dist-js/src/lib/models/cart/localStorage.svelte.d.ts +8 -0
- package/dist-js/src/lib/models/cart/quantityStepper.d.ts +16 -13
- package/dist-js/src/lib/models/ticket/UITicket.svelte.d.ts +35 -0
- package/dist-js/src/lib/stores/shop.svelte.d.ts +24 -2
- package/dist-js/src/workflowSpecs/mantle-workflow.spec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -8,16 +8,19 @@ export declare class SegmentDetails {
|
|
|
8
8
|
type: "Ticket" | "Event" | "Coupon";
|
|
9
9
|
product: import('../../../../../../lib/models/cart/types').Product;
|
|
10
10
|
orderAttributes(): {
|
|
11
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
11
12
|
time: string | undefined;
|
|
12
13
|
quantity: number | undefined;
|
|
13
14
|
shipped_with_merchandise_id: null;
|
|
14
15
|
shipping_mode: string;
|
|
15
16
|
id: number;
|
|
17
|
+
uuid: string;
|
|
16
18
|
} | {
|
|
17
19
|
quantity: number | undefined;
|
|
18
20
|
shipped_with_merchandise_id: null;
|
|
19
21
|
shipping_mode: string;
|
|
20
22
|
id: number;
|
|
23
|
+
uuid: string;
|
|
21
24
|
} | {
|
|
22
25
|
quantities: {
|
|
23
26
|
[x: number]: number | undefined;
|
|
@@ -25,6 +28,7 @@ export declare class SegmentDetails {
|
|
|
25
28
|
shipped_with_merchandise_id: null;
|
|
26
29
|
shipping_mode: string;
|
|
27
30
|
id: number;
|
|
31
|
+
uuid: string;
|
|
28
32
|
};
|
|
29
33
|
uuid: string;
|
|
30
34
|
subUId: string;
|
|
@@ -37,6 +41,10 @@ export declare class SegmentDetails {
|
|
|
37
41
|
total_price_formatted: string;
|
|
38
42
|
quantity?: number | undefined;
|
|
39
43
|
time?: string | undefined;
|
|
44
|
+
mantle?: {
|
|
45
|
+
composition: Record<number, number>;
|
|
46
|
+
key?: string;
|
|
47
|
+
} | undefined;
|
|
40
48
|
display?: {
|
|
41
49
|
discounted: boolean;
|
|
42
50
|
reference_uuid: string;
|
|
@@ -50,16 +58,19 @@ export declare class SegmentDetails {
|
|
|
50
58
|
type: "Ticket" | "Event" | "Coupon";
|
|
51
59
|
product: import('../../../../../../lib/models/cart/types').Product;
|
|
52
60
|
orderAttributes(): {
|
|
61
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
53
62
|
time: string | undefined;
|
|
54
63
|
quantity: number | undefined;
|
|
55
64
|
shipped_with_merchandise_id: null;
|
|
56
65
|
shipping_mode: string;
|
|
57
66
|
id: number;
|
|
67
|
+
uuid: string;
|
|
58
68
|
} | {
|
|
59
69
|
quantity: number | undefined;
|
|
60
70
|
shipped_with_merchandise_id: null;
|
|
61
71
|
shipping_mode: string;
|
|
62
72
|
id: number;
|
|
73
|
+
uuid: string;
|
|
63
74
|
} | {
|
|
64
75
|
quantities: {
|
|
65
76
|
[x: number]: number | undefined;
|
|
@@ -67,6 +78,7 @@ export declare class SegmentDetails {
|
|
|
67
78
|
shipped_with_merchandise_id: null;
|
|
68
79
|
shipping_mode: string;
|
|
69
80
|
id: number;
|
|
81
|
+
uuid: string;
|
|
70
82
|
};
|
|
71
83
|
uuid: string;
|
|
72
84
|
subUId: string;
|
|
@@ -79,6 +91,10 @@ export declare class SegmentDetails {
|
|
|
79
91
|
total_price_formatted: string;
|
|
80
92
|
quantity?: number | undefined;
|
|
81
93
|
time?: string | undefined;
|
|
94
|
+
mantle?: {
|
|
95
|
+
composition: Record<number, number>;
|
|
96
|
+
key?: string;
|
|
97
|
+
} | undefined;
|
|
82
98
|
display?: {
|
|
83
99
|
discounted: boolean;
|
|
84
100
|
reference_uuid: string;
|
|
@@ -94,16 +110,19 @@ export declare class SegmentDetails {
|
|
|
94
110
|
items: {
|
|
95
111
|
type: "Ticket" | "Event" | "Coupon";
|
|
96
112
|
attributes: {
|
|
113
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
97
114
|
time: string | undefined;
|
|
98
115
|
quantity: number | undefined;
|
|
99
116
|
shipped_with_merchandise_id: null;
|
|
100
117
|
shipping_mode: string;
|
|
101
118
|
id: number;
|
|
119
|
+
uuid: string;
|
|
102
120
|
} | {
|
|
103
121
|
quantity: number | undefined;
|
|
104
122
|
shipped_with_merchandise_id: null;
|
|
105
123
|
shipping_mode: string;
|
|
106
124
|
id: number;
|
|
125
|
+
uuid: string;
|
|
107
126
|
} | {
|
|
108
127
|
quantities: {
|
|
109
128
|
[x: number]: number | undefined;
|
|
@@ -111,6 +130,7 @@ export declare class SegmentDetails {
|
|
|
111
130
|
shipped_with_merchandise_id: null;
|
|
112
131
|
shipping_mode: string;
|
|
113
132
|
id: number;
|
|
133
|
+
uuid: string;
|
|
114
134
|
};
|
|
115
135
|
}[];
|
|
116
136
|
shipping_address_id: null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventTicketFactories } from './EventTicketFactories.ts';
|
|
2
2
|
import { TicketFactories } from './TicketFactories.ts';
|
|
3
|
+
export declare const DEFAULT_TIME = "2122-09-18T12:00:00+02:00";
|
|
3
4
|
interface TicketCartItemOptions {
|
|
4
5
|
quantity?: number;
|
|
5
6
|
time?: string;
|
|
@@ -12,21 +13,30 @@ interface EventCartItemOptions {
|
|
|
12
13
|
event_title?: string;
|
|
13
14
|
eventTicket?: Partial<ReturnType<typeof EventTicketFactories.scaled>>;
|
|
14
15
|
}
|
|
16
|
+
interface MantleCartItemOptions {
|
|
17
|
+
quantity?: number;
|
|
18
|
+
time?: string;
|
|
19
|
+
ticket?: Parameters<typeof TicketFactories.mantle>[0];
|
|
20
|
+
subTicketQuantities?: Record<number, number>;
|
|
21
|
+
}
|
|
15
22
|
export declare const CartItemFactories: {
|
|
16
23
|
timeslot({ quantity, time, ticket }?: TicketCartItemOptions): {
|
|
17
24
|
type: "Ticket" | "Event" | "Coupon";
|
|
18
25
|
product: import('../lib/models/cart/types.ts').Product;
|
|
19
26
|
orderAttributes(): {
|
|
27
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
20
28
|
time: string | undefined;
|
|
21
29
|
quantity: number | undefined;
|
|
22
30
|
shipped_with_merchandise_id: null;
|
|
23
31
|
shipping_mode: string;
|
|
24
32
|
id: number;
|
|
33
|
+
uuid: string;
|
|
25
34
|
} | {
|
|
26
35
|
quantity: number | undefined;
|
|
27
36
|
shipped_with_merchandise_id: null;
|
|
28
37
|
shipping_mode: string;
|
|
29
38
|
id: number;
|
|
39
|
+
uuid: string;
|
|
30
40
|
} | {
|
|
31
41
|
quantities: {
|
|
32
42
|
[x: number]: number | undefined;
|
|
@@ -34,6 +44,7 @@ export declare const CartItemFactories: {
|
|
|
34
44
|
shipped_with_merchandise_id: null;
|
|
35
45
|
shipping_mode: string;
|
|
36
46
|
id: number;
|
|
47
|
+
uuid: string;
|
|
37
48
|
};
|
|
38
49
|
uuid: string;
|
|
39
50
|
subUId: string;
|
|
@@ -46,6 +57,10 @@ export declare const CartItemFactories: {
|
|
|
46
57
|
total_price_formatted: string;
|
|
47
58
|
quantity?: number | undefined;
|
|
48
59
|
time?: string | undefined;
|
|
60
|
+
mantle?: {
|
|
61
|
+
composition: Record<number, number>;
|
|
62
|
+
key?: string;
|
|
63
|
+
} | undefined;
|
|
49
64
|
display?: {
|
|
50
65
|
discounted: boolean;
|
|
51
66
|
reference_uuid: string;
|
|
@@ -56,16 +71,66 @@ export declare const CartItemFactories: {
|
|
|
56
71
|
type: "Ticket" | "Event" | "Coupon";
|
|
57
72
|
product: import('../lib/models/cart/types.ts').Product;
|
|
58
73
|
orderAttributes(): {
|
|
74
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
75
|
+
time: string | undefined;
|
|
76
|
+
quantity: number | undefined;
|
|
77
|
+
shipped_with_merchandise_id: null;
|
|
78
|
+
shipping_mode: string;
|
|
79
|
+
id: number;
|
|
80
|
+
uuid: string;
|
|
81
|
+
} | {
|
|
82
|
+
quantity: number | undefined;
|
|
83
|
+
shipped_with_merchandise_id: null;
|
|
84
|
+
shipping_mode: string;
|
|
85
|
+
id: number;
|
|
86
|
+
uuid: string;
|
|
87
|
+
} | {
|
|
88
|
+
quantities: {
|
|
89
|
+
[x: number]: number | undefined;
|
|
90
|
+
};
|
|
91
|
+
shipped_with_merchandise_id: null;
|
|
92
|
+
shipping_mode: string;
|
|
93
|
+
id: number;
|
|
94
|
+
uuid: string;
|
|
95
|
+
};
|
|
96
|
+
uuid: string;
|
|
97
|
+
subUId: string;
|
|
98
|
+
toString(): string;
|
|
99
|
+
price_cents: number;
|
|
100
|
+
price_formatted: string;
|
|
101
|
+
final_price_cents: number;
|
|
102
|
+
final_price_formatted: string;
|
|
103
|
+
total_price_cents: number;
|
|
104
|
+
total_price_formatted: string;
|
|
105
|
+
quantity?: number | undefined;
|
|
106
|
+
time?: string | undefined;
|
|
107
|
+
mantle?: {
|
|
108
|
+
composition: Record<number, number>;
|
|
109
|
+
key?: string;
|
|
110
|
+
} | undefined;
|
|
111
|
+
display?: {
|
|
112
|
+
discounted: boolean;
|
|
113
|
+
reference_uuid: string;
|
|
114
|
+
originalPrice: number;
|
|
115
|
+
} | undefined;
|
|
116
|
+
};
|
|
117
|
+
mantle({ quantity, time, ticket, subTicketQuantities }?: MantleCartItemOptions): {
|
|
118
|
+
type: "Ticket" | "Event" | "Coupon";
|
|
119
|
+
product: import('../lib/models/cart/types.ts').Product;
|
|
120
|
+
orderAttributes(): {
|
|
121
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
59
122
|
time: string | undefined;
|
|
60
123
|
quantity: number | undefined;
|
|
61
124
|
shipped_with_merchandise_id: null;
|
|
62
125
|
shipping_mode: string;
|
|
63
126
|
id: number;
|
|
127
|
+
uuid: string;
|
|
64
128
|
} | {
|
|
65
129
|
quantity: number | undefined;
|
|
66
130
|
shipped_with_merchandise_id: null;
|
|
67
131
|
shipping_mode: string;
|
|
68
132
|
id: number;
|
|
133
|
+
uuid: string;
|
|
69
134
|
} | {
|
|
70
135
|
quantities: {
|
|
71
136
|
[x: number]: number | undefined;
|
|
@@ -73,6 +138,7 @@ export declare const CartItemFactories: {
|
|
|
73
138
|
shipped_with_merchandise_id: null;
|
|
74
139
|
shipping_mode: string;
|
|
75
140
|
id: number;
|
|
141
|
+
uuid: string;
|
|
76
142
|
};
|
|
77
143
|
uuid: string;
|
|
78
144
|
subUId: string;
|
|
@@ -85,6 +151,10 @@ export declare const CartItemFactories: {
|
|
|
85
151
|
total_price_formatted: string;
|
|
86
152
|
quantity?: number | undefined;
|
|
87
153
|
time?: string | undefined;
|
|
154
|
+
mantle?: {
|
|
155
|
+
composition: Record<number, number>;
|
|
156
|
+
key?: string;
|
|
157
|
+
} | undefined;
|
|
88
158
|
display?: {
|
|
89
159
|
discounted: boolean;
|
|
90
160
|
reference_uuid: string;
|
|
@@ -95,16 +165,19 @@ export declare const CartItemFactories: {
|
|
|
95
165
|
type: "Ticket" | "Event" | "Coupon";
|
|
96
166
|
product: import('../lib/models/cart/types.ts').Product;
|
|
97
167
|
orderAttributes(): {
|
|
168
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
98
169
|
time: string | undefined;
|
|
99
170
|
quantity: number | undefined;
|
|
100
171
|
shipped_with_merchandise_id: null;
|
|
101
172
|
shipping_mode: string;
|
|
102
173
|
id: number;
|
|
174
|
+
uuid: string;
|
|
103
175
|
} | {
|
|
104
176
|
quantity: number | undefined;
|
|
105
177
|
shipped_with_merchandise_id: null;
|
|
106
178
|
shipping_mode: string;
|
|
107
179
|
id: number;
|
|
180
|
+
uuid: string;
|
|
108
181
|
} | {
|
|
109
182
|
quantities: {
|
|
110
183
|
[x: number]: number | undefined;
|
|
@@ -112,6 +185,7 @@ export declare const CartItemFactories: {
|
|
|
112
185
|
shipped_with_merchandise_id: null;
|
|
113
186
|
shipping_mode: string;
|
|
114
187
|
id: number;
|
|
188
|
+
uuid: string;
|
|
115
189
|
};
|
|
116
190
|
uuid: string;
|
|
117
191
|
subUId: string;
|
|
@@ -124,6 +198,10 @@ export declare const CartItemFactories: {
|
|
|
124
198
|
total_price_formatted: string;
|
|
125
199
|
quantity?: number | undefined;
|
|
126
200
|
time?: string | undefined;
|
|
201
|
+
mantle?: {
|
|
202
|
+
composition: Record<number, number>;
|
|
203
|
+
key?: string;
|
|
204
|
+
} | undefined;
|
|
127
205
|
display?: {
|
|
128
206
|
discounted: boolean;
|
|
129
207
|
reference_uuid: string;
|
|
@@ -134,16 +212,19 @@ export declare const CartItemFactories: {
|
|
|
134
212
|
type: "Ticket" | "Event" | "Coupon";
|
|
135
213
|
product: import('../lib/models/cart/types.ts').Product;
|
|
136
214
|
orderAttributes(): {
|
|
215
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
137
216
|
time: string | undefined;
|
|
138
217
|
quantity: number | undefined;
|
|
139
218
|
shipped_with_merchandise_id: null;
|
|
140
219
|
shipping_mode: string;
|
|
141
220
|
id: number;
|
|
221
|
+
uuid: string;
|
|
142
222
|
} | {
|
|
143
223
|
quantity: number | undefined;
|
|
144
224
|
shipped_with_merchandise_id: null;
|
|
145
225
|
shipping_mode: string;
|
|
146
226
|
id: number;
|
|
227
|
+
uuid: string;
|
|
147
228
|
} | {
|
|
148
229
|
quantities: {
|
|
149
230
|
[x: number]: number | undefined;
|
|
@@ -151,6 +232,7 @@ export declare const CartItemFactories: {
|
|
|
151
232
|
shipped_with_merchandise_id: null;
|
|
152
233
|
shipping_mode: string;
|
|
153
234
|
id: number;
|
|
235
|
+
uuid: string;
|
|
154
236
|
};
|
|
155
237
|
uuid: string;
|
|
156
238
|
subUId: string;
|
|
@@ -163,6 +245,10 @@ export declare const CartItemFactories: {
|
|
|
163
245
|
total_price_formatted: string;
|
|
164
246
|
quantity?: number | undefined;
|
|
165
247
|
time?: string | undefined;
|
|
248
|
+
mantle?: {
|
|
249
|
+
composition: Record<number, number>;
|
|
250
|
+
key?: string;
|
|
251
|
+
} | undefined;
|
|
166
252
|
display?: {
|
|
167
253
|
discounted: boolean;
|
|
168
254
|
reference_uuid: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Quotas } from '@gomus/types';
|
|
2
|
+
interface GatingQuotaOptions {
|
|
3
|
+
cap: number;
|
|
4
|
+
/** total_capacities value; defaults to `cap` (an untouched contingent). */
|
|
5
|
+
total?: number;
|
|
6
|
+
/** Timeslot key; defaults to the CartItemFactories DEFAULT_TIME so quota and item line up. */
|
|
7
|
+
time?: string;
|
|
8
|
+
/** Tickets gated by the quota; defaults to the ticket factories' default id. */
|
|
9
|
+
ticketIds?: number[];
|
|
10
|
+
quotaId?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const QuotaFactories: {
|
|
13
|
+
/** A single quota of `cap` seats gating `ticketIds` at `time`. */
|
|
14
|
+
gating({ cap, total, time, ticketIds, quotaId }: GatingQuotaOptions): Quotas;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -84,6 +84,48 @@ export declare const TicketFactories: {
|
|
|
84
84
|
restricted_shop_account: boolean;
|
|
85
85
|
dynamic_prices: null;
|
|
86
86
|
};
|
|
87
|
+
mantle(options?: Partial<ReturnType<typeof defaultTicket>>): {
|
|
88
|
+
type: ProductType;
|
|
89
|
+
id: number;
|
|
90
|
+
ticket_type: "time_slot";
|
|
91
|
+
title: string;
|
|
92
|
+
description: string;
|
|
93
|
+
selectedTime: string;
|
|
94
|
+
museum_ids: never[];
|
|
95
|
+
exhibition_ids: never[];
|
|
96
|
+
quota_ids: never[];
|
|
97
|
+
first_entry: number;
|
|
98
|
+
last_entry: number;
|
|
99
|
+
personalizeable: boolean;
|
|
100
|
+
min_persons: number;
|
|
101
|
+
max_persons: number;
|
|
102
|
+
bookable: boolean;
|
|
103
|
+
price_cents: number;
|
|
104
|
+
discount: number;
|
|
105
|
+
vat_pct: number;
|
|
106
|
+
tax_included: boolean;
|
|
107
|
+
entry_duration: number;
|
|
108
|
+
attendees: boolean;
|
|
109
|
+
identification: string;
|
|
110
|
+
free_timing: boolean;
|
|
111
|
+
is_collective: boolean;
|
|
112
|
+
is_upgrade: boolean;
|
|
113
|
+
is_mantle: boolean;
|
|
114
|
+
sub_ticket_ids: number[];
|
|
115
|
+
sub_tickets: {};
|
|
116
|
+
is_sub_ticket: boolean;
|
|
117
|
+
created_at: string;
|
|
118
|
+
updated_at: string;
|
|
119
|
+
cash_point_order: number;
|
|
120
|
+
shop_order: number;
|
|
121
|
+
capacities: {};
|
|
122
|
+
total_capacities: {};
|
|
123
|
+
max_capacity: number;
|
|
124
|
+
max_total_capacity: number;
|
|
125
|
+
shipped_with_merchandise_id: null;
|
|
126
|
+
restricted_shop_account: boolean;
|
|
127
|
+
dynamic_prices: null;
|
|
128
|
+
};
|
|
87
129
|
};
|
|
88
130
|
declare function defaultTicket(): {
|
|
89
131
|
type: ProductType;
|
|
@@ -44,6 +44,7 @@ export declare function createCapacityManager(): {
|
|
|
44
44
|
precart: Record<string, number>;
|
|
45
45
|
clearPrecart(): void;
|
|
46
46
|
setPrecartItemQuantity(ticketId: number, quantity: number): void;
|
|
47
|
+
addPrecartItemQuantity(ticketId: number, quantity: number): void;
|
|
47
48
|
getPrecartItemQuantity(ticketId: number): number;
|
|
48
49
|
timeslots(): {
|
|
49
50
|
timeSlot: string;
|
|
@@ -62,7 +63,7 @@ export declare function createCapacityManager(): {
|
|
|
62
63
|
capacity: number;
|
|
63
64
|
totalCapacity: number;
|
|
64
65
|
}[];
|
|
65
|
-
ticketCapacity(ticketId: number, timeslot: string): number;
|
|
66
|
+
ticketCapacity(ticketId: number, timeslot: string, ownQuantity?: any): number;
|
|
66
67
|
totalCapacity(ticketId: number, timeslot: string): number;
|
|
67
68
|
timeslotsOn(date: import('@internationalized/date').CalendarDate, ticketIds?: number[]): {
|
|
68
69
|
timeSlot: string;
|
|
@@ -74,6 +75,7 @@ export declare function createCapacityManager(): {
|
|
|
74
75
|
};
|
|
75
76
|
addQuotas(quotas: Quotas, saveToLocalStorage?: boolean): void;
|
|
76
77
|
addSeats(dateId: DateID, seats: Seats, saveToLocalStorage?: boolean): void;
|
|
77
|
-
capacityPolicy(item: CartItem): "quotas" | "unlimited" | "seats";
|
|
78
|
+
capacityPolicy(item: CartItem): "quotas" | "mantle" | "unlimited" | "seats";
|
|
78
79
|
capacity(cart: Cart, item: CartItem, preCart: Cart): import('./types.ts').Capacity;
|
|
80
|
+
subTicketMaxes(cart: Cart, item: CartItem, preCart: Cart): Record<number, number>;
|
|
79
81
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CapacityManager } from '../../../../../lib/models/capacity/CapacityManager.ts';
|
|
2
|
+
import { CapacityCalculator } from '../../../../../lib/models/capacity/types.ts';
|
|
3
|
+
import { Cart } from '../../../../../lib/models/cart/cart.svelte.ts';
|
|
4
|
+
import { CartItem } from '../../../../../lib/models/cart/types.ts';
|
|
5
|
+
import { UIMantleTicket } from '../../../../../lib/models/ticket/UITicket.svelte.ts';
|
|
6
|
+
/**
|
|
7
|
+
* Capacity for a Mantelticket — a verbatim port of the legacy Angular shop
|
|
8
|
+
* (`gomus-shop` `ticket.service.coffee`: `getNeededCapacityForTicket` +
|
|
9
|
+
* `getSelectableQuantitiesForTicket`).
|
|
10
|
+
*
|
|
11
|
+
* A mantle is gated off its OWN quota, exactly like a normal ticket, except one mantle
|
|
12
|
+
* draws `Σ(chosen sub-quantities)` capacity instead of one. So:
|
|
13
|
+
*
|
|
14
|
+
* maxMantles = ⌊ mantleHeadroom / Σ(composition) ⌋ (divide only when Σ > 1)
|
|
15
|
+
*
|
|
16
|
+
* The sub-tickets' own quotas are never read — the shop API never exposes them, and the
|
|
17
|
+
* mantle's own quota already reflects the venue/exhibition contingent. The chosen
|
|
18
|
+
* composition is only the divisor. Best-effort (path a): the backend is the final authority
|
|
19
|
+
* at checkout for any sub constrained by a separate quota the mantle isn't on.
|
|
20
|
+
*/
|
|
21
|
+
export declare const maxQuantity_Mantle: CapacityCalculator;
|
|
22
|
+
/** Each sub's TicketCombination max_persons — the ceiling when no quota gates the mantle. */
|
|
23
|
+
export declare const combinationSubMaxes: (p: UIMantleTicket) => Record<number, number>;
|
|
24
|
+
/**
|
|
25
|
+
* Capacity-aware ceilings for a mantle line's sub-ticket selectors, keyed by sub id.
|
|
26
|
+
*
|
|
27
|
+
* Growing a sub by one adds `quantity` seats to the line's draw (every mantle in the line gains
|
|
28
|
+
* one sub), so a sub may grow by at most ⌊spare / quantity⌋ above its CURRENT value, still
|
|
29
|
+
* bounded by its TicketCombination max_persons. `spare` is the quota headroom left after
|
|
30
|
+
* netting cart + preCart INCLUDING the sized line's own draw — unlike line sizing, nothing is
|
|
31
|
+
* credited back, because a mix edit spends seats on top of what the line already holds.
|
|
32
|
+
* Shrinking is never capacity-gated; min_persons stays the selector's floor.
|
|
33
|
+
*/
|
|
34
|
+
export declare function maxSubQuantities(manager: CapacityManager, cart: Cart, item: CartItem, preCart: Cart): Record<number, number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -24,6 +24,7 @@ export declare function createQuotaManager(quotas: Quotas): {
|
|
|
24
24
|
precart: Record<string, number>;
|
|
25
25
|
clearPrecart(): void;
|
|
26
26
|
setPrecartItemQuantity(ticketId: number, quantity: number): void;
|
|
27
|
+
addPrecartItemQuantity(ticketId: number, quantity: number): void;
|
|
27
28
|
getPrecartItemQuantity(ticketId: number): number;
|
|
28
29
|
/**
|
|
29
30
|
* a flat list of all timeslots and their capacities, respecting preCart.
|
|
@@ -50,7 +51,7 @@ export declare function createQuotaManager(quotas: Quotas): {
|
|
|
50
51
|
capacity: number;
|
|
51
52
|
totalCapacity: number;
|
|
52
53
|
}[];
|
|
53
|
-
ticketCapacity(ticketId: number, timeslot: string): number;
|
|
54
|
+
ticketCapacity(ticketId: number, timeslot: string, ownQuantity?: any): number;
|
|
54
55
|
totalCapacity(ticketId: number, timeslot: string): number;
|
|
55
56
|
timeslotsOn(date: CalendarDate, ticketIds?: number[]): {
|
|
56
57
|
timeSlot: string;
|
|
@@ -1,2 +1,25 @@
|
|
|
1
1
|
import { CapacityCalculator } from '../../../../../lib/models/capacity/types.ts';
|
|
2
|
+
import { Cart } from '../../../../../lib/models/cart/cart.svelte.ts';
|
|
3
|
+
import { CartItem } from '../../../../../lib/models/cart/types.ts';
|
|
4
|
+
import { QuotaManager } from '../../../../../lib/models/capacity/calculators/quotaManager/QuotaManager.ts';
|
|
5
|
+
/** Σ of a mantle's chosen sub-ticket quantities (the capacity one mantle draws); 0 otherwise. */
|
|
6
|
+
export declare const compositionSum: (item: CartItem) => number;
|
|
7
|
+
/**
|
|
8
|
+
* Quota capacity one cart item draws — the single source of truth shared by every quota-based
|
|
9
|
+
* calculator (a verbatim parallel to the Angular shop's `getNeededCapacityForTicket`).
|
|
10
|
+
*
|
|
11
|
+
* A mantle draws `qty × Σ(composition)` capacity off its quota; everything else draws `qty`.
|
|
12
|
+
* Used both to net items out when sizing OTHER tickets on the same quota and as the basis for a
|
|
13
|
+
* mantle's own count.
|
|
14
|
+
*/
|
|
15
|
+
export declare function neededCapacity(item: CartItem): number;
|
|
16
|
+
/**
|
|
17
|
+
* Feed cart + preCart into the quota precart as *needed capacity*, so every item sharing a quota is
|
|
18
|
+
* netted out before sizing `item`. `addPrecartItemQuantity` SUMS draws per id, so two lines of the
|
|
19
|
+
* same ticket id (e.g. two mantle lines with different mixes) both count instead of the last
|
|
20
|
+
* overwriting the rest. Returns the draw of the line being sized — captured by reference — so the
|
|
21
|
+
* caller credits back only its OWN draw via `ticketCapacity(..., ownDraw)`, never a sibling
|
|
22
|
+
* same-id line's (which must keep consuming, or the two oversell).
|
|
23
|
+
*/
|
|
24
|
+
export declare function feedQuotaPrecart(quotaManager: QuotaManager, cart: Cart, preCart: Cart, item: CartItem): number;
|
|
2
25
|
export declare const maxQuantity_Quotas: CapacityCalculator;
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { Product } from '../../../../lib/models/cart/types.ts';
|
|
2
|
+
export declare function _resetMantleKeyForTests(): void;
|
|
2
3
|
interface Options {
|
|
3
4
|
quantity?: number;
|
|
4
5
|
time?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Mantelticket only — grouped like `display`. `composition` is the chosen, editable mix
|
|
8
|
+
* (sub-ticket id → quantity), serialized to the order API as `sub_ticket_quantities`. `key`
|
|
9
|
+
* is a unique id FROZEN at creation: the line's stable identity (subUId). Every mantle add
|
|
10
|
+
* gets its own key, so mantles NEVER merge — each is a separate cart line — and editing the
|
|
11
|
+
* mix later never changes the uuid.
|
|
12
|
+
*/
|
|
13
|
+
mantle?: {
|
|
14
|
+
composition: Record<number, number>;
|
|
15
|
+
key?: string;
|
|
16
|
+
};
|
|
5
17
|
display: {
|
|
6
18
|
discounted: boolean;
|
|
7
19
|
reference_uuid: string;
|
|
@@ -15,16 +27,19 @@ export declare function createCartItem(product: Product, options?: Partial<Optio
|
|
|
15
27
|
* is passed to the Order API
|
|
16
28
|
*/
|
|
17
29
|
orderAttributes(): {
|
|
30
|
+
sub_ticket_quantities?: Record<number, number> | undefined;
|
|
18
31
|
time: string | undefined;
|
|
19
32
|
quantity: number | undefined;
|
|
20
33
|
shipped_with_merchandise_id: null;
|
|
21
34
|
shipping_mode: string;
|
|
22
35
|
id: number;
|
|
36
|
+
uuid: string;
|
|
23
37
|
} | {
|
|
24
38
|
quantity: number | undefined;
|
|
25
39
|
shipped_with_merchandise_id: null;
|
|
26
40
|
shipping_mode: string;
|
|
27
41
|
id: number;
|
|
42
|
+
uuid: string;
|
|
28
43
|
} | {
|
|
29
44
|
quantities: {
|
|
30
45
|
[product.scale_price_id]: number | undefined;
|
|
@@ -32,6 +47,7 @@ export declare function createCartItem(product: Product, options?: Partial<Optio
|
|
|
32
47
|
shipped_with_merchandise_id: null;
|
|
33
48
|
shipping_mode: string;
|
|
34
49
|
id: number;
|
|
50
|
+
uuid: string;
|
|
35
51
|
};
|
|
36
52
|
uuid: string;
|
|
37
53
|
subUId: string;
|
|
@@ -43,7 +59,19 @@ export declare function createCartItem(product: Product, options?: Partial<Optio
|
|
|
43
59
|
total_price_cents: number;
|
|
44
60
|
total_price_formatted: string;
|
|
45
61
|
quantity?: number | undefined;
|
|
46
|
-
time?: string
|
|
62
|
+
time?: string
|
|
63
|
+
/**
|
|
64
|
+
* Mantelticket only — grouped like `display`. `composition` is the chosen, editable mix
|
|
65
|
+
* (sub-ticket id → quantity), serialized to the order API as `sub_ticket_quantities`. `key`
|
|
66
|
+
* is a unique id FROZEN at creation: the line's stable identity (subUId). Every mantle add
|
|
67
|
+
* gets its own key, so mantles NEVER merge — each is a separate cart line — and editing the
|
|
68
|
+
* mix later never changes the uuid.
|
|
69
|
+
*/
|
|
70
|
+
| undefined;
|
|
71
|
+
mantle?: {
|
|
72
|
+
composition: Record<number, number>;
|
|
73
|
+
key?: string;
|
|
74
|
+
} | undefined;
|
|
47
75
|
display?: {
|
|
48
76
|
discounted: boolean;
|
|
49
77
|
reference_uuid: string;
|