@wix/himalaya-cli 0.1026.0 → 0.1028.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/dev-server/src/builder.d.ts +9 -0
- package/dist/cli.mjs +1128 -666
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-config.md +6 -0
- package/guides/headless-loop.md +3 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +331 -199
- package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/beauty-salon-owner/dev/index.ts +857 -458
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/branded-lite/dev/index.ts +1539 -623
- package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/community-club/dev/index.ts +237 -142
- package/templates/community-club/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/community-club/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/community-club-owner/dev/index.ts +857 -458
- package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/events-meetups/dev/index.ts +202 -129
- package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/events-meetups-owner/dev/index.ts +815 -458
- package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/gym-fitness/dev/index.ts +461 -212
- package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/gym-fitness-owner/dev/index.ts +758 -338
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/himi-chat/dev/index.ts +26 -1
- package/templates/nonprofit-cause/dev/index.ts +246 -153
- package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/nonprofit-cause-owner/dev/index.ts +716 -338
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/owner-lite/dev/index.ts +758 -338
- package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/podcast-creator/dev/index.ts +255 -164
- package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/podcast-creator-owner/dev/index.ts +857 -458
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/portfolio-creative/dev/index.ts +287 -175
- package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/portfolio-creative-owner/dev/index.ts +857 -458
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/restaurant/dev/index.ts +200 -126
- package/templates/restaurant/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/restaurant-owner/dev/index.ts +758 -338
- package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/retail-store/dev/index.ts +113 -138
- package/templates/retail-store/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/retail-store-owner/dev/index.ts +716 -338
- package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/surface-showcase/dev/index.ts +27 -0
- package/templates/yoga-studio/dev/index.ts +427 -198
- package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +28 -3
- package/templates/yoga-studio-owner/dev/index.ts +716 -338
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +18 -8
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +28 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineService as register, type ServiceDefinition } from '@himalaya/state';
|
|
2
|
-
import { COLLECTIONS, normalizeCollection, projectCollection, collectionId, type CollectionRow } from './collection-contract.js';
|
|
2
|
+
import { COLLECTIONS, COLLECTION_CHROME_MIN_ITEMS, initialCollection, normalizeCollection, projectCollection, collectionId, type CollectionRow } from './collection-contract.js';
|
|
3
3
|
import { localPreferences, type PreferenceRuntime } from './local-preferences.js';
|
|
4
4
|
import { copyParam, stashCopy } from './himi-copy.js';
|
|
5
5
|
import { createCollectionQuery, type CollectionQuerySource, type CollectionQueryState } from './collection-query.js';
|
|
@@ -54,6 +54,14 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
54
54
|
/** Navigation can open a collection in a useful, reviewable context. Keep
|
|
55
55
|
* this input additive and constrained to the same criteria the collection UI
|
|
56
56
|
* can select; arbitrary route values must never become backend filters. */
|
|
57
|
+
/** Labels of the worker-listed filter choices (`filterValuesFrom`), minus the "All" row. */
|
|
58
|
+
const listedFilters = (state: State): string[] => config.filterValuesFrom && Array.isArray(state[config.filterValuesFrom])
|
|
59
|
+
? (state[config.filterValuesFrom] as unknown[]).flatMap(row => {
|
|
60
|
+
const r = row && typeof row === 'object' ? row as Record<string, unknown> : {};
|
|
61
|
+
return typeof r.label === 'string' && r.id !== '' ? [r.label] : [];
|
|
62
|
+
})
|
|
63
|
+
: [];
|
|
64
|
+
let pendingFilter = '';
|
|
57
65
|
const applyNavigationCriteria = (arg: unknown, state: State): boolean => {
|
|
58
66
|
const input = object(arg);
|
|
59
67
|
let changed = false;
|
|
@@ -70,9 +78,14 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
70
78
|
const configured = config.filterValues ?? [];
|
|
71
79
|
const rows = Array.isArray(state[config.rows]) ? state[config.rows] as CollectionRow[] : [];
|
|
72
80
|
const derived = config.filter ? rows.map(row => String(row[config.filter!] ?? '')).filter(Boolean) : [];
|
|
81
|
+
const known = listedFilters(state);
|
|
73
82
|
const allowed = filter === 'all' || filter === 'saved' ||
|
|
74
|
-
(filter.startsWith('value:') && [...configured, ...derived].includes(filter.slice(6)));
|
|
83
|
+
(filter.startsWith('value:') && [...configured, ...derived, ...known].includes(filter.slice(6)));
|
|
75
84
|
if (allowed) { prefs.filter = filter; changed = true; }
|
|
85
|
+
// A worker-listed choice (e.g. a blog category) may not have loaded yet at boot:
|
|
86
|
+
// hold it and settle it against the list once the list arrives, instead of
|
|
87
|
+
// discarding a valid deep link before load().
|
|
88
|
+
else if (filter.startsWith('value:') && config.filterValuesFrom && known.length === 0) pendingFilter = filter;
|
|
76
89
|
}
|
|
77
90
|
if (changed) {
|
|
78
91
|
prefs.selectedIds = [];
|
|
@@ -90,7 +103,12 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
90
103
|
const derive = (s: State): State => {
|
|
91
104
|
syncSaved();
|
|
92
105
|
const rows = Array.isArray(s[config.rows]) ? (s[config.rows] as CollectionRow[]).filter(x => x && typeof x === 'object') : [];
|
|
93
|
-
const
|
|
106
|
+
const known = listedFilters(s);
|
|
107
|
+
if (pendingFilter && known.length) {
|
|
108
|
+
if (known.includes(pendingFilter.slice(6))) { prefs.filter = pendingFilter; persisted.write(prefs); }
|
|
109
|
+
pendingFilter = '';
|
|
110
|
+
}
|
|
111
|
+
const projected = projectCollection(rows, config, prefs, !!backend && config.backendQuery === true, known);
|
|
94
112
|
projected.items.forEach(row => { row.collectionSelectLabel = row.collectionSelected ? copyParam('collection.selected', 'Selected') : copyParam('collection.select', 'Select'); });
|
|
95
113
|
if (previewId && !rows.some(row => collectionId(row) === previewId)) previewId = '';
|
|
96
114
|
const filterChoices = [{ id: 'all', label: copyParam('collection.all', 'All') }, { id: 'saved', label: copyParam('collection.saved', 'Saved') },
|
|
@@ -106,7 +124,14 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
106
124
|
const queryError = typeof backendState?.error === 'string' ? backendState.error.trim() : '';
|
|
107
125
|
const errorMessage = queryError || domainError || copyParam('collection.loadError', 'This collection could not load. Try again.');
|
|
108
126
|
const canRetry = !!backend || typeof def.actions?.refresh === 'function' || typeof def.actions?.load === 'function' || typeof def.actions?.collectionRetry === 'function';
|
|
127
|
+
// A default view is what the screen opens on; anything else is the member's own
|
|
128
|
+
// narrowing, which keeps the chrome (and the Clear that undoes it) on screen.
|
|
129
|
+
// "All" and the collection's own default (e.g. Upcoming) are both un-narrowed: Clear
|
|
130
|
+
// resets to "All", so showing it on either would offer a reset that changes nothing.
|
|
131
|
+
const narrowed = !!prefs.query.trim() || (prefs.filter !== 'all' && prefs.filter !== initialCollection(config).filter);
|
|
132
|
+
const hideChrome = !narrowed && !s.nextCursor && projected.loaded < COLLECTION_CHROME_MIN_ITEMS;
|
|
109
133
|
return { ...s, collection: { ...prefs, ...projected,
|
|
134
|
+
hideChrome, noActiveCriteria: !narrowed,
|
|
110
135
|
viewName, viewMessage, saveMessage, noSavedViews: prefs.savedViews.length === 0,
|
|
111
136
|
cursor: s.pageError === true || s.loadingMore === true ? '' : s.nextCursor,
|
|
112
137
|
noMore: !s.nextCursor || s.pageError === true || s.loadingMore === true,
|