@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.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/sdk/state/src/index.d.ts +2 -1
- package/dist/cli.mjs +37 -27
- package/dist/preview-assets.generated.bin +0 -0
- package/fixtures/wix-canned.json +20 -0
- package/guides/sdk-reference.json +1 -1
- package/package.json +2 -2
- package/templates/beauty-salon/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/beauty-salon/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/beauty-salon-owner/dev/index.ts +3 -14
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/branded-lite/config.ts +7 -0
- package/templates/branded-lite/dev/index.ts +1120 -0
- package/templates/branded-lite/himalaya.content.json +3 -0
- package/templates/branded-lite/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/branded-lite/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/branded-lite/tier5-src/_shared/business-chat-model.ts +22 -0
- package/templates/branded-lite/tier5-src/_shared/business-chat-presenter.ts +427 -0
- package/templates/branded-lite/tier5-src/_shared/business-chat-transport.ts +102 -0
- package/templates/branded-lite/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/branded-lite/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/branded-lite/tier5-src/business-chat/index.ts +304 -0
- package/templates/community-club/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/community-club/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/community-club/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/community-club/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/community-club-owner/dev/index.ts +3 -14
- package/templates/community-club-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/community-club-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/community-club-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/events-meetups/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/events-meetups/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/events-meetups/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/events-meetups-owner/dev/index.ts +3 -14
- package/templates/events-meetups-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/gym-fitness/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/gym-fitness/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/gym-fitness/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/gym-fitness-owner/dev/index.ts +3 -14
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/nonprofit-cause/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/nonprofit-cause/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/nonprofit-cause/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/nonprofit-cause-owner/dev/index.ts +3 -14
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/owner-lite/dev/index.ts +3 -14
- package/templates/owner-lite/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/owner-lite/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/owner-lite/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/podcast-creator/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/podcast-creator/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/podcast-creator/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/podcast-creator-owner/dev/index.ts +3 -14
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/portfolio-creative/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/portfolio-creative/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/portfolio-creative/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/portfolio-creative-owner/dev/index.ts +3 -14
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/restaurant/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/restaurant/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/restaurant/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/restaurant-owner/dev/index.ts +3 -14
- package/templates/restaurant-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/retail-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/retail-store/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/retail-store/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/retail-store-owner/dev/index.ts +3 -14
- package/templates/retail-store-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-manage/logic.ts +18 -5
- package/templates/yoga-studio/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/yoga-studio/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/yoga-studio/tier5-src/_shared/iap-presentation.ts +3 -1
- package/templates/yoga-studio-owner/dev/index.ts +3 -14
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-query.ts +43 -9
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +15 -3
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-manage/index.ts +17 -12
- 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
|
|
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
|
|
260
|
+
else failures.set(keys[index], failureText(metricFailure(result.reason)));
|
|
253
261
|
});
|
|
254
|
-
const areas = withMetrics(state.areas, metrics,
|
|
255
|
-
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
-
/**
|
|
114
|
-
*
|
|
115
|
-
|
|
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
|
-
|
|
119
|
-
|
|
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,
|