@wix/himalaya-cli 0.1445.0 → 0.1447.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 (113) hide show
  1. package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/state/src/index.d.ts +2 -1
  2. package/dist/cli.mjs +37 -27
  3. package/dist/preview-assets.generated.bin +0 -0
  4. package/fixtures/wix-canned.json +20 -0
  5. package/guides/sdk-reference.json +1 -1
  6. package/package.json +2 -2
  7. package/templates/beauty-salon/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  8. package/templates/beauty-salon/tier5-src/_shared/collection-query.ts +43 -9
  9. package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +15 -3
  10. package/templates/beauty-salon/tier5-src/_shared/iap-presentation.ts +3 -1
  11. package/templates/beauty-salon-owner/dev/index.ts +3 -14
  12. package/templates/beauty-salon-owner/tier5-src/_shared/collection-query.ts +43 -9
  13. package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +15 -3
  14. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  15. package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  16. package/templates/branded-lite/config.ts +7 -0
  17. package/templates/branded-lite/dev/index.ts +1120 -0
  18. package/templates/branded-lite/himalaya.content.json +3 -0
  19. package/templates/branded-lite/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  20. package/templates/branded-lite/tier5-src/_shared/business-chat-message-model.ts +177 -0
  21. package/templates/branded-lite/tier5-src/_shared/business-chat-model.ts +22 -0
  22. package/templates/branded-lite/tier5-src/_shared/business-chat-presenter.ts +427 -0
  23. package/templates/branded-lite/tier5-src/_shared/business-chat-transport.ts +102 -0
  24. package/templates/branded-lite/tier5-src/_shared/collection-query.ts +43 -9
  25. package/templates/branded-lite/tier5-src/_shared/collection-service.ts +15 -3
  26. package/templates/branded-lite/tier5-src/_shared/iap-presentation.ts +3 -1
  27. package/templates/branded-lite/tier5-src/business-chat/index.ts +304 -0
  28. package/templates/community-club/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  29. package/templates/community-club/tier5-src/_shared/collection-query.ts +43 -9
  30. package/templates/community-club/tier5-src/_shared/collection-service.ts +15 -3
  31. package/templates/community-club/tier5-src/_shared/iap-presentation.ts +3 -1
  32. package/templates/community-club-owner/dev/index.ts +3 -14
  33. package/templates/community-club-owner/tier5-src/_shared/collection-query.ts +43 -9
  34. package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +15 -3
  35. package/templates/community-club-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  36. package/templates/community-club-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  37. package/templates/events-meetups/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  38. package/templates/events-meetups/tier5-src/_shared/collection-query.ts +43 -9
  39. package/templates/events-meetups/tier5-src/_shared/collection-service.ts +15 -3
  40. package/templates/events-meetups/tier5-src/_shared/iap-presentation.ts +3 -1
  41. package/templates/events-meetups-owner/dev/index.ts +3 -14
  42. package/templates/events-meetups-owner/tier5-src/_shared/collection-query.ts +43 -9
  43. package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +15 -3
  44. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  45. package/templates/events-meetups-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  46. package/templates/gym-fitness/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  47. package/templates/gym-fitness/tier5-src/_shared/collection-query.ts +43 -9
  48. package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +15 -3
  49. package/templates/gym-fitness/tier5-src/_shared/iap-presentation.ts +3 -1
  50. package/templates/gym-fitness-owner/dev/index.ts +3 -14
  51. package/templates/gym-fitness-owner/tier5-src/_shared/collection-query.ts +43 -9
  52. package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +15 -3
  53. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  54. package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  55. package/templates/nonprofit-cause/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  56. package/templates/nonprofit-cause/tier5-src/_shared/collection-query.ts +43 -9
  57. package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +15 -3
  58. package/templates/nonprofit-cause/tier5-src/_shared/iap-presentation.ts +3 -1
  59. package/templates/nonprofit-cause-owner/dev/index.ts +3 -14
  60. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-query.ts +43 -9
  61. package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +15 -3
  62. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  63. package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  64. package/templates/owner-lite/dev/index.ts +3 -14
  65. package/templates/owner-lite/tier5-src/_shared/collection-query.ts +43 -9
  66. package/templates/owner-lite/tier5-src/_shared/collection-service.ts +15 -3
  67. package/templates/owner-lite/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  68. package/templates/owner-lite/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  69. package/templates/podcast-creator/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  70. package/templates/podcast-creator/tier5-src/_shared/collection-query.ts +43 -9
  71. package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +15 -3
  72. package/templates/podcast-creator/tier5-src/_shared/iap-presentation.ts +3 -1
  73. package/templates/podcast-creator-owner/dev/index.ts +3 -14
  74. package/templates/podcast-creator-owner/tier5-src/_shared/collection-query.ts +43 -9
  75. package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +15 -3
  76. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  77. package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  78. package/templates/portfolio-creative/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  79. package/templates/portfolio-creative/tier5-src/_shared/collection-query.ts +43 -9
  80. package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +15 -3
  81. package/templates/portfolio-creative/tier5-src/_shared/iap-presentation.ts +3 -1
  82. package/templates/portfolio-creative-owner/dev/index.ts +3 -14
  83. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-query.ts +43 -9
  84. package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +15 -3
  85. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  86. package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  87. package/templates/restaurant/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  88. package/templates/restaurant/tier5-src/_shared/collection-query.ts +43 -9
  89. package/templates/restaurant/tier5-src/_shared/collection-service.ts +15 -3
  90. package/templates/restaurant/tier5-src/_shared/iap-presentation.ts +3 -1
  91. package/templates/restaurant-owner/dev/index.ts +3 -14
  92. package/templates/restaurant-owner/tier5-src/_shared/collection-query.ts +43 -9
  93. package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +15 -3
  94. package/templates/restaurant-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  95. package/templates/restaurant-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  96. package/templates/retail-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  97. package/templates/retail-store/tier5-src/_shared/collection-query.ts +43 -9
  98. package/templates/retail-store/tier5-src/_shared/collection-service.ts +15 -3
  99. package/templates/retail-store/tier5-src/_shared/iap-presentation.ts +3 -1
  100. package/templates/retail-store-owner/dev/index.ts +3 -14
  101. package/templates/retail-store-owner/tier5-src/_shared/collection-query.ts +43 -9
  102. package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +15 -3
  103. package/templates/retail-store-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  104. package/templates/retail-store-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
  105. package/templates/yoga-studio/tier5-src/_shared/branded-lite-hosted.ts +1 -0
  106. package/templates/yoga-studio/tier5-src/_shared/collection-query.ts +43 -9
  107. package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +15 -3
  108. package/templates/yoga-studio/tier5-src/_shared/iap-presentation.ts +3 -1
  109. package/templates/yoga-studio-owner/dev/index.ts +3 -14
  110. package/templates/yoga-studio-owner/tier5-src/_shared/collection-query.ts +43 -9
  111. package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +15 -3
  112. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
  113. package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
@@ -17,7 +17,7 @@ import { OWNER_MODULES, ownerModuleId } from '../_shared/owner-modules.js';
17
17
  import { localPreferences } from '../_shared/local-preferences.js';
18
18
  import { stashCopy, copyParam, copyTemplate } from '../_shared/himi-copy.js';
19
19
  import { fallbackNameFrom, selectedSiteName } from '../_shared/owner-selected-site.js';
20
- import { DASHBOARD_PATHS, deriveManage, parseAreas, recentAreas, rememberArea, withMetrics, type ManageArea, type Metric } from './logic.js';
20
+ import { DASHBOARD_PATHS, deriveManage, parseAreas, recentAreas, metricFailure, rememberArea, withMetrics, type ManageArea, type Metric, type MetricFailure } from './logic.js';
21
21
 
22
22
  interface State {
23
23
  /** The business the header names: the one picked on Sites, else the descriptor's
@@ -43,7 +43,6 @@ interface State {
43
43
  noSections: boolean;
44
44
  isLoading: boolean;
45
45
  notLoading: boolean;
46
- summaryNote: string;
47
46
  handoffError: string;
48
47
  }
49
48
 
@@ -242,20 +241,26 @@ async function loadMetrics(state: State): Promise<State> {
242
241
  return newestStarted ?? settled;
243
242
  }
244
243
 
244
+ /** A row's status when its summary could not load: why, so a missing app or a denied read is not taken for a fault. */
245
+ function failureText(failure: MetricFailure): string {
246
+ switch (failure) {
247
+ case 'notSetUp': return copyParam('ownerManage.notSetUp', 'Not set up on this site');
248
+ case 'noAccess': return copyParam('ownerManage.noAccess', 'No access');
249
+ default: return copyParam('ownerManage.summaryUnavailable', 'Couldn’t load summary');
250
+ }
251
+ }
252
+
245
253
  async function readMetrics(state: State): Promise<State> {
246
254
  const keys = [...new Set(state.areas.map(area => area.metricKey))];
247
255
  const settled = await Promise.allSettled(keys.map(metricFor));
248
256
  const metrics: Record<string, Metric | undefined> = {};
249
- const unavailable = new Set<string>();
257
+ const failures = new Map<string, string>();
250
258
  settled.forEach((result, index) => {
251
259
  if (result.status === 'fulfilled') metrics[keys[index]] = result.value;
252
- else unavailable.add(keys[index]);
260
+ else failures.set(keys[index], failureText(metricFailure(result.reason)));
253
261
  });
254
- const areas = withMetrics(state.areas, metrics, unavailable);
255
- const note = unavailable.size
256
- ? copyParam('ownerManage.partialSummary', 'Some summaries couldn’t load. You can still open every business area.')
257
- : '';
258
- return derive({ ...state, areas, isLoading: false, notLoading: true, summaryNote: note, handoffError: '' }, areas);
262
+ const areas = withMetrics(state.areas, metrics, failures);
263
+ return derive({ ...state, areas, isLoading: false, notLoading: true, handoffError: '' }, areas);
259
264
  }
260
265
 
261
266
  function findArea(state: State, arg: unknown): ManageArea | undefined {
@@ -294,7 +299,7 @@ const svc = defineService<State, {
294
299
  // 'All' is always a valid filter, so the chip row paints from the first frame
295
300
  // instead of appearing (and shifting the layout) when the areas arrive.
296
301
  groups: [{ id: 'all', label: allLabel() }], summary: '', noEmpty: true,
297
- hasRecents: false, noRecents: true, noSections: true, isLoading: true, notLoading: false, summaryNote: '', handoffError: '',
302
+ hasRecents: false, noRecents: true, noSections: true, isLoading: true, notLoading: false, handoffError: '',
298
303
  },
299
304
  actions: {
300
305
  load: async (state, arg) => {
@@ -313,7 +318,7 @@ const svc = defineService<State, {
313
318
  const parsed = (() => { try { return JSON.parse(str(arg, 'areas') || '[]'); } catch { return []; } })();
314
319
  const areas = parseAreas(parsed);
315
320
  if (state.status === 'ready' && sameAreas(state.areas, areas)) return loadMetrics(revalidating(state, areas));
316
- return loadMetrics(derive({ ...state, status: 'ready', areas, isLoading: true, notLoading: false, summaryNote: '', handoffError: '' }, areas));
321
+ return loadMetrics(derive({ ...state, status: 'ready', areas, isLoading: true, notLoading: false, handoffError: '' }, areas));
317
322
  },
318
323
  // Refresh re-reads summaries for KNOWN areas. Before the descriptor has
319
324
  // delivered them there is nothing to refresh, and settling here would open
@@ -321,7 +326,7 @@ const svc = defineService<State, {
321
326
  // it is re-read either way.
322
327
  refresh: async state => {
323
328
  currentBusinessName = selectedSiteName(fallbackBusinessName);
324
- return state.status !== 'ready' ? { ...state, businessName: currentBusinessName } : loadMetrics(derive({ ...state, isLoading: true, notLoading: false, summaryNote: '', handoffError: '' }));
329
+ return state.status !== 'ready' ? { ...state, businessName: currentBusinessName } : loadMetrics(derive({ ...state, isLoading: true, notLoading: false, handoffError: '' }));
325
330
  },
326
331
  search: (state, arg) => derive({ ...state, query: str(arg, 'value').slice(0, 256) }),
327
332
  filter: (state, arg) => {
@@ -110,13 +110,26 @@ export function countText(metric: Metric, label: string): string {
110
110
  return `${count}${metric.hasMore ? "+" : ""} ${label}`;
111
111
  }
112
112
 
113
- /** Apply independently loaded metrics. A failed source stays visibly unknown;
114
- * it never becomes a misleading zero. */
115
- export function withMetrics(areas: ManageArea[], metrics: Record<string, Metric | undefined>, unavailable: Set<string>): ManageArea[] {
113
+ /** Why a summary could not load: the area's app is not on the site, the owner may not read it, or the read failed.
114
+ * From the LEADING status only, as Today reads it (`isSectionUnavailable`): a transient
115
+ * `HTTP 503: {"message":"upstream returned 404"}` is a failure, not a missing app. */
116
+ export type MetricFailure = "notSetUp" | "noAccess" | "failed";
117
+
118
+ export function metricFailure(error: unknown): MetricFailure {
119
+ const text = String((error as Error)?.message ?? error);
120
+ if (/^HTTP (?:404|428)\b/.test(text) || /^HTTP \d{3} \[FAILED_PRECONDITION\]/.test(text)) return "notSetUp";
121
+ if (/^HTTP 403\b/.test(text) || /^HTTP \d{3} \[PERMISSION_DENIED\]/.test(text)) return "noAccess";
122
+ return "failed";
123
+ }
124
+
125
+ /** Apply independently loaded metrics. A failed source stays visibly unknown, saying why on its own row
126
+ * ([failures]: metric key → that row's status); it never becomes a misleading zero. */
127
+ export function withMetrics(areas: ManageArea[], metrics: Record<string, Metric | undefined>, failures: Map<string, string>): ManageArea[] {
116
128
  return areas.map(area => {
117
129
  const metric = metrics[area.metricKey];
118
- if (!metric || unavailable.has(area.metricKey)) {
119
- return { ...area, metricText: "—", statusText: "Couldn’t load summary", unavailable: true };
130
+ const failure = failures.get(area.metricKey);
131
+ if (!metric || failure !== undefined) {
132
+ return { ...area, metricText: "—", statusText: failure ?? "", unavailable: true };
120
133
  }
121
134
  return {
122
135
  ...area,
@@ -327,6 +327,13 @@ export default defineApp({
327
327
  "parentScreenId": "himi_inbox",
328
328
  "tabId": ""
329
329
  },
330
+ {
331
+ "screenId": "himi_business_chat",
332
+ "isPublic": false,
333
+ "paramKeys": [],
334
+ "parentScreenId": "himi_inbox",
335
+ "tabId": ""
336
+ },
330
337
  {
331
338
  "screenId": "himi_forum",
332
339
  "isPublic": true,