@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.
Files changed (27) hide show
  1. package/README.md +46 -0
  2. package/dist-js/components/cart/components/SubRow.svelte.d.ts +1 -0
  3. package/dist-js/components/shared/quantityStepper/QuantityControl.svelte.d.ts +1 -0
  4. package/dist-js/gomus-webcomponents.css +141 -3
  5. package/dist-js/gomus-webcomponents.iife.js +21070 -20669
  6. package/dist-js/gomus-webcomponents.js +21070 -20669
  7. package/dist-js/gomus-webcomponents.min.css +1 -1
  8. package/dist-js/gomus-webcomponents.min.iife.js +37 -37
  9. package/dist-js/gomus-webcomponents.min.js +18577 -18313
  10. package/dist-js/src/components/shared/quantityStepper/QuantityControl.spec.d.ts +1 -0
  11. package/dist-js/src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/SegmentDetails.svelte.d.ts +20 -0
  12. package/dist-js/src/factories/CartItemFactories.d.ts +86 -0
  13. package/dist-js/src/factories/QuotaFactories.d.ts +16 -0
  14. package/dist-js/src/factories/TicketFactories.d.ts +42 -0
  15. package/dist-js/src/lib/models/capacity/CapacityManager.d.ts +4 -2
  16. package/dist-js/src/lib/models/capacity/calculators/mantle.d.ts +34 -0
  17. package/dist-js/src/lib/models/capacity/calculators/mantle.spec.d.ts +1 -0
  18. package/dist-js/src/lib/models/capacity/calculators/quotaManager/QuotaManager.d.ts +2 -1
  19. package/dist-js/src/lib/models/capacity/calculators/quotas.d.ts +23 -0
  20. package/dist-js/src/lib/models/cart/CartItem.d.ts +29 -1
  21. package/dist-js/src/lib/models/cart/cart.svelte.d.ts +40 -0
  22. package/dist-js/src/lib/models/cart/localStorage.svelte.d.ts +8 -0
  23. package/dist-js/src/lib/models/cart/quantityStepper.d.ts +16 -13
  24. package/dist-js/src/lib/models/ticket/UITicket.svelte.d.ts +35 -0
  25. package/dist-js/src/lib/stores/shop.svelte.d.ts +24 -2
  26. package/dist-js/src/workflowSpecs/mantle-workflow.spec.d.ts +1 -0
  27. package/package.json +1 -1
@@ -5,16 +5,19 @@ export declare function createCart(products?: Product[], contingent?: number): {
5
5
  type: "Ticket" | "Event" | "Coupon";
6
6
  product: Product;
7
7
  orderAttributes(): {
8
+ sub_ticket_quantities?: Record<number, number> | undefined;
8
9
  time: string | undefined;
9
10
  quantity: number | undefined;
10
11
  shipped_with_merchandise_id: null;
11
12
  shipping_mode: string;
12
13
  id: number;
14
+ uuid: string;
13
15
  } | {
14
16
  quantity: number | undefined;
15
17
  shipped_with_merchandise_id: null;
16
18
  shipping_mode: string;
17
19
  id: number;
20
+ uuid: string;
18
21
  } | {
19
22
  quantities: {
20
23
  [x: number]: number | undefined;
@@ -22,6 +25,7 @@ export declare function createCart(products?: Product[], contingent?: number): {
22
25
  shipped_with_merchandise_id: null;
23
26
  shipping_mode: string;
24
27
  id: number;
28
+ uuid: string;
25
29
  };
26
30
  uuid: string;
27
31
  subUId: string;
@@ -34,6 +38,10 @@ export declare function createCart(products?: Product[], contingent?: number): {
34
38
  total_price_formatted: string;
35
39
  quantity?: number | undefined;
36
40
  time?: string | undefined;
41
+ mantle?: {
42
+ composition: Record<number, number>;
43
+ key?: string;
44
+ } | undefined;
37
45
  display?: {
38
46
  discounted: boolean;
39
47
  reference_uuid: string;
@@ -47,16 +55,19 @@ export declare function createCart(products?: Product[], contingent?: number): {
47
55
  type: "Ticket" | "Event" | "Coupon";
48
56
  product: Product;
49
57
  orderAttributes(): {
58
+ sub_ticket_quantities?: Record<number, number> | undefined;
50
59
  time: string | undefined;
51
60
  quantity: number | undefined;
52
61
  shipped_with_merchandise_id: null;
53
62
  shipping_mode: string;
54
63
  id: number;
64
+ uuid: string;
55
65
  } | {
56
66
  quantity: number | undefined;
57
67
  shipped_with_merchandise_id: null;
58
68
  shipping_mode: string;
59
69
  id: number;
70
+ uuid: string;
60
71
  } | {
61
72
  quantities: {
62
73
  [x: number]: number | undefined;
@@ -64,6 +75,7 @@ export declare function createCart(products?: Product[], contingent?: number): {
64
75
  shipped_with_merchandise_id: null;
65
76
  shipping_mode: string;
66
77
  id: number;
78
+ uuid: string;
67
79
  };
68
80
  uuid: string;
69
81
  subUId: string;
@@ -76,6 +88,10 @@ export declare function createCart(products?: Product[], contingent?: number): {
76
88
  total_price_formatted: string;
77
89
  quantity?: number | undefined;
78
90
  time?: string | undefined;
91
+ mantle?: {
92
+ composition: Record<number, number>;
93
+ key?: string;
94
+ } | undefined;
79
95
  display?: {
80
96
  discounted: boolean;
81
97
  reference_uuid: string;
@@ -94,16 +110,19 @@ export declare function createCart(products?: Product[], contingent?: number): {
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 function createCart(products?: Product[], contingent?: number): {
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;
@@ -137,16 +157,19 @@ export declare function createMainCart(): {
137
157
  type: "Ticket" | "Event" | "Coupon";
138
158
  product: Product;
139
159
  orderAttributes(): {
160
+ sub_ticket_quantities?: Record<number, number> | undefined;
140
161
  time: string | undefined;
141
162
  quantity: number | undefined;
142
163
  shipped_with_merchandise_id: null;
143
164
  shipping_mode: string;
144
165
  id: number;
166
+ uuid: string;
145
167
  } | {
146
168
  quantity: number | undefined;
147
169
  shipped_with_merchandise_id: null;
148
170
  shipping_mode: string;
149
171
  id: number;
172
+ uuid: string;
150
173
  } | {
151
174
  quantities: {
152
175
  [x: number]: number | undefined;
@@ -154,6 +177,7 @@ export declare function createMainCart(): {
154
177
  shipped_with_merchandise_id: null;
155
178
  shipping_mode: string;
156
179
  id: number;
180
+ uuid: string;
157
181
  };
158
182
  uuid: string;
159
183
  subUId: string;
@@ -166,6 +190,10 @@ export declare function createMainCart(): {
166
190
  total_price_formatted: string;
167
191
  quantity?: number | undefined;
168
192
  time?: string | undefined;
193
+ mantle?: {
194
+ composition: Record<number, number>;
195
+ key?: string;
196
+ } | undefined;
169
197
  display?: {
170
198
  discounted: boolean;
171
199
  reference_uuid: string;
@@ -179,16 +207,19 @@ export declare function createMainCart(): {
179
207
  type: "Ticket" | "Event" | "Coupon";
180
208
  product: Product;
181
209
  orderAttributes(): {
210
+ sub_ticket_quantities?: Record<number, number> | undefined;
182
211
  time: string | undefined;
183
212
  quantity: number | undefined;
184
213
  shipped_with_merchandise_id: null;
185
214
  shipping_mode: string;
186
215
  id: number;
216
+ uuid: string;
187
217
  } | {
188
218
  quantity: number | undefined;
189
219
  shipped_with_merchandise_id: null;
190
220
  shipping_mode: string;
191
221
  id: number;
222
+ uuid: string;
192
223
  } | {
193
224
  quantities: {
194
225
  [x: number]: number | undefined;
@@ -196,6 +227,7 @@ export declare function createMainCart(): {
196
227
  shipped_with_merchandise_id: null;
197
228
  shipping_mode: string;
198
229
  id: number;
230
+ uuid: string;
199
231
  };
200
232
  uuid: string;
201
233
  subUId: string;
@@ -208,6 +240,10 @@ export declare function createMainCart(): {
208
240
  total_price_formatted: string;
209
241
  quantity?: number | undefined;
210
242
  time?: string | undefined;
243
+ mantle?: {
244
+ composition: Record<number, number>;
245
+ key?: string;
246
+ } | undefined;
211
247
  display?: {
212
248
  discounted: boolean;
213
249
  reference_uuid: string;
@@ -226,16 +262,19 @@ export declare function createMainCart(): {
226
262
  items: {
227
263
  type: "Ticket" | "Event" | "Coupon";
228
264
  attributes: {
265
+ sub_ticket_quantities?: Record<number, number> | undefined;
229
266
  time: string | undefined;
230
267
  quantity: number | undefined;
231
268
  shipped_with_merchandise_id: null;
232
269
  shipping_mode: string;
233
270
  id: number;
271
+ uuid: string;
234
272
  } | {
235
273
  quantity: number | undefined;
236
274
  shipped_with_merchandise_id: null;
237
275
  shipping_mode: string;
238
276
  id: number;
277
+ uuid: string;
239
278
  } | {
240
279
  quantities: {
241
280
  [x: number]: number | undefined;
@@ -243,6 +282,7 @@ export declare function createMainCart(): {
243
282
  shipped_with_merchandise_id: null;
244
283
  shipping_mode: string;
245
284
  id: number;
285
+ uuid: string;
246
286
  };
247
287
  }[];
248
288
  shipping_address_id: null;
@@ -12,16 +12,19 @@ export declare function loadFromLocalStorage(cart: Cart): {
12
12
  type: "Ticket" | "Event" | "Coupon";
13
13
  product: import('../../../../lib/models/cart/types.ts').Product;
14
14
  orderAttributes(): {
15
+ sub_ticket_quantities?: Record<number, number> | undefined;
15
16
  time: string | undefined;
16
17
  quantity: number | undefined;
17
18
  shipped_with_merchandise_id: null;
18
19
  shipping_mode: string;
19
20
  id: number;
21
+ uuid: string;
20
22
  } | {
21
23
  quantity: number | undefined;
22
24
  shipped_with_merchandise_id: null;
23
25
  shipping_mode: string;
24
26
  id: number;
27
+ uuid: string;
25
28
  } | {
26
29
  quantities: {
27
30
  [x: number]: number | undefined;
@@ -29,6 +32,7 @@ export declare function loadFromLocalStorage(cart: Cart): {
29
32
  shipped_with_merchandise_id: null;
30
33
  shipping_mode: string;
31
34
  id: number;
35
+ uuid: string;
32
36
  };
33
37
  uuid: string;
34
38
  subUId: string;
@@ -41,6 +45,10 @@ export declare function loadFromLocalStorage(cart: Cart): {
41
45
  total_price_formatted: string;
42
46
  quantity?: number | undefined;
43
47
  time?: string | undefined;
48
+ mantle?: {
49
+ composition: Record<number, number>;
50
+ key?: string;
51
+ } | undefined;
44
52
  display?: {
45
53
  discounted: boolean;
46
54
  reference_uuid: string;
@@ -1,29 +1,32 @@
1
1
  /**
2
2
  * Pure transition logic for the quantity stepper (WI 44).
3
3
  *
4
- * The set of valid quantities is `{0} ∪ [min, max]`:
5
- * - `0` means "none selected" (`go-tickets`) or a kept-but-empty line (`go-cart`).
6
- * Reaching `0` never removes a cart line — the ✕ button does that.
7
- * - any positive quantity must be at least `min` (a ticket's `min_persons`) and
4
+ * The set of valid quantities is `{floor} ∪ [min, max]`:
5
+ * - `floor` (default `0`) is the deselect value: "none selected" (`go-tickets`) or a
6
+ * kept-but-empty line (`go-cart`). Reaching it never removes a cart line — the ✕
7
+ * button does that. Mantle sub-rows pass `floor: min` instead: a sub-ticket's
8
+ * `min_persons` is a hard bottom the backend does not enforce (Angular-shop
9
+ * parity), so `−` stops there rather than dropping to `0`.
10
+ * - any other quantity must be at least `min` (a ticket's `min_persons`) and
8
11
  * at most `max` (the per-ticket / cart-wide capacity).
9
12
  *
10
13
  * The same functions drive the +/− buttons and the ArrowUp / ArrowDown / Home /
11
- * End keys so they can never disagree. There is deliberately no `floor`
12
- * parameter: both call sites bottom out at `0`.
14
+ * End keys so they can never disagree.
13
15
  */
14
16
  export type QuantityBounds = {
15
17
  min: number;
16
18
  max: number;
19
+ floor?: number;
17
20
  };
18
- /** `+`: from `0` jump to the order minimum (at least `1`); otherwise step up by one. Capped at `max`. */
21
+ /** `+`: from below the order minimum jump to it (at least `1`); otherwise step up by one. Capped at `max`. */
19
22
  export declare function increment(value: number, { min, max }: QuantityBounds): number;
20
- /** `−`: from the order minimum drop straight to `0` (skipping the invalid `1..min-1` band); otherwise step down by one. */
21
- export declare function decrement(value: number, { min }: QuantityBounds): number;
22
- /** Clamp a typed value into `{0} ∪ [min, max]`: `≤0` → `0`, `0<v<min` rounds up to `min`, `>max` → `max`. */
23
- export declare function clampTyped(raw: number, { min, max }: QuantityBounds): number;
23
+ /** `−`: from the order minimum drop straight to `floor` (skipping the invalid band); otherwise step down by one. */
24
+ export declare function decrement(value: number, { min, floor }: QuantityBounds): number;
25
+ /** Clamp a typed value into `{floor} ∪ [min, max]`: `≤0` → `floor`, `0<v<min` rounds up to `min`, `>max` → `max`. */
26
+ export declare function clampTyped(raw: number, { min, max, floor }: QuantityBounds): number;
24
27
  /** Whether `value` is a committable quantity for these bounds. */
25
- export declare function isValid(value: number, { min, max }: QuantityBounds): boolean;
28
+ export declare function isValid(value: number, { min, max, floor }: QuantityBounds): boolean;
26
29
  /** Whether `+` can change the value (false → the button is `aria-disabled`). */
27
30
  export declare function canIncrement(value: number, bounds: QuantityBounds): boolean;
28
31
  /** Whether `−` can change the value (false → the button is `aria-disabled`). */
29
- export declare function canDecrement(value: number): boolean;
32
+ export declare function canDecrement(value: number, { floor }: QuantityBounds): boolean;
@@ -6,6 +6,41 @@ interface Options {
6
6
  export type UITicketType = 'timeslot' | 'annual' | 'day' | 'event:ticket';
7
7
  export type UITicket = ReturnType<typeof createUITicket>;
8
8
  export declare function isUITicket(x: BaseProduct | null | undefined): x is UITicket;
9
+ /**
10
+ * A sub-ticket entry from a mantle's `sub_tickets` map, normalized for the UI:
11
+ * the map key is lifted to a numeric `id`, all-optional fields get defaults, and
12
+ * snake_case is kept to match the API / the rest of `UITicket`.
13
+ * `min_persons`/`max_persons` are the TicketCombination bounds — advisory selector
14
+ * hints; the backend enforces each sub against its own ticket's max_persons.
15
+ */
16
+ export type UISubTicketDef = {
17
+ id: number;
18
+ title: string;
19
+ description: string | null;
20
+ min_persons: number;
21
+ max_persons: number;
22
+ };
23
+ /** Raw sub-ticket shape as the API spreads it onto a mantle's `sub_tickets` map. */
24
+ type RawSubTicket = {
25
+ title?: string;
26
+ description?: string | null;
27
+ min_persons?: number;
28
+ max_persons?: number;
29
+ };
30
+ /** A Mantelticket: a UITicket whose `sub_tickets` map is populated. */
31
+ export type UIMantleTicket = UITicket & {
32
+ is_mantle: true;
33
+ sub_tickets: Record<string, RawSubTicket>;
34
+ };
35
+ /**
36
+ * Mantle-ness is derived from the raw API fields already spread onto every
37
+ * UITicket — the base type stays pure (no `subTickets` field on non-mantles).
38
+ * A ticket is a mantle only when `is_mantle` is set AND it actually carries
39
+ * sub-tickets (the `sub_tickets` map is feature-flagged and may be empty).
40
+ */
41
+ export declare function isMantleTicket(x: unknown): x is UIMantleTicket;
42
+ /** Normalizes a mantle's raw `sub_tickets` map into ordered UI sub-ticket defs. */
43
+ export declare function subTicketDefs(mantle: UIMantleTicket): UISubTicketDef[];
9
44
  export declare function createUITicket(apiTicket: Ticket | AnnualTicket | NormalTickets[number], options?: Options): {
10
45
  selectedTime: string;
11
46
  type: "Ticket";
@@ -42,6 +42,7 @@ export declare class Shop {
42
42
  precart: Record<string, number>;
43
43
  clearPrecart(): void;
44
44
  setPrecartItemQuantity(ticketId: number, quantity: number): void;
45
+ addPrecartItemQuantity(ticketId: number, quantity: number): void;
45
46
  getPrecartItemQuantity(ticketId: number): number;
46
47
  timeslots(): {
47
48
  timeSlot: string;
@@ -60,7 +61,7 @@ export declare class Shop {
60
61
  capacity: number;
61
62
  totalCapacity: number;
62
63
  }[];
63
- ticketCapacity(ticketId: number, timeslot: string): number;
64
+ ticketCapacity(ticketId: number, timeslot: string, ownQuantity?: any): number;
64
65
  totalCapacity(ticketId: number, timeslot: string): number;
65
66
  timeslotsOn(date: import('@internationalized/date').CalendarDate, ticketIds?: number[]): {
66
67
  timeSlot: string;
@@ -72,24 +73,28 @@ export declare class Shop {
72
73
  };
73
74
  addQuotas(quotas: import('@gomus/types').Quotas, saveToLocalStorage?: boolean): void;
74
75
  addSeats(dateId: import('../../../lib/models/capacity/CapacityManager.ts').DateID, seats: import('../../../lib/models/capacity/CapacityManager.ts').Seats, saveToLocalStorage?: boolean): void;
75
- capacityPolicy(item: import('../models/cart/types').CartItem): "quotas" | "unlimited" | "seats";
76
+ capacityPolicy(item: import('../models/cart/types').CartItem): "quotas" | "mantle" | "unlimited" | "seats";
76
77
  capacity(cart: Cart, item: import('../models/cart/types').CartItem, preCart: Cart): import('../models/capacity/types').Capacity;
78
+ subTicketMaxes(cart: Cart, item: import('../models/cart/types').CartItem, preCart: Cart): Record<number, number>;
77
79
  };
78
80
  get cart(): {
79
81
  items: {
80
82
  type: "Ticket" | "Event" | "Coupon";
81
83
  product: import('../models/cart/types').Product;
82
84
  orderAttributes(): {
85
+ sub_ticket_quantities?: Record<number, number> | undefined;
83
86
  time: string | undefined;
84
87
  quantity: number | undefined;
85
88
  shipped_with_merchandise_id: null;
86
89
  shipping_mode: string;
87
90
  id: number;
91
+ uuid: string;
88
92
  } | {
89
93
  quantity: number | undefined;
90
94
  shipped_with_merchandise_id: null;
91
95
  shipping_mode: string;
92
96
  id: number;
97
+ uuid: string;
93
98
  } | {
94
99
  quantities: {
95
100
  [x: number]: number | undefined;
@@ -97,6 +102,7 @@ export declare class Shop {
97
102
  shipped_with_merchandise_id: null;
98
103
  shipping_mode: string;
99
104
  id: number;
105
+ uuid: string;
100
106
  };
101
107
  uuid: string;
102
108
  subUId: string;
@@ -109,6 +115,10 @@ export declare class Shop {
109
115
  total_price_formatted: string;
110
116
  quantity?: number | undefined;
111
117
  time?: string | undefined;
118
+ mantle?: {
119
+ composition: Record<number, number>;
120
+ key?: string;
121
+ } | undefined;
112
122
  display?: {
113
123
  discounted: boolean;
114
124
  reference_uuid: string;
@@ -122,16 +132,19 @@ export declare class Shop {
122
132
  type: "Ticket" | "Event" | "Coupon";
123
133
  product: import('../models/cart/types').Product;
124
134
  orderAttributes(): {
135
+ sub_ticket_quantities?: Record<number, number> | undefined;
125
136
  time: string | undefined;
126
137
  quantity: number | undefined;
127
138
  shipped_with_merchandise_id: null;
128
139
  shipping_mode: string;
129
140
  id: number;
141
+ uuid: string;
130
142
  } | {
131
143
  quantity: number | undefined;
132
144
  shipped_with_merchandise_id: null;
133
145
  shipping_mode: string;
134
146
  id: number;
147
+ uuid: string;
135
148
  } | {
136
149
  quantities: {
137
150
  [x: number]: number | undefined;
@@ -139,6 +152,7 @@ export declare class Shop {
139
152
  shipped_with_merchandise_id: null;
140
153
  shipping_mode: string;
141
154
  id: number;
155
+ uuid: string;
142
156
  };
143
157
  uuid: string;
144
158
  subUId: string;
@@ -151,6 +165,10 @@ export declare class Shop {
151
165
  total_price_formatted: string;
152
166
  quantity?: number | undefined;
153
167
  time?: string | undefined;
168
+ mantle?: {
169
+ composition: Record<number, number>;
170
+ key?: string;
171
+ } | undefined;
154
172
  display?: {
155
173
  discounted: boolean;
156
174
  reference_uuid: string;
@@ -166,16 +184,19 @@ export declare class Shop {
166
184
  items: {
167
185
  type: "Ticket" | "Event" | "Coupon";
168
186
  attributes: {
187
+ sub_ticket_quantities?: Record<number, number> | undefined;
169
188
  time: string | undefined;
170
189
  quantity: number | undefined;
171
190
  shipped_with_merchandise_id: null;
172
191
  shipping_mode: string;
173
192
  id: number;
193
+ uuid: string;
174
194
  } | {
175
195
  quantity: number | undefined;
176
196
  shipped_with_merchandise_id: null;
177
197
  shipping_mode: string;
178
198
  id: number;
199
+ uuid: string;
179
200
  } | {
180
201
  quantities: {
181
202
  [x: number]: number | undefined;
@@ -183,6 +204,7 @@ export declare class Shop {
183
204
  shipped_with_merchandise_id: null;
184
205
  shipping_mode: string;
185
206
  id: number;
207
+ uuid: string;
186
208
  };
187
209
  }[];
188
210
  shipping_address_id: null;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "3.12.0",
7
+ "version": "4.1.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",