@endora-commerce/mod-dictionaries 0.100.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/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/admin/api/client.d.ts +76 -0
- package/dist/admin/api/client.d.ts.map +1 -0
- package/dist/admin/api/client.js +87 -0
- package/dist/admin/api/client.js.map +1 -0
- package/dist/admin/components/EntryStatusBadges.d.ts +9 -0
- package/dist/admin/components/EntryStatusBadges.d.ts.map +1 -0
- package/dist/admin/components/EntryStatusBadges.js +8 -0
- package/dist/admin/components/EntryStatusBadges.js.map +1 -0
- package/dist/admin/components/LanguagePicker.d.ts +8 -0
- package/dist/admin/components/LanguagePicker.d.ts.map +1 -0
- package/dist/admin/components/LanguagePicker.js +30 -0
- package/dist/admin/components/LanguagePicker.js.map +1 -0
- package/dist/admin/components/TranslationsDrawer.d.ts +10 -0
- package/dist/admin/components/TranslationsDrawer.d.ts.map +1 -0
- package/dist/admin/components/TranslationsDrawer.js +90 -0
- package/dist/admin/components/TranslationsDrawer.js.map +1 -0
- package/dist/admin/index.d.ts +48 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +82 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/pages/AuditPage.d.ts +9 -0
- package/dist/admin/pages/AuditPage.d.ts.map +1 -0
- package/dist/admin/pages/AuditPage.js +80 -0
- package/dist/admin/pages/AuditPage.js.map +1 -0
- package/dist/admin/pages/DictionaryPage.d.ts +9 -0
- package/dist/admin/pages/DictionaryPage.d.ts.map +1 -0
- package/dist/admin/pages/DictionaryPage.js +38 -0
- package/dist/admin/pages/DictionaryPage.js.map +1 -0
- package/dist/admin/tabs/CountriesTab.d.ts +3 -0
- package/dist/admin/tabs/CountriesTab.d.ts.map +1 -0
- package/dist/admin/tabs/CountriesTab.js +233 -0
- package/dist/admin/tabs/CountriesTab.js.map +1 -0
- package/dist/admin/tabs/CurrenciesTab.d.ts +3 -0
- package/dist/admin/tabs/CurrenciesTab.d.ts.map +1 -0
- package/dist/admin/tabs/CurrenciesTab.js +209 -0
- package/dist/admin/tabs/CurrenciesTab.js.map +1 -0
- package/dist/admin/tabs/LanguagesTab.d.ts +3 -0
- package/dist/admin/tabs/LanguagesTab.d.ts.map +1 -0
- package/dist/admin/tabs/LanguagesTab.js +268 -0
- package/dist/admin/tabs/LanguagesTab.js.map +1 -0
- package/dist/backend/entities/country.entity.d.ts +35 -0
- package/dist/backend/entities/country.entity.d.ts.map +1 -0
- package/dist/backend/entities/country.entity.js +107 -0
- package/dist/backend/entities/country.entity.js.map +1 -0
- package/dist/backend/entities/dictionary-translation.entity.d.ts +25 -0
- package/dist/backend/entities/dictionary-translation.entity.d.ts.map +1 -0
- package/dist/backend/entities/dictionary-translation.entity.js +65 -0
- package/dist/backend/entities/dictionary-translation.entity.js.map +1 -0
- package/dist/backend/entities/language-country.entity.d.ts +17 -0
- package/dist/backend/entities/language-country.entity.d.ts.map +1 -0
- package/dist/backend/entities/language-country.entity.js +49 -0
- package/dist/backend/entities/language-country.entity.js.map +1 -0
- package/dist/backend/index.d.ts +85 -0
- package/dist/backend/index.d.ts.map +1 -0
- package/dist/backend/index.js +155 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/routes.admin.d.ts +39 -0
- package/dist/backend/routes.admin.d.ts.map +1 -0
- package/dist/backend/routes.admin.js +317 -0
- package/dist/backend/routes.admin.js.map +1 -0
- package/dist/backend/routes.storefront.d.ts +7 -0
- package/dist/backend/routes.storefront.d.ts.map +1 -0
- package/dist/backend/routes.storefront.js +34 -0
- package/dist/backend/routes.storefront.js.map +1 -0
- package/dist/backend/seed/countries.d.ts +28 -0
- package/dist/backend/seed/countries.d.ts.map +1 -0
- package/dist/backend/seed/countries.js +121 -0
- package/dist/backend/seed/countries.js.map +1 -0
- package/dist/backend/seed/currencies.d.ts +9 -0
- package/dist/backend/seed/currencies.d.ts.map +1 -0
- package/dist/backend/seed/currencies.js +76 -0
- package/dist/backend/seed/currencies.js.map +1 -0
- package/dist/backend/seed/language-countries.d.ts +7 -0
- package/dist/backend/seed/language-countries.d.ts.map +1 -0
- package/dist/backend/seed/language-countries.js +19 -0
- package/dist/backend/seed/language-countries.js.map +1 -0
- package/dist/backend/seed/translations.pl-PL.d.ts +10 -0
- package/dist/backend/seed/translations.pl-PL.d.ts.map +1 -0
- package/dist/backend/seed/translations.pl-PL.js +74 -0
- package/dist/backend/seed/translations.pl-PL.js.map +1 -0
- package/dist/backend/services/country-currency-reference.d.ts +13 -0
- package/dist/backend/services/country-currency-reference.d.ts.map +1 -0
- package/dist/backend/services/country-currency-reference.js +25 -0
- package/dist/backend/services/country-currency-reference.js.map +1 -0
- package/dist/backend/services/country-reference-registry.d.ts +30 -0
- package/dist/backend/services/country-reference-registry.d.ts.map +1 -0
- package/dist/backend/services/country-reference-registry.js +54 -0
- package/dist/backend/services/country-reference-registry.js.map +1 -0
- package/dist/backend/services/country-service.d.ts +69 -0
- package/dist/backend/services/country-service.d.ts.map +1 -0
- package/dist/backend/services/country-service.js +193 -0
- package/dist/backend/services/country-service.js.map +1 -0
- package/dist/backend/services/dictionary-cache.d.ts +27 -0
- package/dist/backend/services/dictionary-cache.d.ts.map +1 -0
- package/dist/backend/services/dictionary-cache.js +57 -0
- package/dist/backend/services/dictionary-cache.js.map +1 -0
- package/dist/backend/services/dictionary-read-service.d.ts +36 -0
- package/dist/backend/services/dictionary-read-service.d.ts.map +1 -0
- package/dist/backend/services/dictionary-read-service.js +232 -0
- package/dist/backend/services/dictionary-read-service.js.map +1 -0
- package/dist/backend/services/dictionary-validator.d.ts +26 -0
- package/dist/backend/services/dictionary-validator.d.ts.map +1 -0
- package/dist/backend/services/dictionary-validator.js +72 -0
- package/dist/backend/services/dictionary-validator.js.map +1 -0
- package/dist/backend/services/dispatch-validator-mode.d.ts +19 -0
- package/dist/backend/services/dispatch-validator-mode.d.ts.map +1 -0
- package/dist/backend/services/dispatch-validator-mode.js +19 -0
- package/dist/backend/services/dispatch-validator-mode.js.map +1 -0
- package/dist/backend/services/label-resolver.d.ts +57 -0
- package/dist/backend/services/label-resolver.d.ts.map +1 -0
- package/dist/backend/services/label-resolver.js +116 -0
- package/dist/backend/services/label-resolver.js.map +1 -0
- package/dist/backend/services/language-country-service.d.ts +26 -0
- package/dist/backend/services/language-country-service.d.ts.map +1 -0
- package/dist/backend/services/language-country-service.js +108 -0
- package/dist/backend/services/language-country-service.js.map +1 -0
- package/dist/backend/services/seed-reconciler.d.ts +22 -0
- package/dist/backend/services/seed-reconciler.d.ts.map +1 -0
- package/dist/backend/services/seed-reconciler.js +149 -0
- package/dist/backend/services/seed-reconciler.js.map +1 -0
- package/dist/backend/services/translation-service.d.ts +29 -0
- package/dist/backend/services/translation-service.d.ts.map +1 -0
- package/dist/backend/services/translation-service.js +99 -0
- package/dist/backend/services/translation-service.js.map +1 -0
- package/dist/manifest.d.ts +174 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +178 -0
- package/dist/manifest.js.map +1 -0
- package/dist/migrations/20260506T112634_dictionaries_dictionary_init.d.ts +33 -0
- package/dist/migrations/20260506T112634_dictionaries_dictionary_init.d.ts.map +1 -0
- package/dist/migrations/20260506T112634_dictionaries_dictionary_init.js +157 -0
- package/dist/migrations/20260506T112634_dictionaries_dictionary_init.js.map +1 -0
- package/dist/migrations/index.d.ts +27 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +29 -0
- package/dist/migrations/index.js.map +1 -0
- package/docs/dictionaries/index.md +89 -0
- package/i18n/en.json +88 -0
- package/i18n/pl.json +88 -0
- package/package.json +99 -0
- package/tailwind.css +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Endora sp. z o.o. and the Endora Commerce contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- Generated by `pnpm --filter backend run manifests:generate`. Delete this line to take the file over; a README without it is never regenerated. -->
|
|
2
|
+
|
|
3
|
+
# @endora-commerce/mod-dictionaries
|
|
4
|
+
|
|
5
|
+
Cross-module registry of countries, languages, and currencies — backs every dropdown, validator, and address-form picker on the storefront and admin.
|
|
6
|
+
|
|
7
|
+
## What this is
|
|
8
|
+
|
|
9
|
+
An **Endora Commerce module package**. Its module id is `dictionaries` — the identity of record in the platform's registries, in its migrations and in its setting, permission and translation codes.
|
|
10
|
+
|
|
11
|
+
A module is not imported by application code. The platform discovers the extension packages an instance has installed, reads the manifest on the root subpath and composes the module from it, so installing this package and starting the instance is the whole integration.
|
|
12
|
+
|
|
13
|
+
## Entry points
|
|
14
|
+
|
|
15
|
+
| Import | Contents |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `@endora-commerce/mod-dictionaries` | the module manifest — its id, version, dependencies, settings and activation |
|
|
18
|
+
| `@endora-commerce/mod-dictionaries/admin` | the Admin UI contribution: the screens, navigation and palette actions it adds |
|
|
19
|
+
| `@endora-commerce/mod-dictionaries/backend` | the composition root the platform calls, with the entities, services, routes and workers it registers |
|
|
20
|
+
| `@endora-commerce/mod-dictionaries/migrations` | the module’s own schema migrations, in the order the platform runs them |
|
|
21
|
+
| `@endora-commerce/mod-dictionaries/tailwind.css` | the Tailwind source declaration for the admin code above |
|
|
22
|
+
|
|
23
|
+
## Depends on
|
|
24
|
+
|
|
25
|
+
Everything below is a **peer** dependency, so the application resolves exactly one copy of each — two copies of a host or of React are a runtime failure rather than a type error. An entry marked *optional* is needed only by the layers that use it.
|
|
26
|
+
|
|
27
|
+
**Endora packages**
|
|
28
|
+
|
|
29
|
+
- `@endora-commerce/admin-kit` — *optional*
|
|
30
|
+
- `@endora-commerce/contracts`
|
|
31
|
+
- `@endora-commerce/platform`
|
|
32
|
+
|
|
33
|
+
**Third-party**
|
|
34
|
+
|
|
35
|
+
- `@mikro-orm/core` ^6
|
|
36
|
+
- `@mikro-orm/migrations` ^6
|
|
37
|
+
- `@mikro-orm/postgresql` ^6
|
|
38
|
+
- `fastify` ^5
|
|
39
|
+
- `ioredis` ^5
|
|
40
|
+
- `lucide-react` ^1 — *optional*
|
|
41
|
+
- `react` ^19 — *optional*
|
|
42
|
+
- `react-router-dom` ^7 — *optional*
|
|
43
|
+
- `zod` ^4
|
|
44
|
+
|
|
45
|
+
## What the tarball carries
|
|
46
|
+
|
|
47
|
+
- `dist/` — the compiled JavaScript and its type declarations
|
|
48
|
+
- `i18n/` — the translation bundles this package ships (`en`, `pl`), loaded by the platform
|
|
49
|
+
- `docs/` — the package’s own pages in the Endora Commerce documentation site
|
|
50
|
+
- `tailwind.css` — the Tailwind source declaration
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pnpm add @endora-commerce/mod-dictionaries
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Licence
|
|
59
|
+
|
|
60
|
+
MIT — the text is in `LICENSE`, beside this file.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Country, CreateCountryRequest, CreateDictionaryCurrencyRequest, CreateDictionaryLanguageRequest, DictionaryCountriesPageResponse, DictionaryCurrenciesPageResponse, DictionaryCurrency, DictionaryLanguagesPageResponse, DictionaryLanguage, DictionaryTranslation, DictionaryEntryType, LanguageCountry, UpdateCountryRequest, UpdateDictionaryCurrencyRequest, UpdateDictionaryLanguageRequest, UpsertTranslationRequest, UpsertLanguageCountryRequest } from '@endora-commerce/contracts';
|
|
2
|
+
export interface DictionaryListParams {
|
|
3
|
+
page?: number;
|
|
4
|
+
pageSize?: number;
|
|
5
|
+
sort?: 'sortOrder' | 'label' | 'code' | 'region';
|
|
6
|
+
search?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface DictionaryAuditRow {
|
|
9
|
+
dictionary: 'country' | 'currency' | 'language';
|
|
10
|
+
consumer: string;
|
|
11
|
+
tableName: string;
|
|
12
|
+
columnName: string;
|
|
13
|
+
code: string;
|
|
14
|
+
count: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DictionaryAuditResponse {
|
|
17
|
+
data: DictionaryAuditRow[];
|
|
18
|
+
meta: {
|
|
19
|
+
generatedAt: string;
|
|
20
|
+
total: number;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const dictionaryClient: {
|
|
24
|
+
listCountries(params?: DictionaryListParams): Promise<DictionaryCountriesPageResponse>;
|
|
25
|
+
createCountry(input: CreateCountryRequest): Promise<{
|
|
26
|
+
data: Country;
|
|
27
|
+
}>;
|
|
28
|
+
updateCountry(code: string, input: UpdateCountryRequest): Promise<{
|
|
29
|
+
data: Country;
|
|
30
|
+
}>;
|
|
31
|
+
setDefaultCountry(code: string): Promise<{
|
|
32
|
+
data: Country;
|
|
33
|
+
}>;
|
|
34
|
+
deleteCountry(code: string): Promise<void>;
|
|
35
|
+
listCurrencies(params?: DictionaryListParams): Promise<DictionaryCurrenciesPageResponse>;
|
|
36
|
+
createCurrency(input: CreateDictionaryCurrencyRequest): Promise<{
|
|
37
|
+
data: DictionaryCurrency;
|
|
38
|
+
}>;
|
|
39
|
+
updateCurrency(code: string, input: UpdateDictionaryCurrencyRequest): Promise<{
|
|
40
|
+
data: DictionaryCurrency;
|
|
41
|
+
}>;
|
|
42
|
+
setDefaultCurrency(code: string): Promise<{
|
|
43
|
+
data: DictionaryCurrency;
|
|
44
|
+
}>;
|
|
45
|
+
deleteCurrency(code: string): Promise<void>;
|
|
46
|
+
listLanguages(params?: DictionaryListParams): Promise<DictionaryLanguagesPageResponse>;
|
|
47
|
+
createLanguage(input: CreateDictionaryLanguageRequest): Promise<{
|
|
48
|
+
data: DictionaryLanguage;
|
|
49
|
+
}>;
|
|
50
|
+
updateLanguage(code: string, input: UpdateDictionaryLanguageRequest): Promise<{
|
|
51
|
+
data: DictionaryLanguage;
|
|
52
|
+
}>;
|
|
53
|
+
setDefaultLanguage(code: string): Promise<{
|
|
54
|
+
data: DictionaryLanguage;
|
|
55
|
+
}>;
|
|
56
|
+
deleteLanguage(code: string): Promise<void>;
|
|
57
|
+
upsertLanguageCountry(languageCode: string, countryCode: string, input?: UpsertLanguageCountryRequest): Promise<{
|
|
58
|
+
data: LanguageCountry;
|
|
59
|
+
}>;
|
|
60
|
+
removeLanguageCountry(languageCode: string, countryCode: string): Promise<void>;
|
|
61
|
+
listTranslations(entryType: DictionaryEntryType, entryCode: string): Promise<{
|
|
62
|
+
data: DictionaryTranslation[];
|
|
63
|
+
}>;
|
|
64
|
+
upsertTranslation(entryType: DictionaryEntryType, entryCode: string, languageCode: string, input: UpsertTranslationRequest): Promise<{
|
|
65
|
+
data: DictionaryTranslation;
|
|
66
|
+
}>;
|
|
67
|
+
removeTranslation(entryType: DictionaryEntryType, entryCode: string, languageCode: string): Promise<void>;
|
|
68
|
+
getOrphanAudit(): Promise<DictionaryAuditResponse>;
|
|
69
|
+
invalidateCache(): Promise<{
|
|
70
|
+
data: {
|
|
71
|
+
invalidated: boolean;
|
|
72
|
+
invalidatedAt: string;
|
|
73
|
+
};
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/admin/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,oBAAoB,EACpB,+BAA+B,EAC/B,+BAA+B,EAC/B,+BAA+B,EAC/B,gCAAgC,EAChC,kBAAkB,EAClB,+BAA+B,EAC/B,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACpB,+BAA+B,EAC/B,+BAA+B,EAC/B,wBAAwB,EACxB,4BAA4B,EAC7B,MAAM,4BAA4B,CAAC;AAIpC,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,EAAE,CAAC;IAC3B,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC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AI,CAAC;gCAKlE,mBAAmB,aACnB,MAAM,GAChB,OAAO,CAAC;QAAE,IAAI,EAAE,qBAAqB,EAAE,CAAA;KAAE,CAAC;iCAIhC,mBAAmB,aACnB,MAAM,gBACH,MAAM,SACb,wBAAwB,GAC9B,OAAO,CAAC;QAAE,IAAI,EAAE,qBAAqB,CAAA;KAAE,CAAC;iCAO9B,mBAAmB,aACnB,MAAM,gBACH,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC;sBAKE,OAAO,CAAC,uBAAuB,CAAC;uBAG/B,OAAO,CAAC;QAAE,IAAI,EAAE;YAAE,WAAW,EAAE,OAAO,CAAC;YAAC,aAAa,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,CAAC;CAGtF,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { apiClient } from '@endora-commerce/admin-kit/lib';
|
|
2
|
+
const BASE = '/api/v1/admin/dictionary';
|
|
3
|
+
function query(params = {}) {
|
|
4
|
+
const sp = new URLSearchParams();
|
|
5
|
+
if (params.page)
|
|
6
|
+
sp.set('page', String(params.page));
|
|
7
|
+
if (params.pageSize)
|
|
8
|
+
sp.set('pageSize', String(params.pageSize));
|
|
9
|
+
if (params.sort)
|
|
10
|
+
sp.set('sort', params.sort);
|
|
11
|
+
if (params.search)
|
|
12
|
+
sp.set('search', params.search);
|
|
13
|
+
const out = sp.toString();
|
|
14
|
+
return out ? `?${out}` : '';
|
|
15
|
+
}
|
|
16
|
+
function enc(value) {
|
|
17
|
+
return encodeURIComponent(value);
|
|
18
|
+
}
|
|
19
|
+
export const dictionaryClient = {
|
|
20
|
+
listCountries(params) {
|
|
21
|
+
return apiClient.get(`${BASE}/countries${query(params)}`);
|
|
22
|
+
},
|
|
23
|
+
createCountry(input) {
|
|
24
|
+
return apiClient.post(`${BASE}/countries`, input);
|
|
25
|
+
},
|
|
26
|
+
updateCountry(code, input) {
|
|
27
|
+
return apiClient.put(`${BASE}/countries/${enc(code)}`, input);
|
|
28
|
+
},
|
|
29
|
+
setDefaultCountry(code) {
|
|
30
|
+
return apiClient.post(`${BASE}/countries/${enc(code)}/default`);
|
|
31
|
+
},
|
|
32
|
+
deleteCountry(code) {
|
|
33
|
+
return apiClient.delete(`${BASE}/countries/${enc(code)}`);
|
|
34
|
+
},
|
|
35
|
+
listCurrencies(params) {
|
|
36
|
+
return apiClient.get(`${BASE}/currencies${query(params)}`);
|
|
37
|
+
},
|
|
38
|
+
createCurrency(input) {
|
|
39
|
+
return apiClient.post(`${BASE}/currencies`, input);
|
|
40
|
+
},
|
|
41
|
+
updateCurrency(code, input) {
|
|
42
|
+
return apiClient.put(`${BASE}/currencies/${enc(code)}`, input);
|
|
43
|
+
},
|
|
44
|
+
setDefaultCurrency(code) {
|
|
45
|
+
return apiClient.post(`${BASE}/currencies/${enc(code)}/default`);
|
|
46
|
+
},
|
|
47
|
+
deleteCurrency(code) {
|
|
48
|
+
return apiClient.delete(`${BASE}/currencies/${enc(code)}`);
|
|
49
|
+
},
|
|
50
|
+
listLanguages(params) {
|
|
51
|
+
return apiClient.get(`${BASE}/languages${query(params)}`);
|
|
52
|
+
},
|
|
53
|
+
createLanguage(input) {
|
|
54
|
+
return apiClient.post(`${BASE}/languages`, input);
|
|
55
|
+
},
|
|
56
|
+
updateLanguage(code, input) {
|
|
57
|
+
return apiClient.put(`${BASE}/languages/${enc(code)}`, input);
|
|
58
|
+
},
|
|
59
|
+
setDefaultLanguage(code) {
|
|
60
|
+
return apiClient.post(`${BASE}/languages/${enc(code)}/default`);
|
|
61
|
+
},
|
|
62
|
+
deleteLanguage(code) {
|
|
63
|
+
return apiClient.delete(`${BASE}/languages/${enc(code)}`);
|
|
64
|
+
},
|
|
65
|
+
upsertLanguageCountry(languageCode, countryCode, input = {}) {
|
|
66
|
+
return apiClient.put(`${BASE}/languages/${enc(languageCode)}/countries/${enc(countryCode)}`, input);
|
|
67
|
+
},
|
|
68
|
+
removeLanguageCountry(languageCode, countryCode) {
|
|
69
|
+
return apiClient.delete(`${BASE}/languages/${enc(languageCode)}/countries/${enc(countryCode)}`);
|
|
70
|
+
},
|
|
71
|
+
listTranslations(entryType, entryCode) {
|
|
72
|
+
return apiClient.get(`${BASE}/translations/${enc(entryType)}/${enc(entryCode)}`);
|
|
73
|
+
},
|
|
74
|
+
upsertTranslation(entryType, entryCode, languageCode, input) {
|
|
75
|
+
return apiClient.put(`${BASE}/translations/${enc(entryType)}/${enc(entryCode)}/${enc(languageCode)}`, input);
|
|
76
|
+
},
|
|
77
|
+
removeTranslation(entryType, entryCode, languageCode) {
|
|
78
|
+
return apiClient.delete(`${BASE}/translations/${enc(entryType)}/${enc(entryCode)}/${enc(languageCode)}`);
|
|
79
|
+
},
|
|
80
|
+
getOrphanAudit() {
|
|
81
|
+
return apiClient.get(`${BASE}/audit/orphans`);
|
|
82
|
+
},
|
|
83
|
+
invalidateCache() {
|
|
84
|
+
return apiClient.post(`${BASE}/cache/invalidate`, {});
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/admin/api/client.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,MAAM,IAAI,GAAG,0BAA0B,CAAC;AA0BxC,SAAS,KAAK,CAAC,SAA+B,EAAE;IAC9C,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC;IACjC,IAAI,MAAM,CAAC,IAAI;QAAE,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACrD,IAAI,MAAM,CAAC,QAAQ;QAAE,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjE,IAAI,MAAM,CAAC,IAAI;QAAE,EAAE,CAAC,GAAG,CAAC,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
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
interface EntryStatusBadgesProps {
|
|
3
|
+
isDefault: boolean;
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
translationsComplete?: boolean | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function EntryStatusBadges({ isDefault, isActive, translationsComplete, }: EntryStatusBadgesProps): ReactNode;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=EntryStatusBadges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntryStatusBadges.d.ts","sourceRoot":"","sources":["../../../src/admin/components/EntryStatusBadges.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,sBAAsB;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CACvC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,oBAA2B,GAC5B,EAAE,sBAAsB,GAAG,SAAS,CAiBpC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from '@endora-commerce/admin-kit/ui';
|
|
3
|
+
import { useTranslation } from '@endora-commerce/admin-kit/i18n';
|
|
4
|
+
export function EntryStatusBadges({ isDefault, isActive, translationsComplete = null, }) {
|
|
5
|
+
const t = useTranslation('dictionaries');
|
|
6
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [isDefault ? _jsx(Badge, { variant: "success", children: t('badge.default') }) : null, _jsx(Badge, { variant: isActive ? 'secondary' : 'warning', children: isActive ? t('badge.active') : t('badge.inactive') }), translationsComplete === null ? (_jsx(Badge, { variant: "outline", children: t('badge.translationsPending') })) : (_jsx(Badge, { variant: translationsComplete ? 'success' : 'warning', children: translationsComplete ? t('badge.translationsComplete') : t('badge.translationsPartial') }))] }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=EntryStatusBadges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntryStatusBadges.js","sourceRoot":"","sources":["../../../src/admin/components/EntryStatusBadges.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAOjE,MAAM,UAAU,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,oBAAoB,GAAG,IAAI,GACJ;IACvB,MAAM,CAAC,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;IACzC,OAAO,CACL,eAAK,SAAS,EAAC,qCAAqC,aACjD,SAAS,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,OAAO,EAAC,SAAS,YAAE,CAAC,CAAC,eAAe,CAAC,GAAS,CAAC,CAAC,CAAC,IAAI,EACzE,KAAC,KAAK,IAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,YAC/C,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAC7C,EACP,oBAAoB,KAAK,IAAI,CAAC,CAAC,CAAC,CAC/B,KAAC,KAAK,IAAC,OAAO,EAAC,SAAS,YAAE,CAAC,CAAC,2BAA2B,CAAC,GAAS,CAClE,CAAC,CAAC,CAAC,CACF,KAAC,KAAK,IAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,YACzD,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,GAClF,CACT,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SelectHTMLAttributes } from 'react';
|
|
2
|
+
export interface LanguagePickerProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'children'> {
|
|
3
|
+
includeBlank?: boolean;
|
|
4
|
+
blankLabel?: string;
|
|
5
|
+
activeOnly?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function LanguagePicker({ includeBlank, blankLabel, activeOnly, ...props }: LanguagePickerProps): React.ReactElement;
|
|
8
|
+
//# sourceMappingURL=LanguagePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguagePicker.d.ts","sourceRoot":"","sources":["../../../src/admin/components/LanguagePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAMhF,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IACjE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,EAC7B,YAAoB,EACpB,UAAU,EACV,UAAiB,EACjB,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAgD1C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Select } from '@endora-commerce/admin-kit/ui';
|
|
4
|
+
import { useTranslation } from '@endora-commerce/admin-kit/i18n';
|
|
5
|
+
import { dictionaryClient } from '../api/client.js';
|
|
6
|
+
export function LanguagePicker({ includeBlank = false, blankLabel, activeOnly = true, ...props }) {
|
|
7
|
+
const t = useTranslation('dictionaries');
|
|
8
|
+
const resolvedBlankLabel = blankLabel ?? t('languagePicker.selectLanguage');
|
|
9
|
+
const [rows, setRows] = useState([]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
let cancelled = false;
|
|
12
|
+
void dictionaryClient
|
|
13
|
+
.listLanguages({ pageSize: 250, sort: 'sortOrder' })
|
|
14
|
+
.then((page) => {
|
|
15
|
+
if (!cancelled)
|
|
16
|
+
setRows(page.data);
|
|
17
|
+
})
|
|
18
|
+
.catch(() => {
|
|
19
|
+
if (!cancelled)
|
|
20
|
+
setRows([]);
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
cancelled = true;
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
const visible = useMemo(() => rows.filter((row) => !activeOnly || row.isActive), [activeOnly, rows]);
|
|
27
|
+
const inactive = useMemo(() => rows.filter((row) => activeOnly && !row.isActive), [activeOnly, rows]);
|
|
28
|
+
return (_jsxs(Select, { ...props, children: [includeBlank ? _jsx("option", { value: "", children: resolvedBlankLabel }) : null, visible.map((row) => (_jsx("option", { value: row.code, children: row.label }, row.code))), inactive.length > 0 ? (_jsx("optgroup", { label: t('languagePicker.inactiveGroup'), children: inactive.map((row) => (_jsx("option", { value: row.code, children: t('languagePicker.inactiveLabel', { label: row.label }) }, row.code))) })) : null] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=LanguagePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LanguagePicker.js","sourceRoot":"","sources":["../../../src/admin/components/LanguagePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAA6B,MAAM,OAAO,CAAC;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AASpD,MAAM,UAAU,cAAc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MAAC,MAAM,OAAK,KAAK,aACd,YAAY,CAAC,CAAC,CAAC,iBAAQ,KAAK,EAAC,EAAE,YAAE,kBAAkB,GAAU,CAAC,CAAC,CAAC,IAAI,EACpE,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACpB,iBAAuB,KAAK,EAAE,GAAG,CAAC,IAAI,YACnC,GAAG,CAAC,KAAK,IADC,GAAG,CAAC,IAAI,CAEZ,CACV,CAAC,EACD,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CACrB,mBAAU,KAAK,EAAE,CAAC,CAAC,8BAA8B,CAAC,YAC/C,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CACrB,iBAAuB,KAAK,EAAE,GAAG,CAAC,IAAI,YACnC,CAAC,CAAC,8BAA8B,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,IAD7C,GAAG,CAAC,IAAI,CAEZ,CACV,CAAC,GACO,CACZ,CAAC,CAAC,CAAC,IAAI,IACD,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { DictionaryEntryType, DictionaryLanguage } from '@endora-commerce/contracts';
|
|
3
|
+
interface TranslationsDrawerProps {
|
|
4
|
+
entryType: DictionaryEntryType;
|
|
5
|
+
entryCode: string | null;
|
|
6
|
+
languages: DictionaryLanguage[];
|
|
7
|
+
}
|
|
8
|
+
export declare function TranslationsDrawer({ entryType, entryCode, languages, }: TranslationsDrawerProps): ReactNode;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=TranslationsDrawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationsDrawer.d.ts","sourceRoot":"","sources":["../../../src/admin/components/TranslationsDrawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,mBAAmB,EAAE,kBAAkB,EAAyB,MAAM,4BAA4B,CAAC;AAMjH,UAAU,uBAAuB;IAC/B,SAAS,EAAE,mBAAmB,CAAC;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,kBAAkB,EAAE,CAAC;CACjC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,SAAS,EACT,SAAS,GACV,EAAE,uBAAuB,GAAG,SAAS,CA8HrC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { ApiError } from '@endora-commerce/admin-kit/lib';
|
|
4
|
+
import { Alert, AlertDescription, Button, Input } from '@endora-commerce/admin-kit/ui';
|
|
5
|
+
import { useTranslation } from '@endora-commerce/admin-kit/i18n';
|
|
6
|
+
import { dictionaryClient } from '../api/client.js';
|
|
7
|
+
export function TranslationsDrawer({ entryType, entryCode, languages, }) {
|
|
8
|
+
const t = useTranslation('dictionaries');
|
|
9
|
+
const [rows, setRows] = useState([]);
|
|
10
|
+
const [drafts, setDrafts] = useState({});
|
|
11
|
+
const [savingLanguage, setSavingLanguage] = useState(null);
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!entryCode) {
|
|
15
|
+
setRows([]);
|
|
16
|
+
setDrafts({});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
let cancelled = false;
|
|
20
|
+
setError(null);
|
|
21
|
+
void dictionaryClient
|
|
22
|
+
.listTranslations(entryType, entryCode)
|
|
23
|
+
.then((res) => {
|
|
24
|
+
if (cancelled)
|
|
25
|
+
return;
|
|
26
|
+
setRows(res.data);
|
|
27
|
+
setDrafts(Object.fromEntries(res.data.map((row) => [row.languageCode, row.label])));
|
|
28
|
+
})
|
|
29
|
+
.catch((err) => {
|
|
30
|
+
if (!cancelled)
|
|
31
|
+
setError(formatError(err, t('translations.error.load')));
|
|
32
|
+
});
|
|
33
|
+
return () => {
|
|
34
|
+
cancelled = true;
|
|
35
|
+
};
|
|
36
|
+
}, [entryCode, entryType, t]);
|
|
37
|
+
const byLanguage = useMemo(() => new Map(rows.map((row) => [row.languageCode, row])), [rows]);
|
|
38
|
+
if (!entryCode)
|
|
39
|
+
return null;
|
|
40
|
+
const save = async (languageCode) => {
|
|
41
|
+
const label = drafts[languageCode]?.trim() ?? '';
|
|
42
|
+
if (!label)
|
|
43
|
+
return;
|
|
44
|
+
setSavingLanguage(languageCode);
|
|
45
|
+
setError(null);
|
|
46
|
+
try {
|
|
47
|
+
const res = await dictionaryClient.upsertTranslation(entryType, entryCode, languageCode, {
|
|
48
|
+
label,
|
|
49
|
+
});
|
|
50
|
+
setRows((prev) => [
|
|
51
|
+
...prev.filter((row) => row.languageCode !== languageCode),
|
|
52
|
+
res.data,
|
|
53
|
+
].sort((a, b) => a.languageCode.localeCompare(b.languageCode)));
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
setError(formatError(err, t('translations.error.save')));
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
setSavingLanguage(null);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const remove = async (languageCode) => {
|
|
63
|
+
if (!confirm(t('translations.confirmRemove', { languageCode })))
|
|
64
|
+
return;
|
|
65
|
+
setSavingLanguage(languageCode);
|
|
66
|
+
setError(null);
|
|
67
|
+
try {
|
|
68
|
+
await dictionaryClient.removeTranslation(entryType, entryCode, languageCode);
|
|
69
|
+
setRows((prev) => prev.filter((row) => row.languageCode !== languageCode));
|
|
70
|
+
setDrafts((prev) => ({ ...prev, [languageCode]: '' }));
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
setError(formatError(err, t('translations.error.remove')));
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
setSavingLanguage(null);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
return (_jsxs("div", { className: "border-t pt-4", children: [_jsx("div", { className: "mb-2 text-sm font-medium", children: t('translations.title') }), error ? (_jsx(Alert, { variant: "destructive", className: "mb-3", children: _jsx(AlertDescription, { children: error }) })) : null, _jsxs("div", { className: "space-y-2 rounded-md border p-2", children: [languages.map((language) => {
|
|
80
|
+
const existing = byLanguage.get(language.code);
|
|
81
|
+
const value = drafts[language.code] ?? '';
|
|
82
|
+
return (_jsxs("div", { className: "grid gap-2 md:grid-cols-[110px_1fr_auto_auto]", children: [_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [_jsx("span", { className: "font-mono text-xs", children: language.code }), !language.isActive ? (_jsx("span", { className: "text-xs text-muted-foreground", children: t('translations.inactive') })) : null] }), _jsx(Input, { value: value, maxLength: 160, placeholder: language.label, onChange: (event) => setDrafts((prev) => ({ ...prev, [language.code]: event.target.value })) }), _jsx(Button, { type: "button", size: "sm", disabled: savingLanguage === language.code || value.trim().length === 0, onClick: () => void save(language.code), children: t('translations.save') }), _jsx(Button, { type: "button", size: "sm", variant: "outline", disabled: savingLanguage === language.code || !existing, onClick: () => void remove(language.code), children: t('translations.remove') })] }, language.code));
|
|
83
|
+
}), languages.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('translations.noLanguages') })) : null] })] }));
|
|
84
|
+
}
|
|
85
|
+
function formatError(err, fallback) {
|
|
86
|
+
if (err instanceof ApiError)
|
|
87
|
+
return err.envelope.error.message;
|
|
88
|
+
return fallback;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=TranslationsDrawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationsDrawer.js","sourceRoot":"","sources":["../../../src/admin/components/TranslationsDrawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC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KAAK,QAAQ,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EACvE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAEtC,CAAC,CAAC,mBAAmB,CAAC,GAChB,EACT,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,SAAS,EACjB,QAAQ,EAAE,cAAc,KAAK,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,EACvD,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,YAExC,CAAC,CAAC,qBAAqB,CAAC,GAClB,KA/BD,QAAQ,CAAC,IAAI,CAgCjB,CACP,CAAC;oBACJ,CAAC,CAAC,EACD,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CACxB,YAAG,SAAS,EAAC,+BAA+B,YAAE,CAAC,CAAC,0BAA0B,CAAC,GAAK,CACjF,CAAC,CAAC,CAAC,IAAI,IACJ,IACF,CACP,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,GAAY,EAAE,QAAgB;IACjD,IAAI,GAAG,YAAY,QAAQ;QAAE,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC;IAC/D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `dictionaries`' admin surface — three routes and two sidebar entries,
|
|
3
|
+
* declared by the module that owns them (feature 091, Phase 4, batch 10;
|
|
4
|
+
* `specs/091-module-owned-admin-surfaces/contracts/admin-contribution.md`).
|
|
5
|
+
*
|
|
6
|
+
* **Its drain fell from eleven to zero and it is coupled to nobody**, which is
|
|
7
|
+
* why it travels with `settings` and `credentials` rather than blocking on
|
|
8
|
+
* them. The eleven were `CountryPicker` and `CurrencyPicker` — two pickers over
|
|
9
|
+
* this module's country and currency catalogues, reached by `taxes`,
|
|
10
|
+
* `inventory`, `credit_limits`, `delivery_methods` and four more — plus five
|
|
11
|
+
* gateways importing the admin API client for one country list. Batch 5 paid
|
|
12
|
+
* the client reaches (each gateway builds
|
|
13
|
+
* `GET /api/v1/admin/dictionary/countries` from the published `apiClient` and
|
|
14
|
+
* `DictionaryCountriesPageResponse`), and batch 8 published both pickers into
|
|
15
|
+
* `@endora-commerce/admin-kit/components` on P2's terms, moving their
|
|
16
|
+
* `countryPicker.*` and `currencyPicker.*` keys to `core` with them. Neither
|
|
17
|
+
* turned out to be this module's *code*: both name an endpoint and a contract
|
|
18
|
+
* type, which is what Z1.1 measures rather than counts.
|
|
19
|
+
*
|
|
20
|
+
* **The two re-export shims go with the directory.** Batch 8 left
|
|
21
|
+
* `components/{CountryPicker,CurrencyPicker}.tsx` forwarding to the kit; a `@/`
|
|
22
|
+
* specifier does not resolve inside a package at all, and no file in the tree
|
|
23
|
+
* named the old paths — the four consumers already name the kit subpath. That
|
|
24
|
+
* is batch 9's `CustomFieldValuesPanel` decision arriving twice.
|
|
25
|
+
*
|
|
26
|
+
* **Two palette actions are declared here for the first time**, which is not a
|
|
27
|
+
* product change: `AppShell.tsx`'s `PALETTE_ITEMS` carried a hand-written
|
|
28
|
+
* *Navigate* row for each of these two screens, and a hand-written palette row
|
|
29
|
+
* is a copy the server was never asked about — it went on advertising the
|
|
30
|
+
* screens after an operator withdrew the module. Both arrive as manifest
|
|
31
|
+
* actions instead, which is the surface the effective enabled-set filters, with
|
|
32
|
+
* the same destinations, the same code and the same keywords the hand-written
|
|
33
|
+
* rows carried. That is batches 7 and 8's shape, and it is why this module is
|
|
34
|
+
* unlike batch 9's `assets_library`, which advertised nothing to begin with and
|
|
35
|
+
* had none invented for it.
|
|
36
|
+
*
|
|
37
|
+
* **`nonDeactivatable`, so the operator axis is the platform's** (`plan.md`
|
|
38
|
+
* Ruling 2). Countries, currencies and languages are what addresses, prices and
|
|
39
|
+
* translations resolve against, and the manifest says so with a reason. The
|
|
40
|
+
* permission axis is what this module still has and is what the off-state test
|
|
41
|
+
* drives; the missing axis is read off the manifest rather than skipped.
|
|
42
|
+
*
|
|
43
|
+
* **This entry exports data and nothing else** (R2); every component is a
|
|
44
|
+
* dynamic-import factory (R6).
|
|
45
|
+
*/
|
|
46
|
+
import type { AdminContributions } from '@endora-commerce/admin-kit/contributions';
|
|
47
|
+
export declare const contributions: AdminContributions;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAsCnF,eAAO,MAAM,aAAa,EAAE,kBAgD3B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/** The module's landing route: the three-tab registry screen. */
|
|
2
|
+
const ROUTE_PATH = '/dictionary';
|
|
3
|
+
/**
|
|
4
|
+
* The audit screen's route, and the spelling the sidebar advertises.
|
|
5
|
+
*
|
|
6
|
+
* `App.tsx` declared it twice — `/dictionaries/audit` and
|
|
7
|
+
* `/admin/dictionaries/audit` — while `AppShell.tsx`'s row and its palette row
|
|
8
|
+
* both pointed at the `/admin` one. Both are kept, for the reason they were
|
|
9
|
+
* both declared: a bookmark on either resolves. The `/admin`-prefixed path is
|
|
10
|
+
* the one the nav entry names, so it is the one `registryCrumbs` derives a
|
|
11
|
+
* breadcrumb for.
|
|
12
|
+
*/
|
|
13
|
+
const AUDIT_ROUTE_PATH = '/admin/dictionaries/audit';
|
|
14
|
+
/**
|
|
15
|
+
* The legacy spelling of the audit route, unadvertised and still resolving.
|
|
16
|
+
*
|
|
17
|
+
* Nothing in the tree links to it and it predates the `/admin` prefix; it is
|
|
18
|
+
* kept because removing a URL an operator may have bookmarked is a product
|
|
19
|
+
* change and this batch is a file move.
|
|
20
|
+
*/
|
|
21
|
+
const AUDIT_LEGACY_ROUTE_PATH = '/dictionaries/audit';
|
|
22
|
+
/**
|
|
23
|
+
* The one code this module declares, and the one every one of its admin routes
|
|
24
|
+
* enforces.
|
|
25
|
+
*
|
|
26
|
+
* `dictionary.write` gates all 23 registrations under
|
|
27
|
+
* `/api/v1/admin/dictionary/*` — including the reads, because the registry
|
|
28
|
+
* screen is an editing surface and this module never split read from write. So
|
|
29
|
+
* the routes, the sidebar rows and the palette actions all carry it, and the
|
|
30
|
+
* screen never advertises a 403.
|
|
31
|
+
*/
|
|
32
|
+
const DICTIONARY_PERMISSION = 'dictionary.write';
|
|
33
|
+
export const contributions = {
|
|
34
|
+
routes: [
|
|
35
|
+
{
|
|
36
|
+
path: ROUTE_PATH,
|
|
37
|
+
component: () => import('./pages/DictionaryPage.js'),
|
|
38
|
+
requiredPermission: DICTIONARY_PERMISSION,
|
|
39
|
+
index: true,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
path: AUDIT_LEGACY_ROUTE_PATH,
|
|
43
|
+
component: () => import('./pages/AuditPage.js'),
|
|
44
|
+
requiredPermission: DICTIONARY_PERMISSION,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
path: AUDIT_ROUTE_PATH,
|
|
48
|
+
component: () => import('./pages/AuditPage.js'),
|
|
49
|
+
requiredPermission: DICTIONARY_PERMISSION,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
nav: [
|
|
53
|
+
{
|
|
54
|
+
to: ROUTE_PATH,
|
|
55
|
+
// Module-relative (R8), resolved in this module's own namespace out of
|
|
56
|
+
// `packages/modules/dictionaries/i18n/`. It was `appShell.nav.dictionary`
|
|
57
|
+
// in the shared `_i18n` bundle, one of the four shared files a module
|
|
58
|
+
// author had to edit.
|
|
59
|
+
labelKey: 'nav.dictionary.label',
|
|
60
|
+
// The glyphs `AppShell.tsx` rendered by hand, both already on
|
|
61
|
+
// `KnownIconNameSchema`.
|
|
62
|
+
icon: 'Languages',
|
|
63
|
+
section: 'channels',
|
|
64
|
+
// The hand-written position in *Sales channels* times a hundred, which is
|
|
65
|
+
// batch four's convention: `/dictionary` and the audit row were the
|
|
66
|
+
// second and third of three, below `/sales-channels`. That row is still
|
|
67
|
+
// the host's, so `composeNav` appends both of these after it — which is
|
|
68
|
+
// exactly where they sat.
|
|
69
|
+
weight: 200,
|
|
70
|
+
requiredPermission: DICTIONARY_PERMISSION,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
to: AUDIT_ROUTE_PATH,
|
|
74
|
+
labelKey: 'nav.dictionaryAudit.label',
|
|
75
|
+
icon: 'ListChecks',
|
|
76
|
+
section: 'channels',
|
|
77
|
+
weight: 300,
|
|
78
|
+
requiredPermission: DICTIONARY_PERMISSION,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AA+CA,iEAAiE;AACjE,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC;;;;;;;;;GASG;AACH,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAuB;IAC/C,MAAM,EAAE;QACN;YACE,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,2BAA2B,CAAC;YACpD,kBAAkB,EAAE,qBAAqB;YACzC,KAAK,EAAE,IAAI;SACZ;QACD;YACE,IAAI,EAAE,uBAAuB;YAC7B,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC;YAC/C,kBAAkB,EAAE,qBAAqB;SAC1C;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC;YAC/C,kBAAkB,EAAE,qBAAqB;SAC1C;KACF;IACD,GAAG,EAAE;QACH;YACE,EAAE,EAAE,UAAU;YACd,uEAAuE;YACvE,0EAA0E;YAC1E,sEAAsE;YACtE,sBAAsB;YACtB,QAAQ,EAAE,sBAAsB;YAChC,8DAA8D;YAC9D,yBAAyB;YACzB,IAAI,EAAE,WAAW;YACjB,OAAO,EAAE,UAAU;YACnB,0EAA0E;YAC1E,oEAAoE;YACpE,wEAAwE;YACxE,wEAAwE;YACxE,0BAA0B;YAC1B,MAAM,EAAE,GAAG;YACX,kBAAkB,EAAE,qBAAqB;SAC1C;QACD;YACE,EAAE,EAAE,gBAAgB;YACpB,QAAQ,EAAE,2BAA2B;YACrC,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,UAAU;YACnB,MAAM,EAAE,GAAG;YACX,kBAAkB,EAAE,qBAAqB;SAC1C;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare function DictionaryAuditPage(): ReactNode;
|
|
3
|
+
/**
|
|
4
|
+
* The registry loads a route component through a dynamic-import factory and
|
|
5
|
+
* reads its default export (feature 091, FR-013). The named export stays: it is
|
|
6
|
+
* the spelling this module's own code and its tests use.
|
|
7
|
+
*/
|
|
8
|
+
export default DictionaryAuditPage;
|
|
9
|
+
//# sourceMappingURL=AuditPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuditPage.d.ts","sourceRoot":"","sources":["../../../src/admin/pages/AuditPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAOlF,wBAAgB,mBAAmB,IAAI,SAAS,CAiI/C;AAyBD;;;;GAIG;AACH,eAAe,mBAAmB,CAAC"}
|