@gomusdev/web-components 0.0.6 → 0.0.8

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 CHANGED
@@ -1,3 +1,6 @@
1
- # TODO
1
+ # Changelog
2
2
 
3
- # WRITE ME
3
+ ## 0.0.8
4
+ - When `go-ticket-selection` filter is `annual`, should correctly show the annual tickets
5
+ - Hide `go-calendar` and `go-timeslots` when filter is `annual`
6
+ - Hide `go-timeslots` when filter is `normal`
@@ -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, _selectedDate, _selectedTimeslot, _selectedTickets, _ticketList, _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, _b, _params, _ticketSelectionDetails, _c, _ticketSelectionDetails2;
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, _selectedTickets, _ticketList, _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, _b, _details, _params, _ticketSelectionDetails, _c, _ticketSelectionDetails2;
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);
@@ -4726,6 +4726,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
4726
4726
  }
4727
4727
  return void 0;
4728
4728
  }
4729
+ function parseIds(ids) {
4730
+ if (!ids) {
4731
+ return void 0;
4732
+ }
4733
+ const parsed = ids.split(",").map((id) => id.trim()).map(Number).filter((num) => !isNaN(num) && num > 0);
4734
+ return parsed.length > 0 ? parsed : void 0;
4735
+ }
4729
4736
  class User {
4730
4737
  get isAuthenticated() {
4731
4738
  return this.isLoggedIn || this.isGuest;
@@ -5585,6 +5592,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
5585
5592
  }
5586
5593
  const TICKETS_CALENDAR_ENDPOINT = "/api/v4/tickets/calendar";
5587
5594
  const TICKET_AND_QUOTAS_ENDPOINT = "/api/v4/tickets/list_and_quotas";
5595
+ const TICKETS_ENDPOINT = "/api/v4/tickets";
5588
5596
  var util;
5589
5597
  (function(util2) {
5590
5598
  util2.assertEqual = (val) => val;
@@ -9518,40 +9526,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
9518
9526
  start_at: z.string().date(),
9519
9527
  personalizations: z.array(PersonalizationSchema)
9520
9528
  });
9521
- const isObject$1 = (value) => {
9522
- return !!value && value.constructor === Object;
9523
- };
9524
- const sort = (array, getter, desc = false) => {
9525
- if (!array)
9526
- return [];
9527
- const asc = (a, b) => getter(a) - getter(b);
9528
- const dsc = (a, b) => getter(b) - getter(a);
9529
- return array.slice().sort(desc === true ? dsc : asc);
9530
- };
9531
- const alphabetical = (array, getter, dir = "asc") => {
9532
- if (!array)
9533
- return [];
9534
- const asc = (a, b) => `${getter(a)}`.localeCompare(getter(b));
9535
- const dsc = (a, b) => `${getter(b)}`.localeCompare(getter(a));
9536
- return array.slice().sort(dir === "desc" ? dsc : asc);
9537
- };
9538
- const assign = (initial, override) => {
9539
- if (!initial || !override)
9540
- return initial ?? override ?? {};
9541
- return Object.entries({ ...initial, ...override }).reduce(
9542
- (acc, [key, value]) => {
9543
- return {
9544
- ...acc,
9545
- [key]: (() => {
9546
- if (isObject$1(initial[key]))
9547
- return assign(initial[key], value);
9548
- return value;
9549
- })()
9550
- };
9551
- },
9552
- {}
9553
- );
9554
- };
9555
9529
  function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
9556
9530
  return amount - numerator * Math.floor(amount / numerator);
9557
9531
  }
@@ -10756,6 +10730,40 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10756
10730
  })
10757
10731
  ];
10758
10732
  }
10733
+ const isObject$1 = (value) => {
10734
+ return !!value && value.constructor === Object;
10735
+ };
10736
+ const sort = (array, getter, desc = false) => {
10737
+ if (!array)
10738
+ return [];
10739
+ const asc = (a, b) => getter(a) - getter(b);
10740
+ const dsc = (a, b) => getter(b) - getter(a);
10741
+ return array.slice().sort(desc === true ? dsc : asc);
10742
+ };
10743
+ const alphabetical = (array, getter, dir = "asc") => {
10744
+ if (!array)
10745
+ return [];
10746
+ const asc = (a, b) => `${getter(a)}`.localeCompare(getter(b));
10747
+ const dsc = (a, b) => `${getter(b)}`.localeCompare(getter(a));
10748
+ return array.slice().sort(dir === "desc" ? dsc : asc);
10749
+ };
10750
+ const assign = (initial, override) => {
10751
+ if (!initial || !override)
10752
+ return initial ?? override ?? {};
10753
+ return Object.entries({ ...initial, ...override }).reduce(
10754
+ (acc, [key, value]) => {
10755
+ return {
10756
+ ...acc,
10757
+ [key]: (() => {
10758
+ if (isObject$1(initial[key]))
10759
+ return assign(initial[key], value);
10760
+ return value;
10761
+ })()
10762
+ };
10763
+ },
10764
+ {}
10765
+ );
10766
+ };
10759
10767
  class GomusTicket {
10760
10768
  constructor(ticketObject, minAvailableCapacity = 0, selectedTime = "", quantity) {
10761
10769
  __publicField(this, "id");
@@ -10859,6 +10867,66 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10859
10867
  });
10860
10868
  return sort(Object.values(tmpTickets), (f) => f.shopOrder);
10861
10869
  }
10870
+ class GomusAnnualTicket {
10871
+ constructor(ticketObject, minAvailableCapacity = 0, selectedTime = "", quantity) {
10872
+ __publicField(this, "id");
10873
+ __publicField(this, "title");
10874
+ __publicField(this, "description");
10875
+ __publicField(this, "type");
10876
+ __publicField(this, "selectedTime");
10877
+ __publicField(this, "_quantity", 0);
10878
+ __publicField(this, "quantityOptions");
10879
+ __publicField(this, "vatPct");
10880
+ __publicField(this, "priceCents");
10881
+ __publicField(this, "priceFormatted");
10882
+ __publicField(this, "totalPriceCents");
10883
+ __publicField(this, "totalPriceFormatted");
10884
+ __publicField(this, "minQuantity");
10885
+ __publicField(this, "maxQuantity");
10886
+ __publicField(this, "maxPersons");
10887
+ __publicField(this, "shopOrder");
10888
+ __publicField(this, "minAvailableCapacity");
10889
+ __publicField(this, "reductionReason");
10890
+ __publicField(this, "ticketObject");
10891
+ this.ticketObject = ticketObject;
10892
+ this.minAvailableCapacity = minAvailableCapacity;
10893
+ this.id = ticketObject.id;
10894
+ this.title = ticketObject.title;
10895
+ this.description = ticketObject.description;
10896
+ this.type = "annual";
10897
+ this.selectedTime = selectedTime;
10898
+ this.vatPct = ticketObject.vat_pct;
10899
+ if (ticketObject.tax_included) {
10900
+ this.priceCents = ticketObject.price_cents;
10901
+ } else {
10902
+ this.priceCents = ticketObject.price_cents * (1 + this.vatPct / 100);
10903
+ }
10904
+ this.priceFormatted = formatCurrency(this.priceCents);
10905
+ this.quantity = quantity || 0;
10906
+ this.minQuantity = ticketObject.min_persons;
10907
+ this.maxPersons = ticketObject.max_persons;
10908
+ this.quantityOptions = generateQuantityOptions(this.minQuantity, this.maxPersons);
10909
+ this.shopOrder = ticketObject.shop_order ? ticketObject.shop_order : 0;
10910
+ }
10911
+ set quantity(value) {
10912
+ this._quantity = value;
10913
+ this.updateTotalPrices();
10914
+ }
10915
+ get quantity() {
10916
+ return this._quantity;
10917
+ }
10918
+ updateTotalPrices() {
10919
+ this.totalPriceCents = this.quantity * this.priceCents;
10920
+ this.totalPriceFormatted = formatCurrency(this.totalPriceCents);
10921
+ }
10922
+ }
10923
+ function initAnnualTickets(tickets) {
10924
+ const tmpTickets = {};
10925
+ Object.keys(tickets).forEach((ticketId) => {
10926
+ if (tickets[ticketId]) tmpTickets[ticketId] = new GomusAnnualTicket(tickets[ticketId]);
10927
+ });
10928
+ return sort(Object.values(tmpTickets), (f) => f.shopOrder);
10929
+ }
10862
10930
  class Shop {
10863
10931
  constructor(apiUrl, shopDomain, locale, type = "angular") {
10864
10932
  __privateAdd(this, _Shop_instances);
@@ -10983,6 +11051,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10983
11051
  ticketsAndQuotas(params) {
10984
11052
  return this.fetchAndCache(TICKET_AND_QUOTAS_ENDPOINT, `ticketsAndQuotas-${JSON.stringify(params)}`, "", { cache: 60, query: params });
10985
11053
  }
11054
+ tickets(params) {
11055
+ return this.fetchAndCache(TICKETS_ENDPOINT, `tickets-${JSON.stringify(params)}`, "", { cache: 60, query: params });
11056
+ }
10986
11057
  /**
10987
11058
  * Returns a reactive value that will contain the fetched data, no need to await.
10988
11059
  *
@@ -11145,6 +11216,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11145
11216
  __privateAdd(this, _eventId, /* @__PURE__ */ state());
11146
11217
  __privateAdd(this, _museumIds, /* @__PURE__ */ state());
11147
11218
  __privateAdd(this, _exhibitionIds, /* @__PURE__ */ state());
11219
+ __privateAdd(this, _ticketIds, /* @__PURE__ */ state());
11148
11220
  __privateAdd(this, _selectedDate, /* @__PURE__ */ state());
11149
11221
  __privateAdd(this, _selectedTimeslot, /* @__PURE__ */ state());
11150
11222
  __privateAdd(this, _selectedTickets, /* @__PURE__ */ state(proxy([])));
@@ -11180,6 +11252,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11180
11252
  set exhibitionIds(value) {
11181
11253
  set(__privateGet(this, _exhibitionIds), value, true);
11182
11254
  }
11255
+ get ticketIds() {
11256
+ return get(__privateGet(this, _ticketIds));
11257
+ }
11258
+ set ticketIds(value) {
11259
+ set(__privateGet(this, _ticketIds), value, true);
11260
+ }
11183
11261
  get selectedDate() {
11184
11262
  return get(__privateGet(this, _selectedDate));
11185
11263
  }
@@ -11217,6 +11295,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11217
11295
  _eventId = new WeakMap();
11218
11296
  _museumIds = new WeakMap();
11219
11297
  _exhibitionIds = new WeakMap();
11298
+ _ticketIds = new WeakMap();
11220
11299
  _selectedDate = new WeakMap();
11221
11300
  _selectedTimeslot = new WeakMap();
11222
11301
  _selectedTickets = new WeakMap();
@@ -13824,7 +13903,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13824
13903
  };
13825
13904
  _props12 = new WeakMap();
13826
13905
  let CalendarHeaderState = _CalendarHeaderState;
13827
- var root_2$e = /* @__PURE__ */ from_html(`<div><!></div>`);
13906
+ var root_2$g = /* @__PURE__ */ from_html(`<div><!></div>`);
13828
13907
  function Calendar$2($$anchor, $$props) {
13829
13908
  push($$props, true);
13830
13909
  let child$1 = prop($$props, "child", 7), children = prop($$props, "children", 7), id = prop($$props, "id", 23, useId), ref = prop($$props, "ref", 15, null), value = prop($$props, "value", 15), onValueChange = prop($$props, "onValueChange", 7, noop), placeholder = prop($$props, "placeholder", 15), onPlaceholderChange = prop($$props, "onPlaceholderChange", 7, noop), weekdayFormat = prop($$props, "weekdayFormat", 7, "narrow"), weekStartsOn = prop($$props, "weekStartsOn", 7), pagedNavigation = prop($$props, "pagedNavigation", 7, false), isDateDisabled = prop($$props, "isDateDisabled", 7, () => false), isDateUnavailable = prop($$props, "isDateUnavailable", 7, () => false), fixedWeeks = prop($$props, "fixedWeeks", 7, false), numberOfMonths = prop($$props, "numberOfMonths", 7, 1), locale = prop($$props, "locale", 7), calendarLabel = prop($$props, "calendarLabel", 7, "Event"), disabled = prop($$props, "disabled", 7, false), readonly = prop($$props, "readonly", 7, false), minValue = prop($$props, "minValue", 7, void 0), maxValue = prop($$props, "maxValue", 7, void 0), preventDeselect = prop($$props, "preventDeselect", 7, false), type = prop($$props, "type", 7), disableDaysOutsideMonth = prop($$props, "disableDaysOutsideMonth", 7, true), initialFocus = prop($$props, "initialFocus", 7, false), maxDays = prop($$props, "maxDays", 7), monthFormat = prop($$props, "monthFormat", 7, "long"), yearFormat = prop($$props, "yearFormat", 7, "numeric"), restProps = /* @__PURE__ */ rest_props($$props, [
@@ -13925,7 +14004,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13925
14004
  append($$anchor2, fragment_1);
13926
14005
  };
13927
14006
  var alternate = ($$anchor2) => {
13928
- var div = root_2$e();
14007
+ var div = root_2$g();
13929
14008
  attribute_effect(div, () => ({ ...get(mergedProps) }));
13930
14009
  var node_2 = child(div);
13931
14010
  snippet(node_2, () => children() ?? noop$1, () => rootState.snippetProps);
@@ -14173,7 +14252,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14173
14252
  [],
14174
14253
  true
14175
14254
  );
14176
- var root_2$d = /* @__PURE__ */ from_html(`<div><!></div>`);
14255
+ var root_2$f = /* @__PURE__ */ from_html(`<div><!></div>`);
14177
14256
  function Calendar_day($$anchor, $$props) {
14178
14257
  const uid = props_id();
14179
14258
  push($$props, true);
@@ -14205,7 +14284,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14205
14284
  append($$anchor2, fragment_1);
14206
14285
  };
14207
14286
  var alternate_1 = ($$anchor2) => {
14208
- var div = root_2$d();
14287
+ var div = root_2$f();
14209
14288
  attribute_effect(div, () => ({ ...get(mergedProps) }));
14210
14289
  var node_2 = child(div);
14211
14290
  {
@@ -14266,7 +14345,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14266
14345
  });
14267
14346
  }
14268
14347
  create_custom_element(Calendar_day, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14269
- var root_2$c = /* @__PURE__ */ from_html(`<table><!></table>`);
14348
+ var root_2$e = /* @__PURE__ */ from_html(`<table><!></table>`);
14270
14349
  function Calendar_grid($$anchor, $$props) {
14271
14350
  const uid = props_id();
14272
14351
  push($$props, true);
@@ -14295,7 +14374,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14295
14374
  append($$anchor2, fragment_1);
14296
14375
  };
14297
14376
  var alternate = ($$anchor2) => {
14298
- var table = root_2$c();
14377
+ var table = root_2$e();
14299
14378
  attribute_effect(table, () => ({ ...get(mergedProps) }));
14300
14379
  var node_2 = child(table);
14301
14380
  snippet(node_2, () => children() ?? noop$1);
@@ -14340,7 +14419,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14340
14419
  });
14341
14420
  }
14342
14421
  create_custom_element(Calendar_grid, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14343
- var root_2$b = /* @__PURE__ */ from_html(`<tbody><!></tbody>`);
14422
+ var root_2$d = /* @__PURE__ */ from_html(`<tbody><!></tbody>`);
14344
14423
  function Calendar_grid_body($$anchor, $$props) {
14345
14424
  const uid = props_id();
14346
14425
  push($$props, true);
@@ -14369,7 +14448,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14369
14448
  append($$anchor2, fragment_1);
14370
14449
  };
14371
14450
  var alternate = ($$anchor2) => {
14372
- var tbody = root_2$b();
14451
+ var tbody = root_2$d();
14373
14452
  attribute_effect(tbody, () => ({ ...get(mergedProps) }));
14374
14453
  var node_2 = child(tbody);
14375
14454
  snippet(node_2, () => children() ?? noop$1);
@@ -14414,7 +14493,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14414
14493
  });
14415
14494
  }
14416
14495
  create_custom_element(Calendar_grid_body, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14417
- var root_2$a = /* @__PURE__ */ from_html(`<td><!></td>`);
14496
+ var root_2$c = /* @__PURE__ */ from_html(`<td><!></td>`);
14418
14497
  function Calendar_cell($$anchor, $$props) {
14419
14498
  const uid = props_id();
14420
14499
  push($$props, true);
@@ -14450,7 +14529,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14450
14529
  append($$anchor2, fragment_1);
14451
14530
  };
14452
14531
  var alternate = ($$anchor2) => {
14453
- var td = root_2$a();
14532
+ var td = root_2$c();
14454
14533
  attribute_effect(td, () => ({ ...get(mergedProps) }));
14455
14534
  var node_2 = child(td);
14456
14535
  snippet(node_2, () => children() ?? noop$1, () => cellState.snippetProps);
@@ -14522,7 +14601,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14522
14601
  [],
14523
14602
  true
14524
14603
  );
14525
- var root_2$9 = /* @__PURE__ */ from_html(`<thead><!></thead>`);
14604
+ var root_2$b = /* @__PURE__ */ from_html(`<thead><!></thead>`);
14526
14605
  function Calendar_grid_head($$anchor, $$props) {
14527
14606
  const uid = props_id();
14528
14607
  push($$props, true);
@@ -14551,7 +14630,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14551
14630
  append($$anchor2, fragment_1);
14552
14631
  };
14553
14632
  var alternate = ($$anchor2) => {
14554
- var thead = root_2$9();
14633
+ var thead = root_2$b();
14555
14634
  attribute_effect(thead, () => ({ ...get(mergedProps) }));
14556
14635
  var node_2 = child(thead);
14557
14636
  snippet(node_2, () => children() ?? noop$1);
@@ -14596,7 +14675,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14596
14675
  });
14597
14676
  }
14598
14677
  create_custom_element(Calendar_grid_head, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14599
- var root_2$8 = /* @__PURE__ */ from_html(`<th><!></th>`);
14678
+ var root_2$a = /* @__PURE__ */ from_html(`<th><!></th>`);
14600
14679
  function Calendar_head_cell($$anchor, $$props) {
14601
14680
  const uid = props_id();
14602
14681
  push($$props, true);
@@ -14625,7 +14704,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14625
14704
  append($$anchor2, fragment_1);
14626
14705
  };
14627
14706
  var alternate = ($$anchor2) => {
14628
- var th = root_2$8();
14707
+ var th = root_2$a();
14629
14708
  attribute_effect(th, () => ({ ...get(mergedProps) }));
14630
14709
  var node_2 = child(th);
14631
14710
  snippet(node_2, () => children() ?? noop$1);
@@ -14670,7 +14749,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14670
14749
  });
14671
14750
  }
14672
14751
  create_custom_element(Calendar_head_cell, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14673
- var root_2$7 = /* @__PURE__ */ from_html(`<tr><!></tr>`);
14752
+ var root_2$9 = /* @__PURE__ */ from_html(`<tr><!></tr>`);
14674
14753
  function Calendar_grid_row($$anchor, $$props) {
14675
14754
  const uid = props_id();
14676
14755
  push($$props, true);
@@ -14699,7 +14778,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14699
14778
  append($$anchor2, fragment_1);
14700
14779
  };
14701
14780
  var alternate = ($$anchor2) => {
14702
- var tr = root_2$7();
14781
+ var tr = root_2$9();
14703
14782
  attribute_effect(tr, () => ({ ...get(mergedProps) }));
14704
14783
  var node_2 = child(tr);
14705
14784
  snippet(node_2, () => children() ?? noop$1);
@@ -14744,7 +14823,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14744
14823
  });
14745
14824
  }
14746
14825
  create_custom_element(Calendar_grid_row, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14747
- var root_2$6 = /* @__PURE__ */ from_html(`<header><!></header>`);
14826
+ var root_2$8 = /* @__PURE__ */ from_html(`<header><!></header>`);
14748
14827
  function Calendar_header($$anchor, $$props) {
14749
14828
  const uid = props_id();
14750
14829
  push($$props, true);
@@ -14773,7 +14852,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14773
14852
  append($$anchor2, fragment_1);
14774
14853
  };
14775
14854
  var alternate = ($$anchor2) => {
14776
- var header = root_2$6();
14855
+ var header = root_2$8();
14777
14856
  attribute_effect(header, () => ({ ...get(mergedProps) }));
14778
14857
  var node_2 = child(header);
14779
14858
  snippet(node_2, () => children() ?? noop$1);
@@ -14818,7 +14897,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14818
14897
  });
14819
14898
  }
14820
14899
  create_custom_element(Calendar_header, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14821
- var root_2$5 = /* @__PURE__ */ from_html(`<div><!></div>`);
14900
+ var root_2$7 = /* @__PURE__ */ from_html(`<div><!></div>`);
14822
14901
  function Calendar_heading($$anchor, $$props) {
14823
14902
  const uid = props_id();
14824
14903
  push($$props, true);
@@ -14850,7 +14929,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14850
14929
  append($$anchor2, fragment_1);
14851
14930
  };
14852
14931
  var alternate_1 = ($$anchor2) => {
14853
- var div = root_2$5();
14932
+ var div = root_2$7();
14854
14933
  attribute_effect(div, () => ({ ...get(mergedProps) }));
14855
14934
  var node_2 = child(div);
14856
14935
  {
@@ -14911,7 +14990,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14911
14990
  });
14912
14991
  }
14913
14992
  create_custom_element(Calendar_heading, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14914
- var root_2$4 = /* @__PURE__ */ from_html(`<button><!></button>`);
14993
+ var root_2$6 = /* @__PURE__ */ from_html(`<button><!></button>`);
14915
14994
  function Calendar_next_button($$anchor, $$props) {
14916
14995
  const uid = props_id();
14917
14996
  push($$props, true);
@@ -14941,7 +15020,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14941
15020
  append($$anchor2, fragment_1);
14942
15021
  };
14943
15022
  var alternate = ($$anchor2) => {
14944
- var button = root_2$4();
15023
+ var button = root_2$6();
14945
15024
  attribute_effect(button, () => ({ ...get(mergedProps) }));
14946
15025
  var node_2 = child(button);
14947
15026
  snippet(node_2, () => children() ?? noop$1);
@@ -14993,7 +15072,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14993
15072
  });
14994
15073
  }
14995
15074
  create_custom_element(Calendar_next_button, { children: {}, child: {}, id: {}, ref: {}, tabindex: {} }, [], [], true);
14996
- var root_2$3 = /* @__PURE__ */ from_html(`<button><!></button>`);
15075
+ var root_2$5 = /* @__PURE__ */ from_html(`<button><!></button>`);
14997
15076
  function Calendar_prev_button($$anchor, $$props) {
14998
15077
  const uid = props_id();
14999
15078
  push($$props, true);
@@ -15023,7 +15102,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15023
15102
  append($$anchor2, fragment_1);
15024
15103
  };
15025
15104
  var alternate = ($$anchor2) => {
15026
- var button = root_2$3();
15105
+ var button = root_2$5();
15027
15106
  attribute_effect(button, () => ({ ...get(mergedProps) }));
15028
15107
  var node_2 = child(button);
15029
15108
  snippet(node_2, () => children() ?? noop$1);
@@ -15078,7 +15157,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15078
15157
  let Calendar$1 = (_b = class {
15079
15158
  constructor() {
15080
15159
  __privateAdd(this, _startAt, /* @__PURE__ */ state(proxy($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()))));
15081
- __privateAdd(this, _selected, /* @__PURE__ */ state(proxy($14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2()))));
15160
+ __privateAdd(this, _selected, /* @__PURE__ */ state(void 0));
15082
15161
  }
15083
15162
  get startAt() {
15084
15163
  return get(__privateGet(this, _startAt));
@@ -15105,16 +15184,25 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15105
15184
  class TicketsCalendar extends Calendar$1 {
15106
15185
  constructor() {
15107
15186
  super(...arguments);
15108
- __privateAdd(this, _params, /* @__PURE__ */ user_derived(() => ({
15109
- by_bookable: true,
15110
- "by_ticket_types[]": void 0,
15111
- "by_ticket_ids[]": void 0,
15112
- "by_museum_ids[]": void 0,
15113
- "by_exhibition_ids[]": void 0,
15114
- // these logic are there to minimize fetches
15115
- start_at: this.startAt.set({ day: 1 }).toString(),
15116
- end_at: this.startAt.add({ months: 1 }).set({ day: 7 }).toString()
15117
- })));
15187
+ __privateAdd(this, _details, /* @__PURE__ */ state());
15188
+ __privateAdd(this, _params, /* @__PURE__ */ user_derived(() => {
15189
+ var _a2, _b2, _c2, _d;
15190
+ return {
15191
+ by_bookable: true,
15192
+ "by_ticket_types[]": (_a2 = this.details) == null ? void 0 : _a2.filters,
15193
+ "by_ticket_ids[]": (_b2 = this.details) == null ? void 0 : _b2.ticketIds,
15194
+ "by_museum_ids[]": (_c2 = this.details) == null ? void 0 : _c2.museumIds,
15195
+ "by_exhibition_ids[]": (_d = this.details) == null ? void 0 : _d.exhibitionIds,
15196
+ start_at: this.startAt.set({ day: 1 }).toString(),
15197
+ end_at: this.startAt.add({ months: 1 }).set({ day: 7 }).toString()
15198
+ };
15199
+ }));
15200
+ }
15201
+ get details() {
15202
+ return get(__privateGet(this, _details));
15203
+ }
15204
+ set details(value) {
15205
+ set(__privateGet(this, _details), value, true);
15118
15206
  }
15119
15207
  get params() {
15120
15208
  return get(__privateGet(this, _params));
@@ -15127,14 +15215,15 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15127
15215
  return ret;
15128
15216
  }
15129
15217
  }
15218
+ _details = new WeakMap();
15130
15219
  _params = new WeakMap();
15131
15220
  const ticketsCalendar = new TicketsCalendar();
15132
15221
  var root_3$1 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
15133
15222
  var root_11 = /* @__PURE__ */ from_html(`<div> </div>`);
15134
15223
  var root_17 = /* @__PURE__ */ from_html(`<div></div> `, 1);
15135
15224
  var root_7 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15136
- var root_2$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15137
- var root_1$2 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
15225
+ var root_2$4 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15226
+ var root_1$3 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
15138
15227
  function CalendarUI($$anchor, $$props) {
15139
15228
  push($$props, true);
15140
15229
  let calendarClass = prop($$props, "calendarClass", 7);
@@ -15146,13 +15235,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15146
15235
  bubbles: true
15147
15236
  }));
15148
15237
  });
15149
- var div = root_1$2();
15238
+ var div = root_1$3();
15150
15239
  var node = child(div);
15151
15240
  {
15152
15241
  const children = ($$anchor2, $$arg0) => {
15153
15242
  let months = () => $$arg0 == null ? void 0 : $$arg0().months;
15154
15243
  let weekdays = () => $$arg0 == null ? void 0 : $$arg0().weekdays;
15155
- var fragment = root_2$2();
15244
+ var fragment = root_2$4();
15156
15245
  var node_1 = first_child(fragment);
15157
15246
  component(node_1, () => Calendar_header, ($$anchor3, Calendar_Header) => {
15158
15247
  Calendar_Header($$anchor3, {
@@ -15352,7 +15441,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15352
15441
  let ticketSelectionDetails = /* @__PURE__ */ state(void 0);
15353
15442
  onMount(() => {
15354
15443
  set(ticketSelectionDetails, getTicketSelectionDetails($$props.$$host), true);
15355
- if (get(ticketSelectionDetails)) get(ticketSelectionDetails).selectedDate = $14e0f24ef4ac5c92$export$d0bdf45af03a6ea3($14e0f24ef4ac5c92$export$aa8b41735afcabd2());
15444
+ ticketsCalendar.details = get(ticketSelectionDetails);
15445
+ if (get(ticketSelectionDetails)) get(ticketSelectionDetails).selectedDate = void 0;
15356
15446
  });
15357
15447
  let wrapper = /* @__PURE__ */ state(void 0);
15358
15448
  onMount(() => {
@@ -15372,8 +15462,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15372
15462
  });
15373
15463
  };
15374
15464
  if_block(node, ($$render) => {
15375
- var _a2;
15376
- if (((_a2 = get(ticketSelectionDetails)) == null ? void 0 : _a2.mode) === "ticket") $$render(consequent);
15465
+ var _a2, _b2;
15466
+ if (((_a2 = get(ticketSelectionDetails)) == null ? void 0 : _a2.mode) === "ticket" && !((_b2 = get(ticketSelectionDetails).filters) == null ? void 0 : _b2.includes("annual"))) $$render(consequent);
15377
15467
  });
15378
15468
  }
15379
15469
  reset(div);
@@ -15442,11 +15532,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15442
15532
  set(__privateGet(this, _ticketSelectionDetails), value, true);
15443
15533
  }
15444
15534
  get timeslots() {
15445
- var _a2, _b2, _c2, _d;
15535
+ var _a2, _b2, _c2, _d, _e;
15446
15536
  const date = (_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.selectedDate;
15447
15537
  const ticketTypes = (_b2 = this.ticketSelectionDetails) == null ? void 0 : _b2.filters;
15448
15538
  const museumIds = (_c2 = this.ticketSelectionDetails) == null ? void 0 : _c2.museumIds;
15449
15539
  const exhibitionIds = (_d = this.ticketSelectionDetails) == null ? void 0 : _d.exhibitionIds;
15540
+ const ticketIds = (_e = this.ticketSelectionDetails) == null ? void 0 : _e.ticketIds;
15450
15541
  if (!date) return [];
15451
15542
  const result = snapshot(shop.ticketsAndQuotas({
15452
15543
  by_bookable: true,
@@ -15454,14 +15545,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15454
15545
  // @ts-ignore
15455
15546
  "by_ticket_types[]": ticketTypes,
15456
15547
  "by_museum_ids[]": museumIds,
15457
- "by_exhibition_ids[]": exhibitionIds
15548
+ "by_exhibition_ids[]": exhibitionIds,
15549
+ "by_ticket_ids[]": ticketIds,
15550
+ locale: shop.locale
15458
15551
  }));
15459
15552
  if (!result) return [];
15460
15553
  return generateAvailableTimeSlots(result.tickets, result.quotas);
15461
15554
  }
15462
15555
  }, _ticketSelectionDetails = new WeakMap(), _c);
15463
- var root_2$1 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`);
15464
- var root_1$1 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots" data-go-timeslots=""></ul>`);
15556
+ var root_2$3 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`);
15557
+ var root_1$2 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots" data-go-timeslots=""></ul>`);
15465
15558
  function Timeslots($$anchor, $$props) {
15466
15559
  push($$props, true);
15467
15560
  const binding_group = [];
@@ -15480,9 +15573,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15480
15573
  var node = first_child(fragment);
15481
15574
  {
15482
15575
  var consequent = ($$anchor2) => {
15483
- var ul = root_1$1();
15576
+ var ul = root_1$2();
15484
15577
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
15485
- var li = root_2$1();
15578
+ var li = root_2$3();
15486
15579
  var label = child(li);
15487
15580
  var text2 = child(label);
15488
15581
  var input = sibling(text2);
@@ -15514,7 +15607,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15514
15607
  append($$anchor2, ul);
15515
15608
  };
15516
15609
  if_block(node, ($$render) => {
15517
- if (details.ticketSelectionDetails) $$render(consequent);
15610
+ var _a2;
15611
+ if (details.ticketSelectionDetails && ((_a2 = details.ticketSelectionDetails.filters) == null ? void 0 : _a2.includes("time_slot"))) $$render(consequent);
15518
15612
  });
15519
15613
  }
15520
15614
  append($$anchor, fragment);
@@ -15522,7 +15616,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15522
15616
  }
15523
15617
  delegate(["change"]);
15524
15618
  customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"], false));
15525
- var root_2 = /* @__PURE__ */ from_html(`<div><!></div>`);
15619
+ var root_2$2 = /* @__PURE__ */ from_html(`<div><!></div>`);
15526
15620
  var root = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15527
15621
  function Wrapper($$anchor, $$props) {
15528
15622
  push($$props, true);
@@ -15555,7 +15649,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15555
15649
  var node_2 = sibling(node, 2);
15556
15650
  {
15557
15651
  var consequent_1 = ($$anchor2) => {
15558
- var div = root_2();
15652
+ var div = root_2$2();
15559
15653
  attribute_effect(div, () => ({ ...restProps }));
15560
15654
  var node_3 = child(div);
15561
15655
  snippet(node_3, children);
@@ -15587,7 +15681,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15587
15681
  create_custom_element(Wrapper, { host: {}, children: {} }, [], [], true);
15588
15682
  function TicketSelection($$anchor, $$props) {
15589
15683
  push($$props, true);
15590
- let mode = prop($$props, "mode", 7), filter = prop($$props, "filter", 7), eventId = prop($$props, "eventId", 7), children = prop($$props, "children", 7), museumId = prop($$props, "museumId", 7), exhibitionId = prop($$props, "exhibitionId", 7), restProps = /* @__PURE__ */ rest_props($$props, [
15684
+ 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, [
15591
15685
  "$$slots",
15592
15686
  "$$events",
15593
15687
  "$$legacy",
@@ -15596,15 +15690,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15596
15690
  "filter",
15597
15691
  "eventId",
15598
15692
  "children",
15599
- "museumId",
15600
- "exhibitionId"
15693
+ "museumIds",
15694
+ "exhibitionIds",
15695
+ "ticketIds"
15601
15696
  ]);
15602
15697
  const details = new TicketSelectionDetails();
15603
15698
  details.mode = mode();
15604
15699
  details.filters = [filter()];
15605
15700
  details.eventId = eventId();
15606
- details.museumIds = [museumId()];
15607
- details.exhibitionIds = [exhibitionId()];
15701
+ details.museumIds = parseIds(museumIds());
15702
+ details.exhibitionIds = parseIds(exhibitionIds());
15703
+ details.ticketIds = parseIds(ticketIds());
15608
15704
  setTicketSelectionDetails($$props.$$host, details);
15609
15705
  let cls = /* @__PURE__ */ user_derived(() => [
15610
15706
  "go-ticket-selection",
@@ -15653,18 +15749,25 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15653
15749
  children($$value);
15654
15750
  flushSync();
15655
15751
  },
15656
- get museumId() {
15657
- return museumId();
15752
+ get museumIds() {
15753
+ return museumIds();
15658
15754
  },
15659
- set museumId($$value) {
15660
- museumId($$value);
15755
+ set museumIds($$value) {
15756
+ museumIds($$value);
15661
15757
  flushSync();
15662
15758
  },
15663
- get exhibitionId() {
15664
- return exhibitionId();
15759
+ get exhibitionIds() {
15760
+ return exhibitionIds();
15665
15761
  },
15666
- set exhibitionId($$value) {
15667
- exhibitionId($$value);
15762
+ set exhibitionIds($$value) {
15763
+ exhibitionIds($$value);
15764
+ flushSync();
15765
+ },
15766
+ get ticketIds() {
15767
+ return ticketIds();
15768
+ },
15769
+ set ticketIds($$value) {
15770
+ ticketIds($$value);
15668
15771
  flushSync();
15669
15772
  }
15670
15773
  });
@@ -15676,8 +15779,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15676
15779
  eventId: { attribute: "event-id", reflect: true, type: "Number" },
15677
15780
  filter: {},
15678
15781
  children: {},
15679
- museumId: {},
15680
- exhibitionId: {}
15782
+ museumIds: {},
15783
+ exhibitionIds: {},
15784
+ ticketIds: {}
15681
15785
  },
15682
15786
  [],
15683
15787
  ["details"],
@@ -15694,132 +15798,231 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15694
15798
  set(__privateGet(this, _ticketSelectionDetails2), value, true);
15695
15799
  }
15696
15800
  get tickets() {
15697
- var _a2, _b2, _c2, _d, _e;
15801
+ var _a2, _b2, _c2, _d, _e, _f;
15698
15802
  const date = (_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.selectedDate;
15699
15803
  const ticketTypes = (_b2 = this.ticketSelectionDetails) == null ? void 0 : _b2.filters;
15700
15804
  const museumIds = (_c2 = this.ticketSelectionDetails) == null ? void 0 : _c2.museumIds;
15701
15805
  const exhibitionIds = (_d = this.ticketSelectionDetails) == null ? void 0 : _d.exhibitionIds;
15702
- if (!date && !((_e = this.ticketSelectionDetails) == null ? void 0 : _e.selectedTimeslot)) return [];
15806
+ const ticketIds = (_e = this.ticketSelectionDetails) == null ? void 0 : _e.ticketIds;
15807
+ if (!date && (!((_f = this.ticketSelectionDetails) == null ? void 0 : _f.selectedTimeslot) && (ticketTypes == null ? void 0 : ticketTypes.includes("time_slot")))) return [];
15703
15808
  const result = snapshot(shop.ticketsAndQuotas({
15704
15809
  by_bookable: true,
15705
15810
  valid_at: date == null ? void 0 : date.toString(),
15706
15811
  // @ts-ignore
15707
15812
  "by_ticket_types[]": ticketTypes,
15708
15813
  "by_museum_ids[]": museumIds,
15709
- "by_exhibition_ids[]": exhibitionIds
15814
+ "by_exhibition_ids[]": exhibitionIds,
15815
+ "by_ticket_ids[]": ticketIds,
15816
+ locale: shop.locale
15710
15817
  }));
15711
15818
  if (!result) return [];
15712
15819
  return initGomusTickets(result.tickets);
15713
15820
  }
15821
+ get annualTickets() {
15822
+ var _a2, _b2;
15823
+ const ticketTypes = (_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.filters;
15824
+ const ticketIds = (_b2 = this.ticketSelectionDetails) == null ? void 0 : _b2.ticketIds;
15825
+ if (!(ticketTypes == null ? void 0 : ticketTypes.includes("annual"))) return [];
15826
+ const result = snapshot(shop.tickets({
15827
+ by_bookable: true,
15828
+ // @ts-ignore
15829
+ "by_ticket_types[]": ticketTypes,
15830
+ "by_ticket_ids[]": ticketIds,
15831
+ locale: shop.locale
15832
+ }));
15833
+ if (!result) return [];
15834
+ return initAnnualTickets(result.tickets);
15835
+ }
15714
15836
  }
15715
15837
  _ticketSelectionDetails2 = new WeakMap();
15716
- var root_4 = /* @__PURE__ */ from_html(`<option> </option>`);
15717
- var root_3 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td><td> </td></tr>`);
15718
- var root_1 = /* @__PURE__ */ from_html(`<table><thead><tr><th>Quantity</th><th>Ticket</th><th>Price</th><th>Total</th></tr></thead><tbody></tbody></table>`);
15719
- function Tickets($$anchor, $$props) {
15838
+ var root_2$1 = /* @__PURE__ */ from_html(`<option> </option>`);
15839
+ var root_1$1 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td></tr>`);
15840
+ function Annual($$anchor, $$props) {
15720
15841
  push($$props, true);
15721
- const details = new Details();
15722
- onMount(() => {
15723
- details.ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
15842
+ let details = prop($$props, "details", 7);
15843
+ var fragment = comment();
15844
+ var node = first_child(fragment);
15845
+ each(node, 16, () => Object.values(details().annualTickets), (ticket) => ticket, ($$anchor2, ticket) => {
15846
+ var tr = root_1$1();
15847
+ var td = child(tr);
15848
+ var select = child(td);
15849
+ each(select, 21, () => ticket.quantityOptions, index, ($$anchor3, quantity) => {
15850
+ var option = root_2$1();
15851
+ var text2 = child(option, true);
15852
+ reset(option);
15853
+ var option_value = {};
15854
+ template_effect(() => {
15855
+ set_selected(option, get(quantity).selected);
15856
+ set_text(text2, get(quantity).label);
15857
+ if (option_value !== (option_value = get(quantity).value)) {
15858
+ option.value = (option.__value = get(quantity).value) ?? "";
15859
+ }
15860
+ });
15861
+ append($$anchor3, option);
15862
+ });
15863
+ reset(select);
15864
+ reset(td);
15865
+ var td_1 = sibling(td);
15866
+ var p = child(td_1);
15867
+ var text_1 = child(p, true);
15868
+ reset(p);
15869
+ var node_1 = sibling(p, 2);
15870
+ html(node_1, () => ticket.description);
15871
+ reset(td_1);
15872
+ var td_2 = sibling(td_1);
15873
+ var text_2 = child(td_2, true);
15874
+ reset(td_2);
15875
+ reset(tr);
15876
+ template_effect(
15877
+ ($0) => {
15878
+ set_attribute(select, "name", $0);
15879
+ set_text(text_1, ticket.title);
15880
+ set_text(text_2, ticket.priceFormatted);
15881
+ },
15882
+ [() => ticket.id.toString()]
15883
+ );
15884
+ append($$anchor2, tr);
15885
+ });
15886
+ append($$anchor, fragment);
15887
+ return pop({
15888
+ get details() {
15889
+ return details();
15890
+ },
15891
+ set details($$value) {
15892
+ details($$value);
15893
+ flushSync();
15894
+ }
15724
15895
  });
15725
- let selection = prop($$props, "selection", 7), timeslot = prop($$props, "timeslot", 7);
15896
+ }
15897
+ create_custom_element(Annual, { details: {} }, [], [], true);
15898
+ var root_3 = /* @__PURE__ */ from_html(`<option> </option>`);
15899
+ var root_2 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td></tr>`);
15900
+ function Timeslot($$anchor, $$props) {
15901
+ push($$props, true);
15902
+ let details = prop($$props, "details", 7);
15726
15903
  function hasTimeSlotInCapacities(ticket) {
15727
15904
  var _a2;
15728
- if ((_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.selectedTimeslot) {
15729
- return Object.keys(ticket.capacities).includes(details.ticketSelectionDetails.selectedTimeslot);
15905
+ if ((_a2 = details().ticketSelectionDetails) == null ? void 0 : _a2.selectedTimeslot) {
15906
+ return Object.keys(ticket.capacities).includes(details().ticketSelectionDetails.selectedTimeslot);
15730
15907
  } else {
15731
15908
  return false;
15732
15909
  }
15733
15910
  }
15734
15911
  var fragment = comment();
15735
15912
  var node = first_child(fragment);
15913
+ each(node, 16, () => Object.values(details().tickets), (ticket) => ticket, ($$anchor2, ticket) => {
15914
+ var fragment_1 = comment();
15915
+ var node_1 = first_child(fragment_1);
15916
+ {
15917
+ var consequent = ($$anchor3) => {
15918
+ var tr = root_2();
15919
+ let classes;
15920
+ var td = child(tr);
15921
+ var select = child(td);
15922
+ each(select, 21, () => ticket.quantityOptions, index, ($$anchor4, quantity) => {
15923
+ var option = root_3();
15924
+ var text2 = child(option, true);
15925
+ reset(option);
15926
+ var option_value = {};
15927
+ template_effect(() => {
15928
+ set_selected(option, get(quantity).selected);
15929
+ set_text(text2, get(quantity).label);
15930
+ if (option_value !== (option_value = get(quantity).value)) {
15931
+ option.value = (option.__value = get(quantity).value) ?? "";
15932
+ }
15933
+ });
15934
+ append($$anchor4, option);
15935
+ });
15936
+ reset(select);
15937
+ reset(td);
15938
+ var td_1 = sibling(td);
15939
+ var p = child(td_1);
15940
+ var text_1 = child(p, true);
15941
+ reset(p);
15942
+ var node_2 = sibling(p, 2);
15943
+ html(node_2, () => ticket.description);
15944
+ reset(td_1);
15945
+ var td_2 = sibling(td_1);
15946
+ var text_2 = child(td_2, true);
15947
+ reset(td_2);
15948
+ reset(tr);
15949
+ template_effect(
15950
+ ($0, $1) => {
15951
+ classes = set_class(tr, 1, "", null, classes, $0);
15952
+ set_attribute(select, "name", $1);
15953
+ set_text(text_1, ticket.title);
15954
+ set_text(text_2, ticket.priceFormatted);
15955
+ },
15956
+ [
15957
+ () => ({ hidden: hasTimeSlotInCapacities(ticket) }),
15958
+ () => ticket.id.toString()
15959
+ ]
15960
+ );
15961
+ append($$anchor3, tr);
15962
+ };
15963
+ if_block(node_1, ($$render) => {
15964
+ if (hasTimeSlotInCapacities(ticket) || ticket.type == "normal") $$render(consequent);
15965
+ });
15966
+ }
15967
+ append($$anchor2, fragment_1);
15968
+ });
15969
+ append($$anchor, fragment);
15970
+ return pop({
15971
+ get details() {
15972
+ return details();
15973
+ },
15974
+ set details($$value) {
15975
+ details($$value);
15976
+ flushSync();
15977
+ }
15978
+ });
15979
+ }
15980
+ create_custom_element(Timeslot, { details: {} }, [], [], true);
15981
+ var root_1 = /* @__PURE__ */ from_html(`<table><thead><tr><th scope="col">Quantity</th><th scope="col">Ticket</th><th scope="col">Price</th></tr></thead><tbody><!></tbody></table>`);
15982
+ function Tickets($$anchor, $$props) {
15983
+ push($$props, true);
15984
+ const details = new Details();
15985
+ onMount(() => {
15986
+ details.ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
15987
+ });
15988
+ var fragment = comment();
15989
+ var node = first_child(fragment);
15736
15990
  {
15737
15991
  var consequent_1 = ($$anchor2) => {
15738
15992
  var table = root_1();
15739
15993
  var tbody = sibling(child(table));
15740
- each(tbody, 20, () => Object.values(details.tickets), (ticket) => ticket, ($$anchor3, ticket) => {
15741
- var fragment_1 = comment();
15742
- var node_1 = first_child(fragment_1);
15743
- {
15744
- var consequent = ($$anchor4) => {
15745
- var tr = root_3();
15746
- let classes;
15747
- var td = child(tr);
15748
- var select = child(td);
15749
- each(select, 21, () => ticket.quantityOptions, index, ($$anchor5, quantity) => {
15750
- var option = root_4();
15751
- var text2 = child(option, true);
15752
- reset(option);
15753
- var option_value = {};
15754
- template_effect(() => {
15755
- set_selected(option, get(quantity).selected);
15756
- set_text(text2, get(quantity).label);
15757
- if (option_value !== (option_value = get(quantity).value)) {
15758
- option.value = (option.__value = get(quantity).value) ?? "";
15759
- }
15760
- });
15761
- append($$anchor5, option);
15762
- });
15763
- reset(select);
15764
- reset(td);
15765
- var td_1 = sibling(td);
15766
- var p = child(td_1);
15767
- var text_1 = child(p, true);
15768
- reset(p);
15769
- var node_2 = sibling(p, 2);
15770
- html(node_2, () => ticket.description);
15771
- reset(td_1);
15772
- var td_2 = sibling(td_1);
15773
- var text_2 = child(td_2, true);
15774
- reset(td_2);
15775
- var td_3 = sibling(td_2);
15776
- var text_3 = child(td_3, true);
15777
- reset(td_3);
15778
- reset(tr);
15779
- template_effect(
15780
- ($0) => {
15781
- classes = set_class(tr, 1, "", null, classes, $0);
15782
- set_attribute(select, "name", ticket.id);
15783
- set_text(text_1, ticket.title);
15784
- set_text(text_2, ticket.priceFormatted);
15785
- set_text(text_3, ticket.totalPriceFormatted);
15786
- },
15787
- [() => ({ hidden: hasTimeSlotInCapacities(ticket) })]
15788
- );
15789
- append($$anchor4, tr);
15790
- };
15791
- if_block(node_1, ($$render) => {
15792
- if (hasTimeSlotInCapacities(ticket)) $$render(consequent);
15994
+ var node_1 = child(tbody);
15995
+ {
15996
+ var consequent = ($$anchor3) => {
15997
+ Annual($$anchor3, {
15998
+ get details() {
15999
+ return details;
16000
+ }
15793
16001
  });
15794
- }
15795
- append($$anchor3, fragment_1);
15796
- });
16002
+ };
16003
+ var alternate = ($$anchor3) => {
16004
+ Timeslot($$anchor3, {
16005
+ get details() {
16006
+ return details;
16007
+ }
16008
+ });
16009
+ };
16010
+ if_block(node_1, ($$render) => {
16011
+ var _a2, _b2;
16012
+ if ((_b2 = (_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.filters) == null ? void 0 : _b2.includes("annual")) $$render(consequent);
16013
+ else $$render(alternate, false);
16014
+ });
16015
+ }
15797
16016
  reset(tbody);
15798
16017
  reset(table);
15799
16018
  append($$anchor2, table);
15800
16019
  };
15801
16020
  if_block(node, ($$render) => {
15802
- if (details.ticketSelectionDetails && details.ticketSelectionDetails.selectedTimeslot) $$render(consequent_1);
16021
+ if (details.ticketSelectionDetails) $$render(consequent_1);
15803
16022
  });
15804
16023
  }
15805
16024
  append($$anchor, fragment);
15806
- return pop({
15807
- details,
15808
- get selection() {
15809
- return selection();
15810
- },
15811
- set selection($$value) {
15812
- selection($$value);
15813
- flushSync();
15814
- },
15815
- get timeslot() {
15816
- return timeslot();
15817
- },
15818
- set timeslot($$value) {
15819
- timeslot($$value);
15820
- flushSync();
15821
- }
15822
- });
16025
+ return pop({ details });
15823
16026
  }
15824
- customElements.define("go-tickets", create_custom_element(Tickets, { selection: {}, timeslot: {} }, [], ["details"], false));
16027
+ customElements.define("go-tickets", create_custom_element(Tickets, {}, [], ["details"], false));
15825
16028
  })();
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "0.0.6",
7
+ "version": "0.0.8",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",