@gomusdev/web-components 1.54.0 → 1.54.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,153 +1 @@
1
- export declare function createMockUITicket(): {
2
- uid: number;
3
- selectedTime: string;
4
- product_type: import('../../../lib/models/cart/types').ProductType;
5
- type: import('../../../lib/models/ticket/UITicket.svelte').UITicketType;
6
- shop_order: number;
7
- id: number;
8
- title: string;
9
- ticket_type: "time_slot" | "annual" | "normal";
10
- bookable: boolean;
11
- museum_ids: number[];
12
- exhibition_ids: number[];
13
- price_cents: number;
14
- discount: number;
15
- vat_pct: number;
16
- tax_included: boolean;
17
- entry_duration: number | null;
18
- min_persons: number;
19
- max_persons: number;
20
- quota_ids: number[];
21
- first_entry: number;
22
- last_entry: number;
23
- personalizeable: boolean;
24
- attendees: boolean | string;
25
- identification: boolean | string;
26
- free_timing: boolean;
27
- is_collective: boolean;
28
- is_upgrade: boolean;
29
- is_mantle: boolean;
30
- description: string | null;
31
- sub_ticket_ids: number[];
32
- sub_tickets: {
33
- [key: string]: {
34
- title?: string;
35
- min_persons?: number;
36
- max_persons?: number;
37
- description?: string | null;
38
- };
39
- } | null;
40
- is_sub_ticket: boolean;
41
- created_at: string;
42
- updated_at: string;
43
- shipped_with_merchandise_id: number | null;
44
- restricted_shop_account: boolean;
45
- cash_point_order: number;
46
- capacities: {
47
- [key: string]: number;
48
- };
49
- total_capacities: {
50
- [key: string]: number;
51
- };
52
- max_capacity: number;
53
- max_total_capacity: number;
54
- dynamic_prices: {
55
- [key: string]: number;
56
- } | null;
57
- } | {
58
- uid: number;
59
- selectedTime: string;
60
- product_type: import('../../../lib/models/cart/types').ProductType;
61
- type: import('../../../lib/models/ticket/UITicket.svelte').UITicketType;
62
- shop_order: number;
63
- id: number;
64
- title: string;
65
- ticket_type: "time_slot" | "annual" | "normal";
66
- bookable: boolean;
67
- museum_ids: number[];
68
- exhibition_ids: number[];
69
- price_cents: number;
70
- discount: number;
71
- vat_pct: number;
72
- tax_included: boolean;
73
- entry_duration: number | null;
74
- min_persons: number;
75
- max_persons: number;
76
- quota_ids: number[];
77
- first_entry: number;
78
- last_entry: number;
79
- personalizeable: boolean;
80
- attendees: boolean | string;
81
- identification: boolean | string;
82
- free_timing: boolean;
83
- is_collective: boolean;
84
- is_upgrade: boolean;
85
- is_mantle: boolean;
86
- description: string | null;
87
- sub_ticket_ids: number[];
88
- sub_tickets: {
89
- [key: string]: {
90
- title?: string;
91
- min_persons?: number;
92
- max_persons?: number;
93
- description?: string | null;
94
- };
95
- } | null;
96
- is_sub_ticket: boolean;
97
- created_at: string;
98
- updated_at: string;
99
- shipped_with_merchandise_id: number | null;
100
- restricted_shop_account: boolean;
101
- cash_point_order: number;
102
- dynamic_prices: {
103
- [key: string]: number;
104
- } | null;
105
- } | {
106
- uid: number;
107
- selectedTime: string;
108
- product_type: import('../../../lib/models/cart/types').ProductType;
109
- type: import('../../../lib/models/ticket/UITicket.svelte').UITicketType;
110
- shop_order: number;
111
- id: number;
112
- title: string;
113
- ticket_type: "time_slot" | "annual" | "normal";
114
- bookable: boolean;
115
- museum_ids: number[];
116
- exhibition_ids: number[];
117
- price_cents: number;
118
- discount: number;
119
- vat_pct: number;
120
- tax_included: boolean;
121
- entry_duration: number | null;
122
- quota_ids: number[];
123
- first_entry: number;
124
- last_entry: number;
125
- personalizeable: boolean;
126
- attendees: boolean | string;
127
- identification: boolean | string;
128
- free_timing: boolean;
129
- is_collective: boolean;
130
- is_upgrade: boolean;
131
- is_mantle: boolean;
132
- description: string | null;
133
- sub_ticket_ids: number[];
134
- sub_tickets: {
135
- [key: string]: {
136
- title?: string;
137
- min_persons?: number;
138
- max_persons?: number;
139
- description?: string | null;
140
- };
141
- } | null;
142
- is_sub_ticket: boolean;
143
- created_at: string;
144
- updated_at: string;
145
- cash_point_order: number;
146
- shipped_with_merchandise_id: number | null;
147
- restricted_shop_account: boolean;
148
- min_persons: number;
149
- max_persons: number;
150
- dynamic_prices?: {
151
- [key: string]: number;
152
- } | null;
153
- };
1
+ export declare function createMockUITicket(): any;
@@ -17169,18 +17169,33 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17169
17169
  }
17170
17170
  return fallback;
17171
17171
  }
17172
+ function resolveQuantitySource(attrs) {
17173
+ return "quantity" in attrs && attrs.quantity !== void 0 ? attrs.quantity : attrs.quantities;
17174
+ }
17175
+ function resolveApiQuantity(attrs) {
17176
+ return getQuantity(resolveQuantitySource(attrs), 0);
17177
+ }
17178
+ function getScalePriceId(attrs) {
17179
+ const source2 = resolveQuantitySource(attrs);
17180
+ if (source2 && typeof source2 === "object") {
17181
+ const keys = Object.keys(source2);
17182
+ if (keys.length > 0) return Number(keys[0]);
17183
+ }
17184
+ return void 0;
17185
+ }
17172
17186
  function createDisplayCart(baseCart, apiItems) {
17173
17187
  const displayCart = createCart();
17174
17188
  const appliedCoupons = /* @__PURE__ */ new Set();
17175
17189
  baseCart.coupons.forEach((coupon) => displayCart.addCoupon(coupon));
17176
17190
  apiItems.forEach((apiItem) => {
17177
17191
  const attrs = apiItem.attributes;
17192
+ const scalePriceId = getScalePriceId(attrs);
17178
17193
  const itemInBaseCart = baseCart.items.find(
17179
- (i) => i.type.toLowerCase() === apiItem.type.toLowerCase() && i.product.id === attrs.id && (!attrs.time || i.time === attrs.time)
17194
+ (i) => i.type.toLowerCase() === apiItem.type.toLowerCase() && i.product.id === attrs.id && (!attrs.time || i.time === attrs.time) && (scalePriceId === void 0 || isUIScaledPricesTicket(i.product) && i.product.scale_price_id === scalePriceId)
17180
17195
  );
17181
17196
  if (!itemInBaseCart) {
17182
17197
  console.error("(go-cart) Ignoring unmatched cart line", { type: apiItem.type, attrs });
17183
- return [];
17198
+ return;
17184
17199
  }
17185
17200
  if (attrs.coupon) {
17186
17201
  displayCart.addCoupon(attrs.coupon);
@@ -17190,10 +17205,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17190
17205
  });
17191
17206
  return { cart: displayCart, appliedCoupons };
17192
17207
  }
17193
- function resolveApiQuantity(attrs) {
17194
- const source2 = "quantity" in attrs && attrs.quantity !== void 0 ? attrs.quantity : attrs.quantities;
17195
- return getQuantity(source2, 0);
17196
- }
17197
17208
  function createDisplayCartItem(cartItem, attrs) {
17198
17209
  const quantity = resolveApiQuantity(attrs);
17199
17210
  const displayPrice = attrs.price_cents ?? cartItem.product.price_cents;
@@ -17235,7 +17246,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17235
17246
  set(displayCart, get$2(cart), true);
17236
17247
  return;
17237
17248
  }
17238
- (async () => {
17249
+ void (async () => {
17239
17250
  try {
17240
17251
  const { items, coupons } = get$2(cart).orderData();
17241
17252
  const response = await shop.createCart({ items, coupons });
@@ -17169,18 +17169,33 @@ function getQuantity(value, fallback) {
17169
17169
  }
17170
17170
  return fallback;
17171
17171
  }
17172
+ function resolveQuantitySource(attrs) {
17173
+ return "quantity" in attrs && attrs.quantity !== void 0 ? attrs.quantity : attrs.quantities;
17174
+ }
17175
+ function resolveApiQuantity(attrs) {
17176
+ return getQuantity(resolveQuantitySource(attrs), 0);
17177
+ }
17178
+ function getScalePriceId(attrs) {
17179
+ const source2 = resolveQuantitySource(attrs);
17180
+ if (source2 && typeof source2 === "object") {
17181
+ const keys = Object.keys(source2);
17182
+ if (keys.length > 0) return Number(keys[0]);
17183
+ }
17184
+ return void 0;
17185
+ }
17172
17186
  function createDisplayCart(baseCart, apiItems) {
17173
17187
  const displayCart = createCart();
17174
17188
  const appliedCoupons = /* @__PURE__ */ new Set();
17175
17189
  baseCart.coupons.forEach((coupon) => displayCart.addCoupon(coupon));
17176
17190
  apiItems.forEach((apiItem) => {
17177
17191
  const attrs = apiItem.attributes;
17192
+ const scalePriceId = getScalePriceId(attrs);
17178
17193
  const itemInBaseCart = baseCart.items.find(
17179
- (i) => i.type.toLowerCase() === apiItem.type.toLowerCase() && i.product.id === attrs.id && (!attrs.time || i.time === attrs.time)
17194
+ (i) => i.type.toLowerCase() === apiItem.type.toLowerCase() && i.product.id === attrs.id && (!attrs.time || i.time === attrs.time) && (scalePriceId === void 0 || isUIScaledPricesTicket(i.product) && i.product.scale_price_id === scalePriceId)
17180
17195
  );
17181
17196
  if (!itemInBaseCart) {
17182
17197
  console.error("(go-cart) Ignoring unmatched cart line", { type: apiItem.type, attrs });
17183
- return [];
17198
+ return;
17184
17199
  }
17185
17200
  if (attrs.coupon) {
17186
17201
  displayCart.addCoupon(attrs.coupon);
@@ -17190,10 +17205,6 @@ function createDisplayCart(baseCart, apiItems) {
17190
17205
  });
17191
17206
  return { cart: displayCart, appliedCoupons };
17192
17207
  }
17193
- function resolveApiQuantity(attrs) {
17194
- const source2 = "quantity" in attrs && attrs.quantity !== void 0 ? attrs.quantity : attrs.quantities;
17195
- return getQuantity(source2, 0);
17196
- }
17197
17208
  function createDisplayCartItem(cartItem, attrs) {
17198
17209
  const quantity = resolveApiQuantity(attrs);
17199
17210
  const displayPrice = attrs.price_cents ?? cartItem.product.price_cents;
@@ -17235,7 +17246,7 @@ function Cart($$anchor, $$props) {
17235
17246
  set(displayCart, get$2(cart), true);
17236
17247
  return;
17237
17248
  }
17238
- (async () => {
17249
+ void (async () => {
17239
17250
  try {
17240
17251
  const { items, coupons } = get$2(cart).orderData();
17241
17252
  const response = await shop.createCart({ items, coupons });
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.54.0",
7
+ "version": "1.54.1",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",
@@ -1 +0,0 @@
1
- export {};
@@ -1,3 +0,0 @@
1
- import { CalendarDate } from '@internationalized/date';
2
- import { Writable } from 'svelte/store';
3
- export declare const selectedDate: Writable<CalendarDate>;
@@ -1 +0,0 @@
1
- export declare const browser: import('svelte/store').Readable<boolean>;
@@ -1,23 +0,0 @@
1
- export declare const applyAction: (result: any) => void;
2
- export declare function deserialize(result: any): any;
3
- export declare function enhance(form_element: any, submit?: () => {
4
- new (executor: (resolve: (value: void | PromiseLike<void>) => void, reject: (reason?: any) => void) => void): Promise<void>;
5
- all<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
6
- all<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: Awaited<T[P]>; }>;
7
- race<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
8
- race<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
9
- readonly prototype: Promise<any>;
10
- reject<T = never>(reason?: any): Promise<T>;
11
- resolve(): Promise<void>;
12
- resolve<T>(value: T): Promise<Awaited<T>>;
13
- resolve<T>(value: T | PromiseLike<T>): Promise<Awaited<T>>;
14
- allSettled<T extends readonly unknown[] | []>(values: T): Promise<{ -readonly [P in keyof T]: PromiseSettledResult<Awaited<T[P]>>; }>;
15
- allSettled<T>(values: Iterable<T | PromiseLike<T>>): Promise<PromiseSettledResult<Awaited<T>>[]>;
16
- any<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
17
- any<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>>;
18
- withResolvers<T>(): PromiseWithResolvers<T>;
19
- try<T, U extends unknown[]>(callbackFn: (...args: U) => T | PromiseLike<T>, ...args: U): Promise<Awaited<T>>;
20
- readonly [Symbol.species]: PromiseConstructor;
21
- }): {
22
- destroy(): void;
23
- };
@@ -1,4 +0,0 @@
1
- export declare const beforeCallbacks: never[];
2
- export declare const beforeNavigate: () => void;
3
- export declare const goto: () => void;
4
- export declare const invalidateAll: () => void;
@@ -1,2 +0,0 @@
1
- export declare const navigating: import('svelte/store').Readable<boolean>;
2
- export declare const page: import('svelte/store').Writable<Page>;