@wix/himalaya-cli 0.1025.0 → 0.1026.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 (80) hide show
  1. package/dist/cli.mjs +0 -2
  2. package/package.json +2 -2
  3. package/templates/beauty-salon/dev/index.ts +1031 -240
  4. package/templates/beauty-salon/tier5-src/_shared/detail-presence.ts +51 -0
  5. package/templates/beauty-salon/tier5-src/himi-branded-lite-orders/index.ts +4 -1
  6. package/templates/beauty-salon/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
  7. package/templates/beauty-salon/tier5-src/wix-spaces-create-post/index.ts +14 -4
  8. package/templates/beauty-salon/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
  9. package/templates/beauty-salon/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
  10. package/templates/beauty-salon/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  11. package/templates/branded-lite/config.ts +3 -1
  12. package/templates/branded-lite/dev/index.ts +3455 -813
  13. package/templates/branded-lite/tier5-src/_shared/detail-presence.ts +51 -0
  14. package/templates/branded-lite/tier5-src/himi-branded-lite-orders/index.ts +4 -1
  15. package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio-project/index.ts +7 -2
  16. package/templates/branded-lite/tier5-src/himi-branded-lite-simple-detail/index.ts +4 -3
  17. package/templates/branded-lite/tier5-src/wix-spaces-chat-thread/index.ts +17 -4
  18. package/templates/branded-lite/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
  19. package/templates/branded-lite/tier5-src/wix-spaces-coupon-detail/index.ts +7 -9
  20. package/templates/branded-lite/tier5-src/wix-spaces-create-post/index.ts +14 -4
  21. package/templates/branded-lite/tier5-src/wix-spaces-food-order-detail/index.ts +6 -3
  22. package/templates/branded-lite/tier5-src/wix-spaces-form-detail/index.ts +7 -9
  23. package/templates/branded-lite/tier5-src/wix-spaces-forum-post/index.ts +7 -9
  24. package/templates/branded-lite/tier5-src/wix-spaces-invoice-detail/index.ts +7 -9
  25. package/templates/branded-lite/tier5-src/wix-spaces-member-detail/index.ts +8 -8
  26. package/templates/branded-lite/tier5-src/wix-spaces-photo-albums/index.ts +8 -2
  27. package/templates/branded-lite/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
  28. package/templates/branded-lite/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
  29. package/templates/branded-lite/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  30. package/templates/community-club/dev/index.ts +345 -97
  31. package/templates/community-club/tier5-src/wix-spaces-create-post/index.ts +14 -4
  32. package/templates/community-club/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  33. package/templates/events-meetups/dev/index.ts +345 -97
  34. package/templates/events-meetups/tier5-src/wix-spaces-create-post/index.ts +14 -4
  35. package/templates/events-meetups/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  36. package/templates/gym-fitness/dev/index.ts +1031 -240
  37. package/templates/gym-fitness/tier5-src/_shared/detail-presence.ts +51 -0
  38. package/templates/gym-fitness/tier5-src/himi-branded-lite-orders/index.ts +4 -1
  39. package/templates/gym-fitness/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
  40. package/templates/gym-fitness/tier5-src/wix-spaces-create-post/index.ts +14 -4
  41. package/templates/gym-fitness/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
  42. package/templates/gym-fitness/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
  43. package/templates/gym-fitness/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  44. package/templates/nonprofit-cause/dev/index.ts +732 -188
  45. package/templates/nonprofit-cause/tier5-src/_shared/detail-presence.ts +51 -0
  46. package/templates/nonprofit-cause/tier5-src/wix-spaces-create-post/index.ts +14 -4
  47. package/templates/nonprofit-cause/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
  48. package/templates/nonprofit-cause/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
  49. package/templates/nonprofit-cause/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  50. package/templates/podcast-creator/dev/index.ts +942 -321
  51. package/templates/podcast-creator/tier5-src/_shared/detail-presence.ts +51 -0
  52. package/templates/podcast-creator/tier5-src/himi-branded-lite-simple-detail/index.ts +4 -3
  53. package/templates/podcast-creator/tier5-src/wix-spaces-create-post/index.ts +14 -4
  54. package/templates/podcast-creator/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
  55. package/templates/podcast-creator/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
  56. package/templates/podcast-creator/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  57. package/templates/portfolio-creative/dev/index.ts +676 -169
  58. package/templates/portfolio-creative/tier5-src/_shared/detail-presence.ts +51 -0
  59. package/templates/portfolio-creative/tier5-src/himi-branded-lite-orders/index.ts +4 -1
  60. package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio-project/index.ts +7 -2
  61. package/templates/portfolio-creative/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
  62. package/templates/portfolio-creative/tier5-src/wix-spaces-create-post/index.ts +14 -4
  63. package/templates/portfolio-creative/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  64. package/templates/restaurant/dev/index.ts +529 -149
  65. package/templates/restaurant/tier5-src/_shared/detail-presence.ts +51 -0
  66. package/templates/restaurant/tier5-src/wix-spaces-create-post/index.ts +14 -4
  67. package/templates/restaurant/tier5-src/wix-spaces-food-order-detail/index.ts +6 -3
  68. package/templates/restaurant/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  69. package/templates/retail-store/dev/index.ts +643 -148
  70. package/templates/retail-store/tier5-src/_shared/detail-presence.ts +51 -0
  71. package/templates/retail-store/tier5-src/himi-branded-lite-orders/index.ts +4 -1
  72. package/templates/retail-store/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
  73. package/templates/retail-store/tier5-src/wix-spaces-create-post/index.ts +14 -4
  74. package/templates/retail-store/tier5-src/wix-spaces-view-profile/index.ts +22 -12
  75. package/templates/yoga-studio/dev/index.ts +711 -183
  76. package/templates/yoga-studio/tier5-src/_shared/detail-presence.ts +51 -0
  77. package/templates/yoga-studio/tier5-src/wix-spaces-create-post/index.ts +14 -4
  78. package/templates/yoga-studio/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
  79. package/templates/yoga-studio/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
  80. package/templates/yoga-studio/tier5-src/wix-spaces-view-profile/index.ts +22 -12
@@ -3,10 +3,15 @@
3
3
  // paint the seeded "apptestercoowner" demo identity when the session is a real
4
4
  // member (or a guest — show honesty instead).
5
5
  import { defineService } from "@himalaya/state";
6
- import { dispatch } from "@himalaya/dispatch";
6
+ import { memberAccess } from "../_shared/member-access.js";
7
7
  import { getMyData, displayName } from "@himalaya/wix-users";
8
8
 
9
- interface S { status: "loading" | "ready"; name: string; handle: string; about: string; initial: string; photo: string }
9
+ // `needsSignIn` / `noSignIn` drive the shared member gate: a guest gets the
10
+ // gate with a Sign in button and no placeholder profile. `profileHidden` stays true until
11
+ // `load` has resolved a member, so a guest never glimpses the placeholder avatar while
12
+ // the membership check is still running; `hideLoading` is false for exactly that moment,
13
+ // so the screen shows a loading line instead of going blank.
14
+ interface S { status: "loading" | "ready"; name: string; handle: string; about: string; initial: string; photo: string; needsSignIn: boolean; noSignIn: boolean; profileHidden: boolean; hideLoading: boolean }
10
15
 
11
16
  const EMPTY: S = {
12
17
  status: "loading",
@@ -15,18 +20,17 @@ const EMPTY: S = {
15
20
  about: "No info to display.",
16
21
  initial: "?",
17
22
  photo: "",
23
+ needsSignIn: false,
24
+ noSignIn: true,
25
+ profileHidden: true,
26
+ hideLoading: false,
18
27
  };
19
28
 
29
+ // The SAME member check create-post and orders use (`memberAccess`: the host's
30
+ // memberIdentity, falling back to wix-users only on hosts that predate that action), so
31
+ // one shared gate never gives two answers in one app.
20
32
  async function sessionEmail(): Promise<string> {
21
- try {
22
- const identity = await dispatch("himi.wix.memberIdentity") as unknown;
23
- const direct = identity as { email?: unknown } | null;
24
- const wrapped = identity as { payload?: { email?: unknown } } | null;
25
- const email = direct?.email ?? wrapped?.payload?.email;
26
- return typeof email === "string" ? email.trim() : "";
27
- } catch {
28
- return "";
29
- }
33
+ return (await memberAccess()).email;
30
34
  }
31
35
 
32
36
  function wixApi() {
@@ -37,7 +41,7 @@ function fromParts(name: string, handleRaw: string, about: string, photo = ""):
37
41
  const clean = name.trim();
38
42
  const handle = "@" + (handleRaw || clean || "member").replace(/\s+/g, "").replace(/^@+/, "").toLowerCase();
39
43
  const initial = (clean.split(/\s+/).filter(Boolean).map((w) => w[0]).join("").slice(0, 2) || "?").toUpperCase();
40
- return { status: "ready", name: clean || "Member", handle, about: about || "No info to display.", initial, photo };
44
+ return { status: "ready", name: clean || "Member", handle, about: about || "No info to display.", initial, photo, needsSignIn: false, noSignIn: true, profileHidden: false, hideLoading: true };
41
45
  }
42
46
 
43
47
  const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesViewProfile", {
@@ -48,11 +52,17 @@ const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesViewProfile"
48
52
  if (!email) {
49
53
  return {
50
54
  status: "ready",
55
+ // Kept for hosts without the shared member gate (the Spaces clone renders these
56
+ // fields directly); branded-lite hides the profile block behind `profileHidden`.
51
57
  name: "Sign in to view your profile",
52
58
  handle: "",
53
59
  about: "Your public profile is available after you sign in from Account.",
54
60
  initial: "?",
55
61
  photo: "",
62
+ needsSignIn: true,
63
+ noSignIn: false,
64
+ profileHidden: true,
65
+ hideLoading: true,
56
66
  };
57
67
  }
58
68
  try {