@gomusdev/web-components 4.1.1 → 4.3.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 +15 -0
  2. package/dist-js/components/cart/components/itemTitles/Tour.svelte.d.ts +1 -0
  3. package/dist-js/components/membershipActivation/MembershipActivation.svelte.d.ts +1 -0
  4. package/dist-js/components/order/components/subcomponents/breakdown/items/Tour.svelte.d.ts +1 -0
  5. package/dist-js/gomus-webcomponents.iife.js +563 -195
  6. package/dist-js/gomus-webcomponents.js +563 -195
  7. package/dist-js/gomus-webcomponents.min.iife.js +47 -47
  8. package/dist-js/gomus-webcomponents.min.js +7687 -7451
  9. package/dist-js/src/components/cart/components/itemTitles/Tour.spec.d.ts +1 -0
  10. package/dist-js/src/components/membershipActivation/entry.d.ts +0 -0
  11. package/dist-js/src/components/membershipActivation/specs/MembershipActivation.spec.d.ts +1 -0
  12. package/dist-js/src/components/order/components/subcomponents/breakdown/items/Tour.spec.d.ts +1 -0
  13. package/dist-js/src/components/ticketSelection/subcomponents/tickets/subcomponents/segment/SegmentDetails.svelte.d.ts +21 -3
  14. package/dist-js/src/factories/CartItemFactories.d.ts +94 -5
  15. package/dist-js/src/factories/TourFactories.d.ts +41 -0
  16. package/dist-js/src/go/cart.d.ts +19 -0
  17. package/dist-js/src/go/cart.spec.d.ts +1 -0
  18. package/dist-js/src/go/go.d.ts +5 -1
  19. package/dist-js/src/lib/helpers/translations.d.ts +1 -0
  20. package/dist-js/src/lib/models/cart/CartItem.d.ts +7 -1
  21. package/dist-js/src/lib/models/cart/cart.svelte.d.ts +42 -6
  22. package/dist-js/src/lib/models/cart/localStorage.svelte.d.ts +7 -1
  23. package/dist-js/src/lib/models/cart/types.d.ts +4 -1
  24. package/dist-js/src/lib/models/tour/UITour.spec.d.ts +1 -0
  25. package/dist-js/src/lib/models/tour/UITour.svelte.d.ts +99 -0
  26. package/dist-js/src/lib/stores/shop.svelte.d.ts +23 -4
  27. package/package.json +2 -2
@@ -5,7 +5,7 @@ export type TicketSegmentFilter = FilterName | 'custom';
5
5
  export declare class SegmentDetails {
6
6
  preCart: {
7
7
  items: {
8
- type: "Ticket" | "Event" | "Coupon";
8
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
9
9
  product: import('../../../../../../lib/models/cart/types').Product;
10
10
  orderAttributes(): {
11
11
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -29,6 +29,12 @@ export declare class SegmentDetails {
29
29
  shipping_mode: string;
30
30
  id: number;
31
31
  uuid: string;
32
+ } | {
33
+ start_time: string | undefined;
34
+ shipped_with_merchandise_id: null;
35
+ shipping_mode: string;
36
+ id: number;
37
+ uuid: string;
32
38
  };
33
39
  uuid: string;
34
40
  subUId: string;
@@ -55,7 +61,7 @@ export declare class SegmentDetails {
55
61
  paymentModeId: undefined;
56
62
  uid: string;
57
63
  readonly nonEmptyItems: {
58
- type: "Ticket" | "Event" | "Coupon";
64
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
59
65
  product: import('../../../../../../lib/models/cart/types').Product;
60
66
  orderAttributes(): {
61
67
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -79,6 +85,12 @@ export declare class SegmentDetails {
79
85
  shipping_mode: string;
80
86
  id: number;
81
87
  uuid: string;
88
+ } | {
89
+ start_time: string | undefined;
90
+ shipped_with_merchandise_id: null;
91
+ shipping_mode: string;
92
+ id: number;
93
+ uuid: string;
82
94
  };
83
95
  uuid: string;
84
96
  subUId: string;
@@ -108,7 +120,7 @@ export declare class SegmentDetails {
108
120
  toString(): string;
109
121
  orderData(): {
110
122
  items: {
111
- type: "Ticket" | "Event" | "Coupon";
123
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
112
124
  attributes: {
113
125
  sub_ticket_quantities?: Record<number, number> | undefined;
114
126
  time: string | undefined;
@@ -131,6 +143,12 @@ export declare class SegmentDetails {
131
143
  shipping_mode: string;
132
144
  id: number;
133
145
  uuid: string;
146
+ } | {
147
+ start_time: string | undefined;
148
+ shipped_with_merchandise_id: null;
149
+ shipping_mode: string;
150
+ id: number;
151
+ uuid: string;
134
152
  };
135
153
  }[];
136
154
  shipping_address_id: null;
@@ -1,3 +1,4 @@
1
+ import { TourAttributes } from '../../lib/models/tour/UITour.svelte.ts';
1
2
  import { EventTicketFactories } from './EventTicketFactories.ts';
2
3
  import { TicketFactories } from './TicketFactories.ts';
3
4
  export declare const DEFAULT_TIME = "2122-09-18T12:00:00+02:00";
@@ -13,6 +14,11 @@ interface EventCartItemOptions {
13
14
  event_title?: string;
14
15
  eventTicket?: Partial<ReturnType<typeof EventTicketFactories.scaled>>;
15
16
  }
17
+ interface TourCartItemOptions {
18
+ time?: string;
19
+ tour?: Partial<TourAttributes>;
20
+ instanceKey?: string;
21
+ }
16
22
  interface MantleCartItemOptions {
17
23
  quantity?: number;
18
24
  time?: string;
@@ -20,8 +26,61 @@ interface MantleCartItemOptions {
20
26
  subTicketQuantities?: Record<number, number>;
21
27
  }
22
28
  export declare const CartItemFactories: {
29
+ tour({ time, tour, instanceKey }?: TourCartItemOptions): {
30
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
31
+ product: import('../lib/models/cart/types.ts').Product;
32
+ orderAttributes(): {
33
+ sub_ticket_quantities?: Record<number, number> | undefined;
34
+ time: string | undefined;
35
+ quantity: number | undefined;
36
+ shipped_with_merchandise_id: null;
37
+ shipping_mode: string;
38
+ id: number;
39
+ uuid: string;
40
+ } | {
41
+ quantity: number | undefined;
42
+ shipped_with_merchandise_id: null;
43
+ shipping_mode: string;
44
+ id: number;
45
+ uuid: string;
46
+ } | {
47
+ quantities: {
48
+ [x: number]: number | undefined;
49
+ };
50
+ shipped_with_merchandise_id: null;
51
+ shipping_mode: string;
52
+ id: number;
53
+ uuid: string;
54
+ } | {
55
+ start_time: string | undefined;
56
+ shipped_with_merchandise_id: null;
57
+ shipping_mode: string;
58
+ id: number;
59
+ uuid: string;
60
+ };
61
+ uuid: string;
62
+ subUId: string;
63
+ toString(): string;
64
+ price_cents: number;
65
+ price_formatted: string;
66
+ final_price_cents: number;
67
+ final_price_formatted: string;
68
+ total_price_cents: number;
69
+ total_price_formatted: string;
70
+ quantity?: number | undefined;
71
+ time?: string | undefined;
72
+ mantle?: {
73
+ composition: Record<number, number>;
74
+ key?: string;
75
+ } | undefined;
76
+ display?: {
77
+ discounted: boolean;
78
+ reference_uuid: string;
79
+ originalPrice: number;
80
+ } | undefined;
81
+ };
23
82
  timeslot({ quantity, time, ticket }?: TicketCartItemOptions): {
24
- type: "Ticket" | "Event" | "Coupon";
83
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
25
84
  product: import('../lib/models/cart/types.ts').Product;
26
85
  orderAttributes(): {
27
86
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -45,6 +104,12 @@ export declare const CartItemFactories: {
45
104
  shipping_mode: string;
46
105
  id: number;
47
106
  uuid: string;
107
+ } | {
108
+ start_time: string | undefined;
109
+ shipped_with_merchandise_id: null;
110
+ shipping_mode: string;
111
+ id: number;
112
+ uuid: string;
48
113
  };
49
114
  uuid: string;
50
115
  subUId: string;
@@ -68,7 +133,7 @@ export declare const CartItemFactories: {
68
133
  } | undefined;
69
134
  };
70
135
  day({ quantity, time, ticket }?: TicketCartItemOptions): {
71
- type: "Ticket" | "Event" | "Coupon";
136
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
72
137
  product: import('../lib/models/cart/types.ts').Product;
73
138
  orderAttributes(): {
74
139
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -92,6 +157,12 @@ export declare const CartItemFactories: {
92
157
  shipping_mode: string;
93
158
  id: number;
94
159
  uuid: string;
160
+ } | {
161
+ start_time: string | undefined;
162
+ shipped_with_merchandise_id: null;
163
+ shipping_mode: string;
164
+ id: number;
165
+ uuid: string;
95
166
  };
96
167
  uuid: string;
97
168
  subUId: string;
@@ -115,7 +186,7 @@ export declare const CartItemFactories: {
115
186
  } | undefined;
116
187
  };
117
188
  mantle({ quantity, time, ticket, subTicketQuantities }?: MantleCartItemOptions): {
118
- type: "Ticket" | "Event" | "Coupon";
189
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
119
190
  product: import('../lib/models/cart/types.ts').Product;
120
191
  orderAttributes(): {
121
192
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -139,6 +210,12 @@ export declare const CartItemFactories: {
139
210
  shipping_mode: string;
140
211
  id: number;
141
212
  uuid: string;
213
+ } | {
214
+ start_time: string | undefined;
215
+ shipped_with_merchandise_id: null;
216
+ shipping_mode: string;
217
+ id: number;
218
+ uuid: string;
142
219
  };
143
220
  uuid: string;
144
221
  subUId: string;
@@ -162,7 +239,7 @@ export declare const CartItemFactories: {
162
239
  } | undefined;
163
240
  };
164
241
  scaledEvent({ quantity, time, dateId, event_title, eventTicket, }?: EventCartItemOptions): {
165
- type: "Ticket" | "Event" | "Coupon";
242
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
166
243
  product: import('../lib/models/cart/types.ts').Product;
167
244
  orderAttributes(): {
168
245
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -186,6 +263,12 @@ export declare const CartItemFactories: {
186
263
  shipping_mode: string;
187
264
  id: number;
188
265
  uuid: string;
266
+ } | {
267
+ start_time: string | undefined;
268
+ shipped_with_merchandise_id: null;
269
+ shipping_mode: string;
270
+ id: number;
271
+ uuid: string;
189
272
  };
190
273
  uuid: string;
191
274
  subUId: string;
@@ -209,7 +292,7 @@ export declare const CartItemFactories: {
209
292
  } | undefined;
210
293
  };
211
294
  flatEvent({ quantity, time, dateId, event_title, eventTicket, }?: EventCartItemOptions): {
212
- type: "Ticket" | "Event" | "Coupon";
295
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
213
296
  product: import('../lib/models/cart/types.ts').Product;
214
297
  orderAttributes(): {
215
298
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -233,6 +316,12 @@ export declare const CartItemFactories: {
233
316
  shipping_mode: string;
234
317
  id: number;
235
318
  uuid: string;
319
+ } | {
320
+ start_time: string | undefined;
321
+ shipped_with_merchandise_id: null;
322
+ shipping_mode: string;
323
+ id: number;
324
+ uuid: string;
236
325
  };
237
326
  uuid: string;
238
327
  subUId: string;
@@ -0,0 +1,41 @@
1
+ import { TourAttributes } from '../../lib/models/tour/UITour.svelte.ts';
2
+ import { OrderItem } from '@gomus/types';
3
+ export type AddTourOptionsShape = TourAttributes & {
4
+ time: string;
5
+ };
6
+ type TourOrderItem = Extract<OrderItem, {
7
+ type: 'Tour';
8
+ }>;
9
+ export declare const TourFactories: {
10
+ /** The camelCase options an integrator passes to go.cart.addTour. */
11
+ addTourOptions(overrides?: Partial<AddTourOptionsShape>): AddTourOptionsShape;
12
+ /** A UITour product with a fixed instanceKey for stable uuids/snapshots. */
13
+ tour(overrides?: Partial<TourAttributes>, instanceKey?: string): {
14
+ type: "Tour";
15
+ description: string;
16
+ price_cents: number;
17
+ tax_included: boolean;
18
+ vat_pct: number;
19
+ instanceKey: string;
20
+ wire: Record<string, unknown>;
21
+ id: number;
22
+ title: string;
23
+ participants: number;
24
+ languageId: number;
25
+ totalPriceCents: number;
26
+ language?: string;
27
+ gradeId?: number;
28
+ ageGroupId?: number;
29
+ quantities?: Record<string, number>;
30
+ surcharges?: Record<string, number>;
31
+ attendees?: Record<string, unknown>[];
32
+ customs?: Record<string, unknown>;
33
+ equipment?: import('../../lib/models/tour/UITour.svelte.ts').TourEquipment[];
34
+ };
35
+ /**
36
+ * A backend order-echo tour item (the shape go-order-breakdown renders).
37
+ * `attributes` overrides shallow-merge onto the tour_sale defaults.
38
+ */
39
+ orderItem(overrides?: Partial<TourOrderItem>): TourOrderItem;
40
+ };
41
+ export {};
@@ -0,0 +1,19 @@
1
+ import { TourAttributes } from '../../lib/models/tour/UITour.svelte.ts';
2
+ /**
3
+ * Options for go.cart.addTour (WI #128). camelCase like #129's addTicket;
4
+ * the snake_case wire translation happens inside createUITour.
5
+ */
6
+ export type AddTourOptions = TourAttributes & {
7
+ /** ISO date-time of the tour start — becomes tour_cart_item.start_time. */
8
+ time: string;
9
+ };
10
+ /**
11
+ * Adds a group-tour booking to the cart and resolves with the cart line's
12
+ * uuid. Every call appends a NEW line — identical bookings coexist; use the
13
+ * returned uuid to deduplicate or remove.
14
+ *
15
+ * Tours are not priced by the shop API: `totalPriceCents` is the
16
+ * integrator-supplied booking total (incl. mandatory surcharges) and is
17
+ * verified by the backend only at checkout.
18
+ */
19
+ export declare function addTour(options: AddTourOptions): Promise<string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,8 +1,9 @@
1
1
  import { OrdersResult, ValidateTokenResult } from '../../lib/stores/shop.svelte.ts';
2
2
  import { OrdersParams } from '@gomus/types';
3
+ import { AddTourOptions } from '../../go/cart.ts';
3
4
  export type { OrdersResult, ValidateTokenResult } from '../../lib/stores/shop.svelte.ts';
4
5
  export type Command = {
5
- method: 'load' | 'config' | 'init';
6
+ method: 'load' | 'config' | 'init' | 'cart.addTour' | (string & {});
6
7
  options: Record<string, unknown>;
7
8
  };
8
9
  export declare function initGo(window: {
@@ -20,6 +21,9 @@ export declare const go: {
20
21
  getCustomer: () => Promise<ValidateTokenResult>;
21
22
  getOrders: (params?: OrdersParams) => Promise<OrdersResult>;
22
23
  };
24
+ cart: {
25
+ addTour: (options: AddTourOptions) => Promise<string>;
26
+ };
23
27
  };
24
28
  export type Go = typeof go;
25
29
  declare global {
@@ -48,6 +48,7 @@ export declare const translations: {
48
48
  'cart.item.aria.removeItem': string;
49
49
  'cart.item.booking.desc': string;
50
50
  'cart.item.bookingSeat.desc': string;
51
+ 'cart.item.participants': string;
51
52
  'cart.item.ticketSale.day': string;
52
53
  'cart.item.ticketSale.download': string;
53
54
  'cart.item.ticketSale.time': string;
@@ -21,7 +21,7 @@ interface Options {
21
21
  };
22
22
  }
23
23
  export declare function createCartItem(product: Product, options?: Partial<Options>): {
24
- type: "Ticket" | "Event" | "Coupon";
24
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
25
25
  product: Product;
26
26
  /**
27
27
  * is passed to the Order API
@@ -48,6 +48,12 @@ export declare function createCartItem(product: Product, options?: Partial<Optio
48
48
  shipping_mode: string;
49
49
  id: number;
50
50
  uuid: string;
51
+ } | {
52
+ start_time: string | undefined;
53
+ shipped_with_merchandise_id: null;
54
+ shipping_mode: string;
55
+ id: number;
56
+ uuid: string;
51
57
  };
52
58
  uuid: string;
53
59
  subUId: string;
@@ -2,7 +2,7 @@ import { CartItem, CouponItem, Product } from '../../../../lib/models/cart/types
2
2
  export type Cart = ReturnType<typeof createCart>;
3
3
  export declare function createCart(products?: Product[], contingent?: number): {
4
4
  items: {
5
- type: "Ticket" | "Event" | "Coupon";
5
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
6
6
  product: Product;
7
7
  orderAttributes(): {
8
8
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -26,6 +26,12 @@ export declare function createCart(products?: Product[], contingent?: number): {
26
26
  shipping_mode: string;
27
27
  id: number;
28
28
  uuid: string;
29
+ } | {
30
+ start_time: string | undefined;
31
+ shipped_with_merchandise_id: null;
32
+ shipping_mode: string;
33
+ id: number;
34
+ uuid: string;
29
35
  };
30
36
  uuid: string;
31
37
  subUId: string;
@@ -52,7 +58,7 @@ export declare function createCart(products?: Product[], contingent?: number): {
52
58
  paymentModeId: undefined;
53
59
  uid: string;
54
60
  readonly nonEmptyItems: {
55
- type: "Ticket" | "Event" | "Coupon";
61
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
56
62
  product: Product;
57
63
  orderAttributes(): {
58
64
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -76,6 +82,12 @@ export declare function createCart(products?: Product[], contingent?: number): {
76
82
  shipping_mode: string;
77
83
  id: number;
78
84
  uuid: string;
85
+ } | {
86
+ start_time: string | undefined;
87
+ shipped_with_merchandise_id: null;
88
+ shipping_mode: string;
89
+ id: number;
90
+ uuid: string;
79
91
  };
80
92
  uuid: string;
81
93
  subUId: string;
@@ -108,7 +120,7 @@ export declare function createCart(products?: Product[], contingent?: number): {
108
120
  toString(): string;
109
121
  orderData(): {
110
122
  items: {
111
- type: "Ticket" | "Event" | "Coupon";
123
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
112
124
  attributes: {
113
125
  sub_ticket_quantities?: Record<number, number> | undefined;
114
126
  time: string | undefined;
@@ -131,6 +143,12 @@ export declare function createCart(products?: Product[], contingent?: number): {
131
143
  shipping_mode: string;
132
144
  id: number;
133
145
  uuid: string;
146
+ } | {
147
+ start_time: string | undefined;
148
+ shipped_with_merchandise_id: null;
149
+ shipping_mode: string;
150
+ id: number;
151
+ uuid: string;
134
152
  };
135
153
  }[];
136
154
  shipping_address_id: null;
@@ -154,7 +172,7 @@ export declare function createCart(products?: Product[], contingent?: number): {
154
172
  export declare function formatCurrency(priceCents: number): string;
155
173
  export declare function createMainCart(): {
156
174
  items: {
157
- type: "Ticket" | "Event" | "Coupon";
175
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
158
176
  product: Product;
159
177
  orderAttributes(): {
160
178
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -178,6 +196,12 @@ export declare function createMainCart(): {
178
196
  shipping_mode: string;
179
197
  id: number;
180
198
  uuid: string;
199
+ } | {
200
+ start_time: string | undefined;
201
+ shipped_with_merchandise_id: null;
202
+ shipping_mode: string;
203
+ id: number;
204
+ uuid: string;
181
205
  };
182
206
  uuid: string;
183
207
  subUId: string;
@@ -204,7 +228,7 @@ export declare function createMainCart(): {
204
228
  paymentModeId: undefined;
205
229
  uid: string;
206
230
  readonly nonEmptyItems: {
207
- type: "Ticket" | "Event" | "Coupon";
231
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
208
232
  product: Product;
209
233
  orderAttributes(): {
210
234
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -228,6 +252,12 @@ export declare function createMainCart(): {
228
252
  shipping_mode: string;
229
253
  id: number;
230
254
  uuid: string;
255
+ } | {
256
+ start_time: string | undefined;
257
+ shipped_with_merchandise_id: null;
258
+ shipping_mode: string;
259
+ id: number;
260
+ uuid: string;
231
261
  };
232
262
  uuid: string;
233
263
  subUId: string;
@@ -260,7 +290,7 @@ export declare function createMainCart(): {
260
290
  toString(): string;
261
291
  orderData(): {
262
292
  items: {
263
- type: "Ticket" | "Event" | "Coupon";
293
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
264
294
  attributes: {
265
295
  sub_ticket_quantities?: Record<number, number> | undefined;
266
296
  time: string | undefined;
@@ -283,6 +313,12 @@ export declare function createMainCart(): {
283
313
  shipping_mode: string;
284
314
  id: number;
285
315
  uuid: string;
316
+ } | {
317
+ start_time: string | undefined;
318
+ shipped_with_merchandise_id: null;
319
+ shipping_mode: string;
320
+ id: number;
321
+ uuid: string;
286
322
  };
287
323
  }[];
288
324
  shipping_address_id: null;
@@ -9,7 +9,7 @@ import { CartItem } from '../../../../lib/models/cart/types.ts';
9
9
  export declare function generateCartItem(cartItem: any): CartItem | undefined;
10
10
  export declare function clearLocalStorage(): void;
11
11
  export declare function loadFromLocalStorage(cart: Cart): {
12
- type: "Ticket" | "Event" | "Coupon";
12
+ type: "Ticket" | "Event" | "Coupon" | "Tour";
13
13
  product: import('../../../../lib/models/cart/types.ts').Product;
14
14
  orderAttributes(): {
15
15
  sub_ticket_quantities?: Record<number, number> | undefined;
@@ -33,6 +33,12 @@ export declare function loadFromLocalStorage(cart: Cart): {
33
33
  shipping_mode: string;
34
34
  id: number;
35
35
  uuid: string;
36
+ } | {
37
+ start_time: string | undefined;
38
+ shipped_with_merchandise_id: null;
39
+ shipping_mode: string;
40
+ id: number;
41
+ uuid: string;
36
42
  };
37
43
  uuid: string;
38
44
  subUId: string;
@@ -2,7 +2,8 @@ import { createCartItem } from '../../../../lib/models/cart/CartItem.ts';
2
2
  import { UICoupon } from '../../../../lib/models/coupon/UICoupon.svelte.ts';
3
3
  import { UIEventTicket } from '../../../../lib/models/eventTicket/UIEventTicket.svelte.ts';
4
4
  import { UITicket } from '../../../../lib/models/ticket/UITicket.svelte.ts';
5
- export type ProductType = 'Ticket' | 'Event' | 'Coupon';
5
+ import { UITour } from '../../../../lib/models/tour/UITour.svelte.ts';
6
+ export type ProductType = 'Ticket' | 'Event' | 'Coupon' | 'Tour';
6
7
  export type CartItem = ReturnType<typeof createCartItem>;
7
8
  /**
8
9
  * A redeemed coupon code held in the cart. `kind` mirrors the German domain
@@ -41,4 +42,6 @@ export type Product = (UITicket & {
41
42
  type: 'Event';
42
43
  }) | (UICoupon & {
43
44
  type: 'Coupon';
45
+ }) | (UITour & {
46
+ type: 'Tour';
44
47
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Group-tour product added programmatically via go.cart.addTour (WI #128).
3
+ *
4
+ * Tours are not priced by the shop API: POST /api/v4/cart echoes tour lines
5
+ * verbatim, so `totalPriceCents` is the integrator-supplied booking total
6
+ * (base + all mandatory surcharges). The first authoritative price check is
7
+ * POST /api/v4/orders ("invalid client's total estimate").
8
+ */
9
+ export type TourEquipment = {
10
+ id: number;
11
+ quantity: number;
12
+ };
13
+ export type TourAttributes = {
14
+ /** Group-tour product id (public tours are rejected by the order path). */
15
+ id: number;
16
+ /** Display title for the cart / order line — the API returns none for tours. */
17
+ title: string;
18
+ /** Total headcount. Sent as `quantity` unless `quantities` is given. */
19
+ participants: number;
20
+ /** Required by the backend — orders without it fail with "language needed". */
21
+ languageId: number;
22
+ /** Integrator-supplied TOTAL booking price in cents, incl. mandatory surcharges. */
23
+ totalPriceCents: number;
24
+ /** Display language name for the cart line, e.g. "Deutsch". */
25
+ language?: string;
26
+ gradeId?: number;
27
+ ageGroupId?: number;
28
+ /**
29
+ * scale_price_id (string keys) → amount. Required by the backend whenever
30
+ * the tour has shop scale prices; must sum to `participants`.
31
+ */
32
+ quantities?: Record<string, number>;
33
+ /**
34
+ * price_surcharge_id (string keys) → quantity. Mandatory surcharges must be
35
+ * acknowledged here or the order fails ("mandatory surcharge not found").
36
+ */
37
+ surcharges?: Record<string, number>;
38
+ /** Passed through as attendees_attributes. */
39
+ attendees?: Record<string, unknown>[];
40
+ /** Free-form custom fields, passed through verbatim. */
41
+ customs?: Record<string, unknown>;
42
+ /** Equipment bookings: equipment_category_id + quantity. */
43
+ equipment?: TourEquipment[];
44
+ };
45
+ export type UITour = ReturnType<typeof createUITour>;
46
+ export declare function isUITour(x: {
47
+ type?: string;
48
+ } | null | undefined): x is UITour;
49
+ interface Options {
50
+ /**
51
+ * Uniqueness key for the cart-line uuid. Every addTour call appends a NEW
52
+ * cart line (no merge — locked contract), so each UITour needs its own key;
53
+ * it is persisted with the product so rehydrated lines keep their identity.
54
+ * Overridable for deterministic factories/specs.
55
+ */
56
+ instanceKey?: string;
57
+ }
58
+ export declare function createUITour(attributes: TourAttributes, options?: Options): {
59
+ type: "Tour";
60
+ description: string;
61
+ price_cents: number;
62
+ tax_included: boolean;
63
+ vat_pct: number;
64
+ instanceKey: string;
65
+ wire: Record<string, unknown>;
66
+ /** Group-tour product id (public tours are rejected by the order path). */
67
+ id: number;
68
+ /** Display title for the cart / order line — the API returns none for tours. */
69
+ title: string;
70
+ /** Total headcount. Sent as `quantity` unless `quantities` is given. */
71
+ participants: number;
72
+ /** Required by the backend — orders without it fail with "language needed". */
73
+ languageId: number;
74
+ /** Integrator-supplied TOTAL booking price in cents, incl. mandatory surcharges. */
75
+ totalPriceCents: number;
76
+ /** Display language name for the cart line, e.g. "Deutsch". */
77
+ language?: string;
78
+ gradeId?: number;
79
+ ageGroupId?: number;
80
+ /**
81
+ * scale_price_id (string keys) → amount. Required by the backend whenever
82
+ * the tour has shop scale prices; must sum to `participants`.
83
+ */
84
+ quantities?: Record<string, number>;
85
+ /**
86
+ * price_surcharge_id (string keys) → quantity. Mandatory surcharges must be
87
+ * acknowledged here or the order fails ("mandatory surcharge not found").
88
+ */
89
+ surcharges?: Record<string, number>;
90
+ /** Passed through as attendees_attributes. */
91
+ attendees?: Record<string, unknown>[];
92
+ /** Free-form custom fields, passed through verbatim. */
93
+ customs?: Record<string, unknown>;
94
+ /** Equipment bookings: equipment_category_id + quantity. */
95
+ equipment?: TourEquipment[];
96
+ };
97
+ /** Rebuilds a UITour from its localStorage JSON through the one construction path. */
98
+ export declare function reviveUITour(persisted: UITour): UITour;
99
+ export {};