@wix/himalaya-cli 0.1661.0 → 0.1663.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/builder.d.ts +17 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/audio-record/src/index.d.ts +4 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +26 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/members-v1/src/index.d.ts +26 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +8 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-members.mjs +4 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{fcafca348b6b973cfc2eadc938ddec3c515c641874cbca1667a43b22e1bf7a39.bin → 5fe817d61d13666ee8e6951d96a873f768ef305462735f6030cce105f1c21488.bin} +1 -1
- package/dist/browser-plane/sw.js +8 -8
- package/dist/cli.mjs +1147 -731
- package/dist/preview-assets.generated.bin +0 -0
- package/fixtures/wix-canned.json +1 -0
- package/guides/component-reference.json +13 -4
- package/guides/component-reference.md +26 -6
- package/guides/himi-json-output.md +8 -0
- package/guides/index.json +1 -1
- package/guides/one-app-section-mappings.md +3 -4
- package/guides/one-app-to-himi-app.md +20 -1
- package/guides/sdk-reference.json +24 -1
- package/package.json +2 -2
- package/templates/beauty-salon/recipes/announcement-card.json +72 -0
- package/templates/beauty-salon/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/beauty-salon/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/branded-lite/dev/index.ts +791 -169
- package/templates/branded-lite/l10n/en.json +46 -13
- package/templates/branded-lite/l10n/he.json +59 -7
- package/templates/branded-lite/recipes/announcement-card.json +72 -0
- package/templates/branded-lite/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/branded-lite/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/branded-lite/tier5-src/wix-spaces-member-detail/index.ts +367 -63
- package/templates/community-club/l10n/he.json +2 -2
- package/templates/community-club/recipes/announcement-card.json +72 -0
- package/templates/community-club/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/community-club/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/community-club-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/conference/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/events-meetups/recipes/announcement-card.json +72 -0
- package/templates/events-meetups/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/events-meetups/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/events-meetups-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/gym-fitness/recipes/announcement-card.json +72 -0
- package/templates/gym-fitness/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/gym-fitness/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/nonprofit-cause/recipes/announcement-card.json +72 -0
- package/templates/nonprofit-cause/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/nonprofit-cause/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/owner-lite/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/podcast-creator/recipes/announcement-card.json +72 -0
- package/templates/podcast-creator/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/podcast-creator/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/portfolio-creative/recipes/announcement-card.json +72 -0
- package/templates/portfolio-creative/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/portfolio-creative/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/restaurant/recipes/announcement-card.json +72 -0
- package/templates/restaurant/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/restaurant/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/restaurant-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/retail-store/recipes/announcement-card.json +72 -0
- package/templates/retail-store/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/retail-store/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/retail-store-owner/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/salon-spa/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/wholesale-store/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/yoga-studio/recipes/announcement-card.json +72 -0
- package/templates/yoga-studio/tier5-src/_shared/announcement-section.ts +122 -0
- package/templates/yoga-studio/tier5-src/_shared/engine-intl.ts +8 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/engine-intl.ts +8 -0
|
Binary file
|
package/fixtures/wix-canned.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"_comment": "GENERATED by core/web-embed/authoring/gen-reference.mjs from core/ts/src/schema.ts — do not hand-edit. The schema is the source of truth; regenerate on schema changes.",
|
|
3
3
|
"schemaSource": "core/ts/src/schema.ts",
|
|
4
4
|
"bindingGrammar": "$service:<service>.<path> (worker state) · $item.<field> (list row) · $flag:<key> (feature flag) · $env:<key> (client environment — #1056). Bindings resolve in the text/value props marked 'binding-aware' below — INCLUDING Modifiers token refs — but only `background` and `border.color`, which are the two whose token a binding actually fills: a worker can drive per-item theming (e.g. a game board's per-square color), not just text. `shadow` is NOT binding-aware on any renderer, and a gradient is driven by its own `backgroundGradientPath` prop resolving to a gradient token NAME, not by a binding inside a token ref — so `shadow: { token: \"$item.x\" }` and `backgroundGradient: { token: \"$item.x\" }` keep the sentinel and silently lose the per-item styling. Colour slots split by LEVEL, not by component: inside modifiers a colour is a TokenRef OBJECT ({ token: \"…\" }), inside props it is a bare TokenName STRING — there is no modifiers.color or modifiers.tint (see the 'Token slots' section in component-reference.md). A few input props render the LITERAL and are NOT binding-aware — notably SearchField.placeholder and Chip.label; SearchField.value is live and binding-aware like other content props. Bindings also CANNOT target strict-enum fields (style, size, alignment, severity, presentation, contentMode, …) — those fail at render, not validation. $env: is client-resolved (no worker) and valid in modifiers.hiddenPath and FragmentSlot.casePath ONLY — keys reduceMotion/colorScheme/sizeClass/isRTL/keyboardVisible, e.g. hiddenPath:\"$env:reduceMotion\" or hiddenPath:\"$env:colorScheme==light\", casePath:\"$env:colorScheme\"; unknown key fails open (shown / defaultCase).",
|
|
5
|
-
"componentCount":
|
|
5
|
+
"componentCount": 90,
|
|
6
6
|
"notImplementedComponents": [
|
|
7
7
|
"Text",
|
|
8
8
|
"Icon",
|
|
@@ -995,16 +995,25 @@
|
|
|
995
995
|
],
|
|
996
996
|
"propsSource": "export interface VoiceNoteProps {\n /** 0..1 amplitude buckets, already on the shared dBFS curve. */\n waveform?: number[];\n /** \"$service:\" binding → number[] (overrides `waveform`).\n * `$service:` only — a `$item.` placeholder is stringified to \"\" by both\n * native per-row substituters, so it would empty the waveform on iOS and\n * Android while working on web. The scalar `*Path` companions below do\n * accept `$item.`. */\n waveformPath?: string;\n durationMs?: number;\n durationMsPath?: string;\n positionMs?: number;\n positionMsPath?: string;\n /** \"idle\" (default) | \"loading\" | \"playing\" | \"paused\" — lenient, unknown ⇒ \"idle\". */\n state?: string;\n statePath?: string;\n /** \"sent\" (default) | \"uploading\" | \"failed\". */\n delivery?: string;\n deliveryPath?: string;\n onPlay?: Action;\n onPause?: Action;\n /** fired with `args.positionMs` (ms). */\n onSeek?: Action;\n /** fired with `args.rate`. */\n onRateChange?: Action;\n /** offered only while `delivery === \"failed\"`. */\n onRetry?: Action;\n /** rate cycle, e.g. [1, 1.5, 2]; empty ⇒ no rate control. */\n rates?: number[];\n rate?: number;\n ratePath?: string;\n /** played-bar token (default \"accentPrimary\"); unplayed bars derive from it. */\n tint?: TokenName;\n /** resample target (default 48, clamped 8..128). */\n barCount?: number;\n}"
|
|
997
997
|
},
|
|
998
|
+
{
|
|
999
|
+
"name": "LiveWaveform",
|
|
1000
|
+
"category": "Live microphone waveform",
|
|
1001
|
+
"propsType": "LiveWaveformProps",
|
|
1002
|
+
"bindings": [
|
|
1003
|
+
"activePath"
|
|
1004
|
+
],
|
|
1005
|
+
"propsSource": "export interface LiveWaveformProps {\n /** \"audio_record\" (default; the only source). Any other value draws the flat baseline. */\n source?: string;\n /** Visible bar count. Default 32, clamped 8..128. */\n bars?: number;\n /** Bar colour token. Default \"accentPrimary\". */\n color?: TokenName;\n /** Height in pt/dp. Default 32. */\n height?: number;\n /** `$service:` binding → boolean. Live while truthy, baseline otherwise. Empty ⇒ live whenever a recording is active. */\n activePath?: string;\n}"
|
|
1006
|
+
},
|
|
998
1007
|
{
|
|
999
1008
|
"name": "Marquee",
|
|
1000
|
-
"category": "
|
|
1009
|
+
"category": "Live microphone waveform",
|
|
1001
1010
|
"propsType": "MarqueeProps",
|
|
1002
1011
|
"bindings": [],
|
|
1003
1012
|
"propsSource": "export interface MarqueeProps {\n text?: string;\n durationMs?: number;\n style?: TokenName;\n color?: TokenName;\n}"
|
|
1004
1013
|
},
|
|
1005
1014
|
{
|
|
1006
1015
|
"name": "Timeline",
|
|
1007
|
-
"category": "
|
|
1016
|
+
"category": "Live microphone waveform",
|
|
1008
1017
|
"propsType": "TimelineProps",
|
|
1009
1018
|
"bindings": [
|
|
1010
1019
|
"entriesPath"
|
|
@@ -1013,7 +1022,7 @@
|
|
|
1013
1022
|
},
|
|
1014
1023
|
{
|
|
1015
1024
|
"name": "PageControl",
|
|
1016
|
-
"category": "
|
|
1025
|
+
"category": "Live microphone waveform",
|
|
1017
1026
|
"propsType": "PageControlProps",
|
|
1018
1027
|
"bindings": [],
|
|
1019
1028
|
"propsSource": "export interface PageControlProps {\n count?: number;\n currentIndex?: number;\n onChange?: Action;\n}"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
> GENERATED from `core/ts/src/schema.ts` by `core/web-embed/authoring/gen-reference.mjs`.
|
|
4
4
|
> The schema is the source of truth — regenerate on schema changes; do not hand-edit.
|
|
5
5
|
|
|
6
|
-
**
|
|
6
|
+
**90 core component types.** Every component body is `{ "package": "himalaya", "type": "<Type>", "props": { … } }`.
|
|
7
7
|
Binding grammar: `$service:<service>.<path>` (worker state) · `$item.<field>` (list row template) · `$flag:<key>` (feature flag) · `$env:<key>` (client environment — #1056).
|
|
8
8
|
Bindings resolve in the text/value props marked **binding-aware** below — **including two `Modifiers` token refs**, `background` and `border.color`, which are the only two whose token a binding actually fills: a worker can drive per-item **theming** (e.g. a game board's per-square color, `background: { token: "$item.bg" }`), not just text content. `shadow` and `backgroundGradient` are `TokenRef`s but are **not** binding-aware on any renderer — `shadow: { token: "$item.x" }` keeps the sentinel as a literal token name and silently loses the per-item styling, and a gradient is driven by its own `backgroundGradientPath` prop resolving to a gradient token NAME, not by a binding inside a token ref.
|
|
9
9
|
`$env:` is **client-resolved** (no worker) and valid in `modifiers.hiddenPath` and `FragmentSlot.casePath` **only** — keys `reduceMotion` / `colorScheme` / `sizeClass` / `isRTL` / `keyboardVisible` (an on-screen keyboard is up — `hiddenPath: "$env:keyboardVisible"` hides a header while typing), with an optional `==`/`!=` comparison (e.g. `hiddenPath: "$env:reduceMotion"`, `hiddenPath: "$env:colorScheme==light"`, `casePath: "$env:colorScheme"`). An unknown key fails open (shown / `defaultCase`).
|
|
@@ -100,9 +100,10 @@ See also **[Modifiers](#modifiers)** (the `modifiers` block) and **[Actions](#ac
|
|
|
100
100
|
| `MediaField` | Image well + Wix Media upload | `valuePath`, `fallbackTextPath` |
|
|
101
101
|
| `RichTextField` | Formatted multiline field | `valuePath` |
|
|
102
102
|
| `VoiceNote` | Recorded-audio bubble (messenger design G4) | `waveformPath`, `durationMsPath`, `positionMsPath`, `statePath`, `deliveryPath`, `ratePath` |
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
103
|
+
| `LiveWaveform` | Live microphone waveform | `activePath` |
|
|
104
|
+
| `Marquee` | Live microphone waveform | — |
|
|
105
|
+
| `Timeline` | Live microphone waveform | `entriesPath` |
|
|
106
|
+
| `PageControl` | Live microphone waveform | — |
|
|
106
107
|
| `WheelPicker` | Pickers & inputs | `optionsPath`, `selectedId` |
|
|
107
108
|
| `ColorPicker` | Pickers & inputs | `valuePath` |
|
|
108
109
|
| `OtpInput` | Pickers & inputs | `valuePath` |
|
|
@@ -121,7 +122,7 @@ See also **[Modifiers](#modifiers)** (the `modifiers` block) and **[Actions](#ac
|
|
|
121
122
|
|
|
122
123
|
These props are accepted by the schema and pass validation, but the named platform's renderer never reads them — they silently do nothing (no warning, no log). Prefer a prop NOT listed here, or drive the behaviour from a worker.
|
|
123
124
|
|
|
124
|
-
**Scope: 7 of
|
|
125
|
+
**Scope: 7 of 90 components, all of them android / web / ios-only** — every other component/platform pair reads every prop it decodes. The list splits in two, and the halves mean different things:
|
|
125
126
|
|
|
126
127
|
- **`category` (2: `MediaPlayer`, `TimeGrid`)** — the prop changes the component's *kind*. These genuinely are **not implemented**: an overlay renders always-visible inline, so the component does not do the job its name implies. Check the row's note for a working alternative.
|
|
127
128
|
- **`styling` (5: `Text`, `Icon`, `WebView`, `Video`, `PdfView`)** — the component itself **works**; only the listed prop is inert. Use the component; just do not depend on that one prop.
|
|
@@ -169,7 +170,7 @@ So `border` nests an object and `boxShadow`/`backgroundGradient` nest strings. R
|
|
|
169
170
|
element interface (printed below) rather than extrapolating from the level.
|
|
170
171
|
|
|
171
172
|
- Modifier-level (`TokenRef` object): `modifiers.background`, `modifiers.shadow`, `modifiers.backgroundGradient`, `modifiers.appear`, `modifiers.material`, `modifiers.pressMotion`, `modifiers.border.color`.
|
|
172
|
-
- Component-prop-level (bare `TokenName` string): `Card.background`, `Text.style`, `Text.color`, `Image.placeholder`, `Image.tint`, `Icon.tint`, `Toggle.trackOn`, `Toggle.trackOff`, `Toggle.thumb`, `Badge.token`, `Tag.token`, `ProgressBar.tint`, `ProgressBar.trackColor`, `AvatarStrip.ringGradient`, `ListItem.titleStyle`, `ListItem.subtitleStyle`, `ListItem.titleColor`, `ListItem.subtitleColor`, `ListItem.overlineColor`, `Slider.tint`, `ActivityIndicator.tint`, `Chip.token`, `Label.style`, `Label.color`, `Gauge.tint`, `Rating.color`, `Chart.color`, `DonutChart.color`, `VoiceNote.tint`, `Marquee.style`, `Marquee.color`, `Fab.tint`.
|
|
173
|
+
- Component-prop-level (bare `TokenName` string): `Card.background`, `Text.style`, `Text.color`, `Image.placeholder`, `Image.tint`, `Icon.tint`, `Toggle.trackOn`, `Toggle.trackOff`, `Toggle.thumb`, `Badge.token`, `Tag.token`, `ProgressBar.tint`, `ProgressBar.trackColor`, `AvatarStrip.ringGradient`, `ListItem.titleStyle`, `ListItem.subtitleStyle`, `ListItem.titleColor`, `ListItem.subtitleColor`, `ListItem.overlineColor`, `Slider.tint`, `ActivityIndicator.tint`, `Chip.token`, `Label.style`, `Label.color`, `Gauge.tint`, `Rating.color`, `Chart.color`, `DonutChart.color`, `VoiceNote.tint`, `LiveWaveform.color`, `Marquee.style`, `Marquee.color`, `Fab.tint`.
|
|
173
174
|
|
|
174
175
|
There is **no `modifiers.color` and no `modifiers.tint`** — a `tint` is always a component
|
|
175
176
|
prop. Of the two nested slots spelled `color`, `modifiers.border.color` is a `TokenRef`
|
|
@@ -1919,6 +1920,25 @@ export interface VoiceNoteProps {
|
|
|
1919
1920
|
}
|
|
1920
1921
|
```
|
|
1921
1922
|
|
|
1923
|
+
### Live microphone waveform
|
|
1924
|
+
|
|
1925
|
+
#### LiveWaveform
|
|
1926
|
+
|
|
1927
|
+
```ts
|
|
1928
|
+
export interface LiveWaveformProps {
|
|
1929
|
+
/** "audio_record" (default; the only source). Any other value draws the flat baseline. */
|
|
1930
|
+
source?: string;
|
|
1931
|
+
/** Visible bar count. Default 32, clamped 8..128. */
|
|
1932
|
+
bars?: number;
|
|
1933
|
+
/** Bar colour token. Default "accentPrimary". */
|
|
1934
|
+
color?: TokenName;
|
|
1935
|
+
/** Height in pt/dp. Default 32. */
|
|
1936
|
+
height?: number;
|
|
1937
|
+
/** `$service:` binding → boolean. Live while truthy, baseline otherwise. Empty ⇒ live whenever a recording is active. */
|
|
1938
|
+
activePath?: string;
|
|
1939
|
+
}
|
|
1940
|
+
```
|
|
1941
|
+
|
|
1922
1942
|
#### Marquee
|
|
1923
1943
|
|
|
1924
1944
|
```ts
|
|
@@ -14,6 +14,14 @@ require those fields. Existing error-only push refusals now also carry `ok: fals
|
|
|
14
14
|
Output channels and process exit codes are unchanged. Read JSON failures on both
|
|
15
15
|
stdout and stderr; progress/warnings are not failure envelopes.
|
|
16
16
|
|
|
17
|
+
## `himi captcha setup|status` target refusal
|
|
18
|
+
|
|
19
|
+
| Code | Meaning |
|
|
20
|
+
| --- | --- |
|
|
21
|
+
| `insecure_target` | The control URL is neither an HTTPS Wix host nor a loopback dev server. No CAPTCHA request or credential is sent to that target. Stdout retains `complete: false` and `error: "insecure_target"`; exit 1. |
|
|
22
|
+
|
|
23
|
+
This is not a whole-command migration: other CAPTCHA failures retain their legacy envelopes.
|
|
24
|
+
|
|
17
25
|
## `himi login --wix` codes
|
|
18
26
|
|
|
19
27
|
| Code | Meaning |
|
package/guides/index.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_comment": "AUTO-GENERATED by tools/authoring-kit/bundle.mjs — DO NOT EDIT. Regenerate with: npm run authoring:gen",
|
|
3
3
|
"schemaStamp": {
|
|
4
|
-
"componentCount":
|
|
4
|
+
"componentCount": 90,
|
|
5
5
|
"schemaSource": "core/ts/src/schema.ts"
|
|
6
6
|
},
|
|
7
7
|
"portalUrl": "https://apps.wix.com/_api/himi-serve/docs",
|
|
@@ -22,11 +22,11 @@ Source snapshots: Catalyst `617c06d43d2a5608b6876d724553269b1e5346f0`; Himalaya
|
|
|
22
22
|
|
|
23
23
|
| Classification | Definitions |
|
|
24
24
|
| --- | ---: |
|
|
25
|
-
| Module |
|
|
25
|
+
| Module | 14 |
|
|
26
26
|
| Primitive | 7 |
|
|
27
27
|
| Composition | 9 |
|
|
28
28
|
| Partial | 25 |
|
|
29
|
-
| Empty |
|
|
29
|
+
| Empty | 22 |
|
|
30
30
|
| Total | 77 |
|
|
31
31
|
|
|
32
32
|
## Mappings by server group
|
|
@@ -221,7 +221,7 @@ carousel placement remain separate gaps; the mappings above stay Partial.
|
|
|
221
221
|
| --- | --- | --- | --- | --- | --- |
|
|
222
222
|
| `platform_general_contact_section` | `wix.platform.general.contact_section` | [Core Text/Button/Map composition](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/builder.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Inline composition | Composition | Compose the supplied business contact/address/description and source visibility/get-in-touch settings. Wire phone/email/URL/chat actions to existing target capabilities; the Structure alone may need business contact values supplied alongside it. |
|
|
223
223
|
| `platform_general_upcoming_section` | `wix.platform.general.upcoming_section` | [My Bookings data](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-booking-bookings/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + [existing home modules](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/home-modules-screen.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Existing base; adaptation needed | Partial | Reuse real member upcoming-booking logic and compose the source strip/limit. Preserve visitor/access behavior and the original agenda CTA; this does not resolve the separate Bookings agenda gap. |
|
|
224
|
-
| `platform_general_announcement_section` | `wix.platform.general.announcement_section` |
|
|
224
|
+
| `platform_general_announcement_section` | `wix.platform.general.announcement_section` | `announcement-section` shared module + `announcement-card` recipe, mapped by `himi one-app generate` | Inline section; the content is read at runtime, never baked at migration time | Module | The latest announcement (title, rich body, creator, date) through the one read-only call the native app makes: `GET https://manage.wix.com/_api/mobile-apps-announcements/v1/announcements/latest?includeReaderData=false`, authorized with the app's own signed instance (Member when signed in, else Visitor). `includeReaderData` stays false (true needs the One App manage permission and answers 403); `AddCurrentMemberAsReader` is a write and is never called. Known server behaviour, shared with the native app: a site with no announcement gets its default welcome text saved once by this read, so do not call it during migration collection or validation. The section has no settings. The announcement `content` is a DraftJS raw state for announcements written in the app (shown as plain text) or a Ricos document (shown rich). Native hosts send the consumer credential to exactly this GET path only (the `isSupportedConsumerEndpoint` family in `WixApiCapability`, Android and Swift), so a phone shows the section from the first Player/app native release that carries that entry; the local web preview (`himi run`) needs nothing. |
|
|
225
225
|
| `platform_general_members_section` | `membersArea.MembersAboutWidget` | [Member data](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/wix-spaces-members/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + [existing member avatars/home composition](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/home-modules-screen.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Inline composition | Composition | Reuse member rows/avatar presentation and the member-directory destination. Preserve source strip/title/count/privacy settings rather than copying seeded dashboard members. |
|
|
226
226
|
| `platform_elements_divider_section` | `wix.platform.elements.divider_section` | [Core Divider / layout modifiers](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/builder.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Inline primitive | Primitive | Translate orientation/style/spacing from instance settings where supported and retain section margins. |
|
|
227
227
|
| `platform_elements_image_section` | `wix.platform.elements.image_section` | [Core Image](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/src/builder.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") | Inline primitive | Primitive | Translate media URL, aspect/crop ratio, fill/fit, corner radius, alt text and configured click action; preserve sizing and accessibility. |
|
|
@@ -392,7 +392,6 @@ These are the exact definitions whose target cells above remain empty. “Not fo
|
|
|
392
392
|
| `photoalbum-section-definitions.json` | `photoAlbums_list_section` | Existing Photo Albums code is an empty-state placeholder with no album API wired. Pro Gallery uses a different data source and is not a substitute; choose an implementation explicitly. |
|
|
393
393
|
| `photoalbum-section-definitions.json` | `photoAlbums_photos_list` | Existing Photo Albums code is an empty-state placeholder with no album API wired. Pro Gallery uses a different data source and is not a substitute; choose an implementation explicitly. |
|
|
394
394
|
| `photoalbum-section-definitions.json` | `photoAlbums_carousel_section` | Existing Photo Albums code is an empty-state placeholder with no album API wired. Pro Gallery uses a different data source and is not a substitute; choose an implementation explicitly. |
|
|
395
|
-
| `platform-section-definitions.json` | `platform_general_announcement_section` | No live source business-announcement implementation was verified. The Spaces dashboard contains seeded announcement text; the Branded home uses a Blog post title; platform new-release announcements are a different entity. |
|
|
396
395
|
| `platform-section-definitions.json` | `platform_ai_generated_section` | No verified interpreter for the source AI-generated section payload/runtime was found. The presence of Tier-5 or WebView support does not establish payload compatibility. |
|
|
397
396
|
| `platform-section-definitions.json` | `platform_elements_embed_code_section` | Core WebView supports inlineHtml, but the source embed-code settings/runtime contract was not verified. Leave this mapping empty instead of assuming arbitrary source embed payloads are compatible. |
|
|
398
397
|
| `stores-section-definitions.json` | `stores_wishlist_section` | The existing himi_saved_products feature is device-local saved products, not a verified account-backed Wix Stores wishlist. Do not substitute those semantics without the user's choice. |
|
|
@@ -363,6 +363,10 @@ Verify probe behavior in the service contract, not just its HTTP method. Some
|
|
|
363
363
|
legacy GET routes initialize missing records. In particular, announcement
|
|
364
364
|
latest/list reads can create a default announcement; avoid those during migration
|
|
365
365
|
collection and validation. A verified read of a referenced, known record is safer.
|
|
366
|
+
The one place the migration does read announcements is the generated app itself: `generate` maps
|
|
367
|
+
`platform_general_announcement_section` to the shared announcement block, whose worker reads the latest announcement at runtime
|
|
368
|
+
with the one read-only call the native app makes (see the section mappings reference). It never calls `AddCurrentMemberAsReader`
|
|
369
|
+
(a write) and never asks for reader data.
|
|
366
370
|
|
|
367
371
|
`source-graph.json` is a basic relationship index, not the completed plan. The
|
|
368
372
|
agent must still resolve business CTA contracts, toolbar actions and inheritance,
|
|
@@ -1349,6 +1353,14 @@ So generate descriptors as data and write them with the CLI:
|
|
|
1349
1353
|
himi template screens --upsert --from .himi/one-app/gen/screens.json
|
|
1350
1354
|
```
|
|
1351
1355
|
|
|
1356
|
+
`generate` owns a few load parameters on three template screens: `categoryId` on `himi_shop`, and `title`, `groupListLabel` and
|
|
1357
|
+
`pageSize` on `himi_groups_feed` / `himi_groups`. The scaffold ships none of them; a run writes the ones a page's source gives and
|
|
1358
|
+
clears the ones no page owns any more, so do not hand-add these keys there.
|
|
1359
|
+
|
|
1360
|
+
`generate` also fills the `route` rows of `ONE-APP-COVERAGE.json` for the source screens it mapped (`target.screenId` is the screen of
|
|
1361
|
+
the source screen's first visible page), creating the ledger when it is absent; `himi one-app validate-topbar` reads them. A source
|
|
1362
|
+
screen none of whose pages became a screen keeps a blank row, which the validator names.
|
|
1363
|
+
|
|
1352
1364
|
The file is one JSON object, `{ "<screenId>": <ScreenDescriptor>, … }`. Each existing
|
|
1353
1365
|
id is replaced in place; each new id is added and registered in
|
|
1354
1366
|
`navigation.linkableScreens`. One invalid entry refuses the batch and restores every
|
|
@@ -1378,6 +1390,11 @@ with its filled variant when there is one) and repoints every `linkableScreens`
|
|
|
1378
1390
|
- a screen the More tab lists takes the More tab's id (only when there is a More tab);
|
|
1379
1391
|
- any other screen takes `""`, the default stack.
|
|
1380
1392
|
|
|
1393
|
+
A page the source navigation lists (its `navigation-plan.json` tabs, or the bottom tabs of a source that has its own) that
|
|
1394
|
+
`generate` could not turn into a screen is refused with `pages_without_screen`, which names every such page, and nothing is
|
|
1395
|
+
written: a bar that silently lacks a source page is not the source's navigation. Map the sections `generate` reports under
|
|
1396
|
+
`unmapped` and run it again. No placeholder screen is added for them.
|
|
1397
|
+
|
|
1381
1398
|
A tab for a screen the app does not define is refused with `screen_missing` and nothing is written: write the generated
|
|
1382
1399
|
screens first, and keep any template screen a tab opens when you trim. A source icon with no catalog match is reported
|
|
1383
1400
|
under `gaps` and gets a neutral icon; choose a better one in `config.ts`. The drawer is not touched.
|
|
@@ -1795,7 +1812,9 @@ evaluates (`svc.load();` at the bottom of the file — the pattern every migrati
|
|
|
1795
1812
|
worker uses); the screen descriptor names nothing, but the read runs as soon as the
|
|
1796
1813
|
screen boots the worker. Each boot path must be a catalogue or directory read.
|
|
1797
1814
|
Stop if one submits, orders, books, pays, or calls a getter known to mutate on read
|
|
1798
|
-
(such as the legacy announcement default getter).
|
|
1815
|
+
(such as the legacy announcement default getter) from the migration's own collection or tests. The one expected exception is the
|
|
1816
|
+
generated announcement block's runtime read of the latest announcement (see the section mappings reference), which belongs to the
|
|
1817
|
+
app and runs on a device or live preview, never during collection, validation or `himi test`. Then review the recorded and
|
|
1799
1818
|
refused requests. Keep actual recordings
|
|
1800
1819
|
under `.himi/one-app/fixtures/net-mocks.json`. For local test/render discovery,
|
|
1801
1820
|
make `dev/net-mocks.json` a relative symlink to that private file: the source
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
{
|
|
351
351
|
"name": "subscribeLevel",
|
|
352
352
|
"kind": "function",
|
|
353
|
-
"jsdoc": "/** Subscribe the worker to native-pushed live meter readings. */",
|
|
353
|
+
"jsdoc": "/** Subscribe the worker to native-pushed live meter readings, delivered at most 10 times a\n * second while a `start()` recording runs (iOS, macOS and Android; web answers a snapshot).\n * For an on-screen meter, prefer the `LiveWaveform` component: the renderer reads the level\n * itself, so the worker does not re-render the screen on every reading. */",
|
|
354
354
|
"decl": "export async function subscribeLevel(handler: string): Promise<void>;",
|
|
355
355
|
"verificationChecked": true
|
|
356
356
|
},
|
|
@@ -28293,6 +28293,29 @@
|
|
|
28293
28293
|
"http": "POST /members/v3/followers/my/connections",
|
|
28294
28294
|
"verificationChecked": true
|
|
28295
28295
|
},
|
|
28296
|
+
{
|
|
28297
|
+
"name": "WixMemberAbout",
|
|
28298
|
+
"kind": "interface",
|
|
28299
|
+
"jsdoc": "",
|
|
28300
|
+
"decl": "export interface WixMemberAbout {\n id?: string;\n memberId?: string;\n /** Ricos document of the \"About\" section. */\n content?: Record<string, unknown>;\n}",
|
|
28301
|
+
"verificationChecked": true
|
|
28302
|
+
},
|
|
28303
|
+
{
|
|
28304
|
+
"name": "WixQueryMemberAboutsResponse",
|
|
28305
|
+
"kind": "interface",
|
|
28306
|
+
"jsdoc": "",
|
|
28307
|
+
"decl": "export interface WixQueryMemberAboutsResponse {\n memberAbouts?: WixMemberAbout[];\n}",
|
|
28308
|
+
"verificationChecked": true
|
|
28309
|
+
},
|
|
28310
|
+
{
|
|
28311
|
+
"name": "queryMemberAbouts",
|
|
28312
|
+
"kind": "function",
|
|
28313
|
+
"jsdoc": "/** The \"About\" sections that match a query — POST /members/v2/abouts/query. Filter by\n * `{ memberId }`. A member with no About yields an empty list; the by-id GET answers 404 instead,\n * so callers should query rather than get.\n *\n * @scope visitor — observed live: an anonymous visitor token (the Branded Lite site's OAuth client) got 200 for eight public members.\n * None of them had an About section, so the shape of a non-empty answer is the documented one, not an observed one. The API lock\n * (`codegen/wix/auto/lock.json`) lists the APP identity only. A refused read must hide the About section and nothing else; it never\n * means \"this member has no About\". */",
|
|
28314
|
+
"decl": "export function queryMemberAbouts(\n req: { query?: { filter?: Record<string, unknown>; cursorPaging?: { limit?: number; cursor?: string } } } = {},\n options?: WixCallOptions,\n): Promise<WixQueryMemberAboutsResponse>;",
|
|
28315
|
+
"http": "POST /members/v2/abouts/query",
|
|
28316
|
+
"scope": "visitor",
|
|
28317
|
+
"verificationChecked": true
|
|
28318
|
+
},
|
|
28296
28319
|
{
|
|
28297
28320
|
"name": "WixMemberLastOpenApp",
|
|
28298
28321
|
"kind": "interface",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/himalaya-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1663.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": [
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"artifactId": "himalaya-cli"
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"falconPackageHash": "
|
|
75
|
+
"falconPackageHash": "5d3793aa788edc5337012c130b481b7eb61984c5f1f160b81f7a951e"
|
|
76
76
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_recipe": "The business's latest announcement (title, rich body, creator and date), read at runtime. Service: registerAnnouncementSection(svc). Hidden whole while there is nothing to show.",
|
|
3
|
+
"_placeholders": {
|
|
4
|
+
"svc": "service name the page worker registered with registerAnnouncementSection",
|
|
5
|
+
"id": "unique node id prefix (e.g. the screen id)",
|
|
6
|
+
"heading": "the source section's own title when it shows one, else an empty string"
|
|
7
|
+
},
|
|
8
|
+
"node": {
|
|
9
|
+
"id": "{{id}}.announcement",
|
|
10
|
+
"body": {
|
|
11
|
+
"package": "himalaya",
|
|
12
|
+
"type": "VStack",
|
|
13
|
+
"props": {
|
|
14
|
+
"spacing": 8,
|
|
15
|
+
"alignment": "leading",
|
|
16
|
+
"children": [
|
|
17
|
+
{
|
|
18
|
+
"id": "{{id}}.heading",
|
|
19
|
+
"body": { "package": "himalaya", "type": "Text", "props": { "text": "{{heading}}", "style": "title3", "collapseWhenEmpty": true } }
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"id": "{{id}}.title",
|
|
23
|
+
"body": { "package": "himalaya", "type": "Text", "props": { "text": "$service:{{svc}}.title", "style": "bodyEmphasis", "collapseWhenEmpty": true } },
|
|
24
|
+
"modifiers": { "hiddenPath": "$service:{{svc}}.noTitle" }
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "{{id}}.body_rich",
|
|
28
|
+
"body": {
|
|
29
|
+
"package": "himalaya",
|
|
30
|
+
"type": "RichContent",
|
|
31
|
+
"props": {
|
|
32
|
+
"documentJsonPath": "$service:{{svc}}.bodyJson",
|
|
33
|
+
"onLink": { "actionId": "tier5.{{svc}}.openLink" },
|
|
34
|
+
"fallback": { "id": "{{id}}.body_rich_fallback", "body": { "package": "himalaya", "type": "Text", "props": { "text": "$service:{{svc}}.body", "style": "body", "color": "textSecondary" } } }
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"modifiers": { "hiddenPath": "$service:{{svc}}.noBodyJson" }
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "{{id}}.body",
|
|
41
|
+
"body": { "package": "himalaya", "type": "Text", "props": { "text": "$service:{{svc}}.body", "style": "body", "color": "textSecondary", "collapseWhenEmpty": true } },
|
|
42
|
+
"modifiers": { "hiddenPath": "$service:{{svc}}.hasBodyJson" }
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "{{id}}.meta",
|
|
46
|
+
"body": {
|
|
47
|
+
"package": "himalaya",
|
|
48
|
+
"type": "HStack",
|
|
49
|
+
"props": {
|
|
50
|
+
"spacing": 8,
|
|
51
|
+
"alignment": "center",
|
|
52
|
+
"children": [
|
|
53
|
+
{
|
|
54
|
+
"id": "{{id}}.creator",
|
|
55
|
+
"body": { "package": "himalaya", "type": "Text", "props": { "text": "$service:{{svc}}.creator", "style": "caption", "color": "textSecondary", "collapseWhenEmpty": true } },
|
|
56
|
+
"modifiers": { "hiddenPath": "$service:{{svc}}.noCreator" }
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "{{id}}.created",
|
|
60
|
+
"body": { "package": "himalaya", "type": "Text", "props": { "text": "$service:{{svc}}.created", "style": "caption", "color": "textSecondary", "collapseWhenEmpty": true } },
|
|
61
|
+
"modifiers": { "hiddenPath": "$service:{{svc}}.noCreated" }
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"modifiers": { "hiddenPath": "$service:{{svc}}.noAnnouncement", "padding": { "leading": 16, "trailing": 16, "top": 16, "bottom": 16 } }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// The INLINE announcement section: the business's latest announcement, read at RUNTIME (never baked at migration time) and
|
|
2
|
+
// shown next to other sections. It is the call the native Branded app's announcement section makes
|
|
3
|
+
// (wix-one-app-member-view, Announcement/serverApiService.ts `fetchLatestAnnouncement`): one GET of the latest announcement with the
|
|
4
|
+
// app's own signed instance (Member when signed in, else Visitor), which the `wixApi` bridge attaches.
|
|
5
|
+
//
|
|
6
|
+
// READ-ONLY, ALWAYS: `includeReaderData` stays false (true needs the One App manage permission and answers 403), and nothing here
|
|
7
|
+
// ever marks an announcement as seen (`AddCurrentMemberAsReader` is a write). Known server behaviour, shared with the native app: a
|
|
8
|
+
// site that has no announcement yet gets its default welcome text saved once, by this very read.
|
|
9
|
+
// A phone sends the signed instance to this URL only because the native hosts (Android and Swift `WixApiCapability`) allow exactly this
|
|
10
|
+
// GET (host, path, method and the reader-data-off query) for the consumer providers; a build without that entry refuses the read and the
|
|
11
|
+
// section shows nothing. The local web preview has no such list.
|
|
12
|
+
// The `announcement-card` recipe is the card that reads it, bound as `$service:<serviceName>.*`.
|
|
13
|
+
import { defineService } from "@himalaya/state";
|
|
14
|
+
import { richBody } from "./rich-body.js";
|
|
15
|
+
import { formatDateMedium } from "./engine-intl.js";
|
|
16
|
+
import { openRichLink } from "./rich-content-link.js";
|
|
17
|
+
|
|
18
|
+
/** The one call: the latest announcement, without the reader data. */
|
|
19
|
+
export const LATEST_ANNOUNCEMENT_URL = "https://manage.wix.com/_api/mobile-apps-announcements/v1/announcements/latest?includeReaderData=false";
|
|
20
|
+
|
|
21
|
+
interface LatestAnnouncementResponse {
|
|
22
|
+
announcement?: {
|
|
23
|
+
title?: unknown;
|
|
24
|
+
/** The announcement's content: a DraftJS raw state for announcements written in the app, or a Ricos document (as a Struct). */
|
|
25
|
+
content?: unknown;
|
|
26
|
+
createdDate?: unknown;
|
|
27
|
+
creatorMemberProfileData?: { nickname?: unknown; imageUrl?: unknown };
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface AnnouncementState {
|
|
32
|
+
status: "loading" | "ready" | "error";
|
|
33
|
+
hasAnnouncement: boolean; noAnnouncement: boolean;
|
|
34
|
+
title: string; noTitle: boolean;
|
|
35
|
+
/** The rich body as one document string (RichContent draws nothing for ""), and its plain text, shown when there is no document. */
|
|
36
|
+
bodyJson: string; hasBodyJson: boolean; noBodyJson: boolean;
|
|
37
|
+
body: string; noBody: boolean;
|
|
38
|
+
created: string; noCreated: boolean;
|
|
39
|
+
creator: string; noCreator: boolean;
|
|
40
|
+
creatorImage: string; noCreatorImage: boolean;
|
|
41
|
+
isLoading: boolean; notLoading: boolean;
|
|
42
|
+
isErrored: boolean; notErrored: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const text = (value: unknown): string => (typeof value === "string" ? value.trim() : "");
|
|
46
|
+
|
|
47
|
+
/** The plain text of a DraftJS raw state (`{ blocks: [{ text }], entityMap }`), which is what the service's `content` really is for
|
|
48
|
+
* announcements written in the app (observed on a live site, 2026-11-11), or undefined when `content` is not one. Only the blocks' own
|
|
49
|
+
* text is read: the entity map (links, images) is never followed. */
|
|
50
|
+
function draftPlainText(content: unknown): string | undefined {
|
|
51
|
+
let doc = content;
|
|
52
|
+
if (typeof doc === "string") { try { doc = JSON.parse(doc); } catch { return undefined; } }
|
|
53
|
+
const blocks = (doc as { blocks?: unknown } | null | undefined)?.blocks;
|
|
54
|
+
if (!Array.isArray(blocks)) return undefined;
|
|
55
|
+
return blocks.map((block) => text((block as { text?: unknown } | null)?.text)).filter(Boolean).join("\n\n");
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function derive(status: AnnouncementState["status"], fields: { title?: string; bodyJson?: string; body?: string; created?: string; creator?: string; creatorImage?: string } = {}): AnnouncementState {
|
|
59
|
+
const title = fields.title ?? "", bodyJson = fields.bodyJson ?? "", body = fields.body ?? "", created = fields.created ?? "";
|
|
60
|
+
const creator = fields.creator ?? "", creatorImage = fields.creatorImage ?? "";
|
|
61
|
+
const hasAnnouncement = status === "ready" && !!(title || bodyJson || body);
|
|
62
|
+
return {
|
|
63
|
+
status, hasAnnouncement, noAnnouncement: !hasAnnouncement,
|
|
64
|
+
title, noTitle: !title,
|
|
65
|
+
bodyJson, hasBodyJson: !!bodyJson, noBodyJson: !bodyJson,
|
|
66
|
+
body, noBody: !body,
|
|
67
|
+
created, noCreated: !created,
|
|
68
|
+
creator, noCreator: !creator,
|
|
69
|
+
creatorImage, noCreatorImage: !creatorImage,
|
|
70
|
+
isLoading: status === "loading", notLoading: status !== "loading",
|
|
71
|
+
isErrored: status === "error", notErrored: status !== "error",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The state for a latest-announcement response: an empty or missing announcement shows nothing, never a placeholder. */
|
|
76
|
+
export function announcementState(response: unknown): AnnouncementState {
|
|
77
|
+
const announcement = (response as LatestAnnouncementResponse | undefined)?.announcement;
|
|
78
|
+
if (!announcement || typeof announcement !== "object") return derive("ready");
|
|
79
|
+
// A DraftJS body shows as its plain text; a Ricos body keeps its rich document.
|
|
80
|
+
const draft = draftPlainText(announcement.content);
|
|
81
|
+
const rich = draft !== undefined ? { bodyJson: "", bodyText: draft } : richBody(announcement.content);
|
|
82
|
+
const when = typeof announcement.createdDate === "string" ? new Date(announcement.createdDate) : undefined;
|
|
83
|
+
const image = text(announcement.creatorMemberProfileData?.imageUrl);
|
|
84
|
+
return derive("ready", {
|
|
85
|
+
title: text(announcement.title),
|
|
86
|
+
bodyJson: rich.bodyJson, body: rich.bodyText,
|
|
87
|
+
created: when && !Number.isNaN(when.getTime()) ? formatDateMedium(when) : "",
|
|
88
|
+
creator: text(announcement.creatorMemberProfileData?.nickname),
|
|
89
|
+
// An avatar is shown only from an https URL.
|
|
90
|
+
creatorImage: /^https:\/\//i.test(image) ? image : "",
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** `options` is the generator's uniform second argument; the section has no settings of its own, so nothing is read from it. */
|
|
95
|
+
export function registerAnnouncementSection(serviceName: string, _options: object = {}) {
|
|
96
|
+
// The failure path reads the CURRENT state, not the snapshot the call began with: a refresh that fails after another load already
|
|
97
|
+
// showed an announcement must not erase it.
|
|
98
|
+
let current: () => AnnouncementState = () => derive("loading");
|
|
99
|
+
const handle = defineService<AnnouncementState, { load: (state: AnnouncementState) => Promise<AnnouncementState>; openLink: (state: AnnouncementState, arg?: unknown) => Promise<AnnouncementState> }>(serviceName, {
|
|
100
|
+
state: derive("loading"),
|
|
101
|
+
actions: {
|
|
102
|
+
load: async () => {
|
|
103
|
+
// A failed refresh (offline, a 5xx) keeps an announcement that is already showing: only a screen with nothing to show goes to error.
|
|
104
|
+
const failed = (): AnnouncementState => { const now = current(); return now.hasAnnouncement ? now : derive("error"); };
|
|
105
|
+
try {
|
|
106
|
+
const api = (globalThis as { himalaya?: { wixApi?: { call: (method: string, path: string) => Promise<unknown> } } }).himalaya?.wixApi;
|
|
107
|
+
if (!api) return failed();
|
|
108
|
+
return announcementState(await api.call("GET", LATEST_ANNOUNCEMENT_URL));
|
|
109
|
+
} catch {
|
|
110
|
+
return failed();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
// A link tapped inside the rich body: only http(s), mailto and tel links open (the shared rich-link rule).
|
|
114
|
+
openLink: async (state, arg) => {
|
|
115
|
+
await openRichLink(arg);
|
|
116
|
+
return state;
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
current = () => handle.getState() as AnnouncementState;
|
|
121
|
+
return handle;
|
|
122
|
+
}
|
|
@@ -94,6 +94,14 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jan 2026". */
|
|
98
|
+
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
+
if (hasIntl()) {
|
|
100
|
+
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
+
}
|
|
102
|
+
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
97
105
|
/** `{ month: "short", day: "numeric" }` — "Jan 5". */
|
|
98
106
|
export function formatMonthDay(date: Date, locale = appLocale(), timeZone?: string): string {
|
|
99
107
|
if (hasIntl()) {
|
|
@@ -94,6 +94,14 @@ export function formatDateMedium(date: Date, locale = appLocale(), timeZone?: st
|
|
|
94
94
|
return `${MONTHS_SHORT[date.getMonth()]} ${date.getDate()}, ${date.getFullYear()}`;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/** `{ month: "short", year: "numeric" }` — "Jan 2026". */
|
|
98
|
+
export function formatMonthYear(date: Date, locale = "en-US", timeZone?: string): string {
|
|
99
|
+
if (hasIntl()) {
|
|
100
|
+
return dateFormat(locale, { month: "short", year: "numeric" }, timeZone).format(date);
|
|
101
|
+
}
|
|
102
|
+
return `${MONTHS_SHORT[date.getMonth()]} ${date.getFullYear()}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
97
105
|
/** `{ month: "short", day: "numeric" }` — "Jan 5". */
|
|
98
106
|
export function formatMonthDay(date: Date, locale = appLocale(), timeZone?: string): string {
|
|
99
107
|
if (hasIntl()) {
|