@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,85 @@
|
|
|
1
|
+
// RN BI events whose fields exist only in a worker (epic #4973). The platform maps send every
|
|
2
|
+
// other RN event; these go through `wixPlatform.bi.log`, built inline with RN's own field names
|
|
3
|
+
// rather than by bundling a `@wix/bi-logger-*` package. The host owns every identity and common
|
|
4
|
+
// field (msid, uuid, installationId, contactId, _lv, ...), so none is named here.
|
|
5
|
+
import { bi, type BiLogEvent } from "@himalaya/wix-platform";
|
|
6
|
+
|
|
7
|
+
/** Sends one event without waiting for it and never throws: BI must not change a screen. A
|
|
8
|
+
* screen whose descriptor does not declare `wix_platform` is refused by the host, which is
|
|
9
|
+
* swallowed here like any other BI failure. */
|
|
10
|
+
export function logBi(event: BiLogEvent): void {
|
|
11
|
+
try {
|
|
12
|
+
void Promise.resolve(bi.log(event)).catch(() => undefined);
|
|
13
|
+
} catch {
|
|
14
|
+
/* BI is best-effort */
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The HTTP status a Wix SDK error carries (`HTTP 429: ...`, or a `status` field), else 0. */
|
|
19
|
+
export function wixErrorStatus(error: unknown): number {
|
|
20
|
+
const own = Number((error as { status?: unknown; statusCode?: unknown } | null)?.status ?? (error as { statusCode?: unknown } | null)?.statusCode);
|
|
21
|
+
if (Number.isFinite(own) && own > 0) return own;
|
|
22
|
+
const match = /\bHTTP (\d{3})\b/.exec(String((error as Error | null)?.message ?? error ?? ""));
|
|
23
|
+
return match ? Number(match[1]) : 0;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function applicationErrorCode(body: unknown): string {
|
|
27
|
+
const o = body as { details?: { applicationError?: { code?: unknown } }; applicationError?: { code?: unknown }; code?: unknown } | null;
|
|
28
|
+
const code = o?.details?.applicationError?.code ?? o?.applicationError?.code ?? o?.code;
|
|
29
|
+
return typeof code === "string" ? code : "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The code both native bridges put in an application error's message: `HTTP 400 [CODE]: description`
|
|
33
|
+
* (iOS JSWorker.swift `WixApiCapability.Error.application`, Android WebViewJSWorker.kt `Error.Application`). */
|
|
34
|
+
const BRIDGE_APPLICATION_CODE = /\bHTTP \d{3} \[([A-Za-z0-9_.:-]+)\]/;
|
|
35
|
+
|
|
36
|
+
/** The Wix application error code of a failed call (RN's `serializeError(e).code`): read from the
|
|
37
|
+
* error itself, else from the `[CODE]` the native bridges put after `HTTP <status> `, else from the
|
|
38
|
+
* JSON body after `HTTP <status>: ` (the bridges' raw-status arm and the web host's wixCall). ""
|
|
39
|
+
* when there is none. */
|
|
40
|
+
export function wixErrorCode(error: unknown): string {
|
|
41
|
+
const own = applicationErrorCode(error);
|
|
42
|
+
if (own) return own;
|
|
43
|
+
const message = String((error as Error | null)?.message ?? error ?? "");
|
|
44
|
+
const bracketed = BRIDGE_APPLICATION_CODE.exec(message);
|
|
45
|
+
if (bracketed) return bracketed[1];
|
|
46
|
+
const start = message.indexOf("{");
|
|
47
|
+
if (start < 0) return "";
|
|
48
|
+
try {
|
|
49
|
+
return applicationErrorCode(JSON.parse(message.slice(start)));
|
|
50
|
+
} catch {
|
|
51
|
+
return "";
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// RN's `ErrorIndicationType` (mobile-apps-inbox services/errorIndications/errorIndications.type.ts).
|
|
56
|
+
const ERROR_INDICATIONS = new Set([
|
|
57
|
+
"ACCESS_TOKEN_EXPIRED", "ALLOWED_MESSAGING_TIME_WINDOW_EXPIRED", "ATTACHMENT_SIZE_EXCEEDS_ALLOWED_LIMIT", "CAMPAIGN_SUSPENDED",
|
|
58
|
+
"FACEBOOK_ALLOWED_WINDOW_EXPIRED", "GMAIL_ADV_PROTECTION", "INSTAGRAM_ALLOWED_WINDOW_EXPIRED", "INVALID_CHARACTERS",
|
|
59
|
+
"INVALID_PHONE_NUMBER", "INVALID_RECIPIENT_ADDRESS", "LANDLINE_OR_UNREACHABLE_CARRIER", "MESSAGE_FILTERED",
|
|
60
|
+
"MMS_NOT_SUPPORTED_RECEIVING_PHONE_NUMBER", "NETWORK_ISSUE", "NO_MATCHING_RECIPIENT_FOUND", "POLICY_VIOLATION", "QUOTA_EXCEEDED",
|
|
61
|
+
"RATE_LIMIT", "RATE_LIMIT_ERROR", "RECIPIENT_BLOCKED_MESSAGES", "RECIPIENT_NOT_AVAILABLE", "SERVICE_UNAVAILABLE",
|
|
62
|
+
"TELCO_LANDLINE_OR_UNREACHABLE_CARRIER", "TELCO_MEDIA_EXCEEDS_MESSAGING_PROVIDER_SIZE_LIMIT",
|
|
63
|
+
"TELCO_MESSAGE_DELIVERY_UNKNOWN_DESTINATION_HANDSET", "TELCO_MESSAGE_FILTERED", "TELCO_MESSAGE_FROM_NUMBER_STILL_BEING_CONFIGURED",
|
|
64
|
+
"TELCO_MESSAGE_FROM_UNREGISTERED_NUMBER", "TELCO_UNKNOWN_ERROR", "TELCO_UNREACHABLE_DESTINATION_HANDSET", "TOO_MANY_REQUESTS",
|
|
65
|
+
"TOTAL_ATTACHMENTS_SIZE_EXCEEDS_ALLOWED_LIMIT", "UNEXPECTED_ERROR_RETRY_LATER", "UNKNOWN_FAILED_CODE", "UNSUPPORTED",
|
|
66
|
+
"UNSUPPORTED_MESSAGE_TYPE", "USER_RATE_LIMIT",
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
/** 5:1604 inboxSendMessageErrorMsgShown (`@wix/bi-logger-crm-data` v2, endpoint ''), for a chat
|
|
70
|
+
* send that failed and said so. RN's `errorReason` is the failed message's indication code, and
|
|
71
|
+
* RN reports a code it does not know as UNSUPPORTED (`getErrorIndicationFromCode`); a send that
|
|
72
|
+
* never left the device is NETWORK_ISSUE and a 429 is RATE_LIMIT. */
|
|
73
|
+
export function logChatSendError(input: { chatroomId: string; contactId?: string; error: unknown; offline: boolean }): void {
|
|
74
|
+
const code = wixErrorCode(input.error);
|
|
75
|
+
const errorReason = input.offline ? "NETWORK_ISSUE"
|
|
76
|
+
: ERROR_INDICATIONS.has(code) ? code
|
|
77
|
+
: wixErrorStatus(input.error) === 429 ? "RATE_LIMIT"
|
|
78
|
+
: "UNSUPPORTED";
|
|
79
|
+
logBi({
|
|
80
|
+
evid: 1604,
|
|
81
|
+
src: 5,
|
|
82
|
+
endpoint: "",
|
|
83
|
+
params: { origin: "native", chatroomId: input.chatroomId, ...(input.contactId ? { contact_id: input.contactId } : {}), errorReason },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// The destination data the inbox tap needs from the Wix member-link catalog (the one an app's push taps use):
|
|
2
|
+
// which links a member notification carries, and the canonical Himi screen and param each one opens.
|
|
3
|
+
//
|
|
4
|
+
// This is a COPY, on purpose. A worker's shared helpers are copied into the starter app by the template
|
|
5
|
+
// generator, which follows only relative imports that stay inside the bundles source folder, so a worker
|
|
6
|
+
// cannot import the catalog from its own package without breaking `himi init`.
|
|
7
|
+
// The copy is pinned to the catalog by the notification-target parity test (every id, link, param and
|
|
8
|
+
// screen must match), so a catalog change fails that test until this file follows it.
|
|
9
|
+
//
|
|
10
|
+
// Generated from the catalog's `id`, `matches`, `screenParam` and `canonicalScreen`; `vertical`, `audience`
|
|
11
|
+
// and the commentary belong to the catalog and are not repeated here.
|
|
12
|
+
|
|
13
|
+
export interface MemberLinkDestination {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Longest first, as in the catalog. */
|
|
16
|
+
matches: readonly string[];
|
|
17
|
+
/** The capture that names the item; absent for a list screen. */
|
|
18
|
+
screenParam?: string;
|
|
19
|
+
canonicalScreen: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const MEMBER_LINK_DESTINATIONS: readonly MemberLinkDestination[] = [
|
|
23
|
+
{
|
|
24
|
+
id: "store.order",
|
|
25
|
+
matches: [
|
|
26
|
+
"my-account/:site/stores/orders/:orderId",
|
|
27
|
+
],
|
|
28
|
+
screenParam: "orderId",
|
|
29
|
+
canonicalScreen: "himi_order",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "bookings.session",
|
|
33
|
+
matches: [
|
|
34
|
+
"bookings/app/:site/:businessId/:sessionId",
|
|
35
|
+
],
|
|
36
|
+
canonicalScreen: "himi_bookings",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "groups.post",
|
|
40
|
+
matches: [
|
|
41
|
+
"clubs-member/club/:groupId/feed/post/:postId/:commentId",
|
|
42
|
+
"clubs-member/club/:groupId/feed/post/:postId",
|
|
43
|
+
],
|
|
44
|
+
screenParam: "groupId",
|
|
45
|
+
canonicalScreen: "himi_group",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: "forum.thread",
|
|
49
|
+
matches: [
|
|
50
|
+
"forum/post/:postId/:commentId/:replyId",
|
|
51
|
+
"forum/post/:postId/:commentId",
|
|
52
|
+
"forum/post/:postId",
|
|
53
|
+
],
|
|
54
|
+
screenParam: "postId",
|
|
55
|
+
canonicalScreen: "himi_forum_post",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "forum.create",
|
|
59
|
+
matches: [
|
|
60
|
+
"forum/create-post",
|
|
61
|
+
],
|
|
62
|
+
canonicalScreen: "himi_create_post",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "blog.post",
|
|
66
|
+
matches: [
|
|
67
|
+
"blog/post/:postId",
|
|
68
|
+
],
|
|
69
|
+
screenParam: "postId",
|
|
70
|
+
canonicalScreen: "himi_blog_post",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "members.profile",
|
|
74
|
+
matches: [
|
|
75
|
+
"members-area/member-profile/:memberId",
|
|
76
|
+
],
|
|
77
|
+
screenParam: "memberId",
|
|
78
|
+
canonicalScreen: "himi_member",
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: "events.event",
|
|
82
|
+
matches: [
|
|
83
|
+
"my-account/app/140603ad-af8d-84a5-2c80-a0f60cb47351/:instanceId/:eventId/guest-list/:path",
|
|
84
|
+
"my-account/app/140603ad-af8d-84a5-2c80-a0f60cb47351/:instanceId/:eventId/details",
|
|
85
|
+
],
|
|
86
|
+
screenParam: "eventId",
|
|
87
|
+
canonicalScreen: "himi_event",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "galleries.shared",
|
|
91
|
+
matches: [
|
|
92
|
+
"shared-gallery/:site/preview/:itemId",
|
|
93
|
+
],
|
|
94
|
+
canonicalScreen: "himi_galleries",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "galleries.album",
|
|
98
|
+
matches: [
|
|
99
|
+
"lists/:site/:listId/media/:itemId/:commentId",
|
|
100
|
+
"lists/:site/:listId/:tab/:commentId",
|
|
101
|
+
"spaces/lists/:site/:listId/:tab",
|
|
102
|
+
"lists/:site/:listId/:itemId",
|
|
103
|
+
],
|
|
104
|
+
screenParam: "listId",
|
|
105
|
+
canonicalScreen: "himi_photo_album",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "notifications.list",
|
|
109
|
+
matches: [
|
|
110
|
+
"notifications/list/:site",
|
|
111
|
+
],
|
|
112
|
+
canonicalScreen: "himi_notifications",
|
|
113
|
+
},
|
|
114
|
+
];
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
// Shared Wix Bookings service-price formatter for himi workers (#816).
|
|
2
|
+
//
|
|
3
|
+
// One door for turning a Wix Bookings SERVICE payload into a display price
|
|
4
|
+
// string, so the four consuming workers (himi-booking-services,
|
|
5
|
+
// himi-booking-service, himi-booking-time, himi-branded-lite-home) can never
|
|
6
|
+
// drift apart again. Each used to read `payment.price ?? service.price` and
|
|
7
|
+
// default the currency to "USD" — but the live Bookings v2 payload nests the
|
|
8
|
+
// fixed price under `payment.fixed.price.{value,currency}` (Money; `value` is a
|
|
9
|
+
// decimal string), so on a real ILS site the amount rendered blank (the flat
|
|
10
|
+
// fields are absent) or, once decoded, in the wrong "$" currency (the ₪ was
|
|
11
|
+
// dropped). This helper reads the v2 nested shape FIRST and derives the currency
|
|
12
|
+
// FROM THE RECORD, falling back to the legacy/flat shapes for older payloads.
|
|
13
|
+
//
|
|
14
|
+
// Pure + dependency-free (structural `unknown` input, no SDK import) so it bundles
|
|
15
|
+
// into every worker and gen-templates copies it verbatim into each tier5-src.
|
|
16
|
+
|
|
17
|
+
import { formatCurrency } from "../_shared/engine-intl.js";
|
|
18
|
+
/** Coerce a number or numeric string to a finite number, else undefined. */
|
|
19
|
+
function numberOf(value: unknown): number | undefined {
|
|
20
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : undefined;
|
|
21
|
+
if (typeof value === "string" && value.trim()) {
|
|
22
|
+
const n = Number(value);
|
|
23
|
+
return Number.isNaN(n) ? undefined : n;
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Non-empty trimmed string, else "". */
|
|
29
|
+
function stringOf(value: unknown): string {
|
|
30
|
+
return typeof value === "string" ? value.trim() : "";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
type LooseService = {
|
|
34
|
+
payment?: {
|
|
35
|
+
rateType?: unknown;
|
|
36
|
+
fixed?: { price?: { value?: unknown; amount?: unknown; currency?: unknown } };
|
|
37
|
+
price?: unknown;
|
|
38
|
+
currency?: unknown;
|
|
39
|
+
};
|
|
40
|
+
price?: unknown;
|
|
41
|
+
currency?: unknown;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The numeric price amount for a service, following the same v2-first priority
|
|
46
|
+
* as {@link formatServicePrice}. Returns undefined when there is no usable
|
|
47
|
+
* amount or the rate type is non-FIXED — callers use it for "is this a paid
|
|
48
|
+
* service?" decisions so the flag never disagrees with the rendered price.
|
|
49
|
+
*/
|
|
50
|
+
export function serviceAmount(service: unknown): number | undefined {
|
|
51
|
+
const s = (service ?? {}) as LooseService;
|
|
52
|
+
const payment = s.payment ?? {};
|
|
53
|
+
|
|
54
|
+
// A declared non-FIXED rate type (VARIED/CUSTOM/NO_FEE) carries no single fixed
|
|
55
|
+
// amount. An ABSENT rateType (legacy/flat payloads) is NOT treated as non-FIXED.
|
|
56
|
+
const rateType = stringOf(payment.rateType).toUpperCase();
|
|
57
|
+
if (rateType && rateType !== "FIXED") return undefined;
|
|
58
|
+
|
|
59
|
+
const fixed = payment.fixed?.price;
|
|
60
|
+
return numberOf(fixed?.value ?? fixed?.amount ?? payment.price ?? s.price);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The currency for a service, derived FROM THE RECORD (v2 nested first, then
|
|
65
|
+
* legacy nested, then top-level). "USD" is only the absolute last resort when
|
|
66
|
+
* no currency is present anywhere — it never overrides one the record carries.
|
|
67
|
+
*/
|
|
68
|
+
export function serviceCurrency(service: unknown): string {
|
|
69
|
+
const s = (service ?? {}) as LooseService;
|
|
70
|
+
const payment = s.payment ?? {};
|
|
71
|
+
return (
|
|
72
|
+
stringOf(payment.fixed?.price?.currency) ||
|
|
73
|
+
stringOf(payment.currency) ||
|
|
74
|
+
stringOf(s.currency) ||
|
|
75
|
+
"USD"
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Whether money is due for this service — a MONEY decision, deliberately not the same
|
|
81
|
+
* predicate as "do we have a number to display".
|
|
82
|
+
*
|
|
83
|
+
* `serviceAmount` returns undefined for any non-FIXED rate type, which is right for
|
|
84
|
+
* display (there is no single figure to render) and wrong for routing: a VARIED or CUSTOM
|
|
85
|
+
* service is chargeable, it just has no fixed figure. Deriving "is this paid?" from
|
|
86
|
+
* `serviceAmount() > 0` therefore sent such a booking down the FREE branch — booked, never
|
|
87
|
+
* charged. `NO_FEE` is the one non-FIXED type that really is free.
|
|
88
|
+
*
|
|
89
|
+
* Fails toward charging: the checkout path already degrades gracefully when nothing is
|
|
90
|
+
* actually owed (no `paymentGatewayOrderId` ⇒ it completes the booking and stops), so a
|
|
91
|
+
* false positive costs nothing while a false negative gives the service away.
|
|
92
|
+
*/
|
|
93
|
+
export function serviceIsChargeable(service: unknown): boolean {
|
|
94
|
+
const s = (service ?? {}) as LooseService;
|
|
95
|
+
const rateType = stringOf(s.payment?.rateType).toUpperCase();
|
|
96
|
+
if (rateType === "NO_FEE") return false;
|
|
97
|
+
if (rateType && rateType !== "FIXED") return true; // VARIED / CUSTOM: priced, just not fixed
|
|
98
|
+
const amount = serviceAmount(service);
|
|
99
|
+
return amount != null && amount > 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Format one Bookings v2 Money value (`{ value, currency }`, `value` a decimal string) — a
|
|
104
|
+
* price, a deposit, a VARIED minimum, a cancellation fee. A whole amount drops its cents
|
|
105
|
+
* ("₪90", not "₪90.00"), as the service screen shows it. "" when it carries no usable
|
|
106
|
+
* amount. The currency comes from the Money itself, then from `fallbackCurrency`.
|
|
107
|
+
*/
|
|
108
|
+
export function formatServiceMoney(money: unknown, fallbackCurrency = "USD"): string {
|
|
109
|
+
const m = (money ?? {}) as { value?: unknown; amount?: unknown; currency?: unknown };
|
|
110
|
+
const amount = numberOf(m.value ?? m.amount);
|
|
111
|
+
if (amount == null) return "";
|
|
112
|
+
const currency = stringOf(m.currency) || fallbackCurrency;
|
|
113
|
+
try {
|
|
114
|
+
return formatCurrency(amount, currency, undefined, Number.isInteger(amount) ? 0 : undefined);
|
|
115
|
+
} catch {
|
|
116
|
+
return `${amount}`;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Format a Wix Bookings service's price for display, e.g. "₪111" / "$20" / "$19.50".
|
|
122
|
+
*
|
|
123
|
+
* Reads, in order of preference:
|
|
124
|
+
* 1. Bookings v2 fixed price — `payment.fixed.price.{value,currency}` (the
|
|
125
|
+
* live shape; `value`/`amount` is a decimal string, currency is real).
|
|
126
|
+
* 2. Legacy nested — `payment.price` / `payment.currency`.
|
|
127
|
+
* 3. Top-level — `service.price` / `service.currency`.
|
|
128
|
+
*
|
|
129
|
+
* The currency is ALWAYS derived from the record; "USD" is only the absolute
|
|
130
|
+
* last resort when no currency is present anywhere (so behavior is unchanged
|
|
131
|
+
* when the data simply carries none). A non-FIXED `rateType`
|
|
132
|
+
* (VARIED/CUSTOM/NO_FEE) has no single amount to show → returns "".
|
|
133
|
+
* Returns "" (never throws) when there is no usable numeric amount.
|
|
134
|
+
*/
|
|
135
|
+
export function formatServicePrice(service: unknown): string {
|
|
136
|
+
const amount = serviceAmount(service);
|
|
137
|
+
if (amount == null) return "";
|
|
138
|
+
const currency = serviceCurrency(service);
|
|
139
|
+
try {
|
|
140
|
+
// A whole amount drops its cents ("₪70", not "₪70.00"), as formatServiceMoney and the service
|
|
141
|
+
// screen show it, so the same service reads the same price on every screen.
|
|
142
|
+
return formatCurrency(amount, currency, undefined, Number.isInteger(amount) ? 0 : undefined);
|
|
143
|
+
} catch {
|
|
144
|
+
return `${amount}`;
|
|
145
|
+
}
|
|
146
|
+
}
|