orionplace-nuxt 0.7.0 → 0.7.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orionplace-nuxt",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Nuxt 4 storefront for your Orionplace marketplace: setup CLI, server API gateway, typed store and ready-made catalog, cart, checkout and account components in English and Russian, plus an Android app build.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -579,11 +579,10 @@ out; the journal and other pages stay indexable. Leave it empty on a live shop.
579
579
 
580
580
  Every product page carries schema.org product data for Google and Yandex: the
581
581
  price, the crossed-out old price, stock, photos, brand, seller, rating and the
582
- return terms the page shows. To include the return terms, set
583
- \`ORIONPLACE_SHIPPING_COUNTRIES\` in \`.env\` to the countries you ship to, as
584
- ISO codes separated by spaces, for example
585
- \`ORIONPLACE_SHIPPING_COUNTRIES="RU BY"\`; without it the return terms are left
586
- out. The delivery cost is not included: it depends on the buyer's address.
582
+ return terms the page shows. The return terms name the shop's shipping
583
+ countries, which Application Load sends in \`init.shipping_countries\`; without
584
+ a shipping country they are left out. The delivery cost is not included: it
585
+ depends on the buyer's address.
587
586
 
588
587
  This setup does not add analytics.
589
588
 
@@ -24,6 +24,8 @@ export interface IAppLoadCommon {
24
24
  weights: Record<string, IAppLoadCommonUnit>;
25
25
  lengths: Record<string, IAppLoadCommonUnit>;
26
26
  geo_location_enabled: boolean;
27
+ /** ISO codes of the shop's shipping countries, sorted. */
28
+ shipping_countries?: string[];
27
29
  is_authenticated: boolean;
28
30
  wallet?: Record<string, IAppLoadCommonWalletValue>;
29
31
  logos: IAppLoadCommonLogos;
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { useOrionplaceStore } from '@/stores/orionplace';
3
3
  import { computed, ref, watch } from 'vue';
4
- import { navigateTo, useRoute, useState } from '#imports';
4
+ import { navigateTo, useRoute } from '#imports';
5
5
  import { useOrionplacePageSeo } from '@/composables/useOrionplacePageSeo';
6
6
  import { useOrionplaceMissingPage } from '@/composables/useOrionplaceMissingPage';
7
7
  import { useOrionplaceServerData } from '@/composables/useOrionplaceServerData';
@@ -71,13 +71,6 @@
71
71
  return images?.full?.[0] ?? images?.small?.[0];
72
72
  });
73
73
 
74
- // ORIONPLACE_SHIPPING_COUNTRIES from the server's .env, for the return
75
- // terms in the page's schema.org data; the browser reuses the value.
76
- const shippingCountries = useState('orionplace:shipping-countries', () =>
77
- shippingCountryCodes(
78
- import.meta.server ? process.env.ORIONPLACE_SHIPPING_COUNTRIES : '',
79
- ),
80
- );
81
74
  const productName = computed(() =>
82
75
  getAvailableNestedValueFromObject(
83
76
  product.value?.locale,
@@ -113,7 +106,10 @@
113
106
  description: productSummary.value,
114
107
  currencyId: store.currencyId,
115
108
  currencyCode: store.currentCurrency?.currency_code,
116
- shippingCountries: shippingCountries.value,
109
+ // The backend's shipping countries, for the return terms.
110
+ shippingCountries: shippingCountryCodes(
111
+ store.init?.shipping_countries,
112
+ ),
117
113
  showSeller: !store.init?.visual_settings?.single_seller_mode,
118
114
  absoluteUrl: (value) => storefrontAbsoluteUrl(value, origin),
119
115
  }),
@@ -45,7 +45,7 @@ export interface StorefrontProductDataOptions {
45
45
  /** The currency the page shows prices in (its ID and code). */
46
46
  currencyId: string;
47
47
  currencyCode: string | undefined;
48
- /** ORIONPLACE_SHIPPING_COUNTRIES, parsed by shippingCountryCodes(). */
48
+ /** App Load `init.shipping_countries`, parsed by shippingCountryCodes(). */
49
49
  shippingCountries: string[];
50
50
  /** False when the page hides the seller (single-seller storefront). */
51
51
  showSeller: boolean;
@@ -54,11 +54,12 @@ export interface StorefrontProductDataOptions {
54
54
  }
55
55
 
56
56
  /**
57
- * The countries the shop ships to, from ORIONPLACE_SHIPPING_COUNTRIES:
58
- * ISO 3166-1 alpha-2 codes separated by spaces or commas, e.g. "RU BY".
57
+ * The countries the shop ships to: App Load `init.shipping_countries` (the
58
+ * backend's countries marked as shipping countries), as valid ISO 3166-1
59
+ * alpha-2 codes.
59
60
  */
60
61
  export function shippingCountryCodes(value: unknown): string[] {
61
- const codes = String(value ?? '')
62
+ const codes = (Array.isArray(value) ? value.join(' ') : String(value ?? ''))
62
63
  .split(/[\s,;]+/)
63
64
  .map((code) => code.trim().toUpperCase())
64
65
  .filter((code) => /^[A-Z]{2}$/.test(code));