@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.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/locale.d.ts +3 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +57 -3
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +51 -2
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{4235535ddd6e62ae867fd4d3588054909040428cffec9bea2807693a68e297d9.bin → d13ef703cc8f4d7eaa9b12967b618314b75002b5d4441dedbcc65e3601c4750d.bin} +1 -1
- package/dist/browser-plane/sw.js +6 -6
- package/dist/cli.mjs +338 -155
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/himi-json-output.md +1 -1
- package/guides/one-app-to-himi-app.md +11 -2
- package/package.json +2 -2
- package/templates/beauty-salon/l10n/fr.json +4806 -0
- package/templates/beauty-salon/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/branded-lite/l10n/fr.json +9088 -0
- package/templates/branded-lite/l10n/he.json +4 -0
- package/templates/branded-lite/tier5-src/_shared/group-privacy.ts +14 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-group/index.ts +11 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
- package/templates/branded-lite/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/community-club/l10n/fr.json +3026 -0
- package/templates/community-club/l10n/he.json +12 -0
- package/templates/community-club/tier5-src/_shared/group-privacy.ts +14 -0
- package/templates/community-club/tier5-src/himi-branded-lite-group/index.ts +11 -4
- package/templates/community-club/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
- package/templates/community-club/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/events-meetups/l10n/fr.json +2886 -0
- package/templates/events-meetups/l10n/he.json +12 -0
- package/templates/events-meetups/tier5-src/_shared/group-privacy.ts +14 -0
- package/templates/events-meetups/tier5-src/himi-branded-lite-group/index.ts +11 -4
- package/templates/events-meetups/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
- package/templates/events-meetups/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/gym-fitness/l10n/fr.json +5412 -0
- package/templates/gym-fitness/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/nonprofit-cause/l10n/fr.json +3499 -0
- package/templates/nonprofit-cause/l10n/he.json +12 -0
- package/templates/nonprofit-cause/tier5-src/_shared/group-privacy.ts +14 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group/index.ts +11 -4
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group-about/index.ts +2 -6
- package/templates/nonprofit-cause/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/podcast-creator/l10n/fr.json +3321 -0
- package/templates/podcast-creator/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/portfolio-creative/l10n/fr.json +3880 -0
- package/templates/portfolio-creative/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/restaurant/l10n/fr.json +3528 -0
- package/templates/restaurant/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/retail-store/l10n/fr.json +3279 -0
- package/templates/retail-store/tier5-src/wix-spaces-app-language/index.ts +18 -3
- package/templates/yoga-studio/l10n/fr.json +4531 -0
- 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
|
-
/**
|
|
13
|
-
|
|
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
|
}
|