@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
|
@@ -6859,6 +6859,11 @@
|
|
|
6859
6859
|
"translation": "Vous êtes sur la liste d'attente. Vous recevrez un e-mail si une place se libère.",
|
|
6860
6860
|
"origin": "machine"
|
|
6861
6861
|
},
|
|
6862
|
+
"h_146bd1c44b1c": {
|
|
6863
|
+
"source": "This booking is not confirmed. If you did not finish checkout, the business did not get it.",
|
|
6864
|
+
"translation": "Cette réservation n'est pas confirmée. Si vous n'avez pas terminé le paiement, l'établissement ne l'a pas reçue.",
|
|
6865
|
+
"origin": "machine"
|
|
6866
|
+
},
|
|
6862
6867
|
"h_014a590b30b1": {
|
|
6863
6868
|
"source": "Get directions to {place}",
|
|
6864
6869
|
"translation": "Obtenir l'itinéraire vers {place}",
|
|
@@ -8164,6 +8169,11 @@
|
|
|
8164
8169
|
"translation": "Votre adhésion ou votre achat actuel ne permet pas de voir cette vidéo.",
|
|
8165
8170
|
"origin": "machine"
|
|
8166
8171
|
},
|
|
8172
|
+
"h_a9ebcd4e7fea": {
|
|
8173
|
+
"source": "Sign in with an account that has access to this video.",
|
|
8174
|
+
"translation": "Connectez-vous avec un compte qui a accès à cette vidéo.",
|
|
8175
|
+
"origin": "machine"
|
|
8176
|
+
},
|
|
8167
8177
|
"h_4d4ce73b1566": {
|
|
8168
8178
|
"source": "Card",
|
|
8169
8179
|
"translation": "Carte",
|
|
@@ -5656,6 +5656,10 @@
|
|
|
5656
5656
|
"source": "You are on the waitlist. You get an email if a spot opens.",
|
|
5657
5657
|
"translation": "אתם ברשימת ההמתנה. תקבלו אימייל אם יתפנה מקום."
|
|
5658
5658
|
},
|
|
5659
|
+
"h_146bd1c44b1c": {
|
|
5660
|
+
"source": "This booking is not confirmed. If you did not finish checkout, the business did not get it.",
|
|
5661
|
+
"translation": "התור הזה לא אושר. אם לא סיימתם את התשלום, העסק לא קיבל אותו."
|
|
5662
|
+
},
|
|
5659
5663
|
"h_014a590b30b1": {
|
|
5660
5664
|
"source": "Get directions to {place}",
|
|
5661
5665
|
"translation": "הוראות הגעה אל {place}"
|
|
@@ -7520,6 +7524,10 @@
|
|
|
7520
7524
|
"source": "{n, plural, one {per year} other {every # years}}",
|
|
7521
7525
|
"translation": "{n, plural, one {לשנה} other {כל # שנים}}"
|
|
7522
7526
|
},
|
|
7527
|
+
"h_a9ebcd4e7fea": {
|
|
7528
|
+
"source": "Sign in with an account that has access to this video.",
|
|
7529
|
+
"translation": "התחברו באמצעות חשבון שיש לו גישה לסרטון הזה."
|
|
7530
|
+
},
|
|
7523
7531
|
"h_41ea36c1a2ec": {
|
|
7524
7532
|
"source": "No Events Yet",
|
|
7525
7533
|
"translation": "עדיין אין אירועים"
|
|
@@ -190,7 +190,9 @@ export async function placesIn(start: string, end: string, inWindow: Session[],
|
|
|
190
190
|
// Every page, not the first 100: a booking past it would read Book again. Bounded.
|
|
191
191
|
const bookings: WixBooking[] = [];
|
|
192
192
|
for (let page = 0; page < 5; page++) {
|
|
193
|
-
|
|
193
|
+
// Bookings v2 rejects two comparisons in one field expression (INVALID_FILTER).
|
|
194
|
+
// Keep the half-open window as independent AND clauses, with the same member scope.
|
|
195
|
+
const res = await queryBookings({ query: { filter: { "contactDetails.email": { $eq: who.email }, $and: [{ startDate: { $gte: from } }, { startDate: { $lt: to } }] }, paging: { limit: 100, offset: page * 100 } } } as never);
|
|
194
196
|
const batch = res.bookings ?? [];
|
|
195
197
|
bookings.push(...batch);
|
|
196
198
|
if (batch.length < 100) break;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// The Services top-bar location pin, for an app-level `brandedLiteNav` worker.
|
|
2
|
+
//
|
|
3
|
+
// A top-bar action hides only through the app worker, never the screen's, so the worker counts the places the
|
|
4
|
+
// visible catalog is offered in, once per launch, and publishes `noLocationMenu` for the pin's `hiddenPath`. One
|
|
5
|
+
// piece, shared by the full nav worker and `himi-branded-lite-access-nav` (the worker `himi one-app access`
|
|
6
|
+
// switches an app to), so the pin follows the business whichever of them an app runs. A worker that does not
|
|
7
|
+
// publish the field leaves the pin unresolved, and an unresolved top-bar `hiddenPath` shows it.
|
|
8
|
+
|
|
9
|
+
import { queryServices } from "@himalaya/wix-bookings";
|
|
10
|
+
import { distinctChoices, serviceLocationChoices } from "./booking-location.js";
|
|
11
|
+
|
|
12
|
+
export interface LocationPinState {
|
|
13
|
+
/** Hides the Services top-bar location pin: true until the catalog shows two or more places. Read once per launch
|
|
14
|
+
* with the same keys as the Services screen: the stored answer first, then the network's. */
|
|
15
|
+
noLocationMenu: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const LOCATION_PIN_INITIAL: LocationPinState = { noLocationMenu: true };
|
|
19
|
+
|
|
20
|
+
/** The action a service that uses `locationPin` declares in its `defineService` generic. A `type`, as for
|
|
21
|
+
* `HeaderBadgeActionSignatures`: `defineService` constrains its actions to a record only a type alias satisfies. */
|
|
22
|
+
export type LocationPinActionSignatures<S> = {
|
|
23
|
+
/** Commit a count of the places the services are offered in. */
|
|
24
|
+
applyLocationCount: (s: S, places?: unknown) => Promise<S>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** What `locationPin` hands a worker. Named, so a worker can annotate its `pin` and break the loop with its handle. */
|
|
28
|
+
export interface LocationPin<S> {
|
|
29
|
+
actions: LocationPinActionSignatures<S>;
|
|
30
|
+
/** Call once after `defineService`: the launch read. `skip` is true for an app with no bookings (a hosted site
|
|
31
|
+
* without them), which never shows the pin. */
|
|
32
|
+
start(skip?: boolean): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Update<S> = (s: S, change: (current: S) => Promise<S>) => Promise<S>;
|
|
36
|
+
type Self = () => { applyLocationCount(places?: unknown): Promise<unknown> };
|
|
37
|
+
|
|
38
|
+
/** Catalog pages the count may read: a second place can first appear past the first 100 services. */
|
|
39
|
+
const LOCATION_PAGES = 5;
|
|
40
|
+
|
|
41
|
+
/** The site has no Bookings: its API answers 428, or 404 for the route. Read from the LEADING status only, as
|
|
42
|
+
* `_shared/owner-widget-reads.ts` does, so a `HTTP 503` whose body quotes a 404 is still a failed read. */
|
|
43
|
+
function bookingsAbsent(e: unknown): boolean {
|
|
44
|
+
return /^HTTP (?:404|428)\b/.test(String((e as Error)?.message ?? e));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** How many places the visible catalog is offered in, read with `cache`, or undefined when that read
|
|
48
|
+
* has no answer: no stored body, or a failed network read. Pages until a second place shows or the
|
|
49
|
+
* catalog ends; a page that fails after that is no answer, unless two places are already counted. */
|
|
50
|
+
async function locationCount(cache: "only-if-cached" | "reload"): Promise<number | undefined> {
|
|
51
|
+
let places: ReturnType<typeof distinctChoices> = [];
|
|
52
|
+
for (let page = 0; page < LOCATION_PAGES; page++) {
|
|
53
|
+
let services: unknown[];
|
|
54
|
+
try {
|
|
55
|
+
const res = await queryServices({ query: { filter: { hidden: { $ne: true } }, paging: { limit: 100, offset: page * 100 } } }, { cache });
|
|
56
|
+
services = res.services ?? [];
|
|
57
|
+
} catch (e) {
|
|
58
|
+
// No stored body is the normal first launch, and a site without Bookings has no places: neither is worth a
|
|
59
|
+
// line. A worker cannot see which screens its app has, so it reads on a site without Bookings too.
|
|
60
|
+
if (cache === "reload" && !bookingsAbsent(e)) console.warn(`[branded-lite] location count not read: ${String(e)}`);
|
|
61
|
+
return places.length >= 2 ? places.length : undefined;
|
|
62
|
+
}
|
|
63
|
+
places = distinctChoices([...places, ...services.flatMap((service) => serviceLocationChoices((service as { locations?: unknown }).locations))]);
|
|
64
|
+
if (places.length >= 2 || services.length < 100) break;
|
|
65
|
+
}
|
|
66
|
+
return places.length;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @param update serializes state changes for the worker, so overlapping actions build on the preceding result
|
|
71
|
+
* @param self the worker's own service handle (read lazily: it does not exist yet when this is called)
|
|
72
|
+
*/
|
|
73
|
+
export function locationPin<S extends LocationPinState>(update: Update<S>, self: Self): LocationPin<S> {
|
|
74
|
+
const actions: LocationPinActionSignatures<S> = {
|
|
75
|
+
// A param that crosses the native bridge arrives as a string, so the count is read as a number.
|
|
76
|
+
applyLocationCount: async (s, places) =>
|
|
77
|
+
update(s, async (current) => ({ ...current, noLocationMenu: !(Number(places) >= 2) })),
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/** Two reads, each committed as it lands. The STORED answer (`only-if-cached`) first, so a returning
|
|
81
|
+
* visitor of a business with two places sees the pin at once; then the NETWORK's (`reload`), which
|
|
82
|
+
* is the only one that may override it. A plain read is not enough: the native Wix read cache
|
|
83
|
+
* answers it with the body the PREVIOUS launch stored and refreshes the store only in the
|
|
84
|
+
* background, and nothing reads again, so the pin followed the previous launch's catalog for the
|
|
85
|
+
* whole session. A failed network read keeps the stored count. With neither, the pin keeps what the
|
|
86
|
+
* last run committed (`noLocationMenu` is stored with the worker's state, as the place count is a
|
|
87
|
+
* property of the business, not of the run), and on a first launch it stays hidden. A site without
|
|
88
|
+
* bookings never shows it. */
|
|
89
|
+
async function check(): Promise<void> {
|
|
90
|
+
const stored = await locationCount("only-if-cached");
|
|
91
|
+
if (stored !== undefined) await self().applyLocationCount(stored);
|
|
92
|
+
const fresh = await locationCount("reload");
|
|
93
|
+
if (fresh !== undefined) await self().applyLocationCount(fresh);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return { actions, start: (skip) => { if (!skip) void check(); } };
|
|
97
|
+
}
|
|
@@ -1,33 +1,44 @@
|
|
|
1
1
|
import { dispatch } from "@himalaya/dispatch";
|
|
2
2
|
import { getMyData } from "@himalaya/wix-users";
|
|
3
3
|
|
|
4
|
-
export interface MemberAccess { email: string; scope: string; }
|
|
4
|
+
export interface MemberAccess { email: string; scope: string; signedIn?: boolean; }
|
|
5
5
|
export function memberAccessChanged(): Error {
|
|
6
6
|
const error = new Error("Member access changed"); error.name = "MemberAccessChanged"; return error;
|
|
7
7
|
}
|
|
8
|
-
export async function memberAccess(): Promise<MemberAccess> {
|
|
8
|
+
export async function memberAccess(options: { throwOnUnavailable?: boolean } = {}): Promise<MemberAccess> {
|
|
9
9
|
let email = "";
|
|
10
|
+
let signedIn = false;
|
|
10
11
|
let identityUnavailable = false;
|
|
11
12
|
try {
|
|
12
|
-
const value = await dispatch("himi.wix.memberIdentity") as { email?: unknown; payload?: { email?: unknown } } | null;
|
|
13
|
+
const value = await dispatch("himi.wix.memberIdentity") as { status?: unknown; ok?: unknown; email?: unknown; signedIn?: unknown; payload?: { email?: unknown; signedIn?: unknown } } | null;
|
|
14
|
+
if (value?.status === "error" || value?.ok === false) throw value;
|
|
13
15
|
const raw = value?.email ?? value?.payload?.email;
|
|
14
16
|
email = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
17
|
+
signedIn = (value?.signedIn ?? value?.payload?.signedIn) === true;
|
|
15
18
|
} catch { identityUnavailable = true; }
|
|
16
19
|
// Older native hosts predate the memberIdentity action but can still expose
|
|
17
20
|
// the authenticated profile through wix-users. Only a missing action uses
|
|
18
|
-
// that rung
|
|
21
|
+
// that rung. A successful host response is authoritative, including a signed-in
|
|
22
|
+
// session whose email has not arrived yet; it must not consult owner records.
|
|
19
23
|
if (!email && identityUnavailable) {
|
|
20
24
|
try {
|
|
21
25
|
const profile = await getMyData();
|
|
22
26
|
const raw = profile.email ?? profile.contactEmail;
|
|
23
27
|
email = typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
24
|
-
} catch {
|
|
28
|
+
} catch (error) {
|
|
29
|
+
const failure = error as { status?: unknown; statusCode?: unknown; code?: unknown } | null;
|
|
30
|
+
const anonymous = failure?.status === 401 || failure?.statusCode === 401 || failure?.code === "UNAUTHENTICATED";
|
|
31
|
+
// Legacy bridges can lose the structured status. An unknown failure is
|
|
32
|
+
// unavailable in strict consumers, never evidence of a signed-out session.
|
|
33
|
+
if (options.throwOnUnavailable && !anonymous) throw error;
|
|
34
|
+
}
|
|
25
35
|
}
|
|
26
36
|
const input = (globalThis as { himalaya?: { input?: Record<string, unknown> } }).himalaya?.input;
|
|
27
37
|
const account = input?.__himiPreferenceAccount, business = input?.__himiPreferenceBusiness;
|
|
28
38
|
const valid = (v: unknown): v is string => typeof v === "string" && /^[A-Za-z0-9_.:-]{1,128}$/.test(v) && v !== "default";
|
|
29
39
|
// These fields are overwritten by authenticated hosts. Older binaries stay online-only.
|
|
30
|
-
|
|
40
|
+
// A session signal does not grant an email-scoped cache or private query.
|
|
41
|
+
return { email, signedIn: signedIn || Boolean(email), scope: email && valid(account) && valid(business) ? JSON.stringify([account, business, email]) : "" };
|
|
31
42
|
}
|
|
32
43
|
export async function assertMemberAccess(member: MemberAccess): Promise<void> {
|
|
33
44
|
const current = await memberAccess();
|
|
@@ -10,6 +10,17 @@ import { dayKey } from "@himalaya/time";
|
|
|
10
10
|
* booking is in exactly one tab. */
|
|
11
11
|
export const CANCELLED_STATUSES = ["CANCELED", "CANCELLED", "DECLINED"];
|
|
12
12
|
|
|
13
|
+
/** Wix made the booking, but no checkout confirmed it: a paid booking the member did not pay
|
|
14
|
+
* for, or left in the payment page, stays here. It holds no place and the business does not
|
|
15
|
+
* see it in its booking calendar, so it is not an appointment. */
|
|
16
|
+
export const UNCONFIRMED_STATUSES = ["CREATED"];
|
|
17
|
+
|
|
18
|
+
export interface FetchMemberBookingsOptions {
|
|
19
|
+
/** Keep the unconfirmed bookings (`UNCONFIRMED_STATUSES`). Only a list that marks them as
|
|
20
|
+
* not confirmed may ask for them; Home and every count leave them out. */
|
|
21
|
+
includeUnconfirmed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
export interface MemberBookingRow {
|
|
14
25
|
id: string; title: string; subtitle: string; status: string; revision: string;
|
|
15
26
|
start: string; end: string; day: string; serviceId: string;
|
|
@@ -70,7 +81,7 @@ export function memberBookingRow(booking: WixBooking): MemberBookingRow {
|
|
|
70
81
|
courseStart: instant(schedule?.firstSessionStart),
|
|
71
82
|
courseEnd: instant(schedule?.lastSessionEnd) };
|
|
72
83
|
}
|
|
73
|
-
export async function fetchMemberBookings(criteria: CollectionQuery, cursor: string, now: string, expected?: MemberAccess) {
|
|
84
|
+
export async function fetchMemberBookings(criteria: CollectionQuery, cursor: string, now: string, expected?: MemberAccess, options: FetchMemberBookingsOptions = {}) {
|
|
74
85
|
const member = expected ?? await memberAccess();
|
|
75
86
|
const metadata = { email: member.email, scope: member.scope, needsSignIn: !member.email };
|
|
76
87
|
if (!member.email) return { items: [] as MemberBookingRow[], nextCursor: "", metadata };
|
|
@@ -79,9 +90,10 @@ export async function fetchMemberBookings(criteria: CollectionQuery, cursor: str
|
|
|
79
90
|
const filter: Record<string, unknown> = { "contactDetails.email": { $eq: member.email } };
|
|
80
91
|
if (criteria.query) filter.id = { $eq: criteria.query };
|
|
81
92
|
if (criteria.filter === "saved") filter.id = criteria.query ? { $in: criteria.savedIds.filter(id => id === criteria.query) } : { $in: criteria.savedIds };
|
|
82
|
-
|
|
93
|
+
const notListed = options.includeUnconfirmed ? CANCELLED_STATUSES : [...CANCELLED_STATUSES, ...UNCONFIRMED_STATUSES];
|
|
94
|
+
if (criteria.filter === "value:Upcoming") { filter.startDate = { $gte: now }; filter.status = { $nin: notListed }; }
|
|
83
95
|
// Past is what took place: a canceled or declined booking is in the Canceled tab only.
|
|
84
|
-
if (criteria.filter === "value:Past") { filter.startDate = { $lt: now }; filter.status = { $nin:
|
|
96
|
+
if (criteria.filter === "value:Past") { filter.startDate = { $lt: now }; filter.status = { $nin: notListed }; }
|
|
85
97
|
if (criteria.filter === "value:Cancelled") filter.status = { $in: CANCELLED_STATUSES };
|
|
86
98
|
const response = await queryBookings({ query: { filter, paging: { limit: 50, offset: Number(cursor || 0) },
|
|
87
99
|
sort: [{ fieldName: "startDate", order: criteria.sort === "za" ? "DESC" : "ASC" }, { fieldName: "id", order: "ASC" }] } });
|
|
@@ -89,6 +101,7 @@ export async function fetchMemberBookings(criteria: CollectionQuery, cursor: str
|
|
|
89
101
|
const raw = response.bookings ?? [];
|
|
90
102
|
// Server authorization remains authoritative. This guard also rejects a
|
|
91
103
|
// malformed/cross-member row before any UI projection. No private disk cache.
|
|
92
|
-
const items = raw.filter(booking => booking.id && booking.contactDetails?.email?.trim().toLowerCase() === member.email).map(memberBookingRow)
|
|
104
|
+
const items = raw.filter(booking => booking.id && booking.contactDetails?.email?.trim().toLowerCase() === member.email).map(memberBookingRow)
|
|
105
|
+
.filter(row => options.includeUnconfirmed || !UNCONFIRMED_STATUSES.includes(row.statusKey));
|
|
93
106
|
return { items, ...offsetPage(cursor, raw.length, 50, response.pagingMetadata), metadata };
|
|
94
107
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// How a staff member's name splits into words for initials and short names, shared by every
|
|
2
|
+
// worker that shows Bookings staff (himi-booking-service, himi-clinic-home), so a doctor's
|
|
3
|
+
// initials read the same on every screen ("Dr. John Wang, MD" is "JW" everywhere).
|
|
4
|
+
|
|
5
|
+
/** A courtesy title a staff name may start with ("Dr. John Wang"): not a name of its own. */
|
|
6
|
+
const TITLE = /^(dr|prof|mr|mrs|ms|mx)\.?$/i;
|
|
7
|
+
/** A credential or suffix a staff name may end with ("John Wang, MD", "Martin King Jr."). No
|
|
8
|
+
* "Do" or "Pa": they are surnames too ("Anh Do"). */
|
|
9
|
+
const SUFFIX = /^(md|phd|dds|dmd|rn|np|jr|sr|ii|iii|iv)\.?$/i;
|
|
10
|
+
|
|
11
|
+
/** The name's words without a leading title or trailing credentials, commas dropped. A one-word
|
|
12
|
+
* name keeps its word, title or not. */
|
|
13
|
+
export function nameWords(name: string): { title: string; words: string[] } {
|
|
14
|
+
const words = name.split(/\s+/).map((word) => word.replace(/,+$/, "")).filter(Boolean);
|
|
15
|
+
const title = words.length > 1 && TITLE.test(words[0]!) ? words.shift()! : "";
|
|
16
|
+
while (words.length > 1 && SUFFIX.test(words[words.length - 1]!)) words.pop();
|
|
17
|
+
return { title, words };
|
|
18
|
+
}
|
|
@@ -6,7 +6,7 @@ import { wixMediaUrl, WIX_LIST_IMAGE } from "@himalaya/wix-media";
|
|
|
6
6
|
import { navigate } from "@himalaya/state";
|
|
7
7
|
import { copyParam, copyTemplate } from "../_shared/himi-copy.js";
|
|
8
8
|
import { memberAccess, assertMemberAccess, memberAccessChanged, memberAccessDenied, type MemberAccess } from "../_shared/member-access.js";
|
|
9
|
-
import { fetchMemberBookings, CANCELLED_STATUSES, type MemberBookingRow } from "../_shared/member-bookings.js";
|
|
9
|
+
import { fetchMemberBookings, CANCELLED_STATUSES, UNCONFIRMED_STATUSES, type MemberBookingRow } from "../_shared/member-bookings.js";
|
|
10
10
|
import { emitHostEvent } from "../_shared/host-events.js";
|
|
11
11
|
import { formatClock, formatClockRange, formatDateMedium, formatMonthDay, formatWeekdayMonthDay, formatWeekdayMonthDayLong } from "../_shared/engine-intl.js";
|
|
12
12
|
import { parseWeeklyGoal, weeklyGoalProgress, weeklySessionsFromPages } from "../_shared/weekly-goal.js";
|
|
@@ -133,6 +133,7 @@ function tagOf(row: MemberBookingRow): string {
|
|
|
133
133
|
case "CANCELED": case "CANCELLED": return copyParam("bookings.statusCancelled", "Canceled");
|
|
134
134
|
case "DECLINED": return copyParam("bookings.statusDeclined", "Declined");
|
|
135
135
|
}
|
|
136
|
+
if (UNCONFIRMED_STATUSES.includes(row.statusKey)) return copyParam("bookings.statusUnconfirmed", "Not confirmed");
|
|
136
137
|
return row.isCourse ? copyParam("bookings.coursePrefix", "Course") : "";
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -194,6 +195,7 @@ function paymentOf(row: MemberBookingRow): string {
|
|
|
194
195
|
function noticeOf(row: MemberBookingRow): string {
|
|
195
196
|
if (row.statusKey === "PENDING" || row.statusKey === "PENDING_APPROVAL") return copyParam("bookings.pendingNotice", "The business must approve this booking. You get an email when they reply.");
|
|
196
197
|
if (row.statusKey === "WAITING_LIST") return copyParam("bookings.waitlistNotice", "You are on the waitlist. You get an email if a spot opens.");
|
|
198
|
+
if (UNCONFIRMED_STATUSES.includes(row.statusKey)) return copyParam("bookings.unconfirmedNotice", "This booking is not confirmed. If you did not finish checkout, the business did not get it.");
|
|
197
199
|
return "";
|
|
198
200
|
}
|
|
199
201
|
|
|
@@ -314,7 +316,9 @@ const svc = defineBackendCollection<S, MemberBookingRow>("himiBookingBookings",
|
|
|
314
316
|
const member = await memberAccess();
|
|
315
317
|
if (cursor && (!pageMember || pageMember.email !== member.email || pageMember.scope !== member.scope)) throw memberAccessChanged();
|
|
316
318
|
if (!cursor || !queryNow) queryNow = new Date().toISOString();
|
|
317
|
-
|
|
319
|
+
// The list keeps an unconfirmed booking, marked "Not confirmed", so the member can see it
|
|
320
|
+
// and cancel it; Home and the weekly goal leave it out.
|
|
321
|
+
const page = await fetchMemberBookings(criteria, cursor, queryNow, member, { includeUnconfirmed: true });
|
|
318
322
|
if (cursor) return page;
|
|
319
323
|
const weekly = weeklyGoal > 0 && member.email ? await fetchWeeklySessionsDone(member, Date.now()) : null;
|
|
320
324
|
return { ...page, metadata: { ...page.metadata, weeklyDone: weekly } };
|
|
@@ -25,6 +25,7 @@ import { formatClock, formatDateMedium, formatMonthDay } from "../_shared/engine
|
|
|
25
25
|
import { descriptionBody } from "../_shared/rich-body.js";
|
|
26
26
|
import { openRichLink } from "../_shared/rich-content-link.js";
|
|
27
27
|
import { isServiceSaved, toggleSavedService } from "../_shared/himi-booking-saved.js";
|
|
28
|
+
import { nameWords } from "../_shared/staff-name.js";
|
|
28
29
|
|
|
29
30
|
// Offline-first (data-offline): the service detail is a public read-through. On a
|
|
30
31
|
// fetch failure we fall back to the last-synced row for this service written by
|
|
@@ -334,11 +335,15 @@ function locationRows(service: WixService): LocationRow[] {
|
|
|
334
335
|
// ---- Staff -----------------------------------------------------------------------
|
|
335
336
|
|
|
336
337
|
function initials(name: string): string {
|
|
337
|
-
return name
|
|
338
|
+
return nameWords(name).words.slice(0, 2).map((part) => part[0]!.toUpperCase()).join("");
|
|
338
339
|
}
|
|
339
340
|
|
|
341
|
+
/** How a name reads in a short list: the first name ("Noa"), or for a titled name the title and
|
|
342
|
+
* the surname ("Dr. Wang") — the first word alone made a clinic's line "With Dr., Dr. and 2 more". */
|
|
340
343
|
function firstName(name: string): string {
|
|
341
|
-
|
|
344
|
+
const { title, words } = nameWords(name);
|
|
345
|
+
if (title) return `${title} ${words[words.length - 1]}`;
|
|
346
|
+
return words[0] ?? name;
|
|
342
347
|
}
|
|
343
348
|
|
|
344
349
|
/** "With Noa Levi", "With Noa or Dana", "With Noa, Dana and 2 more". Empty when the
|
|
@@ -9,7 +9,7 @@ import { addDays as addLocalDays, dayKey, dayLabel, timeLabel, toDate } from "@h
|
|
|
9
9
|
import { dispatch } from "@himalaya/dispatch";
|
|
10
10
|
import { bookSchedule, bookSlot, getService, queryServiceAvailability, registerToWaitlist, type WixBookingSlotFull, type WixSelectedPaymentOption, type WixService } from "@himalaya/wix-bookings";
|
|
11
11
|
import { createCheckout, createOrder } from "@himalaya/wix-ecom";
|
|
12
|
-
import { createRedirectSession
|
|
12
|
+
import { createRedirectSession } from "@himalaya/wix-redirects";
|
|
13
13
|
import { isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
|
|
14
14
|
import { hostedCheckoutOpener, isHostedWorker } from "../_shared/hosted-checkout.js";
|
|
15
15
|
import { session as wixPlatformSession } from "@himalaya/wix-platform";
|
|
@@ -1633,10 +1633,12 @@ async function bookSelectedIn(s: S): Promise<S> {
|
|
|
1633
1633
|
msid: await resolveMsid(),
|
|
1634
1634
|
// Hosted (Spaces): the host opens this booking's checkout as the lent member.
|
|
1635
1635
|
...(hosted ? { openCashier: hostedCheckoutOpener(checkoutId) } : {}),
|
|
1636
|
+
// The site's checkout page for THIS checkout, which already holds the booking made above.
|
|
1637
|
+
// Never `bookingsCheckout`: that opens the site's booking form, which books the slot
|
|
1638
|
+
// again — the form refused it ("There was an issue with booking this service") and the
|
|
1639
|
+
// member could not pay, while the first booking stayed behind unpaid.
|
|
1636
1640
|
cashierUrl: async () => {
|
|
1637
|
-
const redirect = await createRedirectSession(
|
|
1638
|
-
? { ecomCheckout: { checkoutId } }
|
|
1639
|
-
: { bookingsCheckout: { slotAvailability: { slot: slot as WixSlot } } });
|
|
1641
|
+
const redirect = await createRedirectSession({ ecomCheckout: { checkoutId } });
|
|
1640
1642
|
return redirect.redirectSession?.fullUrl;
|
|
1641
1643
|
},
|
|
1642
1644
|
});
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// The app-level nav worker (`navigation.navLogicBundle`) of a migrated One App that keeps locked pages: the live counts
|
|
2
2
|
// behind the header's bell, chat and cart buttons (the same piece as `himi-branded-lite-header-badges`), plus the page
|
|
3
|
-
// access gates (members only, badge, paid plan) the source's owner set (`_shared/access-gates.ts`)
|
|
3
|
+
// access gates (members only, badge, paid plan) the source's owner set (`_shared/access-gates.ts`), plus the Services
|
|
4
|
+
// top-bar location pin the full worker also publishes (`_shared/location-pin.ts`): this worker replaces that one too, and
|
|
5
|
+
// without the field the pin would show for a one-location business.
|
|
4
6
|
//
|
|
5
7
|
// It is a separate bundle on purpose. The gates read the member, their badges and their plans, which an app that locks
|
|
6
8
|
// no page has no use for, and a worker's source is parsed at every boot. `himi one-app access` points an app's
|
|
@@ -13,8 +15,9 @@
|
|
|
13
15
|
import { defineService } from "@himalaya/state";
|
|
14
16
|
import { HEADER_BADGE_KEYS, headerBadges, type HeaderBadgeActionSignatures, type HeaderBadges, type HeaderBadgeState } from "../_shared/header-badges.js";
|
|
15
17
|
import { ACCESS_GATES_INITIAL, ACCESS_STATE_KEYS, accessGates, chainLifecycle, type AccessGateActionSignatures, type AccessGates, type AccessGateState } from "../_shared/access-gates.js";
|
|
18
|
+
import { LOCATION_PIN_INITIAL, locationPin, type LocationPin, type LocationPinActionSignatures, type LocationPinState } from "../_shared/location-pin.js";
|
|
16
19
|
|
|
17
|
-
type State = HeaderBadgeState & AccessGateState;
|
|
20
|
+
type State = HeaderBadgeState & AccessGateState & LocationPinState;
|
|
18
21
|
|
|
19
22
|
// State changes await native work; overlapping actions must use the preceding result.
|
|
20
23
|
let stateQueue: Promise<State> | undefined;
|
|
@@ -27,19 +30,21 @@ function updateInOrder(s: State, update: (current: State) => Promise<State>): Pr
|
|
|
27
30
|
|
|
28
31
|
const badges: HeaderBadges<State> = headerBadges<State>(updateInOrder, () => svc);
|
|
29
32
|
const access: AccessGates<State> = accessGates<State>(updateInOrder, () => svc);
|
|
33
|
+
const pin: LocationPin<State> = locationPin<State>(updateInOrder, () => svc);
|
|
30
34
|
|
|
31
|
-
const svc = defineService<State, HeaderBadgeActionSignatures<State> & AccessGateActionSignatures<State>>("brandedLiteNav", {
|
|
35
|
+
const svc = defineService<State, HeaderBadgeActionSignatures<State> & AccessGateActionSignatures<State> & LocationPinActionSignatures<State>>("brandedLiteNav", {
|
|
32
36
|
// Every count unavailable until the first read lands, and no failure to report. Every gate pending (locked).
|
|
33
|
-
state: { notificationsBadge: null, chatBadge: null, cartBadge: null, errorText: "", ...ACCESS_GATES_INITIAL },
|
|
37
|
+
state: { notificationsBadge: null, chatBadge: null, cartBadge: null, errorText: "", ...ACCESS_GATES_INITIAL, ...LOCATION_PIN_INITIAL },
|
|
34
38
|
// The counts and the gates describe THIS run (see _shared/header-badges.ts, _shared/access-gates.ts): never stored,
|
|
35
39
|
// never restored, so a snapshot can neither show another day's numbers nor keep a tab open.
|
|
36
40
|
notPersisted: [...HEADER_BADGE_KEYS, ...ACCESS_STATE_KEYS],
|
|
37
41
|
notHydrated: [...HEADER_BADGE_KEYS, ...ACCESS_STATE_KEYS],
|
|
38
42
|
// The host calls one `onForeground` and one `onIdentityChange`: each piece runs in turn.
|
|
39
|
-
actions: { ...badges.actions, ...access.actions, ...chainLifecycle<State>(badges.actions, access.actions) },
|
|
43
|
+
actions: { ...badges.actions, ...access.actions, ...pin.actions, ...chainLifecycle<State>(badges.actions, access.actions) },
|
|
40
44
|
});
|
|
41
45
|
|
|
42
46
|
export { svc };
|
|
43
47
|
|
|
44
48
|
badges.start();
|
|
45
49
|
access.start();
|
|
50
|
+
pin.start();
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// himi-branded-lite APP-LEVEL nav worker — `NavigationConfig.navLogicBundle`.
|
|
2
|
+
//
|
|
3
|
+
// WHY IT EXISTS: `push.observerAction` names a `tier5.<service>.<action>` id, and the
|
|
4
|
+
// native sink resolves it against mounted screens FIRST and the app-level nav worker
|
|
5
|
+
// SECOND (`WorkerActionSink`, both platforms). A notification arrives while no screen
|
|
6
|
+
// of ours is mounted — that is the normal case for a cold-start tap and for every
|
|
7
|
+
// background receipt — so the only place the observer can reliably land is here. The
|
|
8
|
+
// config previously named `tier5.himiBrandedNotifications.onNotification` — a service
|
|
9
|
+
// that DOES exist, but as the notifications SCREEN's worker, alive only while that
|
|
10
|
+
// screen is mounted. So the observer dropped with a `nav_verb_dropped /
|
|
11
|
+
// no_worker_for_service` telemetry line in every case that matters.
|
|
12
|
+
//
|
|
13
|
+
// LIFETIME is the point: a screen worker dies with its screen, and this one is owned
|
|
14
|
+
// by the shell, so the unread count keeps accumulating while the user is somewhere
|
|
15
|
+
// else entirely (or nowhere — the app was backgrounded).
|
|
16
|
+
//
|
|
17
|
+
// It is built like every other worker (`himi build`) and named by the app's `navLogicBundle`.
|
|
18
|
+
|
|
19
|
+
import { defineService } from "@himalaya/state";
|
|
20
|
+
import { serializeForAgent } from "@himalaya/agent";
|
|
21
|
+
import { readNotificationEvent, setBadge } from "@himalaya/push";
|
|
22
|
+
import { applyBrand } from "@himalaya/theme";
|
|
23
|
+
import { hostSiteFromInput, hostedHiddenFlags } from "../_shared/branded-lite-hosted.js";
|
|
24
|
+
import { LOCATION_PIN_INITIAL, locationPin, type LocationPin, type LocationPinActionSignatures, type LocationPinState } from "../_shared/location-pin.js";
|
|
25
|
+
import { HEADER_BADGES_INITIAL, HEADER_BADGE_KEYS, headerBadges, type HeaderBadgeActionSignatures, type HeaderBadges, type HeaderBadgeState } from "../_shared/header-badges.js";
|
|
26
|
+
|
|
27
|
+
interface NavState extends HeaderBadgeState, LocationPinState {
|
|
28
|
+
error: string;
|
|
29
|
+
/** Notifications received but not yet opened. Drives the app-icon badge. */
|
|
30
|
+
unread: number;
|
|
31
|
+
/** True when `unread > 0` — a bindable boolean, so chrome does not have to do
|
|
32
|
+
* arithmetic in a descriptor path. */
|
|
33
|
+
hasUnread: boolean;
|
|
34
|
+
/** WHICH notifications are counted, newest last.
|
|
35
|
+
*
|
|
36
|
+
* A plain counter was wrong in both directions: a notification delivered while the
|
|
37
|
+
* app was backgrounded produces no receipt on either platform, so tapping it
|
|
38
|
+
* decremented a count it never contributed to, and a receipt seen twice (two
|
|
39
|
+
* surfaces reporting one notification) counted it twice. Identity is the fix —
|
|
40
|
+
* `unread` is this list's length, never an independent number. */
|
|
41
|
+
unreadIds: string[];
|
|
42
|
+
/** What arrived last, for the dev loop and for a "what did I miss" surface. The
|
|
43
|
+
* Ping template rather than the body: the body is localized server-side and this
|
|
44
|
+
* worker never sees it. */
|
|
45
|
+
lastTemplateId: string;
|
|
46
|
+
lastTopic: string;
|
|
47
|
+
/** The destination the route table produced, or "" when no route matched. Empty
|
|
48
|
+
* here is exactly the signal that a delivered notification had nowhere to go. */
|
|
49
|
+
lastResolvedLink: string;
|
|
50
|
+
/** Hosted mode (#4089 B2 Task 2c): per vertical, whether its nav rows are hidden for the site the
|
|
51
|
+
* host opened this app for (`himalaya.input.__himiHostSite`, set by core from the host binding). The rows bind it fail-closed, so nothing
|
|
52
|
+
* shows before this worker has answered. A single-site build never binds it. */
|
|
53
|
+
hosted: Record<string, boolean>;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** How many unread notifications are tracked. A long-lived app must not accumulate
|
|
57
|
+
* ids forever, and a count past this is "lots" for badge purposes. */
|
|
58
|
+
const UNREAD_LIMIT = 50;
|
|
59
|
+
|
|
60
|
+
/** What identifies a notification. `notificationId` when the sender set one; the
|
|
61
|
+
* resolved destination (or the raw link) otherwise, which is the best available
|
|
62
|
+
* handle — two notifications that open the same thing collapse, and the alternative
|
|
63
|
+
* is counting every duplicate delivery of one notification. */
|
|
64
|
+
function identify(ev: { notificationId: string; resolvedLink: string; link: string }): string {
|
|
65
|
+
return ev.notificationId || ev.resolvedLink || ev.link;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** The site the host opened this app for, or null (single-site build, or no host). */
|
|
69
|
+
const hostedSite = hostSiteFromInput((globalThis as { himalaya?: { input?: unknown } }).himalaya?.input);
|
|
70
|
+
|
|
71
|
+
// The header badge counts (bell, chat, cart): one service piece shared with the template's badges-only worker.
|
|
72
|
+
const badges: HeaderBadges<NavState> = headerBadges<NavState>(updateInOrder, () => svc);
|
|
73
|
+
// The Services top-bar location pin (`noLocationMenu`): one piece shared with the access-gates worker.
|
|
74
|
+
const pin: LocationPin<NavState> = locationPin<NavState>(updateInOrder, () => svc);
|
|
75
|
+
|
|
76
|
+
const svc = defineService<NavState, {
|
|
77
|
+
/** The observer. Dispatched on EVERY notification, receipt or tap — `tapped` is
|
|
78
|
+
* what tells the two apart, and the native side stringifies it. */
|
|
79
|
+
onNotification: (s: NavState, params?: unknown) => Promise<NavState>;
|
|
80
|
+
/** Zero the count (the user has caught up). */
|
|
81
|
+
clearUnread: (s: NavState) => Promise<NavState>;
|
|
82
|
+
} & HeaderBadgeActionSignatures<NavState> & LocationPinActionSignatures<NavState>>("brandedLiteNav", {
|
|
83
|
+
state: { error: "", unread: 0, hasUnread: false, unreadIds: [], lastTemplateId: "", lastTopic: "", lastResolvedLink: "", hosted: hostedHiddenFlags(hostedSite), ...LOCATION_PIN_INITIAL, ...HEADER_BADGES_INITIAL },
|
|
84
|
+
// The header badge counts describe THIS run (see _shared/header-badges.ts): never stored, never restored.
|
|
85
|
+
notPersisted: HEADER_BADGE_KEYS,
|
|
86
|
+
notHydrated: HEADER_BADGE_KEYS,
|
|
87
|
+
actions: {
|
|
88
|
+
onNotification: async (s, params) => {
|
|
89
|
+
return updateInOrder(s, (current) => {
|
|
90
|
+
const ev = readNotificationEvent(params);
|
|
91
|
+
// A TAP means the user dealt with THAT notification, not all of them — and only
|
|
92
|
+
// with one that was actually counted, which a background delivery never was.
|
|
93
|
+
const id = identify(ev);
|
|
94
|
+
const openedIndex = current.unreadIds.indexOf(id);
|
|
95
|
+
const ids = ev.tapped ? current.unreadIds.filter((_, index) => index !== openedIndex)
|
|
96
|
+
: id && current.unreadIds.includes(id) ? current.unreadIds : [...current.unreadIds, id].slice(-UNREAD_LIMIT);
|
|
97
|
+
return next(current, ids, ev.templateId, ev.topic, ev.resolvedLink);
|
|
98
|
+
}).finally(() => badges.refresh());
|
|
99
|
+
},
|
|
100
|
+
// The shell runs this on every foreground, which is the one supported moment to re-read the badges.
|
|
101
|
+
clearUnread: async (s) => updateInOrder(s, (current) =>
|
|
102
|
+
next(current, [], current.lastTemplateId, current.lastTopic, current.lastResolvedLink))
|
|
103
|
+
.finally(() => badges.refresh()),
|
|
104
|
+
...pin.actions,
|
|
105
|
+
...badges.actions,
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Badge writes await native work; overlapping actions must use the preceding result.
|
|
110
|
+
let stateQueue: Promise<NavState> | undefined;
|
|
111
|
+
function updateInOrder(s: NavState, update: (current: NavState) => Promise<NavState>): Promise<NavState> {
|
|
112
|
+
const previous = stateQueue ?? Promise.resolve(s);
|
|
113
|
+
const result = previous.then(update);
|
|
114
|
+
stateQueue = result.catch(() => previous);
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** One place that writes the count, so the badge and the state cannot disagree.
|
|
119
|
+
* The badge write is best-effort: a denied push permission must not take the
|
|
120
|
+
* observer down with it, and the count is still correct in state. */
|
|
121
|
+
async function next(
|
|
122
|
+
s: NavState,
|
|
123
|
+
unreadIds: string[],
|
|
124
|
+
lastTemplateId: string,
|
|
125
|
+
lastTopic: string,
|
|
126
|
+
lastResolvedLink: string,
|
|
127
|
+
): Promise<NavState> {
|
|
128
|
+
const unread = unreadIds.length;
|
|
129
|
+
const out: NavState = {
|
|
130
|
+
...s, error: "", unread, hasUnread: unread > 0, unreadIds, lastTemplateId, lastTopic, lastResolvedLink,
|
|
131
|
+
};
|
|
132
|
+
try {
|
|
133
|
+
await setBadge(unread);
|
|
134
|
+
} catch {
|
|
135
|
+
out.error = "Could not update the app badge.";
|
|
136
|
+
}
|
|
137
|
+
serializeForAgent({ brandedLiteNav: out });
|
|
138
|
+
return out;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { svc };
|
|
142
|
+
|
|
143
|
+
// A site without bookings never shows the pin, so a hosted site without them reads no catalog.
|
|
144
|
+
pin.start(!!hostedSite && hostedHiddenFlags(hostedSite).bookings);
|
|
145
|
+
// Subscribing notifies at once, which is the launch read; a host with no clock needs the explicit one.
|
|
146
|
+
badges.start();
|
|
147
|
+
|
|
148
|
+
// Hosted mode: the site's own brand over the build's. The shell's brand slot is scoped to this
|
|
149
|
+
// host session, so a site switch drops it.
|
|
150
|
+
if (hostedSite?.primaryColor) {
|
|
151
|
+
void applyBrand({ primaryColor: hostedSite.primaryColor }).catch((e: unknown) => console.warn(`[branded-lite] hosted brand not applied: ${String(e)}`));
|
|
152
|
+
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// until then the checkout is not composed at all and the screen says buying is not available yet.
|
|
5
5
|
import { descriptionBody } from "../_shared/rich-body.js";
|
|
6
6
|
import { defineService } from "@himalaya/state";
|
|
7
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
7
8
|
import { iapPriceFields, wixVideoItem, type IapCatalogItem } from "@himalaya/iap";
|
|
8
9
|
import { createIapCommerce, videosAppleSalesEnabled, wixVideoOrders, type IapPurchaseFields } from "@himalaya/iap-checkout";
|
|
9
10
|
import { iapPriceCopy, iapPurchaseCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
|
|
@@ -124,6 +125,16 @@ async function buy(): Promise<undefined> {
|
|
|
124
125
|
function unavailable(s: S, kind: S["playbackState"], message: string): S {
|
|
125
126
|
return { ...s, ...loaded("videos", [], { ...COPY, empty: "" }), items: [], hidePlayer: true, hideNotFound: kind !== "unavailable", noEntity: kind === "unavailable", hideRefresh: kind === "unavailable", emptyText: "", message, playbackState: kind };
|
|
126
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
|
+
}
|
|
127
138
|
type Actions = {
|
|
128
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>;
|
|
129
140
|
buy: (s: S) => Promise<undefined>; iapPoll: (s: S) => Promise<undefined>;
|
|
@@ -173,7 +184,7 @@ const svc = defineService<S, Actions>("himiBrandedVideo", {
|
|
|
173
184
|
unavailable(next, "processing", copyParam("video.processingText", "Video is processing. Try again later.")) :
|
|
174
185
|
unavailable(next, "unavailable", copyParam("video.unavailableText", "This video is unavailable."));
|
|
175
186
|
else if (!canWatchVideo(channel, video)) {
|
|
176
|
-
next =
|
|
187
|
+
next = await deniedVideo(next);
|
|
177
188
|
nextDetail = wixVideoItem(channel, video);
|
|
178
189
|
}
|
|
179
190
|
else {
|