@gomusdev/web-components 4.13.1 → 4.14.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.
- package/README.md +12 -0
- package/dist-js/gomus-webcomponents.iife.js +554 -427
- package/dist-js/gomus-webcomponents.js +554 -427
- package/dist-js/gomus-webcomponents.min.iife.js +34 -34
- package/dist-js/gomus-webcomponents.min.js +3823 -3749
- package/dist-js/src/components/ticketSelection/filters/_helpers.d.ts +12 -0
- package/dist-js/src/components/ticketSelection/filters/registry.d.ts +1 -1
- package/dist-js/src/components/ticketSelection/filters/spec/tour.spec.d.ts +1 -0
- package/dist-js/src/components/ticketSelection/filters/tour.d.ts +3 -0
- package/dist-js/src/components/ticketSelection/filters/types.d.ts +18 -1
- package/dist-js/src/factories/TicketFactories.d.ts +4 -4
- package/dist-js/src/factories/TourFactories.d.ts +1 -1
- package/dist-js/src/go/cart.d.ts +18 -16
- package/dist-js/src/go/go.d.ts +3 -3
- package/dist-js/src/lib/models/tour/UITour.svelte.d.ts +2 -2
- package/package.json +1 -1
|
@@ -2,6 +2,18 @@ import { SegmentDetails } from '../../../../components/ticketSelection/subcompon
|
|
|
2
2
|
import { TicketSelectionDetails } from '../../../../components/ticketSelection/TicketSelectionDetails.svelte.ts';
|
|
3
3
|
import { UITicket } from '../../../../lib/models/ticket/UITicket.svelte.ts';
|
|
4
4
|
import { DateDetails, Quotas } from '@gomus/types';
|
|
5
|
+
/**
|
|
6
|
+
* The common tail of every ticket filter's `addToCart`: given the ticket
|
|
7
|
+
* its loader resolved, build the cart line, reject if the ticket is unavailable
|
|
8
|
+
* (sold out / unknown → the loader yielded nothing) or the quantity exceeds the
|
|
9
|
+
* remaining capacity, add the line, and return its uuid. Subtype-agnostic — the
|
|
10
|
+
* per-filter loader is the only thing that differs.
|
|
11
|
+
*/
|
|
12
|
+
export declare function addResolvedTicketToCart(ticket: UITicket | undefined, { id, quantity, time }: {
|
|
13
|
+
id: number;
|
|
14
|
+
quantity: number;
|
|
15
|
+
time?: string;
|
|
16
|
+
}): string;
|
|
5
17
|
/**
|
|
6
18
|
* When a segment opts into content attributes (with-content), batch-fetch
|
|
7
19
|
* tickets/content for the given tickets and merge each entry's `content` onto
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { FilterModule, FilterName } from './types.ts';
|
|
2
2
|
export declare function getFilter(name: FilterName): FilterModule;
|
|
3
3
|
export declare function allFilters(): FilterModule[];
|
|
4
|
-
export declare const validFilterNames: readonly ["ticket:timeslot", "ticket:day", "ticket:annual", "event:admission", "event:admission:day", "event:admission:timeslot", "event:price", "events:admission", "events:admission:day", "events:admission:timeslot", "events:price", "coupon"];
|
|
4
|
+
export declare const validFilterNames: readonly ["ticket:timeslot", "ticket:day", "ticket:annual", "event:admission", "event:admission:day", "event:admission:timeslot", "event:price", "events:admission", "events:admission:day", "events:admission:timeslot", "events:price", "coupon", "tour"];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TicketSelectionDetails } from '../../../../components/ticketSelection/TicketSelectionDetails.svelte.ts';
|
|
2
2
|
import { SegmentDetails } from '../../../../components/ticketSelection/subcomponents/tickets/subcomponents/segment/SegmentDetails.svelte.ts';
|
|
3
|
-
export declare const FILTER_NAMES: readonly ["ticket:timeslot", "ticket:day", "ticket:annual", "event:admission", "event:admission:day", "event:admission:timeslot", "event:price", "events:admission", "events:admission:day", "events:admission:timeslot", "events:price", "coupon"];
|
|
3
|
+
export declare const FILTER_NAMES: readonly ["ticket:timeslot", "ticket:day", "ticket:annual", "event:admission", "event:admission:day", "event:admission:timeslot", "event:price", "events:admission", "events:admission:day", "events:admission:timeslot", "events:price", "coupon", "tour"];
|
|
4
4
|
export type FilterName = (typeof FILTER_NAMES)[number];
|
|
5
5
|
export type Required = {
|
|
6
6
|
kind: 'tsd';
|
|
@@ -10,6 +10,13 @@ export type Required = {
|
|
|
10
10
|
field: keyof SegmentDetails;
|
|
11
11
|
};
|
|
12
12
|
export type CalendarEndpoint = 'tickets' | 'events' | null;
|
|
13
|
+
/**
|
|
14
|
+
* Args a filter's `addToCart` receives — the public `go.cart.addItem` options
|
|
15
|
+
* minus `filter`. Deliberately loose: each product kind carries different fields
|
|
16
|
+
* (a ticket has id/quantity/date|time; a tour has participants/languageId/…), so
|
|
17
|
+
* the receiving filter reads and validates the fields it needs.
|
|
18
|
+
*/
|
|
19
|
+
export type AddToCartOptions = Record<string, unknown>;
|
|
13
20
|
export interface FilterModule {
|
|
14
21
|
name: FilterName;
|
|
15
22
|
isCalendarVisible(tsd: TicketSelectionDetails): boolean;
|
|
@@ -17,6 +24,16 @@ export interface FilterModule {
|
|
|
17
24
|
isTicketsVisible(tsd: TicketSelectionDetails): boolean;
|
|
18
25
|
loadProducts(segment: SegmentDetails): Promise<void>;
|
|
19
26
|
loadTimeslots(tsd: TicketSelectionDetails): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Add ONE product straight to the cart — the headless entry behind the public
|
|
29
|
+
* `go.cart.addItem({ filter, … })` API. The filter owns its kind end-to-end:
|
|
30
|
+
* validate the args it needs, resolve the product (fetch by id / build from
|
|
31
|
+
* the given attributes), capacity-gate where it applies, add the line, and
|
|
32
|
+
* return its uuid. Throws on invalid args or an unavailable product. Optional
|
|
33
|
+
* because not every filter is addable (coupon / the event listings aren't yet);
|
|
34
|
+
* `go.cart.addItem` rejects a `filter` that doesn't implement it.
|
|
35
|
+
*/
|
|
36
|
+
addToCart?(options: AddToCartOptions): Promise<string>;
|
|
20
37
|
calendarEndpoint: CalendarEndpoint;
|
|
21
38
|
apiToken?: string;
|
|
22
39
|
requires: ReadonlyArray<Required>;
|
|
@@ -46,7 +46,7 @@ export declare const TicketFactories: {
|
|
|
46
46
|
max_total_capacity: number;
|
|
47
47
|
shipped_with_merchandise_id: null;
|
|
48
48
|
restricted_shop_account: boolean;
|
|
49
|
-
dynamic_prices: null;
|
|
49
|
+
dynamic_prices: Record<string, number> | null;
|
|
50
50
|
};
|
|
51
51
|
day(options?: Partial<ReturnType<typeof defaultTicket>>): {
|
|
52
52
|
type: ProductType;
|
|
@@ -90,7 +90,7 @@ export declare const TicketFactories: {
|
|
|
90
90
|
max_total_capacity: number;
|
|
91
91
|
shipped_with_merchandise_id: null;
|
|
92
92
|
restricted_shop_account: boolean;
|
|
93
|
-
dynamic_prices: null;
|
|
93
|
+
dynamic_prices: Record<string, number> | null;
|
|
94
94
|
};
|
|
95
95
|
mantle(options?: Partial<ReturnType<typeof defaultTicket>>): {
|
|
96
96
|
type: ProductType;
|
|
@@ -134,7 +134,7 @@ export declare const TicketFactories: {
|
|
|
134
134
|
max_total_capacity: number;
|
|
135
135
|
shipped_with_merchandise_id: null;
|
|
136
136
|
restricted_shop_account: boolean;
|
|
137
|
-
dynamic_prices: null;
|
|
137
|
+
dynamic_prices: Record<string, number> | null;
|
|
138
138
|
};
|
|
139
139
|
/**
|
|
140
140
|
* A backend order-echo ticket item (the shape go-order-breakdown renders).
|
|
@@ -186,6 +186,6 @@ declare function defaultTicket(): {
|
|
|
186
186
|
max_total_capacity: number;
|
|
187
187
|
shipped_with_merchandise_id: null;
|
|
188
188
|
restricted_shop_account: boolean;
|
|
189
|
-
dynamic_prices: null;
|
|
189
|
+
dynamic_prices: Record<string, number> | null;
|
|
190
190
|
};
|
|
191
191
|
export {};
|
|
@@ -7,7 +7,7 @@ type TourOrderItem = Extract<OrderItem, {
|
|
|
7
7
|
type: 'Tour';
|
|
8
8
|
}>;
|
|
9
9
|
export declare const TourFactories: {
|
|
10
|
-
/** The camelCase
|
|
10
|
+
/** The camelCase attributes an integrator passes under go.cart.addItem({ filter: 'tour', … }). */
|
|
11
11
|
addTourOptions(overrides?: Partial<AddTourOptionsShape>): AddTourOptionsShape;
|
|
12
12
|
/** A UITour product with a fixed instanceKey for stable uuids/snapshots. */
|
|
13
13
|
tour(overrides?: Partial<TourAttributes>, instanceKey?: string): {
|
package/dist-js/src/go/cart.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FilterName } from '../../components/ticketSelection/filters/types.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Options for go.cart.
|
|
4
|
-
* the
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* uuid. Every call appends a NEW line — identical bookings coexist; use the
|
|
13
|
-
* returned uuid to deduplicate or remove.
|
|
3
|
+
* Options for `go.cart.addItem` — the one generic "add a product to the cart"
|
|
4
|
+
* call. `filter` names the registry filter that knows how to resolve and add
|
|
5
|
+
* that product kind; the remaining fields are that filter's own args, which it
|
|
6
|
+
* validates. Filter names are part of the public API:
|
|
7
|
+
*
|
|
8
|
+
* go.cart.addItem({ filter: 'ticket:day', id, quantity, date })
|
|
9
|
+
* go.cart.addItem({ filter: 'ticket:timeslot', id, quantity, time })
|
|
10
|
+
* go.cart.addItem({ filter: 'ticket:annual', id, quantity })
|
|
11
|
+
* go.cart.addItem({ filter: 'tour', id, time, participants, languageId, totalPriceCents, title, … })
|
|
14
12
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* verified by the backend only at checkout.
|
|
13
|
+
* New product kinds are added by giving their filter an `addToCart` — no change
|
|
14
|
+
* here (WI #129; replaces the per-product addTicket/addTour).
|
|
18
15
|
*/
|
|
19
|
-
export
|
|
16
|
+
export type AddItemOptions = {
|
|
17
|
+
filter: FilterName;
|
|
18
|
+
} & Record<string, unknown>;
|
|
19
|
+
/** Resolves with the new cart line's uuid. Throws if the filter can't add to
|
|
20
|
+
* the cart, or on the filter's own validation / availability errors. */
|
|
21
|
+
export declare function addItem({ filter, ...options }: AddItemOptions): Promise<string>;
|
package/dist-js/src/go/go.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CustomerAddressesResult, CustomerMembershipsResult, OrdersResult, ValidateTokenResult } from '../../lib/stores/shop.svelte.ts';
|
|
2
2
|
import { OrdersParams } from '@gomus/types';
|
|
3
|
-
import {
|
|
3
|
+
import { AddItemOptions } from '../../go/cart.ts';
|
|
4
4
|
export type { CustomerAddressesResult, CustomerMembershipsResult, OrdersResult, ValidateTokenResult, } from '../../lib/stores/shop.svelte.ts';
|
|
5
5
|
export type Command = {
|
|
6
|
-
method: 'load' | 'config' | 'init' | 'cart.
|
|
6
|
+
method: 'load' | 'config' | 'init' | 'cart.addItem' | (string & {});
|
|
7
7
|
options: Record<string, unknown>;
|
|
8
8
|
};
|
|
9
9
|
export declare function initGo(window: {
|
|
@@ -24,7 +24,7 @@ export declare const go: {
|
|
|
24
24
|
getCustomerMemberships: () => Promise<CustomerMembershipsResult>;
|
|
25
25
|
};
|
|
26
26
|
cart: {
|
|
27
|
-
|
|
27
|
+
addItem: (options: AddItemOptions) => Promise<string>;
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
30
|
export type Go = typeof go;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Group-tour product added programmatically via go.cart.
|
|
2
|
+
* Group-tour product added programmatically via go.cart.addItem({ filter: 'tour', … }) (WI #128).
|
|
3
3
|
*
|
|
4
4
|
* Tours are not priced by the shop API: POST /api/v4/cart echoes tour lines
|
|
5
5
|
* verbatim, so `totalPriceCents` is the integrator-supplied booking total
|
|
@@ -48,7 +48,7 @@ export declare function isUITour(x: {
|
|
|
48
48
|
} | null | undefined): x is UITour;
|
|
49
49
|
interface Options {
|
|
50
50
|
/**
|
|
51
|
-
* Uniqueness key for the cart-line uuid. Every
|
|
51
|
+
* Uniqueness key for the cart-line uuid. Every tour add appends a NEW
|
|
52
52
|
* cart line (no merge — locked contract), so each UITour needs its own key;
|
|
53
53
|
* it is persisted with the product so rehydrated lines keep their identity.
|
|
54
54
|
* Overridable for deterministic factories/specs.
|