@wix/himalaya-cli 0.1025.0 → 0.1027.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/dev-server/src/builder.d.ts +9 -0
- package/dist/cli.mjs +1052 -655
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-config.md +6 -0
- package/guides/headless-loop.md +3 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +1476 -553
- package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/beauty-salon/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/beauty-salon/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/beauty-salon/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/beauty-salon/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/beauty-salon/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/beauty-salon/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/beauty-salon-owner/dev/index.ts +857 -458
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/branded-lite/config.ts +3 -1
- package/templates/branded-lite/dev/index.ts +6123 -2565
- package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/branded-lite/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio-project/index.ts +7 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-simple-detail/index.ts +4 -3
- package/templates/branded-lite/tier5-src/wix-spaces-chat-thread/index.ts +17 -4
- package/templates/branded-lite/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/branded-lite/tier5-src/wix-spaces-coupon-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/branded-lite/tier5-src/wix-spaces-food-order-detail/index.ts +6 -3
- package/templates/branded-lite/tier5-src/wix-spaces-form-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-forum-post/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-invoice-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-member-detail/index.ts +8 -8
- package/templates/branded-lite/tier5-src/wix-spaces-photo-albums/index.ts +8 -2
- package/templates/branded-lite/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/branded-lite/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/branded-lite/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/community-club/dev/index.ts +582 -239
- package/templates/community-club/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/community-club/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/community-club/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/community-club/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/community-club-owner/dev/index.ts +857 -458
- package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/events-meetups/dev/index.ts +547 -226
- package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/events-meetups/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/events-meetups/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/events-meetups-owner/dev/index.ts +815 -458
- package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/gym-fitness/dev/index.ts +1609 -569
- package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/gym-fitness/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/gym-fitness/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/gym-fitness/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/gym-fitness/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/gym-fitness/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/gym-fitness/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/gym-fitness-owner/dev/index.ts +758 -338
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/himi-chat/dev/index.ts +26 -1
- package/templates/nonprofit-cause/dev/index.ts +978 -341
- package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/nonprofit-cause/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/nonprofit-cause/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/nonprofit-cause/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/nonprofit-cause/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/nonprofit-cause/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/nonprofit-cause-owner/dev/index.ts +716 -338
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/owner-lite/dev/index.ts +758 -338
- package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/podcast-creator/dev/index.ts +1111 -399
- package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/podcast-creator/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-simple-detail/index.ts +4 -3
- package/templates/podcast-creator/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/podcast-creator/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/podcast-creator/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/podcast-creator/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/podcast-creator-owner/dev/index.ts +857 -458
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/portfolio-creative/dev/index.ts +964 -345
- package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/portfolio-creative/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio-project/index.ts +7 -2
- package/templates/portfolio-creative/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/portfolio-creative/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/portfolio-creative/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/portfolio-creative-owner/dev/index.ts +857 -458
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/restaurant/dev/index.ts +738 -284
- package/templates/restaurant/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/restaurant/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/restaurant/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/restaurant/tier5-src/wix-spaces-food-order-detail/index.ts +6 -3
- package/templates/restaurant/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/restaurant-owner/dev/index.ts +758 -338
- package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/retail-store/dev/index.ts +768 -298
- package/templates/retail-store/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/retail-store/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-orders/index.ts +4 -1
- package/templates/retail-store/tier5-src/wix-spaces-collection-detail/index.ts +9 -9
- package/templates/retail-store/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/retail-store/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/retail-store-owner/dev/index.ts +716 -338
- package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/surface-showcase/dev/index.ts +27 -0
- package/templates/yoga-studio/dev/index.ts +1147 -390
- package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/yoga-studio/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/yoga-studio/tier5-src/wix-spaces-create-post/index.ts +14 -4
- package/templates/yoga-studio/tier5-src/wix-spaces-plan-detail/index.ts +7 -9
- package/templates/yoga-studio/tier5-src/wix-spaces-subscription-detail/index.ts +12 -11
- package/templates/yoga-studio/tier5-src/wix-spaces-view-profile/index.ts +22 -12
- package/templates/yoga-studio-owner/dev/index.ts +716 -338
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +28 -3
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
isFollowingMember,
|
|
13
13
|
type WixMember,
|
|
14
14
|
} from "@himalaya/wix-members";
|
|
15
|
+
import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
15
16
|
|
|
16
|
-
interface S {
|
|
17
|
+
interface S extends PresenceFlags {
|
|
17
18
|
status: "loading" | "ready";
|
|
18
19
|
id: string;
|
|
19
20
|
name: string;
|
|
@@ -29,9 +30,6 @@ interface S {
|
|
|
29
30
|
followCount: string;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
function inputId(): string {
|
|
33
|
-
return (globalThis as { himalaya?: { input?: { id?: string } } }).himalaya?.input?.id ?? "";
|
|
34
|
-
}
|
|
35
33
|
function name(m: WixMember): string {
|
|
36
34
|
const nick = m.profile?.nickname?.trim();
|
|
37
35
|
if (nick) return nick;
|
|
@@ -63,11 +61,12 @@ const svc = defineService<S, {
|
|
|
63
61
|
following: 0,
|
|
64
62
|
followLabel: "Follow",
|
|
65
63
|
followCount: "0 Followers · 0 Following",
|
|
64
|
+
...presence("loading"),
|
|
66
65
|
},
|
|
67
66
|
actions: {
|
|
68
67
|
load: async (s) => {
|
|
69
|
-
const id =
|
|
70
|
-
if (!id) return { ...s, status: "ready" };
|
|
68
|
+
const id = detailInputId();
|
|
69
|
+
if (!id) return { ...s, status: "ready", ...presence("missing") };
|
|
71
70
|
try {
|
|
72
71
|
const res = await getMember(id);
|
|
73
72
|
const m = ((res as unknown as { member?: WixMember }).member) ?? (res as unknown as WixMember);
|
|
@@ -102,9 +101,10 @@ const svc = defineService<S, {
|
|
|
102
101
|
following,
|
|
103
102
|
followLabel: followLabelFor(isFollowing),
|
|
104
103
|
followCount: followCountFor(followers, following),
|
|
104
|
+
...presence("found"),
|
|
105
105
|
};
|
|
106
|
-
} catch {
|
|
107
|
-
return { ...s, status: "ready", id };
|
|
106
|
+
} catch (e) {
|
|
107
|
+
return { ...s, status: "ready", id, ...presenceAfterError(e) };
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
// REAL WRITE: two-state toggle. Flips the relationship and optimistically
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
// Tier-5 bundle: Wix Spaces clone — Photo Albums (ON-DEVICE, site-scoped).
|
|
2
2
|
// No albums API wired yet → renders the real empty state, never fabricated rows.
|
|
3
|
+
// The emptyTitle/emptyBody copy is the Spaces clone's LIST screen. An app that opens
|
|
4
|
+
// this for ONE album (branded-lite's gallery "Open album", which passes the album id)
|
|
5
|
+
// renders its own single-album copy and gates it on `noEntity`; opened with no id at
|
|
6
|
+
// all it shows the shared not-found state.
|
|
3
7
|
import { defineService } from "@himalaya/state";
|
|
8
|
+
import { presence, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
4
9
|
|
|
5
|
-
interface S { status: "ready"; emptyTitle: string; emptyBody: string }
|
|
10
|
+
interface S extends PresenceFlags { status: "ready"; emptyTitle: string; emptyBody: string }
|
|
6
11
|
|
|
7
12
|
const svc = defineService<S, { load: (s: S) => S }>("spacesPhotoAlbums", {
|
|
8
13
|
state: {
|
|
9
14
|
status: "ready",
|
|
10
15
|
emptyTitle: "No albums yet",
|
|
11
16
|
emptyBody: "Photo albums shared on this site will appear here.",
|
|
17
|
+
...presence("loading"),
|
|
12
18
|
},
|
|
13
|
-
actions: { load: (s) => s },
|
|
19
|
+
actions: { load: (s) => ({ ...s, ...presence(detailInputId() ? "found" : "missing") }) },
|
|
14
20
|
});
|
|
15
21
|
export { svc };
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
// himalaya.input.id carries the plan id; fetched via getPlan.
|
|
3
3
|
import { defineService } from "@himalaya/state";
|
|
4
4
|
import { getPlan, type WixPlan } from "@himalaya/wix-pricing-plans";
|
|
5
|
+
import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
5
6
|
|
|
6
|
-
interface S { status: "loading" | "ready"; name: string; price: string; description: string; perks: string }
|
|
7
|
+
interface S extends PresenceFlags { status: "loading" | "ready"; name: string; price: string; description: string; perks: string }
|
|
7
8
|
|
|
8
|
-
function inputId(): string {
|
|
9
|
-
return (globalThis as { himalaya?: { input?: { id?: string } } }).himalaya?.input?.id ?? "";
|
|
10
|
-
}
|
|
11
9
|
function priceOf(p: WixPlan): string {
|
|
12
10
|
const m = p.pricing?.price as unknown as { formattedAmount?: string; amount?: string; currency?: string } | undefined;
|
|
13
11
|
if (!m) return p.pricing?.freeTrialDays ? "Free trial" : "";
|
|
@@ -15,17 +13,17 @@ function priceOf(p: WixPlan): string {
|
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesPlanDetail", {
|
|
18
|
-
state: { status: "loading", name: "", price: "", description: "", perks: "" },
|
|
16
|
+
state: { status: "loading", name: "", price: "", description: "", perks: "", ...presence("loading") },
|
|
19
17
|
actions: {
|
|
20
18
|
load: async (s) => {
|
|
21
|
-
const id =
|
|
22
|
-
if (!id) return { ...s, status: "ready" };
|
|
19
|
+
const id = detailInputId();
|
|
20
|
+
if (!id) return { ...s, status: "ready", ...presence("missing") };
|
|
23
21
|
try {
|
|
24
22
|
const res = await getPlan(id);
|
|
25
23
|
const p = ((res as unknown as { plan?: WixPlan }).plan) ?? (res as unknown as WixPlan);
|
|
26
24
|
const perks = (p.perks?.values ?? []).map((v) => `• ${v}`).join("\n");
|
|
27
|
-
return { status: "ready", name: p.name || "Plan", price: priceOf(p), description: p.description || "", perks };
|
|
28
|
-
} catch { return { ...s, status: "ready" }; }
|
|
25
|
+
return { status: "ready", name: p.name || "Plan", price: priceOf(p), description: p.description || "", perks, ...presence("found") };
|
|
26
|
+
} catch (e) { return { ...s, status: "ready", ...presenceAfterError(e) }; }
|
|
29
27
|
},
|
|
30
28
|
},
|
|
31
29
|
});
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
import { defineService } from "@himalaya/state";
|
|
3
3
|
import { getPlanOrder, type WixPlanOrder } from "@himalaya/wix-pricing-plans";
|
|
4
4
|
import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
5
|
+
import { presence, presenceAfterError, detailInputId, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
5
6
|
|
|
6
|
-
interface S { status: "loading" | "ready"; name: string; subtitle: string; price: string; validity: string }
|
|
7
|
+
interface S extends PresenceFlags { status: "loading" | "ready"; name: string; subtitle: string; price: string; validity: string }
|
|
7
8
|
|
|
8
|
-
function inputId(): string {
|
|
9
|
-
return (globalThis as { himalaya?: { input?: { id?: string } } }).himalaya?.input?.id ?? "";
|
|
10
|
-
}
|
|
11
9
|
|
|
10
|
+
// Shown by hosts without the shared not-found state (the Spaces clone renders `subtitle`
|
|
11
|
+
// directly); branded-lite hides the whole content block behind `notFound`.
|
|
12
12
|
const EMPTY_DETAIL = "Open a subscription from My Subscriptions — detail needs a plan-order id.";
|
|
13
13
|
const LOAD_FAILED = "This subscription could not be loaded. Try again from My Subscriptions.";
|
|
14
14
|
|
|
15
15
|
const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesSubscriptionDetail", {
|
|
16
|
-
state: { status: "loading", name: "", subtitle: "", price: "", validity: "" },
|
|
16
|
+
state: { status: "loading", name: "", subtitle: "", price: "", validity: "", ...presence("loading") },
|
|
17
17
|
actions: {
|
|
18
18
|
load: async (s) => {
|
|
19
|
-
const id =
|
|
20
|
-
//
|
|
21
|
-
if (!id) return { status: "ready", name: "", subtitle: EMPTY_DETAIL, price: "", validity: "" };
|
|
19
|
+
const id = detailInputId();
|
|
20
|
+
// No order id (a stale link, a route opened directly) → the shared not-found state.
|
|
21
|
+
if (!id) return { status: "ready", name: "", subtitle: EMPTY_DETAIL, price: "", validity: "", ...presence("missing") };
|
|
22
22
|
try {
|
|
23
23
|
const res = await getPlanOrder(id);
|
|
24
24
|
const o = (((res as unknown as { order?: WixPlanOrder }).order) ?? (res as unknown as WixPlanOrder)) as unknown as {
|
|
@@ -29,9 +29,10 @@ const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesSubscription
|
|
|
29
29
|
const price = o.pricing?.prices?.[0]?.price?.formattedTotal || "";
|
|
30
30
|
const end = o.currentCycle?.endedDate ? `Renews ${formatDateMedium(new Date(o.currentCycle.endedDate))}` : "";
|
|
31
31
|
return { status: "ready", name: o.planName || "Subscription",
|
|
32
|
-
subtitle: o.status ? o.status.charAt(0) + o.status.slice(1).toLowerCase() : "", price, validity: end };
|
|
33
|
-
} catch {
|
|
34
|
-
|
|
32
|
+
subtitle: o.status ? o.status.charAt(0) + o.status.slice(1).toLowerCase() : "", price, validity: end, ...presence("found") };
|
|
33
|
+
} catch (e) {
|
|
34
|
+
const flags = presenceAfterError(e);
|
|
35
|
+
return { status: "ready", name: "", subtitle: flags.notFound ? "" : LOAD_FAILED, price: "", validity: "", ...flags };
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
},
|
|
@@ -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 {
|
|
6
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
7
7
|
import { getMyData, displayName } from "@himalaya/wix-users";
|
|
8
8
|
|
|
9
|
-
|
|
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
|
-
|
|
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 {
|