@wix/himalaya-cli 0.1032.0 → 0.1034.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/cli.mjs +0 -2
- package/guides/getting-started.md +6 -2
- package/guides/wix-site-to-himi-app.md +9 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +398 -1
- package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/beauty-salon/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/beauty-salon/tier5-src/himi-store-saved/index.ts +3 -2
- package/templates/beauty-salon/tier5-src/wix-spaces-collections/index.ts +3 -2
- package/templates/beauty-salon/tier5-src/wix-spaces-my-subscriptions/index.ts +11 -2
- package/templates/beauty-salon/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/beauty-salon-owner/dev/index.ts +1216 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/branded-lite/dev/index.ts +2239 -343
- package/templates/branded-lite/tier5-src/_shared/branded-load-state.ts +106 -0
- package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/branded-lite/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-badges/index.ts +20 -16
- package/templates/branded-lite/tier5-src/himi-branded-lite-coupons/index.ts +20 -20
- package/templates/branded-lite/tier5-src/himi-branded-lite-donations/index.ts +20 -16
- package/templates/branded-lite/tier5-src/himi-branded-lite-forms/index.ts +23 -31
- package/templates/branded-lite/tier5-src/himi-branded-lite-galleries/index.ts +19 -14
- package/templates/branded-lite/tier5-src/himi-branded-lite-giftcards/index.ts +20 -16
- package/templates/branded-lite/tier5-src/himi-branded-lite-inbox/index.ts +20 -15
- package/templates/branded-lite/tier5-src/himi-branded-lite-invoices/index.ts +20 -16
- package/templates/branded-lite/tier5-src/himi-branded-lite-loyalty/index.ts +20 -17
- package/templates/branded-lite/tier5-src/himi-branded-lite-notifications/index.ts +20 -18
- package/templates/branded-lite/tier5-src/himi-branded-lite-notifsettings/index.ts +23 -19
- package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-reservations/index.ts +24 -20
- package/templates/branded-lite/tier5-src/himi-branded-lite-reviews/index.ts +20 -17
- package/templates/branded-lite/tier5-src/himi-branded-lite-videos/index.ts +19 -15
- package/templates/branded-lite/tier5-src/himi-store-saved/index.ts +3 -2
- package/templates/branded-lite/tier5-src/wix-spaces-collections/index.ts +3 -2
- package/templates/branded-lite/tier5-src/wix-spaces-forum/index.ts +3 -2
- package/templates/branded-lite/tier5-src/wix-spaces-members/index.ts +19 -6
- package/templates/branded-lite/tier5-src/wix-spaces-my-subscriptions/index.ts +11 -2
- package/templates/branded-lite/tier5-src/wix-spaces-new-message/index.ts +3 -2
- package/templates/branded-lite/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/community-club/dev/index.ts +283 -2
- package/templates/community-club/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/community-club/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/community-club/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/community-club/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/community-club-owner/dev/index.ts +1216 -0
- package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/events-meetups/dev/index.ts +197 -1
- package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/events-meetups/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/events-meetups/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/events-meetups-owner/dev/index.ts +1088 -0
- package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/gym-fitness/dev/index.ts +462 -1
- package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/gym-fitness/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/gym-fitness/tier5-src/himi-store-saved/index.ts +3 -2
- package/templates/gym-fitness/tier5-src/wix-spaces-collections/index.ts +3 -2
- package/templates/gym-fitness/tier5-src/wix-spaces-my-subscriptions/index.ts +11 -2
- package/templates/gym-fitness/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/gym-fitness-owner/dev/index.ts +1280 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/nonprofit-cause/dev/index.ts +264 -1
- package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/nonprofit-cause/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/nonprofit-cause/tier5-src/wix-spaces-my-subscriptions/index.ts +11 -2
- package/templates/nonprofit-cause/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/nonprofit-cause-owner/dev/index.ts +1152 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/owner-lite/dev/index.ts +1280 -0
- package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/podcast-creator/dev/index.ts +286 -23
- package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/podcast-creator/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +1 -1
- package/templates/podcast-creator/tier5-src/wix-spaces-my-subscriptions/index.ts +11 -2
- package/templates/podcast-creator/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/podcast-creator-owner/dev/index.ts +1216 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/portfolio-creative/dev/index.ts +353 -23
- package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/portfolio-creative/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/portfolio-creative/tier5-src/himi-store-saved/index.ts +3 -2
- package/templates/portfolio-creative/tier5-src/wix-spaces-collections/index.ts +3 -2
- package/templates/portfolio-creative/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/portfolio-creative-owner/dev/index.ts +1216 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/restaurant/dev/index.ts +197 -1
- package/templates/restaurant/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/restaurant/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/restaurant/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/restaurant-owner/dev/index.ts +1280 -0
- package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/retail-store/dev/index.ts +203 -1
- package/templates/retail-store/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/retail-store/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/retail-store/tier5-src/himi-store-saved/index.ts +3 -2
- package/templates/retail-store/tier5-src/wix-spaces-collections/index.ts +3 -2
- package/templates/retail-store/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/retail-store-owner/dev/index.ts +1152 -0
- package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/yoga-studio/dev/index.ts +392 -1
- package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +36 -5
- package/templates/yoga-studio/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/yoga-studio/tier5-src/wix-spaces-my-subscriptions/index.ts +11 -2
- package/templates/yoga-studio/tier5-src/wix-spaces-whats-new/index.ts +3 -2
- package/templates/yoga-studio-owner/dev/index.ts +1152 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +4 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +36 -5
|
@@ -30,6 +30,9 @@ export interface CollectionConfig {
|
|
|
30
30
|
* `screenId` opens that screen with the row id; without it the verb reuses the
|
|
31
31
|
* row's own tap action (the detail screen that owns the verb). */
|
|
32
32
|
primaryVerb?: { label: string; screenId?: string };
|
|
33
|
+
/** A state field the DOMAIN narrows `rows` by (e.g. a category picker). While it is set,
|
|
34
|
+
* zero rows is a filtered result, not an empty source. */
|
|
35
|
+
narrowedBy?: string;
|
|
33
36
|
}
|
|
34
37
|
/** At or below this many records, with no query/filter narrowing them and no further
|
|
35
38
|
* page, the list/grid toggle, Refine, chips, search and count are noise. */
|
|
@@ -41,7 +44,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
41
44
|
defaultFilter: 'value:Upcoming', searchPlaceholder: 'Exact booking ID', filterValues: ['Upcoming', 'Past', 'Cancelled'],
|
|
42
45
|
sortLabels: { default: 'Soonest', az: 'Oldest', za: 'Latest' } },
|
|
43
46
|
himiEvents: { rows: 'results', title: 'title', subtitle: 'dateLine', image: 'image', view: 'grid', backendQuery: true, searchPlaceholder: 'Exact event title', filterValues: ['Upcoming', 'Past'], sortLabels: { default: 'Date', az: 'Title A–Z', za: 'Title Z–A' }, primaryVerb: { label: 'Register' } },
|
|
44
|
-
himiBlogFeed: { rows: 'posts', title: 'title', subtitle: 'excerpt', image: 'image', filter: 'category', filterValuesFrom: 'categories', view: 'grid' },
|
|
47
|
+
himiBlogFeed: { rows: 'posts', title: 'title', subtitle: 'excerpt', image: 'image', filter: 'category', filterValuesFrom: 'categories', view: 'grid', narrowedBy: 'selectedCategoryId' },
|
|
45
48
|
himiOwnerLiteProducts: { rows: 'products', title: 'name', subtitle: 'price', image: 'image', view: 'grid', backendQuery: true },
|
|
46
49
|
himiOwnerModules: { instanceInput: 'module', rows: 'rows', title: 'title', subtitle: 'subtitle', image: 'image', filter: 'statusLabel', view: 'list', paged: true, reviewAction: 'prepareRecord', reviewSelectedAction: 'prepareSelected' },
|
|
47
50
|
himiOwnerLiteServices: { rows: 'services', title: 'name', subtitle: 'subtitle', view: 'list', backendQuery: true, searchPlaceholder: 'Service name starts with…' },
|
|
@@ -122,14 +122,38 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
122
122
|
const errored = s.status === 'error' || s.isErrored === true || s.errored === true || backendState?.status === 'error';
|
|
123
123
|
const domainError = typeof s.error === 'string' ? s.error.trim() : '';
|
|
124
124
|
const queryError = typeof backendState?.error === 'string' ? backendState.error.trim() : '';
|
|
125
|
-
|
|
125
|
+
// Some domains carry their failure sentence in `emptyText` (portfolio, podcasts);
|
|
126
|
+
// the screen folds that node into this block, so keep the domain's own words.
|
|
127
|
+
const domainEmptyError = errored && typeof s.emptyText === 'string' ? s.emptyText.trim() : '';
|
|
128
|
+
const errorMessage = queryError || domainError || domainEmptyError || copyParam('collection.loadError', 'This collection could not load. Try again.');
|
|
126
129
|
const canRetry = !!backend || typeof def.actions?.refresh === 'function' || typeof def.actions?.load === 'function' || typeof def.actions?.collectionRetry === 'function';
|
|
130
|
+
// Wix refused the visitor: retrying cannot help, signing in can.
|
|
131
|
+
const signInRequired = errored && s.signInRequired === true;
|
|
132
|
+
// "the source has nothing" and "your filter matched nothing" are
|
|
133
|
+
// different states. Only the second may offer "Clear filters", and the list chrome
|
|
134
|
+
// (view, refine, chips, counter, search) means nothing over a source with no rows.
|
|
135
|
+
// Loaded-row collections hold the whole source in `rows`, so zero rows IS an empty
|
|
136
|
+
// source. A backend query returns only matches, so zero rows is source-empty only
|
|
137
|
+
// when nothing narrowed it.
|
|
138
|
+
// Anything the customer (or the domain) narrowed the result by. While narrowed, zero rows
|
|
139
|
+
// is "your filter matched nothing" and the controls that got them here must stay.
|
|
140
|
+
// The DOMAIN's own filter (config.narrowedBy, e.g. blog category) narrowed the rows: the
|
|
141
|
+
// domain owns that empty state and its clear action. The shared "Clear filters" block
|
|
142
|
+
// cannot reset a domain filter, so it never shows for one.
|
|
143
|
+
const domainNarrowed = !!config.narrowedBy && !!s[config.narrowedBy];
|
|
127
144
|
// A default view is what the screen opens on; anything else is the member's own
|
|
128
145
|
// narrowing, which keeps the chrome (and the Clear that undoes it) on screen.
|
|
129
146
|
// "All" and the collection's own default (e.g. Upcoming) are both un-narrowed: Clear
|
|
130
147
|
// 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
|
|
148
|
+
const narrowed = !!prefs.query.trim() || (prefs.filter !== 'all' && prefs.filter !== initialCollection(config).filter) || domainNarrowed;
|
|
149
|
+
const sourceEmpty = !loading && !errored && rows.length === 0 &&
|
|
150
|
+
(!(backend && config.backendQuery) || !narrowed) && !domainNarrowed;
|
|
151
|
+
const emptySourceText = (typeof s.emptyText === 'string' && s.emptyText.trim()) || copyParam('collection.emptySource', 'Nothing here yet');
|
|
152
|
+
// Chrome is noise over a small un-narrowed list (fewer than COLLECTION_CHROME_MIN_ITEMS
|
|
153
|
+
// records, no further page), over an empty source, and before the FIRST load or an
|
|
154
|
+
// un-narrowed failure. A re-query while typing keeps it (and the search field's focus).
|
|
155
|
+
const hideChrome = (!narrowed && !s.nextCursor && projected.loaded < COLLECTION_CHROME_MIN_ITEMS)
|
|
156
|
+
|| sourceEmpty || ((loading || errored) && rows.length === 0 && !narrowed);
|
|
133
157
|
return { ...s, collection: { ...prefs, ...projected,
|
|
134
158
|
hideChrome, noActiveCriteria: !narrowed,
|
|
135
159
|
viewName, viewMessage, saveMessage, noSavedViews: prefs.savedViews.length === 0,
|
|
@@ -138,8 +162,15 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
138
162
|
noPageError: s.pageError !== true,
|
|
139
163
|
noOffline: s.fromCache !== true,
|
|
140
164
|
noError: !errored,
|
|
141
|
-
noRetry: !canRetry,
|
|
165
|
+
noRetry: !canRetry || signInRequired,
|
|
166
|
+
noSignIn: !signInRequired,
|
|
167
|
+
errorTitle: signInRequired ? copyParam('collection.signInTitle', 'Sign in to see this') : copyParam('collection.loadErrorTitle', 'This collection could not load'),
|
|
142
168
|
errorMessage,
|
|
169
|
+
noLoading: !loading,
|
|
170
|
+
// De-dup against a domain that paints its OWN empty block (screen-kit emptyBlock is
|
|
171
|
+
// gated on the domain's top-level `noEmpty`): only one empty state ever shows.
|
|
172
|
+
noEmptySource: !sourceEmpty || s.noEmpty === false,
|
|
173
|
+
emptySourceText,
|
|
143
174
|
hideList: prefs.view !== 'list', hideGrid: prefs.view !== 'grid',
|
|
144
175
|
hideComfortable: prefs.density !== 'comfortable', hideCompact: prefs.density !== 'compact',
|
|
145
176
|
selectingLabel: prefs.selecting ? copyParam('collection.done', 'Done') : copyParam('collection.select', 'Select'),
|
|
@@ -147,7 +178,7 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
147
178
|
cannotSaveSelected: !prefs.selectedIds.length || prefs.selectedIds.some(id => !rows.some(row => collectionId(row) === id)),
|
|
148
179
|
filtersPresented, previewPresented: !!previewId, preview: projected.items.filter(row => row.collectionId === previewId),
|
|
149
180
|
persistenceLabel: persisted.available ? copyParam('collection.onDevice', 'Saved on this device') : copyParam('collection.sessionOnly', 'Choices last for this session'),
|
|
150
|
-
noEmpty: loading || errored || projected.items.length > 0,
|
|
181
|
+
noEmpty: loading || errored || sourceEmpty || domainNarrowed || projected.items.length > 0,
|
|
151
182
|
summary: backend && config.backendQuery
|
|
152
183
|
? (s.fromCache ? copyParam('collection.cached', 'Saved offline · may be outdated')
|
|
153
184
|
: typeof s.total === 'number' ? `${projected.items.length} / ${s.total} ${copyParam('collection.results', 'results')}`
|
|
@@ -4750,7 +4750,8 @@ const SCREENS = runtimeSetting({
|
|
|
4750
4750
|
"props": {
|
|
4751
4751
|
"text": "$service:spacesDeleteAccount.message",
|
|
4752
4752
|
"style": "caption",
|
|
4753
|
-
"color": "textTertiary"
|
|
4753
|
+
"color": "textTertiary",
|
|
4754
|
+
"collapseWhenEmpty": true
|
|
4754
4755
|
}
|
|
4755
4756
|
}
|
|
4756
4757
|
},
|
|
@@ -5045,6 +5046,9 @@ const SCREENS = runtimeSetting({
|
|
|
5045
5046
|
}
|
|
5046
5047
|
]
|
|
5047
5048
|
}
|
|
5049
|
+
},
|
|
5050
|
+
"modifiers": {
|
|
5051
|
+
"hiddenPath": "$service:spacesWhatsNew.noItems"
|
|
5048
5052
|
}
|
|
5049
5053
|
},
|
|
5050
5054
|
{
|
|
@@ -6291,6 +6295,24 @@ const SCREENS = runtimeSetting({
|
|
|
6291
6295
|
"props": {
|
|
6292
6296
|
"spacing": 0,
|
|
6293
6297
|
"children": [
|
|
6298
|
+
{
|
|
6299
|
+
"id": "himi_events.list.collection.loading",
|
|
6300
|
+
"body": {
|
|
6301
|
+
"package": "himalaya",
|
|
6302
|
+
"type": "Skeleton",
|
|
6303
|
+
"props": {
|
|
6304
|
+
"height": 72,
|
|
6305
|
+
"cornerRadius": 12,
|
|
6306
|
+
"count": 3
|
|
6307
|
+
}
|
|
6308
|
+
},
|
|
6309
|
+
"modifiers": {
|
|
6310
|
+
"hiddenPath": "$service:himiEvents.collection.noLoading",
|
|
6311
|
+
"padding": {
|
|
6312
|
+
"bottom": 12
|
|
6313
|
+
}
|
|
6314
|
+
}
|
|
6315
|
+
},
|
|
6294
6316
|
{
|
|
6295
6317
|
"id": "",
|
|
6296
6318
|
"body": {
|
|
@@ -6552,6 +6574,52 @@ const SCREENS = runtimeSetting({
|
|
|
6552
6574
|
}
|
|
6553
6575
|
}
|
|
6554
6576
|
},
|
|
6577
|
+
{
|
|
6578
|
+
"id": "himi_events.list.collection.empty-source",
|
|
6579
|
+
"body": {
|
|
6580
|
+
"package": "himalaya",
|
|
6581
|
+
"type": "VStack",
|
|
6582
|
+
"props": {
|
|
6583
|
+
"spacing": 8,
|
|
6584
|
+
"alignment": "center",
|
|
6585
|
+
"children": [
|
|
6586
|
+
{
|
|
6587
|
+
"id": "",
|
|
6588
|
+
"body": {
|
|
6589
|
+
"package": "himalaya",
|
|
6590
|
+
"type": "Icon",
|
|
6591
|
+
"props": {
|
|
6592
|
+
"name": "inbox",
|
|
6593
|
+
"size": 28,
|
|
6594
|
+
"tint": "textTertiary"
|
|
6595
|
+
}
|
|
6596
|
+
},
|
|
6597
|
+
"modifiers": {
|
|
6598
|
+
"accessibilityRole": "decorative"
|
|
6599
|
+
}
|
|
6600
|
+
},
|
|
6601
|
+
{
|
|
6602
|
+
"id": "",
|
|
6603
|
+
"body": {
|
|
6604
|
+
"package": "himalaya",
|
|
6605
|
+
"type": "Text",
|
|
6606
|
+
"props": {
|
|
6607
|
+
"text": "$service:himiEvents.collection.emptySourceText",
|
|
6608
|
+
"style": "body",
|
|
6609
|
+
"color": "textSecondary"
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
}
|
|
6613
|
+
]
|
|
6614
|
+
}
|
|
6615
|
+
},
|
|
6616
|
+
"modifiers": {
|
|
6617
|
+
"hiddenPath": "$service:himiEvents.collection.noEmptySource",
|
|
6618
|
+
"padding": {
|
|
6619
|
+
"bottom": 12
|
|
6620
|
+
}
|
|
6621
|
+
}
|
|
6622
|
+
},
|
|
6555
6623
|
{
|
|
6556
6624
|
"id": "",
|
|
6557
6625
|
"body": {
|
|
@@ -9595,6 +9663,24 @@ const SCREENS = runtimeSetting({
|
|
|
9595
9663
|
"props": {
|
|
9596
9664
|
"spacing": 0,
|
|
9597
9665
|
"children": [
|
|
9666
|
+
{
|
|
9667
|
+
"id": "himi_blog.list.collection.loading",
|
|
9668
|
+
"body": {
|
|
9669
|
+
"package": "himalaya",
|
|
9670
|
+
"type": "Skeleton",
|
|
9671
|
+
"props": {
|
|
9672
|
+
"height": 72,
|
|
9673
|
+
"cornerRadius": 12,
|
|
9674
|
+
"count": 3
|
|
9675
|
+
}
|
|
9676
|
+
},
|
|
9677
|
+
"modifiers": {
|
|
9678
|
+
"hiddenPath": "$service:himiBlogFeed.collection.noLoading",
|
|
9679
|
+
"padding": {
|
|
9680
|
+
"bottom": 12
|
|
9681
|
+
}
|
|
9682
|
+
}
|
|
9683
|
+
},
|
|
9598
9684
|
{
|
|
9599
9685
|
"id": "",
|
|
9600
9686
|
"body": {
|
|
@@ -9813,6 +9899,52 @@ const SCREENS = runtimeSetting({
|
|
|
9813
9899
|
}
|
|
9814
9900
|
}
|
|
9815
9901
|
},
|
|
9902
|
+
{
|
|
9903
|
+
"id": "himi_blog.list.collection.empty-source",
|
|
9904
|
+
"body": {
|
|
9905
|
+
"package": "himalaya",
|
|
9906
|
+
"type": "VStack",
|
|
9907
|
+
"props": {
|
|
9908
|
+
"spacing": 8,
|
|
9909
|
+
"alignment": "center",
|
|
9910
|
+
"children": [
|
|
9911
|
+
{
|
|
9912
|
+
"id": "",
|
|
9913
|
+
"body": {
|
|
9914
|
+
"package": "himalaya",
|
|
9915
|
+
"type": "Icon",
|
|
9916
|
+
"props": {
|
|
9917
|
+
"name": "inbox",
|
|
9918
|
+
"size": 28,
|
|
9919
|
+
"tint": "textTertiary"
|
|
9920
|
+
}
|
|
9921
|
+
},
|
|
9922
|
+
"modifiers": {
|
|
9923
|
+
"accessibilityRole": "decorative"
|
|
9924
|
+
}
|
|
9925
|
+
},
|
|
9926
|
+
{
|
|
9927
|
+
"id": "",
|
|
9928
|
+
"body": {
|
|
9929
|
+
"package": "himalaya",
|
|
9930
|
+
"type": "Text",
|
|
9931
|
+
"props": {
|
|
9932
|
+
"text": "$service:himiBlogFeed.collection.emptySourceText",
|
|
9933
|
+
"style": "body",
|
|
9934
|
+
"color": "textSecondary"
|
|
9935
|
+
}
|
|
9936
|
+
}
|
|
9937
|
+
}
|
|
9938
|
+
]
|
|
9939
|
+
}
|
|
9940
|
+
},
|
|
9941
|
+
"modifiers": {
|
|
9942
|
+
"hiddenPath": "$service:himiBlogFeed.collection.noEmptySource",
|
|
9943
|
+
"padding": {
|
|
9944
|
+
"bottom": 12
|
|
9945
|
+
}
|
|
9946
|
+
}
|
|
9947
|
+
},
|
|
9816
9948
|
{
|
|
9817
9949
|
"id": "",
|
|
9818
9950
|
"body": {
|
|
@@ -12618,6 +12750,24 @@ const SCREENS = runtimeSetting({
|
|
|
12618
12750
|
"props": {
|
|
12619
12751
|
"spacing": 0,
|
|
12620
12752
|
"children": [
|
|
12753
|
+
{
|
|
12754
|
+
"id": "himi_groups.rows.collection.loading",
|
|
12755
|
+
"body": {
|
|
12756
|
+
"package": "himalaya",
|
|
12757
|
+
"type": "Skeleton",
|
|
12758
|
+
"props": {
|
|
12759
|
+
"height": 72,
|
|
12760
|
+
"cornerRadius": 12,
|
|
12761
|
+
"count": 3
|
|
12762
|
+
}
|
|
12763
|
+
},
|
|
12764
|
+
"modifiers": {
|
|
12765
|
+
"hiddenPath": "$service:himiBrandedGroups.collection.noLoading",
|
|
12766
|
+
"padding": {
|
|
12767
|
+
"bottom": 12
|
|
12768
|
+
}
|
|
12769
|
+
}
|
|
12770
|
+
},
|
|
12621
12771
|
{
|
|
12622
12772
|
"id": "",
|
|
12623
12773
|
"body": {
|
|
@@ -12836,6 +12986,52 @@ const SCREENS = runtimeSetting({
|
|
|
12836
12986
|
}
|
|
12837
12987
|
}
|
|
12838
12988
|
},
|
|
12989
|
+
{
|
|
12990
|
+
"id": "himi_groups.rows.collection.empty-source",
|
|
12991
|
+
"body": {
|
|
12992
|
+
"package": "himalaya",
|
|
12993
|
+
"type": "VStack",
|
|
12994
|
+
"props": {
|
|
12995
|
+
"spacing": 8,
|
|
12996
|
+
"alignment": "center",
|
|
12997
|
+
"children": [
|
|
12998
|
+
{
|
|
12999
|
+
"id": "",
|
|
13000
|
+
"body": {
|
|
13001
|
+
"package": "himalaya",
|
|
13002
|
+
"type": "Icon",
|
|
13003
|
+
"props": {
|
|
13004
|
+
"name": "inbox",
|
|
13005
|
+
"size": 28,
|
|
13006
|
+
"tint": "textTertiary"
|
|
13007
|
+
}
|
|
13008
|
+
},
|
|
13009
|
+
"modifiers": {
|
|
13010
|
+
"accessibilityRole": "decorative"
|
|
13011
|
+
}
|
|
13012
|
+
},
|
|
13013
|
+
{
|
|
13014
|
+
"id": "",
|
|
13015
|
+
"body": {
|
|
13016
|
+
"package": "himalaya",
|
|
13017
|
+
"type": "Text",
|
|
13018
|
+
"props": {
|
|
13019
|
+
"text": "$service:himiBrandedGroups.collection.emptySourceText",
|
|
13020
|
+
"style": "body",
|
|
13021
|
+
"color": "textSecondary"
|
|
13022
|
+
}
|
|
13023
|
+
}
|
|
13024
|
+
}
|
|
13025
|
+
]
|
|
13026
|
+
}
|
|
13027
|
+
},
|
|
13028
|
+
"modifiers": {
|
|
13029
|
+
"hiddenPath": "$service:himiBrandedGroups.collection.noEmptySource",
|
|
13030
|
+
"padding": {
|
|
13031
|
+
"bottom": 12
|
|
13032
|
+
}
|
|
13033
|
+
}
|
|
13034
|
+
},
|
|
12839
13035
|
{
|
|
12840
13036
|
"id": "",
|
|
12841
13037
|
"body": {
|
|
@@ -30,6 +30,9 @@ export interface CollectionConfig {
|
|
|
30
30
|
* `screenId` opens that screen with the row id; without it the verb reuses the
|
|
31
31
|
* row's own tap action (the detail screen that owns the verb). */
|
|
32
32
|
primaryVerb?: { label: string; screenId?: string };
|
|
33
|
+
/** A state field the DOMAIN narrows `rows` by (e.g. a category picker). While it is set,
|
|
34
|
+
* zero rows is a filtered result, not an empty source. */
|
|
35
|
+
narrowedBy?: string;
|
|
33
36
|
}
|
|
34
37
|
/** At or below this many records, with no query/filter narrowing them and no further
|
|
35
38
|
* page, the list/grid toggle, Refine, chips, search and count are noise. */
|
|
@@ -41,7 +44,7 @@ export const COLLECTIONS: Record<string, CollectionConfig> = {
|
|
|
41
44
|
defaultFilter: 'value:Upcoming', searchPlaceholder: 'Exact booking ID', filterValues: ['Upcoming', 'Past', 'Cancelled'],
|
|
42
45
|
sortLabels: { default: 'Soonest', az: 'Oldest', za: 'Latest' } },
|
|
43
46
|
himiEvents: { rows: 'results', title: 'title', subtitle: 'dateLine', image: 'image', view: 'grid', backendQuery: true, searchPlaceholder: 'Exact event title', filterValues: ['Upcoming', 'Past'], sortLabels: { default: 'Date', az: 'Title A–Z', za: 'Title Z–A' }, primaryVerb: { label: 'Register' } },
|
|
44
|
-
himiBlogFeed: { rows: 'posts', title: 'title', subtitle: 'excerpt', image: 'image', filter: 'category', filterValuesFrom: 'categories', view: 'grid' },
|
|
47
|
+
himiBlogFeed: { rows: 'posts', title: 'title', subtitle: 'excerpt', image: 'image', filter: 'category', filterValuesFrom: 'categories', view: 'grid', narrowedBy: 'selectedCategoryId' },
|
|
45
48
|
himiOwnerLiteProducts: { rows: 'products', title: 'name', subtitle: 'price', image: 'image', view: 'grid', backendQuery: true },
|
|
46
49
|
himiOwnerModules: { instanceInput: 'module', rows: 'rows', title: 'title', subtitle: 'subtitle', image: 'image', filter: 'statusLabel', view: 'list', paged: true, reviewAction: 'prepareRecord', reviewSelectedAction: 'prepareSelected' },
|
|
47
50
|
himiOwnerLiteServices: { rows: 'services', title: 'name', subtitle: 'subtitle', view: 'list', backendQuery: true, searchPlaceholder: 'Service name starts with…' },
|
|
@@ -122,14 +122,38 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
122
122
|
const errored = s.status === 'error' || s.isErrored === true || s.errored === true || backendState?.status === 'error';
|
|
123
123
|
const domainError = typeof s.error === 'string' ? s.error.trim() : '';
|
|
124
124
|
const queryError = typeof backendState?.error === 'string' ? backendState.error.trim() : '';
|
|
125
|
-
|
|
125
|
+
// Some domains carry their failure sentence in `emptyText` (portfolio, podcasts);
|
|
126
|
+
// the screen folds that node into this block, so keep the domain's own words.
|
|
127
|
+
const domainEmptyError = errored && typeof s.emptyText === 'string' ? s.emptyText.trim() : '';
|
|
128
|
+
const errorMessage = queryError || domainError || domainEmptyError || copyParam('collection.loadError', 'This collection could not load. Try again.');
|
|
126
129
|
const canRetry = !!backend || typeof def.actions?.refresh === 'function' || typeof def.actions?.load === 'function' || typeof def.actions?.collectionRetry === 'function';
|
|
130
|
+
// Wix refused the visitor: retrying cannot help, signing in can.
|
|
131
|
+
const signInRequired = errored && s.signInRequired === true;
|
|
132
|
+
// "the source has nothing" and "your filter matched nothing" are
|
|
133
|
+
// different states. Only the second may offer "Clear filters", and the list chrome
|
|
134
|
+
// (view, refine, chips, counter, search) means nothing over a source with no rows.
|
|
135
|
+
// Loaded-row collections hold the whole source in `rows`, so zero rows IS an empty
|
|
136
|
+
// source. A backend query returns only matches, so zero rows is source-empty only
|
|
137
|
+
// when nothing narrowed it.
|
|
138
|
+
// Anything the customer (or the domain) narrowed the result by. While narrowed, zero rows
|
|
139
|
+
// is "your filter matched nothing" and the controls that got them here must stay.
|
|
140
|
+
// The DOMAIN's own filter (config.narrowedBy, e.g. blog category) narrowed the rows: the
|
|
141
|
+
// domain owns that empty state and its clear action. The shared "Clear filters" block
|
|
142
|
+
// cannot reset a domain filter, so it never shows for one.
|
|
143
|
+
const domainNarrowed = !!config.narrowedBy && !!s[config.narrowedBy];
|
|
127
144
|
// A default view is what the screen opens on; anything else is the member's own
|
|
128
145
|
// narrowing, which keeps the chrome (and the Clear that undoes it) on screen.
|
|
129
146
|
// "All" and the collection's own default (e.g. Upcoming) are both un-narrowed: Clear
|
|
130
147
|
// 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
|
|
148
|
+
const narrowed = !!prefs.query.trim() || (prefs.filter !== 'all' && prefs.filter !== initialCollection(config).filter) || domainNarrowed;
|
|
149
|
+
const sourceEmpty = !loading && !errored && rows.length === 0 &&
|
|
150
|
+
(!(backend && config.backendQuery) || !narrowed) && !domainNarrowed;
|
|
151
|
+
const emptySourceText = (typeof s.emptyText === 'string' && s.emptyText.trim()) || copyParam('collection.emptySource', 'Nothing here yet');
|
|
152
|
+
// Chrome is noise over a small un-narrowed list (fewer than COLLECTION_CHROME_MIN_ITEMS
|
|
153
|
+
// records, no further page), over an empty source, and before the FIRST load or an
|
|
154
|
+
// un-narrowed failure. A re-query while typing keeps it (and the search field's focus).
|
|
155
|
+
const hideChrome = (!narrowed && !s.nextCursor && projected.loaded < COLLECTION_CHROME_MIN_ITEMS)
|
|
156
|
+
|| sourceEmpty || ((loading || errored) && rows.length === 0 && !narrowed);
|
|
133
157
|
return { ...s, collection: { ...prefs, ...projected,
|
|
134
158
|
hideChrome, noActiveCriteria: !narrowed,
|
|
135
159
|
viewName, viewMessage, saveMessage, noSavedViews: prefs.savedViews.length === 0,
|
|
@@ -138,8 +162,15 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
138
162
|
noPageError: s.pageError !== true,
|
|
139
163
|
noOffline: s.fromCache !== true,
|
|
140
164
|
noError: !errored,
|
|
141
|
-
noRetry: !canRetry,
|
|
165
|
+
noRetry: !canRetry || signInRequired,
|
|
166
|
+
noSignIn: !signInRequired,
|
|
167
|
+
errorTitle: signInRequired ? copyParam('collection.signInTitle', 'Sign in to see this') : copyParam('collection.loadErrorTitle', 'This collection could not load'),
|
|
142
168
|
errorMessage,
|
|
169
|
+
noLoading: !loading,
|
|
170
|
+
// De-dup against a domain that paints its OWN empty block (screen-kit emptyBlock is
|
|
171
|
+
// gated on the domain's top-level `noEmpty`): only one empty state ever shows.
|
|
172
|
+
noEmptySource: !sourceEmpty || s.noEmpty === false,
|
|
173
|
+
emptySourceText,
|
|
143
174
|
hideList: prefs.view !== 'list', hideGrid: prefs.view !== 'grid',
|
|
144
175
|
hideComfortable: prefs.density !== 'comfortable', hideCompact: prefs.density !== 'compact',
|
|
145
176
|
selectingLabel: prefs.selecting ? copyParam('collection.done', 'Done') : copyParam('collection.select', 'Select'),
|
|
@@ -147,7 +178,7 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
147
178
|
cannotSaveSelected: !prefs.selectedIds.length || prefs.selectedIds.some(id => !rows.some(row => collectionId(row) === id)),
|
|
148
179
|
filtersPresented, previewPresented: !!previewId, preview: projected.items.filter(row => row.collectionId === previewId),
|
|
149
180
|
persistenceLabel: persisted.available ? copyParam('collection.onDevice', 'Saved on this device') : copyParam('collection.sessionOnly', 'Choices last for this session'),
|
|
150
|
-
noEmpty: loading || errored || projected.items.length > 0,
|
|
181
|
+
noEmpty: loading || errored || sourceEmpty || domainNarrowed || projected.items.length > 0,
|
|
151
182
|
summary: backend && config.backendQuery
|
|
152
183
|
? (s.fromCache ? copyParam('collection.cached', 'Saved offline · may be outdated')
|
|
153
184
|
: typeof s.total === 'number' ? `${projected.items.length} / ${s.total} ${copyParam('collection.results', 'results')}`
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Empty-collection flags for descriptors.
|
|
2
|
+
//
|
|
3
|
+
// A bound Grid/LazyList with zero rows still renders a zero-height box, and a stack
|
|
4
|
+
// allocates its `spacing` between CHILDREN, not between painted children — so every
|
|
5
|
+
// empty list left a full gap of blank on the screen (the measure pass's `dead-gap`, on
|
|
6
|
+
// iOS and Android as much as on web). `hiddenWhen` hides on a TRUE scalar only, and an
|
|
7
|
+
// empty array is not one, so a descriptor cannot gate a list on its own rows.
|
|
8
|
+
//
|
|
9
|
+
// `withEmptyFlags(def, { rows: "noRows" })` derives `noRows = rows is empty` into the
|
|
10
|
+
// initial state and after EVERY action (sync or async), so a builder can write
|
|
11
|
+
// `hiddenWhen(grid(...), "$service:svc.noRows")` without each reducer remembering to.
|
|
12
|
+
type State = Record<string, unknown>;
|
|
13
|
+
type Action = (s: State, ...args: unknown[]) => unknown;
|
|
14
|
+
|
|
15
|
+
export function withEmptyFlags<D extends { state: object; actions?: object }>(def: D, flags: Record<string, string>): D {
|
|
16
|
+
const derive = <T>(s: T): T => {
|
|
17
|
+
if (!s || typeof s !== "object") return s;
|
|
18
|
+
const out = { ...(s as State) };
|
|
19
|
+
for (const [rows, flag] of Object.entries(flags)) {
|
|
20
|
+
const v = out[rows];
|
|
21
|
+
out[flag] = !Array.isArray(v) || v.length === 0;
|
|
22
|
+
}
|
|
23
|
+
return out as T;
|
|
24
|
+
};
|
|
25
|
+
const actions: Record<string, Action> = {};
|
|
26
|
+
for (const [name, action] of Object.entries((def.actions ?? {}) as Record<string, Action>)) {
|
|
27
|
+
actions[name] = (s, ...args) => {
|
|
28
|
+
const r = action(s, ...args);
|
|
29
|
+
return r && typeof (r as Promise<unknown>).then === "function" ? (r as Promise<unknown>).then(derive) : derive(r);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return { ...def, state: derive(def.state), actions } as D;
|
|
33
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Tier-5 bundle: Wix Spaces clone — What's New (ON-DEVICE, account-level).
|
|
2
2
|
import { defineService } from "@himalaya/state";
|
|
3
|
+
import { withEmptyFlags } from "../_shared/empty-flags.js";
|
|
3
4
|
import { listAnnouncements, type WixAnnouncement } from "@himalaya/wix-new-releases";
|
|
4
5
|
|
|
5
6
|
interface Row { id: string; name: string; subtitle: string }
|
|
@@ -10,7 +11,7 @@ function norm(a: WixAnnouncement, i: number): Row {
|
|
|
10
11
|
return { id: aa.id || `a${i}`, name: aa.title || "Announcement", subtitle: aa.description || aa.bodyText || "" };
|
|
11
12
|
}
|
|
12
13
|
|
|
13
|
-
const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesWhatsNew", {
|
|
14
|
+
const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesWhatsNew", withEmptyFlags({
|
|
14
15
|
state: { status: "loading", items: [], emptyText: "" },
|
|
15
16
|
actions: {
|
|
16
17
|
load: async (s) => {
|
|
@@ -21,6 +22,6 @@ const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesWhatsNew", {
|
|
|
21
22
|
} catch { return { ...s, status: "ready", items: [], emptyText: "Nothing new right now" }; }
|
|
22
23
|
},
|
|
23
24
|
},
|
|
24
|
-
});
|
|
25
|
+
}, { items: "noItems" }));
|
|
25
26
|
svc.load();
|
|
26
27
|
export { svc };
|