@gomusdev/web-components 1.55.3 → 1.56.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.
@@ -8,25 +8,30 @@ interface Options {
8
8
  originalPrice: number;
9
9
  };
10
10
  }
11
- export declare function createCartItem<T extends Product>(product: T, options?: Partial<Options>): {
12
- type: import('../../../../lib/models/cart/types.ts').ProductType;
13
- product: T;
11
+ export declare function createCartItem(product: Product, options?: Partial<Options>): {
12
+ type: "Ticket" | "Event";
13
+ product: Product;
14
14
  /**
15
15
  * is passed to the Order API
16
16
  */
17
17
  orderAttributes(): {
18
+ time: string | undefined;
19
+ quantity: number | undefined;
18
20
  shipped_with_merchandise_id: null;
19
21
  shipping_mode: string;
20
22
  id: number;
21
- time: string | undefined;
22
- quantity: number | undefined;
23
23
  } | {
24
+ quantity: number | undefined;
24
25
  shipped_with_merchandise_id: null;
25
26
  shipping_mode: string;
26
27
  id: number;
28
+ } | {
27
29
  quantities: {
28
- [x: number]: number | undefined;
30
+ [product.scale_price_id]: number | undefined;
29
31
  };
32
+ shipped_with_merchandise_id: null;
33
+ shipping_mode: string;
34
+ id: number;
30
35
  };
31
36
  uuid: string;
32
37
  subUId: string;
@@ -1,11 +1,87 @@
1
1
  import { CartItem, Product } from '../../../../lib/models/cart/types.ts';
2
2
  export type Cart = ReturnType<typeof createCart>;
3
- export declare function createCart(products?: Product[]): {
4
- items: CartItem[];
3
+ export declare function createCart(products?: Product[], contingent?: number): {
4
+ items: {
5
+ type: "Ticket" | "Event";
6
+ product: Product;
7
+ orderAttributes(): {
8
+ time: string | undefined;
9
+ quantity: number | undefined;
10
+ shipped_with_merchandise_id: null;
11
+ shipping_mode: string;
12
+ id: number;
13
+ } | {
14
+ quantity: number | undefined;
15
+ shipped_with_merchandise_id: null;
16
+ shipping_mode: string;
17
+ id: number;
18
+ } | {
19
+ quantities: {
20
+ [x: number]: number | undefined;
21
+ };
22
+ shipped_with_merchandise_id: null;
23
+ shipping_mode: string;
24
+ id: number;
25
+ };
26
+ uuid: string;
27
+ subUId: string;
28
+ toString(): string;
29
+ price_cents: number;
30
+ price_formatted: string;
31
+ final_price_cents: number;
32
+ final_price_formatted: string;
33
+ total_price_cents: number;
34
+ total_price_formatted: string;
35
+ quantity?: number | undefined;
36
+ time?: string | undefined;
37
+ display?: {
38
+ discounted: boolean;
39
+ reference_uuid: string;
40
+ originalPrice: number;
41
+ } | undefined;
42
+ }[];
5
43
  coupons: string[];
6
44
  paymentModeId: undefined;
7
45
  uid: string;
8
- readonly nonEmptyItems: CartItem[];
46
+ readonly nonEmptyItems: {
47
+ type: "Ticket" | "Event";
48
+ product: Product;
49
+ orderAttributes(): {
50
+ time: string | undefined;
51
+ quantity: number | undefined;
52
+ shipped_with_merchandise_id: null;
53
+ shipping_mode: string;
54
+ id: number;
55
+ } | {
56
+ quantity: number | undefined;
57
+ shipped_with_merchandise_id: null;
58
+ shipping_mode: string;
59
+ id: number;
60
+ } | {
61
+ quantities: {
62
+ [x: number]: number | undefined;
63
+ };
64
+ shipped_with_merchandise_id: null;
65
+ shipping_mode: string;
66
+ id: number;
67
+ };
68
+ uuid: string;
69
+ subUId: string;
70
+ toString(): string;
71
+ price_cents: number;
72
+ price_formatted: string;
73
+ final_price_cents: number;
74
+ final_price_formatted: string;
75
+ total_price_cents: number;
76
+ total_price_formatted: string;
77
+ quantity?: number | undefined;
78
+ time?: string | undefined;
79
+ display?: {
80
+ discounted: boolean;
81
+ reference_uuid: string;
82
+ originalPrice: number;
83
+ } | undefined;
84
+ }[];
9
85
  readonly totalPriceCents: number;
10
86
  readonly totalQuantity: number;
11
87
  /**
@@ -14,20 +90,25 @@ export declare function createCart(products?: Product[]): {
14
90
  toString(): string;
15
91
  orderData(): {
16
92
  items: {
17
- type: import('../../../../lib/models/cart/types.ts').ProductType;
93
+ type: "Ticket" | "Event";
18
94
  attributes: {
95
+ time: string | undefined;
96
+ quantity: number | undefined;
19
97
  shipped_with_merchandise_id: null;
20
98
  shipping_mode: string;
21
99
  id: number;
22
- time: string | undefined;
23
- quantity: number | undefined;
24
100
  } | {
101
+ quantity: number | undefined;
25
102
  shipped_with_merchandise_id: null;
26
103
  shipping_mode: string;
27
104
  id: number;
105
+ } | {
28
106
  quantities: {
29
107
  [x: number]: number | undefined;
30
108
  };
109
+ shipped_with_merchandise_id: null;
110
+ shipping_mode: string;
111
+ id: number;
31
112
  };
32
113
  }[];
33
114
  shipping_address_id: null;
@@ -50,11 +131,87 @@ export declare function createCart(products?: Product[]): {
50
131
  };
51
132
  export declare function formatCurrency(priceCents: number): string;
52
133
  export declare function createMainCart(): {
53
- items: CartItem[];
134
+ items: {
135
+ type: "Ticket" | "Event";
136
+ product: Product;
137
+ orderAttributes(): {
138
+ time: string | undefined;
139
+ quantity: number | undefined;
140
+ shipped_with_merchandise_id: null;
141
+ shipping_mode: string;
142
+ id: number;
143
+ } | {
144
+ quantity: number | undefined;
145
+ shipped_with_merchandise_id: null;
146
+ shipping_mode: string;
147
+ id: number;
148
+ } | {
149
+ quantities: {
150
+ [x: number]: number | undefined;
151
+ };
152
+ shipped_with_merchandise_id: null;
153
+ shipping_mode: string;
154
+ id: number;
155
+ };
156
+ uuid: string;
157
+ subUId: string;
158
+ toString(): string;
159
+ price_cents: number;
160
+ price_formatted: string;
161
+ final_price_cents: number;
162
+ final_price_formatted: string;
163
+ total_price_cents: number;
164
+ total_price_formatted: string;
165
+ quantity?: number | undefined;
166
+ time?: string | undefined;
167
+ display?: {
168
+ discounted: boolean;
169
+ reference_uuid: string;
170
+ originalPrice: number;
171
+ } | undefined;
172
+ }[];
54
173
  coupons: string[];
55
174
  paymentModeId: undefined;
56
175
  uid: string;
57
- readonly nonEmptyItems: CartItem[];
176
+ readonly nonEmptyItems: {
177
+ type: "Ticket" | "Event";
178
+ product: Product;
179
+ orderAttributes(): {
180
+ time: string | undefined;
181
+ quantity: number | undefined;
182
+ shipped_with_merchandise_id: null;
183
+ shipping_mode: string;
184
+ id: number;
185
+ } | {
186
+ quantity: number | undefined;
187
+ shipped_with_merchandise_id: null;
188
+ shipping_mode: string;
189
+ id: number;
190
+ } | {
191
+ quantities: {
192
+ [x: number]: number | undefined;
193
+ };
194
+ shipped_with_merchandise_id: null;
195
+ shipping_mode: string;
196
+ id: number;
197
+ };
198
+ uuid: string;
199
+ subUId: string;
200
+ toString(): string;
201
+ price_cents: number;
202
+ price_formatted: string;
203
+ final_price_cents: number;
204
+ final_price_formatted: string;
205
+ total_price_cents: number;
206
+ total_price_formatted: string;
207
+ quantity?: number | undefined;
208
+ time?: string | undefined;
209
+ display?: {
210
+ discounted: boolean;
211
+ reference_uuid: string;
212
+ originalPrice: number;
213
+ } | undefined;
214
+ }[];
58
215
  readonly totalPriceCents: number;
59
216
  readonly totalQuantity: number;
60
217
  /**
@@ -63,20 +220,25 @@ export declare function createMainCart(): {
63
220
  toString(): string;
64
221
  orderData(): {
65
222
  items: {
66
- type: import('../../../../lib/models/cart/types.ts').ProductType;
223
+ type: "Ticket" | "Event";
67
224
  attributes: {
225
+ time: string | undefined;
226
+ quantity: number | undefined;
68
227
  shipped_with_merchandise_id: null;
69
228
  shipping_mode: string;
70
229
  id: number;
71
- time: string | undefined;
72
- quantity: number | undefined;
73
230
  } | {
231
+ quantity: number | undefined;
74
232
  shipped_with_merchandise_id: null;
75
233
  shipping_mode: string;
76
234
  id: number;
235
+ } | {
77
236
  quantities: {
78
237
  [x: number]: number | undefined;
79
238
  };
239
+ shipped_with_merchandise_id: null;
240
+ shipping_mode: string;
241
+ id: number;
80
242
  };
81
243
  }[];
82
244
  shipping_address_id: null;
@@ -8,7 +8,45 @@ import { CartItem } from '../../../../lib/models/cart/types.ts';
8
8
  */
9
9
  export declare function generateCartItem(cartItem: any): CartItem | undefined;
10
10
  export declare function clearLocalStorage(): void;
11
- export declare function loadFromLocalStorage(cart: Cart): CartItem[];
11
+ export declare function loadFromLocalStorage(cart: Cart): {
12
+ type: "Ticket" | "Event";
13
+ product: import('../../../../lib/models/cart/types.ts').Product;
14
+ orderAttributes(): {
15
+ time: string | undefined;
16
+ quantity: number | undefined;
17
+ shipped_with_merchandise_id: null;
18
+ shipping_mode: string;
19
+ id: number;
20
+ } | {
21
+ quantity: number | undefined;
22
+ shipped_with_merchandise_id: null;
23
+ shipping_mode: string;
24
+ id: number;
25
+ } | {
26
+ quantities: {
27
+ [x: number]: number | undefined;
28
+ };
29
+ shipped_with_merchandise_id: null;
30
+ shipping_mode: string;
31
+ id: number;
32
+ };
33
+ uuid: string;
34
+ subUId: string;
35
+ toString(): string;
36
+ price_cents: number;
37
+ price_formatted: string;
38
+ final_price_cents: number;
39
+ final_price_formatted: string;
40
+ total_price_cents: number;
41
+ total_price_formatted: string;
42
+ quantity?: number | undefined;
43
+ time?: string | undefined;
44
+ display?: {
45
+ discounted: boolean;
46
+ reference_uuid: string;
47
+ originalPrice: number;
48
+ } | undefined;
49
+ }[];
12
50
  /**
13
51
  * Synchronizes the given shopping cart with the local storage. The method ensures that the cart is loaded from local storage,
14
52
  * updates are reflected in the local storage, and any external changes to the local storage are propagated to the cart.
@@ -1,15 +1,22 @@
1
1
  import { createCartItem } from '../../../../lib/models/cart/CartItem.ts';
2
+ import { UIEventTicket } from '../../../../lib/models/eventTicket/UIEventTicket.svelte.ts';
3
+ import { UITicket } from '../../../../lib/models/ticket/UITicket.svelte.ts';
2
4
  export type ProductType = 'Ticket' | 'Event';
3
- export type CartItem<T extends Product = Product> = ReturnType<typeof createCartItem<T>>;
5
+ export type CartItem = ReturnType<typeof createCartItem>;
4
6
  /**
5
7
  * minimal props to define a Product in a CartItem
6
8
  */
7
- export type Product = {
9
+ export type BaseProduct = {
8
10
  id: number;
11
+ title: string;
12
+ description: string;
9
13
  price_cents: number;
10
14
  tax_included: boolean;
11
15
  vat_pct: number;
12
- product_type: ProductType;
13
- dynamic_prices?: Record<string, number> | null;
14
- selectedTime?: string;
16
+ type: ProductType;
15
17
  };
18
+ export type Product = (UITicket & {
19
+ type: 'Ticket';
20
+ }) | (UIEventTicket & {
21
+ type: 'Event';
22
+ });
@@ -0,0 +1,66 @@
1
+ import { Product } from '../../../../lib/models/cart/types.ts';
2
+ import { DateDetails, EventTicket } from '@gomus/types';
3
+ interface Options {
4
+ minAvailableCapacity?: number;
5
+ selectedTime?: string;
6
+ quantity?: number;
7
+ date?: DateDetails;
8
+ event_title?: string;
9
+ event_subtitle?: string;
10
+ date_title?: string;
11
+ date_description?: string;
12
+ price_title?: string;
13
+ price_description?: string;
14
+ }
15
+ /**
16
+ * Event tickets come in two subtypes:
17
+ * - `flat`: single fixed price per ticket.
18
+ * - `scale`: price scales by attribute (e.g. age group), identified by `scale_price_id`.
19
+ *
20
+ * Subtype selection is automatic: derived from the API ticket's `scale_price_id`
21
+ * (absent → `flat`, present → `scale`). Consumers should not set it manually;
22
+ * use `isFlatEventTicket` / `isScaleEventTicket` to narrow.
23
+ */
24
+ type UIEventTicketSubtype = 'scale' | 'flat';
25
+ export declare function isEventTicket(x: Product): x is UIEventTicket;
26
+ export declare function isFlatEventTicket(x: Product): x is UIEventTicketFlat;
27
+ export declare function isScaleEventTicket(x: Product): x is UIEventTicketScale;
28
+ export type UIEventTicketBase = ReturnType<typeof buildUIEventTicket>;
29
+ export type UIEventTicketFlat = UIEventTicketBase & {
30
+ subtype: 'flat';
31
+ scale_price_id?: undefined;
32
+ };
33
+ export type UIEventTicketScale = UIEventTicketBase & {
34
+ subtype: 'scale';
35
+ scale_price_id: number;
36
+ };
37
+ export type UIEventTicket = UIEventTicketFlat | UIEventTicketScale;
38
+ declare function buildUIEventTicket(apiTicket: EventTicket, dateId: number, options?: Options): {
39
+ type: "Event";
40
+ subtype: UIEventTicketSubtype;
41
+ group?: boolean;
42
+ optional?: boolean;
43
+ price_cents: number;
44
+ vat_pct: number;
45
+ accounting_article_id?: number;
46
+ accounting_article_type?: string;
47
+ description: string;
48
+ scale_price_id?: number;
49
+ title: string;
50
+ id: number;
51
+ tax_included: boolean;
52
+ minAvailableCapacity: number;
53
+ selectedTime: string;
54
+ quantity?: number;
55
+ date?: DateDetails;
56
+ event_title?: string;
57
+ event_subtitle?: string;
58
+ date_title?: string;
59
+ date_description?: string;
60
+ price_title?: string;
61
+ price_description?: string;
62
+ uid: number;
63
+ dateId: number;
64
+ };
65
+ export declare function createUIEventTicket(apiTicket: EventTicket, dateId: number, options?: Options): UIEventTicket;
66
+ export {};
@@ -1,16 +1,16 @@
1
- import { Product, ProductType } from '../../../../lib/models/cart/types.ts';
1
+ import { BaseProduct } from '../../../../lib/models/cart/types.ts';
2
2
  import { AnnualTicket, NormalTickets, Ticket, Tickets } from '@gomus/types';
3
3
  interface Options {
4
4
  selectedTime?: string;
5
5
  }
6
6
  export type UITicketType = 'timeslot' | 'annual' | 'day' | 'event:ticket';
7
7
  export type UITicket = ReturnType<typeof createUITicket>;
8
- export declare function isUITicket(x: Product): x is UITicket;
8
+ export declare function isUITicket(x: BaseProduct): x is UITicket;
9
9
  export declare function createUITicket(apiTicket: Ticket | AnnualTicket | NormalTickets[number], options?: Options): {
10
10
  uid: number;
11
11
  selectedTime: string;
12
- product_type: ProductType;
13
- type: UITicketType;
12
+ type: "Ticket";
13
+ subtype: UITicketType;
14
14
  shop_order: number;
15
15
  id: number;
16
16
  title: string;
@@ -65,8 +65,8 @@ export declare function createUITicket(apiTicket: Ticket | AnnualTicket | Normal
65
65
  } | {
66
66
  uid: number;
67
67
  selectedTime: string;
68
- product_type: ProductType;
69
- type: UITicketType;
68
+ type: "Ticket";
69
+ subtype: UITicketType;
70
70
  shop_order: number;
71
71
  id: number;
72
72
  title: string;
@@ -113,8 +113,8 @@ export declare function createUITicket(apiTicket: Ticket | AnnualTicket | Normal
113
113
  } | {
114
114
  uid: number;
115
115
  selectedTime: string;
116
- product_type: ProductType;
117
- type: UITicketType;
116
+ type: "Ticket";
117
+ subtype: UITicketType;
118
118
  shop_order: number;
119
119
  id: number;
120
120
  title: string;
@@ -73,30 +73,111 @@ export declare class Shop {
73
73
  capacity(cart: Cart, item: import('../models/cart/types').CartItem, preCart: Cart): import('../models/capacity/types').Capacity;
74
74
  };
75
75
  get cart(): {
76
- items: import('../models/cart/types').CartItem[];
76
+ items: {
77
+ type: "Ticket" | "Event";
78
+ product: import('../models/cart/types').Product;
79
+ orderAttributes(): {
80
+ time: string | undefined;
81
+ quantity: number | undefined;
82
+ shipped_with_merchandise_id: null;
83
+ shipping_mode: string;
84
+ id: number;
85
+ } | {
86
+ quantity: number | undefined;
87
+ shipped_with_merchandise_id: null;
88
+ shipping_mode: string;
89
+ id: number;
90
+ } | {
91
+ quantities: {
92
+ [x: number]: number | undefined;
93
+ };
94
+ shipped_with_merchandise_id: null;
95
+ shipping_mode: string;
96
+ id: number;
97
+ };
98
+ uuid: string;
99
+ subUId: string;
100
+ toString(): string;
101
+ price_cents: number;
102
+ price_formatted: string;
103
+ final_price_cents: number;
104
+ final_price_formatted: string;
105
+ total_price_cents: number;
106
+ total_price_formatted: string;
107
+ quantity?: number | undefined;
108
+ time?: string | undefined;
109
+ display?: {
110
+ discounted: boolean;
111
+ reference_uuid: string;
112
+ originalPrice: number;
113
+ } | undefined;
114
+ }[];
77
115
  coupons: string[];
78
116
  paymentModeId: undefined;
79
117
  uid: string;
80
- readonly nonEmptyItems: import('../models/cart/types').CartItem[];
118
+ readonly nonEmptyItems: {
119
+ type: "Ticket" | "Event";
120
+ product: import('../models/cart/types').Product;
121
+ orderAttributes(): {
122
+ time: string | undefined;
123
+ quantity: number | undefined;
124
+ shipped_with_merchandise_id: null;
125
+ shipping_mode: string;
126
+ id: number;
127
+ } | {
128
+ quantity: number | undefined;
129
+ shipped_with_merchandise_id: null;
130
+ shipping_mode: string;
131
+ id: number;
132
+ } | {
133
+ quantities: {
134
+ [x: number]: number | undefined;
135
+ };
136
+ shipped_with_merchandise_id: null;
137
+ shipping_mode: string;
138
+ id: number;
139
+ };
140
+ uuid: string;
141
+ subUId: string;
142
+ toString(): string;
143
+ price_cents: number;
144
+ price_formatted: string;
145
+ final_price_cents: number;
146
+ final_price_formatted: string;
147
+ total_price_cents: number;
148
+ total_price_formatted: string;
149
+ quantity?: number | undefined;
150
+ time?: string | undefined;
151
+ display?: {
152
+ discounted: boolean;
153
+ reference_uuid: string;
154
+ originalPrice: number;
155
+ } | undefined;
156
+ }[];
81
157
  readonly totalPriceCents: number;
82
158
  readonly totalQuantity: number;
83
159
  toString(): string;
84
160
  orderData(): {
85
161
  items: {
86
- type: import('../models/cart/types').ProductType;
162
+ type: "Ticket" | "Event";
87
163
  attributes: {
164
+ time: string | undefined;
165
+ quantity: number | undefined;
88
166
  shipped_with_merchandise_id: null;
89
167
  shipping_mode: string;
90
168
  id: number;
91
- time: string | undefined;
92
- quantity: number | undefined;
93
169
  } | {
170
+ quantity: number | undefined;
94
171
  shipped_with_merchandise_id: null;
95
172
  shipping_mode: string;
96
173
  id: number;
174
+ } | {
97
175
  quantities: {
98
176
  [x: number]: number | undefined;
99
177
  };
178
+ shipped_with_merchandise_id: null;
179
+ shipping_mode: string;
180
+ id: number;
100
181
  };
101
182
  }[];
102
183
  shipping_address_id: null;
@@ -1487,7 +1487,7 @@ export function getGetTickets200Response(): {
1487
1487
  tickets: {
1488
1488
  id: number;
1489
1489
  title: string;
1490
- ticket_type: "annual" | "time_slot" | "normal";
1490
+ ticket_type: "time_slot" | "annual" | "normal";
1491
1491
  bookable: boolean;
1492
1492
  museum_ids: number[];
1493
1493
  exhibition_ids: number[];
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.55.3",
7
+ "version": "1.56.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",
@@ -1,11 +0,0 @@
1
- export declare function createScalingPrice(title: string, price_cents: number, scale_price_id: number, description?: string): {
2
- scale_price_id: number;
3
- title: string;
4
- description: string;
5
- group: boolean;
6
- optional: boolean;
7
- price_cents: number;
8
- vat_pct: number;
9
- accounting_article_id: number;
10
- accounting_article_type: string;
11
- };
@@ -1,35 +0,0 @@
1
- import { Product, ProductType } from '../../../../lib/models/cart/types.ts';
2
- import { EventScalePriceTicket } from '@gomus/types';
3
- interface Options {
4
- minAvailableCapacity?: number;
5
- selectedTime?: string;
6
- quantity?: number;
7
- event_title: string;
8
- }
9
- type UIScaledPricesTicketTypes = 'scale';
10
- export declare function isUIScaledPricesTicket(x: Product): x is UIScaledPricesTicket;
11
- export type UIScaledPricesTicket = ReturnType<typeof createUIScaledPricesTicket>;
12
- export declare function createUIScaledPricesTicket(apiTicket: EventScalePriceTicket, dateId: number, options?: Options): {
13
- type: UIScaledPricesTicketTypes;
14
- minAvailableCapacity: number;
15
- selectedTime: string;
16
- quantity: number;
17
- event_title: string;
18
- accounting_article_id: number;
19
- accounting_article_type: string;
20
- description: string;
21
- group: boolean;
22
- optional: boolean;
23
- price_cents: number;
24
- scale_price_id: number;
25
- title: string;
26
- vat_pct: number;
27
- id: number;
28
- tax_included: boolean;
29
- product_type: ProductType;
30
- dynamic_prices?: Record<string, number> | null;
31
- uid: number;
32
- dateId: number;
33
- scalePriceId: number;
34
- };
35
- export {};