@wix/himalaya-cli 0.1851.0 → 0.1853.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 +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +13 -3
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{166f7ee733ea8d0fe7bba8b796232efd4f5413e22af4a8aeee20cae1069b2fd6.bin → fb500748f6c4768468f2e7f985aa67c38633077c7a98caaa6b500c7b00eea8e9.bin} +1 -1
- package/dist/browser-plane/sw.js +7 -7
- package/dist/cli.mjs +10136 -9601
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-index.md +1 -1
- package/guides/component-reference.json +2 -2
- package/guides/component-reference.md +8 -1
- package/guides/designing-himi-screens.md +5 -1
- package/guides/himi-json-output.md +13 -3
- package/guides/one-app-section-mappings.md +1 -1
- package/guides/one-app-to-himi-app.md +60 -10
- package/guides/sdk-reference.json +2 -2
- package/package.json +2 -2
- package/template-icons/bare-fashion.png +0 -0
- package/templates/bare-fashion/README.md +52 -0
- package/templates/bare-fashion/config.ts +474 -0
- package/templates/bare-fashion/dev/index.ts +16526 -0
- package/templates/bare-fashion/himalaya.content.json +70 -0
- package/templates/bare-fashion/himalaya.template.json +18 -0
- package/templates/bare-fashion/icon.png +0 -0
- package/templates/bare-fashion/platforms.json +3 -0
- package/templates/bare-fashion/tier5-src/_shared/app-locale.ts +70 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-book.ts +116 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-address-countries.ts +261 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-bag-count.ts +24 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-categories.ts +48 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-facets.ts +265 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-load-error.ts +38 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-product-card.ts +136 -0
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-store-options.ts +129 -0
- package/templates/bare-fashion/tier5-src/_shared/branded-lite-hosted.ts +282 -0
- package/templates/bare-fashion/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/bare-fashion/tier5-src/_shared/collection-query.ts +201 -0
- package/templates/bare-fashion/tier5-src/_shared/collection-service.ts +429 -0
- package/templates/bare-fashion/tier5-src/_shared/engine-intl.ts +529 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-copy.ts +123 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-layouts.ts +142 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-store-categories.ts +108 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-store-saved.ts +57 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/bare-fashion/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/bare-fashion/tier5-src/_shared/live-session.ts +172 -0
- package/templates/bare-fashion/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/bare-fashion/tier5-src/_shared/member-access.ts +63 -0
- package/templates/bare-fashion/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/bare-fashion/tier5-src/_shared/member-orders.ts +8 -0
- package/templates/bare-fashion/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/bare-fashion/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-account/index.ts +127 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-address-form/index.ts +367 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-addresses/index.ts +202 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-appearance/index.ts +73 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-cart/index.ts +540 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-collection/index.ts +111 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +241 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-nav/index.ts +56 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-order/index.ts +437 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-product/index.ts +650 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-products/index.ts +142 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-saved/index.ts +45 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-search/index.ts +199 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-shop/index.ts +79 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-sign-in/index.ts +269 -0
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-wallet/index.ts +224 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-info/index.ts +209 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-orders/index.ts +327 -0
- package/templates/bare-fashion/tier5-src/wix-spaces-collections/index.ts +48 -0
- package/templates/bare-fashion/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/bare-fashion/tier5-src/wix-spaces-view-profile/index.ts +119 -0
- package/templates/bare-fashion/tokens.json +348 -0
- package/templates/beauty-salon/dev/index.ts +223 -0
- package/templates/beauty-salon/l10n/ar.json +6 -0
- package/templates/beauty-salon/l10n/cs.json +6 -0
- package/templates/beauty-salon/l10n/da.json +6 -0
- package/templates/beauty-salon/l10n/de.json +6 -0
- package/templates/beauty-salon/l10n/el.json +6 -0
- package/templates/beauty-salon/l10n/en.json +9 -2
- package/templates/beauty-salon/l10n/es.json +6 -0
- package/templates/beauty-salon/l10n/fi.json +6 -0
- package/templates/beauty-salon/l10n/fr.json +6 -0
- package/templates/beauty-salon/l10n/he.json +5 -0
- package/templates/beauty-salon/l10n/hu.json +6 -0
- package/templates/beauty-salon/l10n/id.json +6 -0
- package/templates/beauty-salon/l10n/it.json +6 -0
- package/templates/beauty-salon/l10n/ja.json +6 -0
- package/templates/beauty-salon/l10n/ko.json +6 -0
- package/templates/beauty-salon/l10n/lt.json +6 -0
- package/templates/beauty-salon/l10n/nl.json +6 -0
- package/templates/beauty-salon/l10n/no.json +6 -0
- package/templates/beauty-salon/l10n/pl.json +6 -0
- package/templates/beauty-salon/l10n/pt.json +6 -0
- package/templates/beauty-salon/l10n/ru.json +6 -0
- package/templates/beauty-salon/l10n/sv.json +6 -0
- package/templates/beauty-salon/l10n/th.json +6 -0
- package/templates/beauty-salon/l10n/tr.json +6 -0
- package/templates/beauty-salon/l10n/uk.json +6 -0
- package/templates/beauty-salon/l10n/vi.json +6 -0
- package/templates/beauty-salon/l10n/zh.json +6 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/beauty-salon/tier5-src/_shared/lifecycle.ts +15 -0
- package/templates/beauty-salon/tier5-src/_shared/nav-member-avatar.ts +92 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-nav/index.ts +15 -6
- package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/branded-lite/dev/index.ts +2167 -0
- package/templates/branded-lite/l10n/ar.json +6 -0
- package/templates/branded-lite/l10n/cs.json +6 -0
- package/templates/branded-lite/l10n/da.json +6 -0
- package/templates/branded-lite/l10n/de.json +6 -0
- package/templates/branded-lite/l10n/el.json +6 -0
- package/templates/branded-lite/l10n/en.json +12 -5
- package/templates/branded-lite/l10n/es.json +6 -0
- package/templates/branded-lite/l10n/fi.json +6 -0
- package/templates/branded-lite/l10n/fr.json +6 -0
- package/templates/branded-lite/l10n/he.json +5 -0
- package/templates/branded-lite/l10n/hu.json +6 -0
- package/templates/branded-lite/l10n/id.json +6 -0
- package/templates/branded-lite/l10n/it.json +6 -0
- package/templates/branded-lite/l10n/ja.json +6 -0
- package/templates/branded-lite/l10n/ko.json +6 -0
- package/templates/branded-lite/l10n/lt.json +6 -0
- package/templates/branded-lite/l10n/nl.json +6 -0
- package/templates/branded-lite/l10n/no.json +6 -0
- package/templates/branded-lite/l10n/pl.json +6 -0
- package/templates/branded-lite/l10n/pt.json +6 -0
- package/templates/branded-lite/l10n/ru.json +6 -0
- package/templates/branded-lite/l10n/sv.json +6 -0
- package/templates/branded-lite/l10n/th.json +6 -0
- package/templates/branded-lite/l10n/tr.json +6 -0
- package/templates/branded-lite/l10n/uk.json +6 -0
- package/templates/branded-lite/l10n/vi.json +6 -0
- package/templates/branded-lite/l10n/zh.json +6 -0
- package/templates/branded-lite/recipes/upcoming-bookings.json +118 -6
- package/templates/branded-lite/tier5-src/_shared/access-gates.ts +0 -13
- package/templates/branded-lite/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/branded-lite/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/branded-lite/tier5-src/_shared/events-inline-options.ts +55 -3
- package/templates/branded-lite/tier5-src/_shared/events-inline.ts +5 -3
- package/templates/branded-lite/tier5-src/_shared/guest-sign-in.ts +36 -0
- package/templates/branded-lite/tier5-src/_shared/lifecycle.ts +15 -0
- package/templates/branded-lite/tier5-src/_shared/nav-member-avatar.ts +92 -0
- package/templates/branded-lite/tier5-src/_shared/upcoming-bookings-section.ts +15 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-access-nav/index.ts +14 -9
- package/templates/branded-lite/tier5-src/himi-branded-lite-inbox/index.ts +6 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-nav/index.ts +15 -6
- package/templates/branded-lite/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
- package/templates/branded-lite/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/branded-lite/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/brandy/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/brandy/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/brandy/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/brandy/tier5-src/_shared/guest-sign-in.ts +36 -0
- package/templates/brandy/tier5-src/himi-branded-lite-inbox/index.ts +6 -1
- package/templates/brandy/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
- package/templates/brandy/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/community-club/dev/index.ts +223 -0
- package/templates/community-club/l10n/ar.json +6 -0
- package/templates/community-club/l10n/cs.json +6 -0
- package/templates/community-club/l10n/da.json +6 -0
- package/templates/community-club/l10n/de.json +6 -0
- package/templates/community-club/l10n/el.json +6 -0
- package/templates/community-club/l10n/en.json +9 -2
- package/templates/community-club/l10n/es.json +6 -0
- package/templates/community-club/l10n/fi.json +6 -0
- package/templates/community-club/l10n/fr.json +6 -0
- package/templates/community-club/l10n/he.json +5 -0
- package/templates/community-club/l10n/hu.json +6 -0
- package/templates/community-club/l10n/id.json +6 -0
- package/templates/community-club/l10n/it.json +6 -0
- package/templates/community-club/l10n/ja.json +6 -0
- package/templates/community-club/l10n/ko.json +6 -0
- package/templates/community-club/l10n/lt.json +6 -0
- package/templates/community-club/l10n/nl.json +6 -0
- package/templates/community-club/l10n/no.json +6 -0
- package/templates/community-club/l10n/pl.json +6 -0
- package/templates/community-club/l10n/pt.json +6 -0
- package/templates/community-club/l10n/ru.json +6 -0
- package/templates/community-club/l10n/sv.json +6 -0
- package/templates/community-club/l10n/th.json +6 -0
- package/templates/community-club/l10n/tr.json +6 -0
- package/templates/community-club/l10n/uk.json +6 -0
- package/templates/community-club/l10n/vi.json +6 -0
- package/templates/community-club/l10n/zh.json +6 -0
- package/templates/community-club/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/community-club/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/community-club/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/community-club/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/community-club/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/community-club-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/conference/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/conference/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/conference/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/conference/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/conference/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/events-meetups/dev/index.ts +142 -0
- package/templates/events-meetups/l10n/ar.json +6 -0
- package/templates/events-meetups/l10n/cs.json +6 -0
- package/templates/events-meetups/l10n/da.json +6 -0
- package/templates/events-meetups/l10n/de.json +6 -0
- package/templates/events-meetups/l10n/el.json +6 -0
- package/templates/events-meetups/l10n/en.json +8 -1
- package/templates/events-meetups/l10n/es.json +6 -0
- package/templates/events-meetups/l10n/fi.json +6 -0
- package/templates/events-meetups/l10n/fr.json +6 -0
- package/templates/events-meetups/l10n/he.json +5 -0
- package/templates/events-meetups/l10n/hu.json +6 -0
- package/templates/events-meetups/l10n/id.json +6 -0
- package/templates/events-meetups/l10n/it.json +6 -0
- package/templates/events-meetups/l10n/ja.json +6 -0
- package/templates/events-meetups/l10n/ko.json +6 -0
- package/templates/events-meetups/l10n/lt.json +6 -0
- package/templates/events-meetups/l10n/nl.json +6 -0
- package/templates/events-meetups/l10n/no.json +6 -0
- package/templates/events-meetups/l10n/pl.json +6 -0
- package/templates/events-meetups/l10n/pt.json +6 -0
- package/templates/events-meetups/l10n/ru.json +6 -0
- package/templates/events-meetups/l10n/sv.json +6 -0
- package/templates/events-meetups/l10n/th.json +6 -0
- package/templates/events-meetups/l10n/tr.json +6 -0
- package/templates/events-meetups/l10n/uk.json +6 -0
- package/templates/events-meetups/l10n/vi.json +6 -0
- package/templates/events-meetups/l10n/zh.json +6 -0
- package/templates/events-meetups/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/events-meetups/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/events-meetups/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/events-meetups/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/events-meetups-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/fitness-gym/tier5-src/_shared/guest-sign-in.ts +36 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
- package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/gym-fitness/dev/index.ts +385 -0
- package/templates/gym-fitness/l10n/ar.json +6 -0
- package/templates/gym-fitness/l10n/cs.json +6 -0
- package/templates/gym-fitness/l10n/da.json +6 -0
- package/templates/gym-fitness/l10n/de.json +6 -0
- package/templates/gym-fitness/l10n/el.json +6 -0
- package/templates/gym-fitness/l10n/en.json +9 -2
- package/templates/gym-fitness/l10n/es.json +6 -0
- package/templates/gym-fitness/l10n/fi.json +6 -0
- package/templates/gym-fitness/l10n/fr.json +6 -0
- package/templates/gym-fitness/l10n/he.json +5 -0
- package/templates/gym-fitness/l10n/hu.json +6 -0
- package/templates/gym-fitness/l10n/id.json +6 -0
- package/templates/gym-fitness/l10n/it.json +6 -0
- package/templates/gym-fitness/l10n/ja.json +6 -0
- package/templates/gym-fitness/l10n/ko.json +6 -0
- package/templates/gym-fitness/l10n/lt.json +6 -0
- package/templates/gym-fitness/l10n/nl.json +6 -0
- package/templates/gym-fitness/l10n/no.json +6 -0
- package/templates/gym-fitness/l10n/pl.json +6 -0
- package/templates/gym-fitness/l10n/pt.json +6 -0
- package/templates/gym-fitness/l10n/ru.json +6 -0
- package/templates/gym-fitness/l10n/sv.json +6 -0
- package/templates/gym-fitness/l10n/th.json +6 -0
- package/templates/gym-fitness/l10n/tr.json +6 -0
- package/templates/gym-fitness/l10n/uk.json +6 -0
- package/templates/gym-fitness/l10n/vi.json +6 -0
- package/templates/gym-fitness/l10n/zh.json +6 -0
- package/templates/gym-fitness/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/gym-fitness/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/gym-fitness/tier5-src/_shared/lifecycle.ts +15 -0
- package/templates/gym-fitness/tier5-src/_shared/nav-member-avatar.ts +92 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-nav/index.ts +15 -6
- package/templates/gym-fitness/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/medical-services/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/medical-services/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/medical-services/tier5-src/_shared/guest-sign-in.ts +36 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-notifications/index.ts +8 -1
- package/templates/medical-services/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/nonprofit-cause/dev/index.ts +223 -0
- package/templates/nonprofit-cause/l10n/ar.json +6 -0
- package/templates/nonprofit-cause/l10n/cs.json +6 -0
- package/templates/nonprofit-cause/l10n/da.json +6 -0
- package/templates/nonprofit-cause/l10n/de.json +6 -0
- package/templates/nonprofit-cause/l10n/el.json +6 -0
- package/templates/nonprofit-cause/l10n/en.json +8 -1
- package/templates/nonprofit-cause/l10n/es.json +6 -0
- package/templates/nonprofit-cause/l10n/fi.json +6 -0
- package/templates/nonprofit-cause/l10n/fr.json +6 -0
- package/templates/nonprofit-cause/l10n/he.json +5 -0
- package/templates/nonprofit-cause/l10n/hu.json +6 -0
- package/templates/nonprofit-cause/l10n/id.json +6 -0
- package/templates/nonprofit-cause/l10n/it.json +6 -0
- package/templates/nonprofit-cause/l10n/ja.json +6 -0
- package/templates/nonprofit-cause/l10n/ko.json +6 -0
- package/templates/nonprofit-cause/l10n/lt.json +6 -0
- package/templates/nonprofit-cause/l10n/nl.json +6 -0
- package/templates/nonprofit-cause/l10n/no.json +6 -0
- package/templates/nonprofit-cause/l10n/pl.json +6 -0
- package/templates/nonprofit-cause/l10n/pt.json +6 -0
- package/templates/nonprofit-cause/l10n/ru.json +6 -0
- package/templates/nonprofit-cause/l10n/sv.json +6 -0
- package/templates/nonprofit-cause/l10n/th.json +6 -0
- package/templates/nonprofit-cause/l10n/tr.json +6 -0
- package/templates/nonprofit-cause/l10n/uk.json +6 -0
- package/templates/nonprofit-cause/l10n/vi.json +6 -0
- package/templates/nonprofit-cause/l10n/zh.json +6 -0
- package/templates/nonprofit-cause/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/nonprofit-cause/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/nonprofit-cause/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/owner-lite/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/podcast-creator/dev/index.ts +223 -0
- package/templates/podcast-creator/l10n/ar.json +6 -0
- package/templates/podcast-creator/l10n/cs.json +6 -0
- package/templates/podcast-creator/l10n/da.json +6 -0
- package/templates/podcast-creator/l10n/de.json +6 -0
- package/templates/podcast-creator/l10n/el.json +6 -0
- package/templates/podcast-creator/l10n/en.json +8 -1
- package/templates/podcast-creator/l10n/es.json +6 -0
- package/templates/podcast-creator/l10n/fi.json +6 -0
- package/templates/podcast-creator/l10n/fr.json +6 -0
- package/templates/podcast-creator/l10n/he.json +5 -0
- package/templates/podcast-creator/l10n/hu.json +6 -0
- package/templates/podcast-creator/l10n/id.json +6 -0
- package/templates/podcast-creator/l10n/it.json +6 -0
- package/templates/podcast-creator/l10n/ja.json +6 -0
- package/templates/podcast-creator/l10n/ko.json +6 -0
- package/templates/podcast-creator/l10n/lt.json +6 -0
- package/templates/podcast-creator/l10n/nl.json +6 -0
- package/templates/podcast-creator/l10n/no.json +6 -0
- package/templates/podcast-creator/l10n/pl.json +6 -0
- package/templates/podcast-creator/l10n/pt.json +6 -0
- package/templates/podcast-creator/l10n/ru.json +6 -0
- package/templates/podcast-creator/l10n/sv.json +6 -0
- package/templates/podcast-creator/l10n/th.json +6 -0
- package/templates/podcast-creator/l10n/tr.json +6 -0
- package/templates/podcast-creator/l10n/uk.json +6 -0
- package/templates/podcast-creator/l10n/vi.json +6 -0
- package/templates/podcast-creator/l10n/zh.json +6 -0
- package/templates/podcast-creator/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/podcast-creator/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/podcast-creator/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/portfolio-creative/dev/index.ts +142 -0
- package/templates/portfolio-creative/l10n/ar.json +6 -0
- package/templates/portfolio-creative/l10n/cs.json +6 -0
- package/templates/portfolio-creative/l10n/da.json +6 -0
- package/templates/portfolio-creative/l10n/de.json +6 -0
- package/templates/portfolio-creative/l10n/el.json +6 -0
- package/templates/portfolio-creative/l10n/en.json +8 -1
- package/templates/portfolio-creative/l10n/es.json +6 -0
- package/templates/portfolio-creative/l10n/fi.json +6 -0
- package/templates/portfolio-creative/l10n/fr.json +6 -0
- package/templates/portfolio-creative/l10n/he.json +5 -0
- package/templates/portfolio-creative/l10n/hu.json +6 -0
- package/templates/portfolio-creative/l10n/id.json +6 -0
- package/templates/portfolio-creative/l10n/it.json +6 -0
- package/templates/portfolio-creative/l10n/ja.json +6 -0
- package/templates/portfolio-creative/l10n/ko.json +6 -0
- package/templates/portfolio-creative/l10n/lt.json +6 -0
- package/templates/portfolio-creative/l10n/nl.json +6 -0
- package/templates/portfolio-creative/l10n/no.json +6 -0
- package/templates/portfolio-creative/l10n/pl.json +6 -0
- package/templates/portfolio-creative/l10n/pt.json +6 -0
- package/templates/portfolio-creative/l10n/ru.json +6 -0
- package/templates/portfolio-creative/l10n/sv.json +6 -0
- package/templates/portfolio-creative/l10n/th.json +6 -0
- package/templates/portfolio-creative/l10n/tr.json +6 -0
- package/templates/portfolio-creative/l10n/uk.json +6 -0
- package/templates/portfolio-creative/l10n/vi.json +6 -0
- package/templates/portfolio-creative/l10n/zh.json +6 -0
- package/templates/portfolio-creative/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/portfolio-creative/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/portfolio-creative/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/restaurant/dev/index.ts +142 -0
- package/templates/restaurant/l10n/ar.json +6 -0
- package/templates/restaurant/l10n/cs.json +6 -0
- package/templates/restaurant/l10n/da.json +6 -0
- package/templates/restaurant/l10n/de.json +6 -0
- package/templates/restaurant/l10n/el.json +6 -0
- package/templates/restaurant/l10n/en.json +9 -2
- package/templates/restaurant/l10n/es.json +6 -0
- package/templates/restaurant/l10n/fi.json +6 -0
- package/templates/restaurant/l10n/fr.json +6 -0
- package/templates/restaurant/l10n/he.json +5 -0
- package/templates/restaurant/l10n/hu.json +6 -0
- package/templates/restaurant/l10n/id.json +6 -0
- package/templates/restaurant/l10n/it.json +6 -0
- package/templates/restaurant/l10n/ja.json +6 -0
- package/templates/restaurant/l10n/ko.json +6 -0
- package/templates/restaurant/l10n/lt.json +6 -0
- package/templates/restaurant/l10n/nl.json +6 -0
- package/templates/restaurant/l10n/no.json +6 -0
- package/templates/restaurant/l10n/pl.json +6 -0
- package/templates/restaurant/l10n/pt.json +6 -0
- package/templates/restaurant/l10n/ru.json +6 -0
- package/templates/restaurant/l10n/sv.json +6 -0
- package/templates/restaurant/l10n/th.json +6 -0
- package/templates/restaurant/l10n/tr.json +6 -0
- package/templates/restaurant/l10n/uk.json +6 -0
- package/templates/restaurant/l10n/vi.json +6 -0
- package/templates/restaurant/l10n/zh.json +6 -0
- package/templates/restaurant/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/restaurant/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/restaurant/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/restaurant/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/restaurant-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/retail-store/dev/index.ts +142 -0
- package/templates/retail-store/l10n/ar.json +6 -0
- package/templates/retail-store/l10n/cs.json +6 -0
- package/templates/retail-store/l10n/da.json +6 -0
- package/templates/retail-store/l10n/de.json +6 -0
- package/templates/retail-store/l10n/el.json +6 -0
- package/templates/retail-store/l10n/en.json +8 -1
- package/templates/retail-store/l10n/es.json +6 -0
- package/templates/retail-store/l10n/fi.json +6 -0
- package/templates/retail-store/l10n/fr.json +6 -0
- package/templates/retail-store/l10n/he.json +5 -0
- package/templates/retail-store/l10n/hu.json +6 -0
- package/templates/retail-store/l10n/id.json +6 -0
- package/templates/retail-store/l10n/it.json +6 -0
- package/templates/retail-store/l10n/ja.json +6 -0
- package/templates/retail-store/l10n/ko.json +6 -0
- package/templates/retail-store/l10n/lt.json +6 -0
- package/templates/retail-store/l10n/nl.json +6 -0
- package/templates/retail-store/l10n/no.json +6 -0
- package/templates/retail-store/l10n/pl.json +6 -0
- package/templates/retail-store/l10n/pt.json +6 -0
- package/templates/retail-store/l10n/ru.json +6 -0
- package/templates/retail-store/l10n/sv.json +6 -0
- package/templates/retail-store/l10n/th.json +6 -0
- package/templates/retail-store/l10n/tr.json +6 -0
- package/templates/retail-store/l10n/uk.json +6 -0
- package/templates/retail-store/l10n/vi.json +6 -0
- package/templates/retail-store/l10n/zh.json +6 -0
- package/templates/retail-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/retail-store/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/retail-store/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/retail-store-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/salon-spa/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/salon-spa/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/salon-spa/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/wholesale-store/tier5-src/_shared/collection-query-legacy.ts +7 -0
- package/templates/wholesale-store/tier5-src/_shared/collection-query.ts +7 -0
- package/templates/wholesale-store/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/yoga-studio/dev/index.ts +304 -0
- package/templates/yoga-studio/l10n/ar.json +6 -0
- package/templates/yoga-studio/l10n/cs.json +6 -0
- package/templates/yoga-studio/l10n/da.json +6 -0
- package/templates/yoga-studio/l10n/de.json +6 -0
- package/templates/yoga-studio/l10n/el.json +6 -0
- package/templates/yoga-studio/l10n/en.json +10 -3
- package/templates/yoga-studio/l10n/es.json +6 -0
- package/templates/yoga-studio/l10n/fi.json +6 -0
- package/templates/yoga-studio/l10n/fr.json +6 -0
- package/templates/yoga-studio/l10n/he.json +5 -0
- package/templates/yoga-studio/l10n/hu.json +6 -0
- package/templates/yoga-studio/l10n/id.json +6 -0
- package/templates/yoga-studio/l10n/it.json +6 -0
- package/templates/yoga-studio/l10n/ja.json +6 -0
- package/templates/yoga-studio/l10n/ko.json +6 -0
- package/templates/yoga-studio/l10n/lt.json +6 -0
- package/templates/yoga-studio/l10n/nl.json +6 -0
- package/templates/yoga-studio/l10n/no.json +6 -0
- package/templates/yoga-studio/l10n/pl.json +6 -0
- package/templates/yoga-studio/l10n/pt.json +6 -0
- package/templates/yoga-studio/l10n/ru.json +6 -0
- package/templates/yoga-studio/l10n/sv.json +6 -0
- package/templates/yoga-studio/l10n/th.json +6 -0
- package/templates/yoga-studio/l10n/tr.json +6 -0
- package/templates/yoga-studio/l10n/uk.json +6 -0
- package/templates/yoga-studio/l10n/vi.json +6 -0
- package/templates/yoga-studio/l10n/zh.json +6 -0
- package/templates/yoga-studio/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +7 -1
- package/templates/yoga-studio/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/yoga-studio/tier5-src/_shared/lifecycle.ts +15 -0
- package/templates/yoga-studio/tier5-src/_shared/nav-member-avatar.ts +92 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-nav/index.ts +15 -6
- package/templates/yoga-studio/tier5-src/himi-events-list/index.ts +17 -0
- package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +26 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-query.ts +8 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +7 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// Tier-5 bundle: BARE — full products gallery (inner Shop screen).
|
|
2
|
+
// Category chips on top, a sort picker and a Filter button that opens the filter
|
|
3
|
+
// panel (price + the store's product options, e.g. COLOR / SIZE).
|
|
4
|
+
//
|
|
5
|
+
// The filter panel and sort picker are BottomSheets on THIS screen, not navigation
|
|
6
|
+
// modals: a modal is a separate screen with its own worker, and state does not
|
|
7
|
+
// cross screens (tier-5 guide).
|
|
8
|
+
//
|
|
9
|
+
// Opened with `category` = a category id or name ("NEW IN", "ON SALE"); absent ⇒ ALL.
|
|
10
|
+
import { defineService } from "@himalaya/state";
|
|
11
|
+
import { searchStoreProducts, type StoreProduct } from "@himalaya/wix-stores";
|
|
12
|
+
import { queryCollections } from "@himalaya/wix-stores-collections";
|
|
13
|
+
import { orderCategories } from "../_shared/bare-fashion-categories.js";
|
|
14
|
+
import { cardId, toggleFavorite, type ProductCard } from "../_shared/bare-fashion-product-card.js";
|
|
15
|
+
import { FACETS_BOOT, applyFacets, countText, currencyOf, facetActions, idOf, option, toRow, type Chip, type FacetState, type Option, type Row } from "../_shared/bare-fashion-facets.js";
|
|
16
|
+
import { errorFlags, errorKindOf, type ErrorKind } from "../_shared/bare-fashion-load-error.js";
|
|
17
|
+
|
|
18
|
+
const ALL = "all";
|
|
19
|
+
const MAX_PRODUCTS = 500;
|
|
20
|
+
|
|
21
|
+
interface S extends FacetState {
|
|
22
|
+
status: "loading" | "ready" | "error";
|
|
23
|
+
isLoading: boolean;
|
|
24
|
+
notLoading: boolean;
|
|
25
|
+
isErrored: boolean;
|
|
26
|
+
notErrored: boolean;
|
|
27
|
+
/** Why the last load failed: the error state shows the offline or the server variant. */
|
|
28
|
+
errorKind?: ErrorKind;
|
|
29
|
+
hideOfflineError?: boolean;
|
|
30
|
+
hideServerError?: boolean;
|
|
31
|
+
|
|
32
|
+
categoryChips: Chip[];
|
|
33
|
+
categorySelected: string[];
|
|
34
|
+
/** The category row: one chip per category, with its selected state. */
|
|
35
|
+
categoryOptions: Option[];
|
|
36
|
+
|
|
37
|
+
results: ProductCard[];
|
|
38
|
+
countLabel: string;
|
|
39
|
+
showLabel: string;
|
|
40
|
+
noResults: boolean;
|
|
41
|
+
noEmpty: boolean;
|
|
42
|
+
emptyText: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The full catalog stays out of bound state; only derived rows are rendered.
|
|
46
|
+
let rows: Row[] = [];
|
|
47
|
+
let categoryPicked = false;
|
|
48
|
+
let currency: string | undefined;
|
|
49
|
+
|
|
50
|
+
function input(): { category?: string } {
|
|
51
|
+
return (globalThis as { himalaya?: { input?: { category?: string } } }).himalaya?.input ?? {};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function fetchAll(): Promise<StoreProduct[]> {
|
|
55
|
+
const out: StoreProduct[] = [];
|
|
56
|
+
let cursor: string | undefined;
|
|
57
|
+
do {
|
|
58
|
+
const res = await searchStoreProducts({ limit: 100, ...(cursor ? { cursor } : {}) });
|
|
59
|
+
out.push(...(res.products ?? []));
|
|
60
|
+
cursor = res.pagingMetadata?.cursors?.next ?? undefined;
|
|
61
|
+
} while (cursor && out.length < MAX_PRODUCTS);
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function derive(s: S): S {
|
|
66
|
+
const category = s.categorySelected[0] ?? ALL;
|
|
67
|
+
const inCategory = category === ALL ? rows : rows.filter((r) => r.categoryIds.includes(category));
|
|
68
|
+
const { next, active } = applyFacets(s, inCategory, currency);
|
|
69
|
+
const n = next.results.length;
|
|
70
|
+
const ready = s.status === "ready";
|
|
71
|
+
return {
|
|
72
|
+
...next,
|
|
73
|
+
isLoading: s.status === "loading",
|
|
74
|
+
notLoading: s.status !== "loading",
|
|
75
|
+
isErrored: s.status === "error",
|
|
76
|
+
notErrored: s.status !== "error",
|
|
77
|
+
...errorFlags(s.status, s.errorKind),
|
|
78
|
+
categoryOptions: s.categoryChips.map((c) => option(c, c.id === category)),
|
|
79
|
+
countLabel: ready ? countText(n) : "",
|
|
80
|
+
showLabel: `Show ${countText(n)}`,
|
|
81
|
+
noResults: n === 0,
|
|
82
|
+
noEmpty: !ready || n > 0,
|
|
83
|
+
emptyText: active ? "No products match these filters." : "No products in this category yet.",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
async function load(s: S): Promise<S> {
|
|
87
|
+
try {
|
|
88
|
+
const [products, collections] = await Promise.all([
|
|
89
|
+
fetchAll(),
|
|
90
|
+
queryCollections({ query: { paging: { limit: 50 } } }).then((r) => r.collections ?? [], () => []),
|
|
91
|
+
]);
|
|
92
|
+
currency = products.map(currencyOf).find(Boolean);
|
|
93
|
+
rows = products.map(toRow).filter((r) => r.card.id);
|
|
94
|
+
const cats = orderCategories(collections).filter((c) => c.id);
|
|
95
|
+
const categoryChips: Chip[] = [{ id: ALL, label: "ALL" }, ...cats.map((c) => ({ id: c.id ?? "", label: (c.name ?? "").toUpperCase() }))];
|
|
96
|
+
// Pre-select the category the shopper came from: an id, or a name ("NEW IN").
|
|
97
|
+
const want = (input().category ?? "").trim();
|
|
98
|
+
const match = want.toLowerCase() === ALL
|
|
99
|
+
? categoryChips[0]
|
|
100
|
+
: cats.find((c) => c.id === want || (c.name ?? "").trim().toUpperCase() === want.toUpperCase());
|
|
101
|
+
// A retry keeps the shopper's own pick; the first load uses the link's category.
|
|
102
|
+
const current = categoryPicked ? s.categorySelected[0] : undefined;
|
|
103
|
+
const keep = current && categoryChips.some((c) => c.id === current) ? current : undefined;
|
|
104
|
+
return derive({ ...s, status: "ready", categoryChips, categorySelected: [match?.id ?? keep ?? ALL] });
|
|
105
|
+
} catch (e) {
|
|
106
|
+
return derive({ ...s, status: "error", errorKind: errorKindOf(e) });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const BOOT: S = derive({
|
|
111
|
+
...FACETS_BOOT,
|
|
112
|
+
status: "loading", isLoading: true, notLoading: false, isErrored: false, notErrored: true,
|
|
113
|
+
categoryChips: [], categorySelected: [ALL], categoryOptions: [],
|
|
114
|
+
results: [], countLabel: "", showLabel: "", noResults: true, noEmpty: true, emptyText: "",
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
type A = (s: S, arg?: unknown) => S | Promise<S>;
|
|
118
|
+
const svc = defineService<S, {
|
|
119
|
+
load: A; retry: A; selectCategory: A; sort: A; openFilters: A; openSort: A; closePanel: A;
|
|
120
|
+
selectPrice: A; selectOpt1: A; selectOpt2: A; selectOpt3: A; clearFilters: A; toggleSave: A;
|
|
121
|
+
}>("bareFashionProducts", {
|
|
122
|
+
state: BOOT,
|
|
123
|
+
actions: {
|
|
124
|
+
load: (s) => load(s),
|
|
125
|
+
retry: (s) => load(derive({ ...s, status: "loading" })),
|
|
126
|
+
// Single-select: one category is always chosen.
|
|
127
|
+
selectCategory: (s, arg) => {
|
|
128
|
+
const id = idOf(arg);
|
|
129
|
+
if (!s.categoryChips.some((c) => c.id === id)) return s;
|
|
130
|
+
categoryPicked = true;
|
|
131
|
+
return derive({ ...s, categorySelected: [id] });
|
|
132
|
+
},
|
|
133
|
+
...facetActions(derive),
|
|
134
|
+
toggleSave: (s, arg) => {
|
|
135
|
+
try { toggleFavorite(s.results, cardId(arg)); } catch { return s; }
|
|
136
|
+
return derive(s);
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
svc.load();
|
|
142
|
+
export { svc };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineService } from "@himalaya/state";
|
|
2
|
+
import { readSavedProducts, removeSavedProduct } from "../_shared/himi-store-saved.js";
|
|
3
|
+
import { cardId, savedCard, type ProductCard } from "../_shared/bare-fashion-product-card.js";
|
|
4
|
+
import { stashCopy, copyParam } from "../_shared/himi-copy.js";
|
|
5
|
+
|
|
6
|
+
type Row = ProductCard;
|
|
7
|
+
interface S {
|
|
8
|
+
status: "loading" | "ready" | "error";
|
|
9
|
+
rows: Row[];
|
|
10
|
+
error: string;
|
|
11
|
+
emptyText: string;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
notLoading: boolean;
|
|
14
|
+
notErrored: boolean;
|
|
15
|
+
noEmpty: boolean;
|
|
16
|
+
}
|
|
17
|
+
function shape(s: Pick<S, "status" | "rows" | "error">): S {
|
|
18
|
+
return { ...s, isLoading: s.status === "loading", notLoading: s.status !== "loading", notErrored: s.status !== "error", noEmpty: s.status !== "ready" || s.rows.length > 0, emptyText: copyParam("savedProducts.empty", "Tap the heart on an item to add it to your wishlist.") };
|
|
19
|
+
}
|
|
20
|
+
function loadRows(): Row[] {
|
|
21
|
+
return readSavedProducts().map(savedCard);
|
|
22
|
+
}
|
|
23
|
+
function failed(s: S): S {
|
|
24
|
+
return shape({ ...s, status: "error", error: copyParam("savedProducts.error", "Could not update your wishlist. Try again.") });
|
|
25
|
+
}
|
|
26
|
+
const svc = defineService<S, {
|
|
27
|
+
load: (s: S, arg?: unknown) => S;
|
|
28
|
+
remove: (s: S, arg?: unknown) => S;
|
|
29
|
+
}>("bareFashionSaved", {
|
|
30
|
+
state: shape({ status: "loading", rows: [], error: "" }),
|
|
31
|
+
actions: {
|
|
32
|
+
load: (s, arg) => {
|
|
33
|
+
stashCopy(arg);
|
|
34
|
+
try { return shape({ status: "ready", rows: loadRows(), error: "" }); }
|
|
35
|
+
catch { return failed(s); }
|
|
36
|
+
},
|
|
37
|
+
remove: (s, arg) => {
|
|
38
|
+
try {
|
|
39
|
+
removeSavedProduct(cardId(arg));
|
|
40
|
+
return shape({ status: "ready", rows: loadRows(), error: "" });
|
|
41
|
+
} catch { return failed(s); }
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
export { svc };
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
// Tier-5 bundle: BARE — full-screen search (opened from the Shop tab's search bar).
|
|
2
|
+
// Opens with the query field focused. Empty query → the shopper's recent searches.
|
|
3
|
+
// Non-empty query → matching products under the same sort picker and filter panel
|
|
4
|
+
// as the Products screen (shared in ../_shared/bare-facets.ts).
|
|
5
|
+
//
|
|
6
|
+
// Recent searches live on this device only (the host's app-scoped KV). A query is
|
|
7
|
+
// saved when the shopper presses Search on the keyboard, taps a recent search, or
|
|
8
|
+
// opens a product from the results — never per keystroke.
|
|
9
|
+
import { defineService, navigate } from "@himalaya/state";
|
|
10
|
+
import { dismiss } from "@himalaya/keyboard";
|
|
11
|
+
import { searchStoreProducts } from "@himalaya/wix-stores";
|
|
12
|
+
import { cardId, toggleFavorite, type ProductCard } from "../_shared/bare-fashion-product-card.js";
|
|
13
|
+
import { FACETS_BOOT, applyFacets, countText, currencyOf, facetActions, idOf, toRow, type FacetState, type Row } from "../_shared/bare-fashion-facets.js";
|
|
14
|
+
import { errorFlags, errorKindOf, type ErrorKind } from "../_shared/bare-fashion-load-error.js";
|
|
15
|
+
|
|
16
|
+
const RECENT_KEY = "bare:recent-searches:v1";
|
|
17
|
+
const RECENT_MAX = 10;
|
|
18
|
+
const RESULT_LIMIT = 100;
|
|
19
|
+
|
|
20
|
+
interface Recent { id: string; label: string }
|
|
21
|
+
|
|
22
|
+
interface S extends FacetState {
|
|
23
|
+
status: "idle" | "loading" | "ready" | "error";
|
|
24
|
+
query: string;
|
|
25
|
+
/** Non-empty seed ⇒ the field takes focus (and the keyboard opens) on appear. */
|
|
26
|
+
focusToken: string;
|
|
27
|
+
recent: Recent[];
|
|
28
|
+
hideRecent: boolean;
|
|
29
|
+
hideQueryArea: boolean;
|
|
30
|
+
isLoading: boolean;
|
|
31
|
+
notLoading: boolean;
|
|
32
|
+
notErrored: boolean;
|
|
33
|
+
/** Why the last load failed: the error state shows the offline or the server variant. */
|
|
34
|
+
errorKind?: ErrorKind;
|
|
35
|
+
hideOfflineError?: boolean;
|
|
36
|
+
hideServerError?: boolean;
|
|
37
|
+
results: ProductCard[];
|
|
38
|
+
countLabel: string;
|
|
39
|
+
showLabel: string;
|
|
40
|
+
noResults: boolean;
|
|
41
|
+
noEmpty: boolean;
|
|
42
|
+
emptyText: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// The fetched result rows stay out of bound state; only derived cards are rendered.
|
|
46
|
+
let rows: Row[] = [];
|
|
47
|
+
let currency: string | undefined;
|
|
48
|
+
// Search responses can land out of order; only the latest query may write state.
|
|
49
|
+
let latestQuery = "";
|
|
50
|
+
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Recent searches (device KV — a failed read or write never breaks search)
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
type StorageLike = { getItem(key: string): string | null; setItem(key: string, value: string): void };
|
|
56
|
+
function storage(): StorageLike | undefined {
|
|
57
|
+
const host = globalThis as { himalaya?: { storage?: StorageLike }; localStorage?: StorageLike };
|
|
58
|
+
return host.himalaya?.storage ?? host.localStorage;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The recent searches kept on the device, or `ok: false` when the stored list cannot be read
|
|
62
|
+
* (no storage, or a value this version did not write). Recent searches are then not offered. */
|
|
63
|
+
function storedRecent(): { ok: true; list: Recent[] } | { ok: false } {
|
|
64
|
+
try {
|
|
65
|
+
const parsed: unknown = JSON.parse(storage()?.getItem(RECENT_KEY) ?? "[]");
|
|
66
|
+
if (!Array.isArray(parsed)) return { ok: false };
|
|
67
|
+
return { ok: true, list: parsed.filter((q): q is string => typeof q === "string" && !!q.trim())
|
|
68
|
+
.slice(0, RECENT_MAX).map((q) => ({ id: q, label: q })) };
|
|
69
|
+
} catch {
|
|
70
|
+
return { ok: false };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function readRecent(): Recent[] {
|
|
74
|
+
const stored = storedRecent();
|
|
75
|
+
return stored.ok ? stored.list : [];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function writeRecent(list: Recent[]): Recent[] {
|
|
79
|
+
try { storage()?.setItem(RECENT_KEY, JSON.stringify(list.map((r) => r.id))); } catch { /* keep in memory */ }
|
|
80
|
+
return list;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Newest first; a repeat (any letter case) moves to the top. */
|
|
84
|
+
function remember(list: Recent[], query: string): Recent[] {
|
|
85
|
+
const q = query.trim();
|
|
86
|
+
if (!q) return list;
|
|
87
|
+
const rest = list.filter((r) => r.id.toLowerCase() !== q.toLowerCase());
|
|
88
|
+
return writeRecent([{ id: q, label: q }, ...rest].slice(0, RECENT_MAX));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
// Derive + search
|
|
93
|
+
// ---------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
function queryOf(arg: unknown): string {
|
|
96
|
+
return String((arg as { value?: unknown } | undefined)?.value ?? "").trim().slice(0, 256);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function derive(s: S): S {
|
|
100
|
+
const { next, active } = applyFacets(s, s.query ? rows : [], currency);
|
|
101
|
+
const n = next.results.length;
|
|
102
|
+
const ready = s.status === "ready";
|
|
103
|
+
return {
|
|
104
|
+
...next,
|
|
105
|
+
hideRecent: !!s.query || s.recent.length === 0,
|
|
106
|
+
hideQueryArea: !s.query,
|
|
107
|
+
isLoading: s.status === "loading",
|
|
108
|
+
notLoading: s.status !== "loading",
|
|
109
|
+
notErrored: s.status !== "error",
|
|
110
|
+
...errorFlags(s.status, s.errorKind),
|
|
111
|
+
countLabel: ready ? countText(n) : "",
|
|
112
|
+
showLabel: `Show ${countText(n)}`,
|
|
113
|
+
noResults: !ready || n === 0,
|
|
114
|
+
noEmpty: !ready || n > 0,
|
|
115
|
+
emptyText: active ? "No products match these filters." : `No products match “${s.query}”.`,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function run(s: S, query: string): Promise<S | undefined> {
|
|
120
|
+
latestQuery = query;
|
|
121
|
+
if (!query) {
|
|
122
|
+
rows = [];
|
|
123
|
+
return derive({ ...s, query: "", status: "idle", panel: "none" });
|
|
124
|
+
}
|
|
125
|
+
try {
|
|
126
|
+
const res = await searchStoreProducts({ query, limit: RESULT_LIMIT });
|
|
127
|
+
if (query !== latestQuery) return undefined;
|
|
128
|
+
const products = res.products ?? [];
|
|
129
|
+
currency = products.map(currencyOf).find(Boolean) ?? currency;
|
|
130
|
+
rows = products.map(toRow).filter((r) => r.card.id);
|
|
131
|
+
return derive({ ...s, query, status: "ready" });
|
|
132
|
+
} catch (e) {
|
|
133
|
+
if (query !== latestQuery) return undefined;
|
|
134
|
+
rows = [];
|
|
135
|
+
return derive({ ...s, query, status: "error", errorKind: errorKindOf(e) });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const BOOT: S = derive({
|
|
140
|
+
...FACETS_BOOT,
|
|
141
|
+
status: "idle", query: "", focusToken: "open", recent: [], hideRecent: true, hideQueryArea: true,
|
|
142
|
+
isLoading: false, notLoading: true, notErrored: true,
|
|
143
|
+
results: [], countLabel: "", showLabel: "", noResults: true, noEmpty: true, emptyText: "",
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
type A = (s: S, arg?: unknown) => S | undefined | Promise<S | undefined>;
|
|
147
|
+
const svc = defineService<S, {
|
|
148
|
+
load: A; change: A; submit: A; pickRecent: A; removeRecent: A; retry: A; openProduct: A; toggleSave: A;
|
|
149
|
+
sort: A; openFilters: A; openSort: A; closePanel: A;
|
|
150
|
+
selectPrice: A; selectOpt1: A; selectOpt2: A; selectOpt3: A; clearFilters: A;
|
|
151
|
+
}>("bareFashionSearch", {
|
|
152
|
+
state: BOOT,
|
|
153
|
+
actions: {
|
|
154
|
+
// Every open starts a fresh search: the host can keep this worker alive between
|
|
155
|
+
// opens, so clear the last query and re-request focus with a new token.
|
|
156
|
+
load: (s) => {
|
|
157
|
+
rows = [];
|
|
158
|
+
latestQuery = "";
|
|
159
|
+
return derive({ ...s, query: "", status: "idle", panel: "none", recent: readRecent(), focusToken: String(Date.now()) });
|
|
160
|
+
},
|
|
161
|
+
change: (s, arg) => {
|
|
162
|
+
const query = queryOf(arg);
|
|
163
|
+
return query === s.query && s.status !== "error" ? s : run(query ? { ...s, status: "loading" } : s, query);
|
|
164
|
+
},
|
|
165
|
+
// Keyboard Search key: search now and keep the query as a recent search.
|
|
166
|
+
submit: (s, arg) => {
|
|
167
|
+
const query = queryOf(arg) || s.query;
|
|
168
|
+
const recent = remember(s.recent, query);
|
|
169
|
+
return run({ ...s, recent, status: query ? "loading" : s.status }, query);
|
|
170
|
+
},
|
|
171
|
+
// A recent search fills the field and runs. Dismiss the keyboard first: the
|
|
172
|
+
// field adopts a worker value only while it is not focused.
|
|
173
|
+
pickRecent: (s, arg) => {
|
|
174
|
+
const query = idOf(arg);
|
|
175
|
+
if (!query) return s;
|
|
176
|
+
dismiss().catch(() => undefined);
|
|
177
|
+
return run({ ...s, recent: remember(s.recent, query), status: "loading" }, query);
|
|
178
|
+
},
|
|
179
|
+
removeRecent: (s, arg) => {
|
|
180
|
+
const id = idOf(arg);
|
|
181
|
+
return derive({ ...s, recent: writeRecent(s.recent.filter((r) => r.id !== id)) });
|
|
182
|
+
},
|
|
183
|
+
retry: (s) => run({ ...s, status: "loading" }, s.query),
|
|
184
|
+
// Opening a result counts as a completed search.
|
|
185
|
+
openProduct: (s, arg) => {
|
|
186
|
+
const id = cardId(arg);
|
|
187
|
+
if (!id) return s;
|
|
188
|
+
return navigate({ ...s, recent: remember(s.recent, s.query) }, { screenId: "himi_product", args: { id } });
|
|
189
|
+
},
|
|
190
|
+
toggleSave: (s, arg) => {
|
|
191
|
+
try { toggleFavorite(s.results, cardId(arg)); } catch { return s; }
|
|
192
|
+
return derive(s);
|
|
193
|
+
},
|
|
194
|
+
...facetActions(derive),
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
svc.load();
|
|
199
|
+
export { svc };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Tier-5 bundle: himi-store — Shop tab. A search bar over the category list.
|
|
2
|
+
// The bar opens the full-screen search (himi_search, worker himi-bare-fashion-search); this
|
|
3
|
+
// screen shows the site's categories as full-width image tiles.
|
|
4
|
+
import { defineService } from "@himalaya/state";
|
|
5
|
+
import { getCurrentCart } from "@himalaya/wix-ecom";
|
|
6
|
+
import { queryCollections } from "@himalaya/wix-stores-collections";
|
|
7
|
+
import { copyParam } from "../_shared/himi-copy.js";
|
|
8
|
+
import { publishBagCount } from "../_shared/bare-fashion-bag-count.js";
|
|
9
|
+
import { categoryCard, orderCategories, type CategoryCard } from "../_shared/bare-fashion-categories.js";
|
|
10
|
+
import { errorFlags, errorKindOf, type ErrorKind } from "../_shared/bare-fashion-load-error.js";
|
|
11
|
+
|
|
12
|
+
interface S {
|
|
13
|
+
status: "loading" | "ready" | "error";
|
|
14
|
+
categories: CategoryCard[];
|
|
15
|
+
cartCount: number;
|
|
16
|
+
emptyText: string;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
isErrored: boolean;
|
|
19
|
+
notErrored: boolean;
|
|
20
|
+
hideCategories: boolean;
|
|
21
|
+
/** Why the last load failed: the error state shows the offline or the server variant. */
|
|
22
|
+
errorKind?: ErrorKind;
|
|
23
|
+
hideOfflineError?: boolean;
|
|
24
|
+
hideServerError?: boolean;
|
|
25
|
+
noEmpty: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Live cart size (sum of line-item quantities) for the Cart tab badge, or `ok: false` when the
|
|
29
|
+
* cart cannot be read: the screen does not fail, and the badge keeps its stored count. */
|
|
30
|
+
async function cartItemCount(): Promise<{ ok: true; count: number } | { ok: false }> {
|
|
31
|
+
try {
|
|
32
|
+
const cart = await getCurrentCart();
|
|
33
|
+
return { ok: true, count: (cart.lineItems ?? []).reduce((n, li) => n + (li.quantity ?? 1), 0) };
|
|
34
|
+
} catch {
|
|
35
|
+
return { ok: false };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Recompute every derived flag. State is not reactive: each action must re-derive. */
|
|
40
|
+
function derive(s: S): S {
|
|
41
|
+
const empty = s.status === "ready" && s.categories.length === 0;
|
|
42
|
+
return {
|
|
43
|
+
...s,
|
|
44
|
+
isLoading: s.status === "loading",
|
|
45
|
+
isErrored: s.status === "error",
|
|
46
|
+
notErrored: s.status !== "error",
|
|
47
|
+
...errorFlags(s.status, s.errorKind),
|
|
48
|
+
hideCategories: s.status !== "ready",
|
|
49
|
+
noEmpty: !empty,
|
|
50
|
+
emptyText: copyParam("shop.emptyText", "No categories are published yet."),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function load(s: S): Promise<S> {
|
|
55
|
+
const [categoriesResult, live] = await Promise.all([
|
|
56
|
+
queryCollections({ query: { paging: { limit: 50 } } }).then((r) => ({ ok: true as const, r }), (e: unknown) => ({ ok: false as const, e })),
|
|
57
|
+
cartItemCount(),
|
|
58
|
+
]);
|
|
59
|
+
if (live.ok) await publishBagCount(live.count);
|
|
60
|
+
const cartCount = live.ok ? live.count : s.cartCount;
|
|
61
|
+
if (!categoriesResult.ok) return derive({ ...s, status: "error", errorKind: errorKindOf(categoriesResult.e), cartCount });
|
|
62
|
+
const categories = orderCategories(categoriesResult.r.collections ?? []).map(categoryCard).filter((c) => c.id);
|
|
63
|
+
return derive({ ...s, status: "ready", categories, cartCount });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const svc = defineService<S, {
|
|
67
|
+
load: (s: S) => Promise<S>;
|
|
68
|
+
retry: (s: S) => Promise<S>;
|
|
69
|
+
}>("bareFashionShop", {
|
|
70
|
+
state: derive({ status: "loading", categories: [], cartCount: 0, emptyText: "",
|
|
71
|
+
isLoading: true, isErrored: false, notErrored: true, hideCategories: true, noEmpty: true }),
|
|
72
|
+
actions: {
|
|
73
|
+
load: (s) => load(s),
|
|
74
|
+
retry: (s) => load(derive({ ...s, status: "loading" })),
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
svc.load();
|
|
79
|
+
export { svc };
|