@gomusdev/web-components 0.0.20 → 0.0.21

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.
@@ -2,7 +2,8 @@ import { Cart } from '../cart/lib/cart.svelte.ts';
2
2
  import { TicketGroupDetails } from './subcomponents/tickets/subcomponents/TicketGroup.svelte.ts';
3
3
  import { CalendarDate } from '@internationalized/date';
4
4
  export type TicketSelectionMode = 'ticket' | 'event' | 'tour';
5
- export type TicketSelectionFilter = 'timeslot' | 'normal' | 'annual';
5
+ export declare const validTicketSelectionFilters: readonly ["timeslot", "normal", "annual"];
6
+ export type TicketSelectionFilter = (typeof validTicketSelectionFilters)[number];
6
7
  export declare class TicketSelectionDetails {
7
8
  uid: number;
8
9
  mode: TicketSelectionMode | undefined;
@@ -282,7 +282,7 @@ export declare class TicketGroupDetails {
282
282
  addItem(item: import('../../../../cart/lib/CartItem').CartItem): void;
283
283
  addItems(items: import('../../../../cart/lib/CartItem').CartItem[]): void;
284
284
  };
285
- type: TicketGroupType;
285
+ filters: TicketGroupType;
286
286
  ticketSelectionDetails: TicketSelectionDetails | undefined;
287
287
  constructor(type: TicketGroupType, ticketSelectionDetails: TicketSelectionDetails);
288
288
  preCartTickets(): ({
@@ -1,121 +1 @@
1
- export declare const mockedTicketsAndQuotas: {
2
- tickets: {
3
- '1': {
4
- id: number;
5
- title: string;
6
- ticket_type: "time_slot" | "annual" | "normal";
7
- bookable: boolean;
8
- museum_ids: number[];
9
- exhibition_ids: number[];
10
- price_cents: number;
11
- discount: number;
12
- vat_pct: number;
13
- tax_included: boolean;
14
- entry_duration: number | null;
15
- min_persons: number;
16
- max_persons: number;
17
- quota_ids: number[];
18
- first_entry: number;
19
- last_entry: number;
20
- personalizeable: boolean;
21
- attendees: boolean | string;
22
- identification: boolean | string;
23
- free_timing: boolean;
24
- is_collective: boolean;
25
- is_upgrade: boolean;
26
- is_mantle: boolean;
27
- description: string | null;
28
- sub_ticket_ids: number[];
29
- sub_tickets: {
30
- [key: string]: {
31
- title?: string;
32
- min_persons?: number;
33
- max_persons?: number;
34
- description?: string | null;
35
- };
36
- } | null;
37
- is_sub_ticket: boolean;
38
- created_at: string;
39
- updated_at: string;
40
- shop_order: number;
41
- shipped_with_merchandise_id: number | null;
42
- restricted_shop_account: boolean;
43
- cash_point_order: number;
44
- capacities: {
45
- [key: string]: number;
46
- };
47
- total_capacities: {
48
- [key: string]: number;
49
- };
50
- max_capacity: number;
51
- max_total_capacity: number;
52
- dynamic_prices: {
53
- [key: string]: number;
54
- } | null;
55
- };
56
- '2': {
57
- id: number;
58
- title: string;
59
- ticket_type: "time_slot" | "annual" | "normal";
60
- bookable: boolean;
61
- museum_ids: number[];
62
- exhibition_ids: number[];
63
- price_cents: number;
64
- discount: number;
65
- vat_pct: number;
66
- tax_included: boolean;
67
- entry_duration: number | null;
68
- min_persons: number;
69
- max_persons: number;
70
- quota_ids: number[];
71
- first_entry: number;
72
- last_entry: number;
73
- personalizeable: boolean;
74
- attendees: boolean | string;
75
- identification: boolean | string;
76
- free_timing: boolean;
77
- is_collective: boolean;
78
- is_upgrade: boolean;
79
- is_mantle: boolean;
80
- description: string | null;
81
- sub_ticket_ids: number[];
82
- sub_tickets: {
83
- [key: string]: {
84
- title?: string;
85
- min_persons?: number;
86
- max_persons?: number;
87
- description?: string | null;
88
- };
89
- } | null;
90
- is_sub_ticket: boolean;
91
- created_at: string;
92
- updated_at: string;
93
- shop_order: number;
94
- shipped_with_merchandise_id: number | null;
95
- restricted_shop_account: boolean;
96
- cash_point_order: number;
97
- capacities: {
98
- [key: string]: number;
99
- };
100
- total_capacities: {
101
- [key: string]: number;
102
- };
103
- max_capacity: number;
104
- max_total_capacity: number;
105
- dynamic_prices: {
106
- [key: string]: number;
107
- } | null;
108
- };
109
- };
110
- quotas: {
111
- '1': {
112
- ticket_ids: number[];
113
- capacities: {
114
- [key: string]: number;
115
- };
116
- total_capacities: {
117
- [key: string]: number;
118
- };
119
- };
120
- };
121
- };
1
+ export {};
@@ -1228,11 +1228,20 @@ h2 {
1228
1228
  justify-content: space-between;
1229
1229
  }
1230
1230
 
1231
- .page-container,
1231
+ .component-container {
1232
+ max-width: 650px;
1233
+ margin: 0 auto;
1234
+ box-shadow:
1235
+ 0 4px 12px rgba(12, 12, 12, 0.15),
1236
+ 0 0 0 1px rgba(0, 0, 0, 0.05);
1237
+ border-radius: 3px;
1238
+ padding: 32px 32px 48px;
1239
+
1240
+ margin: 2rem auto;
1241
+ }
1232
1242
  go-cart,
1233
1243
  go-ticket-selection,
1234
1244
  go-if {
1235
- max-width: 650px;
1236
- margin: 4rem auto;
1245
+ width: 100%;
1237
1246
  display: block;
1238
1247
  }
@@ -11,7 +11,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
12
  (function() {
13
13
  "use strict";
14
- var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _mode, _filters, _eventId, _museumIds, _exhibitionIds, _ticketIds, _selectedDate, _selectedTimeslot, _ticketGroups, _preCarts, _tickets, _preCart, _type, _ticketSelectionDetails, _ticketSelectionDetails2, _b, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _c, _details, _params, _ticketSelectionDetails3;
14
+ var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _mode, _filters, _eventId, _museumIds, _exhibitionIds, _ticketIds, _selectedDate, _selectedTimeslot, _ticketGroups, _preCarts, _tickets, _preCart, _filters2, _ticketSelectionDetails, _ticketSelectionDetails2, _b, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _c, _details, _params, _ticketSelectionDetails3;
15
15
  const PUBLIC_VERSION = "5";
16
16
  if (typeof window !== "undefined") {
17
17
  ((_a = window.__svelte ?? (window.__svelte = {})).v ?? (_a.v = /* @__PURE__ */ new Set())).add(PUBLIC_VERSION);
@@ -4867,6 +4867,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4867
4867
  const parsed = ids.split(",").map((id) => id.trim()).map(Number).filter((num) => !isNaN(num) && num > 0);
4868
4868
  return parsed.length > 0 ? parsed : void 0;
4869
4869
  }
4870
+ function parseTokens(tokens, possibleTokens) {
4871
+ if (!tokens) {
4872
+ return void 0;
4873
+ }
4874
+ const parsed = tokens.split(",").map((token) => token.trim()).map(String).filter((token) => token.length > 0);
4875
+ parsed.forEach((token) => {
4876
+ if (!possibleTokens.includes(token)) {
4877
+ throw new Error("(parseTokens) Invalid token: " + token);
4878
+ }
4879
+ });
4880
+ return parsed.length > 0 ? parsed : void 0;
4881
+ }
4870
4882
  class User {
4871
4883
  get isAuthenticated() {
4872
4884
  return this.isLoggedIn || this.isGuest;
@@ -11518,6 +11530,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11518
11530
  }
11519
11531
  };
11520
11532
  }
11533
+ const validTicketSelectionFilters = ["timeslot", "normal", "annual"];
11521
11534
  let lastUId = 0;
11522
11535
  class TicketSelectionDetails {
11523
11536
  constructor() {
@@ -11742,13 +11755,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11742
11755
  create_custom_element(Wrapper, { host: {}, children: {} }, [], [], true);
11743
11756
  function TicketSelection($$anchor, $$props) {
11744
11757
  push($$props, true);
11745
- let mode = prop($$props, "mode", 7), filter = prop($$props, "filter", 7), eventId = prop($$props, "eventId", 7), children = prop($$props, "children", 7), museumIds = prop($$props, "museumIds", 7), exhibitionIds = prop($$props, "exhibitionIds", 7), ticketIds = prop($$props, "ticketIds", 7), restProps = /* @__PURE__ */ rest_props($$props, [
11758
+ let mode = prop($$props, "mode", 7), filters = prop($$props, "filters", 7), eventId = prop($$props, "eventId", 7), children = prop($$props, "children", 7), museumIds = prop($$props, "museumIds", 7), exhibitionIds = prop($$props, "exhibitionIds", 7), ticketIds = prop($$props, "ticketIds", 7), restProps = /* @__PURE__ */ rest_props($$props, [
11746
11759
  "$$slots",
11747
11760
  "$$events",
11748
11761
  "$$legacy",
11749
11762
  "$$host",
11750
11763
  "mode",
11751
- "filter",
11764
+ "filters",
11752
11765
  "eventId",
11753
11766
  "children",
11754
11767
  "museumIds",
@@ -11758,7 +11771,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11758
11771
  const details = new TicketSelectionDetails();
11759
11772
  user_effect(() => {
11760
11773
  details.mode = mode();
11761
- details.filters = [filter()];
11774
+ details.filters = parseTokens(filters(), validTicketSelectionFilters);
11762
11775
  details.eventId = eventId();
11763
11776
  details.museumIds = parseIds(museumIds());
11764
11777
  details.exhibitionIds = parseIds(exhibitionIds());
@@ -11783,11 +11796,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11783
11796
  mode($$value);
11784
11797
  flushSync();
11785
11798
  },
11786
- get filter() {
11787
- return filter();
11799
+ get filters() {
11800
+ return filters();
11788
11801
  },
11789
- set filter($$value) {
11790
- filter($$value);
11802
+ set filters($$value) {
11803
+ filters($$value);
11791
11804
  flushSync();
11792
11805
  },
11793
11806
  get eventId() {
@@ -11835,7 +11848,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11835
11848
  ticketIds: { attribute: "ticket-ids", reflect: true, type: "String" },
11836
11849
  museumIds: { attribute: "museum-ids", reflect: true, type: "String" },
11837
11850
  exhibitionIds: { attribute: "exhibition-ids", reflect: true, type: "String" },
11838
- filter: {},
11851
+ filters: {},
11839
11852
  children: {}
11840
11853
  },
11841
11854
  [],
@@ -11871,9 +11884,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11871
11884
  constructor(type, ticketSelectionDetails) {
11872
11885
  __privateAdd(this, _tickets, /* @__PURE__ */ state(proxy([])));
11873
11886
  __privateAdd(this, _preCart, /* @__PURE__ */ user_derived(() => createCart(this.preCartTickets())));
11874
- __privateAdd(this, _type, /* @__PURE__ */ state("timeslot"));
11887
+ __privateAdd(this, _filters2, /* @__PURE__ */ state("timeslot"));
11875
11888
  __privateAdd(this, _ticketSelectionDetails, /* @__PURE__ */ state());
11876
- this.type = type;
11889
+ this.filters = type;
11877
11890
  this.ticketSelectionDetails = ticketSelectionDetails;
11878
11891
  this.ticketSelectionDetails.addTicketGroup(this);
11879
11892
  }
@@ -11889,11 +11902,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11889
11902
  set preCart(value) {
11890
11903
  set(__privateGet(this, _preCart), value);
11891
11904
  }
11892
- get type() {
11893
- return get(__privateGet(this, _type));
11905
+ get filters() {
11906
+ return get(__privateGet(this, _filters2));
11894
11907
  }
11895
- set type(value) {
11896
- set(__privateGet(this, _type), value, true);
11908
+ set filters(value) {
11909
+ set(__privateGet(this, _filters2), value, true);
11897
11910
  }
11898
11911
  get ticketSelectionDetails() {
11899
11912
  return get(__privateGet(this, _ticketSelectionDetails));
@@ -11902,7 +11915,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11902
11915
  set(__privateGet(this, _ticketSelectionDetails), value, true);
11903
11916
  }
11904
11917
  preCartTickets() {
11905
- switch (this.type) {
11918
+ switch (this.filters) {
11906
11919
  case "timeslot":
11907
11920
  return this.timeslotTickets;
11908
11921
  case "annual":
@@ -11910,7 +11923,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11910
11923
  case "custom":
11911
11924
  return this.tickets;
11912
11925
  default:
11913
- const exhaustiveCheck = this.type;
11926
+ const exhaustiveCheck = this.filters;
11914
11927
  if (exhaustiveCheck) throw new Error(`(TicketGroup) Unhandled case: ${exhaustiveCheck}`);
11915
11928
  }
11916
11929
  return [];
@@ -11949,37 +11962,37 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11949
11962
  }
11950
11963
  _tickets = new WeakMap();
11951
11964
  _preCart = new WeakMap();
11952
- _type = new WeakMap();
11965
+ _filters2 = new WeakMap();
11953
11966
  _ticketSelectionDetails = new WeakMap();
11954
11967
  const KEY = "go-ticket-group";
11955
11968
  const setTicketGroupDetails = createSetDetails(KEY);
11956
11969
  const getTicketGroupDetails = createGetDetails(KEY);
11957
11970
  function TicketGroup($$anchor, $$props) {
11958
11971
  push($$props, true);
11959
- const type = prop($$props, "type", 7);
11972
+ const filters = prop($$props, "filters", 7);
11960
11973
  const ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
11961
- if (!type()) {
11962
- throw new Error("type is required");
11974
+ if (!filters()) {
11975
+ debugger;
11976
+ throw new Error("filters is required");
11963
11977
  }
11964
11978
  if (!ticketSelectionDetails) throw new Error("Ticket Group should be an ancestor of a Ticket Selection Details element");
11965
- const details = new TicketGroupDetails(type(), ticketSelectionDetails);
11979
+ const details = new TicketGroupDetails(filters(), ticketSelectionDetails);
11966
11980
  setTicketGroupDetails($$props.$$host, details);
11967
11981
  user_effect(() => {
11968
- console.log("setting type");
11969
- details.type = type();
11982
+ details.filters = filters();
11970
11983
  });
11971
11984
  return pop({
11972
11985
  details,
11973
- get type() {
11974
- return type();
11986
+ get filters() {
11987
+ return filters();
11975
11988
  },
11976
- set type($$value) {
11977
- type($$value);
11989
+ set filters($$value) {
11990
+ filters($$value);
11978
11991
  flushSync();
11979
11992
  }
11980
11993
  });
11981
11994
  }
11982
- customElements.define("go-ticket-group", create_custom_element(TicketGroup, { type: { reflect: true } }, [], ["details"], false));
11995
+ customElements.define("go-ticket-group", create_custom_element(TicketGroup, { filters: {} }, [], ["details"], false));
11983
11996
  function updateSelectedTickets(ci, target, tsd) {
11984
11997
  if (!tsd) {
11985
11998
  console.warn("tsd is undefined");
@@ -9,7 +9,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
11
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
12
- var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _mode, _filters, _eventId, _museumIds, _exhibitionIds, _ticketIds, _selectedDate, _selectedTimeslot, _ticketGroups, _preCarts, _tickets, _preCart, _type, _ticketSelectionDetails, _ticketSelectionDetails2, _b, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _c, _details, _params, _ticketSelectionDetails3;
12
+ var _a, _previous, _callbacks, _pending, _deferred, _neutered, _async_effects, _boundary_async_effects, _render_effects, _effects, _block_effects, _dirty_effects, _maybe_dirty_effects, _Batch_instances, traverse_effect_tree_fn, defer_effects_fn, commit_fn, _events, _instance, _data, _fetchStatus, _Shop_instances, defaultApiParams_get, _canFetch, _ensureFetch, _mode, _filters, _eventId, _museumIds, _exhibitionIds, _ticketIds, _selectedDate, _selectedTimeslot, _ticketGroups, _preCarts, _tickets, _preCart, _filters2, _ticketSelectionDetails, _ticketSelectionDetails2, _b, _document, _subscribe, _name, _key, _root, _variant, _prefix, _visibleMonths, _months, _weekdays, _initialPlaceholderYear, _defaultYears, _CalendarRootState_instances, setupInitialFocusEffect_fn, setupAccessibleHeadingEffect_fn, setupFormatterEffect_fn, _isNextButtonDisabled, _isPrevButtonDisabled, _isInvalid, _headingValue, _fullCalendarLabel, isMultipleSelectionValid_fn, _snippetProps, _props, _props2, _cellDate, _isUnavailable, _isDateToday, _isOutsideMonth, _isOutsideVisibleMonths, _isDisabled, _isFocusedDate, _isSelectedDate, _labelText, _snippetProps2, _ariaDisabled, _sharedDataAttrs, _props3, _tabindex, _snippetProps3, _props4, _isDisabled2, _props5, _isDisabled3, _props6, _props7, _props8, _props9, _props10, _props11, _props12, _startAt, _selected, _c, _details, _params, _ticketSelectionDetails3;
13
13
  const PUBLIC_VERSION = "5";
14
14
  if (typeof window !== "undefined") {
15
15
  ((_a = window.__svelte ?? (window.__svelte = {})).v ?? (_a.v = /* @__PURE__ */ new Set())).add(PUBLIC_VERSION);
@@ -4867,6 +4867,18 @@ function parseIds(ids) {
4867
4867
  const parsed = ids.split(",").map((id) => id.trim()).map(Number).filter((num) => !isNaN(num) && num > 0);
4868
4868
  return parsed.length > 0 ? parsed : void 0;
4869
4869
  }
4870
+ function parseTokens(tokens, possibleTokens) {
4871
+ if (!tokens) {
4872
+ return void 0;
4873
+ }
4874
+ const parsed = tokens.split(",").map((token) => token.trim()).map(String).filter((token) => token.length > 0);
4875
+ parsed.forEach((token) => {
4876
+ if (!possibleTokens.includes(token)) {
4877
+ throw new Error("(parseTokens) Invalid token: " + token);
4878
+ }
4879
+ });
4880
+ return parsed.length > 0 ? parsed : void 0;
4881
+ }
4870
4882
  class User {
4871
4883
  get isAuthenticated() {
4872
4884
  return this.isLoggedIn || this.isGuest;
@@ -11518,6 +11530,7 @@ function createGetDetails(KEY2) {
11518
11530
  }
11519
11531
  };
11520
11532
  }
11533
+ const validTicketSelectionFilters = ["timeslot", "normal", "annual"];
11521
11534
  let lastUId = 0;
11522
11535
  class TicketSelectionDetails {
11523
11536
  constructor() {
@@ -11742,13 +11755,13 @@ function Wrapper($$anchor, $$props) {
11742
11755
  create_custom_element(Wrapper, { host: {}, children: {} }, [], [], true);
11743
11756
  function TicketSelection($$anchor, $$props) {
11744
11757
  push($$props, true);
11745
- let mode = prop($$props, "mode", 7), filter = prop($$props, "filter", 7), eventId = prop($$props, "eventId", 7), children = prop($$props, "children", 7), museumIds = prop($$props, "museumIds", 7), exhibitionIds = prop($$props, "exhibitionIds", 7), ticketIds = prop($$props, "ticketIds", 7), restProps = /* @__PURE__ */ rest_props($$props, [
11758
+ let mode = prop($$props, "mode", 7), filters = prop($$props, "filters", 7), eventId = prop($$props, "eventId", 7), children = prop($$props, "children", 7), museumIds = prop($$props, "museumIds", 7), exhibitionIds = prop($$props, "exhibitionIds", 7), ticketIds = prop($$props, "ticketIds", 7), restProps = /* @__PURE__ */ rest_props($$props, [
11746
11759
  "$$slots",
11747
11760
  "$$events",
11748
11761
  "$$legacy",
11749
11762
  "$$host",
11750
11763
  "mode",
11751
- "filter",
11764
+ "filters",
11752
11765
  "eventId",
11753
11766
  "children",
11754
11767
  "museumIds",
@@ -11758,7 +11771,7 @@ function TicketSelection($$anchor, $$props) {
11758
11771
  const details = new TicketSelectionDetails();
11759
11772
  user_effect(() => {
11760
11773
  details.mode = mode();
11761
- details.filters = [filter()];
11774
+ details.filters = parseTokens(filters(), validTicketSelectionFilters);
11762
11775
  details.eventId = eventId();
11763
11776
  details.museumIds = parseIds(museumIds());
11764
11777
  details.exhibitionIds = parseIds(exhibitionIds());
@@ -11783,11 +11796,11 @@ function TicketSelection($$anchor, $$props) {
11783
11796
  mode($$value);
11784
11797
  flushSync();
11785
11798
  },
11786
- get filter() {
11787
- return filter();
11799
+ get filters() {
11800
+ return filters();
11788
11801
  },
11789
- set filter($$value) {
11790
- filter($$value);
11802
+ set filters($$value) {
11803
+ filters($$value);
11791
11804
  flushSync();
11792
11805
  },
11793
11806
  get eventId() {
@@ -11835,7 +11848,7 @@ customElements.define("go-ticket-selection", create_custom_element(
11835
11848
  ticketIds: { attribute: "ticket-ids", reflect: true, type: "String" },
11836
11849
  museumIds: { attribute: "museum-ids", reflect: true, type: "String" },
11837
11850
  exhibitionIds: { attribute: "exhibition-ids", reflect: true, type: "String" },
11838
- filter: {},
11851
+ filters: {},
11839
11852
  children: {}
11840
11853
  },
11841
11854
  [],
@@ -11871,9 +11884,9 @@ class TicketGroupDetails {
11871
11884
  constructor(type, ticketSelectionDetails) {
11872
11885
  __privateAdd(this, _tickets, /* @__PURE__ */ state(proxy([])));
11873
11886
  __privateAdd(this, _preCart, /* @__PURE__ */ user_derived(() => createCart(this.preCartTickets())));
11874
- __privateAdd(this, _type, /* @__PURE__ */ state("timeslot"));
11887
+ __privateAdd(this, _filters2, /* @__PURE__ */ state("timeslot"));
11875
11888
  __privateAdd(this, _ticketSelectionDetails, /* @__PURE__ */ state());
11876
- this.type = type;
11889
+ this.filters = type;
11877
11890
  this.ticketSelectionDetails = ticketSelectionDetails;
11878
11891
  this.ticketSelectionDetails.addTicketGroup(this);
11879
11892
  }
@@ -11889,11 +11902,11 @@ class TicketGroupDetails {
11889
11902
  set preCart(value) {
11890
11903
  set(__privateGet(this, _preCart), value);
11891
11904
  }
11892
- get type() {
11893
- return get(__privateGet(this, _type));
11905
+ get filters() {
11906
+ return get(__privateGet(this, _filters2));
11894
11907
  }
11895
- set type(value) {
11896
- set(__privateGet(this, _type), value, true);
11908
+ set filters(value) {
11909
+ set(__privateGet(this, _filters2), value, true);
11897
11910
  }
11898
11911
  get ticketSelectionDetails() {
11899
11912
  return get(__privateGet(this, _ticketSelectionDetails));
@@ -11902,7 +11915,7 @@ class TicketGroupDetails {
11902
11915
  set(__privateGet(this, _ticketSelectionDetails), value, true);
11903
11916
  }
11904
11917
  preCartTickets() {
11905
- switch (this.type) {
11918
+ switch (this.filters) {
11906
11919
  case "timeslot":
11907
11920
  return this.timeslotTickets;
11908
11921
  case "annual":
@@ -11910,7 +11923,7 @@ class TicketGroupDetails {
11910
11923
  case "custom":
11911
11924
  return this.tickets;
11912
11925
  default:
11913
- const exhaustiveCheck = this.type;
11926
+ const exhaustiveCheck = this.filters;
11914
11927
  if (exhaustiveCheck) throw new Error(`(TicketGroup) Unhandled case: ${exhaustiveCheck}`);
11915
11928
  }
11916
11929
  return [];
@@ -11949,37 +11962,37 @@ class TicketGroupDetails {
11949
11962
  }
11950
11963
  _tickets = new WeakMap();
11951
11964
  _preCart = new WeakMap();
11952
- _type = new WeakMap();
11965
+ _filters2 = new WeakMap();
11953
11966
  _ticketSelectionDetails = new WeakMap();
11954
11967
  const KEY = "go-ticket-group";
11955
11968
  const setTicketGroupDetails = createSetDetails(KEY);
11956
11969
  const getTicketGroupDetails = createGetDetails(KEY);
11957
11970
  function TicketGroup($$anchor, $$props) {
11958
11971
  push($$props, true);
11959
- const type = prop($$props, "type", 7);
11972
+ const filters = prop($$props, "filters", 7);
11960
11973
  const ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
11961
- if (!type()) {
11962
- throw new Error("type is required");
11974
+ if (!filters()) {
11975
+ debugger;
11976
+ throw new Error("filters is required");
11963
11977
  }
11964
11978
  if (!ticketSelectionDetails) throw new Error("Ticket Group should be an ancestor of a Ticket Selection Details element");
11965
- const details = new TicketGroupDetails(type(), ticketSelectionDetails);
11979
+ const details = new TicketGroupDetails(filters(), ticketSelectionDetails);
11966
11980
  setTicketGroupDetails($$props.$$host, details);
11967
11981
  user_effect(() => {
11968
- console.log("setting type");
11969
- details.type = type();
11982
+ details.filters = filters();
11970
11983
  });
11971
11984
  return pop({
11972
11985
  details,
11973
- get type() {
11974
- return type();
11986
+ get filters() {
11987
+ return filters();
11975
11988
  },
11976
- set type($$value) {
11977
- type($$value);
11989
+ set filters($$value) {
11990
+ filters($$value);
11978
11991
  flushSync();
11979
11992
  }
11980
11993
  });
11981
11994
  }
11982
- customElements.define("go-ticket-group", create_custom_element(TicketGroup, { type: { reflect: true } }, [], ["details"], false));
11995
+ customElements.define("go-ticket-group", create_custom_element(TicketGroup, { filters: {} }, [], ["details"], false));
11983
11996
  function updateSelectedTickets(ci, target, tsd) {
11984
11997
  if (!tsd) {
11985
11998
  console.warn("tsd is undefined");
@@ -5,6 +5,7 @@ interface Options {
5
5
  quantity?: number;
6
6
  }
7
7
  type UITicketTypes = 'timeslot' | 'annual' | 'day';
8
+ export type UITicket = ReturnType<typeof createUITicket>;
8
9
  export declare function createUITicket(apiTicket: Ticket | AnnualTicket, options?: Options): {
9
10
  type: UITicketTypes;
10
11
  shop_order: number;
@@ -118,5 +119,4 @@ export declare function createUITicket(apiTicket: Ticket | AnnualTicket, options
118
119
  uid: number;
119
120
  };
120
121
  export declare function initUITimeslotTickets(tickets: Tickets): UITicket[];
121
- export type UITicket = ReturnType<typeof createUITicket>;
122
122
  export {};
@@ -22,3 +22,4 @@ export declare function currency(value: number, currency: string): string;
22
22
  * ```
23
23
  */
24
24
  export declare function parseIds(ids: string | undefined): number[] | undefined;
25
+ export declare function parseTokens<ValidToken>(tokens: string | undefined, possibleTokens: readonly ValidToken[]): ValidToken[] | undefined;
@@ -1,3 +1 @@
1
- export declare const getShop_success: import('msw').HttpHandler;
2
- export declare const getShop_fail: import('msw').HttpHandler;
3
- export declare const dummyShop: readonly ["https://example.com", "dummy_shop_domain", "en"];
1
+ export {};
@@ -0,0 +1,179 @@
1
+ import { Quota, Ticket, TimeSlot } from '@gomus/types';
2
+ export declare const dummyShop: readonly ["https://example.com", "dummy_shop_domain", "en"];
3
+ export declare const mockedTicketsAndQuotas: {
4
+ tickets: {
5
+ '1': {
6
+ id: number;
7
+ title: string;
8
+ ticket_type: "time_slot" | "annual" | "normal";
9
+ bookable: boolean;
10
+ museum_ids: number[];
11
+ exhibition_ids: number[];
12
+ price_cents: number;
13
+ discount: number;
14
+ vat_pct: number;
15
+ tax_included: boolean;
16
+ entry_duration: number | null;
17
+ min_persons: number;
18
+ max_persons: number;
19
+ quota_ids: number[];
20
+ first_entry: number;
21
+ last_entry: number;
22
+ personalizeable: boolean;
23
+ attendees: boolean | string;
24
+ identification: boolean | string;
25
+ free_timing: boolean;
26
+ is_collective: boolean;
27
+ is_upgrade: boolean;
28
+ is_mantle: boolean;
29
+ description: string | null;
30
+ sub_ticket_ids: number[];
31
+ sub_tickets: {
32
+ [key: string]: {
33
+ title?: string;
34
+ min_persons?: number;
35
+ max_persons?: number;
36
+ description?: string | null;
37
+ };
38
+ } | null;
39
+ is_sub_ticket: boolean;
40
+ created_at: string;
41
+ updated_at: string;
42
+ shop_order: number;
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
+ '2': {
59
+ id: number;
60
+ title: string;
61
+ ticket_type: "time_slot" | "annual" | "normal";
62
+ bookable: boolean;
63
+ museum_ids: number[];
64
+ exhibition_ids: number[];
65
+ price_cents: number;
66
+ discount: number;
67
+ vat_pct: number;
68
+ tax_included: boolean;
69
+ entry_duration: number | null;
70
+ min_persons: number;
71
+ max_persons: number;
72
+ quota_ids: number[];
73
+ first_entry: number;
74
+ last_entry: number;
75
+ personalizeable: boolean;
76
+ attendees: boolean | string;
77
+ identification: boolean | string;
78
+ free_timing: boolean;
79
+ is_collective: boolean;
80
+ is_upgrade: boolean;
81
+ is_mantle: boolean;
82
+ description: string | null;
83
+ sub_ticket_ids: number[];
84
+ sub_tickets: {
85
+ [key: string]: {
86
+ title?: string;
87
+ min_persons?: number;
88
+ max_persons?: number;
89
+ description?: string | null;
90
+ };
91
+ } | null;
92
+ is_sub_ticket: boolean;
93
+ created_at: string;
94
+ updated_at: string;
95
+ shop_order: number;
96
+ shipped_with_merchandise_id: number | null;
97
+ restricted_shop_account: boolean;
98
+ cash_point_order: number;
99
+ capacities: {
100
+ [key: string]: number;
101
+ };
102
+ total_capacities: {
103
+ [key: string]: number;
104
+ };
105
+ max_capacity: number;
106
+ max_total_capacity: number;
107
+ dynamic_prices: {
108
+ [key: string]: number;
109
+ } | null;
110
+ };
111
+ };
112
+ quotas: {
113
+ '1': {
114
+ ticket_ids: number[];
115
+ capacities: {
116
+ [key: string]: number;
117
+ };
118
+ total_capacities: {
119
+ [key: string]: number;
120
+ };
121
+ };
122
+ };
123
+ };
124
+ export declare function createMockTicket(ticket?: Partial<Ticket>): Ticket;
125
+ export declare function createMockTimeSlot(timeSlot?: Partial<TimeSlot>): TimeSlot;
126
+ export declare function createMockQuota(quota?: Partial<Quota>): Quota;
127
+ export declare const response_success: {
128
+ shop: {
129
+ name: string;
130
+ config: {
131
+ url: string;
132
+ success_link: string;
133
+ pending_link: string;
134
+ fail_link: string;
135
+ back_link: string;
136
+ confirmation_link: string;
137
+ password_reset_link: string;
138
+ personalization_link: string;
139
+ registration: boolean;
140
+ guest: {
141
+ enabled: boolean;
142
+ limit: number;
143
+ };
144
+ min_total: number;
145
+ max_total: number;
146
+ defaults: {
147
+ price_target_audience_id: number;
148
+ };
149
+ currency: string;
150
+ time_zone: string;
151
+ locale: string;
152
+ custom_css: string;
153
+ custom_js: string;
154
+ donations: {
155
+ enabled: boolean;
156
+ options: number[];
157
+ guest_limit: number;
158
+ free_donations: boolean;
159
+ };
160
+ dynamic_pricing: boolean;
161
+ };
162
+ translations: {
163
+ [x: string]: string;
164
+ };
165
+ payment_modes: {
166
+ [x: string]: {
167
+ id: number;
168
+ name: string;
169
+ icons: string[];
170
+ };
171
+ };
172
+ content: {
173
+ [x: string]: string;
174
+ };
175
+ settings: {};
176
+ };
177
+ };
178
+ export declare const getShop_success: import('msw').HttpHandler;
179
+ export declare const getShop_fail: import('msw').HttpHandler;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "0.0.20",
7
+ "version": "0.0.21",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",