@wix/himalaya-cli 0.1748.0 → 0.1750.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/bin/himi +16 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +9 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +2 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/l10n.mjs +1 -1
- package/dist/browser-plane/assets.json +7 -7
- package/dist/browser-plane/preview-deferred/{63821bbb8f637899037252154a5587f0596e4b537173c7f50551f9e44f7c22c0.bin → b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin} +1 -1
- package/dist/browser-plane/sw.js +6 -6
- package/dist/browser-plane/t5-frame.html +1 -1
- package/dist/browser-plane/t5-worker-frame.html +1 -1
- package/dist/cli.mjs +13464 -8217
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +9 -0
- package/guides/getting-started.md +3 -1
- package/guides/himi-json-output.md +54 -1
- package/guides/himi-skill.md +3 -1
- package/guides/one-app-to-himi-app.md +31 -8
- package/guides/skill.md +3 -1
- package/guides/store-submission.md +149 -34
- package/guides/wix-business-context.md +14 -0
- package/package.json +10 -10
- package/template-icons/medical-services.png +0 -0
- package/template-icons/personal-fitness-trainer.png +0 -0
- package/templates/beauty-salon/config.ts +12 -0
- package/templates/beauty-salon/dev/index.ts +1 -0
- package/templates/beauty-salon/l10n/en.json +6 -0
- package/templates/beauty-salon/l10n/fr.json +11 -0
- package/templates/beauty-salon/l10n/he.json +9 -0
- package/templates/beauty-salon/tier5-src/_shared/booking-session.ts +3 -1
- package/templates/beauty-salon/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/beauty-salon/tier5-src/_shared/header-badges.ts +113 -0
- package/templates/beauty-salon/tier5-src/_shared/location-pin.ts +97 -0
- package/templates/beauty-salon/tier5-src/_shared/member-access.ts +17 -6
- package/templates/beauty-salon/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/beauty-salon/tier5-src/_shared/source-badges.ts +72 -0
- package/templates/beauty-salon/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/beauty-salon/tier5-src/himi-branded-lite-nav/index.ts +152 -0
- package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/beauty-salon/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/beauty-salon-owner/dev/index.ts +54 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/beauty-salon-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/branded-lite/config.ts +12 -0
- package/templates/branded-lite/dev/index.ts +1 -0
- package/templates/branded-lite/l10n/fr.json +10 -0
- package/templates/branded-lite/l10n/he.json +8 -0
- package/templates/branded-lite/tier5-src/_shared/booking-session.ts +3 -1
- package/templates/branded-lite/tier5-src/_shared/location-pin.ts +97 -0
- package/templates/branded-lite/tier5-src/_shared/member-access.ts +17 -6
- package/templates/branded-lite/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/branded-lite/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-access-nav/index.ts +10 -5
- package/templates/branded-lite/tier5-src/himi-branded-lite-nav/index.ts +152 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-video/index.ts +12 -1
- package/templates/branded-lite/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/branded-lite/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/community-club/dev/index.ts +1 -0
- package/templates/community-club/tier5-src/_shared/member-access.ts +17 -6
- package/templates/community-club/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/community-club/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/community-club/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/community-club-owner/dev/index.ts +54 -0
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/community-club-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/conference/dev/index.ts +1 -0
- package/templates/conference/tier5-src/_shared/member-access.ts +17 -6
- package/templates/conference/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/events-meetups/dev/index.ts +1 -0
- package/templates/events-meetups/tier5-src/_shared/member-access.ts +17 -6
- package/templates/events-meetups/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/events-meetups/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/events-meetups/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/events-meetups-owner/dev/index.ts +54 -0
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/events-meetups-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/gym-fitness/config.ts +12 -0
- package/templates/gym-fitness/dev/index.ts +1 -0
- package/templates/gym-fitness/l10n/en.json +6 -0
- package/templates/gym-fitness/l10n/fr.json +11 -0
- package/templates/gym-fitness/l10n/he.json +9 -0
- package/templates/gym-fitness/tier5-src/_shared/booking-session.ts +3 -1
- package/templates/gym-fitness/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/gym-fitness/tier5-src/_shared/header-badges.ts +113 -0
- package/templates/gym-fitness/tier5-src/_shared/location-pin.ts +97 -0
- package/templates/gym-fitness/tier5-src/_shared/member-access.ts +17 -6
- package/templates/gym-fitness/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/gym-fitness/tier5-src/_shared/source-badges.ts +72 -0
- package/templates/gym-fitness/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/gym-fitness/tier5-src/himi-branded-lite-nav/index.ts +152 -0
- package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/gym-fitness/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/gym-fitness-owner/dev/index.ts +54 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/gym-fitness-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/medical-services/README.md +53 -0
- package/templates/medical-services/config.ts +320 -0
- package/templates/medical-services/dev/index.ts +17783 -0
- package/templates/medical-services/himalaya.content.json +46 -0
- package/templates/medical-services/himalaya.template.json +14 -0
- package/templates/medical-services/icon.png +0 -0
- package/templates/medical-services/platforms.json +1 -0
- package/templates/medical-services/tier5-src/_shared/app-locale.ts +61 -0
- package/templates/medical-services/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/medical-services/tier5-src/_shared/booking-session.ts +224 -0
- package/templates/medical-services/tier5-src/_shared/branded-lite-hosted.ts +280 -0
- package/templates/medical-services/tier5-src/_shared/branded-load-state.ts +109 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-history.ts +51 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-model.ts +56 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-presenter.ts +576 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/medical-services/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/medical-services/tier5-src/_shared/collection-query.ts +193 -0
- package/templates/medical-services/tier5-src/_shared/collection-service.ts +400 -0
- package/templates/medical-services/tier5-src/_shared/engine-intl.ts +523 -0
- package/templates/medical-services/tier5-src/_shared/faq-list.ts +405 -0
- package/templates/medical-services/tier5-src/_shared/himi-account.ts +194 -0
- package/templates/medical-services/tier5-src/_shared/himi-booking-saved.ts +88 -0
- package/templates/medical-services/tier5-src/_shared/himi-bookings.ts +318 -0
- package/templates/medical-services/tier5-src/_shared/himi-copy.ts +116 -0
- package/templates/medical-services/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/medical-services/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/medical-services/tier5-src/_shared/host-events.ts +66 -0
- package/templates/medical-services/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/medical-services/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/medical-services/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
- package/templates/medical-services/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/medical-services/tier5-src/_shared/iap-worker.ts +127 -0
- package/templates/medical-services/tier5-src/_shared/inbox-rooms.ts +68 -0
- package/templates/medical-services/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/medical-services/tier5-src/_shared/member-access.ts +63 -0
- package/templates/medical-services/tier5-src/_shared/member-account-routes.ts +52 -0
- package/templates/medical-services/tier5-src/_shared/member-bookings.ts +107 -0
- package/templates/medical-services/tier5-src/_shared/member-screen.ts +99 -0
- package/templates/medical-services/tier5-src/_shared/notification-target.ts +141 -0
- package/templates/medical-services/tier5-src/_shared/offset-page.ts +10 -0
- package/templates/medical-services/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/medical-services/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/medical-services/tier5-src/_shared/payment-setup.ts +6 -0
- package/templates/medical-services/tier5-src/_shared/rich-body.ts +78 -0
- package/templates/medical-services/tier5-src/_shared/rich-content-link.ts +34 -0
- package/templates/medical-services/tier5-src/_shared/sign-in-sheet.ts +18 -0
- package/templates/medical-services/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/medical-services/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/medical-services/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/medical-services/tier5-src/_shared/wix-member-links.ts +114 -0
- package/templates/medical-services/tier5-src/_shared/wix-service-price.ts +146 -0
- package/templates/medical-services/tier5-src/business-chat/index.ts +732 -0
- package/templates/medical-services/tier5-src/himi-booking-account/index.ts +252 -0
- package/templates/medical-services/tier5-src/himi-booking-bookings/index.ts +468 -0
- package/templates/medical-services/tier5-src/himi-booking-service/index.ts +1190 -0
- package/templates/medical-services/tier5-src/himi-booking-services/index.ts +791 -0
- package/templates/medical-services/tier5-src/himi-booking-time/index.ts +1729 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-faq/index.ts +6 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
- package/templates/medical-services/tier5-src/himi-clinic-home/index.ts +389 -0
- package/templates/medical-services/tier5-src/himi-store-account/index.ts +1007 -0
- package/templates/medical-services/tokens.json +418 -0
- package/templates/nonprofit-cause/dev/index.ts +1 -0
- package/templates/nonprofit-cause/tier5-src/_shared/member-access.ts +17 -6
- package/templates/nonprofit-cause/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/nonprofit-cause/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/nonprofit-cause-owner/dev/index.ts +54 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/nonprofit-cause-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/owner-lite/dev/index.ts +54 -0
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/owner-lite/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/personal-fitness-trainer/README.md +51 -0
- package/templates/personal-fitness-trainer/config.ts +343 -0
- package/templates/personal-fitness-trainer/dev/index.ts +24813 -0
- package/templates/personal-fitness-trainer/himalaya.content.json +79 -0
- package/templates/personal-fitness-trainer/himalaya.template.json +14 -0
- package/templates/personal-fitness-trainer/icon.png +0 -0
- package/templates/personal-fitness-trainer/platforms.json +3 -0
- package/templates/personal-fitness-trainer/splash.json +3 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/app-locale.ts +61 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/booking-session.ts +224 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/branded-lite-hosted.ts +280 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/branded-load-state.ts +109 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-history.ts +51 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-model.ts +56 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-presenter.ts +576 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-query.ts +193 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +400 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/empty-flags.ts +33 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/engine-intl.ts +523 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-account.ts +194 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-booking-saved.ts +88 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-bookings.ts +318 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-copy.ts +116 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-layouts.ts +142 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/host-events.ts +66 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/iap-worker.ts +127 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/inbox-rooms.ts +68 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/member-access.ts +63 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/member-account-routes.ts +52 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/member-bookings.ts +107 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/member-screen.ts +99 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/offset-page.ts +10 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/payment-setup.ts +6 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/rich-body.ts +78 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/rich-content-link.ts +34 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/sign-in-sheet.ts +18 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/video-caption.ts +21 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/wix-service-price.ts +146 -0
- package/templates/personal-fitness-trainer/tier5-src/business-chat/index.ts +732 -0
- package/templates/personal-fitness-trainer/tier5-src/business-contact/index.ts +6 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-bookings/index.ts +468 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-service/index.ts +1190 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-services/index.ts +791 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-time/index.ts +1729 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +242 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/index.ts +1094 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +955 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-appearance/index.ts +94 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-notifsettings/index.ts +173 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-plans/index.ts +495 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-splash/index.ts +35 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-video/index.ts +226 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-videos/index.ts +145 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-fitness-trainer-home/index.ts +70 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-fitness-trainer-profile/index.ts +53 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +1007 -0
- package/templates/personal-fitness-trainer/tier5-src/wix-spaces-app-language/index.ts +73 -0
- package/templates/personal-fitness-trainer/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/personal-fitness-trainer/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
- package/templates/personal-fitness-trainer/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
- package/templates/personal-fitness-trainer/tier5-src/wix-spaces-view-profile/index.ts +119 -0
- package/templates/personal-fitness-trainer/tokens.json +381 -0
- package/templates/podcast-creator/dev/index.ts +1 -0
- package/templates/podcast-creator/tier5-src/_shared/member-access.ts +17 -6
- package/templates/podcast-creator/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/podcast-creator/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/podcast-creator-owner/dev/index.ts +54 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/podcast-creator-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/portfolio-creative/dev/index.ts +1 -0
- package/templates/portfolio-creative/tier5-src/_shared/member-access.ts +17 -6
- package/templates/portfolio-creative/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/portfolio-creative/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/portfolio-creative-owner/dev/index.ts +54 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/portfolio-creative-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/restaurant/dev/index.ts +1 -0
- package/templates/restaurant/tier5-src/_shared/member-access.ts +17 -6
- package/templates/restaurant/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/restaurant/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/restaurant/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/restaurant-owner/dev/index.ts +54 -0
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/restaurant-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/retail-store/dev/index.ts +1 -0
- package/templates/retail-store/tier5-src/_shared/member-access.ts +17 -6
- package/templates/retail-store/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/retail-store/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/retail-store/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/retail-store-owner/dev/index.ts +54 -0
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/retail-store-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
- package/templates/salon-spa/dev/index.ts +1 -0
- package/templates/salon-spa/tier5-src/_shared/booking-session.ts +3 -1
- package/templates/salon-spa/tier5-src/_shared/member-access.ts +17 -6
- package/templates/salon-spa/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/salon-spa/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/salon-spa/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/salon-spa/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/salon-spa/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/wholesale-store/dev/index.ts +1 -0
- package/templates/wholesale-store/tier5-src/_shared/member-access.ts +17 -6
- package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/yoga-studio/config.ts +12 -0
- package/templates/yoga-studio/dev/index.ts +1 -0
- package/templates/yoga-studio/l10n/en.json +6 -0
- package/templates/yoga-studio/l10n/fr.json +11 -0
- package/templates/yoga-studio/l10n/he.json +9 -0
- package/templates/yoga-studio/tier5-src/_shared/booking-session.ts +3 -1
- package/templates/yoga-studio/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/yoga-studio/tier5-src/_shared/header-badges.ts +113 -0
- package/templates/yoga-studio/tier5-src/_shared/location-pin.ts +97 -0
- package/templates/yoga-studio/tier5-src/_shared/member-access.ts +17 -6
- package/templates/yoga-studio/tier5-src/_shared/member-bookings.ts +17 -4
- package/templates/yoga-studio/tier5-src/_shared/source-badges.ts +72 -0
- package/templates/yoga-studio/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +6 -2
- package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +7 -2
- package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +6 -4
- package/templates/yoga-studio/tier5-src/himi-branded-lite-nav/index.ts +152 -0
- package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/yoga-studio/tier5-src/wix-spaces-view-profile/index.ts +68 -55
- package/templates/yoga-studio-owner/dev/index.ts +54 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +30 -4
- package/templates/yoga-studio-owner/tier5-src/himi-owner-lite-aria/index.ts +29 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// App Store prices come from the shared IAP catalog layer (@himalaya/iap): a video with a one-time Sale
|
|
2
|
+
// price, in a channel that does not require a subscription, is priced as `wixVideo` under its id. Buying
|
|
3
|
+
// goes through the shared checkout (`wixVideoOrders`) and only once VIDEOS_APPLE_SALES_ENABLED is on;
|
|
4
|
+
// until then the checkout is not composed at all and the screen says buying is not available yet.
|
|
5
|
+
import { descriptionBody } from "../_shared/rich-body.js";
|
|
6
|
+
import { defineService } from "@himalaya/state";
|
|
7
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
8
|
+
import { iapPriceFields, wixVideoItem, type IapCatalogItem } from "@himalaya/iap";
|
|
9
|
+
import { createIapCommerce, videosAppleSalesEnabled, wixVideoOrders, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
10
|
+
import { iapPriceCopy, iapPurchaseCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
|
|
11
|
+
import { LOADING, loaded, loadFailed, needsSignIn, type LoadFlags } from "../_shared/branded-load-state.js";
|
|
12
|
+
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
13
|
+
import {
|
|
14
|
+
canWatchVideo, getVideo, getVideoStreamUrl, isHostedVideo, isVideoProcessing, listChannelVideos, videoCard, youtubeVideoId,
|
|
15
|
+
} from "@himalaya/wix-video";
|
|
16
|
+
import type { MediaItem } from "@himalaya/core";
|
|
17
|
+
|
|
18
|
+
interface VideoRow { id: string; channelId: string; title: string; subtitle: string; meta: string; coverUrl: string; hasCover: boolean; noCover: boolean; priceLine: string }
|
|
19
|
+
interface S extends LoadFlags {
|
|
20
|
+
id: string; channelId: string;
|
|
21
|
+
title: string; description: string; videos: VideoRow[];
|
|
22
|
+
items: MediaItem[]; hidePlayer: boolean; hideNotFound: boolean; noEntity: boolean; hideRefresh: boolean; emptyText: string; message: string;
|
|
23
|
+
playbackState: "loading" | "ready" | "processing" | "denied" | "unavailable" | "error";
|
|
24
|
+
/** This run's App Store price of the video, its loading/unavailable label, or "". */
|
|
25
|
+
priceText: string; priceNote: string; purchaseNote: string; hidePriceRetry: boolean;
|
|
26
|
+
/** The shared checkout's Buy (`commerce.purchaseFields`): shown only on the App Store route. */
|
|
27
|
+
buyHidden: boolean; buyLabel: string; buyDisabled: boolean; buyNote: string;
|
|
28
|
+
}
|
|
29
|
+
const COPY = { prefix: "video", empty: "No videos in this channel yet.", error: "Videos couldn't be loaded.", signIn: "Sign in to watch videos.", sample: () => [] };
|
|
30
|
+
function input(key: string): string {
|
|
31
|
+
const value = (globalThis as { himalaya?: { input?: Record<string, unknown> } }).himalaya?.input?.[key];
|
|
32
|
+
return typeof value === "string" ? value : "";
|
|
33
|
+
}
|
|
34
|
+
let generation = 0;
|
|
35
|
+
const initial: S = { ...LOADING, id: "", channelId: "", title: "", description: "", videos: [], items: [], hidePlayer: true, hideNotFound: true, noEntity: false, hideRefresh: false, emptyText: "", message: "", playbackState: "loading",
|
|
36
|
+
priceText: "", priceNote: "", purchaseNote: "", hidePriceRetry: true, buyHidden: true, buyLabel: "", buyDisabled: true, buyNote: "" };
|
|
37
|
+
|
|
38
|
+
// ── App Store prices ─────
|
|
39
|
+
// One writer: `load` keeps what it read in `shown` and the priced items here; every repaint goes
|
|
40
|
+
// through the synchronous `publish`, which reads the latest content and prices together.
|
|
41
|
+
/** Read once: the checkout is composed for the whole visit or not at all. */
|
|
42
|
+
const SELLS_THROUGH_APPLE = videosAppleSalesEnabled();
|
|
43
|
+
const commerce = createIapCommerce({ adapters: SELLS_THROUGH_APPLE ? [wixVideoOrders] : [], onChange: () => { void svc.publish(); } });
|
|
44
|
+
const pricing = commerce.pricing;
|
|
45
|
+
let shown: S = { ...initial };
|
|
46
|
+
/** The item the detail prices: a locked video sold once. Rows carry their own. */
|
|
47
|
+
let detailItem: IapCatalogItem | undefined;
|
|
48
|
+
let rowItems: Array<IapCatalogItem | undefined> = [];
|
|
49
|
+
let commerceStarted = false;
|
|
50
|
+
/** The bought video `load` re-reads so the player replaces Buy. Only a read that failed, or that Video
|
|
51
|
+
* still denied while its grant catches up, runs again: after ACCESS_RELOAD_RETRY_MS, on the next repaint,
|
|
52
|
+
* at most ACCESS_RELOAD_ATTEMPTS times. Any other answer (the player, processing, unavailable) is final. */
|
|
53
|
+
let accessReload = { id: "", at: 0, attempts: 0, settled: false };
|
|
54
|
+
const ACCESS_RELOAD_RETRY_MS = 10_000;
|
|
55
|
+
const ACCESS_RELOAD_ATTEMPTS = 5;
|
|
56
|
+
const NOT_APPLE: IapPurchaseFields = { appleRoute: false, accessReady: false, buyLabel: "", buyDisabled: true, buyBusy: false, buyNote: "" };
|
|
57
|
+
const NO_BUY = { buyHidden: true, buyLabel: "", buyDisabled: true, buyNote: "" };
|
|
58
|
+
|
|
59
|
+
async function priceContent(): Promise<void> {
|
|
60
|
+
const items = [...(detailItem ? [detailItem] : []), ...rowItems.flatMap((item) => item ?? [])];
|
|
61
|
+
if (items.length) await commerce.loadPrices(items);
|
|
62
|
+
void svc.publish();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Every projection re-arms the checkout's poll, so it steps between cadences on any screen. */
|
|
66
|
+
function priced(state: S): S {
|
|
67
|
+
// A read after access that did not play the video leaves no priced item, so the retry is checked here.
|
|
68
|
+
if (accessReload.id && !accessReload.settled && accessReload.id === state.id) reloadOnceForAccess(state.id);
|
|
69
|
+
return { ...projected(state), ...withPoll() } as S;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function projected(state: S): S {
|
|
73
|
+
const copy = iapPriceCopy("video");
|
|
74
|
+
const videos = state.videos.map((row, i) => ({ ...row, priceLine: rowItems[i] ? iapPriceFields(pricing.view(rowItems[i]!.reference), copy).priceText : "" }));
|
|
75
|
+
if (!detailItem) return { ...state, videos, priceText: "", priceNote: "", purchaseNote: "", hidePriceRetry: true, ...NO_BUY };
|
|
76
|
+
const view = pricing.view(detailItem.reference);
|
|
77
|
+
if (view.route === "disabled") return { ...state, videos, priceText: "", priceNote: "", purchaseNote: "", hidePriceRetry: true, ...NO_BUY };
|
|
78
|
+
const fields = iapPriceFields(view, copy);
|
|
79
|
+
const purchase = SELLS_THROUGH_APPLE ? commerce.purchaseFields(detailItem.reference, iapPurchaseCopy("video")) : NOT_APPLE;
|
|
80
|
+
if (purchase.accessReady) reloadOnceForAccess(state.id);
|
|
81
|
+
// No access for this video now (another member, or a new sale): its next grant reloads again.
|
|
82
|
+
else if (accessReload.id === state.id) accessReload = { id: "", at: 0, attempts: 0, settled: false };
|
|
83
|
+
return { ...state, videos, priceText: fields.priceText, priceNote: fields.priceNote,
|
|
84
|
+
// On the App Store route Buy and its own note replace "not available yet".
|
|
85
|
+
purchaseNote: purchase.appleRoute ? "" : fields.actionNote,
|
|
86
|
+
// An incomplete host scope (a failed app-identity read) reads as non-retryable; Retry re-reads it.
|
|
87
|
+
hidePriceRetry: fields.hidePriceRetry && commerce.scopeComplete(),
|
|
88
|
+
buyHidden: !purchase.appleRoute || purchase.accessReady, buyLabel: purchase.buyLabel, buyDisabled: purchase.buyDisabled, buyNote: purchase.buyNote };
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** A purchase being tracked polls faster; the directive is re-armed only when its interval changes. */
|
|
92
|
+
function withPoll(): { _poll?: unknown } {
|
|
93
|
+
const poll = SELLS_THROUGH_APPLE ? commerce.pollDirective("himiBrandedVideo.iapPoll") : undefined;
|
|
94
|
+
return poll ? { _poll: poll } : {};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Video says the member's purchase is ACTIVE: read the video again so the player replaces Buy. */
|
|
98
|
+
function reloadOnceForAccess(id: string): void {
|
|
99
|
+
if (!id) return;
|
|
100
|
+
const now = Date.now();
|
|
101
|
+
const same = accessReload.id === id;
|
|
102
|
+
if (same && (accessReload.settled || now - accessReload.at < ACCESS_RELOAD_RETRY_MS)) return;
|
|
103
|
+
const attempts = same ? accessReload.attempts + 1 : 1;
|
|
104
|
+
accessReload = { id, at: now, attempts, settled: attempts >= ACCESS_RELOAD_ATTEMPTS };
|
|
105
|
+
void svc.load();
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** First entry recovers held purchases; every later load (a return to the screen) reconciles. */
|
|
109
|
+
async function resumeCommerce(): Promise<void> {
|
|
110
|
+
if (!SELLS_THROUGH_APPLE) return;
|
|
111
|
+
const first = !commerceStarted;
|
|
112
|
+
commerceStarted = true;
|
|
113
|
+
await (first ? commerce.start() : commerce.reconcile());
|
|
114
|
+
void svc.publish();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The App Store sale of the locked video on screen, only through the shared checkout. */
|
|
118
|
+
async function buy(): Promise<undefined> {
|
|
119
|
+
const item = detailItem;
|
|
120
|
+
if (!SELLS_THROUGH_APPLE || !item) return undefined;
|
|
121
|
+
await commerce.buy({ reference: item.reference });
|
|
122
|
+
void svc.publish();
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
function unavailable(s: S, kind: S["playbackState"], message: string): S {
|
|
126
|
+
return { ...s, ...loaded("videos", [], { ...COPY, empty: "" }), items: [], hidePlayer: true, hideNotFound: kind !== "unavailable", noEntity: kind === "unavailable", hideRefresh: kind === "unavailable", emptyText: "", message, playbackState: kind };
|
|
127
|
+
}
|
|
128
|
+
async function deniedVideo(s: S): Promise<S> {
|
|
129
|
+
const identity = await memberAccess();
|
|
130
|
+
const signedIn = identity.signedIn === true || Boolean(identity.email);
|
|
131
|
+
// A successful public metadata read can still describe a paid video. It does not
|
|
132
|
+
// produce a 401, so explicitly offer the existing sign-in continuation to visitors.
|
|
133
|
+
return { ...unavailable(s, "denied", signedIn
|
|
134
|
+
? copyParam("video.deniedText", "Your current membership or purchase does not allow this video.")
|
|
135
|
+
: copyParam("video.accessSignInText", "Sign in with an account that has access to this video.")),
|
|
136
|
+
signInRequired: !signedIn, noSignIn: signedIn, hideRefresh: !signedIn };
|
|
137
|
+
}
|
|
138
|
+
type Actions = {
|
|
139
|
+
reset: (s: S) => S; publish: (s: S) => S; refreshPrice: (s: S) => Promise<undefined>; start: (s: S) => S; load: (s: S, arg?: unknown) => Promise<undefined>;
|
|
140
|
+
buy: (s: S) => Promise<undefined>; iapPoll: (s: S) => Promise<undefined>;
|
|
141
|
+
};
|
|
142
|
+
const svc = defineService<S, Actions>("himiBrandedVideo", {
|
|
143
|
+
state: initial,
|
|
144
|
+
notHydrated: Object.keys(initial) as (keyof S & string)[],
|
|
145
|
+
actions: {
|
|
146
|
+
reset: () => { shown = { ...initial }; detailItem = undefined; rowItems = []; return { ...initial }; },
|
|
147
|
+
publish: () => priced(shown),
|
|
148
|
+
start: () => (SELLS_THROUGH_APPLE ? priced(shown) : { ...priced(shown), _poll: pricing.pollDirective("himiBrandedVideo.refreshPrice") } as S),
|
|
149
|
+
refreshPrice: async () => { await priceContent(); return undefined; },
|
|
150
|
+
buy,
|
|
151
|
+
iapPoll: async () => { await commerce.poll(); void svc.publish(); return undefined; },
|
|
152
|
+
load: async (_s, arg) => {
|
|
153
|
+
stashCopy(arg);
|
|
154
|
+
const request = ++generation;
|
|
155
|
+
// Revoke the previous item immediately while current access is rechecked.
|
|
156
|
+
await svc.reset();
|
|
157
|
+
let next: S = { ...initial, id: input("id"), channelId: input("channelId") };
|
|
158
|
+
let nextDetail: IapCatalogItem | undefined;
|
|
159
|
+
let nextRows: Array<IapCatalogItem | undefined> = [];
|
|
160
|
+
try {
|
|
161
|
+
const { id, channelId } = next;
|
|
162
|
+
const channelScreen = input("screenId") === "himi_video_channel";
|
|
163
|
+
if (!id || (!channelScreen && !channelId)) next = unavailable(next, "unavailable", copyParam("video.unavailableText", "This video or channel is unavailable."));
|
|
164
|
+
else if (channelScreen) {
|
|
165
|
+
const { channel, videos } = await listChannelVideos(id);
|
|
166
|
+
next.title = channel.title ?? "";
|
|
167
|
+
const untitled = copyParam("video.untitled", "Video");
|
|
168
|
+
next = { ...next, ...loaded("videos", videos.map(v => {
|
|
169
|
+
const card = videoCard({ channel, video: v }, untitled);
|
|
170
|
+
return { id: v.id, channelId: id, title: card.title, meta: card.duration, coverUrl: card.coverUrl, hasCover: card.hasCover, noCover: card.noCover, priceLine: "", subtitle:
|
|
171
|
+
v.content?.status !== "READY" ? copyParam("video.processingText", "Video is processing.") : "" };
|
|
172
|
+
}), COPY), playbackState: "ready" };
|
|
173
|
+
// A video the viewer can already watch (bought, rented, or through the channel) is not priced.
|
|
174
|
+
nextRows = next.videos.map((row) => { const v = videos.find((video) => video.id === row.id); return v && !canWatchVideo(channel, v) ? wixVideoItem(channel, v) : undefined; });
|
|
175
|
+
} else {
|
|
176
|
+
const data = await getVideo(channelId, id);
|
|
177
|
+
const channel = data?.channel;
|
|
178
|
+
const video = data?.video;
|
|
179
|
+
if (!channel || !video || video.status !== "VISIBLE") next = unavailable(next, "unavailable", copyParam("video.unavailableText", "This video is unavailable."));
|
|
180
|
+
else {
|
|
181
|
+
next.title = video.title ?? "";
|
|
182
|
+
next.description = descriptionBody(video.description).bodyText;
|
|
183
|
+
if (video.content?.status !== "READY") next = isVideoProcessing(video) ?
|
|
184
|
+
unavailable(next, "processing", copyParam("video.processingText", "Video is processing. Try again later.")) :
|
|
185
|
+
unavailable(next, "unavailable", copyParam("video.unavailableText", "This video is unavailable."));
|
|
186
|
+
else if (!canWatchVideo(channel, video)) {
|
|
187
|
+
next = await deniedVideo(next);
|
|
188
|
+
nextDetail = wixVideoItem(channel, video);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
let item: MediaItem | undefined;
|
|
192
|
+
if (video.source === "YOUTUBE") {
|
|
193
|
+
const providerId = youtubeVideoId(video);
|
|
194
|
+
if (providerId) item = { id, kind: "video", provider: "youtube", providerId, title: next.title };
|
|
195
|
+
} else if (isHostedVideo(video)) {
|
|
196
|
+
const url = await getVideoStreamUrl(channelId, id);
|
|
197
|
+
if (url) item = { id, kind: "video", provider: "direct", url, streamType: "hls", title: next.title };
|
|
198
|
+
}
|
|
199
|
+
next = item ? { ...next, ...loaded("videos", [], { ...COPY, empty: "" }), emptyText: "", items: [item], hidePlayer: false, playbackState: "ready" } :
|
|
200
|
+
unavailable(next, "unavailable", copyParam("video.unavailableText", "This video is unavailable."));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
} catch (error) {
|
|
205
|
+
const denied = (error as { denied?: boolean })?.denied || /^HTTP\s+403\b/.test(String((error as Error)?.message));
|
|
206
|
+
next = (error as { notFound?: boolean })?.notFound ? unavailable(next, "unavailable", copyParam("video.unavailableText", "This video or channel is unavailable.")) :
|
|
207
|
+
needsSignIn(error) ? { ...next, ...loadFailed("videos", error, COPY), playbackState: "denied", items: [], hidePlayer: true, hideRefresh: true } :
|
|
208
|
+
denied ? unavailable(next, "denied", copyParam("video.deniedText", "Your current membership or purchase does not allow this video.")) :
|
|
209
|
+
{ ...next, ...loadFailed("videos", error, COPY), playbackState: "error", items: [], hidePlayer: true };
|
|
210
|
+
}
|
|
211
|
+
if (request !== generation) return undefined;
|
|
212
|
+
if (accessReload.id === next.id && next.playbackState !== "error" && next.playbackState !== "denied") accessReload.settled = true;
|
|
213
|
+
shown = next;
|
|
214
|
+
detailItem = nextDetail;
|
|
215
|
+
rowItems = nextRows;
|
|
216
|
+
void svc.publish();
|
|
217
|
+
void priceContent();
|
|
218
|
+
void resumeCommerce();
|
|
219
|
+
return undefined;
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
resetUnhydratedKeysOnOlderRuntime(svc, initial, Object.keys(initial) as (keyof S & string)[]);
|
|
224
|
+
void svc.start();
|
|
225
|
+
svc.load();
|
|
226
|
+
export { svc };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// himi-branded-lite-videos — branded-lite "Videos" worker (Wix Video).
|
|
2
|
+
//
|
|
3
|
+
// Wix Video has NO platformized REST @wix/auto_sdk_* domain to codegen, so the data
|
|
4
|
+
// comes through the hand-written `@himalaya/wix-video` client, which reads the same
|
|
5
|
+
// Wix Video GraphQL gateway Wix's own mobile app reads, through the raw wixApi bridge
|
|
6
|
+
// (visitor/member auth). ONE paged channel query feeds both sections of the screen:
|
|
7
|
+
// the channels list, and the video carousel (the first videos of each channel, the
|
|
8
|
+
// channels taking turns). A failed query is an error with Retry (or Sign in), an
|
|
9
|
+
// empty one a real empty state; sample channels appear only in the host's explicit
|
|
10
|
+
// sample preview (_shared/branded-load-state.ts).
|
|
11
|
+
//
|
|
12
|
+
// App Store prices come from the shared IAP catalog layer (@himalaya/iap): a carousel video with a
|
|
13
|
+
// one-time Sale price is priced as `wixVideo`. An app that sells nothing through the App Store reads
|
|
14
|
+
// every video as `disabled` and shows no price line. The list sells nothing.
|
|
15
|
+
import { defineService as register } from "@himalaya/state";
|
|
16
|
+
import { decorateCollection } from "../_shared/collection-service.js";
|
|
17
|
+
import { LOADING, loaded, loadFailed, type LoadCopy, type LoadFlags } from "../_shared/branded-load-state.js";
|
|
18
|
+
import { copyParam } from "../_shared/himi-copy.js";
|
|
19
|
+
import { iapPriceCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
|
|
20
|
+
import { videoCaptionOf, withCaption, type CaptionFlags, type VideoCaption } from "../_shared/video-caption.js";
|
|
21
|
+
import { iapPriceFields, wixVideoItem, type IapCatalogItem } from "@himalaya/iap";
|
|
22
|
+
import { createIapCommerce } from "@himalaya/iap-checkout";
|
|
23
|
+
import { canWatchVideo, channelCoverUrl, latestVideos, listChannels, videoCard, type WixVideoCard, type WixVideoChannel, type WixVideoInChannel } from "@himalaya/wix-video";
|
|
24
|
+
|
|
25
|
+
interface Row { id: string; title: string; subtitle: string; coverUrl: string; hasCover: boolean; noCover: boolean }
|
|
26
|
+
interface S extends LoadFlags {
|
|
27
|
+
channels: Row[]; emptyText: string;
|
|
28
|
+
/** Hides the channels section header when there is no row under it. */
|
|
29
|
+
noChannels: boolean;
|
|
30
|
+
/** The carousel section: up to CAROUSEL_SIZE ready videos across the channels, each
|
|
31
|
+
* stamped with the caption placement the descriptor asked for (`videoCaption`). */
|
|
32
|
+
latestVideos: (WixVideoCard & CaptionFlags & { priceLine: string })[]; noLatestVideos: boolean;
|
|
33
|
+
isMock: boolean; notMock: boolean; /** #2849 — hiddenWhen() hides on TRUE, so these are inverted: the empty-state banner
|
|
34
|
+
* shows only when the site really has none, and the unavailable one only when the
|
|
35
|
+
* query failed. A failed query must never render the sentence that claims the
|
|
36
|
+
* customer has no content. */
|
|
37
|
+
notMockEmpty: boolean; notMockUnavailable: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Videos read per channel for the carousel, and the carousel's length. */
|
|
41
|
+
const PER_CHANNEL = 4;
|
|
42
|
+
const CAROUSEL_SIZE = 10;
|
|
43
|
+
|
|
44
|
+
function norm(c: WixVideoChannel): Row {
|
|
45
|
+
const title = (c.title || "Channel").trim() || "Channel";
|
|
46
|
+
const count = c.videos?.total ?? 0;
|
|
47
|
+
const parts = [count === 1 ? "1 video" : `${count} videos`, c.hasPaidVideos ? "Premium" : ""].filter(Boolean);
|
|
48
|
+
const coverUrl = channelCoverUrl(c);
|
|
49
|
+
return { id: c.id || "channel", title, subtitle: parts.join(" · "), coverUrl, hasCover: !!coverUrl, noCover: !coverUrl };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const MOCK: Row[] = [
|
|
53
|
+
{ id: "sample-tutorials", title: "Tutorials", subtitle: "12 videos", coverUrl: "", hasCover: false, noCover: true },
|
|
54
|
+
{ id: "sample-behind", title: "Behind the Scenes", subtitle: "6 videos", coverUrl: "", hasCover: false, noCover: true },
|
|
55
|
+
{ id: "sample-masterclass", title: "Masterclass", subtitle: "8 videos · Premium", coverUrl: "", hasCover: false, noCover: true },
|
|
56
|
+
];
|
|
57
|
+
|
|
58
|
+
/** sample rows reach the screen ONLY in the host's explicit sample preview;
|
|
59
|
+
* a failed or empty query is an honest error / empty state (branded-load-state.ts). */
|
|
60
|
+
const COPY: LoadCopy<Row> = {
|
|
61
|
+
prefix: "videos",
|
|
62
|
+
empty: "No videos yet — check back soon.",
|
|
63
|
+
error: "Videos couldn't be loaded.",
|
|
64
|
+
signIn: "Sign in to watch videos.",
|
|
65
|
+
sample: () => MOCK.map((r) => ({ ...r })),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const SERVICE = "himiBrandedVideos";
|
|
69
|
+
let generation = 0;
|
|
70
|
+
/** The latest placement an appear asked for; a param-less reload keeps it. */
|
|
71
|
+
let caption: VideoCaption = "overlay";
|
|
72
|
+
|
|
73
|
+
// ── Content and App Store prices ─────
|
|
74
|
+
// One writer: `load` keeps the carousel here and every repaint goes through the synchronous
|
|
75
|
+
// `pricingPublish`, which reads the latest content and prices together.
|
|
76
|
+
const commerce = createIapCommerce({ onChange: () => { void svc.pricingPublish(); } });
|
|
77
|
+
const pricing = commerce.pricing;
|
|
78
|
+
const PRICING_NOT_HYDRATED = ["latestVideos"] as const;
|
|
79
|
+
let carousel: Array<{ card: WixVideoCard & CaptionFlags; item?: IapCatalogItem }> = [];
|
|
80
|
+
|
|
81
|
+
function carouselOf(entries: WixVideoInChannel[], untitled: string) {
|
|
82
|
+
const cards = withCaption(entries.map((entry) => videoCard(entry, untitled)), caption);
|
|
83
|
+
// A video the viewer can already watch (bought, rented, or through the channel) is not priced.
|
|
84
|
+
return cards.map((card, i) => {
|
|
85
|
+
const { channel, video } = entries[i];
|
|
86
|
+
return { card, item: canWatchVideo(channel, video) ? undefined : wixVideoItem(channel, video) };
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function priceCarousel(): Promise<void> {
|
|
91
|
+
const items = carousel.flatMap((entry) => entry.item ?? []);
|
|
92
|
+
if (items.length) await commerce.loadPrices(items);
|
|
93
|
+
void svc.pricingPublish();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function pricedState(state: S): S {
|
|
97
|
+
const copy = iapPriceCopy("videos");
|
|
98
|
+
const cards = carousel.map(({ card, item }) => ({ ...card, priceLine: item ? iapPriceFields(pricing.view(item.reference), copy).priceText : "" }));
|
|
99
|
+
return { ...state, latestVideos: cards, noLatestVideos: cards.length === 0 };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
type Actions = {
|
|
103
|
+
load: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
104
|
+
pricingPublish: (s: S) => S;
|
|
105
|
+
pricingStart: (s: S) => S;
|
|
106
|
+
pricingRefresh: (s: S) => Promise<undefined>;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const actions: Actions = {
|
|
110
|
+
load: async (s, arg) => {
|
|
111
|
+
const request = ++generation;
|
|
112
|
+
const asked = (arg as { videoCaption?: unknown } | undefined)?.videoCaption;
|
|
113
|
+
if (asked !== undefined) caption = videoCaptionOf(asked);
|
|
114
|
+
try {
|
|
115
|
+
const entities = await listChannels({ videosPerChannel: PER_CHANNEL });
|
|
116
|
+
const untitled = copyParam("videos.untitledVideo", "Video");
|
|
117
|
+
if (request === generation) {
|
|
118
|
+
carousel = carouselOf(latestVideos(entities, CAROUSEL_SIZE), untitled);
|
|
119
|
+
void priceCarousel();
|
|
120
|
+
const rows = loaded("channels", entities.map(norm), COPY);
|
|
121
|
+
return pricedState({ ...s, ...rows, noChannels: rows.channels.length === 0 });
|
|
122
|
+
}
|
|
123
|
+
} catch (err) {
|
|
124
|
+
if (request === generation) {
|
|
125
|
+
carousel = [];
|
|
126
|
+
const rows = loadFailed("channels", err, COPY);
|
|
127
|
+
return pricedState({ ...s, ...rows, noChannels: rows.channels.length === 0 });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return undefined;
|
|
131
|
+
},
|
|
132
|
+
pricingPublish: pricedState,
|
|
133
|
+
pricingStart: (s) => ({ ...pricedState(s), _poll: pricing.pollDirective(`${SERVICE}.pricingRefresh`) }),
|
|
134
|
+
pricingRefresh: async () => { await priceCarousel(); return undefined; },
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const INITIAL: S = { ...LOADING, channels: [], emptyText: "", noChannels: true, latestVideos: [], noLatestVideos: true } as S;
|
|
138
|
+
// The collection decorator's own `defineService` drops `notHydrated`, so the decorated definition is
|
|
139
|
+
// registered directly: this run's prices must never be restored from a cold-boot snapshot.
|
|
140
|
+
const decorated = decorateCollection(SERVICE, { state: INITIAL, actions } as unknown as Parameters<typeof decorateCollection>[1]);
|
|
141
|
+
const svc = register<S, Actions>(SERVICE, { ...decorated, notHydrated: [...PRICING_NOT_HYDRATED] } as unknown as Parameters<typeof register<S, Actions>>[1]);
|
|
142
|
+
resetUnhydratedKeysOnOlderRuntime(svc, decorated.state as unknown as S, PRICING_NOT_HYDRATED);
|
|
143
|
+
void svc.pricingStart();
|
|
144
|
+
svc.load();
|
|
145
|
+
export { svc };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineService } from '@himalaya/state';
|
|
2
|
+
import { queryServices, type WixService } from '@himalaya/wix-bookings';
|
|
3
|
+
import { wixMediaUrl } from '@himalaya/wix-media';
|
|
4
|
+
import { formatServicePrice } from '../_shared/wix-service-price.js';
|
|
5
|
+
|
|
6
|
+
type Row = { id: string; name: string; price: string; image: string };
|
|
7
|
+
interface State {
|
|
8
|
+
services: Row[];
|
|
9
|
+
error: string;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
notLoading: boolean;
|
|
12
|
+
hideEmpty: boolean;
|
|
13
|
+
hideError: boolean;
|
|
14
|
+
hideLoadError: boolean;
|
|
15
|
+
hideRefreshError: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function serviceImage(service: WixService): string {
|
|
19
|
+
const media = service.media;
|
|
20
|
+
for (const item of [media?.mainMedia, ...(media?.items ?? []), media?.coverMedia]) {
|
|
21
|
+
for (const reference of [item?.image?.url, item?.image?.id]) {
|
|
22
|
+
const url = wixMediaUrl(reference);
|
|
23
|
+
if (url) return url;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return '';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let request = 0;
|
|
30
|
+
const BOOT_STATE: Omit<State, 'services'> = { error: "", loading: true, notLoading: false, hideEmpty: true, hideError: true, hideLoadError: true, hideRefreshError: true };
|
|
31
|
+
const svc = defineService<State, { load: (state: State) => Promise<State | undefined> }>('himiFitnessTrainerHome', {
|
|
32
|
+
state: { services: [], ...BOOT_STATE },
|
|
33
|
+
// Keep the public catalogue; loading and failures belong to this boot.
|
|
34
|
+
notHydrated: Object.keys(BOOT_STATE) as (keyof State & string)[],
|
|
35
|
+
actions: {
|
|
36
|
+
load: async (state) => {
|
|
37
|
+
const generation = ++request;
|
|
38
|
+
try {
|
|
39
|
+
const read = () => queryServices({ query: { filter: { hidden: { $ne: true } }, paging: { limit: 50 } } });
|
|
40
|
+
let response;
|
|
41
|
+
try {
|
|
42
|
+
response = await read();
|
|
43
|
+
} catch {
|
|
44
|
+
if (generation !== request) return undefined;
|
|
45
|
+
// Visitor bootstrap can invalidate an in-flight read (PRINCIPAL_CHANGED).
|
|
46
|
+
// Reissue this public, read-only query once against the current identity.
|
|
47
|
+
response = await read();
|
|
48
|
+
}
|
|
49
|
+
if (generation !== request) return undefined;
|
|
50
|
+
const services = response.services.filter(service => (service as WixService & { hidden?: boolean }).hidden !== true).slice(0, 6).map(service => ({
|
|
51
|
+
id: service.id,
|
|
52
|
+
name: service.name ?? '',
|
|
53
|
+
price: formatServicePrice(service),
|
|
54
|
+
image: serviceImage(service),
|
|
55
|
+
}));
|
|
56
|
+
return { error: "", services, loading: false, notLoading: true, hideEmpty: services.length > 0, hideError: true, hideLoadError: true, hideRefreshError: true };
|
|
57
|
+
} catch {
|
|
58
|
+
if (generation !== request) return undefined;
|
|
59
|
+
// The public services endpoint has no member-only branch. Preserve rows on
|
|
60
|
+
// refresh failure, with a retryable section error instead of invented data.
|
|
61
|
+
return { ...state, error: "Classes could not be loaded. Please try again.", loading: false, notLoading: true, hideEmpty: true, hideError: false, hideLoadError: state.services.length > 0, hideRefreshError: state.services.length === 0 };
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
// Recompute visibility from the restored public rows before the first paint.
|
|
67
|
+
// Resetting only boot fields also clears stale feedback on older native hosts.
|
|
68
|
+
const restored = svc.getState();
|
|
69
|
+
Object.assign(restored, BOOT_STATE, { loading: restored.services.length === 0, notLoading: restored.services.length > 0 });
|
|
70
|
+
export { svc };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { defineService } from '@himalaya/state';
|
|
2
|
+
import { dispatch } from '@himalaya/dispatch';
|
|
3
|
+
import { memberAccess } from '../_shared/member-access.js';
|
|
4
|
+
|
|
5
|
+
interface State { error: string; isMember: boolean; notMember: boolean; hideError: boolean; hideSignOutError: boolean; notLoading: boolean; hideGuest: boolean; hideMember: boolean }
|
|
6
|
+
let revision = 0;
|
|
7
|
+
let signingOut = false;
|
|
8
|
+
const INITIAL: State = { error: "", isMember: false, notMember: true, hideError: true, hideSignOutError: true, notLoading: false, hideGuest: true, hideMember: true };
|
|
9
|
+
const svc = defineService<State, {
|
|
10
|
+
load: (state: State) => Promise<State | undefined>;
|
|
11
|
+
signOut: (state: State) => Promise<State | undefined>;
|
|
12
|
+
}>('himiFitnessTrainerProfile', {
|
|
13
|
+
state: { ...INITIAL },
|
|
14
|
+
// Identity, loading and failures belong to this boot, never a restored snapshot.
|
|
15
|
+
notHydrated: Object.keys(INITIAL) as (keyof State & string)[],
|
|
16
|
+
actions: {
|
|
17
|
+
load: async (state) => {
|
|
18
|
+
if (signingOut) return undefined;
|
|
19
|
+
const current = ++revision;
|
|
20
|
+
try {
|
|
21
|
+
const identity = await memberAccess({ throwOnUnavailable: true });
|
|
22
|
+
if (current !== revision) return undefined;
|
|
23
|
+
const isMember = identity.signedIn === true || Boolean(identity.email);
|
|
24
|
+
return { error: "", isMember, notMember: !isMember, hideError: true, hideSignOutError: true, notLoading: true, hideGuest: isMember, hideMember: !isMember };
|
|
25
|
+
} catch {
|
|
26
|
+
if (current !== revision) return undefined;
|
|
27
|
+
return { ...state, error: "Your account could not be loaded. Please try again.", hideError: false, hideSignOutError: true, notLoading: true, hideGuest: true, hideMember: true };
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
signOut: async (state) => {
|
|
31
|
+
if (signingOut) return undefined;
|
|
32
|
+
signingOut = true;
|
|
33
|
+
// Invalidate an identity read which began before the session was cleared.
|
|
34
|
+
++revision;
|
|
35
|
+
try {
|
|
36
|
+
const result = await dispatch('himi.wix.signOut') as { status?: unknown; ok?: unknown; error?: unknown } | null;
|
|
37
|
+
// The web bridge unwraps ActionResult to payload. Its sign-out failure
|
|
38
|
+
// has an error field but no stable code; use that shape until the host supplies one.
|
|
39
|
+
if (result?.status === 'error' || result?.ok === false || (result != null && typeof result === 'object' && 'error' in result)) {
|
|
40
|
+
return { ...state, hideError: true, hideSignOutError: false };
|
|
41
|
+
}
|
|
42
|
+
return { error: "", isMember: false, notMember: true, hideError: true, hideSignOutError: true, notLoading: true, hideGuest: false, hideMember: true };
|
|
43
|
+
} catch {
|
|
44
|
+
return { ...state, hideError: true, hideSignOutError: false };
|
|
45
|
+
} finally {
|
|
46
|
+
signingOut = false;
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
// Older native hosts ignore the hydration opt-out; reset before the first paint.
|
|
52
|
+
if (!(globalThis as { himalaya?: { hydrationOptOut?: boolean } }).himalaya?.hydrationOptOut) Object.assign(svc.getState(), INITIAL);
|
|
53
|
+
export { svc };
|