@propeller-commerce/propeller-v2-vue-ui 0.3.33 → 0.3.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { h as createServices, H as isContact, J as isCustomer, M as ok, j as err, p as getAddresses, x as getDefaultInvoiceAddress, w as getDefaultDeliveryAddress, b as attributeNameMatches, q as getAttributeDisplayName, g as collectAttributeValues, l as filterProductsBySelections, k as extractAttributeValues, y as getLabel, z as getLanguageString, n as formatPrice, o as formatSurcharge, D as getProductImageUrl, E as getProductSku, v as getCountryName, B as getLocalizedValue, s as getClusterSku, r as getClusterImageUrl, c as buildClusterJsonLd, O as safeJsonStringify, d as buildItemListJsonLd, e as buildProductJsonLd } from "./index-BN8nyGRL.js";
2
2
  import { C, a, f, i, m, t, u, A, F, G, I, K, L, N, P, Q, R, S, T } from "./index-BN8nyGRL.js";
3
- import { u as useInfraProps, n as usePropellerDeps, a as PropellerScopeKey, j as _sfc_main$W, d as _sfc_main$X, e as _sfc_main$Y, m as usePropellerContext, h as _sfc_main$Z, i as _sfc_main$_, l as _sfc_main$$ } from "./ProductVideos.vue_vue_type_script_setup_true_lang-BSXOpWBD.js";
4
- import { _, b, c, f as f2, g, k, P as P2, p, t as t2, o, q } from "./ProductVideos.vue_vue_type_script_setup_true_lang-BSXOpWBD.js";
3
+ import { u as useInfraProps, n as usePropellerDeps, a as PropellerScopeKey, j as _sfc_main$W, d as _sfc_main$X, e as _sfc_main$Y, m as usePropellerContext, h as _sfc_main$Z, i as _sfc_main$_, l as _sfc_main$$ } from "./ProductVideos.vue_vue_type_script_setup_true_lang-Cb_g4zYe.js";
4
+ import { _, b, c, f as f2, g, k, P as P2, p, t as t2, o, q } from "./ProductVideos.vue_vue_type_script_setup_true_lang-Cb_g4zYe.js";
5
5
  import { provide, inject, ref, unref, computed, watch, markRaw, defineComponent, reactive, renderSlot, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, Fragment, createTextVNode, onMounted, onUnmounted, withModifiers, renderList, normalizeClass, createBlock, resolveDynamicComponent, withCtx, normalizeStyle, createVNode, createStaticVNode, withKeys, mergeProps, nextTick, createSlots, normalizeProps, guardReactiveProps } from "vue";
6
6
  import { YesNo, AddressType, CartService, CartStatus, CartAddressType, Gender, PurchaseRole, CrossupsellType, PaymentStatuses, OrderSearchFields, OrderItemClass, ProductSortField, ProductSearchableField, ProductStatus, SortOrder, AttributeType, OrderSortField, OrderType, BundleCondition } from "@propeller-commerce/propeller-sdk-v2";
7
7
  const ProductGridInjectionKey = /* @__PURE__ */ Symbol("propeller-product-grid");
@@ -3184,6 +3184,11 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
3184
3184
  function getLabel$1(key, fallback) {
3185
3185
  return getLabel(props.labels, key, fallback);
3186
3186
  }
3187
+ const noAccountParts = computed(() => {
3188
+ const tpl = getLabel$1("noAccount", "Don't have an account? {link}");
3189
+ const [before, after = ""] = tpl.split("{link}");
3190
+ return { before, after };
3191
+ });
3187
3192
  async function handleSubmit(e) {
3188
3193
  e.preventDefault();
3189
3194
  if (props.beforeLogin) {
@@ -3370,7 +3375,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
3370
3375
  }, toDisplayString(getLabel$1("forgotPassword", "Forgot Password?")), 1)
3371
3376
  ]) : createCommentVNode("", true),
3372
3377
  createElementVNode("div", _hoisted_20$n, [
3373
- createTextVNode(toDisplayString(getLabel$1("noAccount", "Don't have an account?")), 1),
3378
+ createTextVNode(toDisplayString(noAccountParts.value.before), 1),
3374
3379
  __props.displayRegisterLink !== false ? renderSlot(_ctx.$slots, "registerLink", {
3375
3380
  key: 0,
3376
3381
  onClick: (e) => __props.onRegisterClick?.(e),
@@ -3383,7 +3388,8 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
3383
3388
  if (__props.onRegisterClick) __props.onRegisterClick();
3384
3389
  })
3385
3390
  }, toDisplayString(getLabel$1("registerLink", "Register")), 1)
3386
- ]) : createCommentVNode("", true)
3391
+ ]) : createCommentVNode("", true),
3392
+ createTextVNode(toDisplayString(noAccountParts.value.after), 1)
3387
3393
  ])
3388
3394
  ])) : createCommentVNode("", true)
3389
3395
  ], 8, _hoisted_1$P);
@@ -4941,6 +4947,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
4941
4947
  enableDelete: { type: Boolean, default: true },
4942
4948
  enableSetDefault: { type: Boolean, default: true },
4943
4949
  showDefaultBadge: { type: Boolean, default: false },
4950
+ showTypeBadge: { type: Boolean },
4944
4951
  onEdit: {},
4945
4952
  afterEdit: {},
4946
4953
  onDelete: {},
@@ -5105,7 +5112,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
5105
5112
  "data-type": addr.value?.type || ""
5106
5113
  }, [
5107
5114
  createElementVNode("div", _hoisted_3$J, [
5108
- __props.addressType ? renderSlot(_ctx.$slots, "typeBadge", {
5115
+ __props.addressType && __props.showTypeBadge !== false ? renderSlot(_ctx.$slots, "typeBadge", {
5109
5116
  key: 0,
5110
5117
  address: addr.value,
5111
5118
  addressType: __props.addressType,
@@ -6926,6 +6933,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
6926
6933
  cartPageButton: { type: Boolean, default: true },
6927
6934
  onCartPageButtonClick: {},
6928
6935
  labels: {},
6936
+ cartItemLabels: {},
6929
6937
  user: {},
6930
6938
  companyId: {},
6931
6939
  onRequestQuoteClick: {},
@@ -7170,6 +7178,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
7170
7178
  language: __props.language,
7171
7179
  configuration: __props.configuration,
7172
7180
  companyId: __props.companyId,
7181
+ labels: __props.cartItemLabels,
7173
7182
  cardFrame: false,
7174
7183
  showDelete: false,
7175
7184
  readOnlyQuantity: true,
@@ -7207,7 +7216,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
7207
7216
  }, toDisplayString(name), 9, _hoisted_27$f)) : createCommentVNode("", true)
7208
7217
  ]),
7209
7218
  _: 1
7210
- }, 40, ["cartItem", "cartId", "graphqlClient", "user", "language", "configuration", "companyId", "onTitleClick", "includeTax"]);
7219
+ }, 40, ["cartItem", "cartId", "graphqlClient", "user", "language", "configuration", "companyId", "labels", "onTitleClick", "includeTax"]);
7211
7220
  }), 128)) : createCommentVNode("", true),
7212
7221
  (openBlock(), createBlock(resolveDynamicComponent(CartBonusItemsImpl.value), {
7213
7222
  cart: __props.cart,
@@ -7402,11 +7411,11 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
7402
7411
  const requestDate = computed(() => {
7403
7412
  const date = props.cart?.postageData?.requestDate;
7404
7413
  if (!date) return "";
7405
- try {
7406
- return new Date(date).toLocaleDateString();
7407
- } catch {
7408
- return date;
7409
- }
7414
+ const d = new Date(date);
7415
+ if (isNaN(d.getTime())) return date;
7416
+ const day = String(d.getDate()).padStart(2, "0");
7417
+ const month = String(d.getMonth() + 1).padStart(2, "0");
7418
+ return `${day}-${month}-${d.getFullYear()}`;
7410
7419
  });
7411
7420
  const isPurchaseDisabled = computed(() => {
7412
7421
  if (showTermsAndConditions.value && !termsAccepted.value) return true;
@@ -7416,6 +7425,11 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
7416
7425
  function getLabel$1(key, fallback) {
7417
7426
  return getLabel(props.labels, key, fallback);
7418
7427
  }
7428
+ const termsConsentParts = computed(() => {
7429
+ const tpl = getLabel$1("termsConsent", "I agree to the {link}");
7430
+ const [before, after = ""] = tpl.split("{link}");
7431
+ return { before, after };
7432
+ });
7419
7433
  function getCountryName$1(code) {
7420
7434
  return getCountryName(code, props.countries);
7421
7435
  }
@@ -7535,12 +7549,13 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
7535
7549
  onChange: _cache[2] || (_cache[2] = async (event) => handleTermsChange(event.target.checked))
7536
7550
  }, null, 40, _hoisted_30$c),
7537
7551
  createElementVNode("label", _hoisted_31$c, [
7538
- createTextVNode(toDisplayString(getLabel$1("termsPrefix", "I agree to the")), 1),
7552
+ createTextVNode(toDisplayString(termsConsentParts.value.before), 1),
7539
7553
  createElementVNode("a", {
7540
7554
  href: "#",
7541
7555
  class: "text-primary hover:underline font-medium",
7542
7556
  onClick: _cache[3] || (_cache[3] = async (event) => handleTermsLinkClick(event))
7543
- }, toDisplayString(getLabel$1("termsLink", "Terms and Conditions")), 1)
7557
+ }, toDisplayString(getLabel$1("termsLink", "Terms and Conditions")), 1),
7558
+ createTextVNode(toDisplayString(termsConsentParts.value.after), 1)
7544
7559
  ])
7545
7560
  ])) : createCommentVNode("", true),
7546
7561
  showPurchaseButton.value ? (openBlock(), createElementBlock("button", {
@@ -7593,7 +7608,8 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
7593
7608
  showPaymethodLogo: { type: Boolean, default: true },
7594
7609
  onPaymethodSelect: {},
7595
7610
  formatPrice: {},
7596
- labels: {}
7611
+ labels: {},
7612
+ paymethodLabels: {}
7597
7613
  },
7598
7614
  setup(__props) {
7599
7615
  const props = __props;
@@ -7636,6 +7652,10 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
7636
7652
  },
7637
7653
  { immediate: true }
7638
7654
  );
7655
+ function methodName(method) {
7656
+ const code = (method.code || "").toLowerCase();
7657
+ return props.paymethodLabels?.[code] || method.name || method.code || "";
7658
+ }
7639
7659
  function isOnAccountMethod(method) {
7640
7660
  const code = (method.code || "").toLowerCase();
7641
7661
  return code === "on_account" || code === "onaccount" || code === "on-account";
@@ -7675,10 +7695,10 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
7675
7695
  createElementVNode("img", {
7676
7696
  class: "propeller-cart-paymethods__method-logo max-h-10 max-w-[80%] w-auto object-contain",
7677
7697
  src: getLogoUrl(method),
7678
- alt: method.name || method.code
7698
+ alt: methodName(method)
7679
7699
  }, null, 8, _hoisted_5$x)
7680
7700
  ])) : createCommentVNode("", true),
7681
- createElementVNode("span", _hoisted_6$w, toDisplayString(method.name || method.code), 1)
7701
+ createElementVNode("span", _hoisted_6$w, toDisplayString(methodName(method)), 1)
7682
7702
  ], 10, _hoisted_2$C);
7683
7703
  }), 128))
7684
7704
  ])) : createCommentVNode("", true),
@@ -11344,10 +11364,11 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
11344
11364
  if (props.formatDate) return props.formatDate(dateString);
11345
11365
  if (!dateString) return "-";
11346
11366
  const d = new Date(dateString);
11367
+ if (isNaN(d.getTime())) return dateString;
11347
11368
  const day = String(d.getDate()).padStart(2, "0");
11348
11369
  const month = String(d.getMonth() + 1).padStart(2, "0");
11349
11370
  const year = d.getFullYear();
11350
- return `${day}/${month}/${year}`;
11371
+ return `${day}-${month}-${year}`;
11351
11372
  }
11352
11373
  function getProductCount(list) {
11353
11374
  const products = list.products;
@@ -11369,6 +11390,11 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
11369
11390
  function getLabel$1(key, fallback) {
11370
11391
  return getLabel(props.labels, key, fallback);
11371
11392
  }
11393
+ const deletePromptParts = computed(() => {
11394
+ const tpl = getLabel$1("deleteConfirm", 'Are you sure you want to delete "{name}"?');
11395
+ const [before, after = ""] = tpl.split("{name}");
11396
+ return { before, after };
11397
+ });
11372
11398
  return (_ctx, _cache) => {
11373
11399
  return openBlock(), createElementBlock("div", {
11374
11400
  class: normalizeClass(`propeller-favorite-lists ${__props.className || ""}`),
@@ -11528,7 +11554,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
11528
11554
  y2: "12"
11529
11555
  })
11530
11556
  ], -1)),
11531
- createTextVNode(toDisplayString(getTotalCount(list)) + " " + toDisplayString(getLabel$1("items", "items")), 1)
11557
+ createTextVNode(toDisplayString(getTotalCount(list)) + " " + toDisplayString(getTotalCount(list) === 1 ? getLabel$1("itemSingular", "item") : getLabel$1("itemPlural", "items")), 1)
11532
11558
  ])) : createCommentVNode("", true)
11533
11559
  ])
11534
11560
  ])) : createCommentVNode("", true)
@@ -11682,9 +11708,9 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
11682
11708
  ]),
11683
11709
  createElementVNode("div", _hoisted_46$7, [
11684
11710
  createElementVNode("p", _hoisted_47$7, [
11685
- createTextVNode(toDisplayString(getLabel$1("deleteConfirm", "Are you sure you want to delete")), 1),
11686
- createElementVNode("strong", null, '"' + toDisplayString(unref(listToDelete)?.name) + '"', 1),
11687
- _cache[20] || (_cache[20] = createTextVNode("? ", -1))
11711
+ createTextVNode(toDisplayString(deletePromptParts.value.before), 1),
11712
+ createElementVNode("strong", null, toDisplayString(unref(listToDelete)?.name), 1),
11713
+ createTextVNode(toDisplayString(deletePromptParts.value.after), 1)
11688
11714
  ]),
11689
11715
  createElementVNode("p", _hoisted_48$7, toDisplayString(getLabel$1("deleteWarning", "This action cannot be undone.")), 1)
11690
11716
  ]),
@@ -12470,6 +12496,8 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
12470
12496
  [SortOrder.DESC]: "High to Low",
12471
12497
  clearAll: "Clear All",
12472
12498
  products: " Products",
12499
+ productSingular: "Product",
12500
+ productPlural: "Products",
12473
12501
  from: "from",
12474
12502
  results: "results",
12475
12503
  perPage: " per page",
@@ -12568,7 +12596,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
12568
12596
  }, [
12569
12597
  createElementVNode("div", _hoisted_2$m, [
12570
12598
  createElementVNode("div", _hoisted_3$m, [
12571
- __props.itemsFound !== void 0 && __props.itemsFound > 0 ? (openBlock(), createElementBlock("span", _hoisted_4$j, toDisplayString(__props.itemsFound) + toDisplayString(getLabel2("products")), 1)) : createCommentVNode("", true)
12599
+ __props.itemsFound !== void 0 && __props.itemsFound > 0 ? (openBlock(), createElementBlock("span", _hoisted_4$j, toDisplayString(__props.itemsFound) + " " + toDisplayString(__props.itemsFound === 1 ? getLabel2("productSingular") : getLabel2("productPlural")), 1)) : createCommentVNode("", true)
12572
12600
  ]),
12573
12601
  createElementVNode("div", _hoisted_5$j, [
12574
12602
  createElementVNode("select", {
@@ -13828,6 +13856,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
13828
13856
  formatPrice: { type: Function },
13829
13857
  formatDate: { type: Function },
13830
13858
  getStatusColor: { type: Function },
13859
+ statusLabels: {},
13831
13860
  labels: {},
13832
13861
  onCartCreated: { type: Function },
13833
13862
  afterReorder: { type: Function },
@@ -13888,13 +13917,20 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
13888
13917
  function formatDate(dateString) {
13889
13918
  if (props.formatDate) return props.formatDate(dateString);
13890
13919
  if (!dateString) return "-";
13891
- return new Date(dateString).toLocaleDateString();
13920
+ const d = new Date(dateString);
13921
+ if (isNaN(d.getTime())) return dateString;
13922
+ const day = String(d.getDate()).padStart(2, "0");
13923
+ const month = String(d.getMonth() + 1).padStart(2, "0");
13924
+ return `${day}-${month}-${d.getFullYear()}`;
13892
13925
  }
13893
13926
  function formatPrice$1(price) {
13894
13927
  if (props.formatPrice) return props.formatPrice(price);
13895
13928
  if (!price) return "-";
13896
13929
  return formatPrice(price, { symbol: infra.currency ?? "€" });
13897
13930
  }
13931
+ function statusLabel(status) {
13932
+ return props.statusLabels?.[status] || status;
13933
+ }
13898
13934
  function getStatusColor(status) {
13899
13935
  if (props.getStatusColor) return props.getStatusColor(status);
13900
13936
  switch (status) {
@@ -14209,7 +14245,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
14209
14245
  class: normalizeClass(`propeller-order-list__status px-2 inline-flex text-xs leading-5 font-semibold rounded-full ${getStatusColor(
14210
14246
  order.status
14211
14247
  )}`)
14212
- }, toDisplayString(order.status), 11, _hoisted_38$6)) : createCommentVNode("", true),
14248
+ }, toDisplayString(statusLabel(order.status)), 11, _hoisted_38$6)) : createCommentVNode("", true),
14213
14249
  col === "total" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
14214
14250
  createTextVNode(toDisplayString(formatPrice$1(order.total?.net)), 1)
14215
14251
  ], 64)) : createCommentVNode("", true),
@@ -14391,7 +14427,10 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
14391
14427
  function formatDate(dateStr) {
14392
14428
  if (!dateStr) return "-";
14393
14429
  const d = new Date(dateStr);
14394
- return `${d.getDate()}.${d.getMonth() + 1}.${d.getFullYear()}`;
14430
+ if (isNaN(d.getTime())) return dateStr;
14431
+ const day = String(d.getDate()).padStart(2, "0");
14432
+ const month = String(d.getMonth() + 1).padStart(2, "0");
14433
+ return `${day}-${month}-${d.getFullYear()}`;
14395
14434
  }
14396
14435
  function getOrderItemForShipmentItem(shipmentItem) {
14397
14436
  if (!props.order?.items || !shipmentItem.orderItemId) return null;
@@ -14616,16 +14655,19 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
14616
14655
  props: {
14617
14656
  label: {},
14618
14657
  labels: {},
14658
+ value: { type: Boolean },
14619
14659
  initialState: { type: Boolean },
14620
14660
  inclExclVatSwitched: { type: Function },
14621
14661
  className: {}
14622
14662
  },
14623
14663
  setup(__props) {
14624
14664
  const props = __props;
14625
- const isOn = ref(props.initialState ?? true);
14665
+ const isControlled = computed(() => props.value !== void 0);
14666
+ const internal = ref(props.initialState ?? true);
14667
+ const isOn = computed(() => isControlled.value ? !!props.value : internal.value);
14626
14668
  onMounted(() => {
14627
- if (typeof window !== "undefined") {
14628
- isOn.value = props.initialState ?? true;
14669
+ if (!isControlled.value && typeof window !== "undefined") {
14670
+ internal.value = props.initialState ?? true;
14629
14671
  }
14630
14672
  });
14631
14673
  function getLabel$1() {
@@ -14636,7 +14678,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
14636
14678
  }
14637
14679
  function handleToggle() {
14638
14680
  const newValue = !isOn.value;
14639
- isOn.value = newValue;
14681
+ if (!isControlled.value) {
14682
+ internal.value = newValue;
14683
+ }
14640
14684
  if (props.inclExclVatSwitched) {
14641
14685
  props.inclExclVatSwitched(newValue);
14642
14686
  }
@@ -18456,7 +18500,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
18456
18500
  if (props.formatDate) return props.formatDate(dateStr);
18457
18501
  if (!dateStr) return "-";
18458
18502
  const d = new Date(dateStr);
18459
- return `${d.getDate()}.${d.getMonth() + 1}.${d.getFullYear()}`;
18503
+ if (isNaN(d.getTime())) return dateStr;
18504
+ const day = String(d.getDate()).padStart(2, "0");
18505
+ const month = String(d.getMonth() + 1).padStart(2, "0");
18506
+ return `${day}-${month}-${d.getFullYear()}`;
18460
18507
  }
18461
18508
  function formatPrice$1(price) {
18462
18509
  if (props.formatPrice) return props.formatPrice(price);
@@ -18717,6 +18764,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
18717
18764
  function getLabel$1(key, fallback) {
18718
18765
  return getLabel(props.labels, key, fallback);
18719
18766
  }
18767
+ const termsConsentParts = computed(() => {
18768
+ const tpl = getLabel$1("termsConsent", "I agree to the {link}");
18769
+ const [before, after = ""] = tpl.split("{link}");
18770
+ return { before, after };
18771
+ });
18720
18772
  function handleTermsChange(checked) {
18721
18773
  termsAccepted.value = checked;
18722
18774
  }
@@ -18754,12 +18806,13 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
18754
18806
  onChange: _cache[0] || (_cache[0] = async (event) => handleTermsChange(event.target.checked))
18755
18807
  }, null, 40, _hoisted_4$3),
18756
18808
  createElementVNode("label", _hoisted_5$3, [
18757
- createTextVNode(toDisplayString(getLabel$1("termsPrefix", "I agree to the")), 1),
18809
+ createTextVNode(toDisplayString(termsConsentParts.value.before), 1),
18758
18810
  createElementVNode("a", {
18759
18811
  href: "#",
18760
18812
  class: "text-primary hover:underline font-medium",
18761
18813
  onClick: _cache[1] || (_cache[1] = async (event) => handleTermsLinkClick(event))
18762
- }, toDisplayString(getLabel$1("termsLink", "Terms and Conditions")), 1)
18814
+ }, toDisplayString(getLabel$1("termsLink", "Terms and Conditions")), 1),
18815
+ createTextVNode(toDisplayString(termsConsentParts.value.after), 1)
18763
18816
  ])
18764
18817
  ])) : createCommentVNode("", true),
18765
18818
  createElementVNode("button", {