@wix/himalaya-cli 0.1752.0 → 0.1753.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 (46) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +10 -0
  2. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +105 -0
  3. package/dist/cli.mjs +43 -9
  4. package/guides/one-app-section-mappings.md +1 -1
  5. package/guides/wix-business-context.md +15 -1
  6. package/package.json +2 -2
  7. package/templates/beauty-salon/recipes/programs-filters.json +94 -0
  8. package/templates/beauty-salon/recipes/programs-see-all.json +43 -0
  9. package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +19 -7
  10. package/templates/beauty-salon/tier5-src/himi-branded-lite-order/index.ts +7 -2
  11. package/templates/branded-lite/recipes/programs-filters.json +94 -0
  12. package/templates/branded-lite/recipes/programs-see-all.json +43 -0
  13. package/templates/branded-lite/tier5-src/_shared/programs-section.ts +19 -7
  14. package/templates/branded-lite/tier5-src/himi-branded-lite-inbox/index.ts +10 -1
  15. package/templates/branded-lite/tier5-src/himi-branded-lite-order/index.ts +7 -2
  16. package/templates/community-club/recipes/programs-filters.json +94 -0
  17. package/templates/community-club/recipes/programs-see-all.json +43 -0
  18. package/templates/community-club/tier5-src/_shared/programs-section.ts +19 -7
  19. package/templates/events-meetups/recipes/programs-filters.json +94 -0
  20. package/templates/events-meetups/recipes/programs-see-all.json +43 -0
  21. package/templates/events-meetups/tier5-src/_shared/programs-section.ts +19 -7
  22. package/templates/gym-fitness/recipes/programs-filters.json +94 -0
  23. package/templates/gym-fitness/recipes/programs-see-all.json +43 -0
  24. package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +19 -7
  25. package/templates/gym-fitness/tier5-src/himi-branded-lite-order/index.ts +7 -2
  26. package/templates/nonprofit-cause/recipes/programs-filters.json +94 -0
  27. package/templates/nonprofit-cause/recipes/programs-see-all.json +43 -0
  28. package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +19 -7
  29. package/templates/podcast-creator/recipes/programs-filters.json +94 -0
  30. package/templates/podcast-creator/recipes/programs-see-all.json +43 -0
  31. package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +19 -7
  32. package/templates/portfolio-creative/recipes/programs-filters.json +94 -0
  33. package/templates/portfolio-creative/recipes/programs-see-all.json +43 -0
  34. package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +19 -7
  35. package/templates/portfolio-creative/tier5-src/himi-branded-lite-order/index.ts +7 -2
  36. package/templates/restaurant/recipes/programs-filters.json +94 -0
  37. package/templates/restaurant/recipes/programs-see-all.json +43 -0
  38. package/templates/restaurant/tier5-src/_shared/programs-section.ts +19 -7
  39. package/templates/retail-store/recipes/programs-filters.json +94 -0
  40. package/templates/retail-store/recipes/programs-see-all.json +43 -0
  41. package/templates/retail-store/tier5-src/_shared/programs-section.ts +19 -7
  42. package/templates/retail-store/tier5-src/himi-branded-lite-order/index.ts +7 -2
  43. package/templates/wholesale-store/tier5-src/himi-branded-lite-order/index.ts +7 -2
  44. package/templates/yoga-studio/recipes/programs-filters.json +94 -0
  45. package/templates/yoga-studio/recipes/programs-see-all.json +43 -0
  46. package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +19 -7
@@ -0,0 +1,94 @@
1
+ {
2
+ "_recipe": "The programs list's two filters: the participant-status segmented control (All programs / Programs I joined; hidden for a guest) and the category chips (All categories first; hidden when the site has no categories). Service: registerProgramsSection(svc,{layout:'list'}); the worker owns the options and hides a control the source turns off (options.filters). Also the list's empty line (a category or the joined filter with no programs), hidden while there are cards.",
3
+ "_placeholders": {
4
+ "svc": "service name the page worker registered with registerProgramsSection",
5
+ "id": "unique node id prefix (e.g. the screen id)",
6
+ "statusLabel": "accessibility label of the status control",
7
+ "categoryLabel": "accessibility label of the category chips",
8
+ "allProgramsLabel": "fallback label of the first status option",
9
+ "joinedLabel": "fallback label of the second status option",
10
+ "allCategoriesLabel": "fallback label of the first category chip"
11
+ },
12
+ "node": {
13
+ "id": "{{id}}.filters",
14
+ "body": {
15
+ "package": "himalaya",
16
+ "type": "VStack",
17
+ "props": {
18
+ "spacing": 10,
19
+ "alignment": "leading",
20
+ "children": [
21
+ {
22
+ "id": "{{id}}.status_filter",
23
+ "body": {
24
+ "package": "himalaya",
25
+ "type": "SegmentedControl",
26
+ "props": {
27
+ "options": [
28
+ {
29
+ "id": "all",
30
+ "label": "{{allProgramsLabel}}"
31
+ },
32
+ {
33
+ "id": "joined",
34
+ "label": "{{joinedLabel}}"
35
+ }
36
+ ],
37
+ "optionsPath": "$service:{{svc}}.statusOptions",
38
+ "selectedId": "$service:{{svc}}.statusFilter",
39
+ "onChange": {
40
+ "actionId": "tier5.{{svc}}.setStatus"
41
+ }
42
+ }
43
+ },
44
+ "modifiers": {
45
+ "accessibilityLabel": "{{statusLabel}}",
46
+ "hiddenPath": "$service:{{svc}}.hideStatusFilter"
47
+ }
48
+ },
49
+ {
50
+ "id": "{{id}}.category_filter",
51
+ "body": {
52
+ "package": "himalaya",
53
+ "type": "FilterChips",
54
+ "props": {
55
+ "chips": [
56
+ {
57
+ "id": "",
58
+ "label": "{{allCategoriesLabel}}"
59
+ }
60
+ ],
61
+ "optionsPath": "$service:{{svc}}.categoryChips",
62
+ "selectedIds": [
63
+ "$service:{{svc}}.categoryId"
64
+ ],
65
+ "onChange": {
66
+ "actionId": "tier5.{{svc}}.setCategory"
67
+ }
68
+ }
69
+ },
70
+ "modifiers": {
71
+ "accessibilityLabel": "{{categoryLabel}}",
72
+ "hiddenPath": "$service:{{svc}}.hideCategoryFilter"
73
+ }
74
+ },
75
+ {
76
+ "id": "{{id}}.empty",
77
+ "body": {
78
+ "package": "himalaya",
79
+ "type": "Text",
80
+ "props": {
81
+ "text": "$service:{{svc}}.emptyText",
82
+ "style": "body",
83
+ "color": "textSecondary"
84
+ }
85
+ },
86
+ "modifiers": {
87
+ "hiddenPath": "$service:{{svc}}.noEmpty"
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "_recipe": "See all button for an INLINE programs list (a limited number of cards); shown only while more programs exist than the cards show. Omit when the scaffold has no himi_programs screen.",
3
+ "_placeholders": {
4
+ "svc": "service name registered with registerProgramsSection (inlineLimit set)",
5
+ "id": "unique node id prefix for this section",
6
+ "seeAllLabel": "button title",
7
+ "seeAllScreen": "screen id the button opens, himi_programs"
8
+ },
9
+ "node": {
10
+ "id": "{{id}}.seeall",
11
+ "body": {
12
+ "package": "himalaya",
13
+ "type": "VStack",
14
+ "props": {
15
+ "spacing": 0,
16
+ "alignment": "leading",
17
+ "children": [
18
+ {
19
+ "id": "{{id}}.seeall.button",
20
+ "body": {
21
+ "package": "himalaya",
22
+ "type": "Button",
23
+ "props": {
24
+ "title": "{{seeAllLabel}}",
25
+ "style": "secondary",
26
+ "size": "md",
27
+ "fullWidth": true,
28
+ "action": {
29
+ "actionId": "himi.open",
30
+ "params": { "screenId": "{{seeAllScreen}}" }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ]
36
+ }
37
+ },
38
+ "modifiers": {
39
+ "padding": { "leading": 0, "trailing": 0, "top": 8, "bottom": 8 },
40
+ "hiddenPath": "$service:{{svc}}.noSeeAll"
41
+ }
42
+ }
43
+ }
@@ -113,6 +113,7 @@ export interface State {
113
113
  categoryId: string;
114
114
  categoryChips: Option[];
115
115
  hideCategoryFilter: boolean;
116
+ noSeeAll: boolean;
116
117
  hidePriceRetry: boolean;
117
118
  priceRetryText: string;
118
119
  summary: string;
@@ -339,7 +340,7 @@ function programContent(o: { program: WixProgram; participant?: WixParticipant;
339
340
  // ── Reads ────────────────────────────────────────────────────────────────────
340
341
 
341
342
  interface Scope { email: string; memberId: string; scope: string }
342
- interface PageMeta extends Record<string, unknown> { email: string; memberId: string; scope: string; needsSignIn: boolean; joinedFilter: boolean }
343
+ interface PageMeta extends Record<string, unknown> { email: string; memberId: string; scope: string; needsSignIn: boolean; joinedFilter: boolean; more?: boolean }
343
344
 
344
345
  type Participations = Map<string, WixParticipant>;
345
346
  /** The member's participations for this scope — walked once per first page, reused by its later pages. */
@@ -457,6 +458,9 @@ export interface ProgramsSectionOptions {
457
458
  order?: string[];
458
459
  /** list: hide a filter the source section turns off. */
459
460
  filters?: { status?: boolean; category?: boolean };
461
+ /** list: the section's inline mode: show this many cards, no paging, and offer See all while more programs exist
462
+ * (the source's `extraProps.limit`). Absent: the list follows the cursor to the last program. */
463
+ inlineLimit?: number;
460
464
  }
461
465
 
462
466
  const CAROUSEL_LIMIT = 5;
@@ -469,6 +473,7 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
469
473
  const display: Display = { card: carousel, duration: options.showDuration !== false, participants: options.showParticipants !== false };
470
474
  const showPrice = options.showPrice !== false;
471
475
  const limit = Math.min(PAGE_SIZE, Math.max(1, Math.floor(options.limit ?? CAROUSEL_LIMIT)));
476
+ const inlineLimit = !carousel && options.inlineLimit !== undefined && options.inlineLimit > 0 ? Math.min(PAGE_SIZE, Math.floor(options.inlineLimit)) : 0;
472
477
  const order = (options.order ?? []).filter((id) => typeof id === "string" && id).slice(0, ORDER_LIMIT);
473
478
  /** The promoted programs, in their configured order. A failed read promotes nothing: the default order stands. */
474
479
  async function promotedPrograms(): Promise<WixProgram[]> {
@@ -537,13 +542,18 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
537
542
  // An ended program the member never joined is not theirs to see (the One App's visibility rule) —
538
543
  // applied only when the member's participations are known, so a degraded read hides nothing they joined.
539
544
  .filter((p) => !isEnded(p) || participations.has(p.id) || !participationsKnown);
540
- const programs = carousel ? visible.slice(0, limit) : visible;
545
+ const programs = carousel ? visible.slice(0, limit) : inlineLimit ? visible.slice(0, inlineLimit) : visible;
541
546
  const pagingMetadata = response.pagingMetadata as { hasNext?: boolean; cursors?: { next?: string | null } } | undefined;
542
547
  // A last page may still carry a cursor: `hasNext: false` wins, as in the catalog bundle.
543
- const nextCursor = carousel ? "" : pagingMetadata?.hasNext === false ? "" : pagingMetadata?.cursors?.next ?? "";
544
- if (!carousel && pagingMetadata?.hasNext && !nextCursor) throw new Error("Programs response is missing its next-page cursor");
545
- if (!programs.length && nextCursor && nextCursor !== pageCursor) {
546
- if (read + 1 < MAX_EMPTY_READS) { pageCursor = nextCursor; continue; }
548
+ const readCursor = carousel ? "" : pagingMetadata?.hasNext === false ? "" : pagingMetadata?.cursors?.next ?? "";
549
+ // An inline list never hands a cursor to the screen, but it still reads on past a page that held nothing to show.
550
+ const nextCursor = inlineLimit ? "" : readCursor;
551
+ if (!carousel && !inlineLimit && pagingMetadata?.hasNext && !nextCursor) throw new Error("Programs response is missing its next-page cursor");
552
+ // An inline list reads one page and says whether programs remain past what it shows: that is the See all.
553
+ const pageMore = visible.length > inlineLimit || pagingMetadata?.hasNext === true || !!readCursor;
554
+ if (inlineLimit) metadata.more = pageMore;
555
+ if (!programs.length && readCursor && readCursor !== pageCursor) {
556
+ if (read + 1 < MAX_EMPTY_READS) { pageCursor = readCursor; continue; }
547
557
  // Past the cap, end the list rather than hand back an empty page with a cursor nothing can load.
548
558
  return { items: [], nextCursor: "", metadata };
549
559
  }
@@ -570,7 +580,7 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
570
580
  status: "loading", rows: [], isLoading: true, notLoading: false, isErrored: false, notErrored: true, noEmpty: true, hideList: true,
571
581
  emptyText: "", errorText: "", identityLine: "", needsSignIn: false, noSignIn: true, nextCursor: "", noMore: true, noPageError: true, loadingMore: false,
572
582
  statusFilter: "all", statusOptions: [], hideStatusFilter: true, categoryId: "", categoryChips: [], hideCategoryFilter: true,
573
- hidePriceRetry: true, priceRetryText: "", summary: "", hasRows: false, noRows: true,
583
+ noSeeAll: true, hidePriceRetry: true, priceRetryText: "", summary: "", hasRows: false, noRows: true,
574
584
  };
575
585
 
576
586
  /** A row shows a price when the section does and the member is not in or past the program. */
@@ -631,6 +641,8 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
631
641
  hideStatusFilter: options.filters?.status === false || (!member && statusFilter !== "joined"),
632
642
  categoryId, categoryChips,
633
643
  hideCategoryFilter: options.filters?.category === false || categoriesFailed || !categories || categories.length === 0,
644
+ // See all only for an inline (limited) list that has programs past the cards it shows.
645
+ noSeeAll: !(inlineLimit && status === "ready" && meta.more === true),
634
646
  hidePriceRetry: status !== "ready" || !views.some((view) => view && view.route !== "disabled" && (scopeIncomplete || view.retryable)),
635
647
  priceRetryText: copyParam("memberPrograms.priceRetryText", "Some prices could not be loaded."),
636
648
  // The rows loaded so far are not the catalog: a count is only true once the last page is in.
@@ -40,6 +40,10 @@ const COPY: LoadCopy<Row> = {
40
40
  sample: () => MOCK.map((r) => ({ ...r })),
41
41
  };
42
42
 
43
+ /** Where the business's conversation opens. The host may name another served screen (`businessScreenId` in the
44
+ * load params): a site shell, which has no business chat screen, opens it as a thread. */
45
+ let businessScreenId = "himi_business_chat";
46
+
43
47
  const signInRequired = () => new Error("Unauthenticated: sign in to see your messages");
44
48
 
45
49
  async function listAllRooms(): Promise<unknown[]> {
@@ -63,10 +67,15 @@ const svc = defineService<S, { load: (s: S, arg?: unknown) => Promise<S> }>("him
63
67
  // The screen's onAppear carries the copy pack (Hebrew, an owner's wording). This service is not a collection, so
64
68
  // nothing else stashes it; a retry sends no params and keeps the pack already stashed.
65
69
  stashCopy(arg);
70
+ const target = (arg as { businessScreenId?: unknown } | undefined)?.businessScreenId;
71
+ if (typeof target === "string" && /^[a-z0-9_]+$/.test(target)) businessScreenId = target;
66
72
  try {
67
73
  const member = await memberAccess();
68
74
  if (!member.email) throw signInRequired();
69
- const rows = inboxRows(await listAllRooms(), copyParam("inbox.conversationFallback", "Conversation")).map(({ at: _at, ...row }) => row);
75
+ const rows = inboxRows(await listAllRooms(), copyParam("inbox.conversationFallback", "Conversation"))
76
+ .map(({ at: _at, ...row }) => row.screenId === "himi_business_chat" && businessScreenId !== row.screenId
77
+ ? { ...row, screenId: businessScreenId as Row["screenId"], kind: businessScreenId === "himi_chat_thread" ? "chatroom" : row.kind }
78
+ : row);
70
79
  // A sign-out or account switch while the list loaded must not paint the previous member's rooms.
71
80
  await assertMemberAccess(member);
72
81
  return { ...s, ...loaded("conversations", rows, COPY) };
@@ -391,15 +391,20 @@ const svc = defineService<State, {
391
391
  // survives a failed load, and registering from there would subscribe to a record
392
392
  // this member's ownership was never established for — which `findOwnedOrder` and
393
393
  // `assertOrderMember` exist to establish.
394
- follow: (state) => {
394
+ // `scheme`: the host app's own URL scheme (a site shell serving this screen registers its customer's,
395
+ // not Branded Lite's), so the activity's tap returns to the app that started it. Absent or malformed:
396
+ // Branded Lite's.
397
+ follow: (state, arg?: unknown) => {
395
398
  if (state.liveTracking || !state.id || state.hideContent) return undefined;
399
+ const requested = (arg as { scheme?: unknown } | undefined)?.scheme;
400
+ const scheme = typeof requested === "string" && /^[a-z][a-z0-9+.-]*$/i.test(requested) ? requested : "himalaya-himi-branded-lite";
396
401
  liveSession = beginLiveSession({
397
402
  activityType: "member_order",
398
403
  entityType: "order",
399
404
  entityId: state.id,
400
405
  headline: state.title || copyParam("order.followHeadline", "Your order"),
401
406
  detail: [state.fulfillmentStatus, state.total].filter(Boolean).join(" · "),
402
- deepLink: `himalaya-himi-branded-lite://screen/himi_order?id=${encodeURIComponent(state.id)}`,
407
+ deepLink: `${scheme}://screen/himi_order?id=${encodeURIComponent(state.id)}`,
403
408
  ttlSeconds: FOLLOW_TTL_SECONDS,
404
409
  startingNote: copyParam("order.followStarting", "Starting…"),
405
410
  unavailableNote: copyParam("order.followUnavailable", "This device has no live surface."),
@@ -0,0 +1,94 @@
1
+ {
2
+ "_recipe": "The programs list's two filters: the participant-status segmented control (All programs / Programs I joined; hidden for a guest) and the category chips (All categories first; hidden when the site has no categories). Service: registerProgramsSection(svc,{layout:'list'}); the worker owns the options and hides a control the source turns off (options.filters). Also the list's empty line (a category or the joined filter with no programs), hidden while there are cards.",
3
+ "_placeholders": {
4
+ "svc": "service name the page worker registered with registerProgramsSection",
5
+ "id": "unique node id prefix (e.g. the screen id)",
6
+ "statusLabel": "accessibility label of the status control",
7
+ "categoryLabel": "accessibility label of the category chips",
8
+ "allProgramsLabel": "fallback label of the first status option",
9
+ "joinedLabel": "fallback label of the second status option",
10
+ "allCategoriesLabel": "fallback label of the first category chip"
11
+ },
12
+ "node": {
13
+ "id": "{{id}}.filters",
14
+ "body": {
15
+ "package": "himalaya",
16
+ "type": "VStack",
17
+ "props": {
18
+ "spacing": 10,
19
+ "alignment": "leading",
20
+ "children": [
21
+ {
22
+ "id": "{{id}}.status_filter",
23
+ "body": {
24
+ "package": "himalaya",
25
+ "type": "SegmentedControl",
26
+ "props": {
27
+ "options": [
28
+ {
29
+ "id": "all",
30
+ "label": "{{allProgramsLabel}}"
31
+ },
32
+ {
33
+ "id": "joined",
34
+ "label": "{{joinedLabel}}"
35
+ }
36
+ ],
37
+ "optionsPath": "$service:{{svc}}.statusOptions",
38
+ "selectedId": "$service:{{svc}}.statusFilter",
39
+ "onChange": {
40
+ "actionId": "tier5.{{svc}}.setStatus"
41
+ }
42
+ }
43
+ },
44
+ "modifiers": {
45
+ "accessibilityLabel": "{{statusLabel}}",
46
+ "hiddenPath": "$service:{{svc}}.hideStatusFilter"
47
+ }
48
+ },
49
+ {
50
+ "id": "{{id}}.category_filter",
51
+ "body": {
52
+ "package": "himalaya",
53
+ "type": "FilterChips",
54
+ "props": {
55
+ "chips": [
56
+ {
57
+ "id": "",
58
+ "label": "{{allCategoriesLabel}}"
59
+ }
60
+ ],
61
+ "optionsPath": "$service:{{svc}}.categoryChips",
62
+ "selectedIds": [
63
+ "$service:{{svc}}.categoryId"
64
+ ],
65
+ "onChange": {
66
+ "actionId": "tier5.{{svc}}.setCategory"
67
+ }
68
+ }
69
+ },
70
+ "modifiers": {
71
+ "accessibilityLabel": "{{categoryLabel}}",
72
+ "hiddenPath": "$service:{{svc}}.hideCategoryFilter"
73
+ }
74
+ },
75
+ {
76
+ "id": "{{id}}.empty",
77
+ "body": {
78
+ "package": "himalaya",
79
+ "type": "Text",
80
+ "props": {
81
+ "text": "$service:{{svc}}.emptyText",
82
+ "style": "body",
83
+ "color": "textSecondary"
84
+ }
85
+ },
86
+ "modifiers": {
87
+ "hiddenPath": "$service:{{svc}}.noEmpty"
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "_recipe": "See all button for an INLINE programs list (a limited number of cards); shown only while more programs exist than the cards show. Omit when the scaffold has no himi_programs screen.",
3
+ "_placeholders": {
4
+ "svc": "service name registered with registerProgramsSection (inlineLimit set)",
5
+ "id": "unique node id prefix for this section",
6
+ "seeAllLabel": "button title",
7
+ "seeAllScreen": "screen id the button opens, himi_programs"
8
+ },
9
+ "node": {
10
+ "id": "{{id}}.seeall",
11
+ "body": {
12
+ "package": "himalaya",
13
+ "type": "VStack",
14
+ "props": {
15
+ "spacing": 0,
16
+ "alignment": "leading",
17
+ "children": [
18
+ {
19
+ "id": "{{id}}.seeall.button",
20
+ "body": {
21
+ "package": "himalaya",
22
+ "type": "Button",
23
+ "props": {
24
+ "title": "{{seeAllLabel}}",
25
+ "style": "secondary",
26
+ "size": "md",
27
+ "fullWidth": true,
28
+ "action": {
29
+ "actionId": "himi.open",
30
+ "params": { "screenId": "{{seeAllScreen}}" }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ]
36
+ }
37
+ },
38
+ "modifiers": {
39
+ "padding": { "leading": 0, "trailing": 0, "top": 8, "bottom": 8 },
40
+ "hiddenPath": "$service:{{svc}}.noSeeAll"
41
+ }
42
+ }
43
+ }
@@ -113,6 +113,7 @@ export interface State {
113
113
  categoryId: string;
114
114
  categoryChips: Option[];
115
115
  hideCategoryFilter: boolean;
116
+ noSeeAll: boolean;
116
117
  hidePriceRetry: boolean;
117
118
  priceRetryText: string;
118
119
  summary: string;
@@ -339,7 +340,7 @@ function programContent(o: { program: WixProgram; participant?: WixParticipant;
339
340
  // ── Reads ────────────────────────────────────────────────────────────────────
340
341
 
341
342
  interface Scope { email: string; memberId: string; scope: string }
342
- interface PageMeta extends Record<string, unknown> { email: string; memberId: string; scope: string; needsSignIn: boolean; joinedFilter: boolean }
343
+ interface PageMeta extends Record<string, unknown> { email: string; memberId: string; scope: string; needsSignIn: boolean; joinedFilter: boolean; more?: boolean }
343
344
 
344
345
  type Participations = Map<string, WixParticipant>;
345
346
  /** The member's participations for this scope — walked once per first page, reused by its later pages. */
@@ -457,6 +458,9 @@ export interface ProgramsSectionOptions {
457
458
  order?: string[];
458
459
  /** list: hide a filter the source section turns off. */
459
460
  filters?: { status?: boolean; category?: boolean };
461
+ /** list: the section's inline mode: show this many cards, no paging, and offer See all while more programs exist
462
+ * (the source's `extraProps.limit`). Absent: the list follows the cursor to the last program. */
463
+ inlineLimit?: number;
460
464
  }
461
465
 
462
466
  const CAROUSEL_LIMIT = 5;
@@ -469,6 +473,7 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
469
473
  const display: Display = { card: carousel, duration: options.showDuration !== false, participants: options.showParticipants !== false };
470
474
  const showPrice = options.showPrice !== false;
471
475
  const limit = Math.min(PAGE_SIZE, Math.max(1, Math.floor(options.limit ?? CAROUSEL_LIMIT)));
476
+ const inlineLimit = !carousel && options.inlineLimit !== undefined && options.inlineLimit > 0 ? Math.min(PAGE_SIZE, Math.floor(options.inlineLimit)) : 0;
472
477
  const order = (options.order ?? []).filter((id) => typeof id === "string" && id).slice(0, ORDER_LIMIT);
473
478
  /** The promoted programs, in their configured order. A failed read promotes nothing: the default order stands. */
474
479
  async function promotedPrograms(): Promise<WixProgram[]> {
@@ -537,13 +542,18 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
537
542
  // An ended program the member never joined is not theirs to see (the One App's visibility rule) —
538
543
  // applied only when the member's participations are known, so a degraded read hides nothing they joined.
539
544
  .filter((p) => !isEnded(p) || participations.has(p.id) || !participationsKnown);
540
- const programs = carousel ? visible.slice(0, limit) : visible;
545
+ const programs = carousel ? visible.slice(0, limit) : inlineLimit ? visible.slice(0, inlineLimit) : visible;
541
546
  const pagingMetadata = response.pagingMetadata as { hasNext?: boolean; cursors?: { next?: string | null } } | undefined;
542
547
  // A last page may still carry a cursor: `hasNext: false` wins, as in the catalog bundle.
543
- const nextCursor = carousel ? "" : pagingMetadata?.hasNext === false ? "" : pagingMetadata?.cursors?.next ?? "";
544
- if (!carousel && pagingMetadata?.hasNext && !nextCursor) throw new Error("Programs response is missing its next-page cursor");
545
- if (!programs.length && nextCursor && nextCursor !== pageCursor) {
546
- if (read + 1 < MAX_EMPTY_READS) { pageCursor = nextCursor; continue; }
548
+ const readCursor = carousel ? "" : pagingMetadata?.hasNext === false ? "" : pagingMetadata?.cursors?.next ?? "";
549
+ // An inline list never hands a cursor to the screen, but it still reads on past a page that held nothing to show.
550
+ const nextCursor = inlineLimit ? "" : readCursor;
551
+ if (!carousel && !inlineLimit && pagingMetadata?.hasNext && !nextCursor) throw new Error("Programs response is missing its next-page cursor");
552
+ // An inline list reads one page and says whether programs remain past what it shows: that is the See all.
553
+ const pageMore = visible.length > inlineLimit || pagingMetadata?.hasNext === true || !!readCursor;
554
+ if (inlineLimit) metadata.more = pageMore;
555
+ if (!programs.length && readCursor && readCursor !== pageCursor) {
556
+ if (read + 1 < MAX_EMPTY_READS) { pageCursor = readCursor; continue; }
547
557
  // Past the cap, end the list rather than hand back an empty page with a cursor nothing can load.
548
558
  return { items: [], nextCursor: "", metadata };
549
559
  }
@@ -570,7 +580,7 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
570
580
  status: "loading", rows: [], isLoading: true, notLoading: false, isErrored: false, notErrored: true, noEmpty: true, hideList: true,
571
581
  emptyText: "", errorText: "", identityLine: "", needsSignIn: false, noSignIn: true, nextCursor: "", noMore: true, noPageError: true, loadingMore: false,
572
582
  statusFilter: "all", statusOptions: [], hideStatusFilter: true, categoryId: "", categoryChips: [], hideCategoryFilter: true,
573
- hidePriceRetry: true, priceRetryText: "", summary: "", hasRows: false, noRows: true,
583
+ noSeeAll: true, hidePriceRetry: true, priceRetryText: "", summary: "", hasRows: false, noRows: true,
574
584
  };
575
585
 
576
586
  /** A row shows a price when the section does and the member is not in or past the program. */
@@ -631,6 +641,8 @@ export function registerProgramsSection(serviceName: string, options: ProgramsSe
631
641
  hideStatusFilter: options.filters?.status === false || (!member && statusFilter !== "joined"),
632
642
  categoryId, categoryChips,
633
643
  hideCategoryFilter: options.filters?.category === false || categoriesFailed || !categories || categories.length === 0,
644
+ // See all only for an inline (limited) list that has programs past the cards it shows.
645
+ noSeeAll: !(inlineLimit && status === "ready" && meta.more === true),
634
646
  hidePriceRetry: status !== "ready" || !views.some((view) => view && view.route !== "disabled" && (scopeIncomplete || view.retryable)),
635
647
  priceRetryText: copyParam("memberPrograms.priceRetryText", "Some prices could not be loaded."),
636
648
  // The rows loaded so far are not the catalog: a count is only true once the last page is in.
@@ -0,0 +1,94 @@
1
+ {
2
+ "_recipe": "The programs list's two filters: the participant-status segmented control (All programs / Programs I joined; hidden for a guest) and the category chips (All categories first; hidden when the site has no categories). Service: registerProgramsSection(svc,{layout:'list'}); the worker owns the options and hides a control the source turns off (options.filters). Also the list's empty line (a category or the joined filter with no programs), hidden while there are cards.",
3
+ "_placeholders": {
4
+ "svc": "service name the page worker registered with registerProgramsSection",
5
+ "id": "unique node id prefix (e.g. the screen id)",
6
+ "statusLabel": "accessibility label of the status control",
7
+ "categoryLabel": "accessibility label of the category chips",
8
+ "allProgramsLabel": "fallback label of the first status option",
9
+ "joinedLabel": "fallback label of the second status option",
10
+ "allCategoriesLabel": "fallback label of the first category chip"
11
+ },
12
+ "node": {
13
+ "id": "{{id}}.filters",
14
+ "body": {
15
+ "package": "himalaya",
16
+ "type": "VStack",
17
+ "props": {
18
+ "spacing": 10,
19
+ "alignment": "leading",
20
+ "children": [
21
+ {
22
+ "id": "{{id}}.status_filter",
23
+ "body": {
24
+ "package": "himalaya",
25
+ "type": "SegmentedControl",
26
+ "props": {
27
+ "options": [
28
+ {
29
+ "id": "all",
30
+ "label": "{{allProgramsLabel}}"
31
+ },
32
+ {
33
+ "id": "joined",
34
+ "label": "{{joinedLabel}}"
35
+ }
36
+ ],
37
+ "optionsPath": "$service:{{svc}}.statusOptions",
38
+ "selectedId": "$service:{{svc}}.statusFilter",
39
+ "onChange": {
40
+ "actionId": "tier5.{{svc}}.setStatus"
41
+ }
42
+ }
43
+ },
44
+ "modifiers": {
45
+ "accessibilityLabel": "{{statusLabel}}",
46
+ "hiddenPath": "$service:{{svc}}.hideStatusFilter"
47
+ }
48
+ },
49
+ {
50
+ "id": "{{id}}.category_filter",
51
+ "body": {
52
+ "package": "himalaya",
53
+ "type": "FilterChips",
54
+ "props": {
55
+ "chips": [
56
+ {
57
+ "id": "",
58
+ "label": "{{allCategoriesLabel}}"
59
+ }
60
+ ],
61
+ "optionsPath": "$service:{{svc}}.categoryChips",
62
+ "selectedIds": [
63
+ "$service:{{svc}}.categoryId"
64
+ ],
65
+ "onChange": {
66
+ "actionId": "tier5.{{svc}}.setCategory"
67
+ }
68
+ }
69
+ },
70
+ "modifiers": {
71
+ "accessibilityLabel": "{{categoryLabel}}",
72
+ "hiddenPath": "$service:{{svc}}.hideCategoryFilter"
73
+ }
74
+ },
75
+ {
76
+ "id": "{{id}}.empty",
77
+ "body": {
78
+ "package": "himalaya",
79
+ "type": "Text",
80
+ "props": {
81
+ "text": "$service:{{svc}}.emptyText",
82
+ "style": "body",
83
+ "color": "textSecondary"
84
+ }
85
+ },
86
+ "modifiers": {
87
+ "hiddenPath": "$service:{{svc}}.noEmpty"
88
+ }
89
+ }
90
+ ]
91
+ }
92
+ }
93
+ }
94
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "_recipe": "See all button for an INLINE programs list (a limited number of cards); shown only while more programs exist than the cards show. Omit when the scaffold has no himi_programs screen.",
3
+ "_placeholders": {
4
+ "svc": "service name registered with registerProgramsSection (inlineLimit set)",
5
+ "id": "unique node id prefix for this section",
6
+ "seeAllLabel": "button title",
7
+ "seeAllScreen": "screen id the button opens, himi_programs"
8
+ },
9
+ "node": {
10
+ "id": "{{id}}.seeall",
11
+ "body": {
12
+ "package": "himalaya",
13
+ "type": "VStack",
14
+ "props": {
15
+ "spacing": 0,
16
+ "alignment": "leading",
17
+ "children": [
18
+ {
19
+ "id": "{{id}}.seeall.button",
20
+ "body": {
21
+ "package": "himalaya",
22
+ "type": "Button",
23
+ "props": {
24
+ "title": "{{seeAllLabel}}",
25
+ "style": "secondary",
26
+ "size": "md",
27
+ "fullWidth": true,
28
+ "action": {
29
+ "actionId": "himi.open",
30
+ "params": { "screenId": "{{seeAllScreen}}" }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ ]
36
+ }
37
+ },
38
+ "modifiers": {
39
+ "padding": { "leading": 0, "trailing": 0, "top": 8, "bottom": 8 },
40
+ "hiddenPath": "$service:{{svc}}.noSeeAll"
41
+ }
42
+ }
43
+ }