@gomusdev/web-components 1.51.1 → 1.52.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.
@@ -1,6 +1,6 @@
1
1
  import { FullAutoFill } from 'svelte/elements';
2
2
  import { ZodType } from 'zod';
3
- export type FieldType = 'input' | 'text' | 'email' | 'password' | 'search' | 'tel' | 'url' | 'number' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'date';
3
+ export type FieldType = 'input' | 'text' | 'email' | 'password' | 'search' | 'tel' | 'url' | 'number' | 'checkbox' | 'select' | 'radio' | 'textarea' | 'date' | 'paymentMode';
4
4
  export interface Field {
5
5
  key: string;
6
6
  apiKey?: string;
@@ -7,6 +7,7 @@ export declare class SegmentDetails {
7
7
  coupons: string[];
8
8
  contingent: number;
9
9
  uid: string;
10
+ paymentModeId: string | undefined;
10
11
  readonly nonEmptyItems: import('../../../../../../lib/models/cart/types').CartItem[];
11
12
  readonly totalPriceCents: number;
12
13
  readonly totalQuantity: number;
@@ -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) => {
@@ -11306,12 +11347,19 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11306
11347
  function createCart(products, contingent = 20) {
11307
11348
  const items = proxy([]);
11308
11349
  const coupons = proxy([]);
11350
+ let paymentModeId = /* @__PURE__ */ state(void 0);
11309
11351
  const cart = {
11310
11352
  items,
11311
11353
  coupons,
11312
11354
  contingent,
11313
11355
  // caps the total number of items in the cart
11314
11356
  uid: `cart-${lastUuid++}`,
11357
+ get paymentModeId() {
11358
+ return get$2(paymentModeId);
11359
+ },
11360
+ set paymentModeId(value) {
11361
+ set(paymentModeId, value, true);
11362
+ },
11315
11363
  get nonEmptyItems() {
11316
11364
  return this.items.filter((i) => i.quantity > 0);
11317
11365
  },
@@ -11333,7 +11381,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
11333
11381
  shipping_address_id: null,
11334
11382
  comment: null,
11335
11383
  reference: null,
11336
- payment_mode_id: shop.settings?.defaultPaymentModeId,
11384
+ payment_mode_id: this.paymentModeId ?? shop.settings?.defaultPaymentModeId,
11337
11385
  coupons: this.coupons,
11338
11386
  donations: [],
11339
11387
  affiliate: {},
@@ -16153,6 +16201,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16153
16201
  placeholder: "",
16154
16202
  description: "",
16155
16203
  autocomplete: "off"
16204
+ },
16205
+ paymentMode: {
16206
+ key: "paymentMode",
16207
+ apiKey: "payment_mode_id",
16208
+ type: "paymentMode",
16209
+ label: "cart.paymentMode.label",
16210
+ placeholder: "",
16211
+ description: "",
16212
+ autocomplete: "off",
16213
+ options: () => {
16214
+ const modes = shop.payment_modes ? Object.values(shop.payment_modes) : [];
16215
+ return modes.map((m) => ({ value: String(m.id), label: m.name }));
16216
+ }
16156
16217
  }
16157
16218
  };
16158
16219
  function createField(data, required) {
@@ -17176,7 +17237,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
17176
17237
  { key: "lastName", required: true },
17177
17238
  { key: "email", required: true },
17178
17239
  { key: "confirmEmail", required: true },
17179
- { key: "acceptTerms", required: true }
17240
+ { key: "acceptTerms", required: true },
17241
+ { key: "paymentMode", required: true }
17180
17242
  ]
17181
17243
  });
17182
17244
  wrapInElement($$props.$$host, "go-form", { "form-id": "checkoutGuest", custom: custom2() });
@@ -31157,11 +31219,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31157
31219
  var root_1$a = /* @__PURE__ */ from_html(` <!>`, 1);
31158
31220
  var root_3$6 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1);
31159
31221
  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>`);
31222
+ var root_7$2 = /* @__PURE__ */ from_html(`<img src="" alt=""/> <option> </option>`, 1);
31161
31223
  var root_6$1 = /* @__PURE__ */ from_html(`<option disabled hidden="" selected> </option> <!>`, 1);
31224
+ var select_content = /* @__PURE__ */ from_html(`<!>`, 1);
31162
31225
  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>`);
31226
+ var root_12$1 = /* @__PURE__ */ from_html(`<img style="width: 60px" aria-hidden="true"/>`);
31227
+ var root_11$2 = /* @__PURE__ */ from_html(`<span class="go-payment-mode-icons"></span>`);
31228
+ var root_10$1 = /* @__PURE__ */ from_html(`<label><input type="radio"/> <!></label>`);
31229
+ var root_9$1 = /* @__PURE__ */ from_html(`<fieldset role="radiogroup"><legend><!></legend> <!></fieldset>`);
31230
+ var root_15 = /* @__PURE__ */ from_html(`<label> <input/></label>`);
31231
+ var root_13 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`);
31165
31232
  function InputAndLabel($$anchor, $$props) {
31166
31233
  push($$props, true);
31167
31234
  const labelText = ($$anchor2) => {
@@ -31262,36 +31329,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31262
31329
  name: field().key,
31263
31330
  class: inputClass()
31264
31331
  }));
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
- }
31332
+ customizable_select(select_1, () => {
31333
+ var anchor = child(select_1);
31334
+ var fragment_3 = select_content();
31335
+ var node_4 = first_child(fragment_3);
31336
+ {
31337
+ var consequent_1 = ($$anchor3) => {
31338
+ var fragment_4 = root_6$1();
31339
+ var option_1 = first_child(fragment_4);
31340
+ var text_1 = child(option_1, true);
31341
+ reset(option_1);
31342
+ option_1.value = option_1.__value = "";
31343
+ var node_5 = sibling(option_1, 2);
31344
+ each(node_5, 17, () => field().options(), (option2) => option2.value, ($$anchor4, option2) => {
31345
+ var fragment_5 = root_7$2();
31346
+ var option_2 = sibling(first_child(fragment_5), 2);
31347
+ var text_2 = child(option_2, true);
31348
+ reset(option_2);
31349
+ var option_2_value = {};
31350
+ template_effect(() => {
31351
+ set_text(text_2, get$2(option2).label);
31352
+ if (option_2_value !== (option_2_value = get$2(option2).value)) {
31353
+ option_2.value = (option_2.__value = get$2(option2).value) ?? "";
31354
+ }
31355
+ });
31356
+ append($$anchor4, fragment_5);
31284
31357
  });
31285
- append($$anchor4, option_2);
31358
+ template_effect(($0) => set_text(text_1, $0), [() => shop.t("common.choose")]);
31359
+ append($$anchor3, fragment_4);
31360
+ };
31361
+ if_block(node_4, ($$render) => {
31362
+ if (field().options) $$render(consequent_1);
31286
31363
  });
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);
31364
+ }
31365
+ append(anchor, fragment_3);
31366
+ });
31295
31367
  template_effect(() => {
31296
31368
  set_class(label_3, 1, clsx(labelClass()));
31297
31369
  set_attribute(label_3, "for", get$2(inputId));
@@ -31318,23 +31390,83 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31318
31390
  }
31319
31391
  });
31320
31392
  };
31321
- const radio = ($$anchor2) => {
31393
+ const paymentMode = ($$anchor2) => {
31394
+ const modes = /* @__PURE__ */ user_derived(() => shop.payment_modes ? Object.values(shop.payment_modes) : []);
31322
31395
  var fieldset = root_9$1();
31323
31396
  var legend = child(fieldset);
31324
31397
  var node_6 = child(legend);
31325
31398
  labelText(node_6);
31326
31399
  reset(legend);
31327
31400
  var node_7 = sibling(legend, 2);
31401
+ each(node_7, 17, () => get$2(modes), (mode) => mode.id, ($$anchor3, mode) => {
31402
+ var label_4 = root_10$1();
31403
+ var input_3 = child(label_4);
31404
+ remove_input_defaults(input_3);
31405
+ input_3.__change = () => {
31406
+ field(field().value = String(get$2(mode).id), true);
31407
+ };
31408
+ var node_8 = sibling(input_3, 2);
31409
+ {
31410
+ var consequent_2 = ($$anchor4) => {
31411
+ var span_2 = root_11$2();
31412
+ each(span_2, 20, () => get$2(mode).icons, (icon) => icon, ($$anchor5, icon) => {
31413
+ const url = /* @__PURE__ */ user_derived(() => CDN_PATH + icon + ".svg");
31414
+ var img = root_12$1();
31415
+ template_effect(() => {
31416
+ set_class(img, 1, clsx(icon));
31417
+ set_attribute(img, "src", get$2(url));
31418
+ set_attribute(img, "alt", icon + " icon");
31419
+ });
31420
+ append($$anchor5, img);
31421
+ });
31422
+ reset(span_2);
31423
+ append($$anchor4, span_2);
31424
+ };
31425
+ if_block(node_8, ($$render) => {
31426
+ if (get$2(mode).icons.length > 0) $$render(consequent_2);
31427
+ });
31428
+ }
31429
+ reset(label_4);
31430
+ template_effect(
31431
+ ($0, $1, $2) => {
31432
+ set_attribute(input_3, "name", field().key);
31433
+ set_value(input_3, $0);
31434
+ set_checked(input_3, $1);
31435
+ set_attribute(input_3, "hidden", get$2(modes).length === 1);
31436
+ set_attribute(input_3, "aria-label", $2);
31437
+ },
31438
+ [
31439
+ () => String(get$2(mode).id),
31440
+ () => get$2(modes).length === 1 || String(get$2(mode).id) === String(field().value),
31441
+ () => shop.t(`cart.paymentMode.ariaLabel.${get$2(mode).name.toLowerCase()}`)
31442
+ ]
31443
+ );
31444
+ append($$anchor3, label_4);
31445
+ });
31446
+ reset(fieldset);
31447
+ template_effect(() => {
31448
+ set_attribute(fieldset, "aria-required", field().required);
31449
+ set_attribute(fieldset, "aria-invalid", field().errors.length > 0);
31450
+ });
31451
+ append($$anchor2, fieldset);
31452
+ };
31453
+ const radio = ($$anchor2) => {
31454
+ var fieldset_1 = root_13();
31455
+ var legend_1 = child(fieldset_1);
31456
+ var node_9 = child(legend_1);
31457
+ labelText(node_9);
31458
+ reset(legend_1);
31459
+ var node_10 = sibling(legend_1, 2);
31328
31460
  {
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);
31461
+ var consequent_3 = ($$anchor3) => {
31462
+ var fragment_7 = comment();
31463
+ var node_11 = first_child(fragment_7);
31464
+ each(node_11, 17, () => field().options, index$1, ($$anchor4, option2) => {
31465
+ var label_5 = root_15();
31466
+ var text_3 = child(label_5);
31467
+ var input_4 = sibling(text_3);
31336
31468
  attribute_effect(
31337
- input_3,
31469
+ input_4,
31338
31470
  () => ({
31339
31471
  ...get$2(fieldAttributes),
31340
31472
  ...restProps,
@@ -31347,23 +31479,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31347
31479
  void 0,
31348
31480
  true
31349
31481
  );
31350
- reset(label_4);
31482
+ reset(label_5);
31351
31483
  template_effect(() => {
31352
- set_class(label_4, 1, clsx(labelClass()));
31353
- set_attribute(label_4, "for", get$2(inputId) + get$2(option2));
31484
+ set_class(label_5, 1, clsx(labelClass()));
31485
+ set_attribute(label_5, "for", get$2(inputId) + get$2(option2));
31354
31486
  set_text(text_3, `${get$2(option2) ?? ""} `);
31355
31487
  });
31356
- bind_value(input_3, () => field().value, ($$value) => field(field().value = $$value, true));
31357
- append($$anchor4, label_4);
31488
+ bind_value(input_4, () => field().value, ($$value) => field(field().value = $$value, true));
31489
+ append($$anchor4, label_5);
31358
31490
  });
31359
- append($$anchor3, fragment_5);
31491
+ append($$anchor3, fragment_7);
31360
31492
  };
31361
- if_block(node_7, ($$render) => {
31362
- if (field().options) $$render(consequent_2);
31493
+ if_block(node_10, ($$render) => {
31494
+ if (field().options) $$render(consequent_3);
31363
31495
  });
31364
31496
  }
31365
- reset(fieldset);
31366
- append($$anchor2, fieldset);
31497
+ reset(fieldset_1);
31498
+ append($$anchor2, fieldset_1);
31367
31499
  };
31368
31500
  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
31501
  "$$slots",
@@ -31391,7 +31523,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31391
31523
  select,
31392
31524
  radio,
31393
31525
  date: date2,
31394
- textarea: null
31526
+ textarea: null,
31527
+ paymentMode
31395
31528
  };
31396
31529
  const snippet$1 = /* @__PURE__ */ user_derived(() => map[field().type]);
31397
31530
  let inputId = /* @__PURE__ */ user_derived(() => $$props.id || `go-field-${Math.random().toString(36).substring(2, 9)}`);
@@ -31410,6 +31543,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31410
31543
  onblur
31411
31544
  }));
31412
31545
  let label = /* @__PURE__ */ user_derived(() => shop.t(field().label) || field().label);
31546
+ const CDN_PATH = `https://cdn.shop.platform.gomus.de/`;
31413
31547
  var $$exports = {
31414
31548
  get field() {
31415
31549
  return field();
@@ -31447,22 +31581,23 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
31447
31581
  flushSync();
31448
31582
  }
31449
31583
  };
31450
- var fragment_6 = comment();
31451
- var node_9 = first_child(fragment_6);
31584
+ var fragment_8 = comment();
31585
+ var node_12 = first_child(fragment_8);
31452
31586
  {
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);
31587
+ var consequent_4 = ($$anchor2) => {
31588
+ var fragment_9 = comment();
31589
+ var node_13 = first_child(fragment_9);
31590
+ snippet(node_13, () => get$2(snippet$1));
31591
+ append($$anchor2, fragment_9);
31458
31592
  };
31459
- if_block(node_9, ($$render) => {
31460
- if (get$2(snippet$1)) $$render(consequent_3);
31593
+ if_block(node_12, ($$render) => {
31594
+ if (get$2(snippet$1)) $$render(consequent_4);
31461
31595
  });
31462
31596
  }
31463
- append($$anchor, fragment_6);
31597
+ append($$anchor, fragment_8);
31464
31598
  return pop($$exports);
31465
31599
  }
31600
+ delegate(["change"]);
31466
31601
  create_custom_element(
31467
31602
  InputAndLabel,
31468
31603
  {
@@ -2043,6 +2043,9 @@ function clear_text_content(node) {
2043
2043
  function should_defer_append() {
2044
2044
  return false;
2045
2045
  }
2046
+ function create_comment(data = "") {
2047
+ return document.createComment(data);
2048
+ }
2046
2049
  function autofocus(dom, value) {
2047
2050
  if (value) {
2048
2051
  const body = document.body;
@@ -4367,6 +4370,14 @@ function set_value(element, value) {
4367
4370
  }
4368
4371
  element.value = value ?? "";
4369
4372
  }
4373
+ function set_checked(element, checked) {
4374
+ var attributes = get_attributes(element);
4375
+ if (attributes.checked === (attributes.checked = // treat null and undefined the same for the initial value
4376
+ checked ?? void 0)) {
4377
+ return;
4378
+ }
4379
+ element.checked = checked;
4380
+ }
4370
4381
  function set_selected(element, selected) {
4371
4382
  if (selected) {
4372
4383
  if (!element.hasAttribute("selected")) {
@@ -4656,6 +4667,36 @@ function get_setters(element) {
4656
4667
  }
4657
4668
  return setters;
4658
4669
  }
4670
+ let supported = null;
4671
+ function is_supported() {
4672
+ if (supported === null) {
4673
+ var select = document.createElement("select");
4674
+ select.innerHTML = "<option><span>t</span></option>";
4675
+ supported = /** @type {Element} */
4676
+ select.firstChild?.firstChild?.nodeType === 1;
4677
+ }
4678
+ return supported;
4679
+ }
4680
+ function customizable_select(element, rich_fn) {
4681
+ var was_hydrating = hydrating;
4682
+ if (!is_supported()) {
4683
+ set_hydrating(false);
4684
+ element.textContent = "";
4685
+ element.append(create_comment(""));
4686
+ }
4687
+ try {
4688
+ rich_fn();
4689
+ } finally {
4690
+ if (was_hydrating) {
4691
+ if (hydrating) {
4692
+ reset(element);
4693
+ } else {
4694
+ set_hydrating(true);
4695
+ set_hydrate_node(element);
4696
+ }
4697
+ }
4698
+ }
4699
+ }
4659
4700
  function bind_value(input, get2, set2 = get2) {
4660
4701
  var batches2 = /* @__PURE__ */ new WeakSet();
4661
4702
  listen_to_event_and_reset_event(input, "input", async (is_reset) => {
@@ -11306,12 +11347,19 @@ let lastUuid = 0;
11306
11347
  function createCart(products, contingent = 20) {
11307
11348
  const items = proxy([]);
11308
11349
  const coupons = proxy([]);
11350
+ let paymentModeId = /* @__PURE__ */ state(void 0);
11309
11351
  const cart = {
11310
11352
  items,
11311
11353
  coupons,
11312
11354
  contingent,
11313
11355
  // caps the total number of items in the cart
11314
11356
  uid: `cart-${lastUuid++}`,
11357
+ get paymentModeId() {
11358
+ return get$2(paymentModeId);
11359
+ },
11360
+ set paymentModeId(value) {
11361
+ set(paymentModeId, value, true);
11362
+ },
11315
11363
  get nonEmptyItems() {
11316
11364
  return this.items.filter((i) => i.quantity > 0);
11317
11365
  },
@@ -11333,7 +11381,7 @@ function createCart(products, contingent = 20) {
11333
11381
  shipping_address_id: null,
11334
11382
  comment: null,
11335
11383
  reference: null,
11336
- payment_mode_id: shop.settings?.defaultPaymentModeId,
11384
+ payment_mode_id: this.paymentModeId ?? shop.settings?.defaultPaymentModeId,
11337
11385
  coupons: this.coupons,
11338
11386
  donations: [],
11339
11387
  affiliate: {},
@@ -16153,6 +16201,19 @@ var allFields = {
16153
16201
  placeholder: "",
16154
16202
  description: "",
16155
16203
  autocomplete: "off"
16204
+ },
16205
+ paymentMode: {
16206
+ key: "paymentMode",
16207
+ apiKey: "payment_mode_id",
16208
+ type: "paymentMode",
16209
+ label: "cart.paymentMode.label",
16210
+ placeholder: "",
16211
+ description: "",
16212
+ autocomplete: "off",
16213
+ options: () => {
16214
+ const modes = shop.payment_modes ? Object.values(shop.payment_modes) : [];
16215
+ return modes.map((m) => ({ value: String(m.id), label: m.name }));
16216
+ }
16156
16217
  }
16157
16218
  };
16158
16219
  function createField(data, required) {
@@ -17176,7 +17237,8 @@ function CheckoutForm($$anchor, $$props) {
17176
17237
  { key: "lastName", required: true },
17177
17238
  { key: "email", required: true },
17178
17239
  { key: "confirmEmail", required: true },
17179
- { key: "acceptTerms", required: true }
17240
+ { key: "acceptTerms", required: true },
17241
+ { key: "paymentMode", required: true }
17180
17242
  ]
17181
17243
  });
17182
17244
  wrapInElement($$props.$$host, "go-form", { "form-id": "checkoutGuest", custom: custom2() });
@@ -31157,11 +31219,16 @@ var root_2$6 = /* @__PURE__ */ from_html(`<span class="go-field-star" aria-hidde
31157
31219
  var root_1$a = /* @__PURE__ */ from_html(` <!>`, 1);
31158
31220
  var root_3$6 = /* @__PURE__ */ from_html(`<label><!></label> <input/>`, 1);
31159
31221
  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>`);
31222
+ var root_7$2 = /* @__PURE__ */ from_html(`<img src="" alt=""/> <option> </option>`, 1);
31161
31223
  var root_6$1 = /* @__PURE__ */ from_html(`<option disabled hidden="" selected> </option> <!>`, 1);
31224
+ var select_content = /* @__PURE__ */ from_html(`<!>`, 1);
31162
31225
  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>`);
31226
+ var root_12$1 = /* @__PURE__ */ from_html(`<img style="width: 60px" aria-hidden="true"/>`);
31227
+ var root_11$2 = /* @__PURE__ */ from_html(`<span class="go-payment-mode-icons"></span>`);
31228
+ var root_10$1 = /* @__PURE__ */ from_html(`<label><input type="radio"/> <!></label>`);
31229
+ var root_9$1 = /* @__PURE__ */ from_html(`<fieldset role="radiogroup"><legend><!></legend> <!></fieldset>`);
31230
+ var root_15 = /* @__PURE__ */ from_html(`<label> <input/></label>`);
31231
+ var root_13 = /* @__PURE__ */ from_html(`<fieldset><legend><!></legend> <!></fieldset>`);
31165
31232
  function InputAndLabel($$anchor, $$props) {
31166
31233
  push($$props, true);
31167
31234
  const labelText = ($$anchor2) => {
@@ -31262,36 +31329,41 @@ function InputAndLabel($$anchor, $$props) {
31262
31329
  name: field().key,
31263
31330
  class: inputClass()
31264
31331
  }));
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
- }
31332
+ customizable_select(select_1, () => {
31333
+ var anchor = child(select_1);
31334
+ var fragment_3 = select_content();
31335
+ var node_4 = first_child(fragment_3);
31336
+ {
31337
+ var consequent_1 = ($$anchor3) => {
31338
+ var fragment_4 = root_6$1();
31339
+ var option_1 = first_child(fragment_4);
31340
+ var text_1 = child(option_1, true);
31341
+ reset(option_1);
31342
+ option_1.value = option_1.__value = "";
31343
+ var node_5 = sibling(option_1, 2);
31344
+ each(node_5, 17, () => field().options(), (option2) => option2.value, ($$anchor4, option2) => {
31345
+ var fragment_5 = root_7$2();
31346
+ var option_2 = sibling(first_child(fragment_5), 2);
31347
+ var text_2 = child(option_2, true);
31348
+ reset(option_2);
31349
+ var option_2_value = {};
31350
+ template_effect(() => {
31351
+ set_text(text_2, get$2(option2).label);
31352
+ if (option_2_value !== (option_2_value = get$2(option2).value)) {
31353
+ option_2.value = (option_2.__value = get$2(option2).value) ?? "";
31354
+ }
31355
+ });
31356
+ append($$anchor4, fragment_5);
31284
31357
  });
31285
- append($$anchor4, option_2);
31358
+ template_effect(($0) => set_text(text_1, $0), [() => shop.t("common.choose")]);
31359
+ append($$anchor3, fragment_4);
31360
+ };
31361
+ if_block(node_4, ($$render) => {
31362
+ if (field().options) $$render(consequent_1);
31286
31363
  });
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);
31364
+ }
31365
+ append(anchor, fragment_3);
31366
+ });
31295
31367
  template_effect(() => {
31296
31368
  set_class(label_3, 1, clsx(labelClass()));
31297
31369
  set_attribute(label_3, "for", get$2(inputId));
@@ -31318,23 +31390,83 @@ function InputAndLabel($$anchor, $$props) {
31318
31390
  }
31319
31391
  });
31320
31392
  };
31321
- const radio = ($$anchor2) => {
31393
+ const paymentMode = ($$anchor2) => {
31394
+ const modes = /* @__PURE__ */ user_derived(() => shop.payment_modes ? Object.values(shop.payment_modes) : []);
31322
31395
  var fieldset = root_9$1();
31323
31396
  var legend = child(fieldset);
31324
31397
  var node_6 = child(legend);
31325
31398
  labelText(node_6);
31326
31399
  reset(legend);
31327
31400
  var node_7 = sibling(legend, 2);
31401
+ each(node_7, 17, () => get$2(modes), (mode) => mode.id, ($$anchor3, mode) => {
31402
+ var label_4 = root_10$1();
31403
+ var input_3 = child(label_4);
31404
+ remove_input_defaults(input_3);
31405
+ input_3.__change = () => {
31406
+ field(field().value = String(get$2(mode).id), true);
31407
+ };
31408
+ var node_8 = sibling(input_3, 2);
31409
+ {
31410
+ var consequent_2 = ($$anchor4) => {
31411
+ var span_2 = root_11$2();
31412
+ each(span_2, 20, () => get$2(mode).icons, (icon) => icon, ($$anchor5, icon) => {
31413
+ const url = /* @__PURE__ */ user_derived(() => CDN_PATH + icon + ".svg");
31414
+ var img = root_12$1();
31415
+ template_effect(() => {
31416
+ set_class(img, 1, clsx(icon));
31417
+ set_attribute(img, "src", get$2(url));
31418
+ set_attribute(img, "alt", icon + " icon");
31419
+ });
31420
+ append($$anchor5, img);
31421
+ });
31422
+ reset(span_2);
31423
+ append($$anchor4, span_2);
31424
+ };
31425
+ if_block(node_8, ($$render) => {
31426
+ if (get$2(mode).icons.length > 0) $$render(consequent_2);
31427
+ });
31428
+ }
31429
+ reset(label_4);
31430
+ template_effect(
31431
+ ($0, $1, $2) => {
31432
+ set_attribute(input_3, "name", field().key);
31433
+ set_value(input_3, $0);
31434
+ set_checked(input_3, $1);
31435
+ set_attribute(input_3, "hidden", get$2(modes).length === 1);
31436
+ set_attribute(input_3, "aria-label", $2);
31437
+ },
31438
+ [
31439
+ () => String(get$2(mode).id),
31440
+ () => get$2(modes).length === 1 || String(get$2(mode).id) === String(field().value),
31441
+ () => shop.t(`cart.paymentMode.ariaLabel.${get$2(mode).name.toLowerCase()}`)
31442
+ ]
31443
+ );
31444
+ append($$anchor3, label_4);
31445
+ });
31446
+ reset(fieldset);
31447
+ template_effect(() => {
31448
+ set_attribute(fieldset, "aria-required", field().required);
31449
+ set_attribute(fieldset, "aria-invalid", field().errors.length > 0);
31450
+ });
31451
+ append($$anchor2, fieldset);
31452
+ };
31453
+ const radio = ($$anchor2) => {
31454
+ var fieldset_1 = root_13();
31455
+ var legend_1 = child(fieldset_1);
31456
+ var node_9 = child(legend_1);
31457
+ labelText(node_9);
31458
+ reset(legend_1);
31459
+ var node_10 = sibling(legend_1, 2);
31328
31460
  {
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);
31461
+ var consequent_3 = ($$anchor3) => {
31462
+ var fragment_7 = comment();
31463
+ var node_11 = first_child(fragment_7);
31464
+ each(node_11, 17, () => field().options, index$1, ($$anchor4, option2) => {
31465
+ var label_5 = root_15();
31466
+ var text_3 = child(label_5);
31467
+ var input_4 = sibling(text_3);
31336
31468
  attribute_effect(
31337
- input_3,
31469
+ input_4,
31338
31470
  () => ({
31339
31471
  ...get$2(fieldAttributes),
31340
31472
  ...restProps,
@@ -31347,23 +31479,23 @@ function InputAndLabel($$anchor, $$props) {
31347
31479
  void 0,
31348
31480
  true
31349
31481
  );
31350
- reset(label_4);
31482
+ reset(label_5);
31351
31483
  template_effect(() => {
31352
- set_class(label_4, 1, clsx(labelClass()));
31353
- set_attribute(label_4, "for", get$2(inputId) + get$2(option2));
31484
+ set_class(label_5, 1, clsx(labelClass()));
31485
+ set_attribute(label_5, "for", get$2(inputId) + get$2(option2));
31354
31486
  set_text(text_3, `${get$2(option2) ?? ""} `);
31355
31487
  });
31356
- bind_value(input_3, () => field().value, ($$value) => field(field().value = $$value, true));
31357
- append($$anchor4, label_4);
31488
+ bind_value(input_4, () => field().value, ($$value) => field(field().value = $$value, true));
31489
+ append($$anchor4, label_5);
31358
31490
  });
31359
- append($$anchor3, fragment_5);
31491
+ append($$anchor3, fragment_7);
31360
31492
  };
31361
- if_block(node_7, ($$render) => {
31362
- if (field().options) $$render(consequent_2);
31493
+ if_block(node_10, ($$render) => {
31494
+ if (field().options) $$render(consequent_3);
31363
31495
  });
31364
31496
  }
31365
- reset(fieldset);
31366
- append($$anchor2, fieldset);
31497
+ reset(fieldset_1);
31498
+ append($$anchor2, fieldset_1);
31367
31499
  };
31368
31500
  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
31501
  "$$slots",
@@ -31391,7 +31523,8 @@ function InputAndLabel($$anchor, $$props) {
31391
31523
  select,
31392
31524
  radio,
31393
31525
  date: date2,
31394
- textarea: null
31526
+ textarea: null,
31527
+ paymentMode
31395
31528
  };
31396
31529
  const snippet$1 = /* @__PURE__ */ user_derived(() => map[field().type]);
31397
31530
  let inputId = /* @__PURE__ */ user_derived(() => $$props.id || `go-field-${Math.random().toString(36).substring(2, 9)}`);
@@ -31410,6 +31543,7 @@ function InputAndLabel($$anchor, $$props) {
31410
31543
  onblur
31411
31544
  }));
31412
31545
  let label = /* @__PURE__ */ user_derived(() => shop.t(field().label) || field().label);
31546
+ const CDN_PATH = `https://cdn.shop.platform.gomus.de/`;
31413
31547
  var $$exports = {
31414
31548
  get field() {
31415
31549
  return field();
@@ -31447,22 +31581,23 @@ function InputAndLabel($$anchor, $$props) {
31447
31581
  flushSync();
31448
31582
  }
31449
31583
  };
31450
- var fragment_6 = comment();
31451
- var node_9 = first_child(fragment_6);
31584
+ var fragment_8 = comment();
31585
+ var node_12 = first_child(fragment_8);
31452
31586
  {
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);
31587
+ var consequent_4 = ($$anchor2) => {
31588
+ var fragment_9 = comment();
31589
+ var node_13 = first_child(fragment_9);
31590
+ snippet(node_13, () => get$2(snippet$1));
31591
+ append($$anchor2, fragment_9);
31458
31592
  };
31459
- if_block(node_9, ($$render) => {
31460
- if (get$2(snippet$1)) $$render(consequent_3);
31593
+ if_block(node_12, ($$render) => {
31594
+ if (get$2(snippet$1)) $$render(consequent_4);
31461
31595
  });
31462
31596
  }
31463
- append($$anchor, fragment_6);
31597
+ append($$anchor, fragment_8);
31464
31598
  return pop($$exports);
31465
31599
  }
31600
+ delegate(["change"]);
31466
31601
  create_custom_element(
31467
31602
  InputAndLabel,
31468
31603
  {
@@ -5,6 +5,7 @@ export declare function createCart(products?: Product[], contingent?: number): {
5
5
  coupons: string[];
6
6
  contingent: number;
7
7
  uid: string;
8
+ paymentModeId: string | undefined;
8
9
  readonly nonEmptyItems: CartItem[];
9
10
  readonly totalPriceCents: number;
10
11
  readonly totalQuantity: number;
@@ -55,6 +56,7 @@ export declare function createMainCart(): {
55
56
  coupons: string[];
56
57
  contingent: number;
57
58
  uid: string;
59
+ paymentModeId: string | undefined;
58
60
  readonly nonEmptyItems: CartItem[];
59
61
  readonly totalPriceCents: number;
60
62
  readonly totalQuantity: number;
@@ -77,6 +77,7 @@ export declare class Shop {
77
77
  coupons: string[];
78
78
  contingent: number;
79
79
  uid: string;
80
+ paymentModeId: string | undefined;
80
81
  readonly nonEmptyItems: import('../models/cart/types').CartItem[];
81
82
  readonly totalPriceCents: number;
82
83
  readonly totalQuantity: number;
@@ -170,12 +171,10 @@ export declare class Shop {
170
171
  };
171
172
  };
172
173
  get payment_modes(): {
173
- [key: string]: {
174
- id: number;
175
- name: string;
176
- icons: string[];
177
- };
178
- };
174
+ id: number;
175
+ name: string;
176
+ icons: string[];
177
+ }[];
179
178
  get content(): {
180
179
  [key: string]: string;
181
180
  };
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "Giantmonkey GmbH"
5
5
  },
6
6
  "license": "MIT",
7
- "version": "1.51.1",
7
+ "version": "1.52.0",
8
8
  "type": "module",
9
9
  "main": "./dist-js/gomus-webcomponents.iife.js",
10
10
  "module": "./dist-js/gomus-webcomponents.iife.js",