@stapel/listings-react 0.1.0
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/CHANGELOG.md +1 -0
- package/MODULE.md +191 -0
- package/README.md +169 -0
- package/dist/api/generated/schema.d.ts +1253 -0
- package/dist/api/generated/schema.d.ts.map +1 -0
- package/dist/api/generated/schema.js +2 -0
- package/dist/api/generated/schema.js.map +1 -0
- package/dist/api/listingsApi.d.ts +145 -0
- package/dist/api/listingsApi.d.ts.map +1 -0
- package/dist/api/listingsApi.js +38 -0
- package/dist/api/listingsApi.js.map +1 -0
- package/dist/api/types.d.ts +156 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +37 -0
- package/dist/api/types.js.map +1 -0
- package/dist/default/ErrorAlert.d.ts +9 -0
- package/dist/default/ErrorAlert.d.ts.map +1 -0
- package/dist/default/ErrorAlert.js +27 -0
- package/dist/default/ErrorAlert.js.map +1 -0
- package/dist/default/FavoritesPane.d.ts +18 -0
- package/dist/default/FavoritesPane.d.ts.map +1 -0
- package/dist/default/FavoritesPane.js +28 -0
- package/dist/default/FavoritesPane.js.map +1 -0
- package/dist/default/ListingCard.d.ts +42 -0
- package/dist/default/ListingCard.d.ts.map +1 -0
- package/dist/default/ListingCard.js +37 -0
- package/dist/default/ListingCard.js.map +1 -0
- package/dist/default/ListingComposerPage.d.ts +46 -0
- package/dist/default/ListingComposerPage.d.ts.map +1 -0
- package/dist/default/ListingComposerPage.js +99 -0
- package/dist/default/ListingComposerPage.js.map +1 -0
- package/dist/default/ListingDetailPane.d.ts +33 -0
- package/dist/default/ListingDetailPane.d.ts.map +1 -0
- package/dist/default/ListingDetailPane.js +48 -0
- package/dist/default/ListingDetailPane.js.map +1 -0
- package/dist/default/ListingPhoto.d.ts +25 -0
- package/dist/default/ListingPhoto.d.ts.map +1 -0
- package/dist/default/ListingPhoto.js +20 -0
- package/dist/default/ListingPhoto.js.map +1 -0
- package/dist/default/MyListingsPane.d.ts +25 -0
- package/dist/default/MyListingsPane.d.ts.map +1 -0
- package/dist/default/MyListingsPane.js +84 -0
- package/dist/default/MyListingsPane.js.map +1 -0
- package/dist/default/StatusTags.d.ts +31 -0
- package/dist/default/StatusTags.d.ts.map +1 -0
- package/dist/default/StatusTags.js +40 -0
- package/dist/default/StatusTags.js.map +1 -0
- package/dist/default/icons.d.ts +16 -0
- package/dist/default/icons.d.ts.map +1 -0
- package/dist/default/icons.js +5 -0
- package/dist/default/icons.js.map +1 -0
- package/dist/default/index.d.ts +35 -0
- package/dist/default/index.d.ts.map +1 -0
- package/dist/default/index.js +26 -0
- package/dist/default/index.js.map +1 -0
- package/dist/default/theme.d.ts +25 -0
- package/dist/default/theme.d.ts.map +1 -0
- package/dist/default/theme.js +40 -0
- package/dist/default/theme.js.map +1 -0
- package/dist/default/types.d.ts +12 -0
- package/dist/default/types.d.ts.map +1 -0
- package/dist/default/types.js +2 -0
- package/dist/default/types.js.map +1 -0
- package/dist/flows/registry.d.ts +35 -0
- package/dist/flows/registry.d.ts.map +1 -0
- package/dist/flows/registry.js +33 -0
- package/dist/flows/registry.js.map +1 -0
- package/dist/headless/Favorites.d.ts +52 -0
- package/dist/headless/Favorites.d.ts.map +1 -0
- package/dist/headless/Favorites.js +78 -0
- package/dist/headless/Favorites.js.map +1 -0
- package/dist/headless/ListingActions.d.ts +30 -0
- package/dist/headless/ListingActions.d.ts.map +1 -0
- package/dist/headless/ListingActions.js +54 -0
- package/dist/headless/ListingActions.js.map +1 -0
- package/dist/headless/ListingComposer.d.ts +133 -0
- package/dist/headless/ListingComposer.d.ts.map +1 -0
- package/dist/headless/ListingComposer.js +246 -0
- package/dist/headless/ListingComposer.js.map +1 -0
- package/dist/headless/ListingDetail.d.ts +81 -0
- package/dist/headless/ListingDetail.d.ts.map +1 -0
- package/dist/headless/ListingDetail.js +101 -0
- package/dist/headless/ListingDetail.js.map +1 -0
- package/dist/headless/ListingsProvider.d.ts +17 -0
- package/dist/headless/ListingsProvider.d.ts.map +1 -0
- package/dist/headless/ListingsProvider.js +16 -0
- package/dist/headless/ListingsProvider.js.map +1 -0
- package/dist/headless/MyListings.d.ts +44 -0
- package/dist/headless/MyListings.d.ts.map +1 -0
- package/dist/headless/MyListings.js +82 -0
- package/dist/headless/MyListings.js.map +1 -0
- package/dist/headless/useMandateGate.d.ts +28 -0
- package/dist/headless/useMandateGate.d.ts.map +1 -0
- package/dist/headless/useMandateGate.js +39 -0
- package/dist/headless/useMandateGate.js.map +1 -0
- package/dist/i18n/errorsMap.d.ts +34 -0
- package/dist/i18n/errorsMap.d.ts.map +1 -0
- package/dist/i18n/errorsMap.js +45 -0
- package/dist/i18n/errorsMap.js.map +1 -0
- package/dist/i18n/es.d.ts +21 -0
- package/dist/i18n/es.d.ts.map +1 -0
- package/dist/i18n/es.js +146 -0
- package/dist/i18n/es.js.map +1 -0
- package/dist/i18n/generated/errors.es.gen.d.ts +16 -0
- package/dist/i18n/generated/errors.es.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.es.gen.js +58 -0
- package/dist/i18n/generated/errors.es.gen.js.map +1 -0
- package/dist/i18n/generated/errors.gen.d.ts +413 -0
- package/dist/i18n/generated/errors.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.gen.js +210 -0
- package/dist/i18n/generated/errors.gen.js.map +1 -0
- package/dist/i18n/generated/errors.ru.gen.d.ts +16 -0
- package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -0
- package/dist/i18n/generated/errors.ru.gen.js +58 -0
- package/dist/i18n/generated/errors.ru.gen.js.map +1 -0
- package/dist/i18n/keys.d.ts +170 -0
- package/dist/i18n/keys.d.ts.map +1 -0
- package/dist/i18n/keys.js +295 -0
- package/dist/i18n/keys.js.map +1 -0
- package/dist/i18n/ru.d.ts +37 -0
- package/dist/i18n/ru.d.ts.map +1 -0
- package/dist/i18n/ru.js +162 -0
- package/dist/i18n/ru.js.map +1 -0
- package/dist/index.d.ts +103 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +98 -0
- package/dist/index.js.map +1 -0
- package/dist/model/context.d.ts +11 -0
- package/dist/model/context.d.ts.map +1 -0
- package/dist/model/context.js +16 -0
- package/dist/model/context.js.map +1 -0
- package/dist/model/draft.d.ts +138 -0
- package/dist/model/draft.d.ts.map +1 -0
- package/dist/model/draft.js +192 -0
- package/dist/model/draft.js.map +1 -0
- package/dist/model/features.d.ts +69 -0
- package/dist/model/features.d.ts.map +1 -0
- package/dist/model/features.js +73 -0
- package/dist/model/features.js.map +1 -0
- package/dist/model/mineSource.d.ts +47 -0
- package/dist/model/mineSource.d.ts.map +1 -0
- package/dist/model/mineSource.js +45 -0
- package/dist/model/mineSource.js.map +1 -0
- package/dist/model/mutations.d.ts +60 -0
- package/dist/model/mutations.d.ts.map +1 -0
- package/dist/model/mutations.js +165 -0
- package/dist/model/mutations.js.map +1 -0
- package/dist/model/queries.d.ts +75 -0
- package/dist/model/queries.d.ts.map +1 -0
- package/dist/model/queries.js +117 -0
- package/dist/model/queries.js.map +1 -0
- package/dist/model/queryKeys.d.ts +50 -0
- package/dist/model/queryKeys.d.ts.map +1 -0
- package/dist/model/queryKeys.js +24 -0
- package/dist/model/queryKeys.js.map +1 -0
- package/dist/model/runtime.d.ts +69 -0
- package/dist/model/runtime.d.ts.map +1 -0
- package/dist/model/runtime.js +14 -0
- package/dist/model/runtime.js.map +1 -0
- package/dist/model/status.d.ts +117 -0
- package/dist/model/status.d.ts.map +1 -0
- package/dist/model/status.js +164 -0
- package/dist/model/status.js.map +1 -0
- package/dist/model/transitions.d.ts +41 -0
- package/dist/model/transitions.d.ts.map +1 -0
- package/dist/model/transitions.js +25 -0
- package/dist/model/transitions.js.map +1 -0
- package/dist/model/validation.d.ts +135 -0
- package/dist/model/validation.d.ts.map +1 -0
- package/dist/model/validation.js +191 -0
- package/dist/model/validation.js.map +1 -0
- package/dist/nav/manifest.d.ts +46 -0
- package/dist/nav/manifest.d.ts.map +1 -0
- package/dist/nav/manifest.js +56 -0
- package/dist/nav/manifest.js.map +1 -0
- package/llms.txt +118 -0
- package/manifest.json +1044 -0
- package/nav-manifest.json +84 -0
- package/package.json +121 -0
- package/src/analytics/generated/events.json +7 -0
- package/src/api/generated/schema.ts +1255 -0
- package/src/api/listingsApi.ts +237 -0
- package/src/api/types.ts +193 -0
- package/src/default/ErrorAlert.tsx +46 -0
- package/src/default/FavoritesPane.tsx +123 -0
- package/src/default/ListingCard.tsx +178 -0
- package/src/default/ListingComposerPage.tsx +466 -0
- package/src/default/ListingDetailPane.tsx +271 -0
- package/src/default/ListingPhoto.tsx +62 -0
- package/src/default/MyListingsPane.tsx +333 -0
- package/src/default/StatusTags.tsx +86 -0
- package/src/default/icons.tsx +31 -0
- package/src/default/index.ts +35 -0
- package/src/default/theme.tsx +67 -0
- package/src/default/types.ts +12 -0
- package/src/flows/registry.ts +45 -0
- package/src/headless/Favorites.tsx +137 -0
- package/src/headless/ListingActions.tsx +101 -0
- package/src/headless/ListingComposer.tsx +476 -0
- package/src/headless/ListingDetail.tsx +231 -0
- package/src/headless/ListingsProvider.tsx +20 -0
- package/src/headless/MyListings.tsx +148 -0
- package/src/headless/useMandateGate.ts +40 -0
- package/src/i18n/errorsMap.ts +62 -0
- package/src/i18n/es.ts +198 -0
- package/src/i18n/generated/errors.es.gen.ts +64 -0
- package/src/i18n/generated/errors.gen.ts +241 -0
- package/src/i18n/generated/errors.json +499 -0
- package/src/i18n/generated/errors.ru.gen.ts +64 -0
- package/src/i18n/keys.ts +356 -0
- package/src/i18n/ru.ts +215 -0
- package/src/index.ts +260 -0
- package/src/model/context.tsx +28 -0
- package/src/model/draft.ts +307 -0
- package/src/model/features.ts +122 -0
- package/src/model/mineSource.ts +55 -0
- package/src/model/mutations.ts +224 -0
- package/src/model/queries.ts +150 -0
- package/src/model/queryKeys.ts +76 -0
- package/src/model/runtime.ts +87 -0
- package/src/model/status.ts +279 -0
- package/src/model/transitions.ts +62 -0
- package/src/model/validation.ts +271 -0
- package/src/nav/manifest.ts +97 -0
- package/tsconfig.json +26 -0
package/dist/i18n/ru.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { listingsErrorBundleRu } from "./generated/errors.ru.gen.js";
|
|
2
|
+
export { listingsErrorBundleRu } from "./generated/errors.ru.gen.js";
|
|
3
|
+
/**
|
|
4
|
+
* Russian bundle for listings-react — the `@stapel/listings-react/i18n/ru`
|
|
5
|
+
* subpath (i18n-shipping.md §2) so the locale is opt-in: hosts that do not
|
|
6
|
+
* register it never carry these strings (the main entry does not import this
|
|
7
|
+
* module — gated by size-limit + the bundle-purity test).
|
|
8
|
+
*
|
|
9
|
+
* This is the storefront's DEFAULT language (darom-storefront verdict F1:
|
|
10
|
+
* ru-first), which is why the UI copy is here in full and not only the error
|
|
11
|
+
* keys: a seller filling in a listing is the surface where a half-translated
|
|
12
|
+
* form is most obvious.
|
|
13
|
+
*
|
|
14
|
+
* ── What comes from where ──────────────────────────────────────────────────
|
|
15
|
+
*
|
|
16
|
+
* `stapel-listings` ships **no `translations/` directory at all**, so 21 of
|
|
17
|
+
* the 63 registry codes can never come from an upstream catalogue. They split
|
|
18
|
+
* by owner:
|
|
19
|
+
*
|
|
20
|
+
* - the 42 cross-cutting `stapel_core` codes are GENERATED, merged in from
|
|
21
|
+
* stapel-core's own catalogue by `pnpm gen:errors` (spread first below);
|
|
22
|
+
* - the **9 `stapel_listings` codes** are authored here — and when upstream
|
|
23
|
+
* ships a catalogue, nine lines are deleted and no key or text moves;
|
|
24
|
+
* - the **12 `stapel_attributes` codes** are NOT here. They belong to
|
|
25
|
+
* `@stapel/attributes-react`, which already translates them and which is a
|
|
26
|
+
* peer of this pair anyway. Two packages must not give one refusal two
|
|
27
|
+
* sentences (spec §13.2, note 3). A host registers both bundles;
|
|
28
|
+
* `test/i18n.test.ts` proves the union covers the registry.
|
|
29
|
+
*
|
|
30
|
+
* PROVENANCE, stated rather than implied: the core catalogue ships
|
|
31
|
+
* `origin=seed:authored` and is UNREVIEWED; the pair-authored strings below
|
|
32
|
+
* are the same grade. Neither is a claim of review.
|
|
33
|
+
*/
|
|
34
|
+
export const listingsI18nBundleRu = {
|
|
35
|
+
...listingsErrorBundleRu,
|
|
36
|
+
// ── the 9 stapel_listings-owned codes, pair-authored ─────────────────────
|
|
37
|
+
"error.400.category_required": "Нужно выбрать категорию",
|
|
38
|
+
"error.400.image_required": "Чтобы опубликовать объявление, добавьте хотя бы одно фото",
|
|
39
|
+
"error.400.listing_feature_not_allowed": "Характеристика «{feature}» не относится к этой категории",
|
|
40
|
+
"error.400.publish_validation_failed": "Объявление не прошло проверку и не опубликовано",
|
|
41
|
+
"error.403.listing_not_owner": "Это не ваше объявление",
|
|
42
|
+
"error.404.listing_not_found": "Объявление не найдено",
|
|
43
|
+
"error.409.already_favorited": "Объявление уже в избранном",
|
|
44
|
+
"error.409.invalid_listing_transition": "Объявление в статусе «{from_status}» так перевести нельзя",
|
|
45
|
+
"error.409.listing_cannot_delete_active": "Сначала снимите объявление с публикации — активное удалить нельзя",
|
|
46
|
+
"listings.error.unknown": "Что-то пошло не так с этим объявлением",
|
|
47
|
+
"listings.status.draft": "Черновик",
|
|
48
|
+
"listings.status.pending": "На проверке",
|
|
49
|
+
"listings.status.published": "Опубликовано",
|
|
50
|
+
"listings.status.paused": "Приостановлено",
|
|
51
|
+
"listings.status.expired": "Срок вышел",
|
|
52
|
+
"listings.status.sold": "Продано",
|
|
53
|
+
"listings.status.rejected": "Отклонено",
|
|
54
|
+
"listings.status.blocked": "Снято модератором",
|
|
55
|
+
"listings.status.archived": "В архиве",
|
|
56
|
+
"listings.moderation.first_review": "Отправлено на проверку. Объявление появится в продаже после одобрения модератора.",
|
|
57
|
+
"listings.moderation.live_edit_pending": "Объявление остаётся опубликованным, пока мы проверяем правки — покупатели видят его прямо сейчас.",
|
|
58
|
+
"listings.moderation.pending_offline": "Проверка была запрошена, но объявление уже не в продаже.",
|
|
59
|
+
"listings.moderation.needs_review": "Объявление смотрит модератор вручную.",
|
|
60
|
+
"listings.moderation.live_needs_review": "Опубликовано, правки смотрит модератор вручную.",
|
|
61
|
+
"listings.moderation.rejected": "Модератор отклонил объявление. Исправьте и отправьте снова.",
|
|
62
|
+
"listings.moderation.rejected_still_live": "Модератор отклонил объявление; пока решение применяется, оно ещё видно.",
|
|
63
|
+
"listings.card.no_photo": "Без фото",
|
|
64
|
+
"listings.card.photo_unavailable": "Фото недоступно",
|
|
65
|
+
"listings.card.price_absent": "Цена по запросу",
|
|
66
|
+
"listings.card.favorite_add": "В избранное",
|
|
67
|
+
"listings.card.favorite_remove": "Убрать из избранного",
|
|
68
|
+
"listings.card.open": "Открыть",
|
|
69
|
+
"listings.detail.loading": "Загружаем объявление…",
|
|
70
|
+
"listings.detail.load_failed": "Не удалось загрузить объявление",
|
|
71
|
+
"listings.detail.retry": "Повторить",
|
|
72
|
+
"listings.detail.not_found": "По этому адресу объявления нет",
|
|
73
|
+
"listings.detail.removed": "Это объявление удалено",
|
|
74
|
+
"listings.detail.not_published": "Объявление сейчас не в продаже, и то, что вы видите, может быть неактуальным",
|
|
75
|
+
"listings.detail.owner_only_view": "Это видите только вы — объявление ещё не опубликовано",
|
|
76
|
+
"listings.detail.description": "Описание",
|
|
77
|
+
"listings.detail.specs": "Характеристики",
|
|
78
|
+
"listings.detail.no_specs": "Продавец не указал дополнительных характеристик",
|
|
79
|
+
"listings.detail.unreadable_features": "Характеристик, которые эта версия не смогла прочитать: {count}",
|
|
80
|
+
"listings.detail.photos_unavailable": "Фото здесь показать нельзя — приложению нечем их разрешить",
|
|
81
|
+
"listings.detail.photo_alt": "Фото {index} из {total}",
|
|
82
|
+
"listings.detail.published_at": "Опубликовано {date}",
|
|
83
|
+
"listings.detail.expires_at": "В продаже до {date}",
|
|
84
|
+
"listings.detail.stock": "В наличии: {count}",
|
|
85
|
+
"listings.compose.new_title": "Новое объявление",
|
|
86
|
+
"listings.compose.edit_title": "Редактирование объявления",
|
|
87
|
+
"listings.compose.category": "Категория",
|
|
88
|
+
"listings.compose.category_help": "От категории зависит, какие характеристики спросят у продавца",
|
|
89
|
+
"listings.compose.category_required": "Сначала выберите категорию",
|
|
90
|
+
"listings.compose.category_changed_dropped": "Ответов, которые не относятся к этой категории и были очищены: {count}",
|
|
91
|
+
"listings.compose.title_label": "Заголовок",
|
|
92
|
+
"listings.compose.title_too_long": "Заголовок должен быть не длиннее {max_length} символов",
|
|
93
|
+
"listings.compose.description_label": "Описание",
|
|
94
|
+
"listings.compose.price_label": "Цена",
|
|
95
|
+
"listings.compose.price_invalid": "Введите цену числом, не более двух знаков после запятой",
|
|
96
|
+
"listings.compose.currency_label": "Валюта",
|
|
97
|
+
"listings.compose.location_label": "Где находится",
|
|
98
|
+
"listings.compose.lat_label": "Широта",
|
|
99
|
+
"listings.compose.lon_label": "Долгота",
|
|
100
|
+
"listings.compose.geo_incomplete": "Рядом с широтой нужна долгота — половина координаты никуда не указывает",
|
|
101
|
+
"listings.compose.photos": "Фотографии",
|
|
102
|
+
"listings.compose.too_many_images": "К объявлению можно приложить не больше {max} фото",
|
|
103
|
+
"listings.compose.details": "Характеристики",
|
|
104
|
+
"listings.compose.details_loading": "Загружаем характеристики категории…",
|
|
105
|
+
"listings.compose.details_failed": "Не удалось загрузить характеристики категории",
|
|
106
|
+
"listings.compose.details_empty": "Эта категория не спрашивает дополнительных характеристик",
|
|
107
|
+
"listings.compose.countable": "Продаю штучный товар",
|
|
108
|
+
"listings.compose.stock": "Сколько штук",
|
|
109
|
+
"listings.compose.auto_republish": "Публиковать заново, когда истечёт срок",
|
|
110
|
+
"listings.compose.save": "Сохранить черновик",
|
|
111
|
+
"listings.compose.saving": "Сохраняем…",
|
|
112
|
+
"listings.compose.saved": "Черновик сохранён",
|
|
113
|
+
"listings.compose.publish": "Опубликовать",
|
|
114
|
+
"listings.compose.republish": "Отправить правки",
|
|
115
|
+
"listings.compose.publishing": "Отправляем…",
|
|
116
|
+
"listings.compose.published_first": "Отправлено на проверку. Объявление появится в продаже после одобрения модератора.",
|
|
117
|
+
"listings.compose.published_live": "Правки отправлены. Объявление остаётся опубликованным, пока мы их проверяем.",
|
|
118
|
+
"listings.compose.invalid_summary": "Прежде чем отправить, поправьте характеристик: {count}",
|
|
119
|
+
"listings.compose.blocked.no_category": "Выберите категорию — от неё зависит остальная форма",
|
|
120
|
+
"listings.compose.blocked.unsupported_type": "Эта категория спрашивает характеристику, которую приложение пока не умеет показывать ({types}), поэтому заполнить её здесь нельзя",
|
|
121
|
+
"listings.compose.blocked.photos_pending": "Дождитесь окончания загрузки фотографий",
|
|
122
|
+
"listings.compose.blocked.no_draft": "Черновик ещё не создан",
|
|
123
|
+
"listings.compose.blocked.busy": "Секунду — предыдущее изменение ещё сохраняется",
|
|
124
|
+
"listings.compose.blocked.mirror": "Сначала поправьте отмеченные поля",
|
|
125
|
+
"listings.compose.blocked.details_unavailable": "Не удалось загрузить характеристики категории, поэтому проверить форму нельзя",
|
|
126
|
+
"listings.mine.title": "Мои объявления",
|
|
127
|
+
"listings.mine.tab.active": "Активные",
|
|
128
|
+
"listings.mine.tab.drafts": "Черновики",
|
|
129
|
+
"listings.mine.tab.archived": "Архив",
|
|
130
|
+
"listings.mine.loading": "Загружаем ваши объявления…",
|
|
131
|
+
"listings.mine.load_failed": "Не удалось загрузить ваши объявления",
|
|
132
|
+
"listings.mine.empty": "Здесь пока пусто",
|
|
133
|
+
"listings.mine.retry": "Повторить",
|
|
134
|
+
"listings.mine.counters_failed": "Не удалось посчитать ваши объявления",
|
|
135
|
+
"listings.mine.source_missing": "Приложение пока не может перечислить ваши объявления: у сервиса объявлений нет списка, ограниченного владельцем. Счётчики ниже — настоящие.",
|
|
136
|
+
"listings.mine.live_under_review": "Опубликовано, правки на проверке",
|
|
137
|
+
"listings.mine.edit": "Редактировать",
|
|
138
|
+
"listings.mine.archive": "В архив",
|
|
139
|
+
"listings.mine.complete": "Отметить проданным",
|
|
140
|
+
"listings.mine.delete": "Удалить",
|
|
141
|
+
"listings.favorites.title": "Избранное",
|
|
142
|
+
"listings.favorites.loading": "Загружаем избранное…",
|
|
143
|
+
"listings.favorites.load_failed": "Не удалось загрузить избранное",
|
|
144
|
+
"listings.favorites.empty": "Вы ещё ничего не сохранили",
|
|
145
|
+
"listings.blocked.sign_in": "Войдите, чтобы сделать это",
|
|
146
|
+
"listings.blocked.guest": "Этот аккаунт пока так не может — сначала завершите настройку",
|
|
147
|
+
"listings.blocked.mandate_unknown": "Не удалось проверить ваш аккаунт, поэтому мы не угадываем, можно ли вам это",
|
|
148
|
+
"listings.blocked.transition": "Объявление в статусе «{from_status}» так перевести нельзя",
|
|
149
|
+
"listings.blocked.delete_active": "Сначала уберите в архив — объявление в продаже удалить нельзя",
|
|
150
|
+
"listings.blocked.in_flight": "Секунду — это уже выполняется",
|
|
151
|
+
"listings.page.prev": "Назад",
|
|
152
|
+
"listings.page.next": "Дальше",
|
|
153
|
+
"listings.nav.detail": "Объявление",
|
|
154
|
+
"listings.nav.compose": "Подать объявление",
|
|
155
|
+
"listings.nav.mine": "Мои объявления",
|
|
156
|
+
"listings.nav.favorites": "Избранное",
|
|
157
|
+
};
|
|
158
|
+
/** Register the Russian bundle into a core i18n engine. */
|
|
159
|
+
export function registerListingsI18nRu(i18n) {
|
|
160
|
+
i18n.registerBundle("ru", listingsI18nBundleRu);
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=ru.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ru.js","sourceRoot":"","sources":["../../src/i18n/ru.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAmB;IAClD,GAAG,qBAAqB;IAExB,4EAA4E;IAC5E,6BAA6B,EAAE,yBAAyB;IACxD,0BAA0B,EACxB,2DAA2D;IA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EAAE,mCAAmC;IACtE,8CAA8C,EAC5C,+EAA+E;IAEjF,qBAAqB,EAAE,gBAAgB;IACvC,0BAA0B,EAAE,UAAU;IACtC,0BAA0B,EAAE,WAAW;IACvC,4BAA4B,EAAE,OAAO;IACrC,uBAAuB,EAAE,4BAA4B;IACrD,2BAA2B,EAAE,sCAAsC;IACnE,qBAAqB,EAAE,kBAAkB;IACzC,qBAAqB,EAAE,WAAW;IAClC,+BAA+B,EAAE,sCAAsC;IACvE,8BAA8B,EAC5B,6IAA6I;IAC/I,iCAAiC,EAAE,kCAAkC;IACrE,oBAAoB,EAAE,eAAe;IACrC,uBAAuB,EAAE,SAAS;IAClC,wBAAwB,EAAE,oBAAoB;IAC9C,sBAAsB,EAAE,SAAS;IAEjC,0BAA0B,EAAE,WAAW;IACvC,4BAA4B,EAAE,sBAAsB;IACpD,gCAAgC,EAAE,gCAAgC;IAClE,0BAA0B,EAAE,4BAA4B;IAExD,0BAA0B,EAAE,4BAA4B;IACxD,wBAAwB,EACtB,8DAA8D;IAChE,kCAAkC,EAChC,6EAA6E;IAC/E,6BAA6B,EAC3B,2DAA2D;IAC7D,gCAAgC,EAC9B,+DAA+D;IACjE,4BAA4B,EAAE,+BAA+B;IAE7D,oBAAoB,EAAE,OAAO;IAC7B,oBAAoB,EAAE,QAAQ;IAE9B,qBAAqB,EAAE,YAAY;IACnC,sBAAsB,EAAE,mBAAmB;IAC3C,mBAAmB,EAAE,gBAAgB;IACrC,wBAAwB,EAAE,WAAW;CACtC,CAAC;AAEF,2DAA2D;AAC3D,MAAM,UAAU,sBAAsB,CAAC,IAAgB;IACrD,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;AAClD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@stapel/listings-react` — the headless React pair for stapel-listings
|
|
3
|
+
* (frontend-standard §2). Business + state only, zero visual opinion; the
|
|
4
|
+
* antd skin lives behind the `./default` subpath, so a host that renders its
|
|
5
|
+
* own shop window carries none of it.
|
|
6
|
+
*
|
|
7
|
+
* ── The one-liner ──────────────────────────────────────────────────────────
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const runtime = createListingsRuntime({
|
|
11
|
+
* baseUrl: "/listings/api/v1/",
|
|
12
|
+
* resolveImage: (ref) => myCdn.describe(ref),
|
|
13
|
+
* });
|
|
14
|
+
* <ListingsProvider runtime={runtime}>
|
|
15
|
+
* <ListingDetailPane id={id} />
|
|
16
|
+
* </ListingsProvider>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* ── The four properties this pair exists to guarantee ──────────────────────
|
|
20
|
+
*
|
|
21
|
+
* 1. **Two axes, both on screen, neither standing in for the other.**
|
|
22
|
+
* `status` decides visibility and nothing else does; `moderation_status`
|
|
23
|
+
* decides nothing about it. Since stapel-listings 0.5.0 they genuinely
|
|
24
|
+
* diverge — an edit to a LIVE listing keeps `status: published` and moves
|
|
25
|
+
* only the moderation axis — so "published, changes under review" is a
|
|
26
|
+
* sentence this pair can say, and a dashboard that computed either field
|
|
27
|
+
* from the other could not. `model/status.ts` produces both halves from
|
|
28
|
+
* both fields, once, and the 9 × 4 table is asserted.
|
|
29
|
+
* 2. **A refusal lands on the control that caused it.** `publish` answers an
|
|
30
|
+
* invalid draft with a BARE `ValidationBatchResult` (not an error
|
|
31
|
+
* envelope), and the engine's rows carry `{feature, slug}` and never
|
|
32
|
+
* `field`. `model/validation.ts` splits the two kinds of 400 apart and
|
|
33
|
+
* `featureErrorsBySlug` adds the routing key, so "this box is wrong" never
|
|
34
|
+
* degrades into "something is wrong".
|
|
35
|
+
* 3. **Every switched-off control states its reason.** Signing in, waiting
|
|
36
|
+
* for photos, a type this build cannot draw, a lifecycle move the server
|
|
37
|
+
* would refuse — each is an `ActionAvailability` with a named block, never
|
|
38
|
+
* a grey button and never a hidden one.
|
|
39
|
+
* 4. **An absence is never rendered as a zero.** A soft-deleted listing says
|
|
40
|
+
* it was removed rather than 404-ing like a typo; a stored feature this
|
|
41
|
+
* build cannot read is counted rather than dropped; and the owner's own
|
|
42
|
+
* listings — which stapel-listings 0.6.1 has NO endpoint for — arrive as a
|
|
43
|
+
* named failure rather than an empty grid (`headless/MyListings.tsx`).
|
|
44
|
+
*
|
|
45
|
+
* ── The seams, and why they are not imports ────────────────────────────────
|
|
46
|
+
*
|
|
47
|
+
* `@stapel/cdn-react` and `@stapel/categories-react` are L2 pairs, and L2
|
|
48
|
+
* pairs never import each other. The gallery therefore arrives as a
|
|
49
|
+
* structural {@link ListingImagesBag} (satisfied by cdn's upload bag: its
|
|
50
|
+
* `refs` IS `images_draft` and its `settled` is the submit gate), the
|
|
51
|
+
* category schema arrives as a plain `FeatureDef[]`, and a stored image
|
|
52
|
+
* reference is resolved by a host-supplied {@link ListingImageResolver} —
|
|
53
|
+
* because no contract in this fleet resolves a stranger's CDN reference, and
|
|
54
|
+
* a pair that invented a URL convention would be writing a contract nobody
|
|
55
|
+
* agreed to. `@stapel/attributes-react` IS a dependency; it is L0.
|
|
56
|
+
*
|
|
57
|
+
* Layers: api → model → flows → headless → i18n. Generated surfaces (the
|
|
58
|
+
* typed schema, the error map, the manifest, the nav manifest, llms.txt) are
|
|
59
|
+
* produced by the monorepo `gen:*` drivers from stapel-listings' own `docs/`
|
|
60
|
+
* artifacts and stand under drift gates.
|
|
61
|
+
*/
|
|
62
|
+
export { createListingsApi } from "./api/listingsApi.js";
|
|
63
|
+
export type { ListingsApi } from "./api/listingsApi.js";
|
|
64
|
+
export { DEFAULT_LISTING_CURRENCY, LISTING_STATUSES, MODERATION_STATUSES, } from "./api/types.js";
|
|
65
|
+
export type { DeleteResponse, FavoriteToggleResponse, FeatureConfig, FeatureDef, FeatureValueDto, ListingActionResponse, ListingCard, ListingDetail as ListingDetailData, ListingDraft, ListingDraftPatch, ListingFeatureDao, ListingFeatureDaoUnion, ListingFeatureType, ListingFeatureView, ListingLifecycleStatus, ListingModerationStatus, ListingPageParams, ListingStatusInfo, MyCounters, PaginatedListingCards, PublishResponse, Schemas, } from "./api/types.js";
|
|
66
|
+
export { MY_LISTINGS_TABS, MY_LISTINGS_TAB_STATUSES, isPubliclyVisible, lifecycleCaption, listingStatusView, moderationNotice, tabOf, } from "./model/status.js";
|
|
67
|
+
export type { LifecycleCaption, ListingStatusTone, ListingStatusView, ModerationNotice, MyListingsTab, } from "./model/status.js";
|
|
68
|
+
export { LISTING_TRANSITIONS, canDelete, canTransition } from "./model/transitions.js";
|
|
69
|
+
export { MY_LISTINGS_SOURCE_MISSING } from "./model/mineSource.js";
|
|
70
|
+
export type { MyListingsSource } from "./model/mineSource.js";
|
|
71
|
+
export { EMPTY_LOCATION, createDraftBody, draftPatchFromValues, draftValuesFromDetail, draftValuesFromWire, droppedFeatureSlugs, emptyDraftValues, retainKnownFeatureValues, } from "./model/draft.js";
|
|
72
|
+
export type { EmptyDraftOptions, ListingDraftValues, ListingLocation, } from "./model/draft.js";
|
|
73
|
+
export { asFeatureDaoList, featureFromDao, featuresDtoFromDaoList, featuresFromDaoList, unreadableFeatureCount, } from "./model/features.js";
|
|
74
|
+
export { CATEGORY_FIELD, DEFAULT_DRAFT_LIMITS, DESCRIPTION_FIELD, IMAGES_FIELD, PRICE_FIELD, TITLE_FIELD, failedResults, isBatchValid, listingFieldErrors, mirrorDraft, mirrorListingFields, publishRefusal, } from "./model/validation.js";
|
|
75
|
+
export type { ListingDraftLimits, PublishRefusal } from "./model/validation.js";
|
|
76
|
+
export { createListingsRuntime } from "./model/runtime.js";
|
|
77
|
+
export type { CreateListingsRuntimeOptions, ListingImageResolver, ListingsRuntime, } from "./model/runtime.js";
|
|
78
|
+
export { ListingsRuntimeContext, useListingsAnalytics, useListingsApi, useListingsRuntime, } from "./model/context.js";
|
|
79
|
+
export { listingsQueryKeys, pageKey } from "./model/queryKeys.js";
|
|
80
|
+
export type { ListingPageKey } from "./model/queryKeys.js";
|
|
81
|
+
export { useListing, useListingCards, useListingStatus, useMyCounters, useMyFavorites, useValidateDraft, } from "./model/queries.js";
|
|
82
|
+
export { useArchiveListing, useCompleteListing, useCreateDraft, useDeleteListing, useFavoriteListing, usePublishListing, useSaveDraft, } from "./model/mutations.js";
|
|
83
|
+
export type { FavoriteInput, SaveDraftInput } from "./model/mutations.js";
|
|
84
|
+
export { LISTINGS_FLOWS, flowEndpoints } from "./flows/registry.js";
|
|
85
|
+
export type { FlowEndpoint, ListingsFlowId, ListingsFlowSpec, } from "./flows/registry.js";
|
|
86
|
+
export { ListingsProvider } from "./headless/ListingsProvider.js";
|
|
87
|
+
export { useMandateGate } from "./headless/useMandateGate.js";
|
|
88
|
+
export { ListingDetail, useListingDetail } from "./headless/ListingDetail.js";
|
|
89
|
+
export type { ListingDetailBag, UseListingDetailOptions, } from "./headless/ListingDetail.js";
|
|
90
|
+
export { ListingComposer, useListingComposer } from "./headless/ListingComposer.js";
|
|
91
|
+
export type { ComposeStage, ListingComposerBag, ListingImagesBag, PublishOutcome, UseListingComposerOptions, } from "./headless/ListingComposer.js";
|
|
92
|
+
export { MyListings, useMyListings } from "./headless/MyListings.js";
|
|
93
|
+
export type { MyListingsBag, UseMyListingsOptions, } from "./headless/MyListings.js";
|
|
94
|
+
export { Favorites, useFavorites, useFavoriteToggle } from "./headless/Favorites.js";
|
|
95
|
+
export type { FavoriteToggleBag, FavoritesBag, UseFavoritesOptions, } from "./headless/Favorites.js";
|
|
96
|
+
export { useListingActions } from "./headless/ListingActions.js";
|
|
97
|
+
export type { ListingActionsBag } from "./headless/ListingActions.js";
|
|
98
|
+
export { ACCOUNT_ROOT_ID, navEntries } from "./nav/manifest.js";
|
|
99
|
+
export { LISTINGS_I18N_KEYS, listingsI18nBundleEn, registerListingsI18n, } from "./i18n/keys.js";
|
|
100
|
+
export type { ListingsI18nKey } from "./i18n/keys.js";
|
|
101
|
+
export { LISTINGS_ERRORS, LISTINGS_ERROR_CODES, LISTING_CANNOT_DELETE_ACTIVE, LISTING_INVALID_TRANSITION, LISTING_NOT_OWNER, LISTING_PUBLISH_VALIDATION_FAILED, explainListingsError, listingsErrorBundleEn, } from "./i18n/errorsMap.js";
|
|
102
|
+
export type { ListingsErrorCode, ListingsErrorSpec, Remediation, } from "./i18n/errorsMap.js";
|
|
103
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,wBAAwB,EACxB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,cAAc,EACd,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,aAAa,IAAI,iBAAiB,EAClC,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,UAAU,EACV,qBAAqB,EACrB,eAAe,EACf,OAAO,GACR,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;A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CAAC;AAGtD,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,4BAA4B,EAC5B,0BAA0B,EAC1B,iBAAiB,EACjB,iCAAiC,EACjC,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,GACZ,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@stapel/listings-react` — the headless React pair for stapel-listings
|
|
3
|
+
* (frontend-standard §2). Business + state only, zero visual opinion; the
|
|
4
|
+
* antd skin lives behind the `./default` subpath, so a host that renders its
|
|
5
|
+
* own shop window carries none of it.
|
|
6
|
+
*
|
|
7
|
+
* ── The one-liner ──────────────────────────────────────────────────────────
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const runtime = createListingsRuntime({
|
|
11
|
+
* baseUrl: "/listings/api/v1/",
|
|
12
|
+
* resolveImage: (ref) => myCdn.describe(ref),
|
|
13
|
+
* });
|
|
14
|
+
* <ListingsProvider runtime={runtime}>
|
|
15
|
+
* <ListingDetailPane id={id} />
|
|
16
|
+
* </ListingsProvider>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* ── The four properties this pair exists to guarantee ──────────────────────
|
|
20
|
+
*
|
|
21
|
+
* 1. **Two axes, both on screen, neither standing in for the other.**
|
|
22
|
+
* `status` decides visibility and nothing else does; `moderation_status`
|
|
23
|
+
* decides nothing about it. Since stapel-listings 0.5.0 they genuinely
|
|
24
|
+
* diverge — an edit to a LIVE listing keeps `status: published` and moves
|
|
25
|
+
* only the moderation axis — so "published, changes under review" is a
|
|
26
|
+
* sentence this pair can say, and a dashboard that computed either field
|
|
27
|
+
* from the other could not. `model/status.ts` produces both halves from
|
|
28
|
+
* both fields, once, and the 9 × 4 table is asserted.
|
|
29
|
+
* 2. **A refusal lands on the control that caused it.** `publish` answers an
|
|
30
|
+
* invalid draft with a BARE `ValidationBatchResult` (not an error
|
|
31
|
+
* envelope), and the engine's rows carry `{feature, slug}` and never
|
|
32
|
+
* `field`. `model/validation.ts` splits the two kinds of 400 apart and
|
|
33
|
+
* `featureErrorsBySlug` adds the routing key, so "this box is wrong" never
|
|
34
|
+
* degrades into "something is wrong".
|
|
35
|
+
* 3. **Every switched-off control states its reason.** Signing in, waiting
|
|
36
|
+
* for photos, a type this build cannot draw, a lifecycle move the server
|
|
37
|
+
* would refuse — each is an `ActionAvailability` with a named block, never
|
|
38
|
+
* a grey button and never a hidden one.
|
|
39
|
+
* 4. **An absence is never rendered as a zero.** A soft-deleted listing says
|
|
40
|
+
* it was removed rather than 404-ing like a typo; a stored feature this
|
|
41
|
+
* build cannot read is counted rather than dropped; and the owner's own
|
|
42
|
+
* listings — which stapel-listings 0.6.1 has NO endpoint for — arrive as a
|
|
43
|
+
* named failure rather than an empty grid (`headless/MyListings.tsx`).
|
|
44
|
+
*
|
|
45
|
+
* ── The seams, and why they are not imports ────────────────────────────────
|
|
46
|
+
*
|
|
47
|
+
* `@stapel/cdn-react` and `@stapel/categories-react` are L2 pairs, and L2
|
|
48
|
+
* pairs never import each other. The gallery therefore arrives as a
|
|
49
|
+
* structural {@link ListingImagesBag} (satisfied by cdn's upload bag: its
|
|
50
|
+
* `refs` IS `images_draft` and its `settled` is the submit gate), the
|
|
51
|
+
* category schema arrives as a plain `FeatureDef[]`, and a stored image
|
|
52
|
+
* reference is resolved by a host-supplied {@link ListingImageResolver} —
|
|
53
|
+
* because no contract in this fleet resolves a stranger's CDN reference, and
|
|
54
|
+
* a pair that invented a URL convention would be writing a contract nobody
|
|
55
|
+
* agreed to. `@stapel/attributes-react` IS a dependency; it is L0.
|
|
56
|
+
*
|
|
57
|
+
* Layers: api → model → flows → headless → i18n. Generated surfaces (the
|
|
58
|
+
* typed schema, the error map, the manifest, the nav manifest, llms.txt) are
|
|
59
|
+
* produced by the monorepo `gen:*` drivers from stapel-listings' own `docs/`
|
|
60
|
+
* artifacts and stand under drift gates.
|
|
61
|
+
*/
|
|
62
|
+
// ── api ──────────────────────────────────────────────────────────────────────
|
|
63
|
+
export { createListingsApi } from "./api/listingsApi.js";
|
|
64
|
+
export { DEFAULT_LISTING_CURRENCY, LISTING_STATUSES, MODERATION_STATUSES, } from "./api/types.js";
|
|
65
|
+
// ── model: the two axes ──────────────────────────────────────────────────────
|
|
66
|
+
export { MY_LISTINGS_TABS, MY_LISTINGS_TAB_STATUSES, isPubliclyVisible, lifecycleCaption, listingStatusView, moderationNotice, tabOf, } from "./model/status.js";
|
|
67
|
+
export { LISTING_TRANSITIONS, canDelete, canTransition } from "./model/transitions.js";
|
|
68
|
+
// ── model: the owner-list gap, named ─────────────────────────────────────────
|
|
69
|
+
export { MY_LISTINGS_SOURCE_MISSING } from "./model/mineSource.js";
|
|
70
|
+
// ── model: the draft twin ────────────────────────────────────────────────────
|
|
71
|
+
export { EMPTY_LOCATION, createDraftBody, draftPatchFromValues, draftValuesFromDetail, draftValuesFromWire, droppedFeatureSlugs, emptyDraftValues, retainKnownFeatureValues, } from "./model/draft.js";
|
|
72
|
+
// ── model: the stored feature projection ─────────────────────────────────────
|
|
73
|
+
export { asFeatureDaoList, featureFromDao, featuresDtoFromDaoList, featuresFromDaoList, unreadableFeatureCount, } from "./model/features.js";
|
|
74
|
+
// ── model: validation, the mirror and the publish-400 split ──────────────────
|
|
75
|
+
export { CATEGORY_FIELD, DEFAULT_DRAFT_LIMITS, DESCRIPTION_FIELD, IMAGES_FIELD, PRICE_FIELD, TITLE_FIELD, failedResults, isBatchValid, listingFieldErrors, mirrorDraft, mirrorListingFields, publishRefusal, } from "./model/validation.js";
|
|
76
|
+
// ── model: runtime wiring, query keys, context, hooks ────────────────────────
|
|
77
|
+
export { createListingsRuntime } from "./model/runtime.js";
|
|
78
|
+
export { ListingsRuntimeContext, useListingsAnalytics, useListingsApi, useListingsRuntime, } from "./model/context.js";
|
|
79
|
+
export { listingsQueryKeys, pageKey } from "./model/queryKeys.js";
|
|
80
|
+
export { useListing, useListingCards, useListingStatus, useMyCounters, useMyFavorites, useValidateDraft, } from "./model/queries.js";
|
|
81
|
+
export { useArchiveListing, useCompleteListing, useCreateDraft, useDeleteListing, useFavoriteListing, usePublishListing, useSaveDraft, } from "./model/mutations.js";
|
|
82
|
+
// ── flows (zero-flow shim — stapel-listings annotates none) ──────────────────
|
|
83
|
+
export { LISTINGS_FLOWS, flowEndpoints } from "./flows/registry.js";
|
|
84
|
+
// ── headless (renderless components + their bags) ────────────────────────────
|
|
85
|
+
export { ListingsProvider } from "./headless/ListingsProvider.js";
|
|
86
|
+
export { useMandateGate } from "./headless/useMandateGate.js";
|
|
87
|
+
export { ListingDetail, useListingDetail } from "./headless/ListingDetail.js";
|
|
88
|
+
export { ListingComposer, useListingComposer } from "./headless/ListingComposer.js";
|
|
89
|
+
export { MyListings, useMyListings } from "./headless/MyListings.js";
|
|
90
|
+
export { Favorites, useFavorites, useFavoriteToggle } from "./headless/Favorites.js";
|
|
91
|
+
export { useListingActions } from "./headless/ListingActions.js";
|
|
92
|
+
// ── nav manifest (the pair's public surface declaration) ─────────────────────
|
|
93
|
+
export { ACCOUNT_ROOT_ID, navEntries } from "./nav/manifest.js";
|
|
94
|
+
// ── i18n ─────────────────────────────────────────────────────────────────────
|
|
95
|
+
export { LISTINGS_I18N_KEYS, listingsI18nBundleEn, registerListingsI18n, } from "./i18n/keys.js";
|
|
96
|
+
// ── errors map (code → status/params/remediation/en; generated) ──────────────
|
|
97
|
+
export { LISTINGS_ERRORS, LISTINGS_ERROR_CODES, LISTING_CANNOT_DELETE_ACTIVE, LISTING_INVALID_TRANSITION, LISTING_NOT_OWNER, LISTING_PUBLISH_VALIDATION_FAILED, explainListingsError, listingsErrorBundleEn, } from "./i18n/errorsMap.js";
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.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/core";
|
|
3
|
+
import type { ListingsApi } from "../api/listingsApi.js";
|
|
4
|
+
import type { ListingsRuntime } from "./runtime.js";
|
|
5
|
+
export declare const ListingsRuntimeContext: Context<ListingsRuntime | null>;
|
|
6
|
+
export declare const useListingsRuntime: () => ListingsRuntime;
|
|
7
|
+
export declare const useListingsApi: () => ListingsApi;
|
|
8
|
+
export declare const useListingsAnalytics: () => Analytics | null;
|
|
9
|
+
/** @internal Re-exported as `<ListingsProvider>` from `headless/`. */
|
|
10
|
+
export declare const ModuleProvider: ModuleContextKit<ListingsRuntime>["Provider"];
|
|
11
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/model/context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAYpD,eAAO,MAAM,sBAAsB,EAAE,OAAO,CAAC,eAAe,GAAG,IAAI,CAC/C,CAAC;AAErB,eAAO,MAAM,kBAAkB,EAAE,MAAM,eAAgC,CAAC;AAExE,eAAO,MAAM,cAAc,EAAE,MAAM,WAAwB,CAAC;AAE5D,eAAO,MAAM,oBAAoB,EAAE,MAAM,SAAS,GAAG,IAAuB,CAAC;AAE7E,sEAAsE;AACtE,eAAO,MAAM,cAAc,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC,UAAU,CAC3D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createModuleContext } from "@stapel/core";
|
|
2
|
+
/**
|
|
3
|
+
* The wired ListingsRuntime shared through React context by
|
|
4
|
+
* `<ListingsProvider>`. Hooks in `model/` and `headless/` read the singletons
|
|
5
|
+
* from here. One reviewed copy of this plumbing lives in `@stapel/core`
|
|
6
|
+
* (`createModuleContext`, slim wave §21/S2); this module binds it under the
|
|
7
|
+
* pair's public names.
|
|
8
|
+
*/
|
|
9
|
+
const kit = createModuleContext("Listings");
|
|
10
|
+
export const ListingsRuntimeContext = kit.RuntimeContext;
|
|
11
|
+
export const useListingsRuntime = kit.useRuntime;
|
|
12
|
+
export const useListingsApi = kit.useApi;
|
|
13
|
+
export const useListingsAnalytics = kit.useAnalytics;
|
|
14
|
+
/** @internal Re-exported as `<ListingsProvider>` from `headless/`. */
|
|
15
|
+
export const ModuleProvider = kit.Provider;
|
|
16
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/model/context.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD;;;;;;GAMG;AACH,MAAM,GAAG,GACP,mBAAmB,CAAkB,UAAU,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,sBAAsB,GACjC,GAAG,CAAC,cAAc,CAAC;AAErB,MAAM,CAAC,MAAM,kBAAkB,GAA0B,GAAG,CAAC,UAAU,CAAC;AAExE,MAAM,CAAC,MAAM,cAAc,GAAsB,GAAG,CAAC,MAAM,CAAC;AAE5D,MAAM,CAAC,MAAM,oBAAoB,GAA2B,GAAG,CAAC,YAAY,CAAC;AAE7E,sEAAsE;AACtE,MAAM,CAAC,MAAM,cAAc,GACzB,GAAG,CAAC,QAAQ,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The draft a composer holds, and its two conversions to the wire.
|
|
3
|
+
*
|
|
4
|
+
* stapel-listings stores every user-editable field TWICE: `title_draft` beside
|
|
5
|
+
* `title`, `images_draft` beside `images`, and so on. `publish` promotes the
|
|
6
|
+
* draft half onto the published half; nothing else does. So a composer edits
|
|
7
|
+
* exactly one side of that twin, and this module is where the browser's
|
|
8
|
+
* shape (plain values keyed the way a form keys them) meets the wire's
|
|
9
|
+
* (`*_draft` fields plus the `{slug: {type, value}}` feature envelope).
|
|
10
|
+
*
|
|
11
|
+
* Everything here is PURE — no React, no fetch — so the round trip is
|
|
12
|
+
* testable without mounting anything, and so `test/compose.test.tsx` can
|
|
13
|
+
* assert the BODY a save sends rather than the fact that it sent one.
|
|
14
|
+
*/
|
|
15
|
+
import type { FeatureDef, FeaturesDto } from "@stapel/attributes-react";
|
|
16
|
+
import type { ListingDetail, ListingDraft, ListingDraftPatch } from "../api/types.js";
|
|
17
|
+
/**
|
|
18
|
+
* Where the listing is, as ONE value.
|
|
19
|
+
*
|
|
20
|
+
* A composite because the four members only make sense together: a `lat`
|
|
21
|
+
* without a `lon` is not "half a location", it is a broken one, and a
|
|
22
|
+
* `geohash` that disagrees with the coordinates beside it is worse than no
|
|
23
|
+
* geohash — the pin and the bucket point at different places.
|
|
24
|
+
*
|
|
25
|
+
* The pair does NOT compute `geohash` from `lat`/`lon`, and that is a
|
|
26
|
+
* decision. A geohash is precision-dependent, the indexer's bucketing depends
|
|
27
|
+
* on which precision was used, and a client that picked its own would put
|
|
28
|
+
* listings in neighbouring cells for reasons nobody could see. It is written
|
|
29
|
+
* by whatever resolved the place (a geo picker, `stapel-geo`) and carried
|
|
30
|
+
* verbatim from there to the wire.
|
|
31
|
+
*/
|
|
32
|
+
export interface ListingLocation {
|
|
33
|
+
/** Opaque id from whatever place directory the deployment uses. */
|
|
34
|
+
readonly locationId: string;
|
|
35
|
+
/** What a person reads: "Kazan, Vahitovsky district". */
|
|
36
|
+
readonly locationLabel: string;
|
|
37
|
+
/** Decimal STRING, as the wire spells it — a float here would round-trip
|
|
38
|
+
* `55.796100` into `55.7961` and change what was submitted. */
|
|
39
|
+
readonly lat: string | null;
|
|
40
|
+
readonly lon: string | null;
|
|
41
|
+
readonly geohash: string;
|
|
42
|
+
}
|
|
43
|
+
export declare const EMPTY_LOCATION: ListingLocation;
|
|
44
|
+
/**
|
|
45
|
+
* Everything a composer edits.
|
|
46
|
+
*
|
|
47
|
+
* `features` holds PLAIN values keyed by slug — what a value editor's
|
|
48
|
+
* `onChange` produces — never the DTO envelope. The envelope is built at send
|
|
49
|
+
* time by `toFeaturesDto`, which tags each value with its type from the
|
|
50
|
+
* category schema; a composer that stored tagged values would have to
|
|
51
|
+
* re-tag them on every category change.
|
|
52
|
+
*/
|
|
53
|
+
export interface ListingDraftValues {
|
|
54
|
+
readonly categoryId: string;
|
|
55
|
+
readonly title: string;
|
|
56
|
+
readonly description: string;
|
|
57
|
+
/** Decimal string, or `""` for "no price yet". */
|
|
58
|
+
readonly price: string;
|
|
59
|
+
readonly currency: string;
|
|
60
|
+
readonly language: string;
|
|
61
|
+
/** CDN references (`<type>/<hash>`) — ORDER IS THE GALLERY ORDER, and the
|
|
62
|
+
* first one is the cover. This is exactly `bag.refs` from
|
|
63
|
+
* `@stapel/cdn-react`'s upload queue; see `headless/ListingComposer.tsx`. */
|
|
64
|
+
readonly images: readonly string[];
|
|
65
|
+
readonly location: ListingLocation;
|
|
66
|
+
readonly features: Readonly<Record<string, unknown>>;
|
|
67
|
+
/** A countable good (a quantity applies) vs a service. */
|
|
68
|
+
readonly countable: boolean;
|
|
69
|
+
readonly stockQuantity: number | null;
|
|
70
|
+
readonly autoRepublish: boolean;
|
|
71
|
+
}
|
|
72
|
+
export interface EmptyDraftOptions {
|
|
73
|
+
readonly categoryId?: string;
|
|
74
|
+
readonly currency?: string;
|
|
75
|
+
readonly language?: string;
|
|
76
|
+
}
|
|
77
|
+
/** A blank draft. `currency` defaults to the storefront's (owner verdict F6 —
|
|
78
|
+
* RUB), overridable per runtime and per call. */
|
|
79
|
+
export declare function emptyDraftValues(options?: EmptyDraftOptions): ListingDraftValues;
|
|
80
|
+
/**
|
|
81
|
+
* A reopened draft: the server's `*_draft` fields → the composer's values.
|
|
82
|
+
*
|
|
83
|
+
* `features_draft` is `null` on a listing nobody has filled in yet, which is
|
|
84
|
+
* not the same as `{}` on the wire but is the same thing to a composer.
|
|
85
|
+
*/
|
|
86
|
+
export declare function draftValuesFromWire(draft: ListingDraft, options?: EmptyDraftOptions): ListingDraftValues;
|
|
87
|
+
/**
|
|
88
|
+
* Editing something already PUBLISHED: the published half → the composer.
|
|
89
|
+
*
|
|
90
|
+
* A live listing's `*_draft` fields hold whatever was last submitted, which
|
|
91
|
+
* after a publish is the same content — but a listing published before this
|
|
92
|
+
* pair existed, or one whose draft was cleared, would open empty. Seeding
|
|
93
|
+
* from the PUBLISHED fields is what makes "edit" show the listing a person
|
|
94
|
+
* can actually see. Feature values come back from the DAO projection, which
|
|
95
|
+
* is the one place the published values live.
|
|
96
|
+
*/
|
|
97
|
+
export declare function draftValuesFromDetail(detail: ListingDetail, featuresDto: FeaturesDto, options?: EmptyDraftOptions): ListingDraftValues;
|
|
98
|
+
/**
|
|
99
|
+
* The composer's values → the `save-draft` body.
|
|
100
|
+
*
|
|
101
|
+
* `features` needs the category schema to be tagged, so it is passed in. A
|
|
102
|
+
* feature the schema no longer declares is dropped by `toFeaturesDto` only if
|
|
103
|
+
* it is absent from `features`; keeping a stale slug in the payload would be
|
|
104
|
+
* refused per-feature by 0.6.0's M-7 rule
|
|
105
|
+
* (`error.400.listing_feature_not_allowed`), which is why
|
|
106
|
+
* {@link retainKnownFeatureValues} prunes on the way in rather than letting
|
|
107
|
+
* the server explain it.
|
|
108
|
+
*/
|
|
109
|
+
export declare function draftPatchFromValues(values: ListingDraftValues, features: readonly FeatureDef[]): ListingDraftPatch;
|
|
110
|
+
/**
|
|
111
|
+
* The body for CREATING a draft: `category_id` and nothing else.
|
|
112
|
+
*
|
|
113
|
+
* `perform_create` forces `owner` and `status`, and everything else has a
|
|
114
|
+
* model default, so a create that also carried the form's current contents
|
|
115
|
+
* would be a second write of data the very next `save-draft` sends anyway —
|
|
116
|
+
* and would fail the whole submission on a field the person could still fix.
|
|
117
|
+
* Create the row, then save into it.
|
|
118
|
+
*/
|
|
119
|
+
export declare function createDraftBody(categoryId: string): ListingDraftPatch;
|
|
120
|
+
/**
|
|
121
|
+
* Switching category: keep the answers whose slug the new schema also
|
|
122
|
+
* declares, drop the rest.
|
|
123
|
+
*
|
|
124
|
+
* Spec §4.1 asks for exactly this, and the reason is the same one the forms
|
|
125
|
+
* spec gives for `error.409.forms_version_superseded`: a person who picked
|
|
126
|
+
* "Phones", filled in Brand and Condition, then realised they meant "Used
|
|
127
|
+
* phones" should not retype what both categories ask for. A value whose slug
|
|
128
|
+
* is gone IS dropped, because 0.6.0 rejects an unknown slug per feature —
|
|
129
|
+
* carrying it would turn a category change into a publish refusal about a
|
|
130
|
+
* field the composer no longer draws.
|
|
131
|
+
*/
|
|
132
|
+
export declare function retainKnownFeatureValues(values: Readonly<Record<string, unknown>>, features: readonly FeatureDef[]): Readonly<Record<string, unknown>>;
|
|
133
|
+
/** Slugs that were answered and are NOT in the new schema — what
|
|
134
|
+
* {@link retainKnownFeatureValues} just dropped. A composer tells the person
|
|
135
|
+
* ("2 answers do not apply to this category") instead of losing them
|
|
136
|
+
* silently. */
|
|
137
|
+
export declare function droppedFeatureSlugs(values: Readonly<Record<string, unknown>>, features: readonly FeatureDef[]): readonly string[];
|
|
138
|
+
//# sourceMappingURL=draft.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/model/draft.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAExE,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAGzB;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,aAA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