@wix/himalaya-cli 0.1151.0 → 0.1152.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/cli.mjs +15 -17
- package/dist/preview-assets.generated.bin +0 -0
- package/package.json +2 -2
- package/templates/community-club-owner/dev/index.ts +44 -1
- package/templates/community-club-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
- package/templates/events-meetups-owner/dev/index.ts +44 -1
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
- package/templates/gym-fitness-owner/dev/index.ts +44 -1
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
- package/templates/nonprofit-cause-owner/dev/index.ts +44 -1
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
- package/templates/owner-lite/dev/index.ts +44 -1
- package/templates/owner-lite/tier5-src/himi-owner-lite-event/index.ts +52 -8
- package/templates/podcast-creator-owner/dev/index.ts +44 -1
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
- package/templates/restaurant-owner/dev/index.ts +44 -1
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
- package/templates/yoga-studio-owner/dev/index.ts +44 -1
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-event/index.ts +52 -8
package/dist/cli.mjs
CHANGED
|
@@ -23592,7 +23592,6 @@ function shouldRevealError(args) {
|
|
|
23592
23592
|
var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE;
|
|
23593
23593
|
var init_validation = __esm({
|
|
23594
23594
|
"../../core/ts/src/validation.ts"() {
|
|
23595
|
-
"use strict";
|
|
23596
23595
|
EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
|
|
23597
23596
|
URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
|
|
23598
23597
|
INTEGER_RE = /^[+-]?[0-9]+$/;
|
|
@@ -24252,7 +24251,6 @@ function validateWorkerSubtree(raw, slotId, policy, actionCatalog) {
|
|
|
24252
24251
|
var WORKER_SUBTREE_CEILINGS, ID_PART, ACTION_ID;
|
|
24253
24252
|
var init_worker_subtree = __esm({
|
|
24254
24253
|
"../../core/ts/src/worker-subtree.ts"() {
|
|
24255
|
-
"use strict";
|
|
24256
24254
|
init_worker_subtree_safe_types_generated();
|
|
24257
24255
|
WORKER_SUBTREE_CEILINGS = Object.freeze({
|
|
24258
24256
|
maxEncodedBytes: 65536,
|
|
@@ -59116,21 +59114,21 @@ var init_preview_assets_generated = __esm({
|
|
|
59116
59114
|
"../../packages/serve/src/preview-assets.generated.ts"() {
|
|
59117
59115
|
init_preview_assets_format();
|
|
59118
59116
|
PREVIEW_ASSET_MANIFEST = [
|
|
59119
|
-
{ key: "assets/index-
|
|
59120
|
-
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset:
|
|
59121
|
-
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset:
|
|
59122
|
-
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset:
|
|
59123
|
-
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
59124
|
-
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset:
|
|
59125
|
-
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset:
|
|
59126
|
-
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
59127
|
-
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset:
|
|
59128
|
-
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset:
|
|
59129
|
-
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset:
|
|
59130
|
-
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset:
|
|
59131
|
-
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset:
|
|
59132
|
-
{ key: "index.html", contentType: "text/html; charset=utf-8", offset:
|
|
59133
|
-
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset:
|
|
59117
|
+
{ key: "assets/index-DHO0WElX.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 1127482, sha256: "9a198f7af12c683263ba55641ec1802d4ca9addb9b8d38170e6b4f60387c61c3" },
|
|
59118
|
+
{ key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 1127490, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
|
|
59119
|
+
{ key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 1132100, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
|
|
59120
|
+
{ key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 1620684, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
|
|
59121
|
+
{ key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 1711608, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
|
|
59122
|
+
{ key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 1802592, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
|
|
59123
|
+
{ key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 1893572, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
|
|
59124
|
+
{ key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 1984444, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
|
|
59125
|
+
{ key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 2075424, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
|
|
59126
|
+
{ key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 2184060, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
|
|
59127
|
+
{ key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 2293144, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
|
|
59128
|
+
{ key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 2402192, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
|
|
59129
|
+
{ key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 2509892, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
|
|
59130
|
+
{ key: "index.html", contentType: "text/html; charset=utf-8", offset: 2598e3, length: 4947, sha256: "72e531f20412d0f07433cb52fac32ff7f5be87a4ef435c2d919cd5e21ec84ad3" },
|
|
59131
|
+
{ key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 2602947, length: 17344, sha256: "d057298d75e7373e5e2c4d11b7d1bcbea88e03af555ba63d97641c78509c58e4" }
|
|
59134
59132
|
];
|
|
59135
59133
|
}
|
|
59136
59134
|
});
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1152.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"artifactId": "himalaya-cli"
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
"falconPackageHash": "
|
|
70
|
+
"falconPackageHash": "ec72821be8fc18dc66961c702e0a8b0f4653ea5cfb9bbe17d54ff092"
|
|
71
71
|
}
|
|
@@ -76662,6 +76662,48 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
76662
76662
|
}
|
|
76663
76663
|
}
|
|
76664
76664
|
},
|
|
76665
|
+
{
|
|
76666
|
+
"id": "event_body",
|
|
76667
|
+
"body": {
|
|
76668
|
+
"package": "himalaya",
|
|
76669
|
+
"type": "RichContent",
|
|
76670
|
+
"props": {
|
|
76671
|
+
"documentJsonPath": "$service:himiOwnerLiteEvent.bodyJson",
|
|
76672
|
+
"onLink": {
|
|
76673
|
+
"actionId": "tier5.himiOwnerLiteEvent.openLink"
|
|
76674
|
+
},
|
|
76675
|
+
"fallback": {
|
|
76676
|
+
"id": "",
|
|
76677
|
+
"body": {
|
|
76678
|
+
"package": "himalaya",
|
|
76679
|
+
"type": "Text",
|
|
76680
|
+
"props": {
|
|
76681
|
+
"text": "$service:himiOwnerLiteEvent.bodyText",
|
|
76682
|
+
"style": "body",
|
|
76683
|
+
"color": "textPrimary",
|
|
76684
|
+
"collapseWhenEmpty": true
|
|
76685
|
+
}
|
|
76686
|
+
}
|
|
76687
|
+
}
|
|
76688
|
+
}
|
|
76689
|
+
}
|
|
76690
|
+
},
|
|
76691
|
+
{
|
|
76692
|
+
"id": "event_body_text",
|
|
76693
|
+
"body": {
|
|
76694
|
+
"package": "himalaya",
|
|
76695
|
+
"type": "Text",
|
|
76696
|
+
"props": {
|
|
76697
|
+
"text": "$service:himiOwnerLiteEvent.bodyText",
|
|
76698
|
+
"style": "body",
|
|
76699
|
+
"color": "textPrimary",
|
|
76700
|
+
"collapseWhenEmpty": true
|
|
76701
|
+
}
|
|
76702
|
+
},
|
|
76703
|
+
"modifiers": {
|
|
76704
|
+
"hiddenPath": "$service:himiOwnerLiteEvent.hasBodyJson"
|
|
76705
|
+
}
|
|
76706
|
+
},
|
|
76665
76707
|
{
|
|
76666
76708
|
"id": "event_info_card",
|
|
76667
76709
|
"body": {
|
|
@@ -77000,7 +77042,8 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
77000
77042
|
"contentType": "application/javascript+ts-bundle",
|
|
77001
77043
|
"declaredCapabilities": [
|
|
77002
77044
|
"wix_api",
|
|
77003
|
-
"local_database"
|
|
77045
|
+
"local_database",
|
|
77046
|
+
"open_url"
|
|
77004
77047
|
],
|
|
77005
77048
|
"minBinaryVersion": "0.1.0",
|
|
77006
77049
|
"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 {
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -68631,6 +68631,48 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
68631
68631
|
}
|
|
68632
68632
|
}
|
|
68633
68633
|
},
|
|
68634
|
+
{
|
|
68635
|
+
"id": "event_body",
|
|
68636
|
+
"body": {
|
|
68637
|
+
"package": "himalaya",
|
|
68638
|
+
"type": "RichContent",
|
|
68639
|
+
"props": {
|
|
68640
|
+
"documentJsonPath": "$service:himiOwnerLiteEvent.bodyJson",
|
|
68641
|
+
"onLink": {
|
|
68642
|
+
"actionId": "tier5.himiOwnerLiteEvent.openLink"
|
|
68643
|
+
},
|
|
68644
|
+
"fallback": {
|
|
68645
|
+
"id": "",
|
|
68646
|
+
"body": {
|
|
68647
|
+
"package": "himalaya",
|
|
68648
|
+
"type": "Text",
|
|
68649
|
+
"props": {
|
|
68650
|
+
"text": "$service:himiOwnerLiteEvent.bodyText",
|
|
68651
|
+
"style": "body",
|
|
68652
|
+
"color": "textPrimary",
|
|
68653
|
+
"collapseWhenEmpty": true
|
|
68654
|
+
}
|
|
68655
|
+
}
|
|
68656
|
+
}
|
|
68657
|
+
}
|
|
68658
|
+
}
|
|
68659
|
+
},
|
|
68660
|
+
{
|
|
68661
|
+
"id": "event_body_text",
|
|
68662
|
+
"body": {
|
|
68663
|
+
"package": "himalaya",
|
|
68664
|
+
"type": "Text",
|
|
68665
|
+
"props": {
|
|
68666
|
+
"text": "$service:himiOwnerLiteEvent.bodyText",
|
|
68667
|
+
"style": "body",
|
|
68668
|
+
"color": "textPrimary",
|
|
68669
|
+
"collapseWhenEmpty": true
|
|
68670
|
+
}
|
|
68671
|
+
},
|
|
68672
|
+
"modifiers": {
|
|
68673
|
+
"hiddenPath": "$service:himiOwnerLiteEvent.hasBodyJson"
|
|
68674
|
+
}
|
|
68675
|
+
},
|
|
68634
68676
|
{
|
|
68635
68677
|
"id": "event_info_card",
|
|
68636
68678
|
"body": {
|
|
@@ -68969,7 +69011,8 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
68969
69011
|
"contentType": "application/javascript+ts-bundle",
|
|
68970
69012
|
"declaredCapabilities": [
|
|
68971
69013
|
"wix_api",
|
|
68972
|
-
"local_database"
|
|
69014
|
+
"local_database",
|
|
69015
|
+
"open_url"
|
|
68973
69016
|
],
|
|
68974
69017
|
"minBinaryVersion": "0.1.0",
|
|
68975
69018
|
"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 {
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -81260,6 +81260,48 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
81260
81260
|
}
|
|
81261
81261
|
}
|
|
81262
81262
|
},
|
|
81263
|
+
{
|
|
81264
|
+
"id": "event_body",
|
|
81265
|
+
"body": {
|
|
81266
|
+
"package": "himalaya",
|
|
81267
|
+
"type": "RichContent",
|
|
81268
|
+
"props": {
|
|
81269
|
+
"documentJsonPath": "$service:himiOwnerLiteEvent.bodyJson",
|
|
81270
|
+
"onLink": {
|
|
81271
|
+
"actionId": "tier5.himiOwnerLiteEvent.openLink"
|
|
81272
|
+
},
|
|
81273
|
+
"fallback": {
|
|
81274
|
+
"id": "",
|
|
81275
|
+
"body": {
|
|
81276
|
+
"package": "himalaya",
|
|
81277
|
+
"type": "Text",
|
|
81278
|
+
"props": {
|
|
81279
|
+
"text": "$service:himiOwnerLiteEvent.bodyText",
|
|
81280
|
+
"style": "body",
|
|
81281
|
+
"color": "textPrimary",
|
|
81282
|
+
"collapseWhenEmpty": true
|
|
81283
|
+
}
|
|
81284
|
+
}
|
|
81285
|
+
}
|
|
81286
|
+
}
|
|
81287
|
+
}
|
|
81288
|
+
},
|
|
81289
|
+
{
|
|
81290
|
+
"id": "event_body_text",
|
|
81291
|
+
"body": {
|
|
81292
|
+
"package": "himalaya",
|
|
81293
|
+
"type": "Text",
|
|
81294
|
+
"props": {
|
|
81295
|
+
"text": "$service:himiOwnerLiteEvent.bodyText",
|
|
81296
|
+
"style": "body",
|
|
81297
|
+
"color": "textPrimary",
|
|
81298
|
+
"collapseWhenEmpty": true
|
|
81299
|
+
}
|
|
81300
|
+
},
|
|
81301
|
+
"modifiers": {
|
|
81302
|
+
"hiddenPath": "$service:himiOwnerLiteEvent.hasBodyJson"
|
|
81303
|
+
}
|
|
81304
|
+
},
|
|
81263
81305
|
{
|
|
81264
81306
|
"id": "event_info_card",
|
|
81265
81307
|
"body": {
|
|
@@ -81598,7 +81640,8 @@ const TEMPLATED: { pattern: string; display: string; liveSeed?: LiveSeed; static
|
|
|
81598
81640
|
"contentType": "application/javascript+ts-bundle",
|
|
81599
81641
|
"declaredCapabilities": [
|
|
81600
81642
|
"wix_api",
|
|
81601
|
-
"local_database"
|
|
81643
|
+
"local_database",
|
|
81644
|
+
"open_url"
|
|
81602
81645
|
],
|
|
81603
81646
|
"minBinaryVersion": "0.1.0",
|
|
81604
81647
|
"bundleVersion": "0.0.1"
|