@gomusdev/web-components 1.30.0 → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1,69 @@
1
+ import { EventDetails } from '@gomus/types';
2
+ export declare const EventFactories: {
3
+ event(options?: Partial<ReturnType<typeof defaultEvent>>): EventDetails;
4
+ };
5
+ declare function defaultEvent(): {
6
+ id: number;
7
+ description: string;
8
+ museum_id: number;
9
+ exhibition_id: number;
10
+ foreign_id: string;
11
+ title: string;
12
+ sub_title: string;
13
+ created_at: string;
14
+ updated_at: string;
15
+ featured: boolean;
16
+ bookable: boolean;
17
+ registerable: boolean;
18
+ picture: {
19
+ title: string;
20
+ description: string;
21
+ copyright_info: string;
22
+ original: string;
23
+ teaser: string;
24
+ teaser_3x2: string;
25
+ preview: string;
26
+ preview_3x2: string;
27
+ detail: string;
28
+ detail_3x2: string;
29
+ article: string;
30
+ article_3x2: string;
31
+ thumbnail: string;
32
+ };
33
+ duration: number;
34
+ location: {
35
+ id: number;
36
+ name: string;
37
+ city: string;
38
+ country: string;
39
+ street: string;
40
+ zip: string;
41
+ latitude: string;
42
+ longitude: string;
43
+ };
44
+ age_groups: never[];
45
+ audiences: never[];
46
+ catch_words: never[];
47
+ disablements: never[];
48
+ grades: never[];
49
+ proposal_categories: never[];
50
+ languages: never[];
51
+ category: {
52
+ id: number;
53
+ name: string;
54
+ filtername: string;
55
+ };
56
+ upcoming_bookings_start_times: never[];
57
+ tickets: never[];
58
+ quotas: never[];
59
+ ticket_sales_in_shop: boolean;
60
+ dates: {
61
+ first: string;
62
+ last: string;
63
+ count: number;
64
+ };
65
+ sellabilities: never[];
66
+ documents: never[];
67
+ content: {};
68
+ };
69
+ export {};
@@ -0,0 +1,130 @@
1
+ import { ProductType } from '../lib/models/cart/types.ts';
2
+ export declare const TicketFactories: {
3
+ timeslot(options?: Partial<ReturnType<typeof defaultTicket>>): {
4
+ product_type: ProductType;
5
+ id: number;
6
+ ticket_type: "time_slot";
7
+ title: string;
8
+ description: string;
9
+ selectedTime: string;
10
+ museum_ids: never[];
11
+ exhibition_ids: never[];
12
+ quota_ids: never[];
13
+ first_entry: number;
14
+ last_entry: number;
15
+ personalizeable: boolean;
16
+ min_persons: number;
17
+ max_persons: number;
18
+ bookable: boolean;
19
+ price_cents: number;
20
+ discount: number;
21
+ vat_pct: number;
22
+ tax_included: boolean;
23
+ entry_duration: number;
24
+ attendees: boolean;
25
+ identification: string;
26
+ free_timing: boolean;
27
+ is_collective: boolean;
28
+ is_upgrade: boolean;
29
+ is_mantle: boolean;
30
+ sub_ticket_ids: never[];
31
+ sub_tickets: {};
32
+ is_sub_ticket: boolean;
33
+ created_at: string;
34
+ updated_at: string;
35
+ cash_point_order: number;
36
+ shop_order: number;
37
+ capacities: {};
38
+ total_capacities: {};
39
+ max_capacity: number;
40
+ max_total_capacity: number;
41
+ shipped_with_merchandise_id: null;
42
+ restricted_shop_account: boolean;
43
+ dynamic_prices: null;
44
+ };
45
+ day(options?: Partial<ReturnType<typeof defaultTicket>>): {
46
+ product_type: ProductType;
47
+ id: number;
48
+ ticket_type: "time_slot" | "normal";
49
+ title: string;
50
+ description: string;
51
+ selectedTime: string;
52
+ museum_ids: never[];
53
+ exhibition_ids: never[];
54
+ quota_ids: never[];
55
+ first_entry: number;
56
+ last_entry: number;
57
+ personalizeable: boolean;
58
+ min_persons: number;
59
+ max_persons: number;
60
+ bookable: boolean;
61
+ price_cents: number;
62
+ discount: number;
63
+ vat_pct: number;
64
+ tax_included: boolean;
65
+ entry_duration: number;
66
+ attendees: boolean;
67
+ identification: string;
68
+ free_timing: boolean;
69
+ is_collective: boolean;
70
+ is_upgrade: boolean;
71
+ is_mantle: boolean;
72
+ sub_ticket_ids: never[];
73
+ sub_tickets: {};
74
+ is_sub_ticket: boolean;
75
+ created_at: string;
76
+ updated_at: string;
77
+ cash_point_order: number;
78
+ shop_order: number;
79
+ capacities: {};
80
+ total_capacities: {};
81
+ max_capacity: number;
82
+ max_total_capacity: number;
83
+ shipped_with_merchandise_id: null;
84
+ restricted_shop_account: boolean;
85
+ dynamic_prices: null;
86
+ };
87
+ };
88
+ declare function defaultTicket(): {
89
+ product_type: ProductType;
90
+ id: number;
91
+ ticket_type: "time_slot";
92
+ title: string;
93
+ description: string;
94
+ selectedTime: string;
95
+ museum_ids: never[];
96
+ exhibition_ids: never[];
97
+ quota_ids: never[];
98
+ first_entry: number;
99
+ last_entry: number;
100
+ personalizeable: boolean;
101
+ min_persons: number;
102
+ max_persons: number;
103
+ bookable: boolean;
104
+ price_cents: number;
105
+ discount: number;
106
+ vat_pct: number;
107
+ tax_included: boolean;
108
+ entry_duration: number;
109
+ attendees: boolean;
110
+ identification: string;
111
+ free_timing: boolean;
112
+ is_collective: boolean;
113
+ is_upgrade: boolean;
114
+ is_mantle: boolean;
115
+ sub_ticket_ids: never[];
116
+ sub_tickets: {};
117
+ is_sub_ticket: boolean;
118
+ created_at: string;
119
+ updated_at: string;
120
+ cash_point_order: number;
121
+ shop_order: number;
122
+ capacities: {};
123
+ total_capacities: {};
124
+ max_capacity: number;
125
+ max_total_capacity: number;
126
+ shipped_with_merchandise_id: null;
127
+ restricted_shop_account: boolean;
128
+ dynamic_prices: null;
129
+ };
130
+ export {};
@@ -962,11 +962,6 @@ go-timeslots > ul label {
962
962
 
963
963
  /* Available timeslot */
964
964
 
965
- go-timeslots > ul .available {
966
- background-color: #fff;
967
- color: #333;
968
- }
969
-
970
965
  go-timeslots > ul input[type='radio'] {
971
966
  display: none; /* Hide the radio button */
972
967
  }
@@ -985,19 +980,16 @@ go-timeslots > ul label:has(input[type='radio']:checked) {
985
980
 
986
981
  /* Finished (unavailable) timeslot */
987
982
 
988
- go-timeslots > ul .finished {
983
+ go-timeslots > ul .is-sold-out,go-timeslots > ul .is-disabled {
989
984
  background-color: #f0f0f0;
990
985
  color: #999;
991
- }
992
-
993
- go-timeslots > ul .finished input {
994
- display: none;
995
- }
996
-
997
- go-timeslots > ul .finished {
998
986
  pointer-events: none;
999
987
  }
1000
988
 
989
+ go-timeslots > ul .is-sold-out input,go-timeslots > ul .is-disabled input {
990
+ display: none;
991
+ }
992
+
1001
993
  /* Disabled radio button appearance */
1002
994
 
1003
995
  go-timeslots > ul input:disabled + label {
@@ -10951,6 +10951,11 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
10951
10951
  function initUITimeslotTickets(tickets, selectedTime2 = "") {
10952
10952
  return sort(Object.values(tickets).map((ticket) => createUITicket(ticket, { selectedTime: selectedTime2 })), (f) => f.shop_order);
10953
10953
  }
10954
+ function filterAvailabletickets(tickets, selectedTime2 = "") {
10955
+ let available = Object.entries(tickets);
10956
+ if (selectedTime2 !== "") available = available.filter(([, t]) => t.total_capacities?.[selectedTime2] && t.total_capacities[selectedTime2] > 0);
10957
+ return Object.fromEntries(available);
10958
+ }
10954
10959
  const maxQuantity_Quotas = function(manager, cart, item, preCart) {
10955
10960
  if (manager.capacityPolicy(item) !== "quotas") throw new Error("(getMaxQuantityQuotas) impossible");
10956
10961
  if (!isUITicket(item.product)) {
@@ -10965,6 +10970,8 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
10965
10970
  quotaManager.setPrecartItemQuantity(product.id, i.quantity);
10966
10971
  }
10967
10972
  }
10973
+ console.log("checking quotas for", p2.id, "on", p2.selectedTime);
10974
+ console.log("available timeslots", quotaManager.timeslots());
10968
10975
  const cap = quotaManager.ticketCapacity(p2.id, p2.selectedTime);
10969
10976
  const total = quotaManager.totalCapacity(p2.id, p2.selectedTime);
10970
10977
  return {
@@ -15821,8 +15828,8 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
15821
15828
  [],
15822
15829
  false
15823
15830
  ));
15824
- var root_1$g = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1);
15825
- var root$6 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"><span class="go-cart-item-title-event-title"> </span> <span class="go-cart-item-title-ticket-title"> </span></span> <!></li>`);
15831
+ var root_1$g = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span><span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1);
15832
+ var root$6 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"><span class="go-cart-item-title-event-title"> </span><span class="go-cart-item-title-ticket-title"> </span></span><!></li>`);
15826
15833
  function Event$2($$anchor, $$props) {
15827
15834
  push($$props, true);
15828
15835
  let cartItem = prop($$props, "cartItem", 7);
@@ -15842,18 +15849,18 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
15842
15849
  var span_1 = child(span);
15843
15850
  var text2 = child(span_1, true);
15844
15851
  reset(span_1);
15845
- var span_2 = sibling(span_1, 2);
15852
+ var span_2 = sibling(span_1);
15846
15853
  var text_1 = child(span_2, true);
15847
15854
  reset(span_2);
15848
15855
  reset(span);
15849
- var node = sibling(span, 2);
15856
+ var node = sibling(span);
15850
15857
  {
15851
15858
  var consequent = ($$anchor2) => {
15852
15859
  var fragment = root_1$g();
15853
15860
  var span_3 = first_child(fragment);
15854
15861
  var text_2 = child(span_3, true);
15855
15862
  reset(span_3);
15856
- var span_4 = sibling(span_3, 2);
15863
+ var span_4 = sibling(span_3);
15857
15864
  var text_3 = child(span_4, true);
15858
15865
  reset(span_4);
15859
15866
  template_effect(
@@ -30693,15 +30700,27 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
30693
30700
  const _tsd = getTicketSelectionDetails($$props.$$host);
30694
30701
  const tsd = /* @__PURE__ */ user_derived(() => _tsd.value);
30695
30702
  user_effect(() => {
30696
- if (!get$2(tsd)?.isTicketsVisible) {
30697
- $$props.$$host.style.display = "none";
30698
- } else {
30699
- $$props.$$host.style.display = "block";
30700
- }
30703
+ $$props.$$host.style.display = get$2(tsd)?.isTicketsVisible ? "block" : "none";
30704
+ $$props.$$host.classList.toggle("is-hidden", !get$2(tsd)?.isTicketsVisible);
30705
+ $$props.$$host.classList.toggle("is-visible", get$2(tsd)?.isTicketsVisible);
30701
30706
  });
30702
30707
  pop();
30703
30708
  }
30704
30709
  customElements.define("go-tickets", create_custom_element(Tickets, {}, [], [], false));
30710
+ function TicketsEmpty($$anchor, $$props) {
30711
+ push($$props, true);
30712
+ const _tsd = getTicketSelectionDetails($$props.$$host);
30713
+ const tsd = /* @__PURE__ */ user_derived(() => _tsd.value);
30714
+ const numTickets = /* @__PURE__ */ user_derived(() => sum(get$2(tsd)?.preCarts || [], (pc) => pc.items.length));
30715
+ const isVisible = /* @__PURE__ */ user_derived(() => !get$2(tsd)?.isTicketsVisible || get$2(tsd)?.isTicketsVisible && get$2(numTickets) === 0);
30716
+ user_effect(() => {
30717
+ $$props.$$host.style.display = get$2(isVisible) ? "block" : "none";
30718
+ $$props.$$host.classList.toggle("is-hidden", !get$2(isVisible));
30719
+ $$props.$$host.classList.toggle("is-visible", get$2(isVisible));
30720
+ });
30721
+ pop();
30722
+ }
30723
+ customElements.define("go-tickets-empty", create_custom_element(TicketsEmpty, {}, [], [], false));
30705
30724
  function TicketsSum($$anchor, $$props) {
30706
30725
  push($$props, true);
30707
30726
  const _tsd = getTicketSelectionDetails($$props.$$host);
@@ -30756,7 +30775,8 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
30756
30775
  timeslot = Object.keys(Object.values(quotas)[0].capacities)[0];
30757
30776
  }
30758
30777
  shop.capacityManager.addQuotas(quotas);
30759
- const uiTickets = initUITimeslotTickets(tickets, timeslot);
30778
+ const available = filterAvailabletickets(tickets, timeslot);
30779
+ const uiTickets = initUITimeslotTickets(available, timeslot);
30760
30780
  segment.preCart = createCart(uiTickets);
30761
30781
  }
30762
30782
  async function loadEventScaledPricesTickets(segment) {
@@ -30832,7 +30852,8 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
30832
30852
  valid_at: tsd.selectedDate?.toString()
30833
30853
  }));
30834
30854
  shop.capacityManager.addQuotas(quotas);
30835
- const uiTickets = initUITimeslotTickets(tickets, tsd.selectedTime);
30855
+ const available = filterAvailabletickets(tickets, tsd.selectedTime);
30856
+ const uiTickets = initUITimeslotTickets(available, tsd.selectedTime);
30836
30857
  segment.preCart = createCart(uiTickets);
30837
30858
  }
30838
30859
  async function loadTimeslotTickets(segment) {
@@ -30841,7 +30862,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
30841
30862
  segment.clear();
30842
30863
  return;
30843
30864
  }
30844
- const result = await shop.asyncFetch(() => shop.ticketsAndQuotas({
30865
+ const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
30845
30866
  by_bookable: true,
30846
30867
  valid_at: tsd.selectedDate?.toString(),
30847
30868
  // @ts-ignore
@@ -30851,8 +30872,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
30851
30872
  "by_ticket_ids[]": tsd.ticketIds,
30852
30873
  "by_ticket_group_ids[]": tsd.ticketGroupIds
30853
30874
  }));
30854
- shop.capacityManager.addQuotas(result.quotas);
30855
- const uiTickets = initUITimeslotTickets(result.tickets, tsd.selectedTime);
30875
+ shop.capacityManager.addQuotas(quotas);
30876
+ const available = filterAvailabletickets(tickets, tsd.selectedTime);
30877
+ const uiTickets = initUITimeslotTickets(available, tsd.selectedTime);
30856
30878
  segment.preCart = createCart(uiTickets);
30857
30879
  }
30858
30880
  class TicketSegmentDetails {
@@ -30961,7 +30983,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
30961
30983
  TicketSegment,
30962
30984
  {
30963
30985
  dateId: { attribute: "date-id", reflect: true, type: "Number" },
30964
- filters: {}
30986
+ filters: { attribute: "filters", reflect: true, type: "String" }
30965
30987
  },
30966
30988
  [],
30967
30989
  ["details"],
@@ -31289,11 +31311,12 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
31289
31311
  reset(label);
31290
31312
  reset(li);
31291
31313
  template_effect(() => {
31292
- set_class(li, 1, clsx([
31293
- timeslot.capacity === 0 && "is-sold-out",
31294
- !timeslot.available && "is-disabled",
31295
- get$2(selected) && "is-selected"
31296
- ]));
31314
+ set_class(li, 1, clsx({
31315
+ "go-timeslot": true,
31316
+ "is-sold-out": timeslot.capacity === 0,
31317
+ "is-disabled": !timeslot.available,
31318
+ "is-selected": get$2(selected)
31319
+ }));
31297
31320
  set_text(text2, `${timeslot.timeFormatted ?? ""} `);
31298
31321
  input.disabled = timeslot.capacity == 0;
31299
31322
  set_attribute(input, "aria-disabled", timeslot.capacity == 0);
@@ -10951,6 +10951,11 @@ function createUITicket(apiTicket, options) {
10951
10951
  function initUITimeslotTickets(tickets, selectedTime2 = "") {
10952
10952
  return sort(Object.values(tickets).map((ticket) => createUITicket(ticket, { selectedTime: selectedTime2 })), (f) => f.shop_order);
10953
10953
  }
10954
+ function filterAvailabletickets(tickets, selectedTime2 = "") {
10955
+ let available = Object.entries(tickets);
10956
+ if (selectedTime2 !== "") available = available.filter(([, t]) => t.total_capacities?.[selectedTime2] && t.total_capacities[selectedTime2] > 0);
10957
+ return Object.fromEntries(available);
10958
+ }
10954
10959
  const maxQuantity_Quotas = function(manager, cart, item, preCart) {
10955
10960
  if (manager.capacityPolicy(item) !== "quotas") throw new Error("(getMaxQuantityQuotas) impossible");
10956
10961
  if (!isUITicket(item.product)) {
@@ -10965,6 +10970,8 @@ const maxQuantity_Quotas = function(manager, cart, item, preCart) {
10965
10970
  quotaManager.setPrecartItemQuantity(product.id, i.quantity);
10966
10971
  }
10967
10972
  }
10973
+ console.log("checking quotas for", p2.id, "on", p2.selectedTime);
10974
+ console.log("available timeslots", quotaManager.timeslots());
10968
10975
  const cap = quotaManager.ticketCapacity(p2.id, p2.selectedTime);
10969
10976
  const total = quotaManager.totalCapacity(p2.id, p2.selectedTime);
10970
10977
  return {
@@ -15821,8 +15828,8 @@ customElements.define("go-sign-up", create_custom_element(
15821
15828
  [],
15822
15829
  false
15823
15830
  ));
15824
- var root_1$g = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span> <span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1);
15825
- var root$6 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"><span class="go-cart-item-title-event-title"> </span> <span class="go-cart-item-title-ticket-title"> </span></span> <!></li>`);
15831
+ var root_1$g = /* @__PURE__ */ from_html(`<span class="go-cart-item-date" data-testid="cart-item-date"> </span><span class="go-cart-item-time" data-testid="cart-item-time"> </span>`, 1);
15832
+ var root$6 = /* @__PURE__ */ from_html(`<li data-go-cart-item-title=""><span class="go-cart-item-title" data-testid="cart-item-title"><span class="go-cart-item-title-event-title"> </span><span class="go-cart-item-title-ticket-title"> </span></span><!></li>`);
15826
15833
  function Event$2($$anchor, $$props) {
15827
15834
  push($$props, true);
15828
15835
  let cartItem = prop($$props, "cartItem", 7);
@@ -15842,18 +15849,18 @@ function Event$2($$anchor, $$props) {
15842
15849
  var span_1 = child(span);
15843
15850
  var text2 = child(span_1, true);
15844
15851
  reset(span_1);
15845
- var span_2 = sibling(span_1, 2);
15852
+ var span_2 = sibling(span_1);
15846
15853
  var text_1 = child(span_2, true);
15847
15854
  reset(span_2);
15848
15855
  reset(span);
15849
- var node = sibling(span, 2);
15856
+ var node = sibling(span);
15850
15857
  {
15851
15858
  var consequent = ($$anchor2) => {
15852
15859
  var fragment = root_1$g();
15853
15860
  var span_3 = first_child(fragment);
15854
15861
  var text_2 = child(span_3, true);
15855
15862
  reset(span_3);
15856
- var span_4 = sibling(span_3, 2);
15863
+ var span_4 = sibling(span_3);
15857
15864
  var text_3 = child(span_4, true);
15858
15865
  reset(span_4);
15859
15866
  template_effect(
@@ -30693,15 +30700,27 @@ function Tickets($$anchor, $$props) {
30693
30700
  const _tsd = getTicketSelectionDetails($$props.$$host);
30694
30701
  const tsd = /* @__PURE__ */ user_derived(() => _tsd.value);
30695
30702
  user_effect(() => {
30696
- if (!get$2(tsd)?.isTicketsVisible) {
30697
- $$props.$$host.style.display = "none";
30698
- } else {
30699
- $$props.$$host.style.display = "block";
30700
- }
30703
+ $$props.$$host.style.display = get$2(tsd)?.isTicketsVisible ? "block" : "none";
30704
+ $$props.$$host.classList.toggle("is-hidden", !get$2(tsd)?.isTicketsVisible);
30705
+ $$props.$$host.classList.toggle("is-visible", get$2(tsd)?.isTicketsVisible);
30701
30706
  });
30702
30707
  pop();
30703
30708
  }
30704
30709
  customElements.define("go-tickets", create_custom_element(Tickets, {}, [], [], false));
30710
+ function TicketsEmpty($$anchor, $$props) {
30711
+ push($$props, true);
30712
+ const _tsd = getTicketSelectionDetails($$props.$$host);
30713
+ const tsd = /* @__PURE__ */ user_derived(() => _tsd.value);
30714
+ const numTickets = /* @__PURE__ */ user_derived(() => sum(get$2(tsd)?.preCarts || [], (pc) => pc.items.length));
30715
+ const isVisible = /* @__PURE__ */ user_derived(() => !get$2(tsd)?.isTicketsVisible || get$2(tsd)?.isTicketsVisible && get$2(numTickets) === 0);
30716
+ user_effect(() => {
30717
+ $$props.$$host.style.display = get$2(isVisible) ? "block" : "none";
30718
+ $$props.$$host.classList.toggle("is-hidden", !get$2(isVisible));
30719
+ $$props.$$host.classList.toggle("is-visible", get$2(isVisible));
30720
+ });
30721
+ pop();
30722
+ }
30723
+ customElements.define("go-tickets-empty", create_custom_element(TicketsEmpty, {}, [], [], false));
30705
30724
  function TicketsSum($$anchor, $$props) {
30706
30725
  push($$props, true);
30707
30726
  const _tsd = getTicketSelectionDetails($$props.$$host);
@@ -30756,7 +30775,8 @@ async function loadDayTickets(segment) {
30756
30775
  timeslot = Object.keys(Object.values(quotas)[0].capacities)[0];
30757
30776
  }
30758
30777
  shop.capacityManager.addQuotas(quotas);
30759
- const uiTickets = initUITimeslotTickets(tickets, timeslot);
30778
+ const available = filterAvailabletickets(tickets, timeslot);
30779
+ const uiTickets = initUITimeslotTickets(available, timeslot);
30760
30780
  segment.preCart = createCart(uiTickets);
30761
30781
  }
30762
30782
  async function loadEventScaledPricesTickets(segment) {
@@ -30832,7 +30852,8 @@ async function loadEventTickets(segment) {
30832
30852
  valid_at: tsd.selectedDate?.toString()
30833
30853
  }));
30834
30854
  shop.capacityManager.addQuotas(quotas);
30835
- const uiTickets = initUITimeslotTickets(tickets, tsd.selectedTime);
30855
+ const available = filterAvailabletickets(tickets, tsd.selectedTime);
30856
+ const uiTickets = initUITimeslotTickets(available, tsd.selectedTime);
30836
30857
  segment.preCart = createCart(uiTickets);
30837
30858
  }
30838
30859
  async function loadTimeslotTickets(segment) {
@@ -30841,7 +30862,7 @@ async function loadTimeslotTickets(segment) {
30841
30862
  segment.clear();
30842
30863
  return;
30843
30864
  }
30844
- const result = await shop.asyncFetch(() => shop.ticketsAndQuotas({
30865
+ const { tickets, quotas } = await shop.asyncFetch(() => shop.ticketsAndQuotas({
30845
30866
  by_bookable: true,
30846
30867
  valid_at: tsd.selectedDate?.toString(),
30847
30868
  // @ts-ignore
@@ -30851,8 +30872,9 @@ async function loadTimeslotTickets(segment) {
30851
30872
  "by_ticket_ids[]": tsd.ticketIds,
30852
30873
  "by_ticket_group_ids[]": tsd.ticketGroupIds
30853
30874
  }));
30854
- shop.capacityManager.addQuotas(result.quotas);
30855
- const uiTickets = initUITimeslotTickets(result.tickets, tsd.selectedTime);
30875
+ shop.capacityManager.addQuotas(quotas);
30876
+ const available = filterAvailabletickets(tickets, tsd.selectedTime);
30877
+ const uiTickets = initUITimeslotTickets(available, tsd.selectedTime);
30856
30878
  segment.preCart = createCart(uiTickets);
30857
30879
  }
30858
30880
  class TicketSegmentDetails {
@@ -30961,7 +30983,7 @@ customElements.define("go-ticket-segment", create_custom_element(
30961
30983
  TicketSegment,
30962
30984
  {
30963
30985
  dateId: { attribute: "date-id", reflect: true, type: "Number" },
30964
- filters: {}
30986
+ filters: { attribute: "filters", reflect: true, type: "String" }
30965
30987
  },
30966
30988
  [],
30967
30989
  ["details"],
@@ -31289,11 +31311,12 @@ function Timeslots($$anchor, $$props) {
31289
31311
  reset(label);
31290
31312
  reset(li);
31291
31313
  template_effect(() => {
31292
- set_class(li, 1, clsx([
31293
- timeslot.capacity === 0 && "is-sold-out",
31294
- !timeslot.available && "is-disabled",
31295
- get$2(selected) && "is-selected"
31296
- ]));
31314
+ set_class(li, 1, clsx({
31315
+ "go-timeslot": true,
31316
+ "is-sold-out": timeslot.capacity === 0,
31317
+ "is-disabled": !timeslot.available,
31318
+ "is-selected": get$2(selected)
31319
+ }));
31297
31320
  set_text(text2, `${timeslot.timeFormatted ?? ""} `);
31298
31321
  input.disabled = timeslot.capacity == 0;
31299
31322
  set_attribute(input, "aria-disabled", timeslot.capacity == 0);
@@ -160,4 +160,5 @@ export declare function createUITicket(apiTicket: Ticket | AnnualTicket | Normal
160
160
  } | null;
161
161
  };
162
162
  export declare function initUITimeslotTickets(tickets: Tickets, selectedTime?: string): UITicket[];
163
+ export declare function filterAvailabletickets(tickets: Tickets, selectedTime?: string): Tickets;
163
164
  export {};
@@ -26,6 +26,7 @@ export declare const TicketMocks: {
26
26
  description: string;
27
27
  sub_ticket_ids: never[];
28
28
  sub_tickets: {};
29
+ total_capacities: {};
29
30
  is_sub_ticket: boolean;
30
31
  created_at: string;
31
32
  updated_at: string;
@@ -62,6 +63,7 @@ export declare const TicketMocks: {
62
63
  description: string;
63
64
  sub_ticket_ids: never[];
64
65
  sub_tickets: {};
66
+ total_capacities: {};
65
67
  is_sub_ticket: boolean;
66
68
  created_at: string;
67
69
  updated_at: string;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.30.0",
7
+ "version": "1.31.1",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",