basklee-nuxt 0.9.14 → 0.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "basklee-nuxt",
3
- "version": "0.9.14",
3
+ "version": "0.9.15",
4
4
  "description": "Nuxt 4 storefront for your Basklee marketplace: setup CLI, server API gateway, typed store and ready-made catalog, cart, checkout and account components in English, Russian and Spanish, plus an Android app build. Powered by Basklee: https://basklee.com",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -3,6 +3,7 @@
3
3
  import { useBaskleeStore } from '@/stores/basklee';
4
4
  import { useBaskleeSelectionsStore } from '@/stores/baskleeSelections';
5
5
  import { profileLabels } from '@/utils/basklee/profileLabels';
6
+ import { phoneForDisplay } from '@/utils/basklee/phone';
6
7
  import { featureLabels } from '@/utils/basklee/featureLabels';
7
8
  import '@/components/basklee/shared/features.css';
8
9
  import type {
@@ -111,7 +112,7 @@
111
112
  >
112
113
  <path d="M8 3h8v18H8zM11 18h2" />
113
114
  </svg>
114
- {{ store.profile.phone }}
115
+ {{ phoneForDisplay(store.profile.phone) }}
115
116
  </li>
116
117
  <li v-if="store.profile?.email">
117
118
  <svg
@@ -4,6 +4,7 @@
4
4
  import { useBaskleeCartContext } from '@/composables/useBaskleeCart';
5
5
  import { featureLabels } from '@/utils/basklee/featureLabels';
6
6
  import { cartLabels } from '@/utils/basklee/cartLabels';
7
+ import { phoneForDisplay } from '@/utils/basklee/phone';
7
8
  import { getAvailableValueFromObject } from '@/utils/basklee/presentation';
8
9
  import { phoneWithCountryCode } from '@/utils/basklee/phone';
9
10
  import {
@@ -216,7 +217,7 @@
216
217
  <h2 class="commerce-subtitle">{{ labels.recipient }}</h2>
217
218
  <p class="op-feature-copy">
218
219
  {{ summary?.contact.receiver?.full_name }} ·
219
- {{ summary?.contact.receiver?.phone }}
220
+ {{ phoneForDisplay(summary?.contact.receiver?.phone) }}
220
221
  </p>
221
222
  <div class="op-feature-actions">
222
223
  <button
@@ -4,6 +4,7 @@
4
4
  import { useBaskleeStore } from '@/stores/basklee';
5
5
  import { useBaskleeSelectionsStore } from '@/stores/baskleeSelections';
6
6
  import { orderLabels } from '@/utils/basklee/orderLabels';
7
+ import { phoneForDisplay } from '@/utils/basklee/phone';
7
8
  import {
8
9
  hasOrderAmount,
9
10
  orderAmount,
@@ -71,7 +72,7 @@
71
72
  const shipments = computed(() => props.order.delivery_froms ?? []);
72
73
  const recipient = computed(() => ({
73
74
  name: props.order.contact.reciever_name || props.order.contact.full_name,
74
- phone: props.order.contact.reciever_phone || props.order.contact.phone,
75
+ phone: phoneForDisplay(props.order.contact.reciever_phone || props.order.contact.phone),
75
76
  email: props.order.contact.email,
76
77
  }));
77
78
  const method = computed(() =>
@@ -1,3 +1,5 @@
1
+ import { parsePhoneNumberFromString } from 'libphonenumber-js';
2
+
1
3
  /**
2
4
  * A phone number typed without «+» on the Russian storefront, as people in
3
5
  * Russia usually type it: «8 900 555-01-72» (the domestic prefix 8) or
@@ -20,3 +22,19 @@ export function phoneWithCountryCode(value: string, locale: string): string {
20
22
  }
21
23
  return value;
22
24
  }
25
+
26
+ /**
27
+ * A stored phone as people read it: «+12125550161» becomes «+1 212 555 0161»,
28
+ * «+74955550162» becomes «+7 495 555 01 62». The backend keeps numbers in the
29
+ * international format without spaces; a number the library cannot read is
30
+ * shown as stored.
31
+ */
32
+ export function phoneForDisplay(value: string | null | undefined): string {
33
+ const text = (value ?? '').trim();
34
+
35
+ if (!text) {
36
+ return '';
37
+ }
38
+
39
+ return parsePhoneNumberFromString(text)?.formatInternational() ?? text;
40
+ }