@wix/himalaya-cli 0.1663.0 → 0.1665.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/THIRD_PARTY_NOTICES +47 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +6 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +6 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +3 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +3 -2
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{5fe817d61d13666ee8e6951d96a873f768ef305462735f6030cce105f1c21488.bin → 7700021a25a8d932331f2abf6ba6c2f13b2a18cabfc4ce8b02aa0ed1ae973ffc.bin} +1 -1
- package/dist/browser-plane/sw.js +8 -8
- package/dist/cli.mjs +44406 -12484
- package/dist/preview-assets.generated.bin +0 -0
- package/fixtures/wix-canned.json +3 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +1 -0
- package/guides/himi-json-output.md +35 -0
- package/guides/himi-mcp.md +19 -3
- package/guides/index.json +6 -0
- package/guides/store-submission.md +171 -0
- package/package.json +11 -4
- package/templates/beauty-salon/config.ts +1 -1
- package/templates/beauty-salon/l10n/en.json +1 -1
- package/templates/beauty-salon/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/beauty-salon-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/branded-lite/config.ts +1 -1
- package/templates/branded-lite/dev/index.ts +214 -122
- package/templates/branded-lite/l10n/en.json +18 -25
- package/templates/branded-lite/l10n/he.json +22 -17
- package/templates/branded-lite/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/branded-lite/tier5-src/wix-spaces-member-detail/index.ts +144 -75
- package/templates/community-club/config.ts +1 -1
- package/templates/community-club/l10n/en.json +1 -1
- package/templates/community-club/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/community-club-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/conference/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/events-meetups/config.ts +1 -1
- package/templates/events-meetups/l10n/en.json +1 -1
- package/templates/events-meetups/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/events-meetups-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/gym-fitness/config.ts +1 -1
- package/templates/gym-fitness/l10n/en.json +1 -1
- package/templates/gym-fitness/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/gym-fitness-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/nonprofit-cause/config.ts +1 -1
- package/templates/nonprofit-cause/l10n/en.json +1 -1
- package/templates/nonprofit-cause/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/nonprofit-cause-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/owner-lite/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/podcast-creator/config.ts +1 -1
- package/templates/podcast-creator/l10n/en.json +1 -1
- package/templates/podcast-creator/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/podcast-creator-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/portfolio-creative/config.ts +1 -1
- package/templates/portfolio-creative/l10n/en.json +1 -1
- package/templates/portfolio-creative/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/portfolio-creative-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/restaurant/config.ts +1 -1
- package/templates/restaurant/l10n/en.json +1 -1
- package/templates/restaurant/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/restaurant-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/retail-store/config.ts +1 -1
- package/templates/retail-store/l10n/en.json +1 -1
- package/templates/retail-store/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/retail-store-owner/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/salon-spa/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/wholesale-store/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/yoga-studio/config.ts +1 -1
- package/templates/yoga-studio/l10n/en.json +1 -1
- package/templates/yoga-studio/tier5-src/_shared/engine-intl.ts +3 -4
- package/templates/yoga-studio-owner/tier5-src/_shared/engine-intl.ts +3 -4
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// MemberFollowers API. A visitor never writes: Follow opens sign-in (the descriptor routes it).
|
|
8
8
|
import { classifyLoadError, defineService } from "@himalaya/state";
|
|
9
9
|
import { share as shareSheet } from "@himalaya/share";
|
|
10
|
+
import { snackbar as showSnackbar } from "@himalaya/ui";
|
|
10
11
|
import {
|
|
11
12
|
getMember,
|
|
12
13
|
followMember,
|
|
@@ -26,9 +27,11 @@ import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
|
26
27
|
import { presence, presenceAfterError, detailInputId, isNotFoundError, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
27
28
|
|
|
28
29
|
import { readAccess, assertReadAccess, readAccessDenied, readSignInFlags, NO_READ_SIGN_IN, type ReadAccess } from "../_shared/member-read.js";
|
|
30
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
29
31
|
|
|
30
32
|
const POST_LIMIT = 3;
|
|
31
|
-
|
|
33
|
+
// The descriptor's 64pt square preview at up to 3x density.
|
|
34
|
+
const POST_THUMB_IMAGE = { width: 192, height: 192 };
|
|
32
35
|
|
|
33
36
|
interface PostRow {
|
|
34
37
|
id: string;
|
|
@@ -55,7 +58,7 @@ interface S extends PresenceFlags {
|
|
|
55
58
|
followers: number | null;
|
|
56
59
|
following: number | null;
|
|
57
60
|
followCount: string;
|
|
58
|
-
/**
|
|
61
|
+
/** Backward-compatible label used by the wix-spaces-clone fixture. */
|
|
59
62
|
followLabel: string;
|
|
60
63
|
followBusy: boolean;
|
|
61
64
|
/** True for a visitor: Follow and Message open sign-in instead of acting. */
|
|
@@ -72,11 +75,7 @@ interface S extends PresenceFlags {
|
|
|
72
75
|
forumPosts: PostRow[];
|
|
73
76
|
/** One-shot snackbar after a failed follow write. */
|
|
74
77
|
snackbarMessage: string;
|
|
75
|
-
/** Which failure the snackbar reports; the descriptor holds one literal-copy Snackbar per kind (a native Snackbar does not resolve a bound message). */
|
|
76
|
-
snackbarKind: "" | "follow" | "unfollow";
|
|
77
78
|
noSnackbar: boolean;
|
|
78
|
-
noFollowError: boolean;
|
|
79
|
-
noUnfollowError: boolean;
|
|
80
79
|
/** The Follow / Following swap, and the guest variant of Follow. */
|
|
81
80
|
hideFollow: boolean;
|
|
82
81
|
hideFollowing: boolean;
|
|
@@ -134,7 +133,6 @@ export function profileUrl(siteUrl: string, slug: string): string {
|
|
|
134
133
|
return `${m[1].toLowerCase()}://${m[2].toLowerCase()}${m[3].replace(/\/$/, "")}/profile/${encodeURIComponent(slug)}/profile`;
|
|
135
134
|
}
|
|
136
135
|
function derive(s: S): S {
|
|
137
|
-
// The counts line is gated on the text it will show, so a header built from INITIAL (followCount "") still shows known counts.
|
|
138
136
|
const followCount = followCountFor(s.followers, s.following);
|
|
139
137
|
return {
|
|
140
138
|
...s,
|
|
@@ -145,7 +143,6 @@ function derive(s: S): S {
|
|
|
145
143
|
hideAbout: !s.hasAbout, hideBadges: !s.hasBadges, hideBlogPosts: !s.hasBlogPosts, hideForumPosts: !s.hasForumPosts,
|
|
146
144
|
hideCounts: !followCount, hideJoined: !s.hasJoined,
|
|
147
145
|
noSnackbar: !s.snackbarMessage,
|
|
148
|
-
noFollowError: s.snackbarKind !== "follow" || !s.snackbarMessage, noUnfollowError: s.snackbarKind !== "unfollow" || !s.snackbarMessage,
|
|
149
146
|
followCount,
|
|
150
147
|
followLabel: s.isFollowing ? "Following ✓" : "Follow",
|
|
151
148
|
};
|
|
@@ -158,11 +155,11 @@ function postMeta(date: string | undefined, minutes: number | undefined): string
|
|
|
158
155
|
}
|
|
159
156
|
function blogRow(p: WixBlogPost): PostRow {
|
|
160
157
|
const m = p.media;
|
|
161
|
-
return { id: p.id, title: p.title || "", meta: postMeta(p.firstPublishedDate, p.minutesToRead), thumb: wixMediaUrl(m?.wixMedia?.image?.url || m?.embedMedia?.thumbnail?.url,
|
|
158
|
+
return { id: p.id, title: p.title || "", meta: postMeta(p.firstPublishedDate, p.minutesToRead), thumb: wixMediaUrl(m?.wixMedia?.image?.url, POST_THUMB_IMAGE) || wixMediaUrl(m?.embedMedia?.thumbnail?.url, POST_THUMB_IMAGE) };
|
|
162
159
|
}
|
|
163
160
|
function forumRow(p: WixForumPost): PostRow {
|
|
164
161
|
const first = (p.images ?? [])[0] as { url?: string } | string | undefined;
|
|
165
|
-
return { id: p.id, title: p.title || "", meta: postMeta(p.createdDate, undefined), thumb: wixMediaUrl(typeof first === "string" ? first : first?.url,
|
|
162
|
+
return { id: p.id, title: p.title || "", meta: postMeta(p.createdDate, undefined), thumb: wixMediaUrl(typeof first === "string" ? first : first?.url, POST_THUMB_IMAGE) };
|
|
166
163
|
}
|
|
167
164
|
|
|
168
165
|
const INITIAL: S = derive({
|
|
@@ -193,10 +190,7 @@ const INITIAL: S = derive({
|
|
|
193
190
|
hasForumPosts: false,
|
|
194
191
|
forumPosts: [],
|
|
195
192
|
snackbarMessage: "",
|
|
196
|
-
snackbarKind: "",
|
|
197
193
|
noSnackbar: true,
|
|
198
|
-
noFollowError: true,
|
|
199
|
-
noUnfollowError: true,
|
|
200
194
|
hideFollow: false,
|
|
201
195
|
hideFollowing: true,
|
|
202
196
|
hideAbout: true,
|
|
@@ -212,45 +206,49 @@ const INITIAL: S = derive({
|
|
|
212
206
|
...presence("loading"), ...NO_READ_SIGN_IN,
|
|
213
207
|
});
|
|
214
208
|
let loadVersion = 0;
|
|
209
|
+
let followRevision = 0;
|
|
215
210
|
let loadedAccess: ReadAccess | undefined;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
211
|
+
let cachedAccess: ReadAccess | undefined;
|
|
212
|
+
function sameAccess(a: ReadAccess | undefined, b: ReadAccess | undefined): boolean {
|
|
213
|
+
return !!a && !!b && a.tenant === b.tenant && a.member.scope === b.member.scope && a.member.email === b.member.email;
|
|
214
|
+
}
|
|
219
215
|
let siteUrlParam = "";
|
|
220
216
|
let sectionsEnabled = false;
|
|
221
217
|
let blogEnabled = false;
|
|
222
218
|
let forumEnabled = false;
|
|
223
219
|
const pendingFollows = new Set<string>();
|
|
224
220
|
|
|
225
|
-
/**
|
|
221
|
+
/** Use the shared classifier so programming errors are never called connectivity failures. */
|
|
226
222
|
function errorVariantOf(e: unknown): string {
|
|
227
223
|
return classifyLoadError(e) === "offline" ? "offline" : "server";
|
|
228
224
|
}
|
|
229
225
|
|
|
230
|
-
|
|
231
|
-
prepare: (s: S) => S;
|
|
232
|
-
resetToSkeleton: (s: S) => S;
|
|
226
|
+
const svc = defineService<S, {
|
|
227
|
+
prepare: (s: S, context?: { access: ReadAccess; cached?: S }) => S;
|
|
233
228
|
load: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
234
229
|
retry: (s: S) => Promise<S | undefined>;
|
|
235
230
|
toggleFollow: (s: S) => Promise<S | undefined>;
|
|
236
231
|
follow: (s: S) => Promise<S | undefined>;
|
|
237
232
|
unfollow: (s: S) => Promise<S | undefined>;
|
|
233
|
+
resetToSkeleton: (s: S) => S;
|
|
234
|
+
retryFollow: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
238
235
|
share: (s: S) => Promise<S | undefined>;
|
|
239
236
|
applySections: (s: S) => S | undefined;
|
|
240
237
|
setBusy: (s: S, busy: boolean) => S;
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
const svc: ReturnType<typeof defineService<S, Actions>> = defineService<S, Actions>("spacesMemberDetail", {
|
|
238
|
+
syncBusy: (s: S) => S;
|
|
239
|
+
}>("spacesMemberDetail", {
|
|
244
240
|
state: INITIAL,
|
|
245
241
|
actions: {
|
|
246
242
|
// A revisit keeps the cached profile on screen: only the first load starts from the skeleton.
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
prepare: (_s, context) => {
|
|
244
|
+
const { access, cached } = context ?? {};
|
|
245
|
+
const keep = cached?.found && cached.id === detailInputId() && sameAccess(cachedAccess, access);
|
|
246
|
+
// Cached content becomes actionable again only after the same reader/site has been verified.
|
|
247
|
+
loadedAccess = keep ? access : undefined;
|
|
248
|
+
if (!keep) cachedAccess = undefined;
|
|
249
|
+
return derive(keep ? { ...cached, ...sectionsOf(cached), snackbarMessage: "" } : { ...INITIAL });
|
|
252
250
|
},
|
|
253
|
-
resetToSkeleton: (
|
|
251
|
+
resetToSkeleton: (): S => ({ ...INITIAL }),
|
|
254
252
|
load: async (s, arg): Promise<S | undefined> => {
|
|
255
253
|
stashCopy(arg);
|
|
256
254
|
if (arg && typeof arg === "object") {
|
|
@@ -261,24 +259,38 @@ const svc: ReturnType<typeof defineService<S, Actions>> = defineService<S, Actio
|
|
|
261
259
|
if (a.forum !== undefined) forumEnabled = a.forum === "1" || a.forum === true;
|
|
262
260
|
}
|
|
263
261
|
const version = ++loadVersion;
|
|
264
|
-
await svc.prepare();
|
|
265
262
|
const id = detailInputId();
|
|
266
|
-
|
|
263
|
+
// The bridge may be resolving a different reader even for the same profile ID.
|
|
264
|
+
// Keep the cache private until identity is known; restore it before the network re-read
|
|
265
|
+
// for the same reader, so pending member/relationship reads still allow cached actions.
|
|
266
|
+
loadedAccess = undefined;
|
|
267
|
+
await svc.resetToSkeleton();
|
|
268
|
+
if (version !== loadVersion) return undefined;
|
|
269
|
+
if (!id) return { ...INITIAL, status: "ready", noShare: true, ...presence("missing") };
|
|
270
|
+
let access: ReadAccess | undefined;
|
|
271
|
+
let prior: S | undefined;
|
|
267
272
|
try {
|
|
268
|
-
|
|
269
|
-
if (
|
|
273
|
+
access = await readAccess();
|
|
274
|
+
if (version !== loadVersion) return undefined;
|
|
275
|
+
await svc.prepare({ access, cached: s });
|
|
276
|
+
const prepared = svc.getState();
|
|
277
|
+
prior = prepared.found && prepared.id === id ? prepared : undefined;
|
|
278
|
+
const followAtStart = followRevision;
|
|
270
279
|
const res = await getMember(id);
|
|
271
280
|
const m = ((res as unknown as { member?: WixMember }).member) ?? (res as unknown as WixMember);
|
|
272
281
|
const n = name(m);
|
|
273
|
-
//
|
|
274
|
-
// An anonymous read carries "UNKNOWN" for both fields (the public fieldset): that is not a refusal, so it passes.
|
|
282
|
+
// Anonymous public reads may omit status fields (UNKNOWN). Explicit refusals hide the profile.
|
|
275
283
|
const known = (v: string | undefined): v is string => !!v && v !== "UNKNOWN";
|
|
276
|
-
|
|
277
|
-
if (hidden) {
|
|
284
|
+
if ((known(m.privacyStatus) && m.privacyStatus !== "PUBLIC") || (known(m.status) && m.status !== "APPROVED")) {
|
|
278
285
|
await assertReadAccess(access);
|
|
279
|
-
|
|
286
|
+
if (version !== loadVersion) return undefined;
|
|
287
|
+
loadedAccess = undefined;
|
|
288
|
+
cachedAccess = undefined;
|
|
289
|
+
sections = {};
|
|
290
|
+
return { ...INITIAL, status: "ready", id, ...presence("missing") };
|
|
280
291
|
}
|
|
281
292
|
|
|
293
|
+
|
|
282
294
|
// A forbidden/missing aggregate is unknown, while the public profile
|
|
283
295
|
// remains readable. The descriptor collapses an empty count label.
|
|
284
296
|
let followers: number | null = null;
|
|
@@ -296,15 +308,15 @@ const svc: ReturnType<typeof defineService<S, Actions>> = defineService<S, Actio
|
|
|
296
308
|
|
|
297
309
|
await assertReadAccess(access);
|
|
298
310
|
if (version !== loadVersion) return undefined;
|
|
311
|
+
// A cached Follow/Unfollow may finish while these reads are pending. Re-read
|
|
312
|
+
// rather than let their older relationship/counts undo the confirmed write.
|
|
313
|
+
if (followAtStart !== followRevision) return svc.load();
|
|
299
314
|
loadedAccess = access;
|
|
300
|
-
|
|
315
|
+
cachedAccess = access;
|
|
301
316
|
const slug = m.profile?.slug?.trim() || "";
|
|
302
317
|
const shareUrl = profileUrl(siteUrlParam, slug);
|
|
303
318
|
const joined = joinedFor(m.createdDate);
|
|
304
319
|
// A revisit keeps the sections it already showed until their re-reads land, so nothing shifts.
|
|
305
|
-
// Another reader (signed out, another account, another site) never inherits the previous reader's sections.
|
|
306
|
-
const prior = s.found && s.id === id && readerKey === loadedReader ? s : undefined;
|
|
307
|
-
loadedReader = readerKey;
|
|
308
320
|
const header = derive({
|
|
309
321
|
...INITIAL, ...(prior ? sectionsOf(prior) : {}), status: "ready",
|
|
310
322
|
id,
|
|
@@ -317,6 +329,7 @@ const svc: ReturnType<typeof defineService<S, Actions>> = defineService<S, Actio
|
|
|
317
329
|
followers,
|
|
318
330
|
following,
|
|
319
331
|
isGuest: !access.member.email,
|
|
332
|
+
followBusy: pendingFollows.has(JSON.stringify([access.tenant, access.member.scope, access.member.email, id])),
|
|
320
333
|
...presence("found"),
|
|
321
334
|
});
|
|
322
335
|
// The header paints now; the secondary sections arrive one by one below.
|
|
@@ -324,18 +337,33 @@ const svc: ReturnType<typeof defineService<S, Actions>> = defineService<S, Actio
|
|
|
324
337
|
if (sectionsEnabled) void publishSections(id, version, access);
|
|
325
338
|
return header;
|
|
326
339
|
} catch (e) {
|
|
340
|
+
if (version !== loadVersion) return undefined;
|
|
341
|
+
// Only an availability failure for this same reader may retain a cached profile.
|
|
342
|
+
// A refusal, deletion or context switch must clear it.
|
|
343
|
+
let currentAccess = false;
|
|
344
|
+
if (access) {
|
|
345
|
+
try { await assertReadAccess(access); currentAccess = true; } catch { /* changed identity/site */ }
|
|
346
|
+
}
|
|
347
|
+
if (version !== loadVersion) return undefined;
|
|
348
|
+
if (prior && access && currentAccess && !readAccessDenied(e) && !isNotFoundError(e)) {
|
|
349
|
+
loadedAccess = access;
|
|
350
|
+
return derive({ ...prior, snackbarMessage: "", followBusy: pendingFollows.has(JSON.stringify([access.tenant, access.member.scope, access.member.email, id])) });
|
|
351
|
+
}
|
|
352
|
+
loadedAccess = undefined;
|
|
353
|
+
cachedAccess = undefined;
|
|
354
|
+
sections = {};
|
|
327
355
|
const flags = await readSignInFlags(e);
|
|
328
|
-
return version === loadVersion ? derive({ ...INITIAL, status: "ready", id, ...presenceAfterError(e), ...flags, errorVariant: errorVariantOf(e) }) : undefined;
|
|
356
|
+
return version === loadVersion ? derive({ ...INITIAL, status: "ready", id, noShare: true, ...presenceAfterError(e), ...flags, errorVariant: errorVariantOf(e) }) : undefined;
|
|
329
357
|
}
|
|
330
358
|
},
|
|
331
359
|
retry: async (): Promise<S | undefined> => svc.load(),
|
|
332
|
-
//
|
|
333
|
-
follow: async (s): Promise<S | undefined> =>
|
|
334
|
-
unfollow: async (s): Promise<S | undefined> =>
|
|
360
|
+
// Directional actions do not reverse a stale Follow/Unfollow tap after relationship state changes.
|
|
361
|
+
follow: async (s): Promise<S | undefined> => s.isFollowing ? undefined : svc.toggleFollow(),
|
|
362
|
+
unfollow: async (s): Promise<S | undefined> => s.isFollowing ? svc.toggleFollow() : undefined,
|
|
335
363
|
// REAL WRITE: two-state toggle. A visitor never reaches it (the descriptor opens sign-in), and a
|
|
336
364
|
// guest that does is ignored. Flips the relationship, then adjusts the follower total.
|
|
337
|
-
toggleFollow: async (s) => {
|
|
338
|
-
if (!s.id) return
|
|
365
|
+
toggleFollow: async (s): Promise<S | undefined> => {
|
|
366
|
+
if (!s.found || !s.id) return undefined;
|
|
339
367
|
const access = loadedAccess;
|
|
340
368
|
if (!access || detailInputId() !== s.id) return undefined;
|
|
341
369
|
if (!access.member.email) return undefined;
|
|
@@ -361,32 +389,53 @@ const svc: ReturnType<typeof defineService<S, Actions>> = defineService<S, Actio
|
|
|
361
389
|
if (detailInputId() === s.id) await svc.load();
|
|
362
390
|
return undefined;
|
|
363
391
|
}
|
|
392
|
+
followRevision++;
|
|
364
393
|
const isFollowing = !s.isFollowing;
|
|
365
394
|
const followers = s.followers === null ? null : Math.max(0, s.followers + (isFollowing ? 1 : -1));
|
|
366
|
-
return derive({ ...svc.getState(), isFollowing, followers, followBusy: false, snackbarMessage: ""
|
|
395
|
+
return derive({ ...svc.getState(), isFollowing, followers, followBusy: false, snackbarMessage: "" });
|
|
367
396
|
} catch {
|
|
368
397
|
// A failed write belongs only to the reader who loaded this profile. Compare explicitly: a
|
|
369
398
|
// context change discards this completion; a failure for the same reader keeps the old state
|
|
370
399
|
// and raises the retry snackbar.
|
|
371
400
|
const now = await readAccess();
|
|
372
|
-
if (now.member.email !== access.member.email || now.member.scope !== access.member.scope || now.tenant !== access.tenant)
|
|
401
|
+
if (now.member.email !== access.member.email || now.member.scope !== access.member.scope || now.tenant !== access.tenant) return undefined;
|
|
373
402
|
if (!current()) return undefined;
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
403
|
+
// Imperative presentation is a one-shot event, not persisted screen state that can
|
|
404
|
+
// replay after a remount. The native presenter owns dismissal and Retry routing.
|
|
405
|
+
void showSnackbar({
|
|
406
|
+
message: s.isFollowing ? copyParam("member.unfollowError", "Couldn't unfollow. Try again.") : copyParam("member.followError", "Couldn't follow. Try again."),
|
|
407
|
+
tone: "danger", durationMs: 4000,
|
|
408
|
+
action: { label: copyParam("common.retryCta", "Retry"), actionId: "tier5.spacesMemberDetail.retryFollow", args: { id: s.id, version, following: s.isFollowing } },
|
|
409
|
+
}).catch(() => { /* an unavailable presenter must not fail the worker */ });
|
|
410
|
+
return derive({ ...svc.getState(), followBusy: false, snackbarMessage: "" });
|
|
379
411
|
} finally {
|
|
380
412
|
pendingFollows.delete(pendingKey);
|
|
413
|
+
void svc.syncBusy();
|
|
381
414
|
}
|
|
382
415
|
},
|
|
416
|
+
retryFollow: async (s, arg): Promise<S | undefined> => {
|
|
417
|
+
const failed = arg as { id?: unknown; version?: unknown; following?: unknown } | undefined;
|
|
418
|
+
if (!failed || failed.id !== s.id || failed.version !== loadVersion || failed.following !== s.isFollowing) return undefined;
|
|
419
|
+
// toggleFollow revalidates the captured reader/site again before issuing the write.
|
|
420
|
+
return svc.toggleFollow();
|
|
421
|
+
},
|
|
383
422
|
applySections: (s) => (s.found && s.id === detailInputId() ? derive({ ...s, ...sections }) : undefined),
|
|
384
|
-
setBusy: (s, busy) => derive({ ...s, followBusy: busy,
|
|
385
|
-
|
|
386
|
-
|
|
423
|
+
setBusy: (s, busy) => derive({ ...s, followBusy: busy, snackbarMessage: busy ? "" : s.snackbarMessage }),
|
|
424
|
+
syncBusy: (s): S => {
|
|
425
|
+
const access = loadedAccess;
|
|
426
|
+
if (!access || !s.found || s.id !== detailInputId()) return s;
|
|
427
|
+
return derive({ ...s, followBusy: pendingFollows.has(JSON.stringify([access.tenant, access.member.scope, access.member.email, s.id])) });
|
|
428
|
+
},
|
|
387
429
|
share: async (s): Promise<S | undefined> => {
|
|
388
|
-
|
|
389
|
-
|
|
430
|
+
const access = loadedAccess;
|
|
431
|
+
const version = loadVersion;
|
|
432
|
+
if (!s.found || !s.shareUrl || !access || detailInputId() !== s.id) return undefined;
|
|
433
|
+
try {
|
|
434
|
+
await assertReadAccess(access);
|
|
435
|
+
if (version !== loadVersion || loadedAccess !== access || detailInputId() !== s.id) return undefined;
|
|
436
|
+
await shareSheet({ subject: s.name, url: s.shareUrl });
|
|
437
|
+
} catch { /* changed identity, unavailable presenter or cancellation makes no share */ }
|
|
438
|
+
// A one-shot presentation never writes a captured screen snapshot back after an await.
|
|
390
439
|
return undefined;
|
|
391
440
|
},
|
|
392
441
|
},
|
|
@@ -397,20 +446,27 @@ let sections: Partial<S> = {};
|
|
|
397
446
|
function sectionsOf(s: S): Partial<S> {
|
|
398
447
|
return {
|
|
399
448
|
hasAbout: s.hasAbout, aboutJson: s.aboutJson, hasBadges: s.hasBadges, badges: s.badges,
|
|
400
|
-
|
|
449
|
+
// A disabled vertical cannot keep contributing cached content, even on an offline revisit.
|
|
450
|
+
hasBlogPosts: blogEnabled && s.hasBlogPosts, blogPosts: blogEnabled ? s.blogPosts : [],
|
|
451
|
+
hasForumPosts: forumEnabled && s.hasForumPosts, forumPosts: forumEnabled ? s.forumPosts : [],
|
|
401
452
|
};
|
|
402
453
|
}
|
|
403
454
|
|
|
404
455
|
/** Each secondary read lands in its own state write, so a slow read never delays another section and a
|
|
405
|
-
* failed one only hides its own.
|
|
406
|
-
*
|
|
456
|
+
* failed one only hides its own. They never change the header or the action row. An availability failure
|
|
457
|
+
* keeps cached content; an authoritative refusal or missing result clears only that section. */
|
|
407
458
|
async function publishSections(id: string, version: number, access: ReadAccess): Promise<void> {
|
|
408
|
-
const still = () => version === loadVersion &&
|
|
459
|
+
const still = () => version === loadVersion && detailInputId() === id && sameAccess(loadedAccess, access);
|
|
409
460
|
const land = async (patch: Partial<S>) => {
|
|
410
461
|
if (!still()) return;
|
|
411
462
|
try { await assertReadAccess(access); }
|
|
412
463
|
catch {
|
|
413
|
-
if (still()) {
|
|
464
|
+
if (still()) {
|
|
465
|
+
loadedAccess = undefined;
|
|
466
|
+
cachedAccess = undefined;
|
|
467
|
+
sections = {};
|
|
468
|
+
await svc.resetToSkeleton();
|
|
469
|
+
}
|
|
414
470
|
return;
|
|
415
471
|
}
|
|
416
472
|
if (!still()) return;
|
|
@@ -425,8 +481,7 @@ async function publishSections(id: string, version: number, access: ReadAccess):
|
|
|
425
481
|
const nodes = (content as { nodes?: unknown[] } | undefined)?.nodes;
|
|
426
482
|
await land(content && Array.isArray(nodes) && hasAboutContent(nodes) ? { hasAbout: true, aboutJson: JSON.stringify(content) } : { hasAbout: false, aboutJson: "" });
|
|
427
483
|
} catch (e) {
|
|
428
|
-
|
|
429
|
-
if (isNotFoundError(e) || readAccessDenied(e)) await land({ hasAbout: false, aboutJson: "" });
|
|
484
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasAbout: false, aboutJson: "" });
|
|
430
485
|
}
|
|
431
486
|
})());
|
|
432
487
|
reads.push((async () => {
|
|
@@ -436,19 +491,28 @@ async function publishSections(id: string, version: number, access: ReadAccess):
|
|
|
436
491
|
const ids = new Set<string>();
|
|
437
492
|
let assignmentCursor: string | undefined;
|
|
438
493
|
let assignmentsComplete = false;
|
|
494
|
+
const assignmentCursors = new Set<string>();
|
|
439
495
|
for (let page = 0; page < 10; page++) {
|
|
496
|
+
if (!still()) return;
|
|
497
|
+
await assertReadAccess(access);
|
|
498
|
+
if (!still()) return;
|
|
440
499
|
// The cursor encodes the filter, so only the first page carries it (and a follow-up sends no limit).
|
|
441
500
|
const held = await queryBadgeAssignments({ query: assignmentCursor ? { cursorPaging: { cursor: assignmentCursor } } : { filter: { memberId: { $in: [id] } }, cursorPaging: { limit: 100 } } });
|
|
442
501
|
for (const a of held.badgeAssignments ?? []) if (a.badgeId) ids.add(a.badgeId);
|
|
443
502
|
assignmentCursor = held.pagingMetadata?.cursors?.next;
|
|
444
503
|
if (!held.pagingMetadata?.hasNext) { assignmentsComplete = true; break; }
|
|
445
|
-
if (!assignmentCursor) throw new Error("Badge assignments
|
|
504
|
+
if (!assignmentCursor || assignmentCursors.has(assignmentCursor)) throw new Error("Badge assignments did not advance");
|
|
505
|
+
assignmentCursors.add(assignmentCursor);
|
|
446
506
|
}
|
|
447
507
|
if (!assignmentsComplete) throw new Error("Badge assignments are longer than the pages read");
|
|
448
508
|
const badges: Array<{ id: string; title: string }> = [];
|
|
449
509
|
let cursor: string | undefined;
|
|
450
510
|
let catalogComplete = ids.size === 0;
|
|
511
|
+
const catalogCursors = new Set<string>();
|
|
451
512
|
for (let page = 0; page < 50 && ids.size > 0; page++) {
|
|
513
|
+
if (!still()) return;
|
|
514
|
+
await assertReadAccess(access);
|
|
515
|
+
if (!still()) return;
|
|
452
516
|
// A follow-up page carries the cursor alone: Badges v4 rejects a limit beside it.
|
|
453
517
|
const res = await queryBadges({ query: { cursorPaging: cursor ? { cursor } : { limit: 100 } } });
|
|
454
518
|
for (const b of res.badges ?? []) if (b.id && ids.has(b.id) && (b.title || "").trim()) {
|
|
@@ -457,27 +521,32 @@ async function publishSections(id: string, version: number, access: ReadAccess):
|
|
|
457
521
|
}
|
|
458
522
|
cursor = res.pagingMetadata?.cursors?.next;
|
|
459
523
|
if (!res.pagingMetadata?.hasNext || ids.size === 0) { catalogComplete = true; break; }
|
|
460
|
-
if (!cursor) throw new Error("Badge catalog
|
|
524
|
+
if (!cursor || catalogCursors.has(cursor)) throw new Error("Badge catalog did not advance");
|
|
525
|
+
catalogCursors.add(cursor);
|
|
461
526
|
}
|
|
462
527
|
if (!catalogComplete) throw new Error("Badge catalog is longer than the pages read");
|
|
463
528
|
await land({ hasBadges: badges.length > 0, badges });
|
|
464
|
-
} catch (e) {
|
|
529
|
+
} catch (e) {
|
|
530
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasBadges: false, badges: [] });
|
|
531
|
+
}
|
|
465
532
|
})());
|
|
466
533
|
if (blogEnabled) reads.push((async () => {
|
|
467
534
|
try {
|
|
468
535
|
const res = await queryBlogPosts({ query: { filter: { memberId: id }, paging: { limit: POST_LIMIT } } });
|
|
469
536
|
const rows = (res.posts ?? []).slice(0, POST_LIMIT).filter((p) => p.id).map(blogRow);
|
|
470
537
|
await land({ hasBlogPosts: rows.length > 0, blogPosts: rows });
|
|
471
|
-
} catch (e) {
|
|
538
|
+
} catch (e) {
|
|
539
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasBlogPosts: false, blogPosts: [] });
|
|
540
|
+
}
|
|
472
541
|
})());
|
|
473
542
|
if (forumEnabled) reads.push((async () => {
|
|
474
543
|
try {
|
|
475
|
-
// Observed live: the Forum posts query takes a top-level body. `filter.ownerId` needs `{ $eq }` (a bare value answers 400), and a
|
|
476
|
-
// `{ query: … }` wrapper is ignored whole, so every owner would get the same posts. The owner is also checked here.
|
|
477
544
|
const res = await queryForumPosts({ filter: { ownerId: { $eq: id } }, paging: { limit: POST_LIMIT } });
|
|
478
|
-
const rows = (res.posts ?? []).filter((p) => p.id &&
|
|
545
|
+
const rows = (res.posts ?? []).filter((p) => p.id && p.ownerId === id).slice(0, POST_LIMIT).map(forumRow);
|
|
479
546
|
await land({ hasForumPosts: rows.length > 0, forumPosts: rows });
|
|
480
|
-
} catch (e) {
|
|
547
|
+
} catch (e) {
|
|
548
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasForumPosts: false, forumPosts: [] });
|
|
549
|
+
}
|
|
481
550
|
})());
|
|
482
551
|
await Promise.all(reads);
|
|
483
552
|
}
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["push","share","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","
|
|
40
|
+
capabilities: ["push","share","ui","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","wix_cashier"],
|
|
41
41
|
cache: {
|
|
42
42
|
"rules": [
|
|
43
43
|
{
|
|
@@ -94,11 +94,10 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** `{ month: "short", year: "numeric" }` — "
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
|
|
98
|
+
* Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
|
|
98
99
|
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
-
if (hasIntl()) {
|
|
100
|
-
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
-
}
|
|
100
|
+
if (hasIntl()) return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
102
101
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -94,11 +94,10 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** `{ month: "short", year: "numeric" }` — "
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
|
|
98
|
+
* Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
|
|
98
99
|
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
-
if (hasIntl()) {
|
|
100
|
-
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
-
}
|
|
100
|
+
if (hasIntl()) return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
102
101
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -94,11 +94,10 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** `{ month: "short", year: "numeric" }` — "
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
|
|
98
|
+
* Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
|
|
98
99
|
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
-
if (hasIntl()) {
|
|
100
|
-
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
-
}
|
|
100
|
+
if (hasIntl()) return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
102
101
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["push","share","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","
|
|
40
|
+
capabilities: ["push","share","ui","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","wix_cashier"],
|
|
41
41
|
cache: {
|
|
42
42
|
"rules": [
|
|
43
43
|
{
|
|
@@ -94,11 +94,10 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** `{ month: "short", year: "numeric" }` — "
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
|
|
98
|
+
* Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
|
|
98
99
|
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
-
if (hasIntl()) {
|
|
100
|
-
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
-
}
|
|
100
|
+
if (hasIntl()) return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
102
101
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -94,11 +94,10 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** `{ month: "short", year: "numeric" }` — "
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
|
|
98
|
+
* Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
|
|
98
99
|
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
-
if (hasIntl()) {
|
|
100
|
-
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
-
}
|
|
100
|
+
if (hasIntl()) return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
102
101
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["live_activity","push","share","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","motion","theme","
|
|
40
|
+
capabilities: ["live_activity","push","share","ui","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","motion","theme","wix_cashier"],
|
|
41
41
|
cache: {
|
|
42
42
|
"rules": [
|
|
43
43
|
{
|
|
@@ -94,11 +94,10 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** `{ month: "short", year: "numeric" }` — "
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
|
|
98
|
+
* Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
|
|
98
99
|
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
-
if (hasIntl()) {
|
|
100
|
-
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
-
}
|
|
100
|
+
if (hasIntl()) return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
102
101
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -94,11 +94,10 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
/** `{ month: "short", year: "numeric" }` — "
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jul 2026", without parsing a localized day.
|
|
98
|
+
* Like the other date helpers, an engine without Intl keeps the documented en-US fallback. */
|
|
98
99
|
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
-
if (hasIntl()) {
|
|
100
|
-
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
-
}
|
|
100
|
+
if (hasIntl()) return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
102
101
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
102
|
}
|
|
104
103
|
|
|
@@ -37,7 +37,7 @@ export default defineApp({
|
|
|
37
37
|
actions: "http://localhost:8190/v1/actions",
|
|
38
38
|
sync: "http://localhost:8190/v1/sync",
|
|
39
39
|
},
|
|
40
|
-
capabilities: ["push","share","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","
|
|
40
|
+
capabilities: ["push","share","ui","secure_storage","open_url","calendar","local_database","wix_api","wix_platform","app_info","iap","release_control","clipboard","theme","wix_cashier"],
|
|
41
41
|
cache: {
|
|
42
42
|
"rules": [
|
|
43
43
|
{
|