@wix/himalaya-cli 0.1151.0 → 0.1153.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 (41) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/bookings-v2/src/extensions.d.ts +33 -2
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/wix-data/src/index.d.ts +14 -2
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-bookings.mjs +71 -5
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-data.mjs +3 -2
  5. package/dist/cli.mjs +141 -29
  6. package/dist/preview-assets.generated.bin +0 -0
  7. package/guides/cms-collections.md +4 -1
  8. package/guides/getting-started.md +3 -1
  9. package/guides/himi-skill.md +3 -1
  10. package/guides/owner-lite-site-binding.md +26 -0
  11. package/guides/push-cli-onboarding.md +42 -1
  12. package/guides/sdk-reference.json +23 -11
  13. package/guides/templates.md +1 -0
  14. package/guides/wix-api-usage.md +5 -1
  15. package/package.json +2 -2
  16. package/templates/beauty-salon/dev/index.ts +6 -3
  17. package/templates/community-club/dev/index.ts +6 -3
  18. package/templates/community-club-owner/dev/index.ts +44 -1
  19. package/templates/community-club-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
  20. package/templates/events-meetups/dev/index.ts +6 -3
  21. package/templates/events-meetups-owner/dev/index.ts +44 -1
  22. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
  23. package/templates/gym-fitness/dev/index.ts +6 -3
  24. package/templates/gym-fitness-owner/dev/index.ts +44 -1
  25. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
  26. package/templates/nonprofit-cause/dev/index.ts +6 -3
  27. package/templates/nonprofit-cause-owner/dev/index.ts +44 -1
  28. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
  29. package/templates/owner-lite/dev/index.ts +44 -1
  30. package/templates/owner-lite/tier5-src/himi-owner-lite-event/index.ts +52 -8
  31. package/templates/podcast-creator/dev/index.ts +6 -3
  32. package/templates/podcast-creator-owner/dev/index.ts +44 -1
  33. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
  34. package/templates/portfolio-creative/dev/index.ts +6 -3
  35. package/templates/restaurant/dev/index.ts +6 -3
  36. package/templates/restaurant-owner/dev/index.ts +44 -1
  37. package/templates/restaurant-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
  38. package/templates/retail-store/dev/index.ts +7 -3
  39. package/templates/yoga-studio/dev/index.ts +6 -3
  40. package/templates/yoga-studio-owner/dev/index.ts +44 -1
  41. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
@@ -11,7 +11,9 @@ import { normalizeEvent, eventDescription } from "../_shared/himi-events.js";
11
11
  import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo, shouldQueueOwnerWrite } from "../_shared/owner-load-error.js";
12
12
  import { DEMO_EVENTS, DEMO_NOTE, DEMO_SAVE_NOTE } from "../_shared/owner-preview-demo.js";
13
13
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
14
- import { get as dbGet, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
14
+ import { openRichLink } from "../_shared/rich-content-link.js";
15
+ import { richBody } from "../_shared/rich-body.js";
16
+ import { get as dbGet, upsert as dbUpsert, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
15
17
 
16
18
  // Offline-first (data-offline): the event DETAIL falls back to the last-synced
17
19
  // local `owner_events` row (put by the event form's write-behind) on a failed
@@ -20,6 +22,7 @@ import { get as dbGet, remove as dbRemove, enqueue as dbEnqueue, type DbEntity }
20
22
  // ENQUEUED for replay on reconnect. Every local-db call is wrapped so a build
21
23
  // without the `local_database` grant behaves exactly as before (online-only).
22
24
  const ENTITY = "owner_events";
25
+ async function cachePut(row: DbEntity): Promise<void> { try { await dbUpsert(ENTITY, row); } catch { /* capability not granted */ } }
23
26
  async function cacheDrop(id: string): Promise<void> { try { await dbRemove(ENTITY, id); } catch { /* capability not granted */ } }
24
27
  async function cacheGet(id: string): Promise<DbEntity | null> { try { return await dbGet(ENTITY, id); } catch { return null; } }
25
28
  async function queueWrite(actionId: string, params: Record<string, string>): Promise<void> { try { await dbEnqueue(actionId, params); } catch { /* capability not granted */ } }
@@ -33,6 +36,13 @@ interface EventState {
33
36
  title: string;
34
37
  subtitle: string;
35
38
  summary: string;
39
+ // Body ([rico] #3499) — RichContent binds bodyJson; the plain text shows when there is no document.
40
+ /** The v3 Ricos `description` (read with `fields=TEXTS`) as ONE document string; "" when there is none. */
41
+ bodyJson: string;
42
+ /** bodyJson !== "" — gates the plain text, because RichContent draws nothing for "". */
43
+ hasBodyJson: boolean;
44
+ /** The description's plain text (the document's own text, else the legacy description). */
45
+ bodyText: string;
36
46
  initial: string;
37
47
  image: string;
38
48
  dateLine: string;
@@ -55,6 +65,17 @@ interface EventState {
55
65
  }
56
66
 
57
67
  /* eslint-disable @typescript-eslint/no-explicit-any */
68
+ /** [rico] #3499 — keep the description's plain text with the event's cached row, so the offline detail shows it.
69
+ * Merged into the row the events list (or the form) wrote rather than replacing it; with no row yet, the
70
+ * loaded detail's own fields become one. */
71
+ async function cacheBodyText(s: EventState): Promise<void> {
72
+ if (s.status !== "ready" || !s.id) return;
73
+ const prev = await cacheGet(s.id);
74
+ await cachePut(prev ? { ...prev, bodyText: s.bodyText } : {
75
+ id: s.id, title: s.title, subtitle: s.subtitle, image: s.image, dateLine: s.dateLine, location: s.location,
76
+ statusLabel: s.statusLabel, registration: s.registration, bodyText: s.bodyText,
77
+ });
78
+ }
58
79
  function idFrom(arg: unknown, fallback = ""): string {
59
80
  return typeof arg === "string" ? arg : String((arg as any)?.id ?? fallback);
60
81
  }
@@ -97,6 +118,9 @@ function shape(s: Partial<EventState>): EventState {
97
118
  title: s.title ?? "",
98
119
  subtitle: s.subtitle ?? "",
99
120
  summary: s.summary ?? "",
121
+ bodyJson: s.bodyJson ?? "",
122
+ hasBodyJson: !!s.bodyJson,
123
+ bodyText: s.bodyText ?? "",
100
124
  initial: s.initial ?? "?",
101
125
  image,
102
126
  dateLine: s.dateLine ?? "—",
@@ -128,7 +152,9 @@ function demoDetail(s: EventState, id: string): EventState | null {
128
152
  status: "ready",
129
153
  title: d.title,
130
154
  subtitle: [d.dateLine, d.location].filter(Boolean).join(" · "),
131
- summary: d.description,
155
+ summary: "",
156
+ bodyJson: "",
157
+ bodyText: d.description,
132
158
  initial: (d.title[0] || "?").toUpperCase(),
133
159
  image: "",
134
160
  dateLine: d.dateLine,
@@ -151,7 +177,9 @@ function cachedDetail(s: EventState, row: DbEntity): EventState {
151
177
  status: "ready",
152
178
  title,
153
179
  subtitle: String(row.subtitle ?? [dateLine, location].filter((x) => x && x !== "—").join(" · ")),
154
- summary: String(row.summary ?? row.description ?? ""),
180
+ summary: "",
181
+ bodyJson: "",
182
+ bodyText: String(row.bodyText ?? row.summary ?? row.description ?? ""),
155
183
  initial: String(row.initial ?? (title[0] || "?")).slice(0, 1).toUpperCase(),
156
184
  image: String(row.image ?? ""),
157
185
  dateLine: dateLine || "—",
@@ -164,21 +192,27 @@ function cachedDetail(s: EventState, row: DbEntity): EventState {
164
192
  }
165
193
 
166
194
  async function refresh(prev: EventState, id: string): Promise<EventState> {
167
- const res = await getEvent(id);
195
+ // A bare read returns the base fieldset: DETAILS adds `shortDescription` (the teaser and the legacy body),
196
+ // TEXTS the Ricos `description`.
197
+ const res = await getEvent(id, { fields: ["DETAILS", "TEXTS"] });
168
198
  const ev = (res.event ?? res) as WixEvent;
169
199
  if (!ev || !(ev as any).id) {
170
200
  return shape({ ...prev, id, status: "error", title: "", error: copyParam("ownerEvent.errorNotFound", "event not found") });
171
201
  }
172
202
  const row = normalizeEvent(ev); // reuses date/location/status normalization
173
203
  const image = /^https?:\/\//.test(row.image) ? row.image : "";
174
- const desc = (eventDescription(ev) || "").trim();
204
+ const { bodyJson, bodyText } = richBody((ev as unknown as { description?: unknown }).description, (eventDescription(ev) || "").trim());
205
+ // The teaser stays above the body only when it says something the body does not.
206
+ const teaser = String((ev as any).shortDescription ?? "").trim();
175
207
  return shape({
176
208
  ...prev,
177
209
  id,
178
210
  status: "ready",
179
211
  title: row.title,
180
212
  subtitle: [row.dateLine, row.location].filter((x) => x && x !== "—").join(" · "),
181
- summary: desc,
213
+ summary: teaser && teaser !== bodyText.trim() ? teaser : "",
214
+ bodyJson,
215
+ bodyText,
182
216
  initial: (row.title[0] || "?").toUpperCase(),
183
217
  image,
184
218
  dateLine: row.dateLine || "—",
@@ -194,6 +228,7 @@ const svc = defineService<EventState, {
194
228
  load: (s: EventState, arg?: unknown) => Promise<EventState>;
195
229
  retry: (s: EventState) => Promise<EventState>;
196
230
  delete: (s: EventState) => Promise<EventState>;
231
+ openLink: (s: EventState, arg?: unknown) => Promise<EventState>;
197
232
  }>("himiOwnerLiteEvent", {
198
233
  state: shape({ status: "loading" }),
199
234
  actions: {
@@ -208,7 +243,9 @@ const svc = defineService<EventState, {
208
243
  return shape({ ...s, status: "error", error: "Sample item not found." });
209
244
  }
210
245
  try {
211
- return await refresh(shape({ ...s, id, status: "loading" }), id);
246
+ const loaded = await refresh(shape({ ...s, id, status: "loading" }), id);
247
+ await cacheBodyText(loaded);
248
+ return loaded;
212
249
  } catch (e) {
213
250
  // Offline: fall back to the last-synced local row before the demo/error paths.
214
251
  const cached = await cacheGet(id);
@@ -229,7 +266,9 @@ const svc = defineService<EventState, {
229
266
  return shape({ ...s, status: "error", error: "Sample item not found." });
230
267
  }
231
268
  try {
232
- return await refresh(shape({ ...s, status: "loading" }), s.id);
269
+ const loaded = await refresh(shape({ ...s, status: "loading" }), s.id);
270
+ await cacheBodyText(loaded);
271
+ return loaded;
233
272
  } catch (e) {
234
273
  const cached = await cacheGet(s.id);
235
274
  if (cached) return cachedDetail(s, cached);
@@ -256,6 +295,11 @@ const svc = defineService<EventState, {
256
295
  return shape({ ...s, actionMessage: ownerLoadError(e) });
257
296
  }
258
297
  },
298
+ // [rico] #3499 — a link tapped in the RichContent description.
299
+ openLink: async (s, arg) => shape({
300
+ ...s,
301
+ actionMessage: (await openRichLink(arg)) ? "" : copyParam("ownerEvent.linkOpenFailed", "This link could not be opened."),
302
+ }),
259
303
  },
260
304
  });
261
305
 
@@ -1419,7 +1419,8 @@ const SCREENS = runtimeSetting({
1419
1419
  "params": {
1420
1420
  "verticals": "[\"store\",\"blog\"]",
1421
1421
  "homeModules": "[{\"id\":\"saved\",\"label\":\"Saved on this device\",\"dataSource\":\"device.saved_items\",\"emptyWhen\":[\"noSavedContent\"]},{\"id\":\"section_0\",\"label\":\"Shop the collection\",\"dataSource\":\"storeFirst.section0\"},{\"id\":\"section_1\",\"label\":\"Explore\",\"dataSource\":\"storeFirst.section1\"},{\"id\":\"section_2\",\"label\":\"Shop\",\"dataSource\":\"storeFirst.section2\"}]",
1422
- "ownerDefaultLayout": "storeFirst"
1422
+ "ownerDefaultLayout": "storeFirst",
1423
+ "copy": "{\"home.profileBody\":\"Sign in for orders and saved posts.\"}"
1423
1424
  }
1424
1425
  }
1425
1426
  }
@@ -1470,7 +1471,7 @@ const SCREENS = runtimeSetting({
1470
1471
  "package": "himalaya",
1471
1472
  "type": "Text",
1472
1473
  "props": {
1473
- "text": "Orders, bookings, RSVPs and saved content in one place.",
1474
+ "text": "Orders and saved content in one place.",
1474
1475
  "style": "body",
1475
1476
  "color": "textSecondary"
1476
1477
  }
@@ -2694,7 +2695,10 @@ const SCREENS = runtimeSetting({
2694
2695
  "bottom": 28
2695
2696
  },
2696
2697
  "onAppear": {
2697
- "actionId": "tier5.himiStoreAccount.refresh"
2698
+ "actionId": "tier5.himiStoreAccount.refresh",
2699
+ "params": {
2700
+ "copy": "{\"account.subtitle\":\"Orders and saved content in one place.\",\"storeAccount.authBody\":\"Sign in to continue — your cart stays with you.\",\"storeAccount.authBodyRegister\":\"Create a member account to continue — your cart stays with you.\"}"
2701
+ }
2698
2702
  }
2699
2703
  }
2700
2704
  },
@@ -2350,7 +2350,7 @@ const SCREENS = runtimeSetting({
2350
2350
  "verticals": "[\"bookings\",\"programs\",\"plans\",\"events\",\"blog\"]",
2351
2351
  "homeModules": "[{\"id\":\"member_progress\",\"label\":\"Today's schedule\",\"dataSource\":\"member.bookings.schedule\",\"emptyWhen\":[\"hideMemberProgress\"]},{\"id\":\"up_next\",\"label\":\"Up next\",\"dataSource\":\"member.bookings\",\"emptyWhen\":[\"hideNextBooking\",\"hidePersonalError\"]},{\"id\":\"saved\",\"label\":\"Saved on this device\",\"dataSource\":\"device.saved_items\",\"emptyWhen\":[\"noSavedContent\"]},{\"id\":\"section_0\",\"label\":\"Today's schedule\",\"dataSource\":\"calmStudio.section0\",\"emptyWhen\":[\"noTodaysClasses\"]},{\"id\":\"section_1\",\"label\":\"Your practice\",\"dataSource\":\"calmStudio.section1\"}]",
2352
2352
  "ownerDefaultLayout": "calmStudio",
2353
- "copy": "{\"home.bookClassCta\":\"Reserve your spot\",\"home.onboardingBody\":\"Reserve classes, follow programs, and join retreats — all from one calm place.\",\"home.practiceTitle\":\"Your practice\",\"home.retreatsTitle\":\"Retreats & workshops\",\"home.scheduleTitle\":\"Today's schedule\",\"home.teachersCaption\":\"Your teachers\"}"
2353
+ "copy": "{\"home.bookClassCta\":\"Reserve your spot\",\"home.onboardingBody\":\"Reserve classes, follow programs, and join retreats — all from one calm place.\",\"home.practiceTitle\":\"Your practice\",\"home.profileBody\":\"Sign in for bookings, RSVPs, memberships, programs and saved posts.\",\"home.retreatsTitle\":\"Retreats & workshops\",\"home.scheduleTitle\":\"Today's schedule\",\"home.teachersCaption\":\"Your teachers\"}"
2354
2354
  }
2355
2355
  }
2356
2356
  }
@@ -2401,7 +2401,7 @@ const SCREENS = runtimeSetting({
2401
2401
  "package": "himalaya",
2402
2402
  "type": "Text",
2403
2403
  "props": {
2404
- "text": "Orders, bookings, RSVPs and saved content in one place.",
2404
+ "text": "Bookings, RSVPs, memberships, programs and saved content in one place.",
2405
2405
  "style": "body",
2406
2406
  "color": "textSecondary"
2407
2407
  }
@@ -3802,7 +3802,10 @@ const SCREENS = runtimeSetting({
3802
3802
  "bottom": 28
3803
3803
  },
3804
3804
  "onAppear": {
3805
- "actionId": "tier5.himiStoreAccount.refresh"
3805
+ "actionId": "tier5.himiStoreAccount.refresh",
3806
+ "params": {
3807
+ "copy": "{\"account.subtitle\":\"Bookings, RSVPs, memberships, programs and saved content in one place.\",\"storeAccount.authBody\":\"Sign in to continue — bookings, RSVPs, memberships and programs stay with you.\",\"storeAccount.authBodyRegister\":\"Create a member account to continue — bookings, RSVPs, memberships and programs stay with you.\"}"
3808
+ }
3806
3809
  }
3807
3810
  }
3808
3811
  },
@@ -73229,6 +73229,48 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
73229
73229
  }
73230
73230
  }
73231
73231
  },
73232
+ {
73233
+ "id": "event_body",
73234
+ "body": {
73235
+ "package": "himalaya",
73236
+ "type": "RichContent",
73237
+ "props": {
73238
+ "documentJsonPath": "$service:himiOwnerLiteEvent.bodyJson",
73239
+ "onLink": {
73240
+ "actionId": "tier5.himiOwnerLiteEvent.openLink"
73241
+ },
73242
+ "fallback": {
73243
+ "id": "",
73244
+ "body": {
73245
+ "package": "himalaya",
73246
+ "type": "Text",
73247
+ "props": {
73248
+ "text": "$service:himiOwnerLiteEvent.bodyText",
73249
+ "style": "body",
73250
+ "color": "textPrimary",
73251
+ "collapseWhenEmpty": true
73252
+ }
73253
+ }
73254
+ }
73255
+ }
73256
+ }
73257
+ },
73258
+ {
73259
+ "id": "event_body_text",
73260
+ "body": {
73261
+ "package": "himalaya",
73262
+ "type": "Text",
73263
+ "props": {
73264
+ "text": "$service:himiOwnerLiteEvent.bodyText",
73265
+ "style": "body",
73266
+ "color": "textPrimary",
73267
+ "collapseWhenEmpty": true
73268
+ }
73269
+ },
73270
+ "modifiers": {
73271
+ "hiddenPath": "$service:himiOwnerLiteEvent.hasBodyJson"
73272
+ }
73273
+ },
73232
73274
  {
73233
73275
  "id": "event_info_card",
73234
73276
  "body": {
@@ -73567,7 +73609,8 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
73567
73609
  "contentType": "application/javascript+ts-bundle",
73568
73610
  "declaredCapabilities": [
73569
73611
  "wix_api",
73570
- "local_database"
73612
+ "local_database",
73613
+ "open_url"
73571
73614
  ],
73572
73615
  "minBinaryVersion": "0.1.0",
73573
73616
  "bundleVersion": "0.0.1"
@@ -11,7 +11,9 @@ import { normalizeEvent, eventDescription } from "../_shared/himi-events.js";
11
11
  import { ownerLoadError, isBridgeUnavailable, isOwnerPreviewDemo, shouldQueueOwnerWrite } from "../_shared/owner-load-error.js";
12
12
  import { DEMO_EVENTS, DEMO_NOTE, DEMO_SAVE_NOTE } from "../_shared/owner-preview-demo.js";
13
13
  import { stashCopy, copyParam } from "../_shared/himi-copy.js";
14
- import { get as dbGet, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
14
+ import { openRichLink } from "../_shared/rich-content-link.js";
15
+ import { richBody } from "../_shared/rich-body.js";
16
+ import { get as dbGet, upsert as dbUpsert, remove as dbRemove, enqueue as dbEnqueue, type DbEntity } from "../_shared/owner-local-db.js";
15
17
 
16
18
  // Offline-first (data-offline): the event DETAIL falls back to the last-synced
17
19
  // local `owner_events` row (put by the event form's write-behind) on a failed
@@ -20,6 +22,7 @@ import { get as dbGet, remove as dbRemove, enqueue as dbEnqueue, type DbEntity }
20
22
  // ENQUEUED for replay on reconnect. Every local-db call is wrapped so a build
21
23
  // without the `local_database` grant behaves exactly as before (online-only).
22
24
  const ENTITY = "owner_events";
25
+ async function cachePut(row: DbEntity): Promise<void> { try { await dbUpsert(ENTITY, row); } catch { /* capability not granted */ } }
23
26
  async function cacheDrop(id: string): Promise<void> { try { await dbRemove(ENTITY, id); } catch { /* capability not granted */ } }
24
27
  async function cacheGet(id: string): Promise<DbEntity | null> { try { return await dbGet(ENTITY, id); } catch { return null; } }
25
28
  async function queueWrite(actionId: string, params: Record<string, string>): Promise<void> { try { await dbEnqueue(actionId, params); } catch { /* capability not granted */ } }
@@ -33,6 +36,13 @@ interface EventState {
33
36
  title: string;
34
37
  subtitle: string;
35
38
  summary: string;
39
+ // Body ([rico] #3499) — RichContent binds bodyJson; the plain text shows when there is no document.
40
+ /** The v3 Ricos `description` (read with `fields=TEXTS`) as ONE document string; "" when there is none. */
41
+ bodyJson: string;
42
+ /** bodyJson !== "" — gates the plain text, because RichContent draws nothing for "". */
43
+ hasBodyJson: boolean;
44
+ /** The description's plain text (the document's own text, else the legacy description). */
45
+ bodyText: string;
36
46
  initial: string;
37
47
  image: string;
38
48
  dateLine: string;
@@ -55,6 +65,17 @@ interface EventState {
55
65
  }
56
66
 
57
67
  /* eslint-disable @typescript-eslint/no-explicit-any */
68
+ /** [rico] #3499 — keep the description's plain text with the event's cached row, so the offline detail shows it.
69
+ * Merged into the row the events list (or the form) wrote rather than replacing it; with no row yet, the
70
+ * loaded detail's own fields become one. */
71
+ async function cacheBodyText(s: EventState): Promise<void> {
72
+ if (s.status !== "ready" || !s.id) return;
73
+ const prev = await cacheGet(s.id);
74
+ await cachePut(prev ? { ...prev, bodyText: s.bodyText } : {
75
+ id: s.id, title: s.title, subtitle: s.subtitle, image: s.image, dateLine: s.dateLine, location: s.location,
76
+ statusLabel: s.statusLabel, registration: s.registration, bodyText: s.bodyText,
77
+ });
78
+ }
58
79
  function idFrom(arg: unknown, fallback = ""): string {
59
80
  return typeof arg === "string" ? arg : String((arg as any)?.id ?? fallback);
60
81
  }
@@ -97,6 +118,9 @@ function shape(s: Partial<EventState>): EventState {
97
118
  title: s.title ?? "",
98
119
  subtitle: s.subtitle ?? "",
99
120
  summary: s.summary ?? "",
121
+ bodyJson: s.bodyJson ?? "",
122
+ hasBodyJson: !!s.bodyJson,
123
+ bodyText: s.bodyText ?? "",
100
124
  initial: s.initial ?? "?",
101
125
  image,
102
126
  dateLine: s.dateLine ?? "—",
@@ -128,7 +152,9 @@ function demoDetail(s: EventState, id: string): EventState | null {
128
152
  status: "ready",
129
153
  title: d.title,
130
154
  subtitle: [d.dateLine, d.location].filter(Boolean).join(" · "),
131
- summary: d.description,
155
+ summary: "",
156
+ bodyJson: "",
157
+ bodyText: d.description,
132
158
  initial: (d.title[0] || "?").toUpperCase(),
133
159
  image: "",
134
160
  dateLine: d.dateLine,
@@ -151,7 +177,9 @@ function cachedDetail(s: EventState, row: DbEntity): EventState {
151
177
  status: "ready",
152
178
  title,
153
179
  subtitle: String(row.subtitle ?? [dateLine, location].filter((x) => x && x !== "—").join(" · ")),
154
- summary: String(row.summary ?? row.description ?? ""),
180
+ summary: "",
181
+ bodyJson: "",
182
+ bodyText: String(row.bodyText ?? row.summary ?? row.description ?? ""),
155
183
  initial: String(row.initial ?? (title[0] || "?")).slice(0, 1).toUpperCase(),
156
184
  image: String(row.image ?? ""),
157
185
  dateLine: dateLine || "—",
@@ -164,21 +192,27 @@ function cachedDetail(s: EventState, row: DbEntity): EventState {
164
192
  }
165
193
 
166
194
  async function refresh(prev: EventState, id: string): Promise<EventState> {
167
- const res = await getEvent(id);
195
+ // A bare read returns the base fieldset: DETAILS adds `shortDescription` (the teaser and the legacy body),
196
+ // TEXTS the Ricos `description`.
197
+ const res = await getEvent(id, { fields: ["DETAILS", "TEXTS"] });
168
198
  const ev = (res.event ?? res) as WixEvent;
169
199
  if (!ev || !(ev as any).id) {
170
200
  return shape({ ...prev, id, status: "error", title: "", error: copyParam("ownerEvent.errorNotFound", "event not found") });
171
201
  }
172
202
  const row = normalizeEvent(ev); // reuses date/location/status normalization
173
203
  const image = /^https?:\/\//.test(row.image) ? row.image : "";
174
- const desc = (eventDescription(ev) || "").trim();
204
+ const { bodyJson, bodyText } = richBody((ev as unknown as { description?: unknown }).description, (eventDescription(ev) || "").trim());
205
+ // The teaser stays above the body only when it says something the body does not.
206
+ const teaser = String((ev as any).shortDescription ?? "").trim();
175
207
  return shape({
176
208
  ...prev,
177
209
  id,
178
210
  status: "ready",
179
211
  title: row.title,
180
212
  subtitle: [row.dateLine, row.location].filter((x) => x && x !== "—").join(" · "),
181
- summary: desc,
213
+ summary: teaser && teaser !== bodyText.trim() ? teaser : "",
214
+ bodyJson,
215
+ bodyText,
182
216
  initial: (row.title[0] || "?").toUpperCase(),
183
217
  image,
184
218
  dateLine: row.dateLine || "—",
@@ -194,6 +228,7 @@ const svc = defineService<EventState, {
194
228
  load: (s: EventState, arg?: unknown) => Promise<EventState>;
195
229
  retry: (s: EventState) => Promise<EventState>;
196
230
  delete: (s: EventState) => Promise<EventState>;
231
+ openLink: (s: EventState, arg?: unknown) => Promise<EventState>;
197
232
  }>("himiOwnerLiteEvent", {
198
233
  state: shape({ status: "loading" }),
199
234
  actions: {
@@ -208,7 +243,9 @@ const svc = defineService<EventState, {
208
243
  return shape({ ...s, status: "error", error: "Sample item not found." });
209
244
  }
210
245
  try {
211
- return await refresh(shape({ ...s, id, status: "loading" }), id);
246
+ const loaded = await refresh(shape({ ...s, id, status: "loading" }), id);
247
+ await cacheBodyText(loaded);
248
+ return loaded;
212
249
  } catch (e) {
213
250
  // Offline: fall back to the last-synced local row before the demo/error paths.
214
251
  const cached = await cacheGet(id);
@@ -229,7 +266,9 @@ const svc = defineService<EventState, {
229
266
  return shape({ ...s, status: "error", error: "Sample item not found." });
230
267
  }
231
268
  try {
232
- return await refresh(shape({ ...s, status: "loading" }), s.id);
269
+ const loaded = await refresh(shape({ ...s, status: "loading" }), s.id);
270
+ await cacheBodyText(loaded);
271
+ return loaded;
233
272
  } catch (e) {
234
273
  const cached = await cacheGet(s.id);
235
274
  if (cached) return cachedDetail(s, cached);
@@ -256,6 +295,11 @@ const svc = defineService<EventState, {
256
295
  return shape({ ...s, actionMessage: ownerLoadError(e) });
257
296
  }
258
297
  },
298
+ // [rico] #3499 — a link tapped in the RichContent description.
299
+ openLink: async (s, arg) => shape({
300
+ ...s,
301
+ actionMessage: (await openRichLink(arg)) ? "" : copyParam("ownerEvent.linkOpenFailed", "This link could not be opened."),
302
+ }),
259
303
  },
260
304
  });
261
305