@gomusdev/web-components 3.7.0 → 3.8.1

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.
@@ -1,7 +1,6 @@
1
1
  import { Cart } from '../../../../lib/models/cart/cart.svelte.ts';
2
2
  export declare class CartDetails {
3
3
  displayCart: Cart | undefined;
4
- appliedCoupons: Set<string>;
5
4
  preview: boolean;
6
5
  get totalPriceCents(): number;
7
6
  get subtotalPriceCents(): number;
@@ -6,9 +6,5 @@ export type ApiItem = PostCartData['items'][number];
6
6
  export type DisplayItem = CartItem & {
7
7
  display: NonNullable<CartItem['display']>;
8
8
  };
9
- export type DisplayCartResult = {
10
- cart: Cart;
11
- appliedCoupons: Set<string>;
12
- };
13
- export declare function createDisplayCart(baseCart: Cart, apiItems: ApiItem[]): DisplayCartResult;
9
+ export declare function createDisplayCart(baseCart: Cart, apiItems: ApiItem[]): Cart;
14
10
  export {};
@@ -16,6 +16,7 @@ export declare class TicketSelectionDetails {
16
16
  ticketGroupIds: number[] | undefined;
17
17
  selectedDate: CalendarDate | undefined;
18
18
  selectedTimeslot: string | undefined;
19
+ timeslotTicketIds: number[];
19
20
  selectedTime: string | undefined;
20
21
  ticketSegments: SegmentDetails[];
21
22
  preCarts: Cart[];
@@ -1,4 +1,12 @@
1
1
  import { TicketSelectionDetails } from '../../../../components/ticketSelection/TicketSelectionDetails.svelte.ts';
2
- import { DateDetails } from '@gomus/types';
2
+ import { DateDetails, Quotas } from '@gomus/types';
3
+ /**
4
+ * Load quotas fetched by a filter's loadTimeslots into the shared quota store and
5
+ * record which ticket ids this selection loaded for its picker. timeslotsOn() reads
6
+ * tsd.timeslotTicketIds, so only these tickets' slots render — a foreign
7
+ * segment/selection sharing the store can't leak in. Appends, so multiple active
8
+ * filters accumulate within one render pass (<go-timeslots> resets the list first).
9
+ */
10
+ export declare function loadPickerQuotas(tsd: TicketSelectionDetails, quotas: Quotas): void;
3
11
  export declare function filterDatesInWindow(dates: ReadonlyArray<DateDetails>, selectedDate: string, selectedTime: string): DateDetails[];
4
12
  export declare function loadEventsTimeslots(tsd: TicketSelectionDetails): Promise<void>;
@@ -43,7 +43,7 @@ export declare class SegmentDetails {
43
43
  originalPrice: number;
44
44
  } | undefined;
45
45
  }[];
46
- coupons: string[];
46
+ coupons: import('../../../../../../lib/models/cart/types').CouponItem[];
47
47
  paymentModeId: undefined;
48
48
  uid: string;
49
49
  readonly nonEmptyItems: {
@@ -87,6 +87,8 @@ export declare class SegmentDetails {
87
87
  }[];
88
88
  readonly totalPriceCents: number;
89
89
  readonly totalQuantity: number;
90
+ readonly valueVoucherCents: number;
91
+ readonly amountToPayCents: number;
90
92
  toString(): string;
91
93
  orderData(): {
92
94
  items: {
@@ -125,8 +127,8 @@ export declare class SegmentDetails {
125
127
  deleteItem(item: import('../../../../../../lib/models/cart/types').CartItem): void;
126
128
  addItem(item: import('../../../../../../lib/models/cart/types').CartItem): void;
127
129
  addItems(items: import('../../../../../../lib/models/cart/types').CartItem[]): void;
128
- addCoupon(token: string): void;
129
- removeCoupon(token: string): void;
130
+ addCoupon(item: import('../../../../../../lib/models/cart/types').CouponItem): void;
131
+ removeCoupon(code: string): void;
130
132
  clearCoupons(): void;
131
133
  };
132
134
  filters: TicketSegmentFilter[] | undefined;
@@ -64,7 +64,7 @@ export declare function createCapacityManager(): {
64
64
  }[];
65
65
  ticketCapacity(ticketId: number, timeslot: string): number;
66
66
  totalCapacity(ticketId: number, timeslot: string): number;
67
- timeslotsOn(date: import('@internationalized/date').CalendarDate): {
67
+ timeslotsOn(date: import('@internationalized/date').CalendarDate, ticketIds?: number[]): {
68
68
  timeSlot: string;
69
69
  quota: string;
70
70
  capacity: number;
@@ -52,7 +52,7 @@ export declare function createQuotaManager(quotas: Quotas): {
52
52
  }[];
53
53
  ticketCapacity(ticketId: number, timeslot: string): number;
54
54
  totalCapacity(ticketId: number, timeslot: string): number;
55
- timeslotsOn(date: CalendarDate): {
55
+ timeslotsOn(date: CalendarDate, ticketIds?: number[]): {
56
56
  timeSlot: string;
57
57
  quota: string;
58
58
  capacity: number;
@@ -1,4 +1,4 @@
1
- import { CartItem, Product } from '../../../../lib/models/cart/types.ts';
1
+ import { CartItem, CouponItem, Product } from '../../../../lib/models/cart/types.ts';
2
2
  export type Cart = ReturnType<typeof createCart>;
3
3
  export declare function createCart(products?: Product[], contingent?: number): {
4
4
  items: {
@@ -40,7 +40,7 @@ export declare function createCart(products?: Product[], contingent?: number): {
40
40
  originalPrice: number;
41
41
  } | undefined;
42
42
  }[];
43
- coupons: string[];
43
+ coupons: CouponItem[];
44
44
  paymentModeId: undefined;
45
45
  uid: string;
46
46
  readonly nonEmptyItems: {
@@ -84,6 +84,8 @@ export declare function createCart(products?: Product[], contingent?: number): {
84
84
  }[];
85
85
  readonly totalPriceCents: number;
86
86
  readonly totalQuantity: number;
87
+ readonly valueVoucherCents: number;
88
+ readonly amountToPayCents: number;
87
89
  /**
88
90
  * Generates a formatted string representation of the current object.
89
91
  */
@@ -125,8 +127,8 @@ export declare function createCart(products?: Product[], contingent?: number): {
125
127
  deleteItem(item: CartItem): void;
126
128
  addItem(item: CartItem): void;
127
129
  addItems(items: CartItem[]): void;
128
- addCoupon(token: string): void;
129
- removeCoupon(token: string): void;
130
+ addCoupon(item: CouponItem): void;
131
+ removeCoupon(code: string): void;
130
132
  clearCoupons(): void;
131
133
  };
132
134
  export declare function formatCurrency(priceCents: number): string;
@@ -170,7 +172,7 @@ export declare function createMainCart(): {
170
172
  originalPrice: number;
171
173
  } | undefined;
172
174
  }[];
173
- coupons: string[];
175
+ coupons: CouponItem[];
174
176
  paymentModeId: undefined;
175
177
  uid: string;
176
178
  readonly nonEmptyItems: {
@@ -214,6 +216,8 @@ export declare function createMainCart(): {
214
216
  }[];
215
217
  readonly totalPriceCents: number;
216
218
  readonly totalQuantity: number;
219
+ readonly valueVoucherCents: number;
220
+ readonly amountToPayCents: number;
217
221
  /**
218
222
  * Generates a formatted string representation of the current object.
219
223
  */
@@ -255,7 +259,7 @@ export declare function createMainCart(): {
255
259
  deleteItem(item: CartItem): void;
256
260
  addItem(item: CartItem): void;
257
261
  addItems(items: CartItem[]): void;
258
- addCoupon(token: string): void;
259
- removeCoupon(token: string): void;
262
+ addCoupon(item: CouponItem): void;
263
+ removeCoupon(code: string): void;
260
264
  clearCoupons(): void;
261
265
  };
@@ -4,6 +4,25 @@ import { UIEventTicket } from '../../../../lib/models/eventTicket/UIEventTicket.
4
4
  import { UITicket } from '../../../../lib/models/ticket/UITicket.svelte.ts';
5
5
  export type ProductType = 'Ticket' | 'Event' | 'Coupon';
6
6
  export type CartItem = ReturnType<typeof createCartItem>;
7
+ /**
8
+ * A redeemed coupon code held in the cart. `kind` mirrors the German domain
9
+ * terms 1:1: Aktionstoken (order discount), Leistungsgutschein (free specific
10
+ * ticket), Wertgutschein (gift-card credit that pays toward the total).
11
+ */
12
+ export type CouponKind = 'actionToken' | 'serviceVoucher' | 'valueVoucher';
13
+ export type CouponItem = {
14
+ code: string;
15
+ kind: CouponKind;
16
+ /** Only for valueVoucher — remaining balance at redemption time. */
17
+ valueCents?: number;
18
+ /**
19
+ * Whether this coupon is currently applied to the cart. Set when the display
20
+ * cart is built (see createDisplayCart): value/service vouchers are applied
21
+ * client-side and are always true; an order-discount token is applied only
22
+ * once the backend confirms it on a cart line.
23
+ */
24
+ applied?: boolean;
25
+ };
7
26
  /**
8
27
  * minimal props to define a Product in a CartItem
9
28
  */
@@ -60,7 +60,7 @@ export declare class Shop {
60
60
  }[];
61
61
  ticketCapacity(ticketId: number, timeslot: string): number;
62
62
  totalCapacity(ticketId: number, timeslot: string): number;
63
- timeslotsOn(date: import('@internationalized/date').CalendarDate): {
63
+ timeslotsOn(date: import('@internationalized/date').CalendarDate, ticketIds?: number[]): {
64
64
  timeSlot: string;
65
65
  quota: string;
66
66
  capacity: number;
@@ -113,7 +113,7 @@ export declare class Shop {
113
113
  originalPrice: number;
114
114
  } | undefined;
115
115
  }[];
116
- coupons: string[];
116
+ coupons: import('../models/cart/types').CouponItem[];
117
117
  paymentModeId: undefined;
118
118
  uid: string;
119
119
  readonly nonEmptyItems: {
@@ -157,6 +157,8 @@ export declare class Shop {
157
157
  }[];
158
158
  readonly totalPriceCents: number;
159
159
  readonly totalQuantity: number;
160
+ readonly valueVoucherCents: number;
161
+ readonly amountToPayCents: number;
160
162
  toString(): string;
161
163
  orderData(): {
162
164
  items: {
@@ -195,8 +197,8 @@ export declare class Shop {
195
197
  deleteItem(item: import('../models/cart/types').CartItem): void;
196
198
  addItem(item: import('../models/cart/types').CartItem): void;
197
199
  addItems(items: import('../models/cart/types').CartItem[]): void;
198
- addCoupon(token: string): void;
199
- removeCoupon(token: string): void;
200
+ addCoupon(item: import('../models/cart/types').CouponItem): void;
201
+ removeCoupon(code: string): void;
200
202
  clearCoupons(): void;
201
203
  } | undefined;
202
204
  get auth(): Auth;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "3.7.0",
7
+ "version": "3.8.1",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",