@gomusdev/web-components 1.51.1 → 1.53.0

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.
@@ -2045,6 +2045,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
2045
2045
  function should_defer_append() {
2046
2046
  return false;
2047
2047
  }
2048
+ function create_comment(data = "") {
2049
+ return document.createComment(data);
2050
+ }
2048
2051
  function autofocus(dom, value) {
2049
2052
  if (value) {
2050
2053
  const body = document.body;
@@ -4369,6 +4372,14 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
4369
4372
  }
4370
4373
  element.value = value ?? "";
4371
4374
  }
4375
+ function set_checked(element, checked) {
4376
+ var attributes = get_attributes(element);
4377
+ if (attributes.checked === (attributes.checked = // treat null and undefined the same for the initial value
4378
+ checked ?? void 0)) {
4379
+ return;
4380
+ }
4381
+ element.checked = checked;
4382
+ }
4372
4383
  function set_selected(element, selected) {
4373
4384
  if (selected) {
4374
4385
  if (!element.hasAttribute("selected")) {
@@ -4657,6 +4668,36 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
4657
4668
  }
4658
4669
  return setters;
4659
4670
  }
4671
+ let supported = null;
4672
+ function is_supported() {
4673
+ if (supported === null) {
4674
+ var select = document.createElement("select");
4675
+ select.innerHTML = "<option><span>t</span></option>";
4676
+ supported = /** @type {Element} */
4677
+ select.firstChild?.firstChild?.nodeType === 1;
4678
+ }
4679
+ return supported;
4680
+ }
4681
+ function customizable_select(element, rich_fn) {
4682
+ var was_hydrating = hydrating;
4683
+ if (!is_supported()) {
4684
+ set_hydrating(false);
4685
+ element.textContent = "";
4686
+ element.append(create_comment(""));
4687
+ }
4688
+ try {
4689
+ rich_fn();
4690
+ } finally {
4691
+ if (was_hydrating) {
4692
+ if (hydrating) {
4693
+ reset(element);
4694
+ } else {
4695
+ set_hydrating(true);
4696
+ set_hydrate_node(element);
4697
+ }
4698
+ }
4699
+ }
4700
+ }
4660
4701
  function bind_value(input, get2, set2 = get2) {
4661
4702
  var batches2 = /* @__PURE__ */ new WeakSet();
4662
4703
  listen_to_event_and_reset_event(input, "input", async (is_reset) => {
@@ -11188,10 +11229,17 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11188
11229
  return this.type + "-" + this.product.id + this.subUId;
11189
11230
  },
11190
11231
  get subUId() {
11232
+ const segments = [];
11233
+ if (this.time) {
11234
+ segments.push(`time: ${this.time}`);
11235
+ }
11191
11236
  if (isUIScaledPricesTicket(this.product)) {
11192
- return ` (scale_price: ${this.product.scale_price_id})`;
11237
+ segments.push(`scale_price: ${this.product.scale_price_id}`);
11193
11238
  }
11194
- return "";
11239
+ if (this.display?.discounted) {
11240
+ segments.push("discounted");
11241
+ }
11242
+ return segments.length > 0 ? ` (${segments.join(", ")})` : "";
11195
11243
  },
11196
11244
  toString() {
11197
11245
  return this.uuid + ":" + this.quantity;
@@ -11220,11 +11268,6 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11220
11268
  }
11221
11269
  };
11222
11270
  }
11223
- function updateLocalStorage(cart) {
11224
- const content = JSON.stringify({ items: cart.items || [], coupons: cart.coupons || [] });
11225
- localStorage.setItem("go-cart", content);
11226
- return content;
11227
- }
11228
11271
  function generateCartItem(cartItem) {
11229
11272
  const type = cartItem.type;
11230
11273
  switch (type) {
@@ -11274,27 +11317,21 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11274
11317
  }
11275
11318
  function syncCartToLocalStorage(cart) {
11276
11319
  loadFromLocalStorage$1(cart);
11277
- const storeCart = proxy(cart);
11320
+ let lastWritten = JSON.stringify({ items: cart.items || [], coupons: cart.coupons || [] });
11321
+ localStorage.setItem("go-cart", lastWritten);
11278
11322
  effect_root(() => {
11279
11323
  user_effect(() => {
11280
- updateLocalStorage(storeCart);
11324
+ const content = JSON.stringify({ items: cart.items || [], coupons: cart.coupons || [] });
11325
+ if (content === lastWritten) return;
11326
+ lastWritten = content;
11327
+ localStorage.setItem("go-cart", content);
11281
11328
  });
11282
11329
  });
11283
- let lastLS = "";
11284
- setInterval(
11285
- () => {
11286
- if (!localStorage) {
11287
- console.warn("(syncCartToLocalStorage) localStorage is not available");
11288
- return;
11289
- }
11290
- let newLS = localStorage.getItem("go-cart");
11291
- if (lastLS && lastLS !== newLS) {
11292
- loadFromLocalStorage$1(cart);
11293
- }
11294
- lastLS = newLS || "";
11295
- },
11296
- 1e3
11297
- );
11330
+ window.addEventListener("storage", (event2) => {
11331
+ if (event2.key !== "go-cart") return;
11332
+ lastWritten = localStorage.getItem("go-cart") ?? "";
11333
+ loadFromLocalStorage$1(cart);
11334
+ });
11298
11335
  }
11299
11336
  const inTheFuture = (time2) => {
11300
11337
  const now = /* @__PURE__ */ new Date();
@@ -11306,12 +11343,19 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11306
11343
  function createCart(products, contingent = 20) {
11307
11344
  const items = proxy([]);
11308
11345
  const coupons = proxy([]);
11346
+ let paymentModeId = /* @__PURE__ */ state(void 0);
11309
11347
  const cart = {
11310
11348
  items,
11311
11349
  coupons,
11312
11350
  contingent,
11313
11351
  // caps the total number of items in the cart
11314
11352
  uid: `cart-${lastUuid++}`,
11353
+ get paymentModeId() {
11354
+ return get$2(paymentModeId);
11355
+ },
11356
+ set paymentModeId(value) {
11357
+ set(paymentModeId, value, true);
11358
+ },
11315
11359
  get nonEmptyItems() {
11316
11360
  return this.items.filter((i) => i.quantity > 0);
11317
11361
  },
@@ -11333,7 +11377,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11333
11377
  shipping_address_id: null,
11334
11378
  comment: null,
11335
11379
  reference: null,
11336
- payment_mode_id: shop.settings?.defaultPaymentModeId,
11380
+ payment_mode_id: this.paymentModeId ?? shop.settings?.defaultPaymentModeId,
11337
11381
  coupons: this.coupons,
11338
11382
  donations: [],
11339
11383
  affiliate: {},
@@ -12571,6 +12615,9 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
12571
12615
  checkout(params) {
12572
12616
  return this.apiPost(`/api/v4/orders`, { body: params, requiredFields: ["items", "total"] });
12573
12617
  }
12618
+ createCart(params) {
12619
+ return this.apiPost(`/api/v4/cart`, { body: params, requiredFields: ["items"] });
12620
+ }
12574
12621
  order(token) {
12575
12622
  return this.fetchAndCache("/api/v4/orders/{id}", `order-${token}`, "order", { path: { id: token } });
12576
12623
  }
@@ -16153,6 +16200,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16153
16200
  placeholder: "",
16154
16201
  description: "",
16155
16202
  autocomplete: "off"
16203
+ },
16204
+ paymentMode: {
16205
+ key: "paymentMode",
16206
+ apiKey: "payment_mode_id",
16207
+ type: "paymentMode",
16208
+ label: "cart.paymentMode.label",
16209
+ placeholder: "",
16210
+ description: "",
16211
+ autocomplete: "off",
16212
+ options: () => {
16213
+ const modes = shop.payment_modes ? Object.values(shop.payment_modes) : [];
16214
+ return modes.map((m) => ({ value: String(m.id), label: m.name }));
16215
+ }
16156
16216
  }
16157
16217
  };
16158
16218
  function createField(data, required) {
@@ -16431,6 +16491,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16431
16491
  const ret = Object.fromEntries(validFields.map((f) => [f.apiKey, coerce2(f.value)]));
16432
16492
  return ret;
16433
16493
  }
16494
+ fieldValue(key) {
16495
+ return this.fields.find((f) => f.key === key)?.value;
16496
+ }
16434
16497
  get apiErrors() {
16435
16498
  return get$2(this.#apiErrors);
16436
16499
  }
@@ -16880,39 +16943,66 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16880
16943
  function option(value) {
16881
16944
  return { value, label: value.toString() };
16882
16945
  }
16883
- var root_5$1 = /* @__PURE__ */ from_html(`<span> </span>`);
16884
- var root_7$3 = /* @__PURE__ */ from_html(`<option> </option>`);
16885
- var root_6$2 = /* @__PURE__ */ from_html(`<select></select>`);
16886
- var root_8$2 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove" data-go-cart-item-remove=""><button>⨉</button></li>`);
16887
- var root_1$i = /* @__PURE__ */ from_html(`<article><ul><li data-go-cart-item-title=""><!></li> <li class="go-cart-item-price" data-go-cart-item-price=""> </li> <li class="go-cart-item-count" data-go-cart-item-count=""><!></li> <!> <li class="go-cart-item-sum" data-go-cart-item-sum=""> </li></ul></article>`);
16946
+ var root_5$2 = /* @__PURE__ */ from_html(`<s class="go-cart-item-price-original"> </s> <span class="go-cart-item-price-discounted"> </span>`, 1);
16947
+ var root_6$3 = /* @__PURE__ */ from_html(`<span class="go-cart-item-price-discounted"> </span>`);
16948
+ var root_7$4 = /* @__PURE__ */ from_html(`<span> </span>`);
16949
+ var root_9$4 = /* @__PURE__ */ from_html(`<option> </option>`);
16950
+ var root_8$2 = /* @__PURE__ */ from_html(`<select class="go-cart-item-select"></select>`);
16951
+ var root_10$2 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button>⨉</button></li>`);
16952
+ var root_1$i = /* @__PURE__ */ from_html(`<article class="go-cart-item-content"><ul><li class="go-cart-item-title-container"><!></li> <li class="go-cart-item-price"><!></li> <li class="go-cart-item-count"><!></li> <!> <li class="go-cart-item-sum"> </li></ul></article>`);
16888
16953
  function Item$1($$anchor, $$props) {
16889
16954
  push($$props, true);
16890
- let cartItem = prop($$props, "cartItem", 7), cart = prop($$props, "cart", 7), preview = prop($$props, "preview", 7);
16955
+ let displayItem = prop($$props, "displayItem", 7), displayCart = prop($$props, "displayCart", 7), mainCart = prop($$props, "mainCart", 7), preview = prop($$props, "preview", 7);
16891
16956
  let capacity = /* @__PURE__ */ state(void 0);
16957
+ const itemInMaincart = /* @__PURE__ */ user_derived(() => mainCart().items.find((item) => item.uuid === displayItem().display?.reference_uuid));
16892
16958
  const emptyCart = createCart();
16893
16959
  user_effect(() => {
16894
- cart().items.map((i) => i.quantity);
16960
+ mainCart().items.map((i) => i.quantity);
16895
16961
  untrack(() => {
16896
- set(capacity, shop.capacityManager.capacity(cart(), cartItem(), emptyCart), true);
16962
+ set(capacity, shop.capacityManager.capacity(displayCart(), displayItem(), emptyCart), true);
16897
16963
  });
16898
16964
  });
16899
- function update(ci, target) {
16965
+ function update(target) {
16900
16966
  const el = target;
16901
- ci.quantity = parseInt(el.value);
16967
+ if (!get$2(itemInMaincart)) {
16968
+ console.error("(CartItem) Could not find main item for line", displayItem());
16969
+ return;
16970
+ }
16971
+ const nextLineQuantity = parseInt(el.value, 10);
16972
+ get$2(itemInMaincart).quantity = Math.max(0, get$2(itemInMaincart).quantity - displayItem().quantity + nextLineQuantity);
16973
+ }
16974
+ function del() {
16975
+ if (!get$2(itemInMaincart)) {
16976
+ console.error("(CartItem) Could not find main item for line", displayItem());
16977
+ return;
16978
+ }
16979
+ const newQuantity = Math.max(0, get$2(itemInMaincart).quantity - displayItem().quantity);
16980
+ if (newQuantity === 0) {
16981
+ mainCart().deleteItem(get$2(itemInMaincart));
16982
+ } else {
16983
+ get$2(itemInMaincart).quantity = newQuantity;
16984
+ }
16902
16985
  }
16903
16986
  var $$exports = {
16904
- get cartItem() {
16905
- return cartItem();
16987
+ get displayItem() {
16988
+ return displayItem();
16906
16989
  },
16907
- set cartItem($$value) {
16908
- cartItem($$value);
16990
+ set displayItem($$value) {
16991
+ displayItem($$value);
16909
16992
  flushSync();
16910
16993
  },
16911
- get cart() {
16912
- return cart();
16994
+ get displayCart() {
16995
+ return displayCart();
16913
16996
  },
16914
- set cart($$value) {
16915
- cart($$value);
16997
+ set displayCart($$value) {
16998
+ displayCart($$value);
16999
+ flushSync();
17000
+ },
17001
+ get mainCart() {
17002
+ return mainCart();
17003
+ },
17004
+ set mainCart($$value) {
17005
+ mainCart($$value);
16916
17006
  flushSync();
16917
17007
  },
16918
17008
  get preview() {
@@ -16926,7 +17016,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16926
17016
  var fragment = comment();
16927
17017
  var node = first_child(fragment);
16928
17018
  {
16929
- var consequent_4 = ($$anchor2) => {
17019
+ var consequent_5 = ($$anchor2) => {
16930
17020
  var article = root_1$i();
16931
17021
  var ul = child(article);
16932
17022
  var li = child(ul);
@@ -16935,7 +17025,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16935
17025
  var consequent = ($$anchor3) => {
16936
17026
  Ticket($$anchor3, {
16937
17027
  get cartItem() {
16938
- return cartItem();
17028
+ return displayItem();
16939
17029
  }
16940
17030
  });
16941
17031
  };
@@ -16946,14 +17036,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16946
17036
  var consequent_1 = ($$anchor4) => {
16947
17037
  Event$2($$anchor4, {
16948
17038
  get cartItem() {
16949
- return cartItem();
17039
+ return displayItem();
16950
17040
  }
16951
17041
  });
16952
17042
  };
16953
17043
  if_block(
16954
17044
  node_2,
16955
17045
  ($$render) => {
16956
- if (cartItem().product.product_type === "Event") $$render(consequent_1);
17046
+ if (displayItem().product.product_type === "Event") $$render(consequent_1);
16957
17047
  },
16958
17048
  true
16959
17049
  );
@@ -16961,35 +17051,68 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16961
17051
  append($$anchor3, fragment_2);
16962
17052
  };
16963
17053
  if_block(node_1, ($$render) => {
16964
- if (cartItem().product.product_type === "Ticket") $$render(consequent);
17054
+ if (displayItem().product.product_type === "Ticket") $$render(consequent);
16965
17055
  else $$render(alternate, false);
16966
17056
  });
16967
17057
  }
16968
17058
  reset(li);
16969
17059
  var li_1 = sibling(li, 2);
16970
- var text2 = child(li_1, true);
16971
- reset(li_1);
16972
- var li_2 = sibling(li_1, 2);
16973
- var node_3 = child(li_2);
17060
+ var node_3 = child(li_1);
16974
17061
  {
16975
17062
  var consequent_2 = ($$anchor3) => {
16976
- var span = root_5$1();
17063
+ var fragment_4 = root_5$2();
17064
+ var s = first_child(fragment_4);
17065
+ var text2 = child(s, true);
17066
+ reset(s);
17067
+ var span = sibling(s, 2);
16977
17068
  var text_1 = child(span, true);
16978
17069
  reset(span);
16979
- template_effect(() => set_text(text_1, cartItem().quantity));
16980
- append($$anchor3, span);
17070
+ template_effect(
17071
+ ($0, $1) => {
17072
+ set_text(text2, $0);
17073
+ set_text(text_1, $1);
17074
+ },
17075
+ [
17076
+ () => formatCurrency(displayItem().display.originalPrice),
17077
+ () => formatCurrency(displayItem().final_price_cents)
17078
+ ]
17079
+ );
17080
+ append($$anchor3, fragment_4);
16981
17081
  };
16982
17082
  var alternate_1 = ($$anchor3) => {
16983
- var select = root_6$2();
16984
- select.__change = (e) => update(cartItem(), e.target);
17083
+ var span_1 = root_6$3();
17084
+ var text_2 = child(span_1, true);
17085
+ reset(span_1);
17086
+ template_effect(($0) => set_text(text_2, $0), [() => formatCurrency(displayItem().final_price_cents)]);
17087
+ append($$anchor3, span_1);
17088
+ };
17089
+ if_block(node_3, ($$render) => {
17090
+ if (displayItem().display?.discounted) $$render(consequent_2);
17091
+ else $$render(alternate_1, false);
17092
+ });
17093
+ }
17094
+ reset(li_1);
17095
+ var li_2 = sibling(li_1, 2);
17096
+ var node_4 = child(li_2);
17097
+ {
17098
+ var consequent_3 = ($$anchor3) => {
17099
+ var span_2 = root_7$4();
17100
+ var text_3 = child(span_2, true);
17101
+ reset(span_2);
17102
+ template_effect(() => set_text(text_3, displayItem().quantity));
17103
+ append($$anchor3, span_2);
17104
+ };
17105
+ var alternate_2 = ($$anchor3) => {
17106
+ var select = root_8$2();
17107
+ select.__change = (e) => update(e.target);
16985
17108
  each(select, 21, () => generateQuantityOptions(get$2(capacity).min, get$2(capacity).max, { floor: 1 }), (q) => q.value, ($$anchor4, q) => {
16986
- var option2 = root_7$3();
16987
- var text_2 = child(option2, true);
17109
+ var option2 = root_9$4();
17110
+ var text_4 = child(option2, true);
16988
17111
  reset(option2);
16989
17112
  var option_value = {};
16990
17113
  template_effect(() => {
16991
- set_selected(option2, cartItem().quantity === get$2(q).value);
16992
- set_text(text_2, get$2(q).label);
17114
+ set_selected(option2, displayItem().quantity === get$2(q).value);
17115
+ set_text(text_4, get$2(q).label);
16993
17116
  if (option_value !== (option_value = get$2(q).value)) {
16994
17117
  option2.value = (option2.__value = get$2(q).value) ?? "";
16995
17118
  }
@@ -16997,56 +17120,143 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16997
17120
  append($$anchor4, option2);
16998
17121
  });
16999
17122
  reset(select);
17123
+ template_effect(($0) => set_attribute(select, "aria-label", $0), [() => shop.t("cart.content.table.edit")]);
17000
17124
  append($$anchor3, select);
17001
17125
  };
17002
- if_block(node_3, ($$render) => {
17003
- if (preview()) $$render(consequent_2);
17004
- else $$render(alternate_1, false);
17126
+ if_block(node_4, ($$render) => {
17127
+ if (preview()) $$render(consequent_3);
17128
+ else $$render(alternate_2, false);
17005
17129
  });
17006
17130
  }
17007
17131
  reset(li_2);
17008
- var node_4 = sibling(li_2, 2);
17132
+ var node_5 = sibling(li_2, 2);
17009
17133
  {
17010
- var consequent_3 = ($$anchor3) => {
17011
- var li_3 = root_8$2();
17134
+ var consequent_4 = ($$anchor3) => {
17135
+ var li_3 = root_10$2();
17012
17136
  var button = child(li_3);
17013
- button.__click = () => cart().deleteItem(cartItem());
17137
+ button.__click = del;
17014
17138
  reset(li_3);
17015
17139
  append($$anchor3, li_3);
17016
17140
  };
17017
- if_block(node_4, ($$render) => {
17018
- if (!preview()) $$render(consequent_3);
17141
+ if_block(node_5, ($$render) => {
17142
+ if (!preview()) $$render(consequent_4);
17019
17143
  });
17020
17144
  }
17021
- var li_4 = sibling(node_4, 2);
17022
- var text_3 = child(li_4, true);
17145
+ var li_4 = sibling(node_5, 2);
17146
+ var text_5 = child(li_4, true);
17023
17147
  reset(li_4);
17024
17148
  reset(ul);
17025
17149
  reset(article);
17026
- template_effect(() => {
17027
- set_attribute(article, "data-testid", cartItem().uuid);
17028
- set_text(text2, cartItem().final_price_formatted);
17029
- set_text(text_3, cartItem().total_price_formatted);
17030
- });
17150
+ template_effect(($0) => set_text(text_5, $0), [() => formatCurrency(displayItem().total_price_cents)]);
17031
17151
  append($$anchor2, article);
17032
17152
  };
17033
17153
  if_block(node, ($$render) => {
17034
- if (get$2(capacity)) $$render(consequent_4);
17154
+ if (get$2(capacity)) $$render(consequent_5);
17035
17155
  });
17036
17156
  }
17037
17157
  append($$anchor, fragment);
17038
17158
  return pop($$exports);
17039
17159
  }
17040
17160
  delegate(["change", "click"]);
17041
- create_custom_element(Item$1, { cartItem: {}, cart: {}, preview: {} }, [], [], { mode: "open" });
17042
- var root_2$p = /* @__PURE__ */ from_html(`<li class="go-cart-header-remove" data-go-cart-header-remove=""></li>`);
17043
- var root_3$8 = /* @__PURE__ */ from_html(`<li class="go-cart-item" data-go-cart-item=""><!></li>`);
17044
- var root_4$6 = /* @__PURE__ */ from_html(`<li class="go-cart-footer-remove" data-go-cart-footer-remove=""></li>`);
17045
- var root_1$h = /* @__PURE__ */ from_html(`<ol data-testid="cart"><li class="go-cart-header" data-go-cart-header="" data-testid="cart-header"><ul><li class="go-cart-header-title" data-go-cart-header-title=""> </li> <li class="go-cart-header-price" data-go-cart-header-price=""> </li> <li class="go-cart-header-count" data-go-cart-header-count=""> </li> <!> <li class="go-cart-header-sum" data-go-cart-header-sum=""> </li></ul></li> <!> <li class="go-cart-footer" data-go-cart-footer="" data-testid="cart-footer"><ul><li class="go-cart-footer-title" data-go-cart-footer-title=""></li> <li class="go-cart-footer-price" data-go-cart-footer-price=""></li> <li class="go-cart-footer-count" data-go-cart-footer-count=""></li> <!> <li class="go-cart-footer-sum" data-go-cart-footer-sum="" data-go-cart-sum=""> </li></ul></li></ol>`);
17161
+ create_custom_element(Item$1, { displayItem: {}, displayCart: {}, mainCart: {}, preview: {} }, [], [], { mode: "open" });
17162
+ function getQuantity(value, fallback) {
17163
+ if (typeof value === "number" && Number.isFinite(value)) return value;
17164
+ if (value && typeof value === "object") {
17165
+ const total = Object.values(value).reduce((sum2, num) => {
17166
+ return typeof num === "number" && Number.isFinite(num) ? sum2 + num : sum2;
17167
+ }, 0);
17168
+ if (total > 0) return total;
17169
+ }
17170
+ return fallback;
17171
+ }
17172
+ function createDisplayCart(baseCart, apiItems) {
17173
+ const displayCart = createCart();
17174
+ const appliedCoupons = /* @__PURE__ */ new Set();
17175
+ baseCart.coupons.forEach((coupon) => displayCart.addCoupon(coupon));
17176
+ apiItems.forEach((apiItem) => {
17177
+ const attrs = apiItem.attributes;
17178
+ const itemInBaseCart = baseCart.items.find(
17179
+ (i) => i.type.toLowerCase() === apiItem.type.toLowerCase() && i.product.id === attrs.id && (!attrs.time || i.time === attrs.time)
17180
+ );
17181
+ if (!itemInBaseCart) {
17182
+ console.error("(go-cart) Ignoring unmatched cart line", { type: apiItem.type, attrs });
17183
+ return [];
17184
+ }
17185
+ if (attrs.coupon) {
17186
+ displayCart.addCoupon(attrs.coupon);
17187
+ appliedCoupons.add(attrs.coupon);
17188
+ }
17189
+ displayCart.addItem(createDisplayCartItem(itemInBaseCart, attrs));
17190
+ });
17191
+ return { cart: displayCart, appliedCoupons };
17192
+ }
17193
+ function resolveApiQuantity(attrs) {
17194
+ const source2 = "quantity" in attrs && attrs.quantity !== void 0 ? attrs.quantity : attrs.quantities;
17195
+ return getQuantity(source2, 0);
17196
+ }
17197
+ function createDisplayCartItem(cartItem, attrs) {
17198
+ const quantity = resolveApiQuantity(attrs);
17199
+ const displayPrice = attrs.price_cents ?? cartItem.product.price_cents;
17200
+ const originalPrice = cartItem.product.price_cents;
17201
+ const discounted = displayPrice < originalPrice;
17202
+ const product = { ...cartItem.product, price_cents: displayPrice };
17203
+ return createCartItem(product, {
17204
+ quantity,
17205
+ time: cartItem.time,
17206
+ display: {
17207
+ discounted,
17208
+ reference_uuid: cartItem.uuid,
17209
+ originalPrice
17210
+ }
17211
+ });
17212
+ }
17213
+ var root_2$p = /* @__PURE__ */ from_html(`<li class="go-cart-header-remove"></li>`);
17214
+ var root_3$8 = /* @__PURE__ */ from_html(`<li class="go-cart-item"><!></li>`);
17215
+ var root_6$2 = /* @__PURE__ */ from_html(`<li class="go-cart-item-remove"><button>⨉</button></li>`);
17216
+ var root_5$1 = /* @__PURE__ */ from_html(`<li><article class="go-cart-item-content"><ul><li class="go-cart-item-title"> </li> <li class="go-cart-item-price"></li> <li class="go-cart-item-count"></li> <!> <li class="go-cart-item-sum"></li></ul></article></li>`);
17217
+ var root_7$3 = /* @__PURE__ */ from_html(`<li class="go-cart-footer-remove"></li>`);
17218
+ var root_1$h = /* @__PURE__ */ from_html(`<ol data-testid="cart"><li class="go-cart-header"><ul><li class="go-cart-header-title"> </li> <li class="go-cart-header-price"> </li> <li class="go-cart-header-count"> </li> <!> <li class="go-cart-header-sum"> </li></ul></li> <!> <!> <li class="go-cart-footer"><ul><li class="go-cart-footer-title"></li> <li class="go-cart-footer-price"></li> <li class="go-cart-footer-count"></li> <!> <li class="go-cart-footer-sum"> </li></ul></li></ol>`);
17046
17219
  function Cart($$anchor, $$props) {
17047
17220
  push($$props, true);
17048
17221
  const preview = prop($$props, "preview", 7, false);
17049
17222
  let cart = /* @__PURE__ */ user_derived(() => shop.cart);
17223
+ let displayCart = /* @__PURE__ */ state(proxy(get$2(cart)));
17224
+ let appliedCoupons = /* @__PURE__ */ state(proxy(/* @__PURE__ */ new Set()));
17225
+ let requestId = 0;
17226
+ const displayTotalCents = /* @__PURE__ */ user_derived(() => get$2(displayCart)?.totalPriceCents ?? 0);
17227
+ user_effect(() => {
17228
+ if (!get$2(cart)) {
17229
+ return;
17230
+ }
17231
+ get$2(cart).items.map((i) => i.uuid + ":" + i.quantity + ":" + i.time);
17232
+ get$2(cart).coupons.join("|");
17233
+ const currentRequest = ++requestId;
17234
+ if (get$2(cart).items.length === 0) {
17235
+ set(displayCart, get$2(cart), true);
17236
+ return;
17237
+ }
17238
+ (async () => {
17239
+ try {
17240
+ const { items, coupons } = get$2(cart).orderData();
17241
+ const response = await shop.createCart({ items, coupons });
17242
+ if (currentRequest !== requestId || !get$2(cart)) return;
17243
+ if (!response || "error" in response) {
17244
+ if (response && "error" in response) {
17245
+ console.error("(go-cart) Unable to fetch discounted cart data", response.error);
17246
+ }
17247
+ set(displayCart, get$2(cart), true);
17248
+ return;
17249
+ }
17250
+ const result = createDisplayCart(get$2(cart), response.data.items ?? []);
17251
+ set(displayCart, result.cart, true);
17252
+ set(appliedCoupons, result.appliedCoupons, true);
17253
+ } catch (error) {
17254
+ console.error("(go-cart) Unable to fetch discounted cart data", error);
17255
+ if (currentRequest !== requestId || !get$2(cart)) return;
17256
+ set(displayCart, get$2(cart), true);
17257
+ }
17258
+ })();
17259
+ });
17050
17260
  var $$exports = {
17051
17261
  get preview() {
17052
17262
  return preview();
@@ -17059,7 +17269,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17059
17269
  var fragment = comment();
17060
17270
  var node = first_child(fragment);
17061
17271
  {
17062
- var consequent_2 = ($$anchor2) => {
17272
+ var consequent_4 = ($$anchor2) => {
17063
17273
  var ol = root_1$h();
17064
17274
  var li = child(ol);
17065
17275
  var ul = child(li);
@@ -17088,14 +17298,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17088
17298
  reset(ul);
17089
17299
  reset(li);
17090
17300
  var node_2 = sibling(li, 2);
17091
- each(node_2, 17, () => get$2(cart).items, (cartItem) => cartItem.uuid, ($$anchor3, cartItem) => {
17301
+ each(node_2, 17, () => get$2(displayCart).items, (item) => item.uuid, ($$anchor3, item) => {
17092
17302
  var li_6 = root_3$8();
17093
17303
  var node_3 = child(li_6);
17094
17304
  Item$1(node_3, {
17095
- get cartItem() {
17096
- return get$2(cartItem);
17305
+ get displayItem() {
17306
+ return get$2(item);
17307
+ },
17308
+ get displayCart() {
17309
+ return get$2(displayCart);
17097
17310
  },
17098
- get cart() {
17311
+ get mainCart() {
17099
17312
  return get$2(cart);
17100
17313
  },
17101
17314
  get preview() {
@@ -17105,48 +17318,99 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17105
17318
  reset(li_6);
17106
17319
  append($$anchor3, li_6);
17107
17320
  });
17108
- var li_7 = sibling(node_2, 2);
17109
- var ul_1 = child(li_7);
17110
- var node_4 = sibling(child(ul_1), 6);
17321
+ var node_4 = sibling(node_2, 2);
17111
17322
  {
17112
- var consequent_1 = ($$anchor3) => {
17113
- var li_8 = root_4$6();
17114
- append($$anchor3, li_8);
17323
+ var consequent_2 = ($$anchor3) => {
17324
+ var fragment_1 = comment();
17325
+ var node_5 = first_child(fragment_1);
17326
+ each(node_5, 16, () => get$2(displayCart).coupons, (coupon) => coupon, ($$anchor4, coupon) => {
17327
+ var li_7 = root_5$1();
17328
+ let classes;
17329
+ var article = child(li_7);
17330
+ var ul_1 = child(article);
17331
+ var li_8 = child(ul_1);
17332
+ var text_4 = child(li_8, true);
17333
+ reset(li_8);
17334
+ var node_6 = sibling(li_8, 6);
17335
+ {
17336
+ var consequent_1 = ($$anchor5) => {
17337
+ var li_9 = root_6$2();
17338
+ var button = child(li_9);
17339
+ button.__click = () => get$2(cart)?.removeCoupon(coupon);
17340
+ reset(li_9);
17341
+ append($$anchor5, li_9);
17342
+ };
17343
+ if_block(node_6, ($$render) => {
17344
+ if (!preview()) $$render(consequent_1);
17345
+ });
17346
+ }
17347
+ next(2);
17348
+ reset(ul_1);
17349
+ reset(article);
17350
+ reset(li_7);
17351
+ template_effect(
17352
+ ($0) => {
17353
+ classes = set_class(li_7, 1, "go-cart-item", null, classes, $0);
17354
+ set_text(text_4, coupon);
17355
+ },
17356
+ [
17357
+ () => ({
17358
+ "go-cart-coupon-inactive": !get$2(appliedCoupons).has(coupon)
17359
+ })
17360
+ ]
17361
+ );
17362
+ append($$anchor4, li_7);
17363
+ });
17364
+ append($$anchor3, fragment_1);
17115
17365
  };
17116
17366
  if_block(node_4, ($$render) => {
17117
- if (!preview()) $$render(consequent_1);
17367
+ if (get$2(displayCart).coupons.length > 0) $$render(consequent_2);
17118
17368
  });
17119
17369
  }
17120
- var li_9 = sibling(node_4, 2);
17121
- var text_4 = child(li_9, true);
17122
- reset(li_9);
17123
- reset(ul_1);
17124
- reset(li_7);
17370
+ var li_10 = sibling(node_4, 2);
17371
+ var ul_2 = child(li_10);
17372
+ var node_7 = sibling(child(ul_2), 6);
17373
+ {
17374
+ var consequent_3 = ($$anchor3) => {
17375
+ var li_11 = root_7$3();
17376
+ append($$anchor3, li_11);
17377
+ };
17378
+ if_block(node_7, ($$render) => {
17379
+ if (!preview()) $$render(consequent_3);
17380
+ });
17381
+ }
17382
+ var li_12 = sibling(node_7, 2);
17383
+ var text_5 = child(li_12, true);
17384
+ reset(li_12);
17385
+ reset(ul_2);
17386
+ reset(li_10);
17125
17387
  reset(ol);
17126
17388
  template_effect(
17127
- ($0, $1, $2, $3) => {
17389
+ ($0, $1, $2, $3, $4) => {
17128
17390
  set_text(text2, $0);
17129
17391
  set_text(text_1, $1);
17130
17392
  set_text(text_2, $2);
17131
17393
  set_text(text_3, $3);
17132
- set_text(text_4, get$2(cart).totalFormatted);
17394
+ set_text(text_5, $4);
17133
17395
  },
17134
17396
  [
17135
17397
  () => shop.t("cart.content.table.desc"),
17136
17398
  () => shop.t("cart.content.table.price"),
17137
17399
  () => shop.t("cart.content.table.quantity"),
17138
- () => shop.t("cart.content.table.total")
17400
+ () => shop.t("cart.content.table.total"),
17401
+ () => formatCurrency(get$2(displayTotalCents))
17139
17402
  ]
17140
17403
  );
17141
17404
  append($$anchor2, ol);
17142
17405
  };
17143
17406
  if_block(node, ($$render) => {
17144
- if (get$2(cart) && get$2(cart).items.length) $$render(consequent_2);
17407
+ if (get$2(displayCart) && get$2(displayCart).items.length) $$render(consequent_4);
17145
17408
  });
17146
17409
  }
17147
17410
  append($$anchor, fragment);
17148
17411
  return pop($$exports);
17149
17412
  }
17413
+ delegate(["click"]);
17150
17414
  customElements.define("go-cart", create_custom_element(Cart, { preview: {} }, [], []));
17151
17415
  function CartEmpty($$anchor, $$props) {
17152
17416
  push($$props, true);
@@ -17176,7 +17440,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17176
17440
  { key: "lastName", required: true },
17177
17441
  { key: "email", required: true },
17178
17442
  { key: "confirmEmail", required: true },
17179
- { key: "acceptTerms", required: true }
17443
+ { key: "acceptTerms", required: true },
17444
+ { key: "paymentMode", required: true }
17180
17445
  ]
17181
17446
  });
17182
17447
  wrapInElement($$props.$$host, "go-form", { "form-id": "checkoutGuest", custom: custom2() });
@@ -17212,40 +17477,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17212
17477
  }
17213
17478
  customElements.define("go-checkout-form", create_custom_element(CheckoutForm, { custom: {} }, [], []));
17214
17479
  enable_legacy_mode_flag();
17215
- async function redeem(form) {
17216
- if (!form) {
17217
- throw new Error("(go-coupon-redemption): form not found");
17218
- }
17480
+ const APPLY_ORDER_DISCOUNT = "TokenActions::ApplyOrderDiscount";
17481
+ async function redeem(token) {
17219
17482
  if (!shop.cart) {
17220
17483
  throw new Error("(go-coupon-redemption): cart not found");
17221
17484
  }
17222
- const result = await shop.asyncFetch(() => shop.getCouponSaleByBarcode(form.details.formData.id));
17223
- if (result?.is_valid && result.is_voucher_for) {
17224
- const tickets = await shop.asyncFetch(
17225
- () => shop.tickets({
17226
- // @ts-ignore - api supports filter even if schema doesn't yet.
17227
- "by_ticket_ids[]": [result.is_voucher_for]
17228
- })
17229
- );
17230
- const ticket = tickets.find((t) => t.id === result.is_voucher_for);
17231
- if (!ticket) {
17232
- form.details.apiErrors ??= [];
17233
- form.details.apiErrors = [shop.t("cart.coupon.form.errors.error")];
17234
- return;
17235
- }
17236
- const voucherTicket = { ...ticket, price_cents: 0 };
17237
- shop.cart.addItem(createCartItem(createUITicket(voucherTicket), { quantity: 1 }));
17238
- const token = form.details.formData.id;
17485
+ const couponSale = await shop.asyncFetch(() => shop.getCouponSaleByBarcode(token));
17486
+ if (!couponSale?.is_valid) {
17487
+ return fail([shop.t("cart.coupon.form.errors.notValid")]);
17488
+ }
17489
+ if (couponSale.value_action === APPLY_ORDER_DISCOUNT) {
17239
17490
  shop.cart.addCoupon(token);
17240
- const tokenField = form.details.fields.find((f) => f.key === "token");
17241
- if (tokenField) {
17242
- tokenField.value = "";
17243
- form.dispatchEvent(new Event("go-success", { bubbles: true, composed: true }));
17244
- }
17491
+ return { success: true };
17492
+ } else if (couponSale.is_voucher_for) {
17493
+ return applyVoucher(token, couponSale);
17245
17494
  } else {
17246
- form.details.apiErrors ??= [];
17247
- form.details.apiErrors = [shop.t("cart.coupon.form.errors.notValid")];
17495
+ return fail([shop.t("cart.coupon.form.errors.notValid")]);
17496
+ }
17497
+ }
17498
+ async function applyVoucher(token, couponSale) {
17499
+ const tickets = await shop.asyncFetch(
17500
+ () => shop.tickets({
17501
+ // @ts-ignore - api supports filter even if schema doesn't yet.
17502
+ "by_ticket_ids[]": [couponSale.is_voucher_for]
17503
+ })
17504
+ );
17505
+ const ticket = tickets.find((t) => t.id === couponSale.is_voucher_for);
17506
+ if (!ticket) {
17507
+ return fail([shop.t("cart.coupon.form.errors.error")]);
17248
17508
  }
17509
+ const voucherTicket = { ...ticket, price_cents: 0 };
17510
+ shop.cart.addItem(createCartItem(createUITicket(voucherTicket), { quantity: 1 }));
17511
+ shop.cart.addCoupon(token);
17512
+ return { success: true };
17513
+ }
17514
+ function fail(errors2) {
17515
+ return { success: false, errors: errors2 };
17249
17516
  }
17250
17517
  var root$a = /* @__PURE__ */ from_html(`<go-form></go-form>`, 2);
17251
17518
  function CouponRedemption($$anchor, $$props) {
@@ -17255,8 +17522,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17255
17522
  submitLabel: "cart.coupon.form.submit",
17256
17523
  fields: [{ key: "token", required: true }]
17257
17524
  });
17258
- async function redeem$1(e) {
17259
- await redeem(e.target);
17525
+ async function redeem$1(event2) {
17526
+ const form = event2.target;
17527
+ const field = form.details.fields.find((f) => f.key === "token");
17528
+ const token = form.details.fieldValue("token").trim();
17529
+ const result = await redeem(token);
17530
+ if (!result.success) {
17531
+ form.details.apiErrors = result.errors;
17532
+ return;
17533
+ }
17534
+ field.value = "";
17535
+ form.dispatchEvent(new Event("go-success", { bubbles: true, composed: true }));
17260
17536
  }
17261
17537
  init();
17262
17538
  var go_form = root$a();
@@ -31157,11 +31433,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31157
31433
  var root_1$a = /* @__PURE__ */ from_html(` <!>`, 1);
31158
31434
  var root_3$6 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1);
31159
31435
  var root_4$3 = /* @__PURE__ */ from_html(`<label><input/> <span class="go-checkbox-label"><!></span></label>`);
31160
- var root_7$2 = /* @__PURE__ */ from_html(`<option> </option>`);
31436
+ var root_7$2 = /* @__PURE__ */ from_html(`<img src="" alt=""/> <option> </option>`, 1);
31161
31437
  var root_6$1 = /* @__PURE__ */ from_html(`<option disabled hidden="" selected> </option> <!>`, 1);
31438
+ var select_content = /* @__PURE__ */ from_html(`<!>`, 1);
31162
31439
  var root_5 = /* @__PURE__ */ from_html(`<label><!></label> <select><!></select>`, 1);
31163
- var root_11$2 = /* @__PURE__ */ from_html(`<label> <input/></label>`);
31164
- var root_9$1 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`);
31440
+ var root_12$1 = /* @__PURE__ */ from_html(`<img style="width: 60px" aria-hidden="true"/>`);
31441
+ var root_11$2 = /* @__PURE__ */ from_html(`<span class="go-payment-mode-icons"></span>`);
31442
+ var root_10$1 = /* @__PURE__ */ from_html(`<label><input type="radio"/> <!></label>`);
31443
+ var root_9$1 = /* @__PURE__ */ from_html(`<fieldset role="radiogroup"><legend><!></legend> <!></fieldset>`);
31444
+ var root_15 = /* @__PURE__ */ from_html(`<label> <input/></label>`);
31445
+ var root_13 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`);
31165
31446
  function InputAndLabel($$anchor, $$props) {
31166
31447
  push($$props, true);
31167
31448
  const labelText = ($$anchor2) => {
@@ -31262,36 +31543,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31262
31543
  name: field().key,
31263
31544
  class: inputClass()
31264
31545
  }));
31265
- var node_4 = child(select_1);
31266
- {
31267
- var consequent_1 = ($$anchor3) => {
31268
- var fragment_3 = root_6$1();
31269
- var option_1 = first_child(fragment_3);
31270
- var text_1 = child(option_1, true);
31271
- reset(option_1);
31272
- option_1.value = option_1.__value = "";
31273
- var node_5 = sibling(option_1, 2);
31274
- each(node_5, 17, () => field().options(), index$1, ($$anchor4, option2) => {
31275
- var option_2 = root_7$2();
31276
- var text_2 = child(option_2, true);
31277
- reset(option_2);
31278
- var option_2_value = {};
31279
- template_effect(() => {
31280
- set_text(text_2, get$2(option2).label);
31281
- if (option_2_value !== (option_2_value = get$2(option2).value)) {
31282
- option_2.value = (option_2.__value = get$2(option2).value) ?? "";
31283
- }
31546
+ customizable_select(select_1, () => {
31547
+ var anchor = child(select_1);
31548
+ var fragment_3 = select_content();
31549
+ var node_4 = first_child(fragment_3);
31550
+ {
31551
+ var consequent_1 = ($$anchor3) => {
31552
+ var fragment_4 = root_6$1();
31553
+ var option_1 = first_child(fragment_4);
31554
+ var text_1 = child(option_1, true);
31555
+ reset(option_1);
31556
+ option_1.value = option_1.__value = "";
31557
+ var node_5 = sibling(option_1, 2);
31558
+ each(node_5, 17, () => field().options(), (option2) => option2.value, ($$anchor4, option2) => {
31559
+ var fragment_5 = root_7$2();
31560
+ var option_2 = sibling(first_child(fragment_5), 2);
31561
+ var text_2 = child(option_2, true);
31562
+ reset(option_2);
31563
+ var option_2_value = {};
31564
+ template_effect(() => {
31565
+ set_text(text_2, get$2(option2).label);
31566
+ if (option_2_value !== (option_2_value = get$2(option2).value)) {
31567
+ option_2.value = (option_2.__value = get$2(option2).value) ?? "";
31568
+ }
31569
+ });
31570
+ append($$anchor4, fragment_5);
31284
31571
  });
31285
- append($$anchor4, option_2);
31572
+ template_effect(($0) => set_text(text_1, $0), [() => shop.t("common.choose")]);
31573
+ append($$anchor3, fragment_4);
31574
+ };
31575
+ if_block(node_4, ($$render) => {
31576
+ if (field().options) $$render(consequent_1);
31286
31577
  });
31287
- template_effect(($0) => set_text(text_1, $0), [() => shop.t("common.choose")]);
31288
- append($$anchor3, fragment_3);
31289
- };
31290
- if_block(node_4, ($$render) => {
31291
- if (field().options) $$render(consequent_1);
31292
- });
31293
- }
31294
- reset(select_1);
31578
+ }
31579
+ append(anchor, fragment_3);
31580
+ });
31295
31581
  template_effect(() => {
31296
31582
  set_class(label_3, 1, clsx(labelClass()));
31297
31583
  set_attribute(label_3, "for", get$2(inputId));
@@ -31318,23 +31604,83 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31318
31604
  }
31319
31605
  });
31320
31606
  };
31321
- const radio = ($$anchor2) => {
31607
+ const paymentMode = ($$anchor2) => {
31608
+ const modes = /* @__PURE__ */ user_derived(() => shop.payment_modes ? Object.values(shop.payment_modes) : []);
31322
31609
  var fieldset = root_9$1();
31323
31610
  var legend = child(fieldset);
31324
31611
  var node_6 = child(legend);
31325
31612
  labelText(node_6);
31326
31613
  reset(legend);
31327
31614
  var node_7 = sibling(legend, 2);
31615
+ each(node_7, 17, () => get$2(modes), (mode) => mode.id, ($$anchor3, mode) => {
31616
+ var label_4 = root_10$1();
31617
+ var input_3 = child(label_4);
31618
+ remove_input_defaults(input_3);
31619
+ input_3.__change = () => {
31620
+ field(field().value = String(get$2(mode).id), true);
31621
+ };
31622
+ var node_8 = sibling(input_3, 2);
31623
+ {
31624
+ var consequent_2 = ($$anchor4) => {
31625
+ var span_2 = root_11$2();
31626
+ each(span_2, 20, () => get$2(mode).icons, (icon) => icon, ($$anchor5, icon) => {
31627
+ const url = /* @__PURE__ */ user_derived(() => CDN_PATH + icon + ".svg");
31628
+ var img = root_12$1();
31629
+ template_effect(() => {
31630
+ set_class(img, 1, clsx(icon));
31631
+ set_attribute(img, "src", get$2(url));
31632
+ set_attribute(img, "alt", icon + " icon");
31633
+ });
31634
+ append($$anchor5, img);
31635
+ });
31636
+ reset(span_2);
31637
+ append($$anchor4, span_2);
31638
+ };
31639
+ if_block(node_8, ($$render) => {
31640
+ if (get$2(mode).icons.length > 0) $$render(consequent_2);
31641
+ });
31642
+ }
31643
+ reset(label_4);
31644
+ template_effect(
31645
+ ($0, $1, $2) => {
31646
+ set_attribute(input_3, "name", field().key);
31647
+ set_value(input_3, $0);
31648
+ set_checked(input_3, $1);
31649
+ set_attribute(input_3, "hidden", get$2(modes).length === 1);
31650
+ set_attribute(input_3, "aria-label", $2);
31651
+ },
31652
+ [
31653
+ () => String(get$2(mode).id),
31654
+ () => get$2(modes).length === 1 || String(get$2(mode).id) === String(field().value),
31655
+ () => shop.t(`cart.paymentMode.ariaLabel.${get$2(mode).name.toLowerCase()}`)
31656
+ ]
31657
+ );
31658
+ append($$anchor3, label_4);
31659
+ });
31660
+ reset(fieldset);
31661
+ template_effect(() => {
31662
+ set_attribute(fieldset, "aria-required", field().required);
31663
+ set_attribute(fieldset, "aria-invalid", field().errors.length > 0);
31664
+ });
31665
+ append($$anchor2, fieldset);
31666
+ };
31667
+ const radio = ($$anchor2) => {
31668
+ var fieldset_1 = root_13();
31669
+ var legend_1 = child(fieldset_1);
31670
+ var node_9 = child(legend_1);
31671
+ labelText(node_9);
31672
+ reset(legend_1);
31673
+ var node_10 = sibling(legend_1, 2);
31328
31674
  {
31329
- var consequent_2 = ($$anchor3) => {
31330
- var fragment_5 = comment();
31331
- var node_8 = first_child(fragment_5);
31332
- each(node_8, 17, () => field().options, index$1, ($$anchor4, option2) => {
31333
- var label_4 = root_11$2();
31334
- var text_3 = child(label_4);
31335
- var input_3 = sibling(text_3);
31675
+ var consequent_3 = ($$anchor3) => {
31676
+ var fragment_7 = comment();
31677
+ var node_11 = first_child(fragment_7);
31678
+ each(node_11, 17, () => field().options, index$1, ($$anchor4, option2) => {
31679
+ var label_5 = root_15();
31680
+ var text_3 = child(label_5);
31681
+ var input_4 = sibling(text_3);
31336
31682
  attribute_effect(
31337
- input_3,
31683
+ input_4,
31338
31684
  () => ({
31339
31685
  ...get$2(fieldAttributes),
31340
31686
  ...restProps,
@@ -31347,23 +31693,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31347
31693
  void 0,
31348
31694
  true
31349
31695
  );
31350
- reset(label_4);
31696
+ reset(label_5);
31351
31697
  template_effect(() => {
31352
- set_class(label_4, 1, clsx(labelClass()));
31353
- set_attribute(label_4, "for", get$2(inputId) + get$2(option2));
31698
+ set_class(label_5, 1, clsx(labelClass()));
31699
+ set_attribute(label_5, "for", get$2(inputId) + get$2(option2));
31354
31700
  set_text(text_3, `${get$2(option2) ?? ""} `);
31355
31701
  });
31356
- bind_value(input_3, () => field().value, ($$value) => field(field().value = $$value, true));
31357
- append($$anchor4, label_4);
31702
+ bind_value(input_4, () => field().value, ($$value) => field(field().value = $$value, true));
31703
+ append($$anchor4, label_5);
31358
31704
  });
31359
- append($$anchor3, fragment_5);
31705
+ append($$anchor3, fragment_7);
31360
31706
  };
31361
- if_block(node_7, ($$render) => {
31362
- if (field().options) $$render(consequent_2);
31707
+ if_block(node_10, ($$render) => {
31708
+ if (field().options) $$render(consequent_3);
31363
31709
  });
31364
31710
  }
31365
- reset(fieldset);
31366
- append($$anchor2, fieldset);
31711
+ reset(fieldset_1);
31712
+ append($$anchor2, fieldset_1);
31367
31713
  };
31368
31714
  let field = prop($$props, "field", 15), describedByIds = prop($$props, "describedByIds", 7), labelClass = prop($$props, "labelClass", 7), inputClass = prop($$props, "inputClass", 7), host = prop($$props, "host", 7), restProps = /* @__PURE__ */ rest_props($$props, [
31369
31715
  "$$slots",
@@ -31391,7 +31737,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31391
31737
  select,
31392
31738
  radio,
31393
31739
  date: date2,
31394
- textarea: null
31740
+ textarea: null,
31741
+ paymentMode
31395
31742
  };
31396
31743
  const snippet$1 = /* @__PURE__ */ user_derived(() => map[field().type]);
31397
31744
  let inputId = /* @__PURE__ */ user_derived(() => $$props.id || `go-field-${Math.random().toString(36).substring(2, 9)}`);
@@ -31410,6 +31757,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31410
31757
  onblur
31411
31758
  }));
31412
31759
  let label = /* @__PURE__ */ user_derived(() => shop.t(field().label) || field().label);
31760
+ const CDN_PATH = `https://cdn.shop.platform.gomus.de/`;
31413
31761
  var $$exports = {
31414
31762
  get field() {
31415
31763
  return field();
@@ -31447,22 +31795,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31447
31795
  flushSync();
31448
31796
  }
31449
31797
  };
31450
- var fragment_6 = comment();
31451
- var node_9 = first_child(fragment_6);
31798
+ var fragment_8 = comment();
31799
+ var node_12 = first_child(fragment_8);
31452
31800
  {
31453
- var consequent_3 = ($$anchor2) => {
31454
- var fragment_7 = comment();
31455
- var node_10 = first_child(fragment_7);
31456
- snippet(node_10, () => get$2(snippet$1));
31457
- append($$anchor2, fragment_7);
31801
+ var consequent_4 = ($$anchor2) => {
31802
+ var fragment_9 = comment();
31803
+ var node_13 = first_child(fragment_9);
31804
+ snippet(node_13, () => get$2(snippet$1));
31805
+ append($$anchor2, fragment_9);
31458
31806
  };
31459
- if_block(node_9, ($$render) => {
31460
- if (get$2(snippet$1)) $$render(consequent_3);
31807
+ if_block(node_12, ($$render) => {
31808
+ if (get$2(snippet$1)) $$render(consequent_4);
31461
31809
  });
31462
31810
  }
31463
- append($$anchor, fragment_6);
31811
+ append($$anchor, fragment_8);
31464
31812
  return pop($$exports);
31465
31813
  }
31814
+ delegate(["change"]);
31466
31815
  create_custom_element(
31467
31816
  InputAndLabel,
31468
31817
  {
@@ -33428,7 +33777,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
33428
33777
  }
33429
33778
  var root_1$3 = /* @__PURE__ */ from_html(`<span class="go-tickets-item-title-event-title"> </span> <span class="go-tickets-item-title-product-title"> </span>`, 1);
33430
33779
  var root_4 = /* @__PURE__ */ from_html(`<option> </option>`);
33431
- var root_3$1 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-tickets-item-title"><!></li> <li class="go-tickets-item-description" data-go-tickets-description=""><!></li> <li class="go-tickets-item-price" data-go-tickets-price=""> </li> <li class="go-tickets-item-quality" data-go-tickets-quality=""><select></select></li></ul></article></li>`);
33780
+ var root_3$1 = /* @__PURE__ */ from_html(`<li><article><ul><li class="go-tickets-item-title"><!></li> <li class="go-tickets-item-description" data-go-tickets-description=""><!></li> <li class="go-tickets-item-price" data-go-tickets-price=""> </li> <li class="go-tickets-item-quality" data-go-tickets-quality=""><select class="go-tickets-item-select"></select></li></ul></article></li>`);
33432
33781
  function Item($$anchor, $$props) {
33433
33782
  push($$props, true);
33434
33783
  const scaled_title = ($$anchor2) => {
@@ -33525,14 +33874,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
33525
33874
  reset(ul);
33526
33875
  reset(article);
33527
33876
  reset(li);
33528
- template_effect(() => {
33529
- set_class(article, 1, clsx([
33530
- "go-tickets-item",
33531
- get$2(capacity).bookedOut && "is-booked-out"
33532
- ]));
33533
- set_attribute(article, "data-testid", item().uuid);
33534
- set_text(text_3, item().price_formatted);
33535
- });
33877
+ template_effect(
33878
+ ($0) => {
33879
+ set_class(article, 1, clsx([
33880
+ "go-tickets-item",
33881
+ get$2(capacity).bookedOut && "is-booked-out"
33882
+ ]));
33883
+ set_attribute(article, "data-testid", item().uuid);
33884
+ set_text(text_3, item().price_formatted);
33885
+ set_attribute(select, "aria-label", $0);
33886
+ },
33887
+ [() => shop.t("cart.content.table.edit")]
33888
+ );
33536
33889
  append($$anchor2, li);
33537
33890
  };
33538
33891
  if_block(node, ($$render) => {
@@ -34088,7 +34441,6 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
34088
34441
  }
34089
34442
  });
34090
34443
  $$props.$$host.addEventListener("go-date-select", (e) => {
34091
- console.log("calendar selected date", e.detail.selected);
34092
34444
  if (get$2(ticketSelectionDetails)) {
34093
34445
  get$2(ticketSelectionDetails).selectedDate = e.detail.selected;
34094
34446
  get$2(ticketSelectionDetails).selectedTimeslot = void 0;