@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
@@ -1758,10 +1758,22 @@
1758
1758
  "source": "This site is not accepting online payments. Go back or contact the business for other payment options.",
1759
1759
  "translation": "האתר הזה אינו מקבל תשלומים מקוונים. אפשר לחזור אחורה או לפנות לעסק לבירור אפשרויות תשלום אחרות."
1760
1760
  },
1761
+ "h_237dfa0a21c8": {
1762
+ "source": "Private",
1763
+ "translation": "פרטית"
1764
+ },
1761
1765
  "h_dc5eb704bbca": {
1762
1766
  "source": "Public",
1763
1767
  "translation": "ציבורית"
1764
1768
  },
1769
+ "h_f4e7a8740db0": {
1770
+ "source": "Secret",
1771
+ "translation": "סודית"
1772
+ },
1773
+ "h_bc7819b34ff8": {
1774
+ "source": "Unknown",
1775
+ "translation": "לא ידוע"
1776
+ },
1765
1777
  "h_eee52995478b": {
1766
1778
  "source": "Signed in as {email}",
1767
1779
  "translation": "מחובר/ת בתור {email}"
@@ -0,0 +1,14 @@
1
+ import { copyParam } from "./himi-copy.js";
2
+
3
+ /** The label for a group's privacy status ("Private"), through the copy pack so a translated app reads it in
4
+ * its own language. A status with no key of its own (anything Wix adds later) keeps its capitalised English.
5
+ * A screen that renders it must carry the `group.privacy*` keys: its `appear()` lists the `group.` prefix, or
6
+ * these keys exactly when it reads another namespace (the group About page). */
7
+ export function groupPrivacyLabel(status: string): string {
8
+ const lower = status.trim().toLowerCase();
9
+ if (lower === "public") return copyParam("group.privacyPublic", "Public");
10
+ if (lower === "private") return copyParam("group.privacyPrivate", "Private");
11
+ if (lower === "secret") return copyParam("group.privacySecret", "Secret");
12
+ if (lower === "unknown") return copyParam("group.privacyUnknown", "Unknown");
13
+ return lower ? lower[0].toUpperCase() + lower.slice(1) : "";
14
+ }
@@ -8,6 +8,7 @@ import { groupImage } from "../_shared/himi-media.js";
8
8
  import { WIX_DETAIL_IMAGE } from "@himalaya/wix-media";
9
9
  import { copyParam, stashCopy } from "../_shared/himi-copy.js";
10
10
  import { cachedMemberCount, groupMemberCount } from "../_shared/group-member-count.js";
11
+ import { groupPrivacyLabel } from "../_shared/group-privacy.js";
11
12
  import { get as dbGet, upsert as dbUpsert, type DbEntity } from "@himalaya/local-db";
12
13
  import { isOfflineFailure, writeMayHaveLanded } from "../_shared/owner-load-error";
13
14
  import { descriptionBody } from "../_shared/rich-body.js";
@@ -57,7 +58,10 @@ interface State {
57
58
  description: string;
58
59
  descriptionJson: string;
59
60
  hasDescriptionJson: boolean;
61
+ /** The privacy label as painted (copy-pack translated); never compared, see `privacyKind`. */
60
62
  privacy: string;
63
+ /** The raw status the label was made from (`public`, `private`, `secret`, `unknown`, …): what join logic reads. */
64
+ privacyKind: string;
61
65
  memberCount: string;
62
66
  /** The raw count behind `memberCount`, written to the offline cache instead of the label. */
63
67
  memberTotal: number | null;
@@ -98,7 +102,7 @@ function inputId(): string {
98
102
  }
99
103
 
100
104
  function membershipState(state: State, joined: boolean, signedIn: boolean): State {
101
- const isPublic = state.privacy === "Public" || state.privacy === "Unknown";
105
+ const isPublic = state.privacyKind === "public" || state.privacyKind === "unknown";
102
106
  return {
103
107
  ...state,
104
108
  isJoined: joined,
@@ -143,6 +147,7 @@ const initial: State = {
143
147
  descriptionJson: "",
144
148
  hasDescriptionJson: false,
145
149
  privacy: "",
150
+ privacyKind: "",
146
151
  memberCount: "",
147
152
  memberTotal: null,
148
153
  memberAvatars: [],
@@ -188,7 +193,7 @@ const svc = defineService<State, {
188
193
  const image = groupImage(group, WIX_DETAIL_IMAGE);
189
194
  const count = group.membersCount ?? group.memberCount;
190
195
  const privacy = (group.privacyStatus || "UNKNOWN").toLowerCase();
191
- const privacyLabel = privacy[0].toUpperCase() + privacy.slice(1);
196
+ const privacyLabel = groupPrivacyLabel(privacy);
192
197
  const signedIn = Boolean(await signedInEmail());
193
198
  const memberAvatars = await memberAvatarsOf(id);
194
199
  const body = descriptionBody(group.description, descriptionBody(group.teaser,
@@ -202,6 +207,7 @@ const svc = defineService<State, {
202
207
  descriptionJson: body.bodyJson,
203
208
  hasDescriptionJson: body.bodyJson !== "",
204
209
  privacy: privacyLabel,
210
+ privacyKind: privacy,
205
211
  memberCount: count == null ? "" : groupMemberCount(count),
206
212
  memberTotal: count ?? null,
207
213
  memberAvatars,
@@ -236,7 +242,8 @@ const svc = defineService<State, {
236
242
  description: body.bodyText,
237
243
  descriptionJson: body.bodyJson,
238
244
  hasDescriptionJson: body.bodyJson !== "",
239
- privacy: "Unknown",
245
+ privacy: groupPrivacyLabel("unknown"),
246
+ privacyKind: "unknown",
240
247
  memberCount: cachedMemberCount(cached.count),
241
248
  memberTotal: typeof cached.count === "number" ? cached.count : null,
242
249
  image,
@@ -259,7 +266,7 @@ const svc = defineService<State, {
259
266
  join: async (state) => {
260
267
  const signedIn = Boolean(await signedInEmail());
261
268
  if (!signedIn) return membershipState({ ...state, message: copyParam("group.joinSignInMessage", "Sign in from Profile to join groups.") }, false, false);
262
- if (state.privacy !== "Public" && state.privacy !== "Unknown") {
269
+ if (state.privacyKind !== "public" && state.privacyKind !== "unknown") {
263
270
  return membershipState({ ...state, message: copyParam("group.privateInviteMessage", "Private groups are available by invitation.") }, false, true);
264
271
  }
265
272
  try {
@@ -3,6 +3,7 @@ import { getGroup, listRules, type WixGroup, type WixGroupRule } from "@himalaya
3
3
  import { WIX_DETAIL_IMAGE } from "@himalaya/wix-media";
4
4
  import { copyParam, stashCopy } from "../_shared/himi-copy.js";
5
5
  import { groupMemberCount } from "../_shared/group-member-count.js";
6
+ import { groupPrivacyLabel } from "../_shared/group-privacy.js";
6
7
  import { groupImage } from "../_shared/himi-media.js";
7
8
  import { descriptionBody } from "../_shared/rich-body.js";
8
9
  import { openRichLink } from "../_shared/rich-content-link.js";
@@ -144,11 +145,6 @@ function withRules(state: State, rules: RuleRow[] | undefined, failure: Failure
144
145
  };
145
146
  }
146
147
 
147
- function capitalized(value: string): string {
148
- const lower = value.trim().toLowerCase();
149
- return lower ? lower[0].toUpperCase() + lower.slice(1) : "";
150
- }
151
-
152
148
  function createdLabel(value: unknown): string {
153
149
  if (typeof value !== "string" || !value) return "";
154
150
  const date = new Date(value);
@@ -158,7 +154,7 @@ function createdLabel(value: unknown): string {
158
154
  function groupState(state: State, id: string, group: WixGroup): State {
159
155
  const name = (group.name || (group as { title?: string }).title || copyParam("group.groupFallbackName", "Group")).trim();
160
156
  const body = descriptionBody(group.description, descriptionBody(group.teaser, "").bodyText);
161
- const privacy = capitalized(group.privacyStatus ?? "");
157
+ const privacy = groupPrivacyLabel(group.privacyStatus ?? "");
162
158
  const created = createdLabel(group.createdDate);
163
159
  const count = group.membersCount ?? group.memberCount;
164
160
  const image = groupImage(group, WIX_DETAIL_IMAGE);
@@ -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
  }