@propeller-commerce/propeller-v2-vue-ui 0.3.14 → 0.3.15

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, n as formatPrice, o as formatSurcharge, D as getProductImageUrl, E as getProductSku, v as getCountryName, B as getLocalizedValue, z as getLanguageString, 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$V, d as _sfc_main$W, e as _sfc_main$X, h as _sfc_main$Y, i as _sfc_main$Z, 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, m as m2, 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$V, d as _sfc_main$W, e as _sfc_main$X, m as usePropellerContext, h as _sfc_main$Y, i as _sfc_main$Z, 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";
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, nextTick } 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");
@@ -7568,9 +7568,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
7568
7568
  });
7569
7569
  const payMethods = computed(() => {
7570
7570
  const methods = props.cart?.payMethods || [];
7571
- return methods.filter((m3) => {
7572
- if (!m3?.code) return false;
7573
- if (!showOnAccountForGuests && isGuest && isOnAccountMethod(m3)) {
7571
+ return methods.filter((m2) => {
7572
+ if (!m2?.code) return false;
7573
+ if (!showOnAccountForGuests && isGuest && isOnAccountMethod(m2)) {
7574
7574
  return false;
7575
7575
  }
7576
7576
  return true;
@@ -7583,7 +7583,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
7583
7583
  selectedCode.value = props.cart.paymentData.method;
7584
7584
  if (props.onPaymethodSelect) {
7585
7585
  const match = payMethods.value.find(
7586
- (m3) => m3.code === selectedCode.value
7586
+ (m2) => m2.code === selectedCode.value
7587
7587
  );
7588
7588
  if (match) props.onPaymethodSelect(match);
7589
7589
  }
@@ -7988,20 +7988,20 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
7988
7988
  const props = __props;
7989
7989
  function pickImageUrl(mediaItems2, target) {
7990
7990
  if (!mediaItems2 || mediaItems2.length === 0) return null;
7991
- for (const m3 of mediaItems2) {
7992
- const match = m3.imageVariants?.find((v) => v.language === target && v.url);
7991
+ for (const m2 of mediaItems2) {
7992
+ const match = m2.imageVariants?.find((v) => v.language === target && v.url);
7993
7993
  if (match?.url) return match.url;
7994
7994
  }
7995
- for (const m3 of mediaItems2) {
7996
- const match = m3.images?.find((i2) => i2.language === target && i2.originalUrl);
7995
+ for (const m2 of mediaItems2) {
7996
+ const match = m2.images?.find((i2) => i2.language === target && i2.originalUrl);
7997
7997
  if (match?.originalUrl) return match.originalUrl;
7998
7998
  }
7999
- for (const m3 of mediaItems2) {
8000
- const first = m3.imageVariants?.find((v) => v.url);
7999
+ for (const m2 of mediaItems2) {
8000
+ const first = m2.imageVariants?.find((v) => v.url);
8001
8001
  if (first?.url) return first.url;
8002
8002
  }
8003
- for (const m3 of mediaItems2) {
8004
- const first = m3.images?.find((i2) => i2.originalUrl);
8003
+ for (const m2 of mediaItems2) {
8004
+ const first = m2.images?.find((i2) => i2.originalUrl);
8005
8005
  if (first?.originalUrl) return first.originalUrl;
8006
8006
  }
8007
8007
  return null;
@@ -8154,6 +8154,9 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8154
8154
  setup(__props) {
8155
8155
  const props = __props;
8156
8156
  const RESOLVE_SPEC = {
8157
+ // NOTE: includeTax is resolved separately (see `infra`/`resolvedIncludeTax`
8158
+ // below) because the infra fallback must read injected context at setup —
8159
+ // useResolvedProps runs inside a `computed` here, where inject() returns null.
8157
8160
  priceComponent: { grid: "priceComponent" },
8158
8161
  stockComponent: { grid: "stockComponent" },
8159
8162
  imageComponent: { grid: "imageComponent" },
@@ -8161,14 +8164,16 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8161
8164
  favoriteComponent: { grid: "favoriteComponent" }
8162
8165
  };
8163
8166
  const resolved = computed(() => useResolvedProps(props, RESOLVE_SPEC));
8167
+ const infra = useInfraProps(props);
8168
+ const resolvedIncludeTax = computed(
8169
+ () => props.includeTax === true ? true : !!infra.includeTax
8170
+ );
8164
8171
  const PriceImpl = computed(() => resolved.value.priceComponent ?? _sfc_main$V);
8165
8172
  const StockImpl = computed(() => resolved.value.stockComponent ?? _sfc_main$W);
8166
8173
  const ImageImpl = computed(() => resolved.value.imageComponent ?? _sfc_main$D);
8167
8174
  const BadgesImpl = computed(() => resolved.value.badgesComponent ?? _sfc_main$C);
8168
8175
  const FavoriteImpl = computed(() => resolved.value.favoriteComponent ?? _sfc_main$P);
8169
8176
  const isFavorite = ref(false);
8170
- const includeTax = ref(false);
8171
- ref(null);
8172
8177
  function isRow() {
8173
8178
  return props.columns === 1;
8174
8179
  }
@@ -8215,7 +8220,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8215
8220
  function getClusterPrice() {
8216
8221
  if (!props.showPrice) return "";
8217
8222
  const priceObj = props.cluster?.defaultProduct?.price;
8218
- const useTax = props.includeTax !== void 0 ? !!props.includeTax : includeTax.value;
8223
+ const useTax = resolvedIncludeTax.value;
8219
8224
  const value = useTax ? priceObj?.net : priceObj?.gross;
8220
8225
  if (!value && value !== 0) return "";
8221
8226
  return formatPrice(Number(value), { symbol: props.currency ?? "€" });
@@ -8449,14 +8454,14 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8449
8454
  key: 1,
8450
8455
  cluster: __props.cluster,
8451
8456
  price: __props.cluster.defaultProduct?.price,
8452
- includeTax: props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
8457
+ includeTax: resolvedIncludeTax.value,
8453
8458
  currency: __props.currency,
8454
8459
  labels: __props.labels
8455
8460
  }, () => [
8456
8461
  props.priceComponent ? (openBlock(), createBlock(resolveDynamicComponent(PriceImpl.value), {
8457
8462
  key: 0,
8458
8463
  price: __props.cluster.defaultProduct?.price,
8459
- "include-tax": includeTax.value,
8464
+ "include-tax": resolvedIncludeTax.value,
8460
8465
  currency: __props.currency,
8461
8466
  labels: __props.labels
8462
8467
  }, null, 8, ["price", "include-tax", "currency", "labels"])) : (openBlock(), createElementBlock("span", _hoisted_16$i, toDisplayString(getClusterPrice()), 1))
@@ -8552,7 +8557,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8552
8557
  key: 6,
8553
8558
  cluster: __props.cluster,
8554
8559
  price: __props.cluster.defaultProduct?.price,
8555
- includeTax: props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
8560
+ includeTax: resolvedIncludeTax.value,
8556
8561
  currency: __props.currency,
8557
8562
  labels: __props.labels
8558
8563
  }, () => [
@@ -8560,7 +8565,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8560
8565
  props.priceComponent ? (openBlock(), createBlock(resolveDynamicComponent(PriceImpl.value), {
8561
8566
  key: 0,
8562
8567
  price: __props.cluster.defaultProduct?.price,
8563
- "include-tax": includeTax.value,
8568
+ "include-tax": resolvedIncludeTax.value,
8564
8569
  currency: __props.currency,
8565
8570
  labels: __props.labels
8566
8571
  }, null, 8, ["price", "include-tax", "currency", "labels"])) : (openBlock(), createElementBlock("span", _hoisted_26$b, toDisplayString(getClusterPrice()), 1))
@@ -9585,9 +9590,9 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
9585
9590
  const tomorrow = /* @__PURE__ */ new Date();
9586
9591
  tomorrow.setDate(tomorrow.getDate() + 1);
9587
9592
  const y = tomorrow.getFullYear();
9588
- const m3 = String(tomorrow.getMonth() + 1).padStart(2, "0");
9593
+ const m2 = String(tomorrow.getMonth() + 1).padStart(2, "0");
9589
9594
  const d = String(tomorrow.getDate()).padStart(2, "0");
9590
- return y + "-" + m3 + "-" + d;
9595
+ return y + "-" + m2 + "-" + d;
9591
9596
  });
9592
9597
  watch(
9593
9598
  () => [props.initialDate, props.cart],
@@ -9608,18 +9613,18 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
9608
9613
  }
9609
9614
  function toApiDate(date) {
9610
9615
  const y = date.getFullYear();
9611
- const m3 = String(date.getMonth() + 1).padStart(2, "0");
9616
+ const m2 = String(date.getMonth() + 1).padStart(2, "0");
9612
9617
  const d = String(date.getDate()).padStart(2, "0");
9613
- return y + "-" + m3 + "-" + d + "T00:00:00Z";
9618
+ return y + "-" + m2 + "-" + d + "T00:00:00Z";
9614
9619
  }
9615
9620
  function toDayKey(iso) {
9616
9621
  if (!iso) return "";
9617
9622
  const date = new Date(iso);
9618
9623
  if (isNaN(date.getTime())) return "";
9619
9624
  const y = date.getFullYear();
9620
- const m3 = String(date.getMonth() + 1).padStart(2, "0");
9625
+ const m2 = String(date.getMonth() + 1).padStart(2, "0");
9621
9626
  const d = String(date.getDate()).padStart(2, "0");
9622
- return y + "-" + m3 + "-" + d;
9627
+ return y + "-" + m2 + "-" + d;
9623
9628
  }
9624
9629
  function formatDisplay(isoDate) {
9625
9630
  if (props.formatDateDisplay) {
@@ -15008,6 +15013,9 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15008
15013
  setup(__props) {
15009
15014
  const props = __props;
15010
15015
  const RESOLVE_SPEC = {
15016
+ // NOTE: includeTax is resolved separately (see `infra`/`resolvedIncludeTax`
15017
+ // below) because the infra fallback must read injected context at setup —
15018
+ // useResolvedProps runs inside a `computed` here, where inject() returns null.
15011
15019
  priceComponent: { grid: "priceComponent" },
15012
15020
  stockComponent: { grid: "stockComponent" },
15013
15021
  addToCartComponent: { grid: "addToCartComponent" },
@@ -15016,6 +15024,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15016
15024
  favoriteComponent: { grid: "favoriteComponent" }
15017
15025
  };
15018
15026
  const resolved = computed(() => useResolvedProps(props, RESOLVE_SPEC));
15027
+ const infra = useInfraProps(props);
15028
+ const resolvedIncludeTax = computed(
15029
+ () => props.includeTax === true ? true : !!infra.includeTax
15030
+ );
15019
15031
  const PriceImpl = computed(() => resolved.value.priceComponent ?? _sfc_main$V);
15020
15032
  const StockImpl = computed(() => resolved.value.stockComponent ?? _sfc_main$W);
15021
15033
  const AddToCartImpl = computed(() => resolved.value.addToCartComponent ?? _sfc_main$Q);
@@ -15023,8 +15035,6 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15023
15035
  const BadgesImpl = computed(() => resolved.value.badgesComponent ?? _sfc_main$C);
15024
15036
  const FavoriteImpl = computed(() => resolved.value.favoriteComponent ?? _sfc_main$P);
15025
15037
  const isFavorite = ref(false);
15026
- const includeTax = ref(false);
15027
- ref(null);
15028
15038
  function isRow() {
15029
15039
  return props.columns === 1;
15030
15040
  }
@@ -15290,7 +15300,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15290
15300
  key: 1,
15291
15301
  product: __props.product,
15292
15302
  price: __props.product.price,
15293
- includeTax: props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
15303
+ includeTax: resolvedIncludeTax.value,
15294
15304
  currency: __props.currency,
15295
15305
  labels: props.priceLabels
15296
15306
  }, () => [
@@ -15298,13 +15308,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15298
15308
  props.priceComponent ? (openBlock(), createBlock(resolveDynamicComponent(PriceImpl.value), {
15299
15309
  key: 0,
15300
15310
  price: __props.product.price,
15301
- "include-tax": props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
15311
+ "include-tax": resolvedIncludeTax.value,
15302
15312
  currency: __props.currency,
15303
15313
  labels: props.priceLabels
15304
15314
  }, null, 8, ["price", "include-tax", "currency", "labels"])) : (openBlock(), createBlock(_sfc_main$V, {
15305
15315
  key: 1,
15306
15316
  price: __props.product.price,
15307
- includeTax: props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
15317
+ includeTax: resolvedIncludeTax.value,
15308
15318
  priceSize: "text-sm",
15309
15319
  labels: props.priceLabels
15310
15320
  }, null, 8, ["price", "includeTax", "labels"]))
@@ -15430,7 +15440,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15430
15440
  key: 6,
15431
15441
  product: __props.product,
15432
15442
  price: __props.product.price,
15433
- includeTax: props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
15443
+ includeTax: resolvedIncludeTax.value,
15434
15444
  currency: __props.currency,
15435
15445
  labels: props.priceLabels
15436
15446
  }, () => [
@@ -15438,13 +15448,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
15438
15448
  props.priceComponent ? (openBlock(), createBlock(resolveDynamicComponent(PriceImpl.value), {
15439
15449
  key: 0,
15440
15450
  price: __props.product.price,
15441
- "include-tax": props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
15451
+ "include-tax": resolvedIncludeTax.value,
15442
15452
  currency: __props.currency,
15443
15453
  labels: props.priceLabels
15444
15454
  }, null, 8, ["price", "include-tax", "currency", "labels"])) : (openBlock(), createBlock(_sfc_main$V, {
15445
15455
  key: 1,
15446
15456
  price: __props.product.price,
15447
- includeTax: props.includeTax !== void 0 ? !!props.includeTax : includeTax.value,
15457
+ includeTax: resolvedIncludeTax.value,
15448
15458
  priceSize: "text-base sm:text-lg",
15449
15459
  labels: props.priceLabels
15450
15460
  }, null, 8, ["price", "includeTax", "labels"]))
@@ -15864,6 +15874,10 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
15864
15874
  setup(__props) {
15865
15875
  const props = __props;
15866
15876
  const infra = useInfraProps(props);
15877
+ const ctxForTax = usePropellerContext();
15878
+ const resolvedIncludeTax = computed(
15879
+ () => props.includeTax === true ? true : !!(ctxForTax ? ctxForTax.includeTax : false)
15880
+ );
15867
15881
  const ProductCardImpl = computed(
15868
15882
  () => props.productCardComponent ?? _sfc_main$e
15869
15883
  );
@@ -16052,7 +16066,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
16052
16066
  columns: props.columns || 3,
16053
16067
  cluster: item,
16054
16068
  configuration: unref(infra).configuration,
16055
- includeTax: unref(infra).includeTax,
16069
+ includeTax: resolvedIncludeTax.value,
16056
16070
  showPrice: props.showPrice,
16057
16071
  language: unref(infra).language || "NL",
16058
16072
  showStock: props.showStock,
@@ -16080,7 +16094,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
16080
16094
  graphqlClient: unref(infra).graphqlClient,
16081
16095
  user: unref(infra).user || null,
16082
16096
  configuration: unref(infra).configuration,
16083
- includeTax: unref(infra).includeTax,
16097
+ includeTax: resolvedIncludeTax.value,
16084
16098
  cartId: props.cartId,
16085
16099
  createCart: props.createCart,
16086
16100
  onCartCreated: props.onCartCreated,
@@ -20076,7 +20090,7 @@ export {
20076
20090
  useProductSearch,
20077
20091
  useProductSlider,
20078
20092
  useProductSpecs,
20079
- m2 as usePropellerContext,
20093
+ usePropellerContext,
20080
20094
  usePropellerDeps,
20081
20095
  usePurchaseAuthorizationConfigurator,
20082
20096
  usePurchaseAuthorizationRequests,