@wix/himalaya-cli 0.1740.0 → 0.1741.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 (49) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/locale.d.ts +3 -1
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +57 -3
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +51 -2
  4. package/dist/browser-plane/assets.json +5 -5
  5. package/dist/browser-plane/preview-deferred/{4235535ddd6e62ae867fd4d3588054909040428cffec9bea2807693a68e297d9.bin → d13ef703cc8f4d7eaa9b12967b618314b75002b5d4441dedbcc65e3601c4750d.bin} +1 -1
  6. package/dist/browser-plane/sw.js +6 -6
  7. package/dist/cli.mjs +338 -155
  8. package/dist/preview-assets.generated.bin +0 -0
  9. package/guides/himi-json-output.md +1 -1
  10. package/guides/one-app-to-himi-app.md +11 -2
  11. package/package.json +2 -2
  12. package/templates/beauty-salon/l10n/fr.json +4806 -0
  13. package/templates/beauty-salon/tier5-src/wix-spaces-app-language/index.ts +18 -3
  14. package/templates/branded-lite/l10n/fr.json +9088 -0
  15. package/templates/branded-lite/l10n/he.json +4 -0
  16. package/templates/branded-lite/tier5-src/_shared/group-privacy.ts +14 -0
  17. package/templates/branded-lite/tier5-src/himi-branded-lite-group/index.ts +11 -4
  18. package/templates/branded-lite/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  19. package/templates/branded-lite/tier5-src/wix-spaces-app-language/index.ts +18 -3
  20. package/templates/community-club/l10n/fr.json +3026 -0
  21. package/templates/community-club/l10n/he.json +12 -0
  22. package/templates/community-club/tier5-src/_shared/group-privacy.ts +14 -0
  23. package/templates/community-club/tier5-src/himi-branded-lite-group/index.ts +11 -4
  24. package/templates/community-club/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  25. package/templates/community-club/tier5-src/wix-spaces-app-language/index.ts +18 -3
  26. package/templates/events-meetups/l10n/fr.json +2886 -0
  27. package/templates/events-meetups/l10n/he.json +12 -0
  28. package/templates/events-meetups/tier5-src/_shared/group-privacy.ts +14 -0
  29. package/templates/events-meetups/tier5-src/himi-branded-lite-group/index.ts +11 -4
  30. package/templates/events-meetups/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  31. package/templates/events-meetups/tier5-src/wix-spaces-app-language/index.ts +18 -3
  32. package/templates/gym-fitness/l10n/fr.json +5412 -0
  33. package/templates/gym-fitness/tier5-src/wix-spaces-app-language/index.ts +18 -3
  34. package/templates/nonprofit-cause/l10n/fr.json +3499 -0
  35. package/templates/nonprofit-cause/l10n/he.json +12 -0
  36. package/templates/nonprofit-cause/tier5-src/_shared/group-privacy.ts +14 -0
  37. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group/index.ts +11 -4
  38. package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
  39. package/templates/nonprofit-cause/tier5-src/wix-spaces-app-language/index.ts +18 -3
  40. package/templates/podcast-creator/l10n/fr.json +3321 -0
  41. package/templates/podcast-creator/tier5-src/wix-spaces-app-language/index.ts +18 -3
  42. package/templates/portfolio-creative/l10n/fr.json +3880 -0
  43. package/templates/portfolio-creative/tier5-src/wix-spaces-app-language/index.ts +18 -3
  44. package/templates/restaurant/l10n/fr.json +3528 -0
  45. package/templates/restaurant/tier5-src/wix-spaces-app-language/index.ts +18 -3
  46. package/templates/retail-store/l10n/fr.json +3279 -0
  47. package/templates/retail-store/tier5-src/wix-spaces-app-language/index.ts +18 -3
  48. package/templates/yoga-studio/l10n/fr.json +4531 -0
  49. package/templates/yoga-studio/tier5-src/wix-spaces-app-language/index.ts +18 -3
@@ -9,13 +9,25 @@ import { dispatch } from "@himalaya/dispatch";
9
9
  interface Row { id: string; name: string; subtitle: string; selected: boolean }
10
10
  interface S { status: "ready"; options: Row[] }
11
11
 
12
- /** Locales with catalogs (`tools/l10n/catalog.<tag>.json`) + LocaleStore support. */
13
- const LOCALE_OPTIONS: Omit<Row, "subtitle" | "selected">[] = [
12
+ /** What a host that cannot say which languages the app ships offers: the three the template's first catalogs cover. A host
13
+ * that answers `locale.get` with its `available` list (every current one) replaces this with the real list. */
14
+ const DEFAULT_OPTIONS: Omit<Row, "subtitle" | "selected">[] = [
14
15
  { id: "en", name: "English" },
15
16
  { id: "es", name: "Español" },
16
17
  { id: "he", name: "עברית" },
17
18
  ];
18
19
 
20
+ let LOCALE_OPTIONS = DEFAULT_OPTIONS;
21
+
22
+ /** The host's `available` list (`{ tag, nativeName }[]`), or undefined when it sent none that can be used. */
23
+ function optionsFrom(payload: { available?: unknown } | null): Omit<Row, "subtitle" | "selected">[] | undefined {
24
+ if (!Array.isArray(payload?.available)) return undefined;
25
+ const rows = (payload.available as { tag?: unknown; nativeName?: unknown }[])
26
+ .filter((a) => typeof a?.tag === "string" && a.tag !== "")
27
+ .map((a) => ({ id: a.tag as string, name: typeof a.nativeName === "string" && a.nativeName ? a.nativeName : (a.tag as string) }));
28
+ return rows.length ? rows : undefined;
29
+ }
30
+
19
31
  function withSelected(selected: string): Row[] {
20
32
  return LOCALE_OPTIONS.map((o) => ({
21
33
  ...o,
@@ -43,11 +55,14 @@ const svc = defineService<S, {
43
55
  },
44
56
  hydrate: async (s) => {
45
57
  try {
46
- const payload = (await dispatch("locale.get")) as { tag?: string } | null;
58
+ const payload = (await dispatch("locale.get")) as { tag?: string; available?: unknown } | null;
59
+ // The app's own languages, as its host reports them: a catalog added to the app is selectable with no change here.
60
+ LOCALE_OPTIONS = optionsFrom(payload) ?? DEFAULT_OPTIONS;
47
61
  const tag = typeof payload?.tag === "string" ? payload.tag : "en";
48
62
  if (LOCALE_OPTIONS.some((o) => o.id === tag)) {
49
63
  return { ...s, options: withSelected(tag) };
50
64
  }
65
+ return { ...s, options: withSelected("") };
51
66
  } catch {
52
67
  // ignore — leave default Selected
53
68
  }