@wix/himalaya-cli 0.1034.0 → 0.1036.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 +7 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/events/src/display.d.ts +13 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-events.mjs +28 -6
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores-collections.mjs +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores.mjs +7 -1
- package/dist/cli.mjs +25 -19
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/sdk-reference.json +16 -4
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +72 -175
- package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/beauty-salon/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/beauty-salon/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/beauty-salon/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/beauty-salon/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/beauty-salon/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/beauty-salon/tier5-src/himi-branded-lite-plans/index.ts +1 -1
- package/templates/beauty-salon/tier5-src/wix-spaces-collections/index.ts +1 -1
- package/templates/beauty-salon/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/beauty-salon-owner/dev/index.ts +84 -599
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/beauty-salon-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/branded-lite/dev/index.ts +178 -264
- package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/branded-lite/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/branded-lite/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/branded-lite/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/branded-lite/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-cms/index.ts +5 -5
- package/templates/branded-lite/tier5-src/himi-branded-lite-coupons/index.ts +33 -7
- package/templates/branded-lite/tier5-src/himi-branded-lite-donations/index.ts +3 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-forms/index.ts +11 -10
- package/templates/branded-lite/tier5-src/himi-branded-lite-giftcards/index.ts +3 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-invoices/index.ts +3 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-loyalty/index.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-plans/index.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-reserve/index.ts +5 -3
- package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/branded-lite/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/branded-lite/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/branded-lite/tier5-src/wix-spaces-collections/index.ts +1 -1
- package/templates/branded-lite/tier5-src/wix-spaces-forum/index.ts +7 -1
- package/templates/branded-lite/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/community-club/dev/index.ts +62 -81
- package/templates/community-club/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/community-club/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/community-club/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/community-club/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/community-club/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/community-club/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/community-club/tier5-src/himi-branded-lite-cms/index.ts +5 -5
- package/templates/community-club/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/community-club/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/community-club/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/community-club/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/community-club/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/community-club-owner/dev/index.ts +84 -599
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/community-club-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/community-club-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/community-club-owner/tier5-src/himi-owner-lite-events/index.ts +1 -0
- package/templates/events-meetups/dev/index.ts +60 -79
- package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/events-meetups/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/events-meetups/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/events-meetups/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/events-meetups/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/events-meetups/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/events-meetups/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/events-meetups/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/events-meetups/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/events-meetups-owner/dev/index.ts +84 -543
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/events-meetups-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/events-meetups-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-events/index.ts +1 -0
- package/templates/gym-fitness/dev/index.ts +73 -204
- package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/gym-fitness/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/gym-fitness/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/gym-fitness/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/gym-fitness/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/gym-fitness/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/gym-fitness/tier5-src/himi-branded-lite-plans/index.ts +1 -1
- package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/gym-fitness/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/gym-fitness/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/gym-fitness/tier5-src/wix-spaces-collections/index.ts +1 -1
- package/templates/gym-fitness/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/gym-fitness-owner/dev/index.ts +84 -627
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/gym-fitness-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-events/index.ts +1 -0
- package/templates/himi-chat/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/nonprofit-cause/dev/index.ts +71 -90
- package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/nonprofit-cause/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/nonprofit-cause/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/nonprofit-cause/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/nonprofit-cause/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-plans/index.ts +1 -1
- package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/nonprofit-cause/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/nonprofit-cause/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/nonprofit-cause/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/nonprofit-cause-owner/dev/index.ts +84 -571
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/nonprofit-cause-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-events/index.ts +1 -0
- package/templates/owner-lite/dev/index.ts +84 -627
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/owner-lite/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/owner-lite/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/owner-lite/tier5-src/himi-owner-lite-events/index.ts +1 -0
- package/templates/podcast-creator/dev/index.ts +71 -90
- package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/podcast-creator/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/podcast-creator/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/podcast-creator/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/podcast-creator/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/podcast-creator/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/podcast-creator/tier5-src/himi-branded-lite-plans/index.ts +1 -1
- package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/podcast-creator/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/podcast-creator/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/podcast-creator/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/podcast-creator-owner/dev/index.ts +84 -599
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/podcast-creator-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-events/index.ts +1 -0
- package/templates/portfolio-creative/dev/index.ts +62 -137
- package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/portfolio-creative/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/portfolio-creative/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/portfolio-creative/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/portfolio-creative/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/portfolio-creative/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/portfolio-creative/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/portfolio-creative/tier5-src/wix-spaces-collections/index.ts +1 -1
- package/templates/portfolio-creative/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/portfolio-creative-owner/dev/index.ts +84 -599
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/portfolio-creative-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/restaurant/dev/index.ts +124 -101
- package/templates/restaurant/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/restaurant/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/restaurant/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/restaurant/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/restaurant/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/restaurant/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/restaurant/tier5-src/himi-branded-lite-reserve/index.ts +5 -3
- package/templates/restaurant/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/restaurant/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/restaurant/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/restaurant/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/restaurant-owner/dev/index.ts +84 -627
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/restaurant-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/restaurant-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-events/index.ts +1 -0
- package/templates/retail-store/dev/index.ts +59 -106
- package/templates/retail-store/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/retail-store/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/retail-store/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/retail-store/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/retail-store/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/retail-store/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/retail-store/tier5-src/wix-spaces-collections/index.ts +1 -1
- package/templates/retail-store/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/retail-store-owner/dev/index.ts +84 -571
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/retail-store-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/retail-store-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/yoga-studio/dev/index.ts +73 -148
- package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/yoga-studio/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/yoga-studio/tier5-src/_shared/himi-restaurants.ts +4 -4
- package/templates/yoga-studio/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/yoga-studio/tier5-src/_shared/wix-service-price.ts +1 -1
- package/templates/yoga-studio/tier5-src/himi-branded-lite-info/index.ts +5 -2
- package/templates/yoga-studio/tier5-src/himi-branded-lite-plans/index.ts +1 -1
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +1 -1
- package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +1 -1
- package/templates/yoga-studio/tier5-src/himi-events-list/index.ts +20 -4
- package/templates/yoga-studio/tier5-src/himi-events-my-events/index.ts +2 -2
- package/templates/yoga-studio/tier5-src/wix-spaces-whats-new/index.ts +4 -4
- package/templates/yoga-studio-owner/dev/index.ts +84 -571
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +22 -6
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +16 -9
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +19 -5
- package/templates/yoga-studio-owner/tier5-src/_shared/engine-intl.ts +51 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/owner-load-error.ts +49 -0
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-events/index.ts +1 -0
|
@@ -18,6 +18,20 @@ type Reducer = (s: State, ...args: unknown[]) => State | undefined | Promise<Sta
|
|
|
18
18
|
const object = (x: unknown): State => x && typeof x === 'object' && !Array.isArray(x) ? x as State : {};
|
|
19
19
|
const str = (arg: unknown, key: string): string => typeof arg === 'string' ? arg : String(object(arg)[key] ?? '');
|
|
20
20
|
|
|
21
|
+
/** The toolbar count line — "12 dishes", or "3 of 12 dishes" while a filter narrows the list.
|
|
22
|
+
*
|
|
23
|
+
* It used to read "12 / 12 loaded" and "2 / 2 results" ([branded-lite-qa] #3002): the numbers
|
|
24
|
+
* described the implementation (a client-side filter over a fetched page) rather than what the
|
|
25
|
+
* customer is looking at, and the slash-and-suffix wrapped onto two lines on web. When the
|
|
26
|
+
* backend total is unknown the count shown is simply what is shown; the "Load more" button is
|
|
27
|
+
* what says there is more. */
|
|
28
|
+
export function collectionSummary(o: { shown: number; loaded: number; total?: number; backend?: boolean; noun?: [string, string] }): string {
|
|
29
|
+
const [one, many] = o.noun ?? [copyParam('collection.itemOne', 'item'), copyParam('collection.itemMany', 'items')];
|
|
30
|
+
const whole = o.backend ? (typeof o.total === 'number' ? o.total : o.shown) : o.loaded;
|
|
31
|
+
const noun = (whole === 1 ? one : many);
|
|
32
|
+
return o.shown < whole ? `${o.shown} ${copyParam('collection.of', 'of')} ${whole} ${noun}` : `${o.shown} ${o.shown === 1 ? one : many}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
21
35
|
/** Opt-in decorator. Domain reducers remain authoritative; collection preferences
|
|
22
36
|
* survive reducers which replace their entire state, including async refreshes. */
|
|
23
37
|
export function decorateCollection(name: string, def: { state: State; actions?: Record<string, Reducer> }, saving?: CollectionSaving, backend?: BackendCollection) {
|
|
@@ -179,11 +193,11 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
179
193
|
filtersPresented, previewPresented: !!previewId, preview: projected.items.filter(row => row.collectionId === previewId),
|
|
180
194
|
persistenceLabel: persisted.available ? copyParam('collection.onDevice', 'Saved on this device') : copyParam('collection.sessionOnly', 'Choices last for this session'),
|
|
181
195
|
noEmpty: loading || errored || sourceEmpty || domainNarrowed || projected.items.length > 0,
|
|
182
|
-
summary: backend && config.backendQuery
|
|
183
|
-
?
|
|
184
|
-
|
|
185
|
-
:
|
|
186
|
-
|
|
196
|
+
summary: backend && config.backendQuery && s.fromCache
|
|
197
|
+
? copyParam('collection.cached', 'Saved offline · may be outdated')
|
|
198
|
+
: collectionSummary({ shown: projected.items.length, loaded: projected.loaded, backend: !!(backend && config.backendQuery),
|
|
199
|
+
total: typeof s.total === 'number' ? s.total : undefined, noun: config.countNoun
|
|
200
|
+
? [copyParam(`collection.${name}.countOne`, config.countNoun[0]), copyParam(`collection.${name}.countMany`, config.countNoun[1])] : undefined }),
|
|
187
201
|
selectedSummary: `${prefs.selectedIds.length} ${copyParam('collection.selected', 'selected')}`,
|
|
188
202
|
filterChoices,
|
|
189
203
|
chips: config.filterValues ? filterChoices.filter(choice => ['all', 'saved', prefs.filter].includes(choice.id)) : filterChoices,
|
|
@@ -352,3 +352,54 @@ export function compareDateDesc(a: string, b: string): number {
|
|
|
352
352
|
if (bBad) return -1;
|
|
353
353
|
return tb - ta;
|
|
354
354
|
}
|
|
355
|
+
|
|
356
|
+
// --- [branded-lite-qa] #3079: one pattern per fact ---------------------------------------
|
|
357
|
+
//
|
|
358
|
+
// Before these existed, four screens formatted the same money four ways — Shop "69.00 ₪" (Wix's
|
|
359
|
+
// pre-formatted string), Services "₪70" (0 decimals), Menu "₪32.00", Plans "$24" — and two
|
|
360
|
+
// screens formatted the same clock two ways (Events "9:00 PM-11:00 PM", Reserve "20:00").
|
|
361
|
+
// Customers read that as sloppiness, and a whole "₪70" beside "₪69.50" reads as a different
|
|
362
|
+
// kind of number. So: one money pattern, one clock, one range.
|
|
363
|
+
|
|
364
|
+
// Money uses `formatCurrency(amount, currency, "en")` — the currency's NATURAL decimals
|
|
365
|
+
// ("₪70.00", "¥500"). Passing 0 fraction digits for whole amounts is what made a list read
|
|
366
|
+
// "₪70 · ₪69.50".
|
|
367
|
+
|
|
368
|
+
const KNOWN_SYMBOLS = new Set(Object.values(CURRENCY_SYMBOL));
|
|
369
|
+
|
|
370
|
+
/** Wix hands some prices over PRE-formatted in the site's regional style — "69.00 ₪" with the
|
|
371
|
+
* symbol trailing, often wrapped in bidi marks. Reorder those to the house pattern ("₪69.00") so
|
|
372
|
+
* they match every price we format ourselves. Only an en-shaped number ("69.00", "1,234.50") with
|
|
373
|
+
* a known trailing symbol is reordered: a comma-decimal or space-grouped string ("69,00 €",
|
|
374
|
+
* "1 234,56 €") is kept as Wix wrote it, because half-converting it would be worse. Anything else
|
|
375
|
+
* ("Market price") is returned trimmed. The store SDK's product price applies the same rule. */
|
|
376
|
+
export function normalizeFormattedPrice(formatted: string): string {
|
|
377
|
+
const raw = (formatted || "").replace(/[]/g, "").trim();
|
|
378
|
+
const m = /^(-?)(\d{1,3}(?:,\d{3})*(?:\.\d+)?|\d+(?:\.\d+)?)[\s ]*(\S+)$/.exec(raw);
|
|
379
|
+
if (!m || !KNOWN_SYMBOLS.has(m[3])) return raw;
|
|
380
|
+
return `${m[1]}${m[3]}${m[2]}`;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function clockParts(d: Date, locale: string): { time: string; meridiem: string } {
|
|
384
|
+
const full = hasIntl()
|
|
385
|
+
? new Intl.DateTimeFormat(locale, { hour: "numeric", minute: "2-digit", hour12: true }).format(d)
|
|
386
|
+
: clock12(d);
|
|
387
|
+
// ICU puts a narrow no-break space before the meridiem; normalize so callers can split on it.
|
|
388
|
+
const clean = full.replace(/[ ]/g, " ");
|
|
389
|
+
const m = /^(.*?)\s*([AP]\.?M\.?)$/i.exec(clean);
|
|
390
|
+
return m ? { time: m[1], meridiem: m[2] } : { time: clean, meridiem: "" };
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/** "8:00 PM" — the one clock every customer screen uses (12-hour, en-US shape). */
|
|
394
|
+
export function formatClock(date: Date, locale = "en-US"): string {
|
|
395
|
+
const { time, meridiem } = clockParts(date, locale);
|
|
396
|
+
return meridiem ? `${time} ${meridiem}` : time;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/** Is this ISO instant before `now`? A missing or unparseable value is NOT past — "no expiry"
|
|
400
|
+
* must never classify an offer as expired. */
|
|
401
|
+
export function isPastDate(iso: string | undefined | null, now: number = Date.now()): boolean {
|
|
402
|
+
if (!iso) return false;
|
|
403
|
+
const t = Date.parse(iso);
|
|
404
|
+
return !Number.isNaN(t) && t < now;
|
|
405
|
+
}
|
|
@@ -11,7 +11,7 @@ import { wixMediaUrl, type WixImageSize } from "@himalaya/wix-media";
|
|
|
11
11
|
// copier recognizes + carries the dependency; resolves to the same file here
|
|
12
12
|
// and in the scaffolded tier5-src/_shared/ layout.
|
|
13
13
|
import { cleanTitle, initials } from "../_shared/himi-text.js";
|
|
14
|
-
import { formatCurrency } from "../_shared/engine-intl.js";
|
|
14
|
+
import { formatCurrency, normalizeFormattedPrice } from "../_shared/engine-intl.js";
|
|
15
15
|
|
|
16
16
|
/** One dish tile/row: the media-XOR-initials card contract every himi list
|
|
17
17
|
* uses, plus a formatted price line and the templated detail screen id. */
|
|
@@ -97,13 +97,13 @@ export function itemPriceLine(item: WixItem): string {
|
|
|
97
97
|
| { price?: unknown; currency?: unknown; formattedPrice?: unknown }
|
|
98
98
|
| undefined;
|
|
99
99
|
const formatted = typeof info?.formattedPrice === "string" ? info.formattedPrice.trim() : "";
|
|
100
|
-
if (formatted) return formatted;
|
|
100
|
+
if (formatted) return normalizeFormattedPrice(formatted);
|
|
101
101
|
const price = info?.price;
|
|
102
102
|
if (price == null || price === "" || Number.isNaN(Number(price))) return "";
|
|
103
103
|
const currency = typeof info?.currency === "string" ? info.currency : "";
|
|
104
104
|
if (!currency) return `${price}`;
|
|
105
105
|
try {
|
|
106
|
-
return formatCurrency(Number(price), currency, "en"
|
|
106
|
+
return formatCurrency(Number(price), currency, "en");
|
|
107
107
|
} catch {
|
|
108
108
|
return `${price}`;
|
|
109
109
|
}
|
|
@@ -149,7 +149,7 @@ export function itemPriceVariants(item: WixItem): Array<{ id: string; name: stri
|
|
|
149
149
|
let priceLine = `${price}`;
|
|
150
150
|
if (currency) {
|
|
151
151
|
try {
|
|
152
|
-
priceLine = formatCurrency(Number(price), currency, "en"
|
|
152
|
+
priceLine = formatCurrency(Number(price), currency, "en");
|
|
153
153
|
} catch { /* keep the bare amount */ }
|
|
154
154
|
}
|
|
155
155
|
rows.push({ id: typeof node.id === "string" && node.id ? node.id : `variant-${index}`, name: name || "Option", priceLine });
|
|
@@ -74,6 +74,54 @@ const SITE_CONTEXT_CODES = ["MISSING_METASITE_ID", "MISSING_REQUEST_SITE_CONTEXT
|
|
|
74
74
|
* message and starts being a payload dump. */
|
|
75
75
|
const MAX_RAW = 200;
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* A TRANSPORT failure: the request never got an HTTP answer at all.
|
|
79
|
+
*
|
|
80
|
+
* Each host describes one in its own platform's words, and every one of them is a
|
|
81
|
+
* diagnostic dump rather than a message. iOS's JSWorker hands a worker the Swift
|
|
82
|
+
* description of the `NSError` —
|
|
83
|
+
* `Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server."
|
|
84
|
+
* UserInfo={… NSErrorFailingURLStringKey=http://127.0.0.1:8178/__dev/wix/proxy, …}`
|
|
85
|
+
* — which Aria painted verbatim: the domain, the code, and the local server's
|
|
86
|
+
* own URL. Android's bridge carries the `java.net` exception text, and a browser's
|
|
87
|
+
* fetch rejects with "Failed to fetch" / "Load failed" / "NetworkError …".
|
|
88
|
+
*
|
|
89
|
+
* Only a message with NO HTTP status qualifies: a status means Wix answered, and
|
|
90
|
+
* that case keeps its own reductions below.
|
|
91
|
+
*/
|
|
92
|
+
const TRANSPORT = [
|
|
93
|
+
/\bError Domain=\w+/, // any Cocoa NSError description
|
|
94
|
+
/\bNSURLErrorDomain\b/,
|
|
95
|
+
/\bjava\.(?:net|io)\.\w+(?:Exception|Error)\b/,
|
|
96
|
+
/\b(?:UnknownHost|Connect|SocketTimeout|NoRouteToHost|SSLHandshake)Exception\b/,
|
|
97
|
+
// Android's WebViewJSWorker bridges `e.message ?: e.javaClass.simpleName`, so
|
|
98
|
+
// the class name is usually absent and only OkHttp's own message arrives.
|
|
99
|
+
/^Failed to connect to \S/,
|
|
100
|
+
/^Unable to resolve host\b/,
|
|
101
|
+
/\b(?:Connection refused|Network is unreachable|Software caused connection abort)\b/,
|
|
102
|
+
/^(?:timeout|Read timed out|connect timed out)$/i,
|
|
103
|
+
/\bFailed to fetch\b/,
|
|
104
|
+
/\bNetworkError when attempting to fetch\b/,
|
|
105
|
+
/^(?:TypeError: )?Load failed$/,
|
|
106
|
+
/\bnet::ERR_[A-Z_]+/,
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
/** Did this failure happen below HTTP — no answer from Wix at all? */
|
|
110
|
+
export function isTransportFailure(e: unknown): boolean {
|
|
111
|
+
const msg = String((e as Error)?.message ?? e ?? "");
|
|
112
|
+
if (STATUS.test(msg)) return false;
|
|
113
|
+
return TRANSPORT.some((re) => re.test(msg));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The one sentence for a transport failure. Copy-as-configuration: the key is
|
|
117
|
+
* under `ownerCommon.`, which every owner screen (Aria included) forwards. */
|
|
118
|
+
export function ownerTransportFailureText(): string {
|
|
119
|
+
return copyParam(
|
|
120
|
+
"ownerCommon.networkUnreachable",
|
|
121
|
+
"Couldn’t reach Wix. Check your connection and try again.",
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
77
125
|
/**
|
|
78
126
|
* Reduce a wire failure to something a PERSON can read.
|
|
79
127
|
*
|
|
@@ -85,6 +133,7 @@ const MAX_RAW = 200;
|
|
|
85
133
|
* markup; a long non-HTML body is truncated for the same reason.
|
|
86
134
|
*/
|
|
87
135
|
function humanWireError(msg: string): string {
|
|
136
|
+
if (isTransportFailure(msg)) return ownerTransportFailureText();
|
|
88
137
|
const status = STATUS.exec(msg)?.[1];
|
|
89
138
|
// A JSON ENVELOPE or a NAMED REASON CODE is the machine's word for it, and the
|
|
90
139
|
// owner gets neither. Both reductions used to live in `ownerDisplayError` only,
|
|
@@ -119,7 +119,7 @@ export function formatServicePrice(service: unknown): string {
|
|
|
119
119
|
if (amount == null) return "";
|
|
120
120
|
const currency = serviceCurrency(service);
|
|
121
121
|
try {
|
|
122
|
-
return formatCurrency(amount, currency, "en"
|
|
122
|
+
return formatCurrency(amount, currency, "en");
|
|
123
123
|
} catch {
|
|
124
124
|
return `${amount}`;
|
|
125
125
|
}
|
|
@@ -112,7 +112,10 @@ const svc = defineService<State, {
|
|
|
112
112
|
// Probe before revealing anything picker-shaped (spec R8) — on a customer build this
|
|
113
113
|
// stays false and the whole subtree is hidden.
|
|
114
114
|
const canPick = await pickerAvailable();
|
|
115
|
-
|
|
115
|
+
// The runtime line names the internal platform ("HimalayaCore 0.0.1") — a number for
|
|
116
|
+
// whoever debugs the build, not for a white-label app's customer ([branded-lite-qa]
|
|
117
|
+
// #3002/#3083). It shows only on a build that opted into the QA picker.
|
|
118
|
+
next = { ...next, pickerAvailable: canPick, pickerHidden: !canPick, runtimeLine: canPick ? next.runtimeLine : "" };
|
|
116
119
|
if (canPick) {
|
|
117
120
|
// `active()` is more precise than app-info's releasePinned: it also says WHICH pin
|
|
118
121
|
// (user vs baked) is holding the release.
|
|
@@ -122,7 +125,7 @@ const svc = defineService<State, {
|
|
|
122
125
|
}
|
|
123
126
|
}
|
|
124
127
|
} catch {
|
|
125
|
-
next = { ...next, pickerAvailable: false, pickerHidden: true };
|
|
128
|
+
next = { ...next, pickerAvailable: false, pickerHidden: true, runtimeLine: "" };
|
|
126
129
|
}
|
|
127
130
|
return next;
|
|
128
131
|
},
|
|
@@ -26,7 +26,7 @@ function fromCategory(c: StoreCategory): Row {
|
|
|
26
26
|
function fromCollection(c: WixCollection): Row {
|
|
27
27
|
const cc = c as unknown as { id?: string; name?: string; numberOfProducts?: number };
|
|
28
28
|
const n = cc.numberOfProducts;
|
|
29
|
-
return { id: cc.id || cc.name || "collection", name: cc.name || "Collection", subtitle: n != null ? `${n} ${n === 1 ? "product" : "products"}` : "" };
|
|
29
|
+
return { id: cc.id || cc.name || "collection", name: cc.name || "Collection", subtitle: n != null && n > 0 ? `${n} ${n === 1 ? "product" : "products"}` : "" };
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
type Loaded = { ok: true; rows: Row[] } | { ok: false; error: string };
|
|
@@ -4,7 +4,7 @@ import { withEmptyFlags } from "../_shared/empty-flags.js";
|
|
|
4
4
|
import { listAnnouncements, type WixAnnouncement } from "@himalaya/wix-new-releases";
|
|
5
5
|
|
|
6
6
|
interface Row { id: string; name: string; subtitle: string }
|
|
7
|
-
interface S { status: "loading" | "ready"; items: Row[]; emptyText: string }
|
|
7
|
+
interface S { status: "loading" | "ready"; items: Row[]; emptyText: string; /** hiddenWhen hides on true: the empty card shows only once loaded AND empty. */ noEmpty: boolean }
|
|
8
8
|
|
|
9
9
|
function norm(a: WixAnnouncement, i: number): Row {
|
|
10
10
|
const aa = a as unknown as { id?: string; title?: string; bodyText?: string; description?: string };
|
|
@@ -12,14 +12,14 @@ function norm(a: WixAnnouncement, i: number): Row {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const svc = defineService<S, { load: (s: S) => Promise<S> }>("spacesWhatsNew", withEmptyFlags({
|
|
15
|
-
state: { status: "loading", items: [], emptyText: "" },
|
|
15
|
+
state: { status: "loading", items: [], emptyText: "", noEmpty: true },
|
|
16
16
|
actions: {
|
|
17
17
|
load: async (s) => {
|
|
18
18
|
try {
|
|
19
19
|
const r = await listAnnouncements(20);
|
|
20
20
|
const items = (((r as unknown as { announcements?: WixAnnouncement[] }).announcements) ?? []).map(norm);
|
|
21
|
-
return { status: "ready", items, emptyText: items.length ? "" : "Nothing new right now" };
|
|
22
|
-
} catch { return { ...s, status: "ready", items: [], emptyText: "Nothing new right now" }; }
|
|
21
|
+
return { status: "ready", items, emptyText: items.length ? "" : "Nothing new right now", noEmpty: items.length > 0 };
|
|
22
|
+
} catch { return { ...s, status: "ready", items: [], emptyText: "Nothing new right now", noEmpty: false }; }
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
}, { items: "noItems" }));
|