@wix/himalaya-cli 0.1145.0 → 0.1146.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/stdlib/wix-sdk/comments-v1/src/extensions.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/forum/src/extensions.d.ts +10 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-comments.mjs +5 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-forum.mjs +13 -0
- package/dist/cli.mjs +0 -2
- package/guides/sdk-reference.json +13 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +62 -3
- package/templates/beauty-salon/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/beauty-salon/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +35 -4
- package/templates/beauty-salon-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/branded-lite/dev/index.ts +273 -12
- package/templates/branded-lite/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/branded-lite/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-cms-collection/index.ts +43 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-faq/index.ts +69 -13
- package/templates/branded-lite/tier5-src/himi-branded-lite-feed/index.ts +23 -3
- package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/branded-lite/tier5-src/himi-store-product/index.ts +35 -4
- package/templates/branded-lite/tier5-src/wix-spaces-forum-post/index.ts +29 -5
- package/templates/community-club/dev/index.ts +135 -5
- package/templates/community-club/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/community-club/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/community-club/tier5-src/himi-branded-lite-cms-collection/index.ts +43 -3
- package/templates/community-club/tier5-src/himi-branded-lite-feed/index.ts +23 -3
- package/templates/community-club/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/community-club-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/events-meetups/dev/index.ts +91 -4
- package/templates/events-meetups/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/events-meetups/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/events-meetups/tier5-src/himi-branded-lite-feed/index.ts +23 -3
- package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/events-meetups-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/gym-fitness/dev/index.ts +92 -4
- package/templates/gym-fitness/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/gym-fitness/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +35 -4
- package/templates/gym-fitness-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/nonprofit-cause/dev/index.ts +91 -4
- package/templates/nonprofit-cause/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/nonprofit-cause/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-feed/index.ts +23 -3
- package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/nonprofit-cause-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/owner-lite/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/podcast-creator/dev/index.ts +91 -4
- package/templates/podcast-creator/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/podcast-creator/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/podcast-creator/tier5-src/himi-branded-lite-feed/index.ts +23 -3
- package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/podcast-creator-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/portfolio-creative/dev/index.ts +92 -4
- package/templates/portfolio-creative/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/portfolio-creative/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +35 -4
- package/templates/portfolio-creative-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/restaurant/dev/index.ts +60 -2
- package/templates/restaurant/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/restaurant/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/restaurant/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/restaurant-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/retail-store/dev/index.ts +62 -3
- package/templates/retail-store/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/retail-store/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/retail-store/tier5-src/himi-store-product/index.ts +35 -4
- package/templates/retail-store-owner/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/yoga-studio/dev/index.ts +60 -2
- package/templates/yoga-studio/tier5-src/_shared/rich-body.ts +10 -4
- package/templates/yoga-studio/tier5-src/himi-blog-post/index.ts +12 -2
- package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +40 -3
- package/templates/yoga-studio-owner/tier5-src/_shared/rich-body.ts +10 -4
|
@@ -35,6 +35,8 @@ import {
|
|
|
35
35
|
} from "../_shared/himi-events";
|
|
36
36
|
import { initials } from "../_shared/himi-text.js";
|
|
37
37
|
import { stashCopy, copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
38
|
+
import { openRichLink } from "../_shared/rich-content-link.js";
|
|
39
|
+
import { richBody } from "../_shared/rich-body.js";
|
|
38
40
|
|
|
39
41
|
interface MapMarker {
|
|
40
42
|
latitude: number;
|
|
@@ -88,7 +90,13 @@ interface S {
|
|
|
88
90
|
initial: string;
|
|
89
91
|
when: string;
|
|
90
92
|
location: string;
|
|
93
|
+
/** The plain-text description: RichContent's fallback, the calendar notes, and what shows with no document. */
|
|
91
94
|
description: string;
|
|
95
|
+
/** [rico] #3372 — the v3 Ricos `description` (read with `fields=TEXTS`) as ONE document string for
|
|
96
|
+
* RichContent; "" when the event has none or the encoder rejected it. */
|
|
97
|
+
descriptionJson: string;
|
|
98
|
+
/** descriptionJson !== "" — gates the plain text, because RichContent draws nothing for "". */
|
|
99
|
+
hasDescriptionJson: boolean;
|
|
92
100
|
image: string;
|
|
93
101
|
hasImage: boolean;
|
|
94
102
|
noImage: boolean;
|
|
@@ -212,6 +220,7 @@ function derive(s: S): S {
|
|
|
212
220
|
const hasAttendees = s.attendeeAvatars.length > 0;
|
|
213
221
|
return {
|
|
214
222
|
...s,
|
|
223
|
+
hasDescriptionJson: s.descriptionJson !== "",
|
|
215
224
|
noMap: !s.mapUrl,
|
|
216
225
|
hasMapMarkers,
|
|
217
226
|
noMapMarkers: !hasMapMarkers,
|
|
@@ -357,6 +366,14 @@ async function attendeeSummary(eventId: string): Promise<{ goingLabel: string; a
|
|
|
357
366
|
}
|
|
358
367
|
}
|
|
359
368
|
|
|
369
|
+
/** The description pair: the v3 Ricos `description` for RichContent, and its plain text. A string description
|
|
370
|
+
* (or none) keeps `eventDescription`'s legacy read, with no document. */
|
|
371
|
+
function eventBody(e: WixEvent): { description: string; descriptionJson: string } {
|
|
372
|
+
const legacy = eventDescription(e);
|
|
373
|
+
const { bodyJson, bodyText } = richBody((e as unknown as { description?: unknown }).description, legacy);
|
|
374
|
+
return { description: bodyText, descriptionJson: bodyJson };
|
|
375
|
+
}
|
|
376
|
+
|
|
360
377
|
/** getEvent returns the slim BASE fieldset (no `registration`); enrich from the
|
|
361
378
|
* richer query when the type is unknown — best-effort, find-by-id. */
|
|
362
379
|
async function enrichRegistration(id: string, e: WixEvent): Promise<WixEvent> {
|
|
@@ -364,7 +381,11 @@ async function enrichRegistration(id: string, e: WixEvent): Promise<WixEvent> {
|
|
|
364
381
|
try {
|
|
365
382
|
const list = await queryEvents({ limit: 100 });
|
|
366
383
|
const match = (list.events ?? []).find((candidate) => candidate.id === id);
|
|
367
|
-
|
|
384
|
+
if (!match) return e;
|
|
385
|
+
// [rico] #3372 — the query's rows are read without TEXTS, so they carry no Ricos `description`: keep the
|
|
386
|
+
// one this detail fetched, or the enrichment would silently drop the document on every real site.
|
|
387
|
+
const description = (e as unknown as { description?: unknown }).description;
|
|
388
|
+
return description === undefined ? match : ({ ...match, description } as unknown as WixEvent);
|
|
368
389
|
} catch {
|
|
369
390
|
return e;
|
|
370
391
|
}
|
|
@@ -377,6 +398,8 @@ const svc = defineService<S, {
|
|
|
377
398
|
openRegistration: (s: S) => Promise<S>;
|
|
378
399
|
share: (s: S) => Promise<S>;
|
|
379
400
|
addToCalendar: (s: S) => Promise<S>;
|
|
401
|
+
/** [rico] #3372 — RichContent's on_link: `{ url }` of the tapped link. */
|
|
402
|
+
openLink: (s: S, arg?: unknown) => Promise<S>;
|
|
380
403
|
}>("himiEventDetail", {
|
|
381
404
|
state: derive({
|
|
382
405
|
status: "loading",
|
|
@@ -386,6 +409,8 @@ const svc = defineService<S, {
|
|
|
386
409
|
when: "",
|
|
387
410
|
location: "",
|
|
388
411
|
description: "",
|
|
412
|
+
descriptionJson: "",
|
|
413
|
+
hasDescriptionJson: false,
|
|
389
414
|
image: "",
|
|
390
415
|
hasImage: false,
|
|
391
416
|
noImage: true,
|
|
@@ -433,7 +458,8 @@ const svc = defineService<S, {
|
|
|
433
458
|
const id = s.id || inputId();
|
|
434
459
|
if (!id) return derive({ ...s, status: "ready", errored: true });
|
|
435
460
|
try {
|
|
436
|
-
|
|
461
|
+
// TEXTS adds the Ricos `description` to the base fieldset (a bare read returns none).
|
|
462
|
+
const res = await getEvent(id, { fields: ["TEXTS"] });
|
|
437
463
|
let e = ((res as unknown as { event?: WixEvent }).event ?? res) as WixEvent;
|
|
438
464
|
e = await enrichRegistration(id, e);
|
|
439
465
|
const attendees = await attendeeSummary(id);
|
|
@@ -460,7 +486,9 @@ const svc = defineService<S, {
|
|
|
460
486
|
initial: (title.trim()[0] || "E").toUpperCase(),
|
|
461
487
|
when: eventWhen(e),
|
|
462
488
|
location: eventLocation(e),
|
|
463
|
-
description
|
|
489
|
+
// The Ricos description when the event has one (its own text is the plain copy); the legacy
|
|
490
|
+
// string fields otherwise.
|
|
491
|
+
...eventBody(e),
|
|
464
492
|
image,
|
|
465
493
|
hasImage: !!image,
|
|
466
494
|
noImage: !image,
|
|
@@ -491,6 +519,9 @@ const svc = defineService<S, {
|
|
|
491
519
|
initial: (title.trim()[0] || "E").toUpperCase(),
|
|
492
520
|
when: cached.dateLine,
|
|
493
521
|
location: cached.location,
|
|
522
|
+
// The cached list row carries no description: an offline retry of THIS event keeps the pair it
|
|
523
|
+
// already shows, and any other event's is cleared together, so neither half can linger alone.
|
|
524
|
+
...(s.id === id ? {} : { description: "", descriptionJson: "" }),
|
|
494
525
|
image: cached.image,
|
|
495
526
|
hasImage: !!cached.image,
|
|
496
527
|
noImage: !cached.image,
|
|
@@ -665,6 +696,12 @@ const svc = defineService<S, {
|
|
|
665
696
|
return derive({ ...s, actionMessage: copyParam("event.calendarAddFailed", "Could not add this event to calendar."), isAddingCalendar: false });
|
|
666
697
|
}
|
|
667
698
|
},
|
|
699
|
+
// Only http(s), mailto and tel links reach open_url; a refused link, or one nothing opened, says so, and a
|
|
700
|
+
// link that opens clears an earlier message.
|
|
701
|
+
openLink: async (s, arg) => derive({
|
|
702
|
+
...s,
|
|
703
|
+
actionMessage: (await openRichLink(arg)) ? "" : copyParam("event.linkOpenFailed", "This link could not be opened."),
|
|
704
|
+
}),
|
|
668
705
|
},
|
|
669
706
|
});
|
|
670
707
|
svc.load();
|
|
@@ -14,15 +14,21 @@ export interface RichBody {
|
|
|
14
14
|
bodyText: string;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/** [rico] #3372 — the media width for a document drawn in a LIST row (a feed post, a comment, a CMS item): the
|
|
18
|
+
* list-image size (WIX_LIST_IMAGE), so a scrolling list never downloads every image at detail size. */
|
|
19
|
+
export const ROW_IMAGE_WIDTH = 1000;
|
|
20
|
+
|
|
17
21
|
/** Prepares `richContent` (a Ricos document, as a Wix API returns it, or its JSON string). No document, or one
|
|
18
22
|
* that is not a document, gives `{ bodyJson: "", bodyText: fallback }`. A document past the viewer's limits
|
|
19
23
|
* gives bodyJson "" and its plain text — except one rejected as too deep, which is not walked again (the
|
|
20
|
-
* plain-text walk has no depth limit), so `fallback` stands in for it.
|
|
21
|
-
|
|
24
|
+
* plain-text walk has no depth limit), so `fallback` stands in for it. `imageWidth` sizes its media (default
|
|
25
|
+
* the 1400 px detail budget). */
|
|
26
|
+
export function richBody(richContent: unknown, fallback = "", imageWidth = 1400): RichBody {
|
|
22
27
|
const doc = parseRicosJson(richContent);
|
|
23
28
|
if (!doc) return { bodyJson: "", bodyText: fallback };
|
|
24
|
-
// 1400 px — the detail-image budget, which is also the encoder's maximum
|
|
25
|
-
|
|
29
|
+
// 1400 px by default — the detail-image budget, which is also the encoder's maximum; list rows pass
|
|
30
|
+
// ROW_IMAGE_WIDTH.
|
|
31
|
+
const { json, rejected } = encodeRichContent(doc, { imageWidth });
|
|
26
32
|
const text = rejected === "too_deep" ? "" : ricosToPlainText(doc);
|
|
27
33
|
return { bodyJson: json, bodyText: text || fallback };
|
|
28
34
|
}
|