basklee-svelte 0.9.13 → 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 +1 -1
- package/templates/src/lib/components/basklee/account/StorefrontProfile.svelte +2 -1
- package/templates/src/lib/components/basklee/cart/CartCheckoutDetails.svelte +2 -2
- package/templates/src/lib/components/basklee/orders/OrderDetails.svelte +2 -1
- package/templates/src/lib/components/basklee/orders/StorefrontOrders.svelte +1 -1
- package/templates/src/lib/utils/basklee/orderLabels.ts +5 -2
- package/templates/src/lib/utils/basklee/phone.ts +18 -0
- package/templates/src/lib/utils/basklee/ticketLabels.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "basklee-svelte",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.15",
|
|
4
4
|
"description": "SvelteKit 2 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 '@/lib/stores/basklee.svelte';
|
|
4
4
|
import { useBaskleeSelectionsStore } from '@/lib/stores/baskleeSelections.svelte';
|
|
5
5
|
import { profileLabels } from '@/lib/utils/basklee/profileLabels';
|
|
6
|
+
import { phoneForDisplay } from '@/lib/utils/basklee/phone';
|
|
6
7
|
import { featureLabels } from '@/lib/utils/basklee/featureLabels';
|
|
7
8
|
import '@/lib/components/basklee/shared/features.css';
|
|
8
9
|
import type {
|
|
@@ -150,7 +151,7 @@
|
|
|
150
151
|
>
|
|
151
152
|
<path d="M8 3h8v18H8zM11 18h2"></path>
|
|
152
153
|
</svg>
|
|
153
|
-
{store.profile.phone}
|
|
154
|
+
{phoneForDisplay(store.profile.phone)}
|
|
154
155
|
</li>
|
|
155
156
|
{/if}
|
|
156
157
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { useBaskleeCartContext } from '@/lib/composables/useBaskleeCart.svelte';
|
|
5
5
|
import { featureLabels } from '@/lib/utils/basklee/featureLabels';
|
|
6
6
|
import { cartLabels } from '@/lib/utils/basklee/cartLabels';
|
|
7
|
+
import { phoneForDisplay } from '@/lib/utils/basklee/phone';
|
|
7
8
|
import { phoneWithCountryCode } from '@/lib/utils/basklee/phone';
|
|
8
9
|
import { getAvailableValueFromObject } from '@/lib/utils/basklee/presentation';
|
|
9
10
|
import {
|
|
@@ -237,8 +238,7 @@
|
|
|
237
238
|
{labels.value.recipient}
|
|
238
239
|
</h2>
|
|
239
240
|
<p class={['op-feature-copy']}>
|
|
240
|
-
{summary.value?.contact.receiver?.full_name} · {summary.value?.contact
|
|
241
|
-
.receiver?.phone}
|
|
241
|
+
{summary.value?.contact.receiver?.full_name} · {phoneForDisplay(summary.value?.contact.receiver?.phone)}
|
|
242
242
|
</p>
|
|
243
243
|
<div class={['op-feature-actions']}>
|
|
244
244
|
<button
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { useBaskleeStore } from '@/lib/stores/basklee.svelte';
|
|
5
5
|
import { useBaskleeSelectionsStore } from '@/lib/stores/baskleeSelections.svelte';
|
|
6
6
|
import { orderLabels } from '@/lib/utils/basklee/orderLabels';
|
|
7
|
+
import { phoneForDisplay } from '@/lib/utils/basklee/phone';
|
|
7
8
|
import {
|
|
8
9
|
hasOrderAmount,
|
|
9
10
|
orderAmount,
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
const shipments = computed(() => inputs.order.delivery_froms ?? []);
|
|
98
99
|
const recipient = computed(() => ({
|
|
99
100
|
name: inputs.order.contact.reciever_name || inputs.order.contact.full_name,
|
|
100
|
-
phone: inputs.order.contact.reciever_phone || inputs.order.contact.phone,
|
|
101
|
+
phone: phoneForDisplay(inputs.order.contact.reciever_phone || inputs.order.contact.phone),
|
|
101
102
|
email: inputs.order.contact.email,
|
|
102
103
|
}));
|
|
103
104
|
const method = computed(() =>
|
|
@@ -2,6 +2,7 @@ const en = {
|
|
|
2
2
|
title: 'My orders',
|
|
3
3
|
allOrders: 'All orders',
|
|
4
4
|
order: 'Order',
|
|
5
|
+
orderNumber: 'Order #{id}',
|
|
5
6
|
placed: 'Placed',
|
|
6
7
|
empty: 'No orders in this group',
|
|
7
8
|
emptyHint: 'Check the other tabs or browse the catalog.',
|
|
@@ -146,6 +147,7 @@ const ru: typeof en = {
|
|
|
146
147
|
title: 'Мои заказы',
|
|
147
148
|
allOrders: 'Все заказы',
|
|
148
149
|
order: 'Заказ',
|
|
150
|
+
orderNumber: 'Заказ № {id}',
|
|
149
151
|
placed: 'Оформлен',
|
|
150
152
|
empty: 'В этой группе нет заказов',
|
|
151
153
|
emptyHint: 'Проверьте другие вкладки или перейдите в каталог.',
|
|
@@ -288,6 +290,7 @@ const es: typeof en = {
|
|
|
288
290
|
title: 'Mis pedidos',
|
|
289
291
|
allOrders: 'Todos los pedidos',
|
|
290
292
|
order: 'Pedido',
|
|
293
|
+
orderNumber: 'Pedido n.º {id}',
|
|
291
294
|
placed: 'Realizado',
|
|
292
295
|
empty: 'No hay pedidos en este grupo',
|
|
293
296
|
emptyHint: 'Revisa las otras pestañas o explora el catálogo.',
|
|
@@ -295,8 +298,8 @@ const es: typeof en = {
|
|
|
295
298
|
loading: 'Cargando pedidos',
|
|
296
299
|
tabs: 'Grupos de pedidos',
|
|
297
300
|
active: 'Activos',
|
|
298
|
-
canceled: '
|
|
299
|
-
finished: '
|
|
301
|
+
canceled: 'Cancelados',
|
|
302
|
+
finished: 'Completados',
|
|
300
303
|
refund: 'Devoluciones',
|
|
301
304
|
details: 'Detalles',
|
|
302
305
|
status: 'Estado',
|
|
@@ -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
|
+
}
|
|
@@ -102,8 +102,8 @@ const en = {
|
|
|
102
102
|
const ru: typeof en = {
|
|
103
103
|
title: 'Поддержка',
|
|
104
104
|
new: 'Новое обращение',
|
|
105
|
-
newAction: '
|
|
106
|
-
newHint: '
|
|
105
|
+
newAction: 'Новое',
|
|
106
|
+
newHint: 'Новое обращение',
|
|
107
107
|
ticket: 'Обращение',
|
|
108
108
|
open: 'Открытые',
|
|
109
109
|
closed: 'Закрытые',
|