basklee-svelte 0.8.1 → 0.9.1

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.
Files changed (23) hide show
  1. package/README.md +6 -24
  2. package/package.json +2 -2
  3. package/src/install.mjs +2 -5
  4. package/src/project-readme.mjs +8 -7
  5. package/src/update.mjs +1 -19
  6. package/templates/basklee/COMPONENTS.md +7 -7
  7. package/templates/src/lib/components/basklee/cart/CartDeliverySelector.README.md +1 -1
  8. package/templates/src/lib/components/basklee/cart/CartItemOptions.README.md +1 -1
  9. package/templates/src/lib/components/basklee/cart/CartLineItem.README.md +1 -1
  10. package/templates/src/lib/components/basklee/orders/OrderPaymentForm.README.md +1 -1
  11. package/templates/src/lib/components/basklee/payments/PaymentPanel.README.md +1 -1
  12. package/templates/src/lib/components/basklee/search/SearchFilters.svelte +9 -0
  13. package/templates/src/lib/components/basklee/subscriptions/StorefrontSubscriptions.README.md +1 -1
  14. package/templates/src/lib/components/basklee/subscriptions/SubscriptionPlanSummary.README.md +1 -1
  15. package/templates/src/lib/components/basklee/subscriptions/SubscriptionRemoteDetails.README.md +1 -1
  16. package/templates/src/lib/components/basklee/subscriptions/SubscriptionRenewalDialog.README.md +1 -1
  17. package/templates/src/lib/components/basklee/wallet/StorefrontWallet.README.md +1 -1
  18. package/templates/src/lib/interfaces/basklee/products/IProductSearchApi.ts +2 -0
  19. package/templates/src/lib/interfaces/basklee/products/IProductSearchFacets.ts +2 -0
  20. package/templates/src/lib/utils/basklee/browseLabels.ts +3 -0
  21. package/templates/src/lib/utils/basklee/productStructuredData.ts +18 -4
  22. package/templates/src/routes/product/[id]/+page.svelte +6 -0
  23. package/src/migrate.mjs +0 -124
package/README.md CHANGED
@@ -44,7 +44,7 @@ leaves the app on the first page. With `@capacitor/filesystem` and
44
44
  `@capacitor/share`, a purchased file is saved in the app and opened from the
45
45
  Android share sheet. Without the variable the website build is
46
46
  unchanged. Setup, build and release steps:
47
- [Android app guide](https://basklee.com/en/sandbox/android-app?framework=svelte).
47
+ [Android app guide](https://docs.basklee.com/en/sandbox/android-app?framework=svelte).
48
48
 
49
49
  ```bash
50
50
  npm install -D @sveltejs/adapter-static
@@ -191,7 +191,7 @@ Browse categories, search results and product sources.
191
191
  | **Catalog component** | `StorefrontCatalog` | The component shows store categories, subcategories and product links. |
192
192
  | **Category page** | `StorefrontCategory` | A category with its breadcrumb path, subcategories, filters and paginated product cards. |
193
193
  | **Search results** | `ProductSearchResults` | Filters, products, loading and empty states for search, category, seller and recommendation results. |
194
- | **Search filters** | `SearchFilters` | Price, discount, rating, review, category, seller, manufacturer and variant facets with selectable values and optional result counts. |
194
+ | **Search filters** | `SearchFilters` | Price, discount, stock, rating, review, category, seller, manufacturer and variant facets with selectable values and optional result counts. |
195
195
  | **Sellers** | `StorefrontSellers` | Seller directory with filters and sorting, and a seller profile with its products. |
196
196
  | **Seller filters** | `SellerFilters` | Seller name, minimum rating and category filters for the seller directory. |
197
197
  | **Seller summary** | `SellerSummary` | Seller logo, name, rating, selling-since badge, product count and description. |
@@ -361,7 +361,7 @@ storefront on your server; see [Install on your server](#install-on-your-server)
361
361
 
362
362
  Prepare a Linux server once with the Basklee server script: it installs
363
363
  Node.js, nginx and certbot and adds the `basklee` command
364
- ([server guide](https://basklee.com/en/sandbox/install)).
364
+ ([server guide](https://docs.basklee.com/en/sandbox/install)).
365
365
 
366
366
  ```bash
367
367
  curl -fsSLo basklee.sh https://basklee.com/downloads/basklee.sh
@@ -385,7 +385,7 @@ certificate. Run it again after code or package updates; the service keeps its
385
385
  port. Options: `--name <service>`, `--port <port>`, `--user <user>`,
386
386
  `--no-build` (install the build already in the folder), `--no-domains`, `--yes`,
387
387
  `--dry-run`. Full guide:
388
- [Install a storefront](https://basklee.com/en/sandbox/install/storefront?framework=svelte).
388
+ [Install a storefront](https://docs.basklee.com/en/sandbox/install/storefront?framework=svelte).
389
389
 
390
390
  ### Manage the service
391
391
 
@@ -602,28 +602,10 @@ Updates require the existing `basklee/settings.json` and `.generated.json`.
602
602
  Conflicting untracked files stop the source update before any writes. If dependency
603
603
  installation fails after source generation, run `npm install` and retry `update`.
604
604
 
605
- ### Projects made with orionplace-svelte
606
-
607
- The package was called `orionplace-svelte` until November 2026. In such a project
608
- run the same command:
609
-
610
- ```bash
611
- npx basklee-svelte update
612
- ```
613
-
614
- Before the usual update it renames the project's own files: the `orionplace/`
615
- folders, `Orionplace*` components, types and composables, `--orionplace-*` CSS
616
- variables, `ORIONPLACE_*` keys in `.env`, the `orionplace:*` scripts and the
617
- dependency in `package.json`. Files you edited stay edited; every file it changes
618
- is copied first, at its old path, into `.basklee-backup-<date>/`. Your
619
- `*.orionplace.app` backend address keeps its name. `--dry-run` lists the
620
- renames without changing anything. A server set up before the rename keeps its
621
- `orionplace` service names.
622
-
623
605
  ## Documentation
624
606
 
625
- - [Create a SvelteKit frontend](https://basklee.com/en/sandbox/new-project/svelte)
626
- - [Marketplace API documentation](https://basklee.com/en/sandbox/)
607
+ - [Create a SvelteKit frontend](https://docs.basklee.com/en/sandbox/new-project/svelte)
608
+ - [Marketplace API documentation](https://docs.basklee.com/en/sandbox/)
627
609
 
628
610
  ## Development
629
611
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "basklee-svelte",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
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.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Basklee",
8
- "homepage": "https://basklee.com/en/sandbox/new-project/svelte",
8
+ "homepage": "https://docs.basklee.com/en/sandbox/new-project/svelte",
9
9
  "keywords": [
10
10
  "svelte",
11
11
  "svelte5",
package/src/install.mjs CHANGED
@@ -26,13 +26,10 @@ export const framework = {
26
26
  },
27
27
  };
28
28
 
29
- // Servers set up before the rename to Basklee (2026-11) keep their names: /etc/orionplace, /srv/orionplace,
30
- // orionplace-<app> services and the "orionplace" server tool. New servers use basklee.
31
- export const serverName = (process.env.ORIONPLACE_ETC
32
- || (!process.env.BASKLEE_ETC && !existsSync('/etc/basklee') && existsSync('/etc/orionplace'))) ? 'orionplace' : 'basklee';
29
+ export const serverName = 'basklee';
33
30
 
34
31
  export const defaultPaths = {
35
- etc: process.env.BASKLEE_ETC || process.env.ORIONPLACE_ETC || `/etc/${serverName}`,
32
+ etc: process.env.BASKLEE_ETC || `/etc/${serverName}`,
36
33
  systemd: '/etc/systemd/system',
37
34
  openrc: '/etc/init.d',
38
35
  logs: `/var/log/${serverName}`,
@@ -295,7 +295,7 @@ The shared client renews the token for the next action and returns the failed
295
295
  request; the customer retries explicitly. After confirmed login/logout, reset and refresh Application Load; these actions
296
296
  change application data and do not log in/out or delete cookies.
297
297
 
298
- [Cookie lifecycle and browser request example](https://basklee.com/en/sandbox/appload/svelte#session-cookies)
298
+ [Cookie lifecycle and browser request example](https://docs.basklee.com/en/sandbox/appload/svelte#session-cookies)
299
299
 
300
300
  ### Rendering, navigation and failures
301
301
 
@@ -342,7 +342,7 @@ If installation fails after source generation, run \`npm install\` and retry.
342
342
  The quickest way: prepare the server with the Basklee server script,
343
343
  then run \`sudo npx basklee-svelte install\` in this folder. It builds the
344
344
  project, runs it as a system service and connects your domains with nginx and
345
- HTTPS. Steps: [Install a storefront](https://basklee.com/en/sandbox/install/storefront?framework=svelte).
345
+ HTTPS. Steps: [Install a storefront](https://docs.basklee.com/en/sandbox/install/storefront?framework=svelte).
346
346
  Then manage it from this folder: \`npx basklee-svelte status\`, \`sudo npx basklee-svelte restart\`,
347
347
  \`sudo npx basklee-svelte stop\`, \`sudo npx basklee-svelte start\` and \`sudo npx basklee-svelte logs\`.
348
348
  \`sudo npx basklee-svelte uninstall\` (or \`cleanup\`) stops and removes the service; this folder stays.
@@ -404,8 +404,9 @@ pages answer with \`X-Robots-Tag: noindex, follow\` and the sitemap leaves them
404
404
  out; the journal and other pages stay indexable. Leave it empty on a live shop.
405
405
 
406
406
  Every product page carries schema.org product data for Google and Yandex: the
407
- price, the crossed-out old price, stock, photos, brand, seller, rating and the
408
- return terms the page shows. The return terms name the shop's shipping
407
+ price, the crossed-out old price, stock (a product open for preorder is a
408
+ preorder, not sold out), photos, brand (the manufacturer, otherwise the seller),
409
+ seller, rating and the return terms the page shows. The return terms name the shop's shipping
409
410
  countries, which Application Load sends in \`init.shipping_countries\`; without
410
411
  a shipping country they are left out. The delivery cost is not included: it
411
412
  depends on the buyer's address.
@@ -419,7 +420,7 @@ Deploy the website first, then build the app with Capacitor 8. With
419
420
  client-only and sends every API request to that storefront through Capacitor's
420
421
  native HTTP (\`src/lib/utils/basklee/nativeApp.ts\`). Without the variable the
421
422
  website build is unchanged. Steps:
422
- [Android app guide](https://basklee.com/en/sandbox/android-app?framework=svelte).
423
+ [Android app guide](https://docs.basklee.com/en/sandbox/android-app?framework=svelte).
423
424
 
424
425
  \`\`\`bash
425
426
  npm install -D @sveltejs/adapter-static
@@ -429,7 +430,7 @@ npx cap sync android
429
430
 
430
431
  ## More documentation
431
432
 
432
- - [SvelteKit package installation and domain setup](https://basklee.com/en/sandbox/new-project/svelte)
433
- - [Application Load](https://basklee.com/en/sandbox)
433
+ - [SvelteKit package installation and domain setup](https://docs.basklee.com/en/sandbox/new-project/svelte)
434
+ - [Application Load](https://docs.basklee.com/en/sandbox)
434
435
  `;
435
436
  }
package/src/update.mjs CHANGED
@@ -1,16 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { readFileSync } from 'node:fs';
3
2
  import { resolve } from 'node:path';
4
- import { migrateLegacyProject } from './migrate.mjs';
5
3
  import { setupProject } from './setup.mjs';
6
4
 
7
- const PACKAGE = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
8
-
9
- function printMigration(done, dryRun) {
10
- console.log(`${dryRun ? 'Would rename' : 'Renamed'} this project from the old orionplace names to Basklee (${done.files.length} files changed, ${done.moved} moved; dependency ${done.dependency}).`);
11
- if (done.backup) console.log(`Backup of every changed file, at its old path: ${done.backup}/ (delete it after checking).`);
12
- }
13
-
14
5
  export function runNpm(args, cwd) {
15
6
  const npmCli = process.env.npm_execpath;
16
7
  const command = npmCli ? process.execPath : 'npm';
@@ -26,24 +17,15 @@ export function runNpm(args, cwd) {
26
17
 
27
18
  export async function updateProject({ cwd = process.cwd(), dryRun = false, local = false, npm = runNpm } = {}) {
28
19
  cwd = resolve(cwd);
29
- // A project made before the rename to Basklee is renamed first (migrate.mjs); the latest CLI does it.
30
- const legacy = await migrateLegacyProject({ cwd, dryRun: true, packageName: PACKAGE.name, version: PACKAGE.version });
31
20
  // Validate before downloading or writing; the latest CLI repeats preflight with its own templates.
32
- const preview = legacy ? null : await setupProject({ cwd, action: 'update', dryRun: true });
21
+ const preview = await setupProject({ cwd, action: 'update', dryRun: true });
33
22
  if (!local) {
34
23
  console.log('Checking the latest Basklee Svelte release…');
35
24
  await npm(['exec', '--yes', '--prefer-online', '--package=basklee-svelte@latest', '--',
36
25
  'basklee-svelte', 'update', '--local', '--cwd', cwd, ...(dryRun ? ['--dry-run'] : [])], cwd);
37
26
  return null; // The latest CLI reports its own changes.
38
27
  }
39
- if (legacy && dryRun) {
40
- printMigration(legacy, true);
41
- for (const file of legacy.files) console.log(` ${file}`);
42
- console.log('The template update is planned after the rename: run update without --dry-run, then update --dry-run again.');
43
- return null;
44
- }
45
28
  if (dryRun) return preview;
46
- if (legacy) printMigration(await migrateLegacyProject({ cwd, packageName: PACKAGE.name, version: PACKAGE.version }), false);
47
29
  const result = await setupProject({ cwd, action: 'update' });
48
30
  try {
49
31
  await npm(['install', '--no-audit', '--no-fund'], cwd);
@@ -157,13 +157,13 @@ The API response tables also explain the following contracts / Таблицы о
157
157
 
158
158
  | API | Contract / Контракт |
159
159
  | --- | --- |
160
- | [cart_guest_get](https://basklee.com/en/sandbox/api/cart_guest_get) · [RU](https://basklee.com/ru/sandbox/api/cart_guest_get) | Checkout options and saved choices / Опции оформления и сохранённый выбор |
161
- | [invoices_get](https://basklee.com/en/sandbox/api/invoices_get) · [RU](https://basklee.com/ru/sandbox/api/invoices_get) | Transaction direction and refunds / Направление платежей и возвраты |
162
- | [subscriptions_get](https://basklee.com/en/sandbox/api/subscriptions_get) · [RU](https://basklee.com/ru/sandbox/api/subscriptions_get) | Subscription state, renewal and service data / Состояние подписки, продление и данные сервиса |
163
- | [profile_promocodes_get](https://basklee.com/en/sandbox/api/profile_promocodes_get) · [RU](https://basklee.com/ru/sandbox/api/profile_promocodes_get) | Issued codes and promotion conditions / Выданные коды и условия акций |
164
- | [orders_create](https://basklee.com/en/sandbox/api/orders_create) · [RU](https://basklee.com/ru/sandbox/api/orders_create) | Failure fields and recovery / Поля ошибок и исправление |
165
- | [profile_orders_get](https://basklee.com/en/sandbox/api/profile_orders_get) · [RU](https://basklee.com/ru/sandbox/api/profile_orders_get) | Ordered options, returns and downloads / Купленные опции, возвраты и загрузки |
166
- | [subscriptions_guest_search](https://basklee.com/en/sandbox/api/subscriptions_guest_search) · [RU](https://basklee.com/ru/sandbox/api/subscriptions_guest_search) | Plan parameters, units and headings / Параметры тарифа, единицы и подписи |
160
+ | [cart_guest_get](https://docs.basklee.com/en/sandbox/api/cart_guest_get) · [RU](https://docs.basklee.com/ru/sandbox/api/cart_guest_get) | Checkout options and saved choices / Опции оформления и сохранённый выбор |
161
+ | [invoices_get](https://docs.basklee.com/en/sandbox/api/invoices_get) · [RU](https://docs.basklee.com/ru/sandbox/api/invoices_get) | Transaction direction and refunds / Направление платежей и возвраты |
162
+ | [subscriptions_get](https://docs.basklee.com/en/sandbox/api/subscriptions_get) · [RU](https://docs.basklee.com/ru/sandbox/api/subscriptions_get) | Subscription state, renewal and service data / Состояние подписки, продление и данные сервиса |
163
+ | [profile_promocodes_get](https://docs.basklee.com/en/sandbox/api/profile_promocodes_get) · [RU](https://docs.basklee.com/ru/sandbox/api/profile_promocodes_get) | Issued codes and promotion conditions / Выданные коды и условия акций |
164
+ | [orders_create](https://docs.basklee.com/en/sandbox/api/orders_create) · [RU](https://docs.basklee.com/ru/sandbox/api/orders_create) | Failure fields and recovery / Поля ошибок и исправление |
165
+ | [profile_orders_get](https://docs.basklee.com/en/sandbox/api/profile_orders_get) · [RU](https://docs.basklee.com/ru/sandbox/api/profile_orders_get) | Ordered options, returns and downloads / Купленные опции, возвраты и загрузки |
166
+ | [subscriptions_guest_search](https://docs.basklee.com/en/sandbox/api/subscriptions_guest_search) · [RU](https://docs.basklee.com/ru/sandbox/api/subscriptions_guest_search) | Plan parameters, units and headings / Параметры тарифа, единицы и подписи |
167
167
 
168
168
  ## Cart loading / Загрузка корзины
169
169
 
@@ -61,7 +61,7 @@ The following tables describe the response and the supplied composition’s foll
61
61
  | Выбрать пункт выдачи | Запрос `cart_customer_delivery_points_get` получает те же ID отправления и типа, возвращая `page_data.items`. Передайте выбранный объект `point`, включая код, код города и адрес, вместе с этими ID в `cart_customer_delivery_pickup_set`. |
62
62
  | После успешного сохранения | Ответ содержит `page_data.delivery_price_is_estimate`, без обновлённого отправления. Контроллер корзины закрывает выбор и вызывает `cart_guest_get`, чтобы получить подтверждённые способ, адрес, даты и итоги. При отказе показывается ошибка. Если не удалась только повторная загрузка, обновите корзину без повторения успешного сохранения. |
63
63
 
64
- [English guide](https://basklee.com/en/sandbox/components/svelte/cart-delivery-selector) · [Русский](https://basklee.com/ru/sandbox/components/svelte/cart-delivery-selector)
64
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/cart-delivery-selector) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/cart-delivery-selector)
65
65
 
66
66
  ## Parent cart loading / Загрузка корзины
67
67
 
@@ -71,4 +71,4 @@ The following tables describe the response and the supplied composition’s foll
71
71
  | `option_group_required` | True помечает группу обязательной. Для текста нужен непустой сохранённый текст, для файла — сохранённое имя, для товарной группы — опция с положительным количеством. |
72
72
  | Очистка | `cart_customer_option_cleanup_additional` получает `option_group_id: group.id` и очищает сохранённые текст/файл. Ошибка сохранения сохраняет локальный ввод; подтверждённое сохранение обновляет корзину. |
73
73
 
74
- [English guide](https://basklee.com/en/sandbox/components/svelte/cart-item-options) · [Русский](https://basklee.com/ru/sandbox/components/svelte/cart-item-options)
74
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/cart-item-options) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/cart-item-options)
@@ -51,4 +51,4 @@ The following tables describe the response and the supplied composition’s foll
51
51
  | Удаление в CHECKOUT | Передайте `product.dlf_id` как `dlf_item_id` в `cart_customer_remove_by_dlf_item`. После подтверждения загрузите все отправки и суммы корзины заново. |
52
52
  | Недоступные или неполные данные | `unavailable` скрывает редактирование количества. Если суммы позиции отправки/корзины отсутствуют, выводится `product.product_price_dict`; эта цена не подтверждает итог оформления. |
53
53
 
54
- [English guide](https://basklee.com/en/sandbox/components/svelte/cart-line-item) · [Русский](https://basklee.com/ru/sandbox/components/svelte/cart-line-item)
54
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/cart-line-item) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/cart-line-item)
@@ -51,4 +51,4 @@ The following tables describe the response and the supplied composition’s foll
51
51
  | Полученные `link` и `link_type` | Описывают следующую страницу оплаты. Родитель при необходимости передаёт их в `PaymentPanel` и загружает `profile_orders_get`. Пустая ссылка может означать, что внешняя страница не нужна; результат подтверждает обновлённое состояние платежа/заказа. |
52
52
  | `onCancel` / `pending` | Cancel без данных просит родителя закрыть форму. Pending блокирует выбор и обе кнопки. Ошибка сохранения оставляет форму и выбранный способ для исправления. |
53
53
 
54
- [English guide](https://basklee.com/en/sandbox/components/svelte/order-payment-form) · [Русский](https://basklee.com/ru/sandbox/components/svelte/order-payment-form)
54
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/order-payment-form) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/order-payment-form)
@@ -67,4 +67,4 @@ The following tables describe the response and the supplied composition’s foll
67
67
  | `onRefresh` | Событие без данных при проверке состояния. Кошелёк обновляет платежи и баланс профиля; страница заказов загружает `profile_orders_get`. |
68
68
  | `onClose` | Событие без данных. Готовый родитель скрывает панель и обновляет те же данные кошелька или заказа. Закрытие меняет видимость панели, а завершение оплаты определяется полученным состоянием платежа/заказа. |
69
69
 
70
- [English guide](https://basklee.com/en/sandbox/components/svelte/payment-panel) · [Русский](https://basklee.com/ru/sandbox/components/svelte/payment-panel)
70
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/payment-panel) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/payment-panel)
@@ -142,6 +142,15 @@
142
142
  );
143
143
  const specialOptions = computed(() =>
144
144
  [
145
+ {
146
+ // Out-of-stock products stay listed; the option is offered when the scope has some.
147
+ key: 'only_in_stock',
148
+ title: labels.value.inStock,
149
+ value: 'true',
150
+ visible:
151
+ (browseStore.searchFacets?.selects.out_of_stock ?? 0) > 0 ||
152
+ browseStore.searchFilters.only_in_stock === 'true',
153
+ },
145
154
  {
146
155
  key: 'avg_raiting_from',
147
156
  title: labels.value.ratedProducts,
@@ -62,4 +62,4 @@ The following tables describe the response and the supplied composition’s foll
62
62
  | Отмена продления | Подписка активна, `cancelled_date` отсутствует, у тарифа есть периоды или уже настроено продление. |
63
63
  | После подтверждённого изменения | Загрузите `subscriptions_get` и `profile_get`: используйте полученные тариф, даты, продление, признак ожидания и баланс. Если обновление не удалось, повторите его до следующего действия с оплатой. |
64
64
 
65
- [English guide](https://basklee.com/en/sandbox/components/svelte/subscriptions) · [Русский](https://basklee.com/ru/sandbox/components/svelte/subscriptions)
65
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/subscriptions) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/subscriptions)
@@ -70,4 +70,4 @@ The following tables describe the response and the supplied composition’s foll
70
70
  | `sales_module`, `blog_module`, `qr_module` | Логические признаки модулей продаж, блога и QR-маркировки остатков. Справочник встроенных параметров находится в `subscriptions_guest_search`. |
71
71
  | Параметр уже показан рядом с использованием | Его предел исключается из отдельного списка параметров тарифа, чтобы выводиться один раз. |
72
72
 
73
- [English guide](https://basklee.com/en/sandbox/components/svelte/subscription-plan) · [Русский](https://basklee.com/ru/sandbox/components/svelte/subscription-plan)
73
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/subscription-plan) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/subscription-plan)
@@ -71,7 +71,7 @@ The following tables describe the response and the supplied composition’s foll
71
71
  | Пример пакета | `host: shop.example` и `enabled: false` дают две строки. Вложенный объект `settings` по умолчанию не выводится. Явный список fields только с `host` оставляет лишь это сведение. |
72
72
  | Собственные сведения | Snippet `details` получает исходные `data` и отфильтрованные `entries`. Выберите поля для отображения. |
73
73
 
74
- [English guide](https://basklee.com/en/sandbox/components/svelte/subscription-remote) · [Русский](https://basklee.com/ru/sandbox/components/svelte/subscription-remote)
74
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/subscription-remote) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/subscription-remote)
75
75
 
76
76
  ## Initial service setup / Первичная настройка сервиса
77
77
 
@@ -68,4 +68,4 @@ The following tables describe the response and the supplied composition’s foll
68
68
  | Нет доступного оплаченного периода; средств недостаточно | Настройка продления успешно сохраняется, но период не покупается. Покажите текущую дату окончания и баланс; для оплаты продления покупателю нужно пополнить баланс. |
69
69
  | После `onSubmit` | Родитель отправляет запрос и загружает `subscriptions_get` и `profile_get`. `renew_period` подтверждает настройку; `active_until` и признак синхронизации определяют состояние доступа. Успех сам по себе подтверждает сохранение настройки, но не новый оплаченный доступ. |
70
70
 
71
- [English guide](https://basklee.com/en/sandbox/components/svelte/subscription-renewal) · [Русский](https://basklee.com/ru/sandbox/components/svelte/subscription-renewal)
71
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/subscription-renewal) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/subscription-renewal)
@@ -67,4 +67,4 @@ The following tables describe the response and the supplied composition’s foll
67
67
  | `refunds[].status.int` | Позиция возврата описывает операцию возврата. Завершение подтверждает только `EInvoiceStatus.COMPLETED`; `to_balance` указывает возврат на баланс или исходный способ оплаты. |
68
68
  | Проверка состояния или закрытие | Готовый кошелёк загружает `invoices_get` и `profile_get`, затем берёт баланс из `wallet` текущего профиля. Оплату подтверждает полученное состояние; открытие или закрытие `PaymentPanel` само по себе её не подтверждает. |
69
69
 
70
- [English guide](https://basklee.com/en/sandbox/components/svelte/wallet) · [Русский](https://basklee.com/ru/sandbox/components/svelte/wallet)
70
+ [English guide](https://docs.basklee.com/en/sandbox/components/svelte/wallet) · [Русский](https://docs.basklee.com/ru/sandbox/components/svelte/wallet)
@@ -33,6 +33,7 @@ export interface IProductSearchFilters {
33
33
  only_featured?: boolean;
34
34
  only_new?: boolean;
35
35
  with_discount?: boolean;
36
+ only_in_stock?: boolean;
36
37
  is_good_for_promo?: number;
37
38
  price_currency?: number;
38
39
  price_from?: number;
@@ -113,6 +114,7 @@ export interface IProductSearchChoices {
113
114
  any: number;
114
115
  };
115
116
  raiting_above_45: number;
117
+ out_of_stock: number;
116
118
  }
117
119
 
118
120
  export interface IProductSearchResponse {
@@ -12,6 +12,8 @@ export interface IProductSearchFacets {
12
12
  };
13
13
  discounts?: { any: number };
14
14
  raiting_above_45?: number;
15
+ // Listed products that cannot be bought now; the in-stock filter hides them.
16
+ out_of_stock?: number;
15
17
  manufacture?: { id: number; name: string; count: number }[];
16
18
  };
17
19
  variants?: Record<
@@ -9,6 +9,7 @@ export function browseLabels(locale: string) {
9
9
  applyPrice: 'Применить',
10
10
  moreFilters: 'Дополнительно',
11
11
  discountFrom: 'Скидка от, %',
12
+ inStock: 'Только в наличии',
12
13
  ratedProducts: 'Товары с оценкой от 4,5',
13
14
  ratedSellers: 'Продавцы с оценкой от 4,5',
14
15
  withReviews: 'Только с отзывами',
@@ -56,6 +57,7 @@ export function browseLabels(locale: string) {
56
57
  applyPrice: 'Aplicar',
57
58
  moreFilters: 'Más filtros',
58
59
  discountFrom: 'Descuento mínimo, %',
60
+ inStock: 'Solo en stock',
59
61
  ratedProducts: 'Productos con valoración de 4,5 o más',
60
62
  ratedSellers: 'Vendedores con valoración de 4,5 o más',
61
63
  withReviews: 'Solo con reseñas',
@@ -103,6 +105,7 @@ export function browseLabels(locale: string) {
103
105
  applyPrice: 'Apply',
104
106
  moreFilters: 'More filters',
105
107
  discountFrom: 'Minimum discount, %',
108
+ inStock: 'In stock only',
106
109
  ratedProducts: 'Products rated 4.5 and above',
107
110
  ratedSellers: 'Sellers rated 4.5 and above',
108
111
  withReviews: 'With reviews only',
@@ -1,8 +1,8 @@
1
1
  // The product page's schema.org data for search engines: Google merchant
2
2
  // listings and Yandex product snippets read the same block. Every value
3
3
  // repeats what the page shows: the price and the crossed-out old price,
4
- // stock, return terms, photos, brand, seller and rating. The delivery cost is
5
- // left out: it depends on the buyer's address.
4
+ // stock (or a preorder), return terms, photos, brand, seller and rating. The
5
+ // delivery cost is left out: it depends on the buyer's address.
6
6
  // The same file is in the three packages; it has no imports so that it stays
7
7
  // identical.
8
8
 
@@ -49,6 +49,12 @@ export interface StorefrontProductDataOptions {
49
49
  shippingCountries: string[];
50
50
  /** False when the page hides the seller (single-seller storefront). */
51
51
  showSeller: boolean;
52
+ /**
53
+ * True when the page offers a preorder instead of «Add to cart»
54
+ * (productAvailability().canPreorder): the offer is PreOrder, not OutOfStock.
55
+ * Yandex hides the price of an out-of-stock offer.
56
+ */
57
+ preorder?: boolean;
52
58
  /** Makes an image address complete (storefrontAbsoluteUrl). */
53
59
  absoluteUrl: (value: string | undefined) => string | undefined;
54
60
  }
@@ -158,8 +164,16 @@ export function storefrontProductStructuredData(
158
164
  ON_SALE_STATUSES.includes(product.status?.status) &&
159
165
  product.c_real_left > 0;
160
166
  const returns = productReturnPolicy(product, options.shippingCountries);
161
- const brand = product.manufacture?.name?.trim();
167
+ // Yandex requires a brand: without a manufacturer the seller (in a
168
+ // single-seller storefront, the shop itself) made the product.
169
+ const brand =
170
+ product.manufacture?.name?.trim() || product.seller?.name?.trim();
162
171
  const seller = options.showSeller ? product.seller?.name?.trim() : '';
172
+ const availability = inStock
173
+ ? 'InStock'
174
+ : options.preorder
175
+ ? 'PreOrder'
176
+ : 'OutOfStock';
163
177
  const reviews = Number(product.feedback_stat?.c_feedbacks ?? 0);
164
178
  const rating = Number(product.feedback_stat?.avg_raiting ?? 0);
165
179
  const offer =
@@ -180,7 +194,7 @@ export function storefrontProductStructuredData(
180
194
  },
181
195
  }
182
196
  : {}),
183
- 'availability': `${SCHEMA_ORG}${inStock ? 'InStock' : 'OutOfStock'}`,
197
+ 'availability': `${SCHEMA_ORG}${availability}`,
184
198
  'itemCondition': `${SCHEMA_ORG}NewCondition`,
185
199
  ...(returns ? { hasMerchantReturnPolicy: returns } : {}),
186
200
  ...(seller
@@ -7,6 +7,7 @@
7
7
  import { useBaskleeServerData } from '@/lib/composables/useBaskleeServerData.svelte';
8
8
  import { requestProductPage } from '@/lib/utils/basklee/productPage';
9
9
  import { storefrontAbsoluteUrl } from '@/lib/utils/basklee/pageSeo';
10
+ import { productAvailability } from '@/lib/utils/basklee/productAvailability';
10
11
  import {
11
12
  shippingCountryCodes,
12
13
  storefrontProductStructuredData,
@@ -116,6 +117,11 @@
116
117
  store.init?.shipping_countries,
117
118
  ),
118
119
  showSeller: !store.init?.visual_settings?.single_seller_mode,
120
+ // A preorder offered instead of «Add to cart» is PreOrder, not OutOfStock.
121
+ preorder: productAvailability(
122
+ product.value,
123
+ store.init?.variables?.allow_preorder,
124
+ ).canPreorder,
119
125
  absoluteUrl: (value) => storefrontAbsoluteUrl(value, origin),
120
126
  }),
121
127
  });
package/src/migrate.mjs DELETED
@@ -1,124 +0,0 @@
1
- // Projects made before the rename to Basklee (2026-11) use the orionplace-<framework> package, the orionplace/
2
- // folders, Orionplace* names and ORIONPLACE_* settings. update renames them in the project's own files first, so
3
- // the template update that follows sees an ordinary Basklee project. Domains *.orionplace.app keep their name.
4
- import { createHash } from 'node:crypto';
5
- import { existsSync } from 'node:fs';
6
- import { mkdir, readdir, readFile, rm, rmdir, stat, writeFile } from 'node:fs/promises';
7
- import { dirname, join, relative, sep } from 'node:path';
8
-
9
- const OLD_DIR = 'orionplace';
10
- const SKIP_DIRS = new Set(['node_modules', '.git', '.nuxt', '.output', '.next', '.svelte-kit', '.vercel', '.netlify',
11
- 'dist', 'build', '.gradle', '.cache', '.turbo']);
12
- const MAX_BYTES = 5 * 1024 * 1024;
13
- const RULES = [
14
- [/Orion ?Marketplace(?!\.app\b)/g, 'Basklee'], // the product's old name in comments copied from the templates
15
- [/ORIONPLACE(?!\.APP\b)/g, 'BASKLEE'],
16
- [/Orionplace(?!\.app\b)/g, 'Basklee'],
17
- [/orionplace(?!\.app\b)/g, 'basklee'],
18
- ];
19
-
20
- const hash = (text) => createHash('sha256').update(text).digest('hex');
21
- const rename = (text) => RULES.reduce((out, [re, to]) => out.replace(re, to), text);
22
- const toPosix = (path) => path.split(sep).join('/');
23
-
24
- async function isLegacy(root) {
25
- if (existsSync(join(root, OLD_DIR, '.generated.json'))) return true;
26
- try {
27
- const pkg = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
28
- return Object.keys({ ...pkg.dependencies, ...pkg.devDependencies }).some((name) => /^orionplace-(nuxt|react|svelte)$/.test(name));
29
- } catch {
30
- return false;
31
- }
32
- }
33
-
34
- async function walk(root, dir = root, files = []) {
35
- for (const entry of await readdir(dir, { withFileTypes: true })) {
36
- if (entry.isDirectory()) {
37
- if (SKIP_DIRS.has(entry.name) || entry.name.startsWith('.basklee-backup-')) continue;
38
- await walk(root, join(dir, entry.name), files);
39
- } else if (entry.isFile()) {
40
- files.push(toPosix(relative(root, join(dir, entry.name))));
41
- }
42
- }
43
- return files;
44
- }
45
-
46
- /**
47
- * Renames an old project in place. Returns null for a project that needs nothing, else
48
- * { files, moved, backup, dependency } — with dryRun nothing is written.
49
- * version: the version of the new package written into package.json.
50
- */
51
- export async function migrateLegacyProject({ cwd, dryRun = false, packageName, version }) {
52
- if (!(await isLegacy(cwd))) return null;
53
- const changes = new Map(); // old relative path -> { to, content (string | Buffer), changed }
54
- for (const path of await walk(cwd)) {
55
- const to = path.split('/').map(rename).join('/');
56
- const info = await stat(join(cwd, path));
57
- let content = null;
58
- if (info.size <= MAX_BYTES) {
59
- const buf = await readFile(join(cwd, path));
60
- if (!buf.subarray(0, 8000).includes(0)) {
61
- const text = buf.toString('utf8');
62
- const next = rename(text);
63
- if (next !== text) content = next;
64
- }
65
- }
66
- if (to !== path || content !== null) changes.set(path, { to, content });
67
- }
68
-
69
- // Generated-file record: a file still equal to what the package wrote stays "unchanged" after the rename, so the
70
- // template update may replace it; a file the owner edited stays edited.
71
- const oldRecord = join(OLD_DIR, '.generated.json');
72
- if (existsSync(join(cwd, oldRecord))) {
73
- const previous = JSON.parse(await readFile(join(cwd, oldRecord), 'utf8'));
74
- const record = {};
75
- for (const [name, sum] of Object.entries(previous)) {
76
- const newName = name.split('/').map(rename).join('/');
77
- let current = null;
78
- try { current = await readFile(join(cwd, name), 'utf8'); } catch { /* removed by the owner */ }
79
- record[newName] = current !== null && hash(current) === sum ? hash(rename(current)) : sum;
80
- }
81
- changes.set(oldRecord, { to: rename(oldRecord), content: JSON.stringify(record, null, 2) + '\n' });
82
- }
83
-
84
- // package.json: the new package at the running version (the old pin names a version the new package lacks).
85
- const pkgPath = 'package.json';
86
- if (existsSync(join(cwd, pkgPath))) {
87
- const text = changes.get(pkgPath)?.content ?? await readFile(join(cwd, pkgPath), 'utf8');
88
- const pkg = JSON.parse(text);
89
- for (const field of ['dependencies', 'devDependencies']) {
90
- if (pkg[field]?.[packageName] !== undefined && version) pkg[field][packageName] = version;
91
- }
92
- changes.set(pkgPath, { to: pkgPath, content: JSON.stringify(pkg, null, 2) + '\n' });
93
- }
94
-
95
- const files = [...changes].filter(([, c]) => c.content !== null).map(([from, c]) => c.to === from ? from : `${from} -> ${c.to}`);
96
- const moved = [...changes].filter(([from, c]) => c.to !== from).length;
97
- const backup = `.basklee-backup-${new Date().toISOString().replace(/[-:]/g, '').slice(0, 15)}`;
98
- if (dryRun) return { files, moved, backup: null, dependency: `${packageName}@${version}` };
99
-
100
- // Backup of every file the migration touches, at its old path.
101
- for (const [from] of changes) {
102
- const target = join(cwd, backup, from);
103
- await mkdir(dirname(target), { recursive: true });
104
- await writeFile(target, await readFile(join(cwd, from)));
105
- }
106
- for (const [from, { to, content }] of changes) {
107
- const source = join(cwd, from);
108
- const target = join(cwd, to);
109
- const data = content ?? await readFile(source);
110
- await mkdir(dirname(target), { recursive: true });
111
- await writeFile(target, data, { mode: (await stat(source)).mode });
112
- if (to !== from) await rm(source);
113
- }
114
- // Folders left empty by the moves (deepest first).
115
- const dirs = new Set();
116
- for (const [from, { to }] of changes) {
117
- if (to === from) continue;
118
- for (let dir = dirname(from); dir !== '.'; dir = dirname(dir)) dirs.add(dir);
119
- }
120
- for (const dir of [...dirs].sort((a, b) => b.split('/').length - a.split('/').length)) {
121
- try { await rmdir(join(cwd, dir)); } catch { /* not empty: holds files the migration did not move */ }
122
- }
123
- return { files, moved, backup, dependency: `${packageName}@${version}` };
124
- }