@wix/himalaya-cli 0.1571.0 → 0.1572.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.
@@ -112,13 +112,10 @@ function programFields(p: WixProgram): Omit<ProgramRow, "priceLine"> {
112
112
  initial: initials(name),
113
113
  hasImage: !!image,
114
114
  noImage: !image,
115
- // The row also binds `id` as a nav param, which `currentInputId` prefers — but no
116
- // shell threads that param into worker `input.id` yet, so a param-less target left
117
- // the detail worker with no id and its Enrol CTA dead on arrival. Same fix (and same
118
- // reasoning) as the events row: bake the id, which the app's own
119
- // liveSeedRoute({ prefix: "himi_program_" }) already seeds and `currentInputId`
120
- // resolves through its prefix path.
121
- detailScreenId: `himi_program_${id}`,
115
+ // The canonical route is baked even offline. Hosts pass the row's `id` as
116
+ // worker input (WS-C); suffixed routes only exist for the preview seed's
117
+ // first 50 records and cannot open a complete live catalog in production.
118
+ detailScreenId: "himi_program",
122
119
  };
123
120
  }
124
121
 
@@ -157,9 +154,29 @@ function errored(state: State): State {
157
154
  };
158
155
  }
159
156
 
160
- async function fetchPrograms(): Promise<WixProgram[]> {
161
- const response = await queryPrograms({ cursorPaging: { limit: 50 } });
162
- return (response.programs ?? []).filter((p) => !isDraft(p));
157
+ async function fetchPrograms(isCurrent: () => boolean): Promise<WixProgram[] | undefined> {
158
+ const programs = new Map<string, WixProgram>();
159
+ const seen = new Set<string>();
160
+ let cursor = "";
161
+ do {
162
+ // Wix cursors carry the initial sort/filter. Repeating either on a continuation
163
+ // is rejected with INVALID_CURSOR, even when their values have not changed.
164
+ const response = await queryPrograms(cursor
165
+ ? { cursorPaging: { limit: 50, cursor } }
166
+ : { cursorPaging: { limit: 50 }, sort: [{ fieldName: "createdDate", order: "DESC" }] });
167
+ if (!isCurrent()) return undefined;
168
+ for (const program of response.programs ?? []) {
169
+ if (program.id && !isDraft(program)) programs.set(program.id, program);
170
+ }
171
+ const paging = response.pagingMetadata;
172
+ const next = paging?.hasNext === false ? "" : paging?.cursors?.next ?? "";
173
+ if ((paging?.hasNext && !next) || (next && seen.has(next))) {
174
+ throw new Error("Invalid program catalog cursor");
175
+ }
176
+ if (next) seen.add(next);
177
+ cursor = next;
178
+ } while (cursor);
179
+ return [...programs.values()];
163
180
  }
164
181
 
165
182
  // ── Content and App Store prices ─────
@@ -180,7 +197,7 @@ let loadSeq = 0;
180
197
  async function load(_state: State, arg?: unknown): Promise<undefined> {
181
198
  stashCopy(arg);
182
199
  const seq = ++loadSeq;
183
- const programs = await fetchPrograms().catch(() => undefined);
200
+ const programs = await fetchPrograms(() => seq === loadSeq).catch(() => undefined);
184
201
  if (seq !== loadSeq) return undefined;
185
202
  content = programs ? { status: "ready", programs: programs.map(programContent) } : { ...content, status: "error" };
186
203
  void svc.pricingPublish();
@@ -52522,8 +52522,7 @@ const SCREENS = runtimeSetting({
52522
52522
  "params": {
52523
52523
  "screenId": "himi_owner_lite_search",
52524
52524
  "title": "Search records",
52525
- "subtitle": "Across your business areas",
52526
- "search": "drawer"
52525
+ "subtitle": "Across your business areas"
52527
52526
  }
52528
52527
  },
52529
52528
  "pressFeedback": "scale",
@@ -54042,7 +54041,7 @@ const SCREENS = runtimeSetting({
54042
54041
  "actionId": "tier5.himiOwnerLiteSearch.search"
54043
54042
  },
54044
54043
  "debounceMs": 200,
54045
- "placement": "drawer"
54044
+ "loadingPath": "$service:himiOwnerLiteSearch.anyLoading"
54046
54045
  }
54047
54046
  }
54048
54047
  },