@molecule/app-locales-legal-default 1.0.4 → 1.0.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"loadContent.d.ts","sourceRoot":"","sources":["../src/loadContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA0BH;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/D"}
1
+ {"version":3,"file":"loadContent.d.ts","sourceRoot":"","sources":["../src/loadContent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAoCH;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/D"}
@@ -10,6 +10,12 @@
10
10
  * @module
11
11
  */
12
12
  import { getProvider as getI18nProvider, registerContent } from '@molecule/app-i18n';
13
+ /** Checks that the namespace export is a string-to-string translation map. */
14
+ function isTranslationMap(value) {
15
+ return (typeof value === 'object' &&
16
+ value !== null &&
17
+ Object.values(value).every((text) => typeof text === 'string'));
18
+ }
13
19
  /**
14
20
  * Resolve the locale map at CALL time, not module-evaluation time.
15
21
  *
@@ -25,8 +31,9 @@ import { getProvider as getI18nProvider, registerContent } from '@molecule/app-i
25
31
  * @returns That locale's legal content, falling back to English.
26
32
  */
27
33
  async function legalFor(code) {
28
- const legalDefault = (await import('./index.js'));
29
- return legalDefault[code.replace('-', '')] ?? legalDefault.en;
34
+ const legalDefault = await import('./index.js');
35
+ const content = Object.getOwnPropertyDescriptor(legalDefault, code.replace('-', ''))?.value;
36
+ return isTranslationMap(content) ? content : { ...legalDefault.en };
30
37
  }
31
38
  /**
32
39
  * Register a legal-content module (privacyPolicy or termsOfService)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-locales-legal-default",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Default privacy policy + terms of service HTML content in 74 languages, with {{appName}} interpolation. Replaces per-app locales/<lang>/privacyPolicy.ts and termsOfService.ts files that ship byte-identical across the fleet.",
5
5
  "homepage": "https://www.molecule.dev/packages/app-locales-legal-default",
6
6
  "type": "module",
@@ -41,7 +41,7 @@
41
41
  "@types/node": "26.6.5",
42
42
  "typescript": "6.0.3",
43
43
  "vitest": "4.1.12",
44
- "@molecule/app-i18n": "1.0.4"
44
+ "@molecule/app-i18n": "1.3.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@molecule/app-i18n": "^1.0.1"