@gomusdev/web-components 0.0.10 → 0.0.13

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.
@@ -10941,7 +10941,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10941
10941
  __publicField(this, "minQuantity");
10942
10942
  __publicField(this, "maxQuantity");
10943
10943
  __publicField(this, "maxPersons");
10944
- __publicField(this, "startTimes");
10944
+ __publicField(this, "timeSlots");
10945
10945
  __publicField(this, "capacities");
10946
10946
  __publicField(this, "totalCapacities");
10947
10947
  __publicField(this, "maxCapacity");
@@ -10971,7 +10971,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10971
10971
  this.maxTotalCapacity = ticketObject.max_total_capacity;
10972
10972
  this.capacities = { ...ticketObject.capacities };
10973
10973
  this.totalCapacities = { ...ticketObject.total_capacities };
10974
- this.startTimes = Object.keys(this.capacities).map((key) => {
10974
+ this.timeSlots = Object.keys(this.capacities).map((key) => {
10975
10975
  return {
10976
10976
  startAt: key,
10977
10977
  timeFormatted: formatTime(key),
@@ -10982,7 +10982,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
10982
10982
  quotaIds: ticketObject.quota_ids
10983
10983
  };
10984
10984
  });
10985
- this.startTimes = this.startTimes.filter((st) => this.totalCapacities[st.startAt]).sort((a, b) => a.startAt > b.startAt ? 1 : -1);
10985
+ this.timeSlots = this.timeSlots.filter((st) => this.totalCapacities[st.startAt]).sort((a, b) => a.startAt > b.startAt ? 1 : -1);
10986
10986
  this.quotaIds = ticketObject.quota_ids;
10987
10987
  this.updateMaxCapacity(selectedTime ?? null);
10988
10988
  this.shopOrder = ticketObject.shop_order ? ticketObject.shop_order : 0;
@@ -11005,14 +11005,14 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11005
11005
  updateMaxQuantity() {
11006
11006
  this.maxQuantity = Math.min(this.maxPersons, this.maxCapacity);
11007
11007
  this.quantityOptions = generateQuantityOptions(this.minQuantity, this.maxQuantity);
11008
- this.updateStartTimes();
11009
- }
11010
- updateStartTimes() {
11011
- this.startTimes.forEach((startTime) => {
11012
- startTime.capacity = Math.max(this.capacities[startTime.startAt], 0);
11013
- const selectedQuantity = startTime.startAt === this.selectedTime ? this.quantity : 0;
11014
- startTime.available = this.capacities[startTime.startAt] + selectedQuantity >= this.quantity && this.capacities[startTime.startAt] + selectedQuantity >= this.minAvailableCapacity;
11015
- startTime.selected = this.selectedTime === startTime.startAt;
11008
+ this.updateTimeslots();
11009
+ }
11010
+ updateTimeslots() {
11011
+ this.timeSlots.forEach((timeslot) => {
11012
+ timeslot.capacity = Math.max(this.capacities[timeslot.startAt], 0);
11013
+ const selectedQuantity = timeslot.startAt === this.selectedTime ? this.quantity : 0;
11014
+ timeslot.available = this.capacities[timeslot.startAt] + selectedQuantity >= this.quantity && this.capacities[timeslot.startAt] + selectedQuantity >= this.minAvailableCapacity;
11015
+ timeslot.selected = this.selectedTime === timeslot.startAt;
11016
11016
  });
11017
11017
  }
11018
11018
  updateTotalPrices() {
@@ -11212,7 +11212,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11212
11212
  return this.fetchAndCache(TICKET_AND_QUOTAS_ENDPOINT, `ticketsAndQuotas-${JSON.stringify(params)}`, "", { cache: 60, query: params });
11213
11213
  }
11214
11214
  tickets(params) {
11215
- return this.fetchAndCache(TICKETS_ENDPOINT, `tickets-${JSON.stringify(params)}`, "", { cache: 60, query: params });
11215
+ return this.fetchAndCache(TICKETS_ENDPOINT, `tickets-${JSON.stringify(params)}`, "tickets", { cache: 60, query: params });
11216
11216
  }
11217
11217
  /**
11218
11218
  * Returns a reactive value that will contain the fetched data, no need to await.
@@ -11348,6 +11348,56 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11348
11348
  [],
11349
11349
  false
11350
11350
  ));
11351
+ function Init($$anchor, $$props) {
11352
+ push($$props, true);
11353
+ let apiDomain = prop($$props, "apiDomain", 7), shopDomain = prop($$props, "shopDomain", 7), locale = prop($$props, "locale", 7);
11354
+ let apiUrl = `https://${apiDomain()}`;
11355
+ GomusInit($$anchor, {
11356
+ get apiUrl() {
11357
+ return apiUrl;
11358
+ },
11359
+ get shopDomain() {
11360
+ return shopDomain();
11361
+ },
11362
+ get locale() {
11363
+ return locale();
11364
+ }
11365
+ });
11366
+ return pop({
11367
+ get apiDomain() {
11368
+ return apiDomain();
11369
+ },
11370
+ set apiDomain($$value) {
11371
+ apiDomain($$value);
11372
+ flushSync();
11373
+ },
11374
+ get shopDomain() {
11375
+ return shopDomain();
11376
+ },
11377
+ set shopDomain($$value) {
11378
+ shopDomain($$value);
11379
+ flushSync();
11380
+ },
11381
+ get locale() {
11382
+ return locale();
11383
+ },
11384
+ set locale($$value) {
11385
+ locale($$value);
11386
+ flushSync();
11387
+ }
11388
+ });
11389
+ }
11390
+ customElements.define("go-init", create_custom_element(
11391
+ Init,
11392
+ {
11393
+ apiDomain: { attribute: "api-domain", type: "String" },
11394
+ shopDomain: { attribute: "shop-domain", type: "String" },
11395
+ locale: { attribute: "locale", type: "String" }
11396
+ },
11397
+ [],
11398
+ [],
11399
+ false
11400
+ ));
11351
11401
  function createSetDetails(KEY2) {
11352
11402
  return function(host, details) {
11353
11403
  if (host) {
@@ -12072,12 +12122,17 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12072
12122
  set total(value) {
12073
12123
  set(__privateGet(this, _total2), value);
12074
12124
  }
12075
- get selectedClasses() {
12076
- return [
12077
- this.selectedDate && "is-date-selected",
12078
- this.selectedTimeslot && "is-timeslot-selected",
12079
- this.selectedTickets.length && "is-tickets-selected"
12080
- ].filter(Boolean).join(" ");
12125
+ get isTimeslotsVisible() {
12126
+ var _a2;
12127
+ return Boolean(((_a2 = this.filters) == null ? void 0 : _a2.includes("time_slot")) && this.selectedDate);
12128
+ }
12129
+ get isTicketsVisible() {
12130
+ return Boolean(this.selectedDate && this.selectedTimeslot);
12131
+ }
12132
+ get isCalendarVisible() {
12133
+ var _a2;
12134
+ console.log("checking", this.filters);
12135
+ return Boolean((_a2 = this.filters) == null ? void 0 : _a2.includes("time_slot"));
12081
12136
  }
12082
12137
  }
12083
12138
  _mode = new WeakMap();
@@ -14694,7 +14749,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14694
14749
  };
14695
14750
  _props12 = new WeakMap();
14696
14751
  let CalendarHeaderState = _CalendarHeaderState;
14697
- var root_2$h = /* @__PURE__ */ from_html(`<div><!></div>`);
14752
+ var root_2$i = /* @__PURE__ */ from_html(`<div><!></div>`);
14698
14753
  function Calendar$2($$anchor, $$props) {
14699
14754
  push($$props, true);
14700
14755
  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, [
@@ -14795,7 +14850,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
14795
14850
  append($$anchor2, fragment_1);
14796
14851
  };
14797
14852
  var alternate = ($$anchor2) => {
14798
- var div = root_2$h();
14853
+ var div = root_2$i();
14799
14854
  attribute_effect(div, () => ({ ...get(mergedProps) }));
14800
14855
  var node_2 = child(div);
14801
14856
  snippet(node_2, () => children() ?? noop$1, () => rootState.snippetProps);
@@ -15043,7 +15098,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15043
15098
  [],
15044
15099
  true
15045
15100
  );
15046
- var root_2$g = /* @__PURE__ */ from_html(`<div><!></div>`);
15101
+ var root_2$h = /* @__PURE__ */ from_html(`<div><!></div>`);
15047
15102
  function Calendar_day($$anchor, $$props) {
15048
15103
  const uid = props_id();
15049
15104
  push($$props, true);
@@ -15075,7 +15130,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15075
15130
  append($$anchor2, fragment_1);
15076
15131
  };
15077
15132
  var alternate_1 = ($$anchor2) => {
15078
- var div = root_2$g();
15133
+ var div = root_2$h();
15079
15134
  attribute_effect(div, () => ({ ...get(mergedProps) }));
15080
15135
  var node_2 = child(div);
15081
15136
  {
@@ -15136,7 +15191,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15136
15191
  });
15137
15192
  }
15138
15193
  create_custom_element(Calendar_day, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15139
- var root_2$f = /* @__PURE__ */ from_html(`<table><!></table>`);
15194
+ var root_2$g = /* @__PURE__ */ from_html(`<table><!></table>`);
15140
15195
  function Calendar_grid($$anchor, $$props) {
15141
15196
  const uid = props_id();
15142
15197
  push($$props, true);
@@ -15165,7 +15220,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15165
15220
  append($$anchor2, fragment_1);
15166
15221
  };
15167
15222
  var alternate = ($$anchor2) => {
15168
- var table = root_2$f();
15223
+ var table = root_2$g();
15169
15224
  attribute_effect(table, () => ({ ...get(mergedProps) }));
15170
15225
  var node_2 = child(table);
15171
15226
  snippet(node_2, () => children() ?? noop$1);
@@ -15210,7 +15265,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15210
15265
  });
15211
15266
  }
15212
15267
  create_custom_element(Calendar_grid, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15213
- var root_2$e = /* @__PURE__ */ from_html(`<tbody><!></tbody>`);
15268
+ var root_2$f = /* @__PURE__ */ from_html(`<tbody><!></tbody>`);
15214
15269
  function Calendar_grid_body($$anchor, $$props) {
15215
15270
  const uid = props_id();
15216
15271
  push($$props, true);
@@ -15239,7 +15294,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15239
15294
  append($$anchor2, fragment_1);
15240
15295
  };
15241
15296
  var alternate = ($$anchor2) => {
15242
- var tbody = root_2$e();
15297
+ var tbody = root_2$f();
15243
15298
  attribute_effect(tbody, () => ({ ...get(mergedProps) }));
15244
15299
  var node_2 = child(tbody);
15245
15300
  snippet(node_2, () => children() ?? noop$1);
@@ -15284,7 +15339,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15284
15339
  });
15285
15340
  }
15286
15341
  create_custom_element(Calendar_grid_body, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15287
- var root_2$d = /* @__PURE__ */ from_html(`<td><!></td>`);
15342
+ var root_2$e = /* @__PURE__ */ from_html(`<td><!></td>`);
15288
15343
  function Calendar_cell($$anchor, $$props) {
15289
15344
  const uid = props_id();
15290
15345
  push($$props, true);
@@ -15320,7 +15375,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15320
15375
  append($$anchor2, fragment_1);
15321
15376
  };
15322
15377
  var alternate = ($$anchor2) => {
15323
- var td = root_2$d();
15378
+ var td = root_2$e();
15324
15379
  attribute_effect(td, () => ({ ...get(mergedProps) }));
15325
15380
  var node_2 = child(td);
15326
15381
  snippet(node_2, () => children() ?? noop$1, () => cellState.snippetProps);
@@ -15392,7 +15447,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15392
15447
  [],
15393
15448
  true
15394
15449
  );
15395
- var root_2$c = /* @__PURE__ */ from_html(`<thead><!></thead>`);
15450
+ var root_2$d = /* @__PURE__ */ from_html(`<thead><!></thead>`);
15396
15451
  function Calendar_grid_head($$anchor, $$props) {
15397
15452
  const uid = props_id();
15398
15453
  push($$props, true);
@@ -15421,7 +15476,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15421
15476
  append($$anchor2, fragment_1);
15422
15477
  };
15423
15478
  var alternate = ($$anchor2) => {
15424
- var thead = root_2$c();
15479
+ var thead = root_2$d();
15425
15480
  attribute_effect(thead, () => ({ ...get(mergedProps) }));
15426
15481
  var node_2 = child(thead);
15427
15482
  snippet(node_2, () => children() ?? noop$1);
@@ -15466,7 +15521,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15466
15521
  });
15467
15522
  }
15468
15523
  create_custom_element(Calendar_grid_head, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15469
- var root_2$b = /* @__PURE__ */ from_html(`<th><!></th>`);
15524
+ var root_2$c = /* @__PURE__ */ from_html(`<th><!></th>`);
15470
15525
  function Calendar_head_cell($$anchor, $$props) {
15471
15526
  const uid = props_id();
15472
15527
  push($$props, true);
@@ -15495,7 +15550,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15495
15550
  append($$anchor2, fragment_1);
15496
15551
  };
15497
15552
  var alternate = ($$anchor2) => {
15498
- var th = root_2$b();
15553
+ var th = root_2$c();
15499
15554
  attribute_effect(th, () => ({ ...get(mergedProps) }));
15500
15555
  var node_2 = child(th);
15501
15556
  snippet(node_2, () => children() ?? noop$1);
@@ -15540,7 +15595,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15540
15595
  });
15541
15596
  }
15542
15597
  create_custom_element(Calendar_head_cell, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15543
- var root_2$a = /* @__PURE__ */ from_html(`<tr><!></tr>`);
15598
+ var root_2$b = /* @__PURE__ */ from_html(`<tr><!></tr>`);
15544
15599
  function Calendar_grid_row($$anchor, $$props) {
15545
15600
  const uid = props_id();
15546
15601
  push($$props, true);
@@ -15569,7 +15624,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15569
15624
  append($$anchor2, fragment_1);
15570
15625
  };
15571
15626
  var alternate = ($$anchor2) => {
15572
- var tr = root_2$a();
15627
+ var tr = root_2$b();
15573
15628
  attribute_effect(tr, () => ({ ...get(mergedProps) }));
15574
15629
  var node_2 = child(tr);
15575
15630
  snippet(node_2, () => children() ?? noop$1);
@@ -15614,7 +15669,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15614
15669
  });
15615
15670
  }
15616
15671
  create_custom_element(Calendar_grid_row, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15617
- var root_2$9 = /* @__PURE__ */ from_html(`<header><!></header>`);
15672
+ var root_2$a = /* @__PURE__ */ from_html(`<header><!></header>`);
15618
15673
  function Calendar_header($$anchor, $$props) {
15619
15674
  const uid = props_id();
15620
15675
  push($$props, true);
@@ -15643,7 +15698,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15643
15698
  append($$anchor2, fragment_1);
15644
15699
  };
15645
15700
  var alternate = ($$anchor2) => {
15646
- var header = root_2$9();
15701
+ var header = root_2$a();
15647
15702
  attribute_effect(header, () => ({ ...get(mergedProps) }));
15648
15703
  var node_2 = child(header);
15649
15704
  snippet(node_2, () => children() ?? noop$1);
@@ -15688,7 +15743,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15688
15743
  });
15689
15744
  }
15690
15745
  create_custom_element(Calendar_header, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15691
- var root_2$8 = /* @__PURE__ */ from_html(`<div><!></div>`);
15746
+ var root_2$9 = /* @__PURE__ */ from_html(`<div><!></div>`);
15692
15747
  function Calendar_heading($$anchor, $$props) {
15693
15748
  const uid = props_id();
15694
15749
  push($$props, true);
@@ -15720,7 +15775,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15720
15775
  append($$anchor2, fragment_1);
15721
15776
  };
15722
15777
  var alternate_1 = ($$anchor2) => {
15723
- var div = root_2$8();
15778
+ var div = root_2$9();
15724
15779
  attribute_effect(div, () => ({ ...get(mergedProps) }));
15725
15780
  var node_2 = child(div);
15726
15781
  {
@@ -15781,7 +15836,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15781
15836
  });
15782
15837
  }
15783
15838
  create_custom_element(Calendar_heading, { children: {}, child: {}, ref: {}, id: {} }, [], [], true);
15784
- var root_2$7 = /* @__PURE__ */ from_html(`<button><!></button>`);
15839
+ var root_2$8 = /* @__PURE__ */ from_html(`<button><!></button>`);
15785
15840
  function Calendar_next_button($$anchor, $$props) {
15786
15841
  const uid = props_id();
15787
15842
  push($$props, true);
@@ -15811,7 +15866,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15811
15866
  append($$anchor2, fragment_1);
15812
15867
  };
15813
15868
  var alternate = ($$anchor2) => {
15814
- var button = root_2$7();
15869
+ var button = root_2$8();
15815
15870
  attribute_effect(button, () => ({ ...get(mergedProps) }));
15816
15871
  var node_2 = child(button);
15817
15872
  snippet(node_2, () => children() ?? noop$1);
@@ -15863,7 +15918,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15863
15918
  });
15864
15919
  }
15865
15920
  create_custom_element(Calendar_next_button, { children: {}, child: {}, id: {}, ref: {}, tabindex: {} }, [], [], true);
15866
- var root_2$6 = /* @__PURE__ */ from_html(`<button><!></button>`);
15921
+ var root_2$7 = /* @__PURE__ */ from_html(`<button><!></button>`);
15867
15922
  function Calendar_prev_button($$anchor, $$props) {
15868
15923
  const uid = props_id();
15869
15924
  push($$props, true);
@@ -15893,7 +15948,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
15893
15948
  append($$anchor2, fragment_1);
15894
15949
  };
15895
15950
  var alternate = ($$anchor2) => {
15896
- var button = root_2$6();
15951
+ var button = root_2$7();
15897
15952
  attribute_effect(button, () => ({ ...get(mergedProps) }));
15898
15953
  var node_2 = child(button);
15899
15954
  snippet(node_2, () => children() ?? noop$1);
@@ -16010,11 +16065,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16010
16065
  _details = new WeakMap();
16011
16066
  _params = new WeakMap();
16012
16067
  const ticketsCalendar = new TicketsCalendar();
16013
- var root_3$2 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
16068
+ var root_3$3 = /* @__PURE__ */ from_html(`<!> <!> <!>`, 1);
16014
16069
  var root_11 = /* @__PURE__ */ from_html(`<div> </div>`);
16015
16070
  var root_17 = /* @__PURE__ */ from_html(`<div></div> `, 1);
16016
16071
  var root_7 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
16017
- var root_2$5 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
16072
+ var root_2$6 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
16018
16073
  var root_1$5 = /* @__PURE__ */ from_html(`<div data-calendar-wrapper=""><!></div>`);
16019
16074
  function CalendarUI($$anchor, $$props) {
16020
16075
  push($$props, true);
@@ -16033,12 +16088,12 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16033
16088
  const children = ($$anchor2, $$arg0) => {
16034
16089
  let months = () => $$arg0 == null ? void 0 : $$arg0().months;
16035
16090
  let weekdays = () => $$arg0 == null ? void 0 : $$arg0().weekdays;
16036
- var fragment = root_2$5();
16091
+ var fragment = root_2$6();
16037
16092
  var node_1 = first_child(fragment);
16038
16093
  component(node_1, () => Calendar_header, ($$anchor3, Calendar_Header) => {
16039
16094
  Calendar_Header($$anchor3, {
16040
16095
  children: ($$anchor4, $$slotProps) => {
16041
- var fragment_1 = root_3$2();
16096
+ var fragment_1 = root_3$3();
16042
16097
  var node_2 = first_child(fragment_1);
16043
16098
  component(node_2, () => Calendar_prev_button, ($$anchor5, Calendar_PrevButton) => {
16044
16099
  Calendar_PrevButton($$anchor5, {
@@ -16344,15 +16399,23 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16344
16399
  return generateAvailableTimeSlots(result.tickets, result.quotas);
16345
16400
  }
16346
16401
  }, _ticketSelectionDetails = new WeakMap(), _d);
16347
- var root_2$4 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`);
16402
+ function dataAttr(name, condition, value = "") {
16403
+ return function(element) {
16404
+ const n = "data-go-" + name;
16405
+ if (condition) {
16406
+ element.setAttribute(n, value);
16407
+ } else {
16408
+ element.removeAttribute(n);
16409
+ }
16410
+ };
16411
+ }
16412
+ var root_2$5 = /* @__PURE__ */ from_html(`<li><label> <input type="radio" name="timeslot"/></label></li>`);
16348
16413
  var root_1$4 = /* @__PURE__ */ from_html(`<ul data-testid="timeslots" data-go-timeslots=""></ul>`);
16349
16414
  function Timeslots($$anchor, $$props) {
16350
16415
  push($$props, true);
16351
16416
  const binding_group = [];
16352
16417
  const details = new Details$2();
16353
- onMount(() => {
16354
- details.ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
16355
- });
16418
+ details.ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
16356
16419
  const change = (e) => {
16357
16420
  e.target.dispatchEvent(new CustomEvent("go-timeslot-select", {
16358
16421
  detail: { selected: details.ticketSelectionDetails.selectedTimeslot },
@@ -16366,7 +16429,11 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16366
16429
  var consequent = ($$anchor2) => {
16367
16430
  var ul = root_1$4();
16368
16431
  each(ul, 20, () => details.timeslots, (timeslot) => timeslot, ($$anchor3, timeslot) => {
16369
- var li = root_2$4();
16432
+ const selected = /* @__PURE__ */ user_derived(() => {
16433
+ var _a2;
16434
+ return ((_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.selectedTimeslot) === timeslot.startAt;
16435
+ });
16436
+ var li = root_2$5();
16370
16437
  var label = child(li);
16371
16438
  var text2 = child(label);
16372
16439
  var input = sibling(text2);
@@ -16375,6 +16442,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16375
16442
  var input_value;
16376
16443
  reset(label);
16377
16444
  reset(li);
16445
+ attach(li, () => dataAttr("selected", get(selected)));
16378
16446
  template_effect(() => {
16379
16447
  set_class(label, 1, clsx(timeslot.available ? "" : "disabled"));
16380
16448
  set_text(text2, `${timeslot.timeFormatted ?? ""} `);
@@ -16407,7 +16475,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16407
16475
  }
16408
16476
  delegate(["change"]);
16409
16477
  customElements.define("go-timeslots", create_custom_element(Timeslots, {}, [], ["details"], false));
16410
- var root_2$3 = /* @__PURE__ */ from_html(`<div><!></div>`);
16478
+ var root_2$4 = /* @__PURE__ */ from_html(`<div><!></div>`);
16411
16479
  var root$3 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
16412
16480
  function Wrapper($$anchor, $$props) {
16413
16481
  push($$props, true);
@@ -16440,7 +16508,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16440
16508
  var node_2 = sibling(node, 2);
16441
16509
  {
16442
16510
  var consequent_1 = ($$anchor2) => {
16443
- var div = root_2$3();
16511
+ var div = root_2$4();
16444
16512
  attribute_effect(div, () => ({ ...restProps }));
16445
16513
  var node_3 = child(div);
16446
16514
  snippet(node_3, children);
@@ -16486,22 +16554,16 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16486
16554
  "ticketIds"
16487
16555
  ]);
16488
16556
  const details = new TicketSelectionDetails();
16489
- details.mode = mode();
16490
- details.filters = [filter()];
16491
- details.eventId = eventId();
16492
- details.museumIds = parseIds(museumIds());
16493
- details.exhibitionIds = parseIds(exhibitionIds());
16494
- details.ticketIds = parseIds(ticketIds());
16557
+ user_effect(() => {
16558
+ details.mode = mode();
16559
+ details.filters = [filter()];
16560
+ details.eventId = eventId();
16561
+ details.museumIds = parseIds(museumIds());
16562
+ details.exhibitionIds = parseIds(exhibitionIds());
16563
+ details.ticketIds = parseIds(ticketIds());
16564
+ });
16495
16565
  setTicketSelectionDetails($$props.$$host, details);
16496
- let cls = /* @__PURE__ */ user_derived(() => [
16497
- "go-ticket-selection",
16498
- details.selectedClasses,
16499
- (restProps == null ? void 0 : restProps["class"]) || ""
16500
- ].join(" "));
16501
16566
  Wrapper($$anchor, spread_props({ host: $$props.$$host }, () => restProps, {
16502
- get class() {
16503
- return get(cls);
16504
- },
16505
16567
  children: ($$anchor2, $$slotProps) => {
16506
16568
  var fragment_1 = comment();
16507
16569
  var node = first_child(fragment_1);
@@ -16569,15 +16631,31 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16569
16631
  mode: { attribute: "mode", reflect: true, type: "String" },
16570
16632
  eventId: { attribute: "event-id", reflect: true, type: "Number" },
16571
16633
  ticketIds: { attribute: "ticket-ids", reflect: true, type: "String" },
16634
+ museumIds: { attribute: "museum-ids", reflect: true, type: "String" },
16635
+ exhibitionIds: { attribute: "exhibition-ids", reflect: true, type: "String" },
16572
16636
  filter: {},
16573
- children: {},
16574
- museumIds: {},
16575
- exhibitionIds: {}
16637
+ children: {}
16576
16638
  },
16577
16639
  [],
16578
16640
  ["details"],
16579
16641
  false
16580
16642
  ));
16643
+ function SelectionTotal($$anchor, $$props) {
16644
+ push($$props, true);
16645
+ let ticketSelectionDetails = /* @__PURE__ */ state(void 0);
16646
+ onMount(() => {
16647
+ set(ticketSelectionDetails, getTicketSelectionDetails($$props.$$host), true);
16648
+ });
16649
+ next();
16650
+ var text$1 = text();
16651
+ template_effect(() => {
16652
+ var _a2;
16653
+ return set_text(text$1, (_a2 = get(ticketSelectionDetails)) == null ? void 0 : _a2.total);
16654
+ });
16655
+ append($$anchor, text$1);
16656
+ pop();
16657
+ }
16658
+ customElements.define("go-total", create_custom_element(SelectionTotal, {}, [], [], false));
16581
16659
  let Details$1 = (_e = class {
16582
16660
  constructor() {
16583
16661
  __privateAdd(this, _ticketSelectionDetails2, /* @__PURE__ */ state());
@@ -16588,44 +16666,44 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16588
16666
  set ticketSelectionDetails(value) {
16589
16667
  set(__privateGet(this, _ticketSelectionDetails2), value, true);
16590
16668
  }
16591
- get tickets() {
16592
- var _a2, _b2, _c2, _d2, _e2, _f;
16593
- const date = (_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.selectedDate;
16594
- const ticketTypes = (_b2 = this.ticketSelectionDetails) == null ? void 0 : _b2.filters;
16595
- const museumIds = (_c2 = this.ticketSelectionDetails) == null ? void 0 : _c2.museumIds;
16596
- const exhibitionIds = (_d2 = this.ticketSelectionDetails) == null ? void 0 : _d2.exhibitionIds;
16597
- const ticketIds = (_e2 = this.ticketSelectionDetails) == null ? void 0 : _e2.ticketIds;
16598
- if (!date && !((_f = this.ticketSelectionDetails) == null ? void 0 : _f.selectedTimeslot) && (ticketTypes == null ? void 0 : ticketTypes.includes("time_slot"))) return [];
16669
+ get allTickets() {
16670
+ return [...this.timeslotTickets, ...this.annualTickets];
16671
+ }
16672
+ get timeslotTickets() {
16673
+ var _a2, _b2;
16674
+ const tsd = this.ticketSelectionDetails;
16675
+ if (!tsd) return [];
16676
+ if (!tsd.selectedDate && !tsd.selectedTimeslot && ((_a2 = tsd.filters) == null ? void 0 : _a2.includes("time_slot"))) return [];
16599
16677
  const result = snapshot(shop.ticketsAndQuotas({
16600
16678
  by_bookable: true,
16601
- valid_at: date == null ? void 0 : date.toString(),
16679
+ valid_at: (_b2 = tsd.selectedDate) == null ? void 0 : _b2.toString(),
16602
16680
  // @ts-ignore
16603
- "by_ticket_types[]": ticketTypes,
16604
- "by_museum_ids[]": museumIds,
16605
- "by_exhibition_ids[]": exhibitionIds,
16606
- "by_ticket_ids[]": ticketIds
16681
+ "by_ticket_types[]": tsd.filters,
16682
+ "by_museum_ids[]": tsd.museumIds,
16683
+ "by_exhibition_ids[]": tsd.exhibitionIds,
16684
+ "by_ticket_ids[]": tsd.ticketIds
16607
16685
  }));
16608
16686
  if (!result) return [];
16609
16687
  return initGomusTickets(result.tickets);
16610
16688
  }
16611
16689
  get annualTickets() {
16612
- var _a2, _b2;
16613
- const ticketTypes = (_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.filters;
16614
- const ticketIds = (_b2 = this.ticketSelectionDetails) == null ? void 0 : _b2.ticketIds;
16615
- if (!(ticketTypes == null ? void 0 : ticketTypes.includes("annual"))) return [];
16690
+ var _a2;
16691
+ const tsd = this.ticketSelectionDetails;
16692
+ if (!tsd) return [];
16693
+ if (!((_a2 = tsd.filters) == null ? void 0 : _a2.includes("annual"))) return [];
16616
16694
  const result = snapshot(shop.tickets({
16617
16695
  by_bookable: true,
16618
16696
  // @ts-ignore
16619
- "by_ticket_types[]": ticketTypes,
16620
- "by_ticket_ids[]": ticketIds
16697
+ "by_ticket_types[]": tsd.filters,
16698
+ "by_ticket_ids[]": tsd.ticketIds
16621
16699
  }));
16622
16700
  if (!result) return [];
16623
- return initAnnualTickets(result.tickets);
16701
+ return initAnnualTickets(result);
16624
16702
  }
16625
16703
  updateSelectedTickets(ticket, quantity) {
16626
16704
  var _a2, _b2, _c2;
16627
- const index2 = this.tickets.findIndex((t) => t.id == ticket.id);
16628
- const duplicate = this.tickets[index2];
16705
+ const index2 = this.timeslotTickets.findIndex((t) => t.id == ticket.id);
16706
+ const duplicate = this.timeslotTickets[index2];
16629
16707
  duplicate.quantity = quantity;
16630
16708
  if (ticket.type == "time_slot") {
16631
16709
  duplicate.selectedTime = ((_a2 = this.ticketSelectionDetails) == null ? void 0 : _a2.selectedTimeslot) || "";
@@ -16635,7 +16713,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16635
16713
  this.ticketSelectionDetails.ticketList = (_c2 = this.ticketSelectionDetails) == null ? void 0 : _c2.ticketList.concat(duplicate);
16636
16714
  }
16637
16715
  }, _ticketSelectionDetails2 = new WeakMap(), _e);
16638
- var root_2$2 = /* @__PURE__ */ from_html(`<option> </option>`);
16716
+ var root_2$3 = /* @__PURE__ */ from_html(`<option> </option>`);
16639
16717
  var root_1$3 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td></tr>`);
16640
16718
  function Annual($$anchor, $$props) {
16641
16719
  push($$props, true);
@@ -16647,7 +16725,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16647
16725
  var td = child(tr);
16648
16726
  var select = child(td);
16649
16727
  each(select, 21, () => ticket.quantityOptions, index, ($$anchor3, quantity) => {
16650
- var option = root_2$2();
16728
+ var option = root_2$3();
16651
16729
  var text2 = child(option, true);
16652
16730
  reset(option);
16653
16731
  var option_value = {};
@@ -16699,8 +16777,8 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16699
16777
  var _a2;
16700
16778
  return details().updateSelectedTickets(ticket, parseInt((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value));
16701
16779
  };
16702
- var root_3$1 = /* @__PURE__ */ from_html(`<option> </option>`);
16703
- var root_2$1 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td></tr>`);
16780
+ var root_3$2 = /* @__PURE__ */ from_html(`<option> </option>`);
16781
+ var root_2$2 = /* @__PURE__ */ from_html(`<tr><td><select></select></td><td><p> </p> <!></td><td> </td></tr>`);
16704
16782
  function Timeslot($$anchor, $$props) {
16705
16783
  push($$props, true);
16706
16784
  let details = prop($$props, "details", 7);
@@ -16714,18 +16792,18 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16714
16792
  }
16715
16793
  var fragment = comment();
16716
16794
  var node = first_child(fragment);
16717
- each(node, 16, () => Object.values(details().tickets), (ticket) => ticket, ($$anchor2, ticket) => {
16795
+ each(node, 16, () => Object.values(details().timeslotTickets), (ticket) => ticket, ($$anchor2, ticket) => {
16718
16796
  var fragment_1 = comment();
16719
16797
  var node_1 = first_child(fragment_1);
16720
16798
  {
16721
16799
  var consequent = ($$anchor3) => {
16722
- var tr = root_2$1();
16800
+ var tr = root_2$2();
16723
16801
  let classes;
16724
16802
  var td = child(tr);
16725
16803
  var select = child(td);
16726
16804
  select.__change = [on_change, details, ticket];
16727
16805
  each(select, 21, () => ticket.quantityOptions, index, ($$anchor4, quantity) => {
16728
- var option = root_3$1();
16806
+ var option = root_3$2();
16729
16807
  var text2 = child(option, true);
16730
16808
  reset(option);
16731
16809
  var option_value = {};
@@ -16784,9 +16862,36 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16784
16862
  }
16785
16863
  delegate(["change"]);
16786
16864
  create_custom_element(Timeslot, { details: {} }, [], [], true);
16787
- var root_1$2 = /* @__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>`);
16865
+ var root_2$1 = /* @__PURE__ */ from_html(`<option> </option>`);
16866
+ var root_1$2 = /* @__PURE__ */ from_html(`<select></select>`);
16867
+ var root_4$1 = /* @__PURE__ */ from_html(`<li><article data-go-ticket=""><ul><li data-go-tickets-title=""> </li> <li data-go-tickets-description=""><!></li> <li data-go-tickets-price=""> </li> <li data-go-tickets-quality=""><!></li></ul></article></li>`);
16868
+ var root_3$1 = /* @__PURE__ */ from_html(`<ol data-go-tickets="" data-testid="tickets"><li data-go-tickets-header="" data-testid="tickets-header"><ul><li data-go-tickets-title="">Title</li> <li data-go-tickets-description="">Description</li> <li data-go-tickets-price="">Price</li> <li data-go-tickets-quality="">Quantity</li></ul></li> <!></ol>`);
16788
16869
  function Tickets($$anchor, $$props) {
16789
16870
  push($$props, true);
16871
+ const select = ($$anchor2, ticket = noop$1) => {
16872
+ var select_1 = root_1$2();
16873
+ select_1.__change = (e) => {
16874
+ var _a2;
16875
+ return details.updateSelectedTickets(ticket(), parseInt((_a2 = e == null ? void 0 : e.target) == null ? void 0 : _a2.value));
16876
+ };
16877
+ each(select_1, 21, () => ticket().quantityOptions, index, ($$anchor3, quantity) => {
16878
+ var option = root_2$1();
16879
+ var text2 = child(option, true);
16880
+ reset(option);
16881
+ var option_value = {};
16882
+ template_effect(() => {
16883
+ set_selected(option, get(quantity).selected);
16884
+ set_text(text2, get(quantity).label);
16885
+ if (option_value !== (option_value = get(quantity).value)) {
16886
+ option.value = (option.__value = get(quantity).value) ?? "";
16887
+ }
16888
+ });
16889
+ append($$anchor3, option);
16890
+ });
16891
+ reset(select_1);
16892
+ template_effect(($0) => set_attribute(select_1, "name", $0), [() => ticket().id.toString()]);
16893
+ append($$anchor2, select_1);
16894
+ };
16790
16895
  const details = new Details$1();
16791
16896
  onMount(() => {
16792
16897
  details.ticketSelectionDetails = getTicketSelectionDetails($$props.$$host);
@@ -16794,43 +16899,49 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
16794
16899
  var fragment = comment();
16795
16900
  var node = first_child(fragment);
16796
16901
  {
16797
- var consequent_1 = ($$anchor2) => {
16798
- var table = root_1$2();
16799
- var tbody = sibling(child(table));
16800
- var node_1 = child(tbody);
16801
- {
16802
- var consequent = ($$anchor3) => {
16803
- Annual($$anchor3, {
16804
- get details() {
16805
- return details;
16806
- }
16807
- });
16808
- };
16809
- var alternate = ($$anchor3) => {
16810
- Timeslot($$anchor3, {
16811
- get details() {
16812
- return details;
16813
- }
16814
- });
16815
- };
16816
- if_block(node_1, ($$render) => {
16817
- var _a2, _b2;
16818
- if ((_b2 = (_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.filters) == null ? void 0 : _b2.includes("annual")) $$render(consequent);
16819
- else $$render(alternate, false);
16902
+ var consequent = ($$anchor2) => {
16903
+ var ol = root_3$1();
16904
+ var node_1 = sibling(child(ol), 2);
16905
+ each(node_1, 17, () => details.timeslotTickets, index, ($$anchor3, ticket) => {
16906
+ var li = root_4$1();
16907
+ var article = child(li);
16908
+ var ul = child(article);
16909
+ var li_1 = child(ul);
16910
+ var text_1 = child(li_1, true);
16911
+ reset(li_1);
16912
+ var li_2 = sibling(li_1, 2);
16913
+ var node_2 = child(li_2);
16914
+ html(node_2, () => get(ticket).description);
16915
+ reset(li_2);
16916
+ var li_3 = sibling(li_2, 2);
16917
+ var text_2 = child(li_3, true);
16918
+ reset(li_3);
16919
+ var li_4 = sibling(li_3, 2);
16920
+ var node_3 = child(li_4);
16921
+ select(node_3, () => get(ticket));
16922
+ reset(li_4);
16923
+ reset(ul);
16924
+ reset(article);
16925
+ reset(li);
16926
+ template_effect(() => {
16927
+ set_attribute(article, "data-testid", "ticket-" + get(ticket).id);
16928
+ set_text(text_1, get(ticket).title);
16929
+ set_text(text_2, get(ticket).totalPriceFormatted);
16820
16930
  });
16821
- }
16822
- reset(tbody);
16823
- reset(table);
16824
- append($$anchor2, table);
16931
+ append($$anchor3, li);
16932
+ });
16933
+ reset(ol);
16934
+ append($$anchor2, ol);
16825
16935
  };
16826
16936
  if_block(node, ($$render) => {
16827
16937
  var _a2;
16828
- if (details.ticketSelectionDetails && details.ticketSelectionDetails.selectedTimeslot || ((_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.selectedDate)) $$render(consequent_1);
16938
+ if (((_a2 = details.ticketSelectionDetails) == null ? void 0 : _a2.isTicketsVisible) && details.allTickets.length > 0) $$render(consequent);
16829
16939
  });
16830
16940
  }
16831
16941
  append($$anchor, fragment);
16832
16942
  return pop({ details });
16833
16943
  }
16944
+ delegate(["change"]);
16834
16945
  customElements.define("go-tickets", create_custom_element(Tickets, {}, [], ["details"], false));
16835
16946
  var root_2 = /* @__PURE__ */ from_html(`<span> </span>`);
16836
16947
  var root_1$1 = /* @__PURE__ */ from_html(`<span> </span> <!>`, 1);