@gomusdev/web-components 1.13.0 → 1.15.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.
- package/dist-js/components/cart/lib/CartEvents.spec.d.ts +1 -0
- package/dist-js/components/cart/lib/CartEvents.svelte.d.ts +1 -0
- package/dist-js/components/cart/lib/cart.svelte.d.ts +1 -1
- package/dist-js/gomus-webcomponents.iife.js +17 -3
- package/dist-js/gomus-webcomponents.js +17 -3
- package/dist-js/lib/vitest/msw/handlers.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function dispathCartEvents(): void;
|
|
@@ -308,6 +308,7 @@ export declare function createCart(tickets?: UITicket[], options?: {
|
|
|
308
308
|
addItem(item: CartItem): void;
|
|
309
309
|
addItems(items: CartItem[]): void;
|
|
310
310
|
};
|
|
311
|
+
export declare function formatCurrency(priceCents: number): string;
|
|
311
312
|
export declare const cart: {
|
|
312
313
|
items: {
|
|
313
314
|
type: import('./CartItem.ts').OrderItemType;
|
|
@@ -613,4 +614,3 @@ export declare const cart: {
|
|
|
613
614
|
addItem(item: CartItem): void;
|
|
614
615
|
addItems(items: CartItem[]): void;
|
|
615
616
|
};
|
|
616
|
-
export declare function formatCurrency(priceCents: number): string;
|
|
@@ -15206,6 +15206,19 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
15206
15206
|
[],
|
|
15207
15207
|
false
|
|
15208
15208
|
));
|
|
15209
|
+
function dispathCartEvents() {
|
|
15210
|
+
let lastLength = 0;
|
|
15211
|
+
effect_root(() => {
|
|
15212
|
+
user_effect(() => {
|
|
15213
|
+
if (cart.items.length === lastLength) {
|
|
15214
|
+
return;
|
|
15215
|
+
}
|
|
15216
|
+
const event = cart.items.length > lastLength ? "go-cart-item-added" : "go-cart-item-removed";
|
|
15217
|
+
lastLength = cart.items.length;
|
|
15218
|
+
document.dispatchEvent(new CustomEvent(event, { detail: cart.items.length }));
|
|
15219
|
+
});
|
|
15220
|
+
});
|
|
15221
|
+
}
|
|
15209
15222
|
function createCartItem(ticket, options) {
|
|
15210
15223
|
const finalOptions = {
|
|
15211
15224
|
quantity: 0,
|
|
@@ -15414,12 +15427,13 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
15414
15427
|
if (tickets) tickets.forEach((t) => cart2.addItem(createCartItem(t)));
|
|
15415
15428
|
return cart2;
|
|
15416
15429
|
}
|
|
15417
|
-
const cart = proxy(createCart([]));
|
|
15418
|
-
syncCartToLocalStorage(cart);
|
|
15419
15430
|
function formatCurrency(priceCents) {
|
|
15420
15431
|
priceCents = priceCents ?? 0;
|
|
15421
15432
|
return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(priceCents / 100);
|
|
15422
15433
|
}
|
|
15434
|
+
const cart = proxy(createCart([]));
|
|
15435
|
+
syncCartToLocalStorage(cart);
|
|
15436
|
+
dispathCartEvents();
|
|
15423
15437
|
var root_2$p = /* @__PURE__ */ from_html(`<li data-go-cart-header-remove="">remove</li>`);
|
|
15424
15438
|
var root_5$2 = /* @__PURE__ */ from_html(`<span class="go-cart-item-time" data-testid="cart-item-time"> </span>`);
|
|
15425
15439
|
var root_4$4 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1);
|
|
@@ -30874,7 +30888,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
30874
30888
|
const filters = prop($$props, "filters", 7);
|
|
30875
30889
|
const ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
|
|
30876
30890
|
if (!filters()) throw new Error("filters is required");
|
|
30877
|
-
if (!ticketSelectionDetails) throw new Error("Ticket
|
|
30891
|
+
if (!ticketSelectionDetails) throw new Error("Ticket Segment should be an ancestor of a Ticket Selection Details element");
|
|
30878
30892
|
const details = new TicketGroupDetails(filters(), ticketSelectionDetails);
|
|
30879
30893
|
setTicketGroupDetails($$props.$$host, details);
|
|
30880
30894
|
user_effect(() => {
|
|
@@ -15206,6 +15206,19 @@ customElements.define("go-sign-up", create_custom_element(
|
|
|
15206
15206
|
[],
|
|
15207
15207
|
false
|
|
15208
15208
|
));
|
|
15209
|
+
function dispathCartEvents() {
|
|
15210
|
+
let lastLength = 0;
|
|
15211
|
+
effect_root(() => {
|
|
15212
|
+
user_effect(() => {
|
|
15213
|
+
if (cart.items.length === lastLength) {
|
|
15214
|
+
return;
|
|
15215
|
+
}
|
|
15216
|
+
const event = cart.items.length > lastLength ? "go-cart-item-added" : "go-cart-item-removed";
|
|
15217
|
+
lastLength = cart.items.length;
|
|
15218
|
+
document.dispatchEvent(new CustomEvent(event, { detail: cart.items.length }));
|
|
15219
|
+
});
|
|
15220
|
+
});
|
|
15221
|
+
}
|
|
15209
15222
|
function createCartItem(ticket, options) {
|
|
15210
15223
|
const finalOptions = {
|
|
15211
15224
|
quantity: 0,
|
|
@@ -15414,12 +15427,13 @@ function createCart(tickets, options) {
|
|
|
15414
15427
|
if (tickets) tickets.forEach((t) => cart2.addItem(createCartItem(t)));
|
|
15415
15428
|
return cart2;
|
|
15416
15429
|
}
|
|
15417
|
-
const cart = proxy(createCart([]));
|
|
15418
|
-
syncCartToLocalStorage(cart);
|
|
15419
15430
|
function formatCurrency(priceCents) {
|
|
15420
15431
|
priceCents = priceCents ?? 0;
|
|
15421
15432
|
return new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(priceCents / 100);
|
|
15422
15433
|
}
|
|
15434
|
+
const cart = proxy(createCart([]));
|
|
15435
|
+
syncCartToLocalStorage(cart);
|
|
15436
|
+
dispathCartEvents();
|
|
15423
15437
|
var root_2$p = /* @__PURE__ */ from_html(`<li data-go-cart-header-remove="">remove</li>`);
|
|
15424
15438
|
var root_5$2 = /* @__PURE__ */ from_html(`<span class="go-cart-item-time" data-testid="cart-item-time"> </span>`);
|
|
15425
15439
|
var root_4$4 = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <!>`, 1);
|
|
@@ -30874,7 +30888,7 @@ function TicketSegment($$anchor, $$props) {
|
|
|
30874
30888
|
const filters = prop($$props, "filters", 7);
|
|
30875
30889
|
const ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
|
|
30876
30890
|
if (!filters()) throw new Error("filters is required");
|
|
30877
|
-
if (!ticketSelectionDetails) throw new Error("Ticket
|
|
30891
|
+
if (!ticketSelectionDetails) throw new Error("Ticket Segment should be an ancestor of a Ticket Selection Details element");
|
|
30878
30892
|
const details = new TicketGroupDetails(filters(), ticketSelectionDetails);
|
|
30879
30893
|
setTicketGroupDetails($$props.$$host, details);
|
|
30880
30894
|
user_effect(() => {
|
|
@@ -1487,7 +1487,7 @@ export function getGetTickets200Response(): {
|
|
|
1487
1487
|
tickets: {
|
|
1488
1488
|
id: number;
|
|
1489
1489
|
title: string;
|
|
1490
|
-
ticket_type: "
|
|
1490
|
+
ticket_type: "time_slot" | "annual" | "normal";
|
|
1491
1491
|
bookable: boolean;
|
|
1492
1492
|
museum_ids: number[];
|
|
1493
1493
|
exhibition_ids: number[];
|