@wix/himalaya-cli 0.1856.0 → 0.1857.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/stdlib/flows/auth/src/copy.generated.d.ts +20 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/feedback.d.ts +9 -0
  3. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/auth/src/index.d.ts +3 -0
  4. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +21 -0
  5. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/auth.mjs +53 -16
  6. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +94 -29
  7. package/dist/browser-plane/assets.json +5 -5
  8. package/dist/browser-plane/preview-deferred/{c1f008be31a41521c6de7c1afad419a1f4dad53cbc2701a14738d5b22f291463.bin → 7c8b32af7572e93ce52c2bc81b8d0bf5525f6e66531f934dac68d4507a6e3026.bin} +1 -1
  9. package/dist/browser-plane/sw.js +8 -8
  10. package/dist/cli.mjs +92 -48
  11. package/dist/preview-assets.generated.bin +0 -0
  12. package/guides/one-app-section-mappings.md +2 -2
  13. package/guides/one-app-to-himi-app.md +2 -2
  14. package/guides/recipe-auth.md +18 -1
  15. package/guides/sdk-reference.json +4 -4
  16. package/package.json +2 -2
  17. package/templates/beauty-salon/tier5-src/_shared/himi-media.ts +6 -2
  18. package/templates/branded-lite/tier5-src/_shared/himi-media.ts +6 -2
  19. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +46 -15
  20. package/templates/community-club/tier5-src/_shared/himi-media.ts +6 -2
  21. package/templates/events-meetups/tier5-src/_shared/himi-media.ts +6 -2
  22. package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +6 -2
  23. package/templates/gym-fitness/tier5-src/_shared/himi-media.ts +6 -2
  24. package/templates/nonprofit-cause/tier5-src/_shared/himi-media.ts +6 -2
  25. package/templates/podcast-creator/tier5-src/_shared/himi-media.ts +6 -2
  26. package/templates/portfolio-creative/tier5-src/_shared/himi-media.ts +6 -2
  27. package/templates/restaurant/tier5-src/_shared/himi-media.ts +6 -2
  28. package/templates/retail-store/tier5-src/_shared/himi-media.ts +6 -2
  29. package/templates/yoga-studio/tier5-src/_shared/himi-media.ts +6 -2
Binary file
@@ -79,8 +79,8 @@ The **Himalaya implementation** cell is blank for every unassigned row. Notes on
79
79
 
80
80
  | Source sectionDefinitionId | Source viewer component | Himalaya implementation | Placement / reuse | Class | Settings, actions and gaps |
81
81
  | --- | --- | --- | --- | --- | --- |
82
- | `achievements_list_section` | `wix-one-app-achievements.SectionMemberChallengesScreen` | [Programs list/detail](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/apps/himi-branded-lite/dev/index.ts) + [programs worker](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-branded-lite-programs/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + shared programs module (list layout) with the `programs-card`, `programs-filters` and `programs-see-all` recipes | Composed inline; member list and program detail reused | Partial | The migration generator composes the list inline: full-width cards (duration, participants and price follow `isDurationVisible`, `isParticipantsVisible`, `isPriceVisible`), the category chips and the "All programs / Programs I joined" control (hidden for a visitor; both hidden when `isFilterVisible` is false, each axis also follows `filterSettings.byCategory` / `byParticipantStatus`), the 2-card mode and "See all" to `himi_programs` only while more programs exist. The card count is the definition's `extraProps.limit` (2, verified in the Catalyst definitions file); an authored `extraProps.limit` or `settings.limit` wins, an infinite flag or a non-count limit shows the whole list, and a limit above 20 shows 20 and reports a gap. A page made only of this section gets a generated screen with the list inline (it is not routed to `himi_programs`). `himi_member_programs` (worker `himi-branded-lite-member-programs`) is the member list: each card carries the signed-in member's standing from Participants v3 / Join Applications v3 (Joined, Program complete, Program ended, Pending request, Request approved, Invited, Participation suspended), a progress bar once started, the price before joining, the same two filters, cursor paging and pull-to-refresh; an ended program the member never joined is dropped. The card opens `himi_program`, which enrols through Join Applications v3 (a free program confirms the participant, a private one sends a request for owner approval, an approved paid application goes to payment), shows the same standing, and offers Cancel request only while a request waits for approval. Still open: join / cancel-request actions on the card itself, a MANUAL order in the inline list (only the carousel reads it; the generator reports no gap for it), and Pricing Plans benefits ("Included in your plan"). |
83
- | `achievements_carousel_section` | `wix-one-app-achievements.MemberChallengesCarousel` | [Programs data/detail](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-branded-lite-programs/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + shared programs module (carousel layout) with the `programs-carousel` recipe | Composed inline | Partial | The migration generator composes the carousel inline: the section title (unless `showTitle` is false), one page of snapping cards with page dots, duration, participants and price per `isDurationVisible`, `isParticipantsVisible`, `isPriceVisible`, a MANUAL `sortingSettings.challengesOrder` that puts the selected programs first (it does not exclude the others), a retry when the read fails, and a card that opens `himi_program`. It shows 5 cards, the definition's `extraProps.limit`; an authored `extraProps.limit` or `settings.limit` wins, a non-count limit shows the most one page holds, and a limit above 20 shows 20 and reports a gap. The source carousel has no setting for its call to action (a collected app carries only the visibility flags, `sortingSettings` and `filterSettings`), so the "See All" button to `himi_programs` is always drawn under the cards, with the `programs-see-all` recipe; a scaffold without that recipe or without `himi_programs` reports a gap. Still open: the button is shown even when no more programs exist than the cards (the worker only clears its `noSeeAll` gate for an inline list). |
82
+ | `achievements_list_section` | `wix-one-app-achievements.SectionMemberChallengesScreen` | [Programs list/detail](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/apps/himi-branded-lite/dev/index.ts) + [programs worker](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-branded-lite-programs/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + shared programs module (list layout) with the `programs-card`, `programs-filters` and `programs-see-all` recipes | Composed inline; member list and program detail reused | Partial | The migration generator composes the list inline: full-width cards (duration, participants and price follow `isDurationVisible`, `isParticipantsVisible`, `isPriceVisible`), the category chips and the "All programs / Programs I joined" control (hidden for a visitor; both hidden when `isFilterVisible` is false, each axis also follows `filterSettings.byCategory` / `byParticipantStatus`), the 2-card mode and "See all" to `himi_programs` only while more programs exist. The card count is the definition's `extraProps.limit` (2, verified in the Catalyst definitions file); an authored `extraProps.limit` or `settings.limit` wins, an infinite flag or a non-count limit shows the whole list, and a limit above 20 shows 20 and reports a gap. A page made only of this section gets a generated screen with the list inline (it is not routed to `himi_programs`). `himi_member_programs` (worker `himi-branded-lite-member-programs`) is the member list: each card carries the signed-in member's standing from Participants v3 / Join Applications v3 (Joined, Program complete, Program ended, Pending request, Request approved, Invited, Participation suspended), a progress bar once started, the price before joining, the same two filters, cursor paging and pull-to-refresh; an ended program the member never joined is dropped. The card opens `himi_program`, which enrols through Join Applications v3 (a free program confirms the participant, a private one sends a request for owner approval, an approved paid application goes to payment), shows the same standing, and offers Cancel request only while a request waits for approval. Also read from the source: the section's chosen category (`categorySettings`) scopes the list, and a MANUAL `sortingSettings.challengesOrder` leads it (the other programs of the category follow; the category chips offer only the chosen categories, and none when one is chosen); a program's cover falls back to its video poster. Still open: join / cancel-request actions on the card itself, and Pricing Plans benefits ("Included in your plan"). |
83
+ | `achievements_carousel_section` | `wix-one-app-achievements.MemberChallengesCarousel` | [Programs data/detail](https://github.com/wix-private/himalaya/blob/97f1542f2f7d6e8cb7a902b912c87dcaa37e5a67/core/dev-server/tier5-bundles-src/himi-branded-lite-programs/index.ts "audience-lint-ok: optional pinned upstream evidence, not a local authoring dependency") + shared programs module (carousel layout) with the `programs-carousel` recipe | Composed inline | Partial | The migration generator composes the carousel inline: the section title (unless `showTitle` is false), one page of snapping cards with page dots, duration, participants and price per `isDurationVisible`, `isParticipantsVisible`, `isPriceVisible`, a MANUAL `sortingSettings.challengesOrder` that puts the selected programs first (the other programs of the category follow), scoped to the section's chosen category (`categorySettings`), a retry when the read fails, and a card that opens `himi_program`. It shows 5 cards, the definition's `extraProps.limit`; an authored `extraProps.limit` or `settings.limit` wins, a non-count limit shows the most one page holds, and a limit above 20 shows 20 and reports a gap. The source carousel has no setting for its call to action (a collected app carries only the visibility flags, `sortingSettings` and `filterSettings`), so the "See All" button to `himi_programs` is always drawn under the cards, with the `programs-see-all` recipe; a scaffold without that recipe or without `himi_programs` reports a gap. Still open: the button is shown even when no more programs exist than the cards (the worker only clears its `noSeeAll` gate for an inline list). |
84
84
  | `achievements_participant_carousel_section` | `wix-one-app-achievements.ParticipantChallengesCarousel` | Shared programs module (carousel layout, `participating`) with the `programs-participant-carousel` recipe | Composed inline | Partial | Signed-in only: hidden whole, title included, for a visitor, when the member has no programs, or when the read fails. The cards are the member's own programs with their progress (no price), and each opens `himi_program`. It shows 5 cards, the definition's `extraProps.limit`; an authored `extraProps.limit` or `settings.limit` is respected up to 20 cards (one read page). The "Programs I joined" CTA opens `himi_member_programs` and shows only with the section title, as in the source viewer. A scaffold without `himi_program` reports the section unsupported; one without `himi_member_programs` leaves out the CTA. Still open: a MANUAL selection/order is ignored, and a limit above 20 shows 20; the generator reports no gap for either. |
85
85
 
86
86
  For authored Programs sections, pass the source settings as a JSON string in the
@@ -178,8 +178,8 @@ The CLI's versioned native-widget inventory supplies these rows automatically.
178
178
  | `bookings_services_list_section` | Search, category and location filters; each card's dates (a course), price and an Ended badge for a past course. `himi_services` has all of them, so never hand-write a list: a page made only of this section opens that screen, and beside other sections the generator shows a short inline list (the first 6 services, each opening its service) with a See All to that screen when the scaffold ships the recipe, else the title and a See All link to it. |
179
179
  | `single_group_feed_section`, `groups_feed_section` | Post actions, attachments, comments/post destination, topic filter and the group's Members / Library / Rules / Media destinations. |
180
180
  | `platform_general_contact_section`, `platform_general_contact_section_bp` | Business address and map, respecting authored visibility and available coordinates. |
181
- | `achievements_list_section` | Category filter, including All Categories with no categories; actual visitor/member login, access/join/payment/Continue states; participants line; default limit 2 and See All when applicable. |
182
- | `achievements_carousel_section` | The same Program state/display rules, default limit 5 (an authored limit is read), page dots and See All to the programs screen. |
181
+ | `achievements_list_section` | Category filter, including All Categories with no categories; actual visitor/member login, access/join/payment/Continue states; participants line; default limit 2 and See All when applicable. The section's chosen category (`categorySettings`) scopes the list and a MANUAL order leads it, as in the source; a program's cover falls back to its video poster. |
182
+ | `achievements_carousel_section` | The same Program state/display rules, default limit 5 (an authored limit is read), page dots and See All to the programs screen. The chosen category scopes the carousel and a MANUAL order leads it. |
183
183
  | `newBlog_postlist_vertical_section`, `newBlog_compact_post_list_vertical_section` | Row display options, unlimited paging or a limited count with See All Posts, and layout. Coverage derives these per placement from the authored settings: see "Generate blog post lists from their settings". |
184
184
  | `events_list_section` | Date badge, Share and the appropriate RSVP/ticket action. |
185
185
  | `platform_elements_image_section` | Press behavior. `onPressType: "openAsModal"` opens the image full screen: tap it with the reserved `himi.lightbox` action and `args.images` set to `[{ "url": <the image url>, "alt": <its accessibility label> }]`. `nothing` and a `none` action need no tap. Coverage derives the row per placement from the authored value. |
@@ -55,7 +55,24 @@ Options (pass the same `service`, `register` and `copy` to **both**
55
55
  create-account button on the screen): `service` (must match the screen), `register` (default `true`), `copy`
56
56
  (every user-facing string: `signInTitle`, `registerTitle`, `subhead`,
57
57
  `emailLabel`, `passwordLabel`, `signInCta`, `registerCta`, `toRegisterCta`,
58
- `toSignInCta`, `signOutCta`, `signedInTitle`).
58
+ `toSignInCta`, `signOutCta`, `signedInTitle`, and the notices `signedInNotice`,
59
+ `signedOutNotice`, `signOutFailed`, `missingFields`).
60
+
61
+ **Localized copy.** Every field has a catalog key (`auth.gate.*` / `auth.flow.*`, with built-in
62
+ English defaults), and failure reasons use `auth.feedback.*`. An explicit
63
+ `copy` value wins; otherwise the string is the app catalog's entry, else the English default.
64
+ Where the catalog is read depends on where the string is built:
65
+
66
+ - **In the worker** (the headline, the submit and switch buttons, notices, failure reasons):
67
+ declare the `l10n` capability (`capabilities: ["wix_api", "l10n"]`, and pass
68
+ `capabilities: ["l10n"]` to `authScreen`). `createAuthService` then reads the catalog through
69
+ `@himalaya/l10n` with no further wiring. Or pass `text(key, fallback)` and `translate(key)` to
70
+ `createAuthService`. `translate` also works as `AuthOptions.translate` on `signInDirect` /
71
+ `registerMember` / `resetPassword`.
72
+ - **When the screen is built** (`emailLabel`, `passwordLabel`, `signOutCta`, and the default title):
73
+ `authScreen` runs outside the worker, so the `l10n` grant does not reach it. To localize these,
74
+ pass `text(key, fallback)` to `authScreen` as well, or set them in `copy`. Without either they
75
+ stay English.
59
76
 
60
77
  ## 2. The screen
61
78
 
@@ -449,7 +449,7 @@
449
449
  "name": "AuthOptions",
450
450
  "kind": "interface",
451
451
  "jsdoc": "",
452
- "decl": "export interface AuthOptions {\n /** Override when the host registered a non-default prefix. */\n prefix?: string;\n}",
452
+ "decl": "export interface AuthOptions {\n /** Override when the host registered a non-default prefix. */\n prefix?: string;\n /** Resolves a catalog key (`auth.feedback.*`) to the app's translation, or undefined/the key\n * when it has none. Defaults to `@himalaya/l10n` when the worker declared the `l10n` grant. */\n translate?: (key: string) => string | undefined;\n}",
453
453
  "verificationChecked": true
454
454
  },
455
455
  {
@@ -5576,14 +5576,14 @@
5576
5576
  "name": "AuthCopy",
5577
5577
  "kind": "interface",
5578
5578
  "jsdoc": "/** Every user-facing string on the auth screen. Override any subset. */",
5579
- "decl": "export interface AuthCopy {\n signInTitle?: string;\n registerTitle?: string;\n subhead?: string;\n emailLabel?: string;\n passwordLabel?: string;\n signInCta?: string;\n registerCta?: string;\n toRegisterCta?: string;\n toSignInCta?: string;\n signOutCta?: string;\n signedInTitle?: string;\n}",
5579
+ "decl": "export interface AuthCopy {\n signInTitle?: string;\n registerTitle?: string;\n subhead?: string;\n emailLabel?: string;\n passwordLabel?: string;\n signInCta?: string;\n registerCta?: string;\n toRegisterCta?: string;\n toSignInCta?: string;\n signOutCta?: string;\n signedInTitle?: string;\n /** Notice after a successful sign-in. */\n signedInNotice?: string;\n /** Notice after a sign-out. */\n signedOutNotice?: string;\n /** Notice when a sign-out left the session alive. */\n signOutFailed?: string;\n /** Notice when email or password is empty. */\n missingFields?: string;\n}",
5580
5580
  "verificationChecked": true
5581
5581
  },
5582
5582
  {
5583
5583
  "name": "AuthScreenOptions",
5584
5584
  "kind": "interface",
5585
5585
  "jsdoc": "",
5586
- "decl": "export interface AuthScreenOptions {\n /** Where the built worker bundle is served from. */\n bundleUrl: string;\n screenId?: string;\n /** Service name — must match `createAuthService({ service })`. */\n service?: string;\n title?: string;\n /** Offer \"create an account\" alongside sign-in. Default true. */\n register?: boolean;\n copy?: AuthCopy;\n /** Buttons shown once signed in, as { label, screenId } — e.g. back to the library. */\n next?: Array<{ label: string; screenId: string }>;\n}",
5586
+ "decl": "export interface AuthScreenOptions {\n /** Where the built worker bundle is served from. */\n bundleUrl: string;\n screenId?: string;\n /** Service name — must match `createAuthService({ service })`. */\n service?: string;\n title?: string;\n /** Offer \"create an account\" alongside sign-in. Default true. */\n register?: boolean;\n copy?: AuthCopy;\n /** Resolve copy from the app's catalog when the screen is built: `text(\"auth.gate.signIn\", fallback)`. */\n text?: AuthTextHook;\n /** Extra capabilities the worker needs, e.g. `[\"l10n\"]` so `createAuthService` can read the app\n * catalog through `@himalaya/l10n` (its default `translate` is silent without that grant). */\n capabilities?: string[];\n /** Buttons shown once signed in, as { label, screenId } — e.g. back to the library. */\n next?: Array<{ label: string; screenId: string }>;\n}",
5587
5587
  "verificationChecked": true
5588
5588
  },
5589
5589
  {
@@ -5597,7 +5597,7 @@
5597
5597
  "name": "AuthServiceOptions",
5598
5598
  "kind": "interface",
5599
5599
  "jsdoc": "",
5600
- "decl": "export interface AuthServiceOptions {\n /** Must match `authScreen({ service })`. */\n service?: string;\n register?: boolean;\n copy?: AuthCopy;\n}",
5600
+ "decl": "export interface AuthServiceOptions {\n /** Must match `authScreen({ service })`. */\n service?: string;\n register?: boolean;\n copy?: AuthCopy;\n /** Resolve copy from the app's catalog at action time: `text(\"auth.flow.signedInNotice\", fallback)`.\n * Defaults to the `@himalaya/l10n` bridge when the worker declared the `l10n` grant. */\n text?: AuthTextHook;\n /** Resolves a failure-reason key (`auth.feedback.*`); defaults to the same catalog. */\n translate?: (key: string) => string | undefined;\n}",
5601
5601
  "verificationChecked": true
5602
5602
  },
5603
5603
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1856.0",
3
+ "version": "0.1857.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": "aae1a6a474ecc62554c6730c48e5c20b0dff53a80abc3a3018bcefb9"
85
+ "falconPackageHash": "c1067947d8ef2872b5dd99d8bbaa6a99d988ad3c59d4f2dbb59bcbc4"
86
86
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -456,8 +456,10 @@ export interface ProgramsSectionOptions {
456
456
  showDuration?: boolean;
457
457
  showParticipants?: boolean;
458
458
  showPrice?: boolean;
459
- /** Program ids promoted to the front, in this order (source `sortingSettings.ordering === "MANUAL"`). */
459
+ /** Program ids promoted to the front, in this order (source `sortingSettings.ordering === "MANUAL"`). Within the section's categories, when it has any. */
460
460
  order?: string[];
461
+ /** The categories the source section is scoped to (`categorySettings`): only their programs are listed, and the category filter offers only them. Absent: every program. */
462
+ categoryIds?: string[];
461
463
  /** carousel: the member's own participations only (the One App participant carousel). Signed out, empty or failed reads show nothing. */
462
464
  participating?: boolean;
463
465
  /** list: hide a filter the source section turns off. */
@@ -467,6 +469,22 @@ export interface ProgramsSectionOptions {
467
469
  inlineLimit?: number;
468
470
  }
469
471
 
472
+ /** A page cursor of this section: the API's own cursor plus the programs the manual order promoted to the first page. The promoted set belongs to
473
+ * the read that produced the cursor, so it travels with it (never in state shared by overlapping reads of the same criteria). The encoding carries
474
+ * its own prefix: an opaque API cursor is never taken for it, whatever its shape. */
475
+ const CURSOR_TAG = "himi-programs-cursor:";
476
+ function wrapCursor(apiCursor: string, promoted: ReadonlySet<string>): string {
477
+ return apiCursor && promoted.size ? CURSOR_TAG + JSON.stringify({ c: apiCursor, p: [...promoted] }) : apiCursor;
478
+ }
479
+ function unwrapCursor(cursor: string): { api: string; promoted: string[] } {
480
+ if (!cursor.startsWith(CURSOR_TAG)) return { api: cursor, promoted: [] };
481
+ try {
482
+ const wrapped = JSON.parse(cursor.slice(CURSOR_TAG.length)) as { c?: unknown; p?: unknown };
483
+ if (typeof wrapped.c === "string") return { api: wrapped.c, promoted: Array.isArray(wrapped.p) ? wrapped.p.filter((id): id is string => typeof id === "string") : [] };
484
+ } catch { /* not ours after all */ }
485
+ return { api: cursor, promoted: [] };
486
+ }
487
+
470
488
  const CAROUSEL_LIMIT = 5;
471
489
  const ORDER_LIMIT = 100;
472
490
 
@@ -480,12 +498,14 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
480
498
  const inlineLimit = !carousel && options.inlineLimit !== undefined && options.inlineLimit > 0 ? Math.min(PAGE_SIZE, Math.floor(options.inlineLimit)) : 0;
481
499
  // A promoted program is read by id, so it would bypass the member's participations: the participant carousel has no manual order.
482
500
  const order = (options.participating ? [] : options.order ?? []).filter((id) => typeof id === "string" && id).slice(0, ORDER_LIMIT);
483
- /** The promoted programs, in their configured order. A failed read promotes nothing: the default order stands. */
484
- async function promotedPrograms(): Promise<WixProgram[]> {
485
- if (!order.length) return [];
501
+ /** The section's own categories: its programs are the only ones listed, and the category filter offers only these. */
502
+ const sectionCategories = (options.categoryIds ?? []).filter((id) => typeof id === "string" && id);
503
+ /** The promoted programs, in their configured order, among those the section lists (`scope`: its status, category and, for the joined view, participation filter). A failed read promotes nothing: the default order stands. */
504
+ async function promotedPrograms(scope: Record<string, unknown>, ids: string[]): Promise<WixProgram[]> {
505
+ if (!ids.length) return [];
486
506
  try {
487
- const response = await queryPrograms({ filter: { id: { $in: order }, status: { $in: ["PUBLISHED", "ENDED"] } }, cursorPaging: { limit: order.length } });
488
- const rank = new Map(order.map((id, index) => [id, index]));
507
+ const response = await queryPrograms({ filter: { ...scope, id: { $in: ids } }, cursorPaging: { limit: ids.length } });
508
+ const rank = new Map(ids.map((id, index) => [id, index]));
489
509
  return (response.programs ?? []).filter((p) => rank.has(p.id)).sort((a, b) => (rank.get(a.id) ?? 0) - (rank.get(b.id) ?? 0));
490
510
  } catch { return []; }
491
511
  }
@@ -494,7 +514,7 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
494
514
  async function loadCategories(): Promise<void> {
495
515
  try {
496
516
  const response = await listProgramCategories();
497
- categories = (response.categories ?? []).filter((c) => c.id && c.label);
517
+ categories = (response.categories ?? []).filter((c) => c.id && c.label && (!sectionCategories.length || sectionCategories.includes(c.id)));
498
518
  categoriesFailed = false;
499
519
  // A picked category the site no longer has would keep the query filtered behind a hidden control.
500
520
  if (categoryId && !categories.some((c) => c.id === categoryId)) categoryId = "";
@@ -513,7 +533,6 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
513
533
  let statusFilter: "all" | "joined" = options.participating ? "joined" : "all";
514
534
  let categoryId = "";
515
535
  let pageScope: Scope | undefined;
516
-
517
536
  async function fetchPage(filter: string, cursor: string): Promise<CollectionPage<ProgramContent>> {
518
537
  const scope = await resolveScope();
519
538
  if (cursor && (!pageScope || !sameScope(pageScope, scope))) throw memberAccessChanged();
@@ -525,15 +544,27 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
525
544
  const category = picked && categories && !categories.some((c) => c.id === picked) ? "" : picked;
526
545
  const { map: participations, complete: participationsKnown } = await participationsFor(scope, !cursor, status === "joined");
527
546
  const programFilter: Record<string, unknown> = { status: { $in: ["PUBLISHED", "ENDED"] } };
528
- if (category) programFilter.categoryIds = { $hasSome: [category] };
547
+ // A picked chip is one of the section's own categories (the chips offer no others), so it narrows the section's scope.
548
+ const scopedCategories = category ? [category] : sectionCategories;
549
+ if (scopedCategories.length) programFilter.categoryIds = { $hasSome: scopedCategories };
529
550
  if (status === "joined") {
530
551
  if (!participations.size) return { items: [], nextCursor: "", metadata };
531
552
  programFilter.id = { $in: [...participations.keys()] };
532
553
  }
533
554
  // A page whose every program is dropped (ended and never joined) would leave the list hidden with
534
555
  // nothing on screen to call loadMore, so read on until a page has rows or the catalog ends.
535
- let pageCursor = cursor;
536
- const promoted = carousel && !cursor ? await promotedPrograms() : [];
556
+ // The API cursor, and the programs the manual order promoted to the first page: the cursor carries them (`wrapCursor`), so the pages after
557
+ // the first skip exactly what the read that produced them promoted, whatever other reads of the same criteria are still in flight.
558
+ const carried = unwrapCursor(cursor);
559
+ let pageCursor = carried.api;
560
+ let promotedFirst: WixProgram[] = [];
561
+ const promotedIds = new Set<string>(carried.promoted);
562
+ // The first page leads with the manual order (a carousel or an inline list shows nothing but that page). The joined view promotes the ordered
563
+ // programs the member joined: the participant query already holds only those.
564
+ if (!cursor) {
565
+ promotedFirst = await promotedPrograms(programFilter, status === "joined" ? order.filter((id) => participations.has(id)) : order);
566
+ for (const p of promotedFirst) promotedIds.add(p.id);
567
+ }
537
568
  for (let read = 0; ; read++) {
538
569
  // A cursor page carries only the cursor — it already encodes the filter and sort — as the
539
570
  // participants query of the same service does.
@@ -542,8 +573,7 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
542
573
  : { filter: programFilter, sort: [{ fieldName: "createdDate", order: "DESC" }], cursorPaging: { limit: PAGE_SIZE } });
543
574
  const after = await resolveScope();
544
575
  if (!sameScope(scope, after)) throw memberAccessChanged();
545
- const promotedIds = new Set(promoted.map((p) => p.id));
546
- const visible = [...promoted, ...(response.programs ?? []).filter((p) => !promotedIds.has(p.id))].filter((p) => p.id && !isDraft(p))
576
+ const visible = [...promotedFirst, ...(response.programs ?? []).filter((p) => !promotedIds.has(p.id))].filter((p) => p.id && !isDraft(p))
547
577
  // An ended program the member never joined is not theirs to see (the One App's visibility rule) —
548
578
  // applied only when the member's participations are known, so a degraded read hides nothing they joined.
549
579
  .filter((p) => !isEnded(p) || participations.has(p.id) || !participationsKnown);
@@ -569,7 +599,7 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
569
599
  // A revalidating load publishes nothing until it settles, so page 1 records the scope its later pages
570
600
  // are read under here, not only from the published snapshot.
571
601
  if (!cursor) pageScope = scope;
572
- return { items, nextCursor, metadata };
602
+ return { items, nextCursor: wrapCursor(nextCursor, promotedIds), metadata };
573
603
  }
574
604
  }
575
605
  /** How many all-dropped pages one fetch reads, in all, before it ends the list. */
@@ -647,7 +677,8 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
647
677
  // filter switch or a refresh reloads, so the control never flickers away under the finger.
648
678
  hideStatusFilter: options.filters?.status === false || (!member && statusFilter !== "joined"),
649
679
  categoryId, categoryChips,
650
- hideCategoryFilter: options.filters?.category === false || categoriesFailed || !categories || categories.length === 0,
680
+ // One category chosen in the section is the whole list: choosing among one is not a filter.
681
+ hideCategoryFilter: options.filters?.category === false || categoriesFailed || !categories || categories.length === 0 || sectionCategories.length === 1,
651
682
  // See all only for an inline (limited) list that has programs past the cards it shows.
652
683
  noSeeAll: !(inlineLimit && status === "ready" && meta.more === true),
653
684
  hidePriceRetry: status !== "ready" || !views.some((view) => view && view.route !== "disabled" && (scopeIncomplete || view.retryable)),
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }
@@ -24,6 +24,10 @@ export function programImage(program: WixProgram, size: WixImageSize = WIX_LIST_
24
24
  const cover = (program as { coverImage?: unknown }).coverImage;
25
25
  const coverUrl = typeof cover === "string" ? cover : (cover as { url?: unknown } | undefined)?.url;
26
26
  const description = (program as { description?: unknown }).description;
27
- const nested = description && typeof description === "object" ? (description as { image?: { url?: unknown; id?: unknown } }).image : undefined;
28
- return firstImage([coverUrl, program.image, nested?.url, nested?.id], size);
27
+ const block = description && typeof description === "object" ? description as { image?: { url?: unknown; id?: unknown }; video?: { posters?: Array<{ url?: unknown }> } } : undefined;
28
+ const nested = block?.image;
29
+ // A program whose description has a video and no image is covered by the video's poster (the source's cover); `seo.imageUrl` is that same cover as the site publishes it.
30
+ const poster = block?.video?.posters?.find((candidate) => typeof candidate?.url === "string" && candidate.url)?.url;
31
+ const published = (program as { seo?: { imageUrl?: unknown } }).seo?.imageUrl;
32
+ return firstImage([coverUrl, program.image, nested?.url, nested?.id, poster, published], size);
29
33
  }