@gomusdev/web-components 0.0.7 → 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`
@@ -5592,6 +5592,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
5592
5592
  }
5593
5593
  const TICKETS_CALENDAR_ENDPOINT = "/api/v4/tickets/calendar";
5594
5594
  const TICKET_AND_QUOTAS_ENDPOINT = "/api/v4/tickets/list_and_quotas";
5595
+ const TICKETS_ENDPOINT = "/api/v4/tickets";
5595
5596
  var util;
5596
5597
  (function(util2) {
5597
5598
  util2.assertEqual = (val) => val;
@@ -9525,40 +9526,6 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
9525
9526
  start_at: z.string().date(),
9526
9527
  personalizations: z.array(PersonalizationSchema)
9527
9528
  });
9528
- const isObject$1 = (value) => {
9529
- return !!value && value.constructor === Object;
9530
- };
9531
- const sort = (array, getter, desc = false) => {
9532
- if (!array)
9533
- return [];
9534
- const asc = (a, b) => getter(a) - getter(b);
9535
- const dsc = (a, b) => getter(b) - getter(a);
9536
- return array.slice().sort(desc === true ? dsc : asc);
9537
- };
9538
- const alphabetical = (array, getter, dir = "asc") => {
9539
- if (!array)
9540
- return [];
9541
- const asc = (a, b) => `${getter(a)}`.localeCompare(getter(b));
9542
- const dsc = (a, b) => `${getter(b)}`.localeCompare(getter(a));
9543
- return array.slice().sort(dir === "desc" ? dsc : asc);
9544
- };
9545
- const assign = (initial, override) => {
9546
- if (!initial || !override)
9547
- return initial ?? override ?? {};
9548
- return Object.entries({ ...initial, ...override }).reduce(
9549
- (acc, [key, value]) => {
9550
- return {
9551
- ...acc,
9552
- [key]: (() => {
9553
- if (isObject$1(initial[key]))
9554
- return assign(initial[key], value);
9555
- return value;
9556
- })()
9557
- };
9558
- },
9559
- {}
9560
- );
9561
- };
9562
9529
  function $2b4dce13dd5a17fa$export$842a2cf37af977e1(amount, numerator) {
9563
9530
  return amount - numerator * Math.floor(amount / numerator);
9564
9531
  }
@@ -10763,6 +10730,40 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10763
10730
  })
10764
10731
  ];
10765
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
+ };
10766
10767
  class GomusTicket {
10767
10768
  constructor(ticketObject, minAvailableCapacity = 0, selectedTime = "", quantity) {
10768
10769
  __publicField(this, "id");
@@ -10866,6 +10867,66 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10866
10867
  });
10867
10868
  return sort(Object.values(tmpTickets), (f) => f.shopOrder);
10868
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
+ }
10869
10930
  class Shop {
10870
10931
  constructor(apiUrl, shopDomain, locale, type = "angular") {
10871
10932
  __privateAdd(this, _Shop_instances);
@@ -10990,6 +11051,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10990
11051
  ticketsAndQuotas(params) {
10991
11052
  return this.fetchAndCache(TICKET_AND_QUOTAS_ENDPOINT, `ticketsAndQuotas-${JSON.stringify(params)}`, "", { cache: 60, query: params });
10992
11053
  }
11054
+ tickets(params) {
11055
+ return this.fetchAndCache(TICKETS_ENDPOINT, `tickets-${JSON.stringify(params)}`, "", { cache: 60, query: params });
11056
+ }
10993
11057
  /**
10994
11058
  * Returns a reactive value that will contain the fetched data, no need to await.
10995
11059
  *
@@ -13839,7 +13903,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13839
13903
  };
13840
13904
  _props12 = new WeakMap();
13841
13905
  let CalendarHeaderState = _CalendarHeaderState;
13842
- var root_2$e = /* @__PURE__ */ from_html(`<div><!></div>`);
13906
+ var root_2$g = /* @__PURE__ */ from_html(`<div><!></div>`);
13843
13907
  function Calendar$2($$anchor, $$props) {
13844
13908
  push($$props, true);
13845
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, [
@@ -13940,7 +14004,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
13940
14004
  append($$anchor2, fragment_1);
13941
14005
  };
13942
14006
  var alternate = ($$anchor2) => {
13943
- var div = root_2$e();
14007
+ var div = root_2$g();
13944
14008
  attribute_effect(div, () => ({ ...get(mergedProps) }));
13945
14009
  var node_2 = child(div);
13946
14010
  snippet(node_2, () => children() ?? noop$1, () => rootState.snippetProps);
@@ -14188,7 +14252,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14188
14252
  [],
14189
14253
  true
14190
14254
  );
14191
- var root_2$d = /* @__PURE__ */ from_html(`<div><!></div>`);
14255
+ var root_2$f = /* @__PURE__ */ from_html(`<div><!></div>`);
14192
14256
  function Calendar_day($$anchor, $$props) {
14193
14257
  const uid = props_id();
14194
14258
  push($$props, true);
@@ -14220,7 +14284,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14220
14284
  append($$anchor2, fragment_1);
14221
14285
  };
14222
14286
  var alternate_1 = ($$anchor2) => {
14223
- var div = root_2$d();
14287
+ var div = root_2$f();
14224
14288
  attribute_effect(div, () => ({ ...get(mergedProps) }));
14225
14289
  var node_2 = child(div);
14226
14290
  {
@@ -14281,7 +14345,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14281
14345
  });
14282
14346
  }
14283
14347
  create_custom_element(Calendar_day, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14284
- var root_2$c = /* @__PURE__ */ from_html(`<table><!></table>`);
14348
+ var root_2$e = /* @__PURE__ */ from_html(`<table><!></table>`);
14285
14349
  function Calendar_grid($$anchor, $$props) {
14286
14350
  const uid = props_id();
14287
14351
  push($$props, true);
@@ -14310,7 +14374,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14310
14374
  append($$anchor2, fragment_1);
14311
14375
  };
14312
14376
  var alternate = ($$anchor2) => {
14313
- var table = root_2$c();
14377
+ var table = root_2$e();
14314
14378
  attribute_effect(table, () => ({ ...get(mergedProps) }));
14315
14379
  var node_2 = child(table);
14316
14380
  snippet(node_2, () => children() ?? noop$1);
@@ -14355,7 +14419,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14355
14419
  });
14356
14420
  }
14357
14421
  create_custom_element(Calendar_grid, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14358
- var root_2$b = /* @__PURE__ */ from_html(`<tbody><!></tbody>`);
14422
+ var root_2$d = /* @__PURE__ */ from_html(`<tbody><!></tbody>`);
14359
14423
  function Calendar_grid_body($$anchor, $$props) {
14360
14424
  const uid = props_id();
14361
14425
  push($$props, true);
@@ -14384,7 +14448,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14384
14448
  append($$anchor2, fragment_1);
14385
14449
  };
14386
14450
  var alternate = ($$anchor2) => {
14387
- var tbody = root_2$b();
14451
+ var tbody = root_2$d();
14388
14452
  attribute_effect(tbody, () => ({ ...get(mergedProps) }));
14389
14453
  var node_2 = child(tbody);
14390
14454
  snippet(node_2, () => children() ?? noop$1);
@@ -14429,7 +14493,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14429
14493
  });
14430
14494
  }
14431
14495
  create_custom_element(Calendar_grid_body, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14432
- var root_2$a = /* @__PURE__ */ from_html(`<td><!></td>`);
14496
+ var root_2$c = /* @__PURE__ */ from_html(`<td><!></td>`);
14433
14497
  function Calendar_cell($$anchor, $$props) {
14434
14498
  const uid = props_id();
14435
14499
  push($$props, true);
@@ -14465,7 +14529,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14465
14529
  append($$anchor2, fragment_1);
14466
14530
  };
14467
14531
  var alternate = ($$anchor2) => {
14468
- var td = root_2$a();
14532
+ var td = root_2$c();
14469
14533
  attribute_effect(td, () => ({ ...get(mergedProps) }));
14470
14534
  var node_2 = child(td);
14471
14535
  snippet(node_2, () => children() ?? noop$1, () => cellState.snippetProps);
@@ -14537,7 +14601,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14537
14601
  [],
14538
14602
  true
14539
14603
  );
14540
- var root_2$9 = /* @__PURE__ */ from_html(`<thead><!></thead>`);
14604
+ var root_2$b = /* @__PURE__ */ from_html(`<thead><!></thead>`);
14541
14605
  function Calendar_grid_head($$anchor, $$props) {
14542
14606
  const uid = props_id();
14543
14607
  push($$props, true);
@@ -14566,7 +14630,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14566
14630
  append($$anchor2, fragment_1);
14567
14631
  };
14568
14632
  var alternate = ($$anchor2) => {
14569
- var thead = root_2$9();
14633
+ var thead = root_2$b();
14570
14634
  attribute_effect(thead, () => ({ ...get(mergedProps) }));
14571
14635
  var node_2 = child(thead);
14572
14636
  snippet(node_2, () => children() ?? noop$1);
@@ -14611,7 +14675,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14611
14675
  });
14612
14676
  }
14613
14677
  create_custom_element(Calendar_grid_head, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14614
- var root_2$8 = /* @__PURE__ */ from_html(`<th><!></th>`);
14678
+ var root_2$a = /* @__PURE__ */ from_html(`<th><!></th>`);
14615
14679
  function Calendar_head_cell($$anchor, $$props) {
14616
14680
  const uid = props_id();
14617
14681
  push($$props, true);
@@ -14640,7 +14704,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14640
14704
  append($$anchor2, fragment_1);
14641
14705
  };
14642
14706
  var alternate = ($$anchor2) => {
14643
- var th = root_2$8();
14707
+ var th = root_2$a();
14644
14708
  attribute_effect(th, () => ({ ...get(mergedProps) }));
14645
14709
  var node_2 = child(th);
14646
14710
  snippet(node_2, () => children() ?? noop$1);
@@ -14685,7 +14749,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14685
14749
  });
14686
14750
  }
14687
14751
  create_custom_element(Calendar_head_cell, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14688
- var root_2$7 = /* @__PURE__ */ from_html(`<tr><!></tr>`);
14752
+ var root_2$9 = /* @__PURE__ */ from_html(`<tr><!></tr>`);
14689
14753
  function Calendar_grid_row($$anchor, $$props) {
14690
14754
  const uid = props_id();
14691
14755
  push($$props, true);
@@ -14714,7 +14778,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14714
14778
  append($$anchor2, fragment_1);
14715
14779
  };
14716
14780
  var alternate = ($$anchor2) => {
14717
- var tr = root_2$7();
14781
+ var tr = root_2$9();
14718
14782
  attribute_effect(tr, () => ({ ...get(mergedProps) }));
14719
14783
  var node_2 = child(tr);
14720
14784
  snippet(node_2, () => children() ?? noop$1);
@@ -14759,7 +14823,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14759
14823
  });
14760
14824
  }
14761
14825
  create_custom_element(Calendar_grid_row, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14762
- var root_2$6 = /* @__PURE__ */ from_html(`<header><!></header>`);
14826
+ var root_2$8 = /* @__PURE__ */ from_html(`<header><!></header>`);
14763
14827
  function Calendar_header($$anchor, $$props) {
14764
14828
  const uid = props_id();
14765
14829
  push($$props, true);
@@ -14788,7 +14852,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14788
14852
  append($$anchor2, fragment_1);
14789
14853
  };
14790
14854
  var alternate = ($$anchor2) => {
14791
- var header = root_2$6();
14855
+ var header = root_2$8();
14792
14856
  attribute_effect(header, () => ({ ...get(mergedProps) }));
14793
14857
  var node_2 = child(header);
14794
14858
  snippet(node_2, () => children() ?? noop$1);
@@ -14833,7 +14897,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14833
14897
  });
14834
14898
  }
14835
14899
  create_custom_element(Calendar_header, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14836
- var root_2$5 = /* @__PURE__ */ from_html(`<div><!></div>`);
14900
+ var root_2$7 = /* @__PURE__ */ from_html(`<div><!></div>`);
14837
14901
  function Calendar_heading($$anchor, $$props) {
14838
14902
  const uid = props_id();
14839
14903
  push($$props, true);
@@ -14865,7 +14929,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14865
14929
  append($$anchor2, fragment_1);
14866
14930
  };
14867
14931
  var alternate_1 = ($$anchor2) => {
14868
- var div = root_2$5();
14932
+ var div = root_2$7();
14869
14933
  attribute_effect(div, () => ({ ...get(mergedProps) }));
14870
14934
  var node_2 = child(div);
14871
14935
  {
@@ -14926,7 +14990,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14926
14990
  });
14927
14991
  }
14928
14992
  create_custom_element(Calendar_heading, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
14929
- var root_2$4 = /* @__PURE__ */ from_html(`<button><!></button>`);
14993
+ var root_2$6 = /* @__PURE__ */ from_html(`<button><!></button>`);
14930
14994
  function Calendar_next_button($$anchor, $$props) {
14931
14995
  const uid = props_id();
14932
14996
  push($$props, true);
@@ -14956,7 +15020,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14956
15020
  append($$anchor2, fragment_1);
14957
15021
  };
14958
15022
  var alternate = ($$anchor2) => {
14959
- var button = root_2$4();
15023
+ var button = root_2$6();
14960
15024
  attribute_effect(button, () => ({ ...get(mergedProps) }));
14961
15025
  var node_2 = child(button);
14962
15026
  snippet(node_2, () => children() ?? noop$1);
@@ -15008,7 +15072,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15008
15072
  });
15009
15073
  }
15010
15074
  create_custom_element(Calendar_next_button, { children: {}, child: {}, id: {}, ref: {}, tabindex: {} }, [], [], true);
15011
- var root_2$3 = /* @__PURE__ */ from_html(`<button><!></button>`);
15075
+ var root_2$5 = /* @__PURE__ */ from_html(`<button><!></button>`);
15012
15076
  function Calendar_prev_button($$anchor, $$props) {
15013
15077
  const uid = props_id();
15014
15078
  push($$props, true);
@@ -15038,7 +15102,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15038
15102
  append($$anchor2, fragment_1);
15039
15103
  };
15040
15104
  var alternate = ($$anchor2) => {
15041
- var button = root_2$3();
15105
+ var button = root_2$5();
15042
15106
  attribute_effect(button, () => ({ ...get(mergedProps) }));
15043
15107
  var node_2 = child(button);
15044
15108
  snippet(node_2, () => children() ?? noop$1);
@@ -15158,8 +15222,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15158
15222
  var root_11 = /* @__PURE__ */ from_html(`<div> </div>`);
15159
15223
  var root_17 = /* @__PURE__ */ from_html(`<div></div> `, 1);
15160
15224
  var root_7 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15161
- var root_2$2 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15162
- 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>`);
15163
15227
  function CalendarUI($$anchor, $$props) {
15164
15228
  push($$props, true);
15165
15229
  let calendarClass = prop($$props, "calendarClass", 7);
@@ -15171,13 +15235,13 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15171
15235
  bubbles: true
15172
15236
  }));
15173
15237
  });
15174
- var div = root_1$2();
15238
+ var div = root_1$3();
15175
15239
  var node = child(div);
15176
15240
  {
15177
15241
  const children = ($$anchor2, $$arg0) => {
15178
15242
  let months = () => $$arg0 == null ? void 0 : $$arg0().months;
15179
15243
  let weekdays = () => $$arg0 == null ? void 0 : $$arg0().weekdays;
15180
- var fragment = root_2$2();
15244
+ var fragment = root_2$4();
15181
15245
  var node_1 = first_child(fragment);
15182
15246
  component(node_1, () => Calendar_header, ($$anchor3, Calendar_Header) => {
15183
15247
  Calendar_Header($$anchor3, {
@@ -15398,8 +15462,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15398
15462
  });
15399
15463
  };
15400
15464
  if_block(node, ($$render) => {
15401
- var _a2;
15402
- 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);
15403
15467
  });
15404
15468
  }
15405
15469
  reset(div);
@@ -15489,8 +15553,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15489
15553
  return generateAvailableTimeSlots(result.tickets, result.quotas);
15490
15554
  }
15491
15555
  }, _ticketSelectionDetails = new WeakMap(), _c);
15492
- var root_2$1 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`);
15493
- 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>`);
15494
15558
  function Timeslots($$anchor, $$props) {
15495
15559
  push($$props, true);
15496
15560
  const binding_group = [];
@@ -15509,9 +15573,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15509
15573
  var node = first_child(fragment);
15510
15574
  {
15511
15575
  var consequent = ($$anchor2) => {
15512
- var ul = root_1$1();
15576
+ var ul = root_1$2();
15513
15577
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
15514
- var li = root_2$1();
15578
+ var li = root_2$3();
15515
15579
  var label = child(li);
15516
15580
  var text2 = child(label);
15517
15581
  var input = sibling(text2);
@@ -15543,7 +15607,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15543
15607
  append($$anchor2, ul);
15544
15608
  };
15545
15609
  if_block(node, ($$render) => {
15546
- 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);
15547
15612
  });
15548
15613
  }
15549
15614
  append($$anchor, fragment);
@@ -15551,7 +15616,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15551
15616
  }
15552
15617
  delegate(["change"]);
15553
15618
  customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"], false));
15554
- var root_2 = /* @__PURE__ */ from_html(`<div><!></div>`);
15619
+ var root_2$2 = /* @__PURE__ */ from_html(`<div><!></div>`);
15555
15620
  var root = /* @__PURE__ */ from_html(`<!> <!>`, 1);
15556
15621
  function Wrapper($$anchor, $$props) {
15557
15622
  push($$props, true);
@@ -15584,7 +15649,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15584
15649
  var node_2 = sibling(node, 2);
15585
15650
  {
15586
15651
  var consequent_1 = ($$anchor2) => {
15587
- var div = root_2();
15652
+ var div = root_2$2();
15588
15653
  attribute_effect(div, () => ({ ...restProps }));
15589
15654
  var node_3 = child(div);
15590
15655
  snippet(node_3, children);
@@ -15739,7 +15804,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15739
15804
  const museumIds = (_c2 = this.ticketSelectionDetails) == null ? void 0 : _c2.museumIds;
15740
15805
  const exhibitionIds = (_d = this.ticketSelectionDetails) == null ? void 0 : _d.exhibitionIds;
15741
15806
  const ticketIds = (_e = this.ticketSelectionDetails) == null ? void 0 : _e.ticketIds;
15742
- if (!date && !((_f = this.ticketSelectionDetails) == null ? void 0 : _f.selectedTimeslot)) return [];
15807
+ if (!date && (!((_f = this.ticketSelectionDetails) == null ? void 0 : _f.selectedTimeslot) && (ticketTypes == null ? void 0 : ticketTypes.includes("time_slot")))) return [];
15743
15808
  const result = snapshot(shop.ticketsAndQuotas({
15744
15809
  by_bookable: true,
15745
15810
  valid_at: date == null ? void 0 : date.toString(),
@@ -15753,115 +15818,211 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15753
15818
  if (!result) return [];
15754
15819
  return initGomusTickets(result.tickets);
15755
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
+ }
15756
15836
  }
15757
15837
  _ticketSelectionDetails2 = new WeakMap();
15758
- var root_4 = /* @__PURE__ */ from_html(`<option> </option>`);
15759
- var root_3 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td><td> </td></tr>`);
15760
- 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>`);
15761
- 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) {
15762
15841
  push($$props, true);
15763
- const details = new Details();
15764
- onMount(() => {
15765
- 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);
15766
15885
  });
15767
- let selection = prop($$props, "selection", 7), timeslot = prop($$props, "timeslot", 7);
15886
+ append($$anchor, fragment);
15887
+ return pop({
15888
+ get details() {
15889
+ return details();
15890
+ },
15891
+ set details($$value) {
15892
+ details($$value);
15893
+ flushSync();
15894
+ }
15895
+ });
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);
15768
15903
  function hasTimeSlotInCapacities(ticket) {
15769
15904
  var _a2;
15770
- if ((_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.selectedTimeslot) {
15771
- 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);
15772
15907
  } else {
15773
15908
  return false;
15774
15909
  }
15775
15910
  }
15776
15911
  var fragment = comment();
15777
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);
15778
15990
  {
15779
15991
  var consequent_1 = ($$anchor2) => {
15780
15992
  var table = root_1();
15781
15993
  var tbody = sibling(child(table));
15782
- each(tbody, 20, () => Object.values(details.tickets), (ticket) => ticket, ($$anchor3, ticket) => {
15783
- var fragment_1 = comment();
15784
- var node_1 = first_child(fragment_1);
15785
- {
15786
- var consequent = ($$anchor4) => {
15787
- var tr = root_3();
15788
- let classes;
15789
- var td = child(tr);
15790
- var select = child(td);
15791
- each(select, 21, () => ticket.quantityOptions, index, ($$anchor5, quantity) => {
15792
- var option = root_4();
15793
- var text2 = child(option, true);
15794
- reset(option);
15795
- var option_value = {};
15796
- template_effect(() => {
15797
- set_selected(option, get(quantity).selected);
15798
- set_text(text2, get(quantity).label);
15799
- if (option_value !== (option_value = get(quantity).value)) {
15800
- option.value = (option.__value = get(quantity).value) ?? "";
15801
- }
15802
- });
15803
- append($$anchor5, option);
15804
- });
15805
- reset(select);
15806
- reset(td);
15807
- var td_1 = sibling(td);
15808
- var p = child(td_1);
15809
- var text_1 = child(p, true);
15810
- reset(p);
15811
- var node_2 = sibling(p, 2);
15812
- html(node_2, () => ticket.description);
15813
- reset(td_1);
15814
- var td_2 = sibling(td_1);
15815
- var text_2 = child(td_2, true);
15816
- reset(td_2);
15817
- var td_3 = sibling(td_2);
15818
- var text_3 = child(td_3, true);
15819
- reset(td_3);
15820
- reset(tr);
15821
- template_effect(
15822
- ($0) => {
15823
- classes = set_class(tr, 1, "", null, classes, $0);
15824
- set_attribute(select, "name", ticket.id);
15825
- set_text(text_1, ticket.title);
15826
- set_text(text_2, ticket.priceFormatted);
15827
- set_text(text_3, ticket.totalPriceFormatted);
15828
- },
15829
- [() => ({ hidden: hasTimeSlotInCapacities(ticket) })]
15830
- );
15831
- append($$anchor4, tr);
15832
- };
15833
- if_block(node_1, ($$render) => {
15834
- 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
+ }
15835
16001
  });
15836
- }
15837
- append($$anchor3, fragment_1);
15838
- });
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
+ }
15839
16016
  reset(tbody);
15840
16017
  reset(table);
15841
16018
  append($$anchor2, table);
15842
16019
  };
15843
16020
  if_block(node, ($$render) => {
15844
- if (details.ticketSelectionDetails && details.ticketSelectionDetails.selectedTimeslot) $$render(consequent_1);
16021
+ if (details.ticketSelectionDetails) $$render(consequent_1);
15845
16022
  });
15846
16023
  }
15847
16024
  append($$anchor, fragment);
15848
- return pop({
15849
- details,
15850
- get selection() {
15851
- return selection();
15852
- },
15853
- set selection($$value) {
15854
- selection($$value);
15855
- flushSync();
15856
- },
15857
- get timeslot() {
15858
- return timeslot();
15859
- },
15860
- set timeslot($$value) {
15861
- timeslot($$value);
15862
- flushSync();
15863
- }
15864
- });
16025
+ return pop({ details });
15865
16026
  }
15866
- customElements.define("go-tickets", create_custom_element(Tickets, { selection: {}, timeslot: {} }, [], ["details"], false));
16027
+ customElements.define("go-tickets", create_custom_element(Tickets, {}, [], ["details"], false));
15867
16028
  })();
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "0.0.7",
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",