@wix/himalaya-cli 0.1744.0 → 0.1746.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +7 -3
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +21 -0
  4. package/dist/browser-plane/assets.json +5 -5
  5. package/dist/browser-plane/preview-deferred/{b583b2879dbf6318c5d5bc0aaca78a34b84f76b51a8f79dc824e05521f2a5a7a.bin → d432d189310d8d819b56251c53dd82a9e166a4a73936749f08c355c11083e8e0.bin} +1 -1
  6. package/dist/browser-plane/sw.js +5 -5
  7. package/dist/cli.mjs +808 -421
  8. package/dist/preview-assets.generated.bin +0 -0
  9. package/guides/android-ux.md +1 -1
  10. package/guides/designing-himi-screens.md +23 -14
  11. package/guides/headless-loop.md +1 -1
  12. package/guides/ios-ux.md +1 -1
  13. package/guides/one-app-section-mappings.md +1 -1
  14. package/guides/one-app-to-himi-app.md +19 -1
  15. package/package.json +2 -2
  16. package/templates/beauty-salon/tier5-src/_shared/himi-account.ts +37 -8
  17. package/templates/branded-lite/tier5-src/_shared/himi-account.ts +37 -8
  18. package/templates/community-club/tier5-src/_shared/himi-account.ts +37 -8
  19. package/templates/conference/tier5-src/_shared/himi-account.ts +37 -8
  20. package/templates/events-meetups/tier5-src/_shared/himi-account.ts +37 -8
  21. package/templates/gym-fitness/tier5-src/_shared/himi-account.ts +37 -8
  22. package/templates/nonprofit-cause/tier5-src/_shared/himi-account.ts +37 -8
  23. package/templates/podcast-creator/tier5-src/_shared/himi-account.ts +37 -8
  24. package/templates/portfolio-creative/tier5-src/_shared/himi-account.ts +37 -8
  25. package/templates/restaurant/tier5-src/_shared/himi-account.ts +37 -8
  26. package/templates/retail-store/tier5-src/_shared/himi-account.ts +37 -8
  27. package/templates/salon-spa/tier5-src/_shared/himi-account.ts +37 -8
  28. package/templates/wholesale-store/tier5-src/_shared/himi-account.ts +37 -8
  29. package/templates/yoga-studio/tier5-src/_shared/himi-account.ts +37 -8
Binary file
@@ -46,7 +46,7 @@ A list or a grid looks the same in the iPhone PNG. That is one descriptor, not a
46
46
  | Destructive or blocking decision | A dialog that names the action. | `AlertDialog`; confirm or offer undo. | [Dialogs](https://m3.material.io/components/dialogs/guidelines) |
47
47
  | Success | A snackbar above the navigation bar. | `ui.snackbar` from the worker. | [Snackbar](https://m3.material.io/components/snackbar/guidelines) |
48
48
  | Search | A search bar in the top app bar, or a dedicated search screen. | `topBar.searchable` plus the page's own `SearchField` (or the row that holds it) with `hiddenPath: "$env:topBarSearch"`. The standard app shell draws that field; only a host with a native search handler hides it for the bar. A dedicated screen when search starts a new task (`himi docs recipe-search`). | [Search](https://m3.material.io/components/search/guidelines) |
49
- | Tablets, foldables, wide windows | List and detail side by side from the expanded width class (840dp and wider); a readable column for reading. | `SplitView`, `Grid` `columnsMedium`/`columnsExpanded`, `contentMaxWidth`. Render at 840px or wider and record the choice. | [Adaptive layouts](https://developer.android.com/design/ui/mobile/guides/layout-and-content/adapt-layout) |
49
+ | Tablets, foldables, wide windows | List and detail side by side from the expanded width class (840dp and wider); a readable column for reading. | `Grid` `columns: 1, columnsMedium: 2` to put parts side by side from 600dp (a tablet in portrait); `SplitView` only from 840dp. The tablet shell does not apply `contentMaxWidth`, so the screen changes shape itself (`designing-himi-screens`). Render at 834px and 840px or wider, and record the choice. | [Adaptive layouts](https://developer.android.com/design/ui/mobile/guides/layout-and-content/adapt-layout) |
50
50
  | Type and shape | The Material type scale and shape scale, following the user's font size. | Typography tokens from the built-in ramp, no raw sizes; a `material` overlay in `tokens.json` `idiom` with `"$system"` (Roboto) and Material radii, turned on by `idiom: { policy: "follow-surface" }` in `config.ts`. | [Typography](https://m3.material.io/styles/typography/applying-type) |
51
51
  | Touch targets | At least 48×48dp. | Use `Button`/`ListItem`; do not shrink a hit area. | [Accessibility](https://developer.android.com/design/ui/mobile/guides/foundations/accessibility) |
52
52
  | Edge to edge | Content draws under the system bars; nothing important sits behind them. | The shell applies the insets; keep the last row clear of `stickyFooter`. | [Edge-to-edge](https://developer.android.com/design/ui/mobile/guides/layout-and-content/edge-to-edge) |
@@ -60,23 +60,32 @@ they decide what a phone screen looks like, and this guide decides how to compos
60
60
  - **Every tap target is at least 44 points** (48 dp on Android). A `Button` grows its own hit area;
61
61
  an `Icon`, an `Image` or a stack with `modifiers.onTap` does not, so give it `padding` until it
62
62
  reaches 44, or use an `iconOnly` `Button` (`himi validate` warns: `touch_target_too_small`).
63
- - **A wide surface gets its own layout, not the phone one stretched.** From the medium width
64
- (600 points: an iPad in portrait) and the expanded one (840: an iPad in landscape, a Mac window,
65
- the web at desktop width), each kind of screen changes shape:
63
+ - **A wide surface gets its own layout, not the phone one stretched.** Do not count on the host
64
+ to narrow the screen: a tablet shows it full bleed at every width, and a `splitView` goes side
65
+ by side from 600 points on iOS but only from 840 on Android and the web, so an Android tablet in
66
+ portrait (and the web below 840) still shows it stacked. From the medium width (600 points: an
67
+ iPad or an Android tablet in portrait), each kind of screen changes shape itself:
66
68
  - Photo tiles add columns (`columnsMedium: 3`, `columnsExpanded: 4`).
67
- - Rows (a schedule, a menu, a session list) stay one readable column, or become
69
+ - A short, bounded set of rows (a day's schedule, a menu, a few sessions) becomes
68
70
  `grid({ columns: 1, columnsMedium: 2 })` of the same rows. A grid fills across each row, so
69
- keep the items in reading order (by time) and they still read in order.
71
+ keep the items in reading order (by time) and they still read in order. A long or paged list
72
+ stays a `lazyList` at the scroll root: on Android a grid inside the screen's scroll is not
73
+ lazy, so every row is built at once.
70
74
  - A shelf has more covers than fit at the widest width (eight or more), so its rail never
71
75
  ends halfway across the screen. With fewer, it is a grid row instead.
72
- - A detail screen puts its photos and its information side by side:
73
- `splitView({ primary: photos, detail: info })`, which stacks on a phone.
74
-
75
- The readable column is the `contentMaxWidth` token. On expanded widths the shell centres the
76
- screen in it (920 points by default). Never cap the root stack with `maxWidth`: it pins
77
- the column to the leading edge and leaves the rest empty. Render `--device tablet` and
78
- `--device desktop` and look for a half of the screen with nothing in it. Space below a short
79
- list is fine.
76
+ - A detail screen puts its photos and its information side by side with
77
+ `grid({ columns: 1, columnsMedium: 2, items: [photos, info] })`, which stacks on a phone and
78
+ splits from 600 on every platform.
79
+ - A short, bounded screen (a cart, a form, sign-in, settings) splits its parts with the same
80
+ grid: the items beside the order summary, the fields beside the explanation or the art, one
81
+ settings section beside the next. Do not centre a capped column with spacers or a centre
82
+ alignment: the renderers do not agree on either, so it centres on one platform and not on
83
+ another. A long or paged list (a chat list, a feed) stays the scroll root (see Fast screens
84
+ below), with its rows at full width.
85
+
86
+ Render `--device tablet` (834 points) and `--device desktop` and look for a half of the screen
87
+ with nothing in it, or a row whose price sits a screen's width from its name. Space below
88
+ a short list is fine.
80
89
 
81
90
  ---
82
91
 
@@ -416,7 +425,7 @@ Concrete patterns lifted from real usage:
416
425
  - **Photo tile** — `vstack({ spacing: 6, alignment: "leading", children: [ image({ url, fillWidth: true, aspectRatio: 0.8, contentMode: "fill", placeholder: "surfaceSecondary", contentDescription }) + cornerRadius 8, text(name, "body"), text(price, "callout", { color: "textSecondary" }) ] })` with `modifiers.onTap` on the stack, inside `grid({ columns: 2, columnsMedium: 3, columnsExpanded: 4, spacing: 12 })`. A shelf is the same tile at a fixed `width` (about 110) in `lazyList({ horizontal: true, spacing: 12 })`.
417
426
  - **A website page with native UI around it** — `vstack({ children: [ header, sitePage(site, { path: "/book-online" }), stickyBar ] })`, where `site` is the app's `site` block (a `SiteShellConfig`) and `sitePage` comes from `@wix/himalaya/sdui`. It emits a `WebView` with `role: "primary"`, `fill`, its own scrolling, `modifiers.weight: 1` and the site preset as its config (the same URL and behaviour a site-shell tab gets; `webView: { … }` overrides it). `title` becomes the page's accessible name (`modifiers.accessibilityLabel`, which every `WebView` needs); without one the site's host is used. The weight gives the page only the height the header and bar leave. Put it at the screen root or directly in a root `VStack`, `HStack` or `ZStack`, and use one per screen. The validator rejects it inside a `LazyList`, `Pager`, `Carousel` or `CollapsingHeader`, or with its weight removed. A site-shell app already gets this form: `siteScreens(site)` gives each page both forms in one descriptor, the Tier-3 screen every app binary renders plus this tree in `payload`, which a newer binary draws instead. To put native UI around one page of a site-shell app and keep it working on older binaries, use `dualFormSiteScreen(defineSiteTab(site, page), vstack({ children: [ header, sitePage(site, { path: page.path, title: page.title }), stickyBar ] }))`. The page inside must load the same URL, with the same config and the same native capability scope (`capabilitiesRequired`), as the Tier-3 screen; `sitePage` scopes a page to no capability, as a site tab is. The validator checks all three (`dual_form_mismatch`), and the screen can carry no `logicBundle`. Older binaries draw only the Tier-3 page, without the header and bar. `siteScreens(site, { form: "node" })` serves the node form alone, for an app whose binaries all support it, and `desugarSiteScreen(descriptor)` converts one Tier-3 site screen. To let native UI follow the page (a cart badge, the page title), give the screen a `logicBundle` that declares `"webview"` and write `sitePage(site, { path, bridge: "worker" })`: the page talks to the worker through `@wix/himalaya/webview-page`, and the worker answers with `@himalaya/webview` ([webview-page-sdk.md](webview-page-sdk.md#a-site-page-that-talks-to-its-screens-worker)). Such a screen carries a worker, so it is a node-form screen (`sdui_layout`), not a dual-form one.
418
427
  - **Overlay** — `zstack({ alignment: "center", children: [ backdropImage(cornerRadius 12), withModifiers(label, { padding, background: { token: "accentPrimary" }, cornerRadius: 10 }) ] })`.
419
- - **Responsive** — `grid({ columns: 1, columnsMedium: 2, spacing: 12 })` for wide cards, 1-up on phone / 2-up on tablet (photo tiles start at 2 on a phone); `splitView({ primary, detail, primaryMaxWidth: 280 })` for master/detail that stacks on a phone; set `contentMaxWidth` in tokens so wide surfaces keep a readable column instead of running edge-to-edge.
428
+ - **Responsive** — `grid({ columns: 1, columnsMedium: 2, spacing: 12 })` for wide cards, 1-up on phone / 2-up on tablet (photo tiles start at 2 on a phone); `splitView({ primary, detail, primaryMaxWidth: 280 })` for master/detail (side by side from 600 points on iOS, from 840 on Android and the web); `contentMaxWidth` in tokens sets the measure only on the web host and in `himi render`; the native Mac window caps content at 920 points whatever it says, and a tablet applies no cap, so a tablet still needs the layout changes above.
420
429
  - **Centered separator, not a flanked divider** — the classic "—— or ——" needs each `divider()` to take equal remaining width, and the HStack row-share only kicks in for controls with an intrinsic fill. **A bare `divider()` inside an HStack is a column separator, not a flanking line**: iOS, macOS, Android, web and React Native all draw it as a thin vertical rule the height of the row that takes no share of the width, which is right for a stats row (`12 | 340 | 87`) and wrong for "—— or ——". For "—— or ——", use a **centered caption**: `hstack({ children: [spacer(), text("or continue with", "caption", { color: "textSecondary" }), spacer()] })`, optionally over a single full-width `divider()`.
421
430
 
422
431
  > **Intrinsic-fill controls grab the row.** `Button` and `TextField` have an intrinsic FILL, so the next four idioms are about NOT letting that surprise you (they were the papercuts every off-repo app hit):
@@ -237,7 +237,7 @@ A few flags worth knowing up front (all discoverable via `himi render --help`):
237
237
  which over-stretches a phone layout.
238
238
  - **`himi icons`** lists the valid `Icon.name` vocabulary — an unknown name silently falls back to a
239
239
  generic glyph on device (and `validate` warns), so pick from this list rather than guessing SF-Symbol
240
- names. The full set (aliases included): ai, arrow_down, arrow_left, arrow_right, arrow_up, back, bag, bag_fill, barcode, bell, bell_fill, bell_off, bell_slash, book, bookmark, bookmark_fill, boxes, branch, calendar, camera, cart, cart_fill, chart, chat, check, checklist, checkmark, chevron_down, chevron_left, chevron_right, chevron_up, circle, circle_fill, clock, close, concealed, cookie, copy, dashboard, doc, document, download, edit, ellipsis, error, expand, external_link, eye, eye_slash, filter, folder, forward, fullscreen, gear, gift, globe, grid, grid_fill, grip, heart, heart_fill, help, home, home_fill, house, image, inbox, info, layers, link, list, location, lock, logout, mail, map, menu, message, mic, mic_fill, microphone, microphone_fill, minus, moon, more, more_vertical, music, newspaper, newspaper_fill, next, paper_plane, pause, pencil, people, person, person_fill, phone, photo, pin, play, play_circle, play_circle_fill, plus, plus_circle, plus_circle_fill, prev, question, refresh, repeat, rss, search, send, send_arrow, settings, settings_fill, share, shuffle, skip_back, skip_forward, skip_next, skip_previous, star, star_fill, stop, success, tag, ticket, ticket_fill, trash, tray, undo, user, visible, volume, warning, wifi, xmark.
240
+ names. The full set (aliases included): ai, arrow_down, arrow_left, arrow_right, arrow_up, back, bag, bag_fill, barcode, bell, bell_fill, bell_off, bell_slash, book, bookmark, bookmark_fill, boxes, branch, calendar, camera, cart, cart_fill, chart, chat, check, checklist, checkmark, chevron_down, chevron_left, chevron_right, chevron_up, circle, circle_fill, clock, close, concealed, cookie, copy, dashboard, doc, document, download, edit, ellipsis, error, expand, external_link, eye, eye_slash, filter, folder, forward, fullscreen, gear, gift, globe, grid, grid_fill, grip, heart, heart_fill, help, home, home_fill, house, image, inbox, info, layers, link, list, location, lock, logout, mail, map, menu, message, mic, mic_fill, microphone, microphone_fill, minus, moon, more, more_vertical, music, newspaper, newspaper_fill, next, paper_plane, pause, pencil, people, person, person_fill, phone, photo, pin, play, play_circle, play_circle_fill, plus, plus_circle, plus_circle_fill, prev, question, redo, refresh, repeat, rss, search, send, send_arrow, settings, settings_fill, share, shuffle, skip_back, skip_forward, skip_next, skip_previous, star, star_fill, stop, success, tag, ticket, ticket_fill, trash, tray, undo, user, visible, volume, warning, wifi, xmark.
241
241
 
242
242
  ## 4b. Prove it WORKS, not just that it renders (`himi test`, when installed)
243
243
 
package/guides/ios-ux.md CHANGED
@@ -45,7 +45,7 @@ Android PNG. That is one descriptor, not a failed render.
45
45
  | Destructive or blocking decision | An alert, with the destructive button styled as such. | `AlertDialog`, or a `ToolbarItem` with `role: "destructive"`. Confirm or offer undo. | [Alerts](https://developer.apple.com/design/human-interface-guidelines/alerts) |
46
46
  | Success | Brief, non-blocking feedback. | `ui.snackbar` from the worker, not an alert. | [Feedback](https://developer.apple.com/design/human-interface-guidelines/feedback) |
47
47
  | Search | A search field in the navigation bar. | `topBar.searchable` plus the page's own `SearchField` (or the row that holds it) with `hiddenPath: "$env:topBarSearch"`. The standard app shell draws that field; only a host with a native search handler hides it for the bar. A dedicated search screen when search starts a new task (`himi docs recipe-search`). | [Search fields](https://developer.apple.com/design/human-interface-guidelines/search-fields) |
48
- | iPad and wide windows | Sidebar or split view for collections; a readable column for reading. | `SplitView`, `Grid` `columnsMedium`/`columnsExpanded`, `contentMaxWidth` in tokens. Render at 834px and record the choice. | [Split views](https://developer.apple.com/design/human-interface-guidelines/split-views) |
48
+ | iPad and wide windows | Sidebar or split view for collections; a readable column for reading. | `Grid` `columns: 1, columnsMedium: 2` to put parts side by side from 600 points; `SplitView` (side by side from 600 on iOS). The iPad shell does not apply `contentMaxWidth`, so the screen changes shape itself (`designing-himi-screens`). Render at 834px and record the choice. | [Split views](https://developer.apple.com/design/human-interface-guidelines/split-views) |
49
49
  | Type | The system text styles, scaled by Dynamic Type. | Typography tokens from the built-in ramp: `largeTitle`, `title1`–`title3`, `headline`, `body`, `bodyEmphasis`, `callout`, `caption`, `footnote`. No raw sizes. | [Typography](https://developer.apple.com/design/human-interface-guidelines/typography) |
50
50
  | Touch targets | At least 44×44 points. | Use `Button`/`ListItem`; do not shrink an icon's hit area below that. | [Accessibility](https://developer.apple.com/design/human-interface-guidelines/accessibility) |
51
51
 
@@ -441,6 +441,6 @@ procedure (`himi docs one-app-to-himi-app`, "Probe an unmapped section") and rec
441
441
 
442
442
  | Source sectionDefinitionId | Seen in | Status and leads |
443
443
  | --- | --- | --- |
444
- | `forum_post_list_section` | A 2026-11 Branded migration | Unmapped. A single-section page can point at the Forum template screen; an inline post list needs an app-local section over the Forum posts read. |
444
+ | `forum_post_list_section` | A 2026-11 Branded migration | Retired. `generate` skips Forum sections as reported gaps and omits a page/tab containing only Forum. Never route to `himi_forum`. Keep explicit Wix Groups sections; this collection does not verify Forum-to-Groups migration or prove that Groups are absent. |
445
445
  | `shared_gallery_list_section` | A 2026-11 Branded migration | Unmapped and left unresolved in that migration. Do not substitute Pro Gallery or Photo Albums without verifying the source data contract. |
446
446
  | `woa_member_restaurants_reservation` | A 2026-11 Branded migration | Unmapped. That migration adapted it to a "Reserve a Table" button that opens the template reservation screen; record it as an adaptation, not as the source section. |
@@ -212,7 +212,13 @@ such setting (a chosen plan or group list, a question or post count, a category,
212
212
  text). Record each as an `adapted` row in the coverage ledger; never leave it unsaid. A scaffold without the screen reports
213
213
  the section as unmapped, and `apply-navigation` keeps refusing it. A link that passes a collection opens the shop screen
214
214
  instead of selecting its tab, so the collection arrives; the shop screen then carries no collection of its own.
215
- Forum, `performance_tracker_section` and `platform_general_upcoming_section` have no screen and stay unmapped.
215
+ Wix Forum is retired: `generate` skips `forum_*` sections as reported gaps, never routes to `himi_forum`, and
216
+ omits pages/tabs containing only those sections (including from More). `apply-navigation` accepts those explicitly
217
+ recorded omissions; other pages without a screen still fail. A mixed page keeps its remaining sections. Explicit Groups
218
+ sections remain: One App collection does not read Groups, so it cannot claim there are none or verify a Forum-to-Groups
219
+ migration. When site analysis is available, follow its `legacyForum` decision: keep real Groups when found, drop an empty
220
+ Groups tab only on a confirmed `none`, and treat failed or absent reads as `unknown`.
221
+ `performance_tracker_section` and `platform_general_upcoming_section` have no screen and stay unmapped.
216
222
 
217
223
  ### Preserve section visibility across authentication
218
224
 
@@ -1377,6 +1383,18 @@ published `revision` and `fetchedAt` of the evidence it read, so a migration gen
1377
1383
  old value: run `himi one-app migrate` again to refresh it before the final check. The file it writes is the
1378
1384
  `--upsert` input below.
1379
1385
 
1386
+ `generate` also writes the starter keep-list to the `## Screen catalogue` table of `SPEC.md` (created from the scaffold's
1387
+ template when the package has none), so `himi template trim --from-spec SPEC.md --links drop` keeps exactly what the migrated app
1388
+ uses. The rows are every generated screen (`more` included), the starter screens its pages and generated buttons open (and the
1389
+ detail screens of the shared modules a generated page worker registers), the account core (account, settings, sign-in, delete
1390
+ account, app info, appearance, language), the screens of the header controls the source has (notifications, cart, the business
1391
+ chat, or the Inbox instead when the manifest says `memberChat: true`) and `source_invite` when the source shows Invite, plus the
1392
+ starter screens those (and the rows already in the table) need, found by asking the trim planner itself: a link `--links drop` cannot remove, and the target of a
1393
+ kept screen's main action (a shop's product and cart, a service list's booking time), and the destinations the worker of a kept
1394
+ starter screen opens at runtime, one hop (the shop's product, the Inbox's chat thread). Links of the sample Home the starter still
1395
+ holds are not counted, since `generate` replaces it. Rows already in the table are never changed or removed: the ones you wrote get the same closure, runtime destinations included, as
1396
+ the ones `generate` computes, and a second run adds nothing. The output reports them under `starterKeepList`.
1397
+
1380
1398
  So generate descriptors as data and write them with the CLI:
1381
1399
 
1382
1400
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1744.0",
3
+ "version": "0.1746.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": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "02e3afe5b6763220607f861e8e278c78fc6d67ac27d0dc6f16042ac2"
85
+ "falconPackageHash": "aa411acc3838b9849dc7d56f136ab42ca83217810f260c443f97cae0"
86
86
  }
@@ -124,24 +124,53 @@ export function guestProfile(detailLine: string): AccountProfile {
124
124
  };
125
125
  }
126
126
 
127
- export async function signedInEmail(): Promise<string> {
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
128
132
  try {
129
133
  const identity = await dispatch("himi.wix.memberIdentity") as unknown;
130
- const direct = identity as { email?: unknown } | null;
131
- const wrapped = identity as { payload?: { email?: unknown } } | null;
132
- const email = direct?.email ?? wrapped?.payload?.email;
133
- return typeof email === "string" ? email : "";
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
134
140
  } catch {
135
- return "";
141
+ return { email: "", signedIn: false };
136
142
  }
137
143
  }
138
144
 
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
139
166
  export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
140
167
  // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
141
168
  // getMyData can still return a site/account nickname (e.g. apptestercoowner)
142
169
  // after sign-out or for anonymous — never treat that as a signed-in member.
143
- const storedEmail = await signedInEmail();
144
- if (!storedEmail) return guestProfile(guestDetailLine);
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
145
174
  try {
146
175
  const data = await getMyData();
147
176
  return profileFromData(data, storedEmail);
@@ -124,24 +124,53 @@ export function guestProfile(detailLine: string): AccountProfile {
124
124
  };
125
125
  }
126
126
 
127
- export async function signedInEmail(): Promise<string> {
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
128
132
  try {
129
133
  const identity = await dispatch("himi.wix.memberIdentity") as unknown;
130
- const direct = identity as { email?: unknown } | null;
131
- const wrapped = identity as { payload?: { email?: unknown } } | null;
132
- const email = direct?.email ?? wrapped?.payload?.email;
133
- return typeof email === "string" ? email : "";
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
134
140
  } catch {
135
- return "";
141
+ return { email: "", signedIn: false };
136
142
  }
137
143
  }
138
144
 
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
139
166
  export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
140
167
  // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
141
168
  // getMyData can still return a site/account nickname (e.g. apptestercoowner)
142
169
  // after sign-out or for anonymous — never treat that as a signed-in member.
143
- const storedEmail = await signedInEmail();
144
- if (!storedEmail) return guestProfile(guestDetailLine);
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
145
174
  try {
146
175
  const data = await getMyData();
147
176
  return profileFromData(data, storedEmail);
@@ -124,24 +124,53 @@ export function guestProfile(detailLine: string): AccountProfile {
124
124
  };
125
125
  }
126
126
 
127
- export async function signedInEmail(): Promise<string> {
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
128
132
  try {
129
133
  const identity = await dispatch("himi.wix.memberIdentity") as unknown;
130
- const direct = identity as { email?: unknown } | null;
131
- const wrapped = identity as { payload?: { email?: unknown } } | null;
132
- const email = direct?.email ?? wrapped?.payload?.email;
133
- return typeof email === "string" ? email : "";
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
134
140
  } catch {
135
- return "";
141
+ return { email: "", signedIn: false };
136
142
  }
137
143
  }
138
144
 
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
139
166
  export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
140
167
  // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
141
168
  // getMyData can still return a site/account nickname (e.g. apptestercoowner)
142
169
  // after sign-out or for anonymous — never treat that as a signed-in member.
143
- const storedEmail = await signedInEmail();
144
- if (!storedEmail) return guestProfile(guestDetailLine);
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
145
174
  try {
146
175
  const data = await getMyData();
147
176
  return profileFromData(data, storedEmail);
@@ -124,24 +124,53 @@ export function guestProfile(detailLine: string): AccountProfile {
124
124
  };
125
125
  }
126
126
 
127
- export async function signedInEmail(): Promise<string> {
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
128
132
  try {
129
133
  const identity = await dispatch("himi.wix.memberIdentity") as unknown;
130
- const direct = identity as { email?: unknown } | null;
131
- const wrapped = identity as { payload?: { email?: unknown } } | null;
132
- const email = direct?.email ?? wrapped?.payload?.email;
133
- return typeof email === "string" ? email : "";
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
134
140
  } catch {
135
- return "";
141
+ return { email: "", signedIn: false };
136
142
  }
137
143
  }
138
144
 
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
139
166
  export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
140
167
  // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
141
168
  // getMyData can still return a site/account nickname (e.g. apptestercoowner)
142
169
  // after sign-out or for anonymous — never treat that as a signed-in member.
143
- const storedEmail = await signedInEmail();
144
- if (!storedEmail) return guestProfile(guestDetailLine);
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
145
174
  try {
146
175
  const data = await getMyData();
147
176
  return profileFromData(data, storedEmail);
@@ -124,24 +124,53 @@ export function guestProfile(detailLine: string): AccountProfile {
124
124
  };
125
125
  }
126
126
 
127
- export async function signedInEmail(): Promise<string> {
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
128
132
  try {
129
133
  const identity = await dispatch("himi.wix.memberIdentity") as unknown;
130
- const direct = identity as { email?: unknown } | null;
131
- const wrapped = identity as { payload?: { email?: unknown } } | null;
132
- const email = direct?.email ?? wrapped?.payload?.email;
133
- return typeof email === "string" ? email : "";
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
134
140
  } catch {
135
- return "";
141
+ return { email: "", signedIn: false };
136
142
  }
137
143
  }
138
144
 
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
139
166
  export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
140
167
  // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
141
168
  // getMyData can still return a site/account nickname (e.g. apptestercoowner)
142
169
  // after sign-out or for anonymous — never treat that as a signed-in member.
143
- const storedEmail = await signedInEmail();
144
- if (!storedEmail) return guestProfile(guestDetailLine);
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
145
174
  try {
146
175
  const data = await getMyData();
147
176
  return profileFromData(data, storedEmail);
@@ -124,24 +124,53 @@ export function guestProfile(detailLine: string): AccountProfile {
124
124
  };
125
125
  }
126
126
 
127
- export async function signedInEmail(): Promise<string> {
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
128
132
  try {
129
133
  const identity = await dispatch("himi.wix.memberIdentity") as unknown;
130
- const direct = identity as { email?: unknown } | null;
131
- const wrapped = identity as { payload?: { email?: unknown } } | null;
132
- const email = direct?.email ?? wrapped?.payload?.email;
133
- return typeof email === "string" ? email : "";
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
134
140
  } catch {
135
- return "";
141
+ return { email: "", signedIn: false };
136
142
  }
137
143
  }
138
144
 
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
139
166
  export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
140
167
  // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
141
168
  // getMyData can still return a site/account nickname (e.g. apptestercoowner)
142
169
  // after sign-out or for anonymous — never treat that as a signed-in member.
143
- const storedEmail = await signedInEmail();
144
- if (!storedEmail) return guestProfile(guestDetailLine);
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
145
174
  try {
146
175
  const data = await getMyData();
147
176
  return profileFromData(data, storedEmail);
@@ -124,24 +124,53 @@ export function guestProfile(detailLine: string): AccountProfile {
124
124
  };
125
125
  }
126
126
 
127
- export async function signedInEmail(): Promise<string> {
127
+ /** `himi.wix.memberIdentity`: the member's email ("" when none is known) and whether a member is
128
+ * signed in. `signedIn` is true only when the host says so explicitly — native hosts answer it
129
+ * for a member whose email is not known yet (an injected or hosted session before `members/my`
130
+ * answers); hosts that predate it answer the email alone. */
131
+ export async function memberIdentity(): Promise<{ email: string; signedIn: boolean }> {
128
132
  try {
129
133
  const identity = await dispatch("himi.wix.memberIdentity") as unknown;
130
- const direct = identity as { email?: unknown } | null;
131
- const wrapped = identity as { payload?: { email?: unknown } } | null;
132
- const email = direct?.email ?? wrapped?.payload?.email;
133
- return typeof email === "string" ? email : "";
134
+ const direct = identity as { email?: unknown; signedIn?: unknown } | null;
135
+ const wrapped = identity as { payload?: { email?: unknown; signedIn?: unknown } } | null;
136
+ const raw = direct?.email ?? wrapped?.payload?.email;
137
+ const email = typeof raw === "string" ? raw : "";
138
+ const signedIn = (direct?.signedIn ?? wrapped?.payload?.signedIn) === true;
139
+ return { email, signedIn: signedIn || !!email };
134
140
  } catch {
135
- return "";
141
+ return { email: "", signedIn: false };
136
142
  }
137
143
  }
138
144
 
145
+ export async function signedInEmail(): Promise<string> {
146
+ return (await memberIdentity()).email;
147
+ }
148
+
149
+ /** A signed-in member nothing names yet: signed in, with a neutral label rather than another
150
+ * member's name or the sign-in form. */
151
+ function neutralMemberProfile(): AccountProfile {
152
+ const name = copyParam("account.member", "Member");
153
+ return {
154
+ isMember: true,
155
+ identityLine: copyParam("account.signedIn", "Signed in"),
156
+ detailLine: name,
157
+ memberName: name,
158
+ memberEmail: "",
159
+ memberImage: "",
160
+ memberInitials: "M",
161
+ hasMemberImage: false,
162
+ noMemberImage: true,
163
+ };
164
+ }
165
+
139
166
  export async function loadMemberProfile(guestDetailLine: string): Promise<AccountProfile> {
140
167
  // `himi.wix.memberIdentity` is the session source of truth. Visitor-scoped
141
168
  // getMyData can still return a site/account nickname (e.g. apptestercoowner)
142
169
  // after sign-out or for anonymous — never treat that as a signed-in member.
143
- const storedEmail = await signedInEmail();
144
- if (!storedEmail) return guestProfile(guestDetailLine);
170
+ const identity = await memberIdentity();
171
+ if (!identity.signedIn) return guestProfile(guestDetailLine);
172
+ const storedEmail = identity.email;
173
+ if (!storedEmail) return (await siteMemberProfile("")) ?? neutralMemberProfile();
145
174
  try {
146
175
  const data = await getMyData();
147
176
  return profileFromData(data, storedEmail);