@wix/himalaya-cli 0.1568.0 → 0.1570.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/l10n-strings.d.ts +3 -2
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/business-contact-service.d.ts +17 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/business-contact.d.ts +73 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/invite-target.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/invite.d.ts +148 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +558 -84
- package/dist/cli.mjs +21211 -20843
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-config.md +10 -0
- package/guides/app-icon.md +20 -1
- package/guides/getting-started.md +5 -0
- package/guides/himi-json-output.md +7 -0
- package/guides/himi-skill.md +5 -0
- package/guides/one-app-to-himi-app.md +159 -4
- package/guides/skill.md +5 -0
- package/guides/splash-screens.md +156 -5
- package/guides/tier-5-add-a-screen.md +20 -0
- package/package.json +2 -2
- package/templates/beauty-salon/config.ts +17 -0
- package/templates/beauty-salon/dev/index.ts +478 -0
- package/templates/beauty-salon/himalaya.content.json +6 -0
- package/templates/beauty-salon/splash.json +3 -0
- package/templates/beauty-salon/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/beauty-salon/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/beauty-salon/tier5-src/business-contact/index.ts +6 -0
- package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +13 -9
- package/templates/beauty-salon/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/beauty-salon-owner/config.ts +8 -0
- package/templates/beauty-salon-owner/dev/index.ts +1 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/beauty-salon-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/branded-lite/config.ts +17 -0
- package/templates/branded-lite/dev/index.ts +541 -1
- package/templates/branded-lite/himalaya.content.json +6 -0
- package/templates/branded-lite/splash.json +3 -0
- package/templates/branded-lite/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/branded-lite/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/branded-lite/tier5-src/business-contact/index.ts +6 -0
- package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +13 -9
- package/templates/branded-lite/tier5-src/himi-branded-lite-group/index.ts +20 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-groups/index.ts +18 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-notifsettings/index.ts +39 -11
- package/templates/branded-lite/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/brandy/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/community-club/config.ts +17 -0
- package/templates/community-club/dev/index.ts +480 -1
- package/templates/community-club/himalaya.content.json +6 -0
- package/templates/community-club/splash.json +3 -0
- package/templates/community-club/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/community-club/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/community-club/tier5-src/business-contact/index.ts +6 -0
- package/templates/community-club/tier5-src/himi-branded-lite-group/index.ts +20 -3
- package/templates/community-club/tier5-src/himi-branded-lite-groups/index.ts +18 -2
- package/templates/community-club/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/community-club-owner/config.ts +8 -0
- package/templates/community-club-owner/dev/index.ts +1 -0
- package/templates/community-club-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/community-club-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/events-meetups/config.ts +17 -0
- package/templates/events-meetups/dev/index.ts +480 -1
- package/templates/events-meetups/himalaya.content.json +6 -0
- package/templates/events-meetups/splash.json +3 -0
- package/templates/events-meetups/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/events-meetups/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/events-meetups/tier5-src/business-contact/index.ts +6 -0
- package/templates/events-meetups/tier5-src/himi-branded-lite-group/index.ts +20 -3
- package/templates/events-meetups/tier5-src/himi-branded-lite-groups/index.ts +18 -2
- package/templates/events-meetups/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/events-meetups-owner/config.ts +8 -0
- package/templates/events-meetups-owner/dev/index.ts +1 -0
- package/templates/events-meetups-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/events-meetups-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/gym-fitness/config.ts +17 -0
- package/templates/gym-fitness/dev/index.ts +478 -0
- package/templates/gym-fitness/himalaya.content.json +6 -0
- package/templates/gym-fitness/splash.json +3 -0
- package/templates/gym-fitness/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/gym-fitness/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/gym-fitness/tier5-src/business-contact/index.ts +6 -0
- package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +13 -9
- package/templates/gym-fitness/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/gym-fitness-owner/config.ts +8 -0
- package/templates/gym-fitness-owner/dev/index.ts +1 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/gym-fitness-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/himi-chat/dev/index.ts +1 -0
- package/templates/himi-chat/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/nonprofit-cause/config.ts +17 -0
- package/templates/nonprofit-cause/dev/index.ts +480 -1
- package/templates/nonprofit-cause/himalaya.content.json +6 -0
- package/templates/nonprofit-cause/splash.json +3 -0
- package/templates/nonprofit-cause/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/nonprofit-cause/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/nonprofit-cause/tier5-src/business-contact/index.ts +6 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-group/index.ts +20 -3
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-groups/index.ts +18 -2
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/nonprofit-cause-owner/config.ts +8 -0
- package/templates/nonprofit-cause-owner/dev/index.ts +1 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/nonprofit-cause-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/owner-lite/config.ts +8 -0
- package/templates/owner-lite/dev/index.ts +1 -0
- package/templates/owner-lite/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/owner-lite/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/podcast-creator/config.ts +17 -0
- package/templates/podcast-creator/dev/index.ts +450 -0
- package/templates/podcast-creator/himalaya.content.json +6 -0
- package/templates/podcast-creator/splash.json +3 -0
- package/templates/podcast-creator/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/podcast-creator/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/podcast-creator/tier5-src/business-contact/index.ts +6 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/podcast-creator-owner/config.ts +8 -0
- package/templates/podcast-creator-owner/dev/index.ts +1 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/podcast-creator-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/portfolio-creative/config.ts +17 -0
- package/templates/portfolio-creative/dev/index.ts +450 -0
- package/templates/portfolio-creative/himalaya.content.json +6 -0
- package/templates/portfolio-creative/splash.json +3 -0
- package/templates/portfolio-creative/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/portfolio-creative/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/portfolio-creative/tier5-src/business-contact/index.ts +6 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/portfolio-creative-owner/config.ts +8 -0
- package/templates/portfolio-creative-owner/dev/index.ts +1 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/portfolio-creative-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/restaurant/config.ts +17 -0
- package/templates/restaurant/dev/index.ts +450 -0
- package/templates/restaurant/himalaya.content.json +6 -0
- package/templates/restaurant/splash.json +3 -0
- package/templates/restaurant/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/restaurant/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/restaurant/tier5-src/business-contact/index.ts +6 -0
- package/templates/restaurant/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/restaurant-owner/config.ts +8 -0
- package/templates/restaurant-owner/dev/index.ts +1 -0
- package/templates/restaurant-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/restaurant-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/retail-store/config.ts +17 -0
- package/templates/retail-store/dev/index.ts +450 -0
- package/templates/retail-store/himalaya.content.json +6 -0
- package/templates/retail-store/splash.json +3 -0
- package/templates/retail-store/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/retail-store/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/retail-store/tier5-src/business-contact/index.ts +6 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/retail-store-owner/config.ts +8 -0
- package/templates/retail-store-owner/dev/index.ts +1 -0
- package/templates/retail-store-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/retail-store-owner/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/surface-showcase/dev/index.ts +1 -0
- package/templates/yoga-studio/config.ts +17 -0
- package/templates/yoga-studio/dev/index.ts +478 -0
- package/templates/yoga-studio/himalaya.content.json +6 -0
- package/templates/yoga-studio/splash.json +3 -0
- package/templates/yoga-studio/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/yoga-studio/tier5-src/_shared/rich-body.ts +44 -0
- package/templates/yoga-studio/tier5-src/business-contact/index.ts +6 -0
- package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +13 -9
- package/templates/yoga-studio/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/yoga-studio-owner/config.ts +8 -0
- package/templates/yoga-studio-owner/dev/index.ts +1 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/himi-copy.ts +17 -6
- package/templates/yoga-studio-owner/tier5-src/_shared/rich-body.ts +44 -0
|
@@ -9,6 +9,8 @@ import { stashCopy, copyParam, copyTemplate, copyPlural } from "../_shared/himi-
|
|
|
9
9
|
import { get, type DbEntity } from "@himalaya/local-db";
|
|
10
10
|
import { wixMediaUrl, WIX_DETAIL_IMAGE, WIX_LIST_IMAGE } from "@himalaya/wix-media";
|
|
11
11
|
import { formatClock, formatDateMedium, formatMonthDay } from "../_shared/engine-intl.js";
|
|
12
|
+
import { descriptionBody } from "../_shared/rich-body.js";
|
|
13
|
+
import { openRichLink } from "../_shared/rich-content-link.js";
|
|
12
14
|
|
|
13
15
|
// Offline-first (data-offline): the service detail is a public read-through. On a
|
|
14
16
|
// fetch failure we fall back to the last-synced row for this service written by
|
|
@@ -119,6 +121,8 @@ interface S {
|
|
|
119
121
|
bookableOnline: boolean;
|
|
120
122
|
notBookableOnline: boolean;
|
|
121
123
|
about: string;
|
|
124
|
+
aboutJson: string;
|
|
125
|
+
hasAboutJson: boolean;
|
|
122
126
|
noAbout: boolean;
|
|
123
127
|
policyLines: PolicyLine[];
|
|
124
128
|
noPolicy: boolean;
|
|
@@ -431,13 +435,6 @@ function serviceShareUrl(service: WixService): string {
|
|
|
431
435
|
return "";
|
|
432
436
|
}
|
|
433
437
|
|
|
434
|
-
function plain(text: string | undefined): string {
|
|
435
|
-
return stringOf(text)
|
|
436
|
-
.replace(/<[^>]*>/g, " ")
|
|
437
|
-
.replace(/\s+/g, " ")
|
|
438
|
-
.trim();
|
|
439
|
-
}
|
|
440
|
-
|
|
441
438
|
// ---- Class and course ------------------------------------------------------------
|
|
442
439
|
|
|
443
440
|
const DAY_MS = 86_400_000;
|
|
@@ -603,7 +600,7 @@ function derive(s: S): S {
|
|
|
603
600
|
noCourseCtaFull: !s.courseCtaFull,
|
|
604
601
|
noCourseCtaClosed: !s.courseCtaClosed,
|
|
605
602
|
notBookableOnline: !s.bookableOnline,
|
|
606
|
-
noAbout: !s.about,
|
|
603
|
+
noAbout: !s.about && !s.aboutJson,
|
|
607
604
|
noPolicy: s.policyLines.length === 0,
|
|
608
605
|
policyCollapsed: !s.policyExpanded,
|
|
609
606
|
noFacts: !s.courseDates && !s.durationText && !s.spotsText && s.locations.length === 0 && !s.online && !s.staffText && !s.payText,
|
|
@@ -617,6 +614,7 @@ function derive(s: S): S {
|
|
|
617
614
|
}
|
|
618
615
|
|
|
619
616
|
function withService(s: S, service: WixService): S {
|
|
617
|
+
const body = descriptionBody(service.description);
|
|
620
618
|
const serviceId = stringOf(service.id) || s.id;
|
|
621
619
|
const name = stringOf(service.name) || "Service";
|
|
622
620
|
const price = priceLine(service);
|
|
@@ -667,7 +665,9 @@ function withService(s: S, service: WixService): S {
|
|
|
667
665
|
paySub: pay.sub,
|
|
668
666
|
requestToBook: service.onlineBooking?.requireManualApproval === true,
|
|
669
667
|
bookableOnline: service.onlineBooking?.enabled !== false,
|
|
670
|
-
about:
|
|
668
|
+
about: body.bodyText,
|
|
669
|
+
aboutJson: body.bodyJson,
|
|
670
|
+
hasAboutJson: body.bodyJson !== "",
|
|
671
671
|
policyLines: policyLines(service.bookingPolicy, stringOf(service.type).toUpperCase()),
|
|
672
672
|
shareUrl: serviceShareUrl(service),
|
|
673
673
|
// WS-C — canonical param-less target; the descriptor's choose-time CTA
|
|
@@ -696,6 +696,7 @@ const id = inputId();
|
|
|
696
696
|
const svc = defineService<S, {
|
|
697
697
|
load: (s: S, arg?: unknown) => Promise<S>;
|
|
698
698
|
share: (s: S) => Promise<S>;
|
|
699
|
+
openLink: (s: S, arg?: unknown) => Promise<undefined>;
|
|
699
700
|
togglePolicy: (s: S) => S;
|
|
700
701
|
toggleSchedule: (s: S) => S;
|
|
701
702
|
openDirections: (s: S, arg?: unknown) => Promise<S>;
|
|
@@ -775,6 +776,8 @@ const svc = defineService<S, {
|
|
|
775
776
|
bookableOnline: true,
|
|
776
777
|
notBookableOnline: false,
|
|
777
778
|
about: "",
|
|
779
|
+
aboutJson: "",
|
|
780
|
+
hasAboutJson: false,
|
|
778
781
|
noAbout: true,
|
|
779
782
|
policyLines: [],
|
|
780
783
|
noPolicy: true,
|
|
@@ -824,6 +827,7 @@ const svc = defineService<S, {
|
|
|
824
827
|
return derive({ ...start, status: "ready", errored: true, name: "" });
|
|
825
828
|
}
|
|
826
829
|
},
|
|
830
|
+
openLink: async (_state, arg) => { await openRichLink(arg); return undefined; },
|
|
827
831
|
share: async (s) => {
|
|
828
832
|
if (!s.name) return s;
|
|
829
833
|
const text = [s.name, s.tagline].filter(Boolean).join(" — ");
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineService } from "@himalaya/state";
|
|
2
|
+
|
|
3
|
+
// Native renderers animate; this worker only publishes the requested visibility.
|
|
4
|
+
// The host waits for presentation, bounded by the original startup deadline.
|
|
5
|
+
const input = (globalThis as unknown as { himalaya?: { input?: Record<string, unknown> } }).himalaya?.input;
|
|
6
|
+
interface State {
|
|
7
|
+
title: string;
|
|
8
|
+
caption: string;
|
|
9
|
+
iconHidden: boolean;
|
|
10
|
+
presentationPending: boolean;
|
|
11
|
+
errorText?: string;
|
|
12
|
+
customLogoHidden?: boolean;
|
|
13
|
+
backgroundImageUrl?: string;
|
|
14
|
+
}
|
|
15
|
+
export const splash = defineService<State, { present: (state: State) => State }>("splash", {
|
|
16
|
+
state: {
|
|
17
|
+
title: typeof input?.title === "string" ? input.title : "",
|
|
18
|
+
caption: typeof input?.caption === "string" ? input.caption : "",
|
|
19
|
+
iconHidden: false,
|
|
20
|
+
presentationPending: true,
|
|
21
|
+
// A malformed OTA toggle must not release the native cover as a successful
|
|
22
|
+
// presentation. The host's existing deadline remains the failure fallback.
|
|
23
|
+
...(input?.showIcon !== undefined && typeof input.showIcon !== "boolean"
|
|
24
|
+
? { errorText: "Splash showIcon must be a boolean" } : {}),
|
|
25
|
+
...(typeof input?.backgroundImageUrl === "string" ? { backgroundImageUrl: input.backgroundImageUrl } : {}),
|
|
26
|
+
...(input?.customLogo === true ? { customLogoHidden: true } : {}),
|
|
27
|
+
},
|
|
28
|
+
actions: {
|
|
29
|
+
present: (state) => state.errorText ? state : ({ ...state,
|
|
30
|
+
iconHidden: input?.showIcon === false || input?.customLogo === true,
|
|
31
|
+
...(input?.customLogo === true ? { customLogoHidden: input?.showIcon === false } : {}),
|
|
32
|
+
presentationPending: false,
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
});
|
|
@@ -39,6 +39,14 @@ export default defineApp({
|
|
|
39
39
|
},
|
|
40
40
|
capabilities: ["live_activity","push","share","secure_storage","open_url","local_database","clipboard","ui","speech","camera","photos","file_picker","files","presigned_upload","app_info","biometrics","wix_platform","animation"],
|
|
41
41
|
designTokensPath: "./tokens.json",
|
|
42
|
+
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
43
|
+
splash: {
|
|
44
|
+
"enabled": true,
|
|
45
|
+
"backgroundColor": "accentPrimary",
|
|
46
|
+
"caption": "Himalaya Owner",
|
|
47
|
+
"minVisibleMs": 400,
|
|
48
|
+
"maxHoldMs": 3000
|
|
49
|
+
},
|
|
42
50
|
navigation: {
|
|
43
51
|
"navKind": "responsive",
|
|
44
52
|
"surfaces": {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// fill __HIMI_ID__ sentinels per request.
|
|
4
4
|
import config from "../config.js";
|
|
5
5
|
|
|
6
|
+
|
|
6
7
|
const runtimeSetting = (value: unknown): unknown => {
|
|
7
8
|
if (value === "__HIMI_PODCAST_FEED_URL__") return process.env.PODCAST_FEED_URL?.trim() || "";
|
|
8
9
|
if (Array.isArray(value)) return value.map(runtimeSetting);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Copy-as-configuration for WORKER-emitted strings (`himi docs designing-himi-screens`,
|
|
2
2
|
// §"Copy is configuration"): a worker never hardcodes user-facing copy — the
|
|
3
3
|
// descriptor bakes the provisioned copy-pack overrides relevant to this worker
|
|
4
|
-
// into its onAppear action params as a `copy` JSON object (
|
|
5
|
-
//
|
|
4
|
+
// into its onAppear action params as a `copy` JSON object (customer strings or
|
|
5
|
+
// source-matched stock translations, computed at descriptor-build time), and the
|
|
6
6
|
// worker reads every user-facing string through `copyParam(key, fallback)`.
|
|
7
7
|
//
|
|
8
8
|
// STASHED (the stashed appear-params idiom, himi-branded-lite-home): the
|
|
@@ -16,9 +16,13 @@
|
|
|
16
16
|
// every worker that emits user-facing copy, and copied verbatim into the
|
|
17
17
|
// generated templates' tier5-src/_shared/.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/** Customer strings override every read; translated stock is valid only for its
|
|
20
|
+
* original English fallback. Some existing keys serve more than one message. */
|
|
21
|
+
export type CopyPackValue = string | { source: string; translation: string };
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
let stashedCopy: Record<string, CopyPackValue> = Object.create(null);
|
|
24
|
+
|
|
25
|
+
/** Absorb the `copy` onAppear param (customer strings or stock translation records)
|
|
22
26
|
* from an action arg. Call first in every action that can receive onAppear
|
|
23
27
|
* params (load/refresh). Non-copy args and malformed packs are ignored — the
|
|
24
28
|
* stock fallbacks keep rendering. */
|
|
@@ -29,9 +33,15 @@ export function stashCopy(arg: unknown): void {
|
|
|
29
33
|
try {
|
|
30
34
|
const parsed = JSON.parse(raw) as unknown;
|
|
31
35
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return;
|
|
32
|
-
const next: Record<string,
|
|
36
|
+
const next: Record<string, CopyPackValue> = Object.create(null);
|
|
33
37
|
for (const [key, value] of Object.entries(parsed as Record<string, unknown>)) {
|
|
34
38
|
if (typeof value === "string") next[key] = value;
|
|
39
|
+
else if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
40
|
+
const row = value as Record<string, unknown>;
|
|
41
|
+
if (typeof row.source === "string" && typeof row.translation === "string") {
|
|
42
|
+
next[key] = { source: row.source, translation: row.translation };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
35
45
|
}
|
|
36
46
|
stashedCopy = next;
|
|
37
47
|
} catch {
|
|
@@ -43,7 +53,8 @@ export function stashCopy(arg: unknown): void {
|
|
|
43
53
|
* pack / no such key reached this worker. */
|
|
44
54
|
export function copyParam(key: string, fallback: string): string {
|
|
45
55
|
const value = stashedCopy[key];
|
|
46
|
-
|
|
56
|
+
if (typeof value === "string") return value !== "" ? value : fallback;
|
|
57
|
+
return value?.source === fallback && value.translation !== "" ? value.translation : fallback;
|
|
47
58
|
}
|
|
48
59
|
|
|
49
60
|
/** Interpolate `{name}` placeholders in a (possibly overridden) template:
|
|
@@ -32,3 +32,47 @@ export function richBody(richContent: unknown, fallback = "", imageWidth = 1400)
|
|
|
32
32
|
const text = rejected === "too_deep" ? "" : ricosToPlainText(doc);
|
|
33
33
|
return { bodyJson: json, bodyText: text || fallback };
|
|
34
34
|
}
|
|
35
|
+
|
|
36
|
+
/** A Wix description may be Ricos (including serialized JSON), HTML or ordinary text.
|
|
37
|
+
* Keep rich documents on the existing bounded encoder path. Non-document JSON and
|
|
38
|
+
* clearly malformed serialization use an independent fallback. Ambiguous bracketed
|
|
39
|
+
* prose stays readable; this does not attempt to repair arbitrary JSON syntax. */
|
|
40
|
+
export function descriptionBody(value: unknown, fallback = "", imageWidth = 1400): RichBody {
|
|
41
|
+
if (typeof value !== "string") return richBody(value, fallback, imageWidth);
|
|
42
|
+
const text = value.trim();
|
|
43
|
+
if (/^[{[]/.test(text)) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed: unknown = JSON.parse(text);
|
|
46
|
+
// Passing the parsed value avoids parsing a valid Ricos document twice; a
|
|
47
|
+
// different JSON structure is rejected by the same existing document check.
|
|
48
|
+
if (parsed && typeof parsed === "object") return richBody(parsed, fallback, imageWidth);
|
|
49
|
+
} catch {
|
|
50
|
+
const objectLike = /^\{\s*(?:["'}]|nodes\b)/.test(text);
|
|
51
|
+
// Only reject scalar-looking malformed arrays when their syntax is clearly
|
|
52
|
+
// unfinished (or contains JS's non-JSON `undefined`). Balanced bracketed
|
|
53
|
+
// prose such as "[1,000]" and "[12:30, 13:30]" is not JSON and stays readable.
|
|
54
|
+
const arrayTokens = text.replace(/"(?:\\.|[^"\\])*"/g, "")
|
|
55
|
+
.replace(/\b(?:true|false|null|undefined)\b/g, "")
|
|
56
|
+
.replace(/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/g, "");
|
|
57
|
+
const arrayLike = /^\[\s*[{"]/.test(text)
|
|
58
|
+
|| (text.startsWith("[") && /^[\s[\]{},:]*$/.test(arrayTokens)
|
|
59
|
+
&& (/,\s*]?$/.test(text) || /\bundefined\b/.test(text) || !text.endsWith("]")));
|
|
60
|
+
if (objectLike || arrayLike) return { bodyJson: "", bodyText: fallback };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Legacy HTML descriptions stay text. Preserve paragraph breaks and ordinary prose's
|
|
64
|
+
// bare '<' (e.g. "ages < 8"), without relying on browser-only DOM APIs in workers.
|
|
65
|
+
const plain = text
|
|
66
|
+
.replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi, "")
|
|
67
|
+
.replace(/<br\s*\/?\s*>/gi, "\n")
|
|
68
|
+
.replace(/<\/(?:p|div|h[1-6]|li)\s*>/gi, "\n\n")
|
|
69
|
+
.replace(/<\/?[a-z][^>]*>/gi, "")
|
|
70
|
+
.replace(/&(?:nbsp|amp|lt|gt|quot|apos|#39);/gi, (entity) => ({
|
|
71
|
+
" ": " ", "&": "&", "<": "<", ">": ">", """: '"', "'": "'", "'": "'",
|
|
72
|
+
})[entity.toLowerCase()] ?? entity)
|
|
73
|
+
.replace(/[\t\r ]+/g, " ")
|
|
74
|
+
.replace(/ *\n */g, "\n")
|
|
75
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
76
|
+
.trim();
|
|
77
|
+
return { bodyJson: "", bodyText: plain || fallback };
|
|
78
|
+
}
|
|
@@ -52,6 +52,16 @@ export default defineApp({
|
|
|
52
52
|
]
|
|
53
53
|
},
|
|
54
54
|
designTokensPath: "./tokens.json",
|
|
55
|
+
// Native fallback; the T5 splash descriptor owns the editable launch appearance.
|
|
56
|
+
splash: {
|
|
57
|
+
"enabled": true,
|
|
58
|
+
"backgroundColor": "accentPrimary",
|
|
59
|
+
"logoAsset": "branded_lite_app_icon",
|
|
60
|
+
"logoWidth": 192,
|
|
61
|
+
"layout": "logoOnly",
|
|
62
|
+
"minVisibleMs": 0,
|
|
63
|
+
"maxHoldMs": 5000
|
|
64
|
+
},
|
|
55
65
|
navigation: {
|
|
56
66
|
"navKind": "responsive",
|
|
57
67
|
"scheme": "himalaya-__HIMI_APP_SLUG__",
|
|
@@ -71,6 +81,13 @@ export default defineApp({
|
|
|
71
81
|
"parentScreenId": "himi_account",
|
|
72
82
|
"tabId": "profile"
|
|
73
83
|
},
|
|
84
|
+
{
|
|
85
|
+
"screenId": "himi_business_contact",
|
|
86
|
+
"isPublic": true,
|
|
87
|
+
"paramKeys": [],
|
|
88
|
+
"parentScreenId": "himi_account",
|
|
89
|
+
"tabId": "profile"
|
|
90
|
+
},
|
|
74
91
|
{
|
|
75
92
|
"screenId": "himi_appearance",
|
|
76
93
|
"isPublic": true,
|