@wix/himalaya-cli 0.1944.0 → 0.1946.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/stdlib/wix-sdk/ecom/src/extensions.d.ts +27 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/motion.mjs +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-ecom.mjs +16 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{e113c7cdcf8f56ad861b2564505fab2a1975c7a995f92d2f999f9c4ce1a09a40.bin → 9521361aa5be10b9a96b96c0ea2f7e157e728874b20de5200879cbd735eefb38.bin} +1 -1
- package/dist/browser-plane/sw.js +9 -9
- package/dist/cli.mjs +1548 -912
- package/dist/preview-assets.generated.bin +0 -0
- package/fixtures/wix-canned.json +6 -0
- package/guides/himi-json-output.md +15 -6
- package/guides/one-app-section-mappings.md +2 -2
- package/guides/one-app-to-himi-app.md +13 -4
- package/guides/release-notes.md +8 -0
- package/guides/sdk-reference.json +55 -0
- package/package.json +2 -2
- package/templates/bare-fashion/dev/index.ts +3 -1
- package/templates/bare-fashion/tier5-src/_shared/bare-fashion-product-card.ts +5 -4
- package/templates/bare-fashion/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/bare-fashion/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/bare-fashion/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-cart/index.ts +19 -12
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-collection/index.ts +9 -4
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-home/index.ts +10 -4
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-product/index.ts +17 -8
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-products/index.ts +8 -4
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-saved/index.ts +31 -12
- package/templates/bare-fashion/tier5-src/himi-bare-fashion-search/index.ts +8 -4
- package/templates/beauty-salon/dev/index.ts +1 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/beauty-salon/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/beauty-salon/tier5-src/_shared/himi-store-facets.ts +4 -4
- package/templates/beauty-salon/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/beauty-salon/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/beauty-salon/tier5-src/himi-branded-lite-cart/index.ts +13 -7
- package/templates/beauty-salon/tier5-src/himi-branded-lite-category/index.ts +6 -1
- package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/beauty-salon/tier5-src/himi-branded-lite-shop/index.ts +9 -3
- package/templates/beauty-salon/tier5-src/himi-store-product/index.ts +7 -5
- package/templates/beauty-salon/tier5-src/himi-store-saved/index.ts +31 -12
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/beauty-salon-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/branded-lite/dev/index.ts +4 -2
- package/templates/branded-lite/l10n/ar.json +5 -5
- package/templates/branded-lite/l10n/cs.json +5 -5
- package/templates/branded-lite/l10n/da.json +5 -5
- package/templates/branded-lite/l10n/de.json +5 -5
- package/templates/branded-lite/l10n/el.json +5 -5
- package/templates/branded-lite/l10n/es.json +5 -5
- package/templates/branded-lite/l10n/fi.json +5 -5
- package/templates/branded-lite/l10n/fr.json +5 -5
- package/templates/branded-lite/l10n/he.json +4 -4
- package/templates/branded-lite/l10n/hu.json +5 -5
- package/templates/branded-lite/l10n/id.json +5 -5
- package/templates/branded-lite/l10n/it.json +5 -5
- package/templates/branded-lite/l10n/ja.json +5 -5
- package/templates/branded-lite/l10n/ko.json +5 -5
- package/templates/branded-lite/l10n/lt.json +5 -5
- package/templates/branded-lite/l10n/nl.json +5 -5
- package/templates/branded-lite/l10n/no.json +5 -5
- package/templates/branded-lite/l10n/pl.json +5 -5
- package/templates/branded-lite/l10n/pt.json +5 -5
- package/templates/branded-lite/l10n/ru.json +5 -5
- package/templates/branded-lite/l10n/sv.json +5 -5
- package/templates/branded-lite/l10n/th.json +5 -5
- package/templates/branded-lite/l10n/tr.json +5 -5
- package/templates/branded-lite/l10n/uk.json +5 -5
- package/templates/branded-lite/l10n/vi.json +5 -5
- package/templates/branded-lite/l10n/zh.json +5 -5
- package/templates/branded-lite/recipes/wishlist-grid.json +1 -1
- package/templates/branded-lite/tier5-src/_shared/collection-service.ts +42 -19
- package/templates/branded-lite/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/branded-lite/tier5-src/_shared/himi-store-facets.ts +4 -4
- package/templates/branded-lite/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-section.ts +24 -16
- package/templates/branded-lite/tier5-src/_shared/performance-tracker-weeks.ts +27 -20
- package/templates/branded-lite/tier5-src/_shared/saved-products-section.ts +14 -8
- package/templates/branded-lite/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-cart/index.ts +13 -7
- package/templates/branded-lite/tier5-src/himi-branded-lite-category/index.ts +6 -1
- package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/branded-lite/tier5-src/himi-branded-lite-shop/index.ts +9 -3
- package/templates/branded-lite/tier5-src/himi-store-product/index.ts +32 -15
- package/templates/branded-lite/tier5-src/himi-store-saved/index.ts +31 -12
- package/templates/brandy/tier5-src/_shared/collection-service.ts +42 -19
- package/templates/brandy/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/brandy/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/brandy/tier5-src/himi-branded-lite-cart/index.ts +13 -7
- package/templates/community-club/dev/index.ts +1 -0
- package/templates/community-club/l10n/ar.json +5 -0
- package/templates/community-club/l10n/cs.json +5 -0
- package/templates/community-club/l10n/da.json +5 -0
- package/templates/community-club/l10n/de.json +5 -0
- package/templates/community-club/l10n/el.json +5 -0
- package/templates/community-club/l10n/es.json +5 -0
- package/templates/community-club/l10n/fi.json +5 -0
- package/templates/community-club/l10n/fr.json +5 -0
- package/templates/community-club/l10n/he.json +4 -0
- package/templates/community-club/l10n/hu.json +5 -0
- package/templates/community-club/l10n/id.json +5 -0
- package/templates/community-club/l10n/it.json +5 -0
- package/templates/community-club/l10n/ja.json +5 -0
- package/templates/community-club/l10n/ko.json +5 -0
- package/templates/community-club/l10n/lt.json +5 -0
- package/templates/community-club/l10n/nl.json +5 -0
- package/templates/community-club/l10n/no.json +5 -0
- package/templates/community-club/l10n/pl.json +5 -0
- package/templates/community-club/l10n/pt.json +5 -0
- package/templates/community-club/l10n/ru.json +5 -0
- package/templates/community-club/l10n/sv.json +5 -0
- package/templates/community-club/l10n/th.json +5 -0
- package/templates/community-club/l10n/tr.json +5 -0
- package/templates/community-club/l10n/uk.json +5 -0
- package/templates/community-club/l10n/vi.json +5 -0
- package/templates/community-club/l10n/zh.json +5 -0
- package/templates/community-club/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/community-club/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/community-club/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/community-club/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/community-club-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/conference/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/conference/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/events-meetups/dev/index.ts +1 -0
- package/templates/events-meetups/l10n/ar.json +5 -0
- package/templates/events-meetups/l10n/cs.json +5 -0
- package/templates/events-meetups/l10n/da.json +5 -0
- package/templates/events-meetups/l10n/de.json +5 -0
- package/templates/events-meetups/l10n/el.json +5 -0
- package/templates/events-meetups/l10n/es.json +5 -0
- package/templates/events-meetups/l10n/fi.json +5 -0
- package/templates/events-meetups/l10n/fr.json +5 -0
- package/templates/events-meetups/l10n/he.json +4 -0
- package/templates/events-meetups/l10n/hu.json +5 -0
- package/templates/events-meetups/l10n/id.json +5 -0
- package/templates/events-meetups/l10n/it.json +5 -0
- package/templates/events-meetups/l10n/ja.json +5 -0
- package/templates/events-meetups/l10n/ko.json +5 -0
- package/templates/events-meetups/l10n/lt.json +5 -0
- package/templates/events-meetups/l10n/nl.json +5 -0
- package/templates/events-meetups/l10n/no.json +5 -0
- package/templates/events-meetups/l10n/pl.json +5 -0
- package/templates/events-meetups/l10n/pt.json +5 -0
- package/templates/events-meetups/l10n/ru.json +5 -0
- package/templates/events-meetups/l10n/sv.json +5 -0
- package/templates/events-meetups/l10n/th.json +5 -0
- package/templates/events-meetups/l10n/tr.json +5 -0
- package/templates/events-meetups/l10n/uk.json +5 -0
- package/templates/events-meetups/l10n/vi.json +5 -0
- package/templates/events-meetups/l10n/zh.json +5 -0
- package/templates/events-meetups/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/events-meetups/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/events-meetups/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/events-meetups/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/events-meetups-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +3 -2
- package/templates/gym-fitness/dev/index.ts +3 -1
- package/templates/gym-fitness/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/gym-fitness/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/gym-fitness/tier5-src/_shared/himi-store-facets.ts +4 -4
- package/templates/gym-fitness/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/gym-fitness/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/gym-fitness/tier5-src/himi-branded-lite-cart/index.ts +13 -7
- package/templates/gym-fitness/tier5-src/himi-branded-lite-category/index.ts +6 -1
- package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/gym-fitness/tier5-src/himi-branded-lite-shop/index.ts +9 -3
- package/templates/gym-fitness/tier5-src/himi-store-product/index.ts +7 -5
- package/templates/gym-fitness/tier5-src/himi-store-saved/index.ts +31 -12
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/gym-fitness-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/medical-services/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/medical-services/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/medical-services/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/medical-services/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/nonprofit-cause/dev/index.ts +1 -0
- package/templates/nonprofit-cause/l10n/ar.json +5 -0
- package/templates/nonprofit-cause/l10n/cs.json +5 -0
- package/templates/nonprofit-cause/l10n/da.json +5 -0
- package/templates/nonprofit-cause/l10n/de.json +5 -0
- package/templates/nonprofit-cause/l10n/el.json +5 -0
- package/templates/nonprofit-cause/l10n/es.json +5 -0
- package/templates/nonprofit-cause/l10n/fi.json +5 -0
- package/templates/nonprofit-cause/l10n/fr.json +5 -0
- package/templates/nonprofit-cause/l10n/he.json +4 -0
- package/templates/nonprofit-cause/l10n/hu.json +5 -0
- package/templates/nonprofit-cause/l10n/id.json +5 -0
- package/templates/nonprofit-cause/l10n/it.json +5 -0
- package/templates/nonprofit-cause/l10n/ja.json +5 -0
- package/templates/nonprofit-cause/l10n/ko.json +5 -0
- package/templates/nonprofit-cause/l10n/lt.json +5 -0
- package/templates/nonprofit-cause/l10n/nl.json +5 -0
- package/templates/nonprofit-cause/l10n/no.json +5 -0
- package/templates/nonprofit-cause/l10n/pl.json +5 -0
- package/templates/nonprofit-cause/l10n/pt.json +5 -0
- package/templates/nonprofit-cause/l10n/ru.json +5 -0
- package/templates/nonprofit-cause/l10n/sv.json +5 -0
- package/templates/nonprofit-cause/l10n/th.json +5 -0
- package/templates/nonprofit-cause/l10n/tr.json +5 -0
- package/templates/nonprofit-cause/l10n/uk.json +5 -0
- package/templates/nonprofit-cause/l10n/vi.json +5 -0
- package/templates/nonprofit-cause/l10n/zh.json +5 -0
- package/templates/nonprofit-cause/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/nonprofit-cause/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/nonprofit-cause/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/nonprofit-cause/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/nonprofit-cause-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/owner-lite/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/personal-fitness-trainer/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/podcast-creator/dev/index.ts +1 -0
- package/templates/podcast-creator/l10n/ar.json +5 -0
- package/templates/podcast-creator/l10n/cs.json +5 -0
- package/templates/podcast-creator/l10n/da.json +5 -0
- package/templates/podcast-creator/l10n/de.json +5 -0
- package/templates/podcast-creator/l10n/el.json +5 -0
- package/templates/podcast-creator/l10n/es.json +5 -0
- package/templates/podcast-creator/l10n/fi.json +5 -0
- package/templates/podcast-creator/l10n/fr.json +5 -0
- package/templates/podcast-creator/l10n/he.json +4 -0
- package/templates/podcast-creator/l10n/hu.json +5 -0
- package/templates/podcast-creator/l10n/id.json +5 -0
- package/templates/podcast-creator/l10n/it.json +5 -0
- package/templates/podcast-creator/l10n/ja.json +5 -0
- package/templates/podcast-creator/l10n/ko.json +5 -0
- package/templates/podcast-creator/l10n/lt.json +5 -0
- package/templates/podcast-creator/l10n/nl.json +5 -0
- package/templates/podcast-creator/l10n/no.json +5 -0
- package/templates/podcast-creator/l10n/pl.json +5 -0
- package/templates/podcast-creator/l10n/pt.json +5 -0
- package/templates/podcast-creator/l10n/ru.json +5 -0
- package/templates/podcast-creator/l10n/sv.json +5 -0
- package/templates/podcast-creator/l10n/th.json +5 -0
- package/templates/podcast-creator/l10n/tr.json +5 -0
- package/templates/podcast-creator/l10n/uk.json +5 -0
- package/templates/podcast-creator/l10n/vi.json +5 -0
- package/templates/podcast-creator/l10n/zh.json +5 -0
- package/templates/podcast-creator/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/podcast-creator/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/podcast-creator/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/podcast-creator/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/podcast-creator-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/portfolio-creative/dev/index.ts +1 -0
- package/templates/portfolio-creative/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/portfolio-creative/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/portfolio-creative/tier5-src/_shared/himi-store-facets.ts +4 -4
- package/templates/portfolio-creative/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/portfolio-creative/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-cart/index.ts +13 -7
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-category/index.ts +6 -1
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-shop/index.ts +9 -3
- package/templates/portfolio-creative/tier5-src/himi-store-product/index.ts +7 -5
- package/templates/portfolio-creative/tier5-src/himi-store-saved/index.ts +31 -12
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/portfolio-creative-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/professional-services/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/professional-services/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/professional-services/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/professional-services/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/restaurant/dev/index.ts +1 -0
- package/templates/restaurant/l10n/ar.json +5 -0
- package/templates/restaurant/l10n/cs.json +5 -0
- package/templates/restaurant/l10n/da.json +5 -0
- package/templates/restaurant/l10n/de.json +5 -0
- package/templates/restaurant/l10n/el.json +5 -0
- package/templates/restaurant/l10n/es.json +5 -0
- package/templates/restaurant/l10n/fi.json +5 -0
- package/templates/restaurant/l10n/fr.json +5 -0
- package/templates/restaurant/l10n/he.json +4 -0
- package/templates/restaurant/l10n/hu.json +5 -0
- package/templates/restaurant/l10n/id.json +5 -0
- package/templates/restaurant/l10n/it.json +5 -0
- package/templates/restaurant/l10n/ja.json +5 -0
- package/templates/restaurant/l10n/ko.json +5 -0
- package/templates/restaurant/l10n/lt.json +5 -0
- package/templates/restaurant/l10n/nl.json +5 -0
- package/templates/restaurant/l10n/no.json +5 -0
- package/templates/restaurant/l10n/pl.json +5 -0
- package/templates/restaurant/l10n/pt.json +5 -0
- package/templates/restaurant/l10n/ru.json +5 -0
- package/templates/restaurant/l10n/sv.json +5 -0
- package/templates/restaurant/l10n/th.json +5 -0
- package/templates/restaurant/l10n/tr.json +5 -0
- package/templates/restaurant/l10n/uk.json +5 -0
- package/templates/restaurant/l10n/vi.json +5 -0
- package/templates/restaurant/l10n/zh.json +5 -0
- package/templates/restaurant/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/restaurant/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/restaurant/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/restaurant/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/restaurant-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/retail-store/dev/index.ts +1 -0
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +42 -19
- package/templates/retail-store/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/retail-store/tier5-src/_shared/himi-store-facets.ts +4 -4
- package/templates/retail-store/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/retail-store/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/retail-store/tier5-src/himi-branded-lite-cart/index.ts +13 -7
- package/templates/retail-store/tier5-src/himi-branded-lite-category/index.ts +6 -1
- package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/retail-store/tier5-src/himi-branded-lite-shop/index.ts +9 -3
- package/templates/retail-store/tier5-src/himi-store-product/index.ts +32 -15
- package/templates/retail-store/tier5-src/himi-store-saved/index.ts +31 -12
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/retail-store-owner/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/salon-spa/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/salon-spa/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/salon-spa/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/salon-spa/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/wholesale-store/dev/index.ts +2 -2
- package/templates/wholesale-store/tier5-src/_shared/collection-service.ts +42 -19
- package/templates/wholesale-store/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/wholesale-store/tier5-src/_shared/himi-store-collection.ts +7 -3
- package/templates/wholesale-store/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/wholesale-store/tier5-src/himi-branded-lite-cart/index.ts +13 -7
- package/templates/wholesale-store/tier5-src/himi-store-product/index.ts +32 -15
- package/templates/wholesale-store/tier5-src/himi-store-saved/index.ts +31 -12
- package/templates/wholesale-store/tier5-src/himi-wholesale-home/index.ts +19 -8
- package/templates/yoga-studio/dev/index.ts +3 -1
- package/templates/yoga-studio/l10n/ar.json +5 -0
- package/templates/yoga-studio/l10n/cs.json +5 -0
- package/templates/yoga-studio/l10n/da.json +5 -0
- package/templates/yoga-studio/l10n/de.json +5 -0
- package/templates/yoga-studio/l10n/el.json +5 -0
- package/templates/yoga-studio/l10n/es.json +5 -0
- package/templates/yoga-studio/l10n/fi.json +5 -0
- package/templates/yoga-studio/l10n/fr.json +5 -0
- package/templates/yoga-studio/l10n/he.json +4 -0
- package/templates/yoga-studio/l10n/hu.json +5 -0
- package/templates/yoga-studio/l10n/id.json +5 -0
- package/templates/yoga-studio/l10n/it.json +5 -0
- package/templates/yoga-studio/l10n/ja.json +5 -0
- package/templates/yoga-studio/l10n/ko.json +5 -0
- package/templates/yoga-studio/l10n/lt.json +5 -0
- package/templates/yoga-studio/l10n/nl.json +5 -0
- package/templates/yoga-studio/l10n/no.json +5 -0
- package/templates/yoga-studio/l10n/pl.json +5 -0
- package/templates/yoga-studio/l10n/pt.json +5 -0
- package/templates/yoga-studio/l10n/ru.json +5 -0
- package/templates/yoga-studio/l10n/sv.json +5 -0
- package/templates/yoga-studio/l10n/th.json +5 -0
- package/templates/yoga-studio/l10n/tr.json +5 -0
- package/templates/yoga-studio/l10n/uk.json +5 -0
- package/templates/yoga-studio/l10n/vi.json +5 -0
- package/templates/yoga-studio/l10n/zh.json +5 -0
- package/templates/yoga-studio/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/yoga-studio/tier5-src/_shared/engine-intl.ts +65 -0
- package/templates/yoga-studio/tier5-src/_shared/himi-store-saved.ts +275 -13
- package/templates/yoga-studio/tier5-src/_shared/weekly-goal.ts +28 -12
- package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +7 -2
- package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +14 -13
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +35 -15
- package/templates/yoga-studio-owner/tier5-src/_shared/engine-intl.ts +65 -0
|
@@ -30,10 +30,10 @@ import { cleanTitle, initials } from "../_shared/himi-text.js";
|
|
|
30
30
|
import { LAYOUT_KEY, type LayoutId, recommendLayout, resolveLayout } from "../_shared/himi-layouts.js";
|
|
31
31
|
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
32
32
|
import { groupMemberCount } from "../_shared/group-member-count.js";
|
|
33
|
-
import { parseWeeklyGoal, weeklyGoalProgress, weeklySessionsFromPages } from "../_shared/weekly-goal.js";
|
|
33
|
+
import { parseWeeklyGoal, resolveFirstWeekday, weekStartMs, weeklyGoalProgress, weeklySessionsFromPages, type Weekday } from "../_shared/weekly-goal.js";
|
|
34
34
|
import { isBridgeUnavailable } from "../_shared/owner-load-error.js";
|
|
35
35
|
import { formatDateMedium } from "../_shared/engine-intl.js";
|
|
36
|
-
import {
|
|
36
|
+
import { listSavedProducts, type SavedProduct } from "../_shared/himi-store-saved.js";
|
|
37
37
|
import { loadStoreCategories, type StoreCategoryCard } from "../_shared/himi-store-categories.js";
|
|
38
38
|
import { readSavedIds } from "../_shared/himi-blog-saved.js";
|
|
39
39
|
import { withoutHidden } from "../_shared/himi-blog-hidden.js";
|
|
@@ -699,14 +699,15 @@ function savedPostCard(post: WixPost): SavedPostCard {
|
|
|
699
699
|
interface SavedSignal { savedProducts: SavedProductCard[]; savedPosts: SavedPostCard[]; }
|
|
700
700
|
function emptySavedSignal(): SavedSignal { return { savedProducts: [], savedPosts: [] }; }
|
|
701
701
|
|
|
702
|
-
/** Resolve supported
|
|
703
|
-
* in refreshPersonal(), so a visitor can never trigger
|
|
702
|
+
/** Resolve supported saves into public rails: saved products are a signed-in member's account wishlist,
|
|
703
|
+
* a visitor's device list. Member-only work remains in refreshPersonal(), so a visitor can never trigger
|
|
704
|
+
* a bookings query here. */
|
|
704
705
|
async function fetchSavedSignal(arg: unknown): Promise<SavedSignal> {
|
|
705
706
|
const verticals = parseVerticals(arg);
|
|
706
707
|
const signal = emptySavedSignal();
|
|
707
708
|
if (verticals.includes("store")) {
|
|
708
|
-
try { signal.savedProducts =
|
|
709
|
-
catch { /*
|
|
709
|
+
try { signal.savedProducts = (await listSavedProducts()).slice(0, 6).map(savedProductCard); }
|
|
710
|
+
catch { /* an unreadable list simply collapses the optional rail */ }
|
|
710
711
|
}
|
|
711
712
|
if (verticals.includes("blog")) {
|
|
712
713
|
let ids: string[] = [];
|
|
@@ -1315,11 +1316,9 @@ async function refreshPublic(state: State, arg?: unknown): Promise<State | undef
|
|
|
1315
1316
|
|
|
1316
1317
|
let personalGeneration = 0;
|
|
1317
1318
|
let shopCategoryActivation = 0;
|
|
1318
|
-
function memberSchedule(rows: MemberBookingRow[], now
|
|
1319
|
-
|
|
1320
|
-
const
|
|
1321
|
-
weekStart.setDate(weekStart.getDate() - day);
|
|
1322
|
-
weekStart.setHours(0, 0, 0, 0);
|
|
1319
|
+
function memberSchedule(rows: MemberBookingRow[], now: Date, firstWeekday: Weekday): { label: string; fraction: number } {
|
|
1320
|
+
// The same week as the weekly-goal Gauge beside it (`weekly-goal.ts`).
|
|
1321
|
+
const weekStart = new Date(weekStartMs(now.getTime(), firstWeekday));
|
|
1323
1322
|
const weekEnd = new Date(weekStart);
|
|
1324
1323
|
weekEnd.setDate(weekEnd.getDate() + 7);
|
|
1325
1324
|
const current = rows.filter((row) => {
|
|
@@ -1343,6 +1342,8 @@ async function refreshPersonal(generation: number, arg?: unknown): Promise<void>
|
|
|
1343
1342
|
const weeklyGoal = parseWeeklyGoal(paramValue(arg, "weeklyGoal"));
|
|
1344
1343
|
if (member.email && parseVerticals(arg).includes("bookings")) {
|
|
1345
1344
|
const now = new Date();
|
|
1345
|
+
// The week starts on the screen's `firstWeekday` (the app's language, set by the descriptor), else the worker's language.
|
|
1346
|
+
const firstWeekday = resolveFirstWeekday(typeof arg === "string" ? undefined : paramValue(arg, "firstWeekday"));
|
|
1346
1347
|
const [upcoming, past] = await Promise.allSettled([
|
|
1347
1348
|
fetchMemberBookings({ query: "", filter: "value:Upcoming", sort: "default", savedIds: [] }, "", now.toISOString(), member),
|
|
1348
1349
|
fetchMemberBookings({ query: "", filter: "value:Past", sort: "za", savedIds: [] }, "", now.toISOString(), member),
|
|
@@ -1356,7 +1357,7 @@ async function refreshPersonal(generation: number, arg?: unknown): Promise<void>
|
|
|
1356
1357
|
if (upcoming.status === "fulfilled" && past.status === "fulfilled") {
|
|
1357
1358
|
// A schedule total needs both halves. Hide it rather than under-counting
|
|
1358
1359
|
// when either query failed.
|
|
1359
|
-
progress = memberSchedule([...upcoming.value.items, ...past.value.items], now);
|
|
1360
|
+
progress = memberSchedule([...upcoming.value.items, ...past.value.items], now, firstWeekday);
|
|
1360
1361
|
}
|
|
1361
1362
|
if (weeklyGoal > 0 && past.status === "fulfilled") {
|
|
1362
1363
|
// The goal counts sessions that already HAPPENED this week (_shared/weekly-goal.ts). A
|
|
@@ -1366,7 +1367,7 @@ async function refreshPersonal(generation: number, arg?: unknown): Promise<void>
|
|
|
1366
1367
|
try {
|
|
1367
1368
|
const readPast = (cursor: string) =>
|
|
1368
1369
|
fetchMemberBookings({ query: "", filter: "value:Past", sort: "za", savedIds: [] }, cursor, now.toISOString(), member);
|
|
1369
|
-
const goal = weeklyGoalProgress(await weeklySessionsFromPages(past.value, readPast, now.getTime()), weeklyGoal);
|
|
1370
|
+
const goal = weeklyGoalProgress(await weeklySessionsFromPages(past.value, readPast, now.getTime(), firstWeekday), weeklyGoal);
|
|
1370
1371
|
weekly = { count: goal.done, fraction: goal.fraction, label: goal.label };
|
|
1371
1372
|
} catch {
|
|
1372
1373
|
weekly = null;
|
|
@@ -15,7 +15,10 @@ type MemberAvatarFactory = (changed: () => void) => {
|
|
|
15
15
|
|
|
16
16
|
export interface CollectionSaving {
|
|
17
17
|
read(): string[];
|
|
18
|
-
|
|
18
|
+
/** May settle later (an account write); a rejection restores the selection and says so. */
|
|
19
|
+
write(ids: string[], rows: Record<string, unknown>[]): void | Promise<void>;
|
|
20
|
+
/** Re-read the saved ids `read` answers (an account list), before a load or refresh reads them. */
|
|
21
|
+
refresh?(): Promise<void>;
|
|
19
22
|
}
|
|
20
23
|
type State = Record<string, unknown>;
|
|
21
24
|
interface BackendCollection {
|
|
@@ -263,19 +266,33 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
263
266
|
const criteriaBefore = criteriaKey();
|
|
264
267
|
const before = [...prefs.savedIds], undoBefore = lastUndo;
|
|
265
268
|
update(arg, s);
|
|
269
|
+
const failed = () => {
|
|
270
|
+
prefs.savedIds = before; lastUndo = undoBefore;
|
|
271
|
+
saveMessage = copyParam('collection.saveError', 'Could not save this change. Try again.');
|
|
272
|
+
};
|
|
273
|
+
const finish = (settledLater: boolean) => {
|
|
274
|
+
persisted.write(prefs);
|
|
275
|
+
if (backend && config.backendQuery && criteriaBefore !== criteriaKey()) return backend.controller.query(criteria()).then(() => undefined);
|
|
276
|
+
// A write that settled later lands on the rows as they are now, not as they were when it began.
|
|
277
|
+
return derive(settledLater && backend ? backend.apply(s, backend.controller.getState()) : s);
|
|
278
|
+
};
|
|
266
279
|
if (saving && JSON.stringify(before) !== JSON.stringify(prefs.savedIds)) {
|
|
280
|
+
let written: void | Promise<void>;
|
|
267
281
|
try {
|
|
268
|
-
saving.write(prefs.savedIds, Array.isArray(s[config.rows]) ? s[config.rows] as CollectionRow[] : []);
|
|
269
|
-
saveMessage = '';
|
|
282
|
+
written = saving.write(prefs.savedIds, Array.isArray(s[config.rows]) ? s[config.rows] as CollectionRow[] : []);
|
|
270
283
|
} catch {
|
|
271
|
-
|
|
272
|
-
|
|
284
|
+
failed();
|
|
285
|
+
return finish(false);
|
|
286
|
+
}
|
|
287
|
+
if (written && typeof written.then === 'function') {
|
|
288
|
+
return written.then(() => { saveMessage = ''; return finish(true); }, () => { failed(); return finish(true); });
|
|
273
289
|
}
|
|
290
|
+
saveMessage = '';
|
|
274
291
|
}
|
|
275
|
-
|
|
276
|
-
if (backend && config.backendQuery && criteriaBefore !== criteriaKey()) return backend.controller.query(criteria()).then(() => undefined);
|
|
277
|
-
return derive(s);
|
|
292
|
+
return finish(false);
|
|
278
293
|
};
|
|
294
|
+
/** Runs `then` once the saved ids are re-read (an account list); at once, in the same turn, when there is nothing to re-read. */
|
|
295
|
+
const afterSavingRefresh = (then: () => Promise<undefined>): Promise<undefined> => saving?.refresh ? saving.refresh().catch(() => undefined).then(then) : then();
|
|
279
296
|
/** Filter and sort in ONE criteria change, so a tab that sets both runs one query, not two. */
|
|
280
297
|
const setCriteria = (arg: unknown): void => {
|
|
281
298
|
const input = object(arg);
|
|
@@ -329,15 +346,18 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
329
346
|
if (backend) {
|
|
330
347
|
actions.collectionDataChanged = s => derive(backend.apply(s, backend.controller.getState()));
|
|
331
348
|
actions.load = (_s, arg) => {
|
|
332
|
-
stashCopy(arg);
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
349
|
+
stashCopy(arg);
|
|
350
|
+
return afterSavingRefresh(() => {
|
|
351
|
+
syncSaved(); applyNavigationCriteria(arg, _s);
|
|
352
|
+
const reset = backend.onLoad?.(arg);
|
|
353
|
+
if (reset) { setCriteria(reset); persisted.write(prefs); }
|
|
354
|
+
// A load of what the screen already shows is the screen coming back: it revalidates behind its rows.
|
|
355
|
+
return backend.controller.query(criteria(), backend.restorePagesOnLoad, true).then(() => undefined);
|
|
356
|
+
});
|
|
337
357
|
};
|
|
338
358
|
actions.refresh = (_s, arg) => {
|
|
339
|
-
stashCopy(arg);
|
|
340
|
-
return backend.controller.query(criteria()).then(() => undefined);
|
|
359
|
+
stashCopy(arg);
|
|
360
|
+
return afterSavingRefresh(() => { syncSaved(); return backend.controller.query(criteria()).then(() => undefined); });
|
|
341
361
|
};
|
|
342
362
|
actions.loadMore = () => backend.controller.loadMore().then(() => undefined);
|
|
343
363
|
actions.retry = actions.collectionRetry = () => backend.controller.retry().then(() => undefined);
|
|
@@ -27,6 +27,21 @@ export function hasIntl(): boolean {
|
|
|
27
27
|
return typeof Intl !== "undefined";
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/** ECMA-402's first day of the week for `locale` (1 = Monday … 7 = Sunday), or undefined where this engine has no
|
|
31
|
+
* `Intl.Locale` week info (QuickJS has no `Intl`; older JSC / V8 / Hermes have no week info). Callers keep a CLDR table for
|
|
32
|
+
* that case, so every engine starts the same week (`weekly-goal.ts` `firstWeekdayOf`). */
|
|
33
|
+
export function intlFirstDayOfWeek(locale: string): number | undefined {
|
|
34
|
+
try {
|
|
35
|
+
// The guard form `worker-globals:check` reads as guarded: the `Intl` use sits inside the `typeof` test's block.
|
|
36
|
+
if (typeof Intl !== "undefined" && typeof Intl.Locale === "function") {
|
|
37
|
+
const loc = new Intl.Locale(locale) as Intl.Locale & { getWeekInfo?: () => { firstDay?: number }; weekInfo?: { firstDay?: number } };
|
|
38
|
+
const firstDay = (typeof loc.getWeekInfo === "function" ? loc.getWeekInfo() : loc.weekInfo)?.firstDay;
|
|
39
|
+
if (typeof firstDay === "number" && Number.isInteger(firstDay) && firstDay >= 1 && firstDay <= 7) return firstDay;
|
|
40
|
+
}
|
|
41
|
+
} catch { /* a malformed tag */ }
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
30
45
|
/** The device's IANA time zone, or "UTC" where this engine has no ECMA-402 or no zone data. */
|
|
31
46
|
export function deviceTimeZone(): string {
|
|
32
47
|
try {
|
|
@@ -536,3 +551,53 @@ export function formatTimeZoneLabel(date: Date, timeZone: string, locale = "en")
|
|
|
536
551
|
}
|
|
537
552
|
return "";
|
|
538
553
|
}
|
|
554
|
+
|
|
555
|
+
// ── The first day of the week ──────────────────────────────────────────────────────────────────────────────────────────────
|
|
556
|
+
// 0 = Sunday … 6 = Saturday, for the app language: the one rule every weekly count and every week a screen shows uses
|
|
557
|
+
// (`weekly-goal.ts`, the performance tracker, the Agenda's descriptor, the one-app generator). CLDR week data: Sunday for "en" /
|
|
558
|
+
// "en-US", Monday for "en-GB" or "de", Saturday for "ar-EG". ECMA-402 week info where the engine has it (`intlFirstDayOfWeek`),
|
|
559
|
+
// a CLDR table where it has not, so iOS, Android, web and a build host agree. It lives here rather than in its own file because
|
|
560
|
+
// every generated template already ships this module, and the public catalog's manifest lists each template file.
|
|
561
|
+
|
|
562
|
+
/** 0 = Sunday … 6 = Saturday, as `Date.prototype.getDay`. */
|
|
563
|
+
export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
564
|
+
export const MONDAY: Weekday = 1;
|
|
565
|
+
|
|
566
|
+
// CLDR `weekData.firstDay` (supplemental data), by region: every region not listed starts on Monday.
|
|
567
|
+
const SUNDAY_REGIONS = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" "));
|
|
568
|
+
const SATURDAY_REGIONS = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
|
|
569
|
+
const FRIDAY_REGIONS = new Set(["MV"]);
|
|
570
|
+
// The region CLDR's likely subtags give a bare language, for the languages whose region does not start on Monday.
|
|
571
|
+
const LIKELY_REGION: Record<string, string> = {
|
|
572
|
+
en: "US", he: "IL", iw: "IL", ar: "EG", pt: "BR", ja: "JP", zh: "CN", ko: "KR", hi: "IN", bn: "BD", th: "TH", id: "ID",
|
|
573
|
+
fa: "IR", ur: "PK", my: "MM", km: "KH", lo: "LA", ne: "NP", am: "ET", mr: "IN", ta: "IN", te: "IN", gu: "IN", kn: "IN",
|
|
574
|
+
ml: "IN", pa: "IN", fil: "PH", tl: "PH", zu: "ZA", dz: "BT", dv: "MV", ps: "AF",
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
/** The region of a language tag ("en-GB" → "GB", "zh-Hant-TW" → "TW"), else its language's likely region, else "". */
|
|
578
|
+
function regionOf(locale: string): string {
|
|
579
|
+
const parts = locale.split(/[-_]/);
|
|
580
|
+
const region = parts.slice(1).find((p) => /^(?:[A-Za-z]{2}|\d{3})$/.test(p));
|
|
581
|
+
if (region) return region.toUpperCase();
|
|
582
|
+
// A script with no region: Traditional Chinese is Taiwan's.
|
|
583
|
+
if (parts[0]?.toLowerCase() === "zh" && parts.some((p) => p.toLowerCase() === "hant")) return "TW";
|
|
584
|
+
return LIKELY_REGION[(parts[0] ?? "").toLowerCase()] ?? "";
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/** The first day of the week for `locale` (the app language by default). */
|
|
588
|
+
export function firstWeekdayOf(locale: string = appLocale()): Weekday {
|
|
589
|
+
// ECMA-402 numbers the days 1 = Monday … 7 = Sunday. A malformed tag or an engine without week info: the CLDR table below.
|
|
590
|
+
const firstDay = intlFirstDayOfWeek(locale);
|
|
591
|
+
if (firstDay !== undefined) return (firstDay % 7) as Weekday;
|
|
592
|
+
const region = regionOf(locale);
|
|
593
|
+
if (SUNDAY_REGIONS.has(region)) return 0;
|
|
594
|
+
if (SATURDAY_REGIONS.has(region)) return 6;
|
|
595
|
+
if (FRIDAY_REGIONS.has(region)) return 5;
|
|
596
|
+
return MONDAY;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/** A screen's `firstWeekday` param (0..6, or its text) when it pins one, else the app language's first day. */
|
|
600
|
+
export function resolveFirstWeekday(raw?: unknown, locale: string = appLocale()): Weekday {
|
|
601
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
|
|
602
|
+
return Number.isInteger(n) && n >= 0 && n <= 6 ? (n as Weekday) : firstWeekdayOf(locale);
|
|
603
|
+
}
|
|
@@ -2026,6 +2026,7 @@ const SCREENS = runtimeSetting({
|
|
|
2026
2026
|
"verticals": "[\"store\",\"blog\"]",
|
|
2027
2027
|
"homeModules": "[{\"id\":\"saved\",\"label\":\"Saved on this device\",\"dataSource\":\"device.saved_items\",\"emptyWhen\":[\"noSavedContent\"]},{\"id\":\"section_0\",\"label\":\"Shop the collection\",\"dataSource\":\"storeFirst.section0\"},{\"id\":\"section_1\",\"label\":\"Explore\",\"dataSource\":\"storeFirst.section1\"},{\"id\":\"section_2\",\"label\":\"Shop\",\"dataSource\":\"storeFirst.section2\"},{\"id\":\"section_3\",\"label\":\"Shop by category\",\"dataSource\":\"storeFirst.section3\",\"emptyWhen\":[\"noHomeCategories\"]}]",
|
|
2028
2028
|
"ownerDefaultLayout": "storeFirst",
|
|
2029
|
+
"firstWeekday": "0",
|
|
2029
2030
|
"copy": "{\"home.profileBody\":\"Sign in for orders and saved posts.\"}"
|
|
2030
2031
|
}
|
|
2031
2032
|
}
|
|
@@ -9,7 +9,10 @@ import type { MemberAvatarFactory } from './member-avatar.js';
|
|
|
9
9
|
|
|
10
10
|
export interface CollectionSaving {
|
|
11
11
|
read(): string[];
|
|
12
|
-
|
|
12
|
+
/** May settle later (an account write); a rejection restores the selection and says so. */
|
|
13
|
+
write(ids: string[], rows: Record<string, unknown>[]): void | Promise<void>;
|
|
14
|
+
/** Re-read the saved ids `read` answers (an account list), before a load or refresh reads them. */
|
|
15
|
+
refresh?(): Promise<void>;
|
|
13
16
|
}
|
|
14
17
|
type State = Record<string, unknown>;
|
|
15
18
|
interface BackendCollection {
|
|
@@ -267,19 +270,33 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
267
270
|
const criteriaBefore = criteriaKey();
|
|
268
271
|
const before = [...prefs.savedIds], undoBefore = lastUndo;
|
|
269
272
|
update(arg, s);
|
|
273
|
+
const failed = () => {
|
|
274
|
+
prefs.savedIds = before; lastUndo = undoBefore;
|
|
275
|
+
saveMessage = copyParam('collection.saveError', 'Could not save this change. Try again.');
|
|
276
|
+
};
|
|
277
|
+
const finish = (settledLater: boolean) => {
|
|
278
|
+
persisted.write(prefs);
|
|
279
|
+
if (backend && config.backendQuery && criteriaBefore !== criteriaKey()) return backend.controller.query(criteria()).then(() => undefined);
|
|
280
|
+
// A write that settled later lands on the rows as they are now, not as they were when it began.
|
|
281
|
+
return derive(settledLater && backend ? backend.apply(s, backend.controller.getState()) : s);
|
|
282
|
+
};
|
|
270
283
|
if (saving && JSON.stringify(before) !== JSON.stringify(prefs.savedIds)) {
|
|
284
|
+
let written: void | Promise<void>;
|
|
271
285
|
try {
|
|
272
|
-
saving.write(prefs.savedIds, Array.isArray(s[config.rows]) ? s[config.rows] as CollectionRow[] : []);
|
|
273
|
-
saveMessage = '';
|
|
286
|
+
written = saving.write(prefs.savedIds, Array.isArray(s[config.rows]) ? s[config.rows] as CollectionRow[] : []);
|
|
274
287
|
} catch {
|
|
275
|
-
|
|
276
|
-
|
|
288
|
+
failed();
|
|
289
|
+
return finish(false);
|
|
290
|
+
}
|
|
291
|
+
if (written && typeof written.then === 'function') {
|
|
292
|
+
return written.then(() => { saveMessage = ''; return finish(true); }, () => { failed(); return finish(true); });
|
|
277
293
|
}
|
|
294
|
+
saveMessage = '';
|
|
278
295
|
}
|
|
279
|
-
|
|
280
|
-
if (backend && config.backendQuery && criteriaBefore !== criteriaKey()) return backend.controller.query(criteria()).then(() => undefined);
|
|
281
|
-
return derive(s);
|
|
296
|
+
return finish(false);
|
|
282
297
|
};
|
|
298
|
+
/** Runs `then` once the saved ids are re-read (an account list); at once, in the same turn, when there is nothing to re-read. */
|
|
299
|
+
const afterSavingRefresh = (then: () => Promise<undefined>): Promise<undefined> => saving?.refresh ? saving.refresh().catch(() => undefined).then(then) : then();
|
|
283
300
|
/** Filter and sort in ONE criteria change, so a tab that sets both runs one query, not two. */
|
|
284
301
|
const setCriteria = (arg: unknown): void => {
|
|
285
302
|
const input = object(arg);
|
|
@@ -333,19 +350,25 @@ export function decorateCollection(name: string, def: { state: State; actions?:
|
|
|
333
350
|
if (backend) {
|
|
334
351
|
actions.collectionDataChanged = s => derive(backend.apply(s, backend.controller.getState()));
|
|
335
352
|
actions.load = (_s, arg) => {
|
|
336
|
-
stashCopy(arg);
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
353
|
+
stashCopy(arg);
|
|
354
|
+
return afterSavingRefresh(() => {
|
|
355
|
+
syncSaved(); applyNavigationCriteria(arg, _s);
|
|
356
|
+
const reset = backend.onLoad?.(arg);
|
|
357
|
+
if (reset) { setCriteria(reset); persisted.write(prefs); }
|
|
358
|
+
// A load of what the screen already shows is the screen coming back: it revalidates behind its rows.
|
|
359
|
+
return backend.controller.query(criteria(), backend.restorePagesOnLoad, true).then(() => undefined);
|
|
360
|
+
});
|
|
341
361
|
};
|
|
342
362
|
actions.refresh = (_s, arg) => {
|
|
343
|
-
stashCopy(arg);
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
363
|
+
stashCopy(arg);
|
|
364
|
+
return afterSavingRefresh(() => {
|
|
365
|
+
syncSaved();
|
|
366
|
+
// Reconnect refreshes the currently visible result. Rebuild every page the
|
|
367
|
+
// user had already opened, using fresh cursors, before replacing the snapshot.
|
|
368
|
+
return (backend.readLifecycle
|
|
369
|
+
? backend.controller.query(criteria(), true, true)
|
|
370
|
+
: backend.controller.query(criteria())).then(() => undefined);
|
|
371
|
+
});
|
|
349
372
|
};
|
|
350
373
|
actions.loadMore = () => backend.controller.loadMore().then(() => undefined);
|
|
351
374
|
actions.retry = actions.collectionRetry = () => backend.controller.retry().then(() => undefined);
|
|
@@ -27,6 +27,21 @@ export function hasIntl(): boolean {
|
|
|
27
27
|
return typeof Intl !== "undefined";
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/** ECMA-402's first day of the week for `locale` (1 = Monday … 7 = Sunday), or undefined where this engine has no
|
|
31
|
+
* `Intl.Locale` week info (QuickJS has no `Intl`; older JSC / V8 / Hermes have no week info). Callers keep a CLDR table for
|
|
32
|
+
* that case, so every engine starts the same week (`weekly-goal.ts` `firstWeekdayOf`). */
|
|
33
|
+
export function intlFirstDayOfWeek(locale: string): number | undefined {
|
|
34
|
+
try {
|
|
35
|
+
// The guard form `worker-globals:check` reads as guarded: the `Intl` use sits inside the `typeof` test's block.
|
|
36
|
+
if (typeof Intl !== "undefined" && typeof Intl.Locale === "function") {
|
|
37
|
+
const loc = new Intl.Locale(locale) as Intl.Locale & { getWeekInfo?: () => { firstDay?: number }; weekInfo?: { firstDay?: number } };
|
|
38
|
+
const firstDay = (typeof loc.getWeekInfo === "function" ? loc.getWeekInfo() : loc.weekInfo)?.firstDay;
|
|
39
|
+
if (typeof firstDay === "number" && Number.isInteger(firstDay) && firstDay >= 1 && firstDay <= 7) return firstDay;
|
|
40
|
+
}
|
|
41
|
+
} catch { /* a malformed tag */ }
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
30
45
|
/** The device's IANA time zone, or "UTC" where this engine has no ECMA-402 or no zone data. */
|
|
31
46
|
export function deviceTimeZone(): string {
|
|
32
47
|
try {
|
|
@@ -536,3 +551,53 @@ export function formatTimeZoneLabel(date: Date, timeZone: string, locale = "en")
|
|
|
536
551
|
}
|
|
537
552
|
return "";
|
|
538
553
|
}
|
|
554
|
+
|
|
555
|
+
// ── The first day of the week ──────────────────────────────────────────────────────────────────────────────────────────────
|
|
556
|
+
// 0 = Sunday … 6 = Saturday, for the app language: the one rule every weekly count and every week a screen shows uses
|
|
557
|
+
// (`weekly-goal.ts`, the performance tracker, the Agenda's descriptor, the one-app generator). CLDR week data: Sunday for "en" /
|
|
558
|
+
// "en-US", Monday for "en-GB" or "de", Saturday for "ar-EG". ECMA-402 week info where the engine has it (`intlFirstDayOfWeek`),
|
|
559
|
+
// a CLDR table where it has not, so iOS, Android, web and a build host agree. It lives here rather than in its own file because
|
|
560
|
+
// every generated template already ships this module, and the public catalog's manifest lists each template file.
|
|
561
|
+
|
|
562
|
+
/** 0 = Sunday … 6 = Saturday, as `Date.prototype.getDay`. */
|
|
563
|
+
export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
564
|
+
export const MONDAY: Weekday = 1;
|
|
565
|
+
|
|
566
|
+
// CLDR `weekData.firstDay` (supplemental data), by region: every region not listed starts on Monday.
|
|
567
|
+
const SUNDAY_REGIONS = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" "));
|
|
568
|
+
const SATURDAY_REGIONS = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
|
|
569
|
+
const FRIDAY_REGIONS = new Set(["MV"]);
|
|
570
|
+
// The region CLDR's likely subtags give a bare language, for the languages whose region does not start on Monday.
|
|
571
|
+
const LIKELY_REGION: Record<string, string> = {
|
|
572
|
+
en: "US", he: "IL", iw: "IL", ar: "EG", pt: "BR", ja: "JP", zh: "CN", ko: "KR", hi: "IN", bn: "BD", th: "TH", id: "ID",
|
|
573
|
+
fa: "IR", ur: "PK", my: "MM", km: "KH", lo: "LA", ne: "NP", am: "ET", mr: "IN", ta: "IN", te: "IN", gu: "IN", kn: "IN",
|
|
574
|
+
ml: "IN", pa: "IN", fil: "PH", tl: "PH", zu: "ZA", dz: "BT", dv: "MV", ps: "AF",
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
/** The region of a language tag ("en-GB" → "GB", "zh-Hant-TW" → "TW"), else its language's likely region, else "". */
|
|
578
|
+
function regionOf(locale: string): string {
|
|
579
|
+
const parts = locale.split(/[-_]/);
|
|
580
|
+
const region = parts.slice(1).find((p) => /^(?:[A-Za-z]{2}|\d{3})$/.test(p));
|
|
581
|
+
if (region) return region.toUpperCase();
|
|
582
|
+
// A script with no region: Traditional Chinese is Taiwan's.
|
|
583
|
+
if (parts[0]?.toLowerCase() === "zh" && parts.some((p) => p.toLowerCase() === "hant")) return "TW";
|
|
584
|
+
return LIKELY_REGION[(parts[0] ?? "").toLowerCase()] ?? "";
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/** The first day of the week for `locale` (the app language by default). */
|
|
588
|
+
export function firstWeekdayOf(locale: string = appLocale()): Weekday {
|
|
589
|
+
// ECMA-402 numbers the days 1 = Monday … 7 = Sunday. A malformed tag or an engine without week info: the CLDR table below.
|
|
590
|
+
const firstDay = intlFirstDayOfWeek(locale);
|
|
591
|
+
if (firstDay !== undefined) return (firstDay % 7) as Weekday;
|
|
592
|
+
const region = regionOf(locale);
|
|
593
|
+
if (SUNDAY_REGIONS.has(region)) return 0;
|
|
594
|
+
if (SATURDAY_REGIONS.has(region)) return 6;
|
|
595
|
+
if (FRIDAY_REGIONS.has(region)) return 5;
|
|
596
|
+
return MONDAY;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/** A screen's `firstWeekday` param (0..6, or its text) when it pins one, else the app language's first day. */
|
|
600
|
+
export function resolveFirstWeekday(raw?: unknown, locale: string = appLocale()): Weekday {
|
|
601
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
|
|
602
|
+
return Number.isInteger(n) && n >= 0 && n <= 6 ? (n as Weekday) : firstWeekdayOf(locale);
|
|
603
|
+
}
|
|
@@ -456,12 +456,12 @@ function selectedId(arg: unknown): string {
|
|
|
456
456
|
return String((arg as { selectedId?: unknown } | undefined)?.selectedId ?? "");
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
/** Toggle one card's saved state in the shared saved-products store
|
|
460
|
-
*
|
|
461
|
-
export function toggleSaved(cards: ProductCard[], id: string): void {
|
|
459
|
+
/** Toggle one card's saved state in the shared saved-products store (a member's account wishlist).
|
|
460
|
+
* Throws when the write fails, so the caller keeps its state and the heart never lies. */
|
|
461
|
+
export async function toggleSaved(cards: ProductCard[], id: string): Promise<void> {
|
|
462
462
|
const card = cards.find((c) => c.id === id);
|
|
463
463
|
if (!card) return;
|
|
464
|
-
toggleSavedProduct({ id: card.id, name: card.name, price: card.commercePrice || card.price, image: card.image,
|
|
464
|
+
await toggleSavedProduct({ id: card.id, name: card.name, price: card.commercePrice || card.price, image: card.image,
|
|
465
465
|
wasPrice: card.commerceWasPrice ?? card.wasPrice,
|
|
466
466
|
swatches: [card.swatch1, card.swatch2, card.swatch3, card.swatch4, card.swatch5].filter(Boolean) });
|
|
467
467
|
}
|