@saasicat/ui-vue 0.16.0 → 0.18.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.
Files changed (46) hide show
  1. package/README.md +12 -11
  2. package/dist/{messages-DetB75lX.d.ts → catalog-JXdKdIqG.d.cts} +104 -40
  3. package/dist/{messages-DetB75lX.d.cts → catalog-JXdKdIqG.d.ts} +104 -40
  4. package/dist/{chunk-TZ2NGQXK.js → chunk-CC4WK3DC.js} +40 -8
  5. package/dist/{chunk-CRUUZMMN.js → chunk-VRCVJTY4.js} +30 -4
  6. package/dist/{chunk-MGKJCVDU.js → chunk-Y5MWMWMD.js} +18 -18
  7. package/dist/client/index.cjs +70 -10
  8. package/dist/client/index.d.cts +51 -5
  9. package/dist/client/index.d.ts +51 -5
  10. package/dist/client/index.js +10 -4
  11. package/dist/index.cjs +85 -22
  12. package/dist/index.d.cts +5 -5
  13. package/dist/index.d.ts +5 -5
  14. package/dist/index.js +11 -5
  15. package/dist/quasar/index.cjs +54 -20
  16. package/dist/quasar/index.d.cts +2 -2
  17. package/dist/quasar/index.d.ts +2 -2
  18. package/dist/quasar/index.js +2 -2
  19. package/dist/{use-super-admin-i18n-DokHhkS_.d.cts → use-super-admin-i18n-1nCOkvgi.d.cts} +29 -9
  20. package/dist/{use-super-admin-i18n-BPC-H9jz.d.ts → use-super-admin-i18n-BlqcD0N7.d.ts} +29 -9
  21. package/package.json +8 -3
  22. package/src/client/i18n/catalog.ts +120 -0
  23. package/src/client/i18n/currency.ts +7 -2
  24. package/src/client/i18n/define.ts +2 -2
  25. package/src/client/i18n/index.ts +1 -0
  26. package/src/client/i18n/locale.ts +23 -11
  27. package/src/client/i18n/messages/bundles.ts +2 -3
  28. package/src/client/i18n/messages/marketing.ts +2 -2
  29. package/src/client/i18n/messages/nav.ts +3 -3
  30. package/src/client/i18n/messages.ts +7 -4
  31. package/src/client/index.ts +1 -0
  32. package/src/client/login-branding.ts +61 -0
  33. package/src/client/nav-builder.ts +33 -6
  34. package/src/components/LocaleSwitcher.vue +21 -12
  35. package/src/components/bundle-editor/BundleVersionStrip.vue +1 -1
  36. package/src/components/bundle-editor/bundle-version-status.ts +18 -11
  37. package/src/pages-standard/AdminLayout.vue +7 -3
  38. package/src/pages-standard/DiscoveryPage.vue +1 -1
  39. package/src/pages-standard/SuperAdminLoginPage.vue +8 -9
  40. package/src/pages-standard/bundles-page/BundleAccordionList.vue +2 -3
  41. package/src/pages-standard/discovery-page/CatalogEntryTransPanel.vue +4 -4
  42. package/src/pages-standard/discovery-page/DiscoveryStatusControl.vue +7 -7
  43. package/src/pages-standard/discovery-page/discovery-ui.ts +24 -15
  44. package/src/pages-standard/plan-versions/PlanVersionsTimeline.vue +2 -3
  45. package/src/pages-standard/plan-versions/format.ts +7 -8
  46. package/src/vue/use-super-admin-i18n.ts +59 -28
package/README.md CHANGED
@@ -15,12 +15,12 @@ The package is layered so that each entry only loads what it names.
15
15
  Lower layers never import upward; ESLint (`no-restricted-imports`, repo
16
16
  root config) enforces the boundaries in CI.
17
17
 
18
- | Entry | Source | May import | Contents |
19
- | --- | --- | --- | --- |
20
- | `@saasicat/ui-vue/client` | `src/client/` | `@saasicat/types` only | Framework-free core: `BootLoader`, `ManifestLoader` (ETag cache), nav builder, action registry, batch column fetcher, `HttpClient`/`KvStore` contract. Usable from any framework or plain Node/TypeScript. |
21
- | `@saasicat/ui-vue` (main) | `src/vue/` (+ client re-exports) | Vue, `vue-router`, Pinia — **no Quasar** | Composables (`useTenants`, `usePlanEditor`, …), router guards, injection keys + shell contract, notify-port type, optional Pinia store factory. |
22
- | `@saasicat/ui-vue/quasar` | `src/quasar/` | everything above + Quasar | `createSuperAdminApp()` bootstrap and the Quasar notify-port implementation. |
23
- | `@saasicat/ui-vue/pages-standard/*`, `/pages-tenant/*`, `/components/*` | SFC directories | everything | The Quasar reference UI, shipped as raw `.vue` from `src/` (compiled by the consumer's Vite). |
18
+ | Entry | Source | May import | Contents |
19
+ | ----------------------------------------------------------------------- | -------------------------------- | ---------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20
+ | `@saasicat/ui-vue/client` | `src/client/` | `@saasicat/types` only | Framework-free core: `BootLoader`, `ManifestLoader` (ETag cache), nav builder, action registry, batch column fetcher, `HttpClient`/`KvStore` contract. Usable from any framework or plain Node/TypeScript. |
21
+ | `@saasicat/ui-vue` (main) | `src/vue/` (+ client re-exports) | Vue, `vue-router`, Pinia — **no Quasar** | Composables (`useTenants`, `usePlanEditor`, …), router guards, injection keys + shell contract, notify-port type, optional Pinia store factory. |
22
+ | `@saasicat/ui-vue/quasar` | `src/quasar/` | everything above + Quasar | `createSuperAdminApp()` bootstrap and the Quasar notify-port implementation. |
23
+ | `@saasicat/ui-vue/pages-standard/*`, `/pages-tenant/*`, `/components/*` | SFC directories | everything | The Quasar reference UI, shipped as raw `.vue` from `src/` (compiled by the consumer's Vite). |
24
24
 
25
25
  Rules of thumb when contributing:
26
26
 
@@ -49,7 +49,7 @@ createSuperAdminApp({
49
49
  ```
50
50
 
51
51
  Confirm dialogs inside the reference pages intentionally keep using Quasar's
52
- `Dialog` — the pages *are* the Quasar layer.
52
+ `Dialog` — the pages _are_ the Quasar layer.
53
53
 
54
54
  ## Usage
55
55
 
@@ -93,10 +93,11 @@ createSuperAdminApp({
93
93
  ```
94
94
 
95
95
  Users switch languages themselves through the shell's `LocaleSwitcher` (header
96
- and login page); the pick is remembered. `i18n.switcher: false` removes it for a
97
- single-language deployment, a `Ref<SaLocale>` hands the value to the app, and
98
- `i18n.overrides` replaces individual strings per locale. Components read the
99
- catalog via `useSaMessages('<namespace>')` / `useSuperAdminI18n()`.
96
+ and login page); the pick is remembered. Which languages an app offers is its
97
+ own call: `i18n.locales` narrows the set, `i18n.additionalLocales` adds
98
+ languages the platform does not ship, `i18n.overrides` replaces individual
99
+ strings, and `i18n.switcher: false` drops the control entirely. Components read
100
+ the catalog via `useSaMessages('<namespace>')` / `useSuperAdminI18n()`.
100
101
  See [handbook §8.6](https://github.com/uelker70/saasicat/blob/main/docs/handbook.md#86-ui-language-i18n).
101
102
 
102
103
  ## Build
@@ -1,4 +1,4 @@
1
- import { AdminManifest, TenantActionDef, StandardPageKey } from '@saasicat/types';
1
+ import { StandardPageKey, AdminManifest, TenantActionDef } from '@saasicat/types';
2
2
 
3
3
  /**
4
4
  * Minimal abstraction over `fetch`. Consumers may pass their own
@@ -38,19 +38,38 @@ declare function defaultKvStore(): KvStore;
38
38
  */
39
39
  declare function defaultHttpClient(): HttpClient;
40
40
 
41
- type SaLocale = 'de' | 'en';
42
- declare const SA_LOCALES: readonly SaLocale[];
43
- declare const DEFAULT_SA_LOCALE: SaLocale;
44
- /** BCP-47 tags used for `Intl`/`toLocaleString` formatting per UI locale. */
45
- declare const SA_INTL_LOCALES: Record<SaLocale, string>;
41
+ /** Locales the platform itself ships a catalog for. */
42
+ type SaBuiltinLocale = 'de' | 'en';
43
+ /**
44
+ * Any locale the shell can run in: the built-ins plus whatever an app adds via
45
+ * `i18n.additionalLocales`. The `string & {}` arm keeps autocompletion for the
46
+ * built-ins while leaving the set open.
47
+ */
48
+ type SaLocale = SaBuiltinLocale | (string & {});
49
+ /** The locales the platform ships. Apps narrow or extend this, see `i18n`. */
50
+ declare const SA_LOCALES: readonly SaBuiltinLocale[];
51
+ declare const DEFAULT_SA_LOCALE: SaBuiltinLocale;
52
+ /** BCP-47 tags used for `Intl`/`toLocaleString` formatting per built-in locale. */
53
+ declare const SA_INTL_LOCALES: Record<SaBuiltinLocale, string>;
46
54
  /**
47
55
  * Names for the language switcher. Endonyms — a language is listed in its own
48
56
  * language, so the entries stay readable no matter which locale is active and
49
57
  * never need translating.
50
58
  */
51
- declare const SA_LOCALE_LABELS: Record<SaLocale, string>;
52
- /** Narrows untrusted input (persisted preference, query parameter) to a locale. */
53
- declare function isSaLocale(value: unknown): value is SaLocale;
59
+ declare const SA_LOCALE_LABELS: Record<SaBuiltinLocale, string>;
60
+ /** Narrows untrusted input to a locale the platform ships a catalog for. */
61
+ declare function isSaBuiltinLocale(value: unknown): value is SaBuiltinLocale;
62
+
63
+ type SaNavMessages = {
64
+ readonly pages: Record<StandardPageKey, string>;
65
+ readonly sections: {
66
+ readonly overview: string;
67
+ readonly catalog: string;
68
+ readonly customers: string;
69
+ readonly system: string;
70
+ };
71
+ };
72
+ declare const navMessages: Record<SaBuiltinLocale, SaNavMessages>;
54
73
 
55
74
  /** Consumer implementation; receives the action inputs as a generic object. */
56
75
  type ActionHandler<TInput = unknown, TResult = unknown> = (input: TInput) => Promise<TResult>;
@@ -115,7 +134,7 @@ type PartialMessages<T> = {
115
134
  * Couples the German reference catalog with its English translation. Missing
116
135
  * or extra keys in the English object are compile errors.
117
136
  */
118
- declare function defineMessages<T extends MessageTree>(de: T, en: TranslationOf<T>): Record<SaLocale, T>;
137
+ declare function defineMessages<T extends MessageTree>(de: T, en: TranslationOf<T>): Record<SaBuiltinLocale, T>;
119
138
  /**
120
139
  * Recursively overlays `overrides` onto `base` without mutating either side.
121
140
  * Only string leaves are replaced; keys not present in `base` are ignored —
@@ -123,7 +142,7 @@ declare function defineMessages<T extends MessageTree>(de: T, en: TranslationOf<
123
142
  */
124
143
  declare function mergeMessages<T extends MessageTree>(base: T, overrides: PartialMessages<T> | undefined): T;
125
144
 
126
- declare const auditMessages: Record<SaLocale, {
145
+ declare const auditMessages: Record<SaBuiltinLocale, {
127
146
  title: string;
128
147
  subtitle: string;
129
148
  filterButton: string;
@@ -143,7 +162,7 @@ declare const auditMessages: Record<SaLocale, {
143
162
  };
144
163
  }>;
145
164
 
146
- declare const bundlesMessages: Record<SaLocale, {
165
+ declare const bundlesMessages: Record<SaBuiltinLocale, {
147
166
  fields: {
148
167
  masterData: string;
149
168
  label: string;
@@ -349,7 +368,7 @@ declare const bundlesMessages: Record<SaLocale, {
349
368
  };
350
369
  }>;
351
370
 
352
- declare const commonMessages: Record<SaLocale, {
371
+ declare const commonMessages: Record<SaBuiltinLocale, {
353
372
  save: string;
354
373
  cancel: string;
355
374
  close: string;
@@ -420,14 +439,14 @@ declare const commonMessages: Record<SaLocale, {
420
439
  noChanges: string;
421
440
  }>;
422
441
 
423
- declare const dashboardMessages: Record<SaLocale, {
442
+ declare const dashboardMessages: Record<SaBuiltinLocale, {
424
443
  title: string;
425
444
  emptyKpiCards: string;
426
445
  shortcutsTitle: string;
427
446
  deltaVsPreviousPeriod: string;
428
447
  }>;
429
448
 
430
- declare const discoveryMessages: Record<SaLocale, {
449
+ declare const discoveryMessages: Record<SaBuiltinLocale, {
431
450
  title: string;
432
451
  subtitleLead: string;
433
452
  subtitleEmphasis: string;
@@ -532,7 +551,7 @@ declare const discoveryMessages: Record<SaLocale, {
532
551
  };
533
552
  }>;
534
553
 
535
- declare const emailMessages: Record<SaLocale, {
554
+ declare const emailMessages: Record<SaBuiltinLocale, {
536
555
  sender: string;
537
556
  recipient: string;
538
557
  errorAction: string;
@@ -592,7 +611,7 @@ declare const emailMessages: Record<SaLocale, {
592
611
  };
593
612
  }>;
594
613
 
595
- declare const marketingMessages: Record<SaLocale, {
614
+ declare const marketingMessages: Record<SaBuiltinLocale, {
596
615
  topFeatures: string;
597
616
  tabs: {
598
617
  preview: string;
@@ -721,18 +740,7 @@ declare const marketingMessages: Record<SaLocale, {
721
740
  };
722
741
  }>;
723
742
 
724
- type NavNamespace = {
725
- readonly pages: Record<StandardPageKey, string>;
726
- readonly sections: {
727
- readonly overview: string;
728
- readonly catalog: string;
729
- readonly customers: string;
730
- readonly system: string;
731
- };
732
- };
733
- declare const navMessages: Record<SaLocale, NavNamespace>;
734
-
735
- declare const pilotsMessages: Record<SaLocale, {
743
+ declare const pilotsMessages: Record<SaBuiltinLocale, {
736
744
  title: string;
737
745
  subtitleCount: string;
738
746
  createAction: string;
@@ -826,7 +834,7 @@ declare const pilotsMessages: Record<SaLocale, {
826
834
  };
827
835
  }>;
828
836
 
829
- declare const planDetailMessages: Record<SaLocale, {
837
+ declare const planDetailMessages: Record<SaBuiltinLocale, {
830
838
  header: {
831
839
  noDescription: string;
832
840
  nameEditHint: string;
@@ -954,7 +962,7 @@ declare const planDetailMessages: Record<SaLocale, {
954
962
  };
955
963
  }>;
956
964
 
957
- declare const planEditorMessages: Record<SaLocale, {
965
+ declare const planEditorMessages: Record<SaBuiltinLocale, {
958
966
  perMonthShort: string;
959
967
  perYearShort: string;
960
968
  sections: {
@@ -1039,7 +1047,7 @@ declare const planEditorMessages: Record<SaLocale, {
1039
1047
  };
1040
1048
  }>;
1041
1049
 
1042
- declare const planVersionsMessages: Record<SaLocale, {
1050
+ declare const planVersionsMessages: Record<SaBuiltinLocale, {
1043
1051
  compareEnd: string;
1044
1052
  status: {
1045
1053
  draft: string;
@@ -1092,7 +1100,7 @@ declare const planVersionsMessages: Record<SaLocale, {
1092
1100
  };
1093
1101
  }>;
1094
1102
 
1095
- declare const plansMessages: Record<SaLocale, {
1103
+ declare const plansMessages: Record<SaBuiltinLocale, {
1096
1104
  page: {
1097
1105
  loading: string;
1098
1106
  toastPlanCreated: string;
@@ -1308,7 +1316,7 @@ declare const plansMessages: Record<SaLocale, {
1308
1316
  };
1309
1317
  }>;
1310
1318
 
1311
- declare const promosMessages: Record<SaLocale, {
1319
+ declare const promosMessages: Record<SaBuiltinLocale, {
1312
1320
  title: string;
1313
1321
  createAction: string;
1314
1322
  apiErrorHttpStatus: string;
@@ -1407,7 +1415,7 @@ declare const promosMessages: Record<SaLocale, {
1407
1415
  };
1408
1416
  }>;
1409
1417
 
1410
- declare const shellMessages: Record<SaLocale, {
1418
+ declare const shellMessages: Record<SaBuiltinLocale, {
1411
1419
  emailLabel: string;
1412
1420
  passwordLabel: string;
1413
1421
  invalidEmail: string;
@@ -1476,7 +1484,7 @@ declare const shellMessages: Record<SaLocale, {
1476
1484
  };
1477
1485
  }>;
1478
1486
 
1479
- declare const tenantsMessages: Record<SaLocale, {
1487
+ declare const tenantsMessages: Record<SaBuiltinLocale, {
1480
1488
  tenant: string;
1481
1489
  plan: string;
1482
1490
  list: {
@@ -1526,7 +1534,7 @@ declare const tenantsMessages: Record<SaLocale, {
1526
1534
  };
1527
1535
  }>;
1528
1536
 
1529
- declare const usersMessages: Record<SaLocale, {
1537
+ declare const usersMessages: Record<SaBuiltinLocale, {
1530
1538
  title: string;
1531
1539
  filterQuery: string;
1532
1540
  filterTenant: string;
@@ -1587,11 +1595,67 @@ type SaMessages = {
1587
1595
  /** Shape of app-side string overrides (deep partial of the catalog). */
1588
1596
  type SaMessagesOverrides = PartialMessages<SaMessages>;
1589
1597
  /** Complete, immutable message catalogs per locale. */
1590
- declare const SA_MESSAGES: Record<SaLocale, SaMessages>;
1598
+ declare const SA_MESSAGES: Record<SaBuiltinLocale, SaMessages>;
1591
1599
  /**
1592
1600
  * Returns the platform catalog for `locale`, optionally overlaid with
1593
1601
  * app-side overrides.
1594
1602
  */
1595
- declare function resolveMessages(locale: SaLocale, overrides?: SaMessagesOverrides): SaMessages;
1603
+ declare function resolveMessages(locale: SaBuiltinLocale, overrides?: SaMessagesOverrides): SaMessages;
1604
+
1605
+ /** A language an app brings along, on top of the two the platform ships. */
1606
+ interface SaLocaleDefinition {
1607
+ /**
1608
+ * Name for the switcher, written in the language itself (`'Français'`) —
1609
+ * that way the entry stays readable whatever locale is currently active.
1610
+ */
1611
+ label: string;
1612
+ /** BCP-47 tag for `Intl`/`toLocaleString`, e.g. `'fr-FR'`. */
1613
+ intlLocale: string;
1614
+ /**
1615
+ * Built-in catalog that fills whatever `messages` leaves out, default
1616
+ * `'en'`. A partial translation therefore renders — untranslated keys fall
1617
+ * back instead of showing blanks.
1618
+ */
1619
+ basedOn?: SaBuiltinLocale;
1620
+ /** The translation. Every key is optional; see `basedOn`. */
1621
+ messages: SaMessagesOverrides;
1622
+ }
1623
+ interface SaCatalogOptions {
1624
+ /**
1625
+ * Locales offered in the switcher, in the order given. Default: the
1626
+ * built-ins plus everything in `additionalLocales`. Narrow it to ship a
1627
+ * single language; entries without a catalog are ignored.
1628
+ */
1629
+ locales?: readonly SaLocale[];
1630
+ /** Languages the app adds, keyed by locale code (`'fr'`, `'pt-BR'`, …). */
1631
+ additionalLocales?: Readonly<Record<string, SaLocaleDefinition>>;
1632
+ /** Per-locale wording changes layered on top of whatever catalog applies. */
1633
+ overrides?: Readonly<Partial<Record<SaLocale, SaMessagesOverrides>>>;
1634
+ }
1635
+ /** One entry of the switcher. */
1636
+ interface SaLocaleOption {
1637
+ code: SaLocale;
1638
+ label: string;
1639
+ }
1640
+ interface SaCatalog {
1641
+ /** Locales to offer, in switcher order. Never empty. */
1642
+ readonly locales: readonly SaLocaleOption[];
1643
+ /**
1644
+ * Whether the app offers this locale. Deliberately not "can it be
1645
+ * rendered": an app that narrowed to English must not be pushed back into
1646
+ * German by a stored pick from before, even though German is still shipped.
1647
+ */
1648
+ has(locale: SaLocale): boolean;
1649
+ /** Locale to start from when nothing else is known. */
1650
+ readonly defaultLocale: SaLocale;
1651
+ messagesFor(locale: SaLocale): SaMessages;
1652
+ intlLocaleFor(locale: SaLocale): string;
1653
+ labelFor(locale: SaLocale): string;
1654
+ }
1655
+ /**
1656
+ * Builds the catalog an app runs on. Resolution is cached per locale, so
1657
+ * switching back and forth does not re-merge the message tree.
1658
+ */
1659
+ declare function createSaCatalog(options?: SaCatalogOptions): SaCatalog;
1596
1660
 
1597
- export { type ActionHandler as A, DEFAULT_SA_LOCALE as D, type HttpClient as H, type KvStore as K, type MessageTree as M, type PartialMessages as P, type ResolvedAction as R, type SaLocale as S, type TranslationOf as T, type SaMessages as a, type SaMessagesOverrides as b, ActionRegistry as c, ActionDefNotInManifestError as d, type HttpResponse as e, MissingHandlerError as f, SA_INTL_LOCALES as g, SA_LOCALES as h, SA_LOCALE_LABELS as i, SA_MESSAGES as j, defaultHttpClient as k, defaultKvStore as l, defineMessages as m, isSaLocale as n, mergeMessages as o, resolveMessages as r };
1661
+ export { type ActionHandler as A, DEFAULT_SA_LOCALE as D, type HttpClient as H, type KvStore as K, type MessageTree as M, type PartialMessages as P, type ResolvedAction as R, type SaLocale as S, type TranslationOf as T, type SaMessages as a, type SaLocaleOption as b, type SaLocaleDefinition as c, type SaMessagesOverrides as d, ActionRegistry as e, ActionDefNotInManifestError as f, type HttpResponse as g, MissingHandlerError as h, SA_INTL_LOCALES as i, SA_LOCALES as j, SA_LOCALE_LABELS as k, SA_MESSAGES as l, type SaBuiltinLocale as m, type SaCatalog as n, type SaCatalogOptions as o, createSaCatalog as p, defaultHttpClient as q, defaultKvStore as r, defineMessages as s, isSaBuiltinLocale as t, mergeMessages as u, resolveMessages as v, type SaNavMessages as w };
@@ -1,4 +1,4 @@
1
- import { AdminManifest, TenantActionDef, StandardPageKey } from '@saasicat/types';
1
+ import { StandardPageKey, AdminManifest, TenantActionDef } from '@saasicat/types';
2
2
 
3
3
  /**
4
4
  * Minimal abstraction over `fetch`. Consumers may pass their own
@@ -38,19 +38,38 @@ declare function defaultKvStore(): KvStore;
38
38
  */
39
39
  declare function defaultHttpClient(): HttpClient;
40
40
 
41
- type SaLocale = 'de' | 'en';
42
- declare const SA_LOCALES: readonly SaLocale[];
43
- declare const DEFAULT_SA_LOCALE: SaLocale;
44
- /** BCP-47 tags used for `Intl`/`toLocaleString` formatting per UI locale. */
45
- declare const SA_INTL_LOCALES: Record<SaLocale, string>;
41
+ /** Locales the platform itself ships a catalog for. */
42
+ type SaBuiltinLocale = 'de' | 'en';
43
+ /**
44
+ * Any locale the shell can run in: the built-ins plus whatever an app adds via
45
+ * `i18n.additionalLocales`. The `string & {}` arm keeps autocompletion for the
46
+ * built-ins while leaving the set open.
47
+ */
48
+ type SaLocale = SaBuiltinLocale | (string & {});
49
+ /** The locales the platform ships. Apps narrow or extend this, see `i18n`. */
50
+ declare const SA_LOCALES: readonly SaBuiltinLocale[];
51
+ declare const DEFAULT_SA_LOCALE: SaBuiltinLocale;
52
+ /** BCP-47 tags used for `Intl`/`toLocaleString` formatting per built-in locale. */
53
+ declare const SA_INTL_LOCALES: Record<SaBuiltinLocale, string>;
46
54
  /**
47
55
  * Names for the language switcher. Endonyms — a language is listed in its own
48
56
  * language, so the entries stay readable no matter which locale is active and
49
57
  * never need translating.
50
58
  */
51
- declare const SA_LOCALE_LABELS: Record<SaLocale, string>;
52
- /** Narrows untrusted input (persisted preference, query parameter) to a locale. */
53
- declare function isSaLocale(value: unknown): value is SaLocale;
59
+ declare const SA_LOCALE_LABELS: Record<SaBuiltinLocale, string>;
60
+ /** Narrows untrusted input to a locale the platform ships a catalog for. */
61
+ declare function isSaBuiltinLocale(value: unknown): value is SaBuiltinLocale;
62
+
63
+ type SaNavMessages = {
64
+ readonly pages: Record<StandardPageKey, string>;
65
+ readonly sections: {
66
+ readonly overview: string;
67
+ readonly catalog: string;
68
+ readonly customers: string;
69
+ readonly system: string;
70
+ };
71
+ };
72
+ declare const navMessages: Record<SaBuiltinLocale, SaNavMessages>;
54
73
 
55
74
  /** Consumer implementation; receives the action inputs as a generic object. */
56
75
  type ActionHandler<TInput = unknown, TResult = unknown> = (input: TInput) => Promise<TResult>;
@@ -115,7 +134,7 @@ type PartialMessages<T> = {
115
134
  * Couples the German reference catalog with its English translation. Missing
116
135
  * or extra keys in the English object are compile errors.
117
136
  */
118
- declare function defineMessages<T extends MessageTree>(de: T, en: TranslationOf<T>): Record<SaLocale, T>;
137
+ declare function defineMessages<T extends MessageTree>(de: T, en: TranslationOf<T>): Record<SaBuiltinLocale, T>;
119
138
  /**
120
139
  * Recursively overlays `overrides` onto `base` without mutating either side.
121
140
  * Only string leaves are replaced; keys not present in `base` are ignored —
@@ -123,7 +142,7 @@ declare function defineMessages<T extends MessageTree>(de: T, en: TranslationOf<
123
142
  */
124
143
  declare function mergeMessages<T extends MessageTree>(base: T, overrides: PartialMessages<T> | undefined): T;
125
144
 
126
- declare const auditMessages: Record<SaLocale, {
145
+ declare const auditMessages: Record<SaBuiltinLocale, {
127
146
  title: string;
128
147
  subtitle: string;
129
148
  filterButton: string;
@@ -143,7 +162,7 @@ declare const auditMessages: Record<SaLocale, {
143
162
  };
144
163
  }>;
145
164
 
146
- declare const bundlesMessages: Record<SaLocale, {
165
+ declare const bundlesMessages: Record<SaBuiltinLocale, {
147
166
  fields: {
148
167
  masterData: string;
149
168
  label: string;
@@ -349,7 +368,7 @@ declare const bundlesMessages: Record<SaLocale, {
349
368
  };
350
369
  }>;
351
370
 
352
- declare const commonMessages: Record<SaLocale, {
371
+ declare const commonMessages: Record<SaBuiltinLocale, {
353
372
  save: string;
354
373
  cancel: string;
355
374
  close: string;
@@ -420,14 +439,14 @@ declare const commonMessages: Record<SaLocale, {
420
439
  noChanges: string;
421
440
  }>;
422
441
 
423
- declare const dashboardMessages: Record<SaLocale, {
442
+ declare const dashboardMessages: Record<SaBuiltinLocale, {
424
443
  title: string;
425
444
  emptyKpiCards: string;
426
445
  shortcutsTitle: string;
427
446
  deltaVsPreviousPeriod: string;
428
447
  }>;
429
448
 
430
- declare const discoveryMessages: Record<SaLocale, {
449
+ declare const discoveryMessages: Record<SaBuiltinLocale, {
431
450
  title: string;
432
451
  subtitleLead: string;
433
452
  subtitleEmphasis: string;
@@ -532,7 +551,7 @@ declare const discoveryMessages: Record<SaLocale, {
532
551
  };
533
552
  }>;
534
553
 
535
- declare const emailMessages: Record<SaLocale, {
554
+ declare const emailMessages: Record<SaBuiltinLocale, {
536
555
  sender: string;
537
556
  recipient: string;
538
557
  errorAction: string;
@@ -592,7 +611,7 @@ declare const emailMessages: Record<SaLocale, {
592
611
  };
593
612
  }>;
594
613
 
595
- declare const marketingMessages: Record<SaLocale, {
614
+ declare const marketingMessages: Record<SaBuiltinLocale, {
596
615
  topFeatures: string;
597
616
  tabs: {
598
617
  preview: string;
@@ -721,18 +740,7 @@ declare const marketingMessages: Record<SaLocale, {
721
740
  };
722
741
  }>;
723
742
 
724
- type NavNamespace = {
725
- readonly pages: Record<StandardPageKey, string>;
726
- readonly sections: {
727
- readonly overview: string;
728
- readonly catalog: string;
729
- readonly customers: string;
730
- readonly system: string;
731
- };
732
- };
733
- declare const navMessages: Record<SaLocale, NavNamespace>;
734
-
735
- declare const pilotsMessages: Record<SaLocale, {
743
+ declare const pilotsMessages: Record<SaBuiltinLocale, {
736
744
  title: string;
737
745
  subtitleCount: string;
738
746
  createAction: string;
@@ -826,7 +834,7 @@ declare const pilotsMessages: Record<SaLocale, {
826
834
  };
827
835
  }>;
828
836
 
829
- declare const planDetailMessages: Record<SaLocale, {
837
+ declare const planDetailMessages: Record<SaBuiltinLocale, {
830
838
  header: {
831
839
  noDescription: string;
832
840
  nameEditHint: string;
@@ -954,7 +962,7 @@ declare const planDetailMessages: Record<SaLocale, {
954
962
  };
955
963
  }>;
956
964
 
957
- declare const planEditorMessages: Record<SaLocale, {
965
+ declare const planEditorMessages: Record<SaBuiltinLocale, {
958
966
  perMonthShort: string;
959
967
  perYearShort: string;
960
968
  sections: {
@@ -1039,7 +1047,7 @@ declare const planEditorMessages: Record<SaLocale, {
1039
1047
  };
1040
1048
  }>;
1041
1049
 
1042
- declare const planVersionsMessages: Record<SaLocale, {
1050
+ declare const planVersionsMessages: Record<SaBuiltinLocale, {
1043
1051
  compareEnd: string;
1044
1052
  status: {
1045
1053
  draft: string;
@@ -1092,7 +1100,7 @@ declare const planVersionsMessages: Record<SaLocale, {
1092
1100
  };
1093
1101
  }>;
1094
1102
 
1095
- declare const plansMessages: Record<SaLocale, {
1103
+ declare const plansMessages: Record<SaBuiltinLocale, {
1096
1104
  page: {
1097
1105
  loading: string;
1098
1106
  toastPlanCreated: string;
@@ -1308,7 +1316,7 @@ declare const plansMessages: Record<SaLocale, {
1308
1316
  };
1309
1317
  }>;
1310
1318
 
1311
- declare const promosMessages: Record<SaLocale, {
1319
+ declare const promosMessages: Record<SaBuiltinLocale, {
1312
1320
  title: string;
1313
1321
  createAction: string;
1314
1322
  apiErrorHttpStatus: string;
@@ -1407,7 +1415,7 @@ declare const promosMessages: Record<SaLocale, {
1407
1415
  };
1408
1416
  }>;
1409
1417
 
1410
- declare const shellMessages: Record<SaLocale, {
1418
+ declare const shellMessages: Record<SaBuiltinLocale, {
1411
1419
  emailLabel: string;
1412
1420
  passwordLabel: string;
1413
1421
  invalidEmail: string;
@@ -1476,7 +1484,7 @@ declare const shellMessages: Record<SaLocale, {
1476
1484
  };
1477
1485
  }>;
1478
1486
 
1479
- declare const tenantsMessages: Record<SaLocale, {
1487
+ declare const tenantsMessages: Record<SaBuiltinLocale, {
1480
1488
  tenant: string;
1481
1489
  plan: string;
1482
1490
  list: {
@@ -1526,7 +1534,7 @@ declare const tenantsMessages: Record<SaLocale, {
1526
1534
  };
1527
1535
  }>;
1528
1536
 
1529
- declare const usersMessages: Record<SaLocale, {
1537
+ declare const usersMessages: Record<SaBuiltinLocale, {
1530
1538
  title: string;
1531
1539
  filterQuery: string;
1532
1540
  filterTenant: string;
@@ -1587,11 +1595,67 @@ type SaMessages = {
1587
1595
  /** Shape of app-side string overrides (deep partial of the catalog). */
1588
1596
  type SaMessagesOverrides = PartialMessages<SaMessages>;
1589
1597
  /** Complete, immutable message catalogs per locale. */
1590
- declare const SA_MESSAGES: Record<SaLocale, SaMessages>;
1598
+ declare const SA_MESSAGES: Record<SaBuiltinLocale, SaMessages>;
1591
1599
  /**
1592
1600
  * Returns the platform catalog for `locale`, optionally overlaid with
1593
1601
  * app-side overrides.
1594
1602
  */
1595
- declare function resolveMessages(locale: SaLocale, overrides?: SaMessagesOverrides): SaMessages;
1603
+ declare function resolveMessages(locale: SaBuiltinLocale, overrides?: SaMessagesOverrides): SaMessages;
1604
+
1605
+ /** A language an app brings along, on top of the two the platform ships. */
1606
+ interface SaLocaleDefinition {
1607
+ /**
1608
+ * Name for the switcher, written in the language itself (`'Français'`) —
1609
+ * that way the entry stays readable whatever locale is currently active.
1610
+ */
1611
+ label: string;
1612
+ /** BCP-47 tag for `Intl`/`toLocaleString`, e.g. `'fr-FR'`. */
1613
+ intlLocale: string;
1614
+ /**
1615
+ * Built-in catalog that fills whatever `messages` leaves out, default
1616
+ * `'en'`. A partial translation therefore renders — untranslated keys fall
1617
+ * back instead of showing blanks.
1618
+ */
1619
+ basedOn?: SaBuiltinLocale;
1620
+ /** The translation. Every key is optional; see `basedOn`. */
1621
+ messages: SaMessagesOverrides;
1622
+ }
1623
+ interface SaCatalogOptions {
1624
+ /**
1625
+ * Locales offered in the switcher, in the order given. Default: the
1626
+ * built-ins plus everything in `additionalLocales`. Narrow it to ship a
1627
+ * single language; entries without a catalog are ignored.
1628
+ */
1629
+ locales?: readonly SaLocale[];
1630
+ /** Languages the app adds, keyed by locale code (`'fr'`, `'pt-BR'`, …). */
1631
+ additionalLocales?: Readonly<Record<string, SaLocaleDefinition>>;
1632
+ /** Per-locale wording changes layered on top of whatever catalog applies. */
1633
+ overrides?: Readonly<Partial<Record<SaLocale, SaMessagesOverrides>>>;
1634
+ }
1635
+ /** One entry of the switcher. */
1636
+ interface SaLocaleOption {
1637
+ code: SaLocale;
1638
+ label: string;
1639
+ }
1640
+ interface SaCatalog {
1641
+ /** Locales to offer, in switcher order. Never empty. */
1642
+ readonly locales: readonly SaLocaleOption[];
1643
+ /**
1644
+ * Whether the app offers this locale. Deliberately not "can it be
1645
+ * rendered": an app that narrowed to English must not be pushed back into
1646
+ * German by a stored pick from before, even though German is still shipped.
1647
+ */
1648
+ has(locale: SaLocale): boolean;
1649
+ /** Locale to start from when nothing else is known. */
1650
+ readonly defaultLocale: SaLocale;
1651
+ messagesFor(locale: SaLocale): SaMessages;
1652
+ intlLocaleFor(locale: SaLocale): string;
1653
+ labelFor(locale: SaLocale): string;
1654
+ }
1655
+ /**
1656
+ * Builds the catalog an app runs on. Resolution is cached per locale, so
1657
+ * switching back and forth does not re-merge the message tree.
1658
+ */
1659
+ declare function createSaCatalog(options?: SaCatalogOptions): SaCatalog;
1596
1660
 
1597
- export { type ActionHandler as A, DEFAULT_SA_LOCALE as D, type HttpClient as H, type KvStore as K, type MessageTree as M, type PartialMessages as P, type ResolvedAction as R, type SaLocale as S, type TranslationOf as T, type SaMessages as a, type SaMessagesOverrides as b, ActionRegistry as c, ActionDefNotInManifestError as d, type HttpResponse as e, MissingHandlerError as f, SA_INTL_LOCALES as g, SA_LOCALES as h, SA_LOCALE_LABELS as i, SA_MESSAGES as j, defaultHttpClient as k, defaultKvStore as l, defineMessages as m, isSaLocale as n, mergeMessages as o, resolveMessages as r };
1661
+ export { type ActionHandler as A, DEFAULT_SA_LOCALE as D, type HttpClient as H, type KvStore as K, type MessageTree as M, type PartialMessages as P, type ResolvedAction as R, type SaLocale as S, type TranslationOf as T, type SaMessages as a, type SaLocaleOption as b, type SaLocaleDefinition as c, type SaMessagesOverrides as d, ActionRegistry as e, ActionDefNotInManifestError as f, type HttpResponse as g, MissingHandlerError as h, SA_INTL_LOCALES as i, SA_LOCALES as j, SA_LOCALE_LABELS as k, SA_MESSAGES as l, type SaBuiltinLocale as m, type SaCatalog as n, type SaCatalogOptions as o, createSaCatalog as p, defaultHttpClient as q, defaultKvStore as r, defineMessages as s, isSaBuiltinLocale as t, mergeMessages as u, resolveMessages as v, type SaNavMessages as w };