@wix/himalaya-cli 0.1749.0 → 0.1751.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/himi-package.d.ts +478 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/host-compatibility.d.ts +56 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/icon-catalog.generated.d.ts +1 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/site-shell.d.ts +156 -8
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/validator.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/index.d.ts +2 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast-service.d.ts +105 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/flows/screens/src/podcast.d.ts +116 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +326 -13
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +730 -81
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +155 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{b40ea5d0d6251898ff5617139fde8be008dd11e99a70b14c1052093685401700.bin → 21f35a12bd94f4ab97a9a75453c4adcadc438daf024a4b1950d5c356c123bd01.bin} +1 -1
- package/dist/browser-plane/sw.js +7 -7
- package/dist/cli.mjs +44618 -35753
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +4 -0
- package/guides/designing-himi-screens.md +7 -0
- package/guides/getting-started.md +5 -1
- package/guides/headless-loop.md +1 -1
- package/guides/himi-json-output.md +54 -1
- package/guides/himi-skill.md +5 -1
- package/guides/index.json +6 -0
- package/guides/one-app-to-himi-app.md +31 -8
- package/guides/qa-builds.md +12 -1
- package/guides/recipe-podcast.md +149 -0
- package/guides/skill.md +3 -1
- package/guides/store-submission.md +149 -34
- package/guides/tier-5-add-a-screen.md +16 -2
- package/guides/wix-business-context.md +43 -0
- package/guides/wix-platform-usage.md +7 -2
- package/package.json +10 -10
- package/template-icons/fitness-gym.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 -1
- package/templates/beauty-salon/l10n/en.json +1 -1
- 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/program-fields.ts +16 -0
- package/templates/beauty-salon/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/beauty-salon/tier5-src/_shared/source-badges.ts +72 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +37 -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/branded-lite/config.ts +12 -0
- package/templates/branded-lite/dev/index.ts +101 -1
- package/templates/branded-lite/l10n/en.json +22 -1
- package/templates/branded-lite/l10n/es.json +22 -0
- package/templates/branded-lite/l10n/fr.json +23 -0
- package/templates/branded-lite/l10n/he.json +19 -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/program-fields.ts +16 -0
- package/templates/branded-lite/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/branded-lite/tier5-src/himi-branded-lite-access-nav/index.ts +10 -5
- package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-nav/index.ts +152 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
- 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/brandy/README.md +33 -0
- package/templates/brandy/config.ts +51 -7
- package/templates/brandy/dev/index.ts +23 -9
- package/templates/community-club/l10n/en.json +1 -1
- package/templates/community-club/tier5-src/_shared/member-access.ts +17 -6
- package/templates/community-club/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/community-club/tier5-src/_shared/programs-section.ts +5 -8
- 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/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/l10n/en.json +1 -1
- package/templates/events-meetups/tier5-src/_shared/member-access.ts +17 -6
- package/templates/events-meetups/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/events-meetups/tier5-src/_shared/programs-section.ts +5 -8
- 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/fitness-gym/README.md +53 -0
- package/templates/fitness-gym/config.ts +560 -0
- package/templates/fitness-gym/dev/index.ts +25787 -0
- package/templates/fitness-gym/himalaya.content.json +64 -0
- package/templates/fitness-gym/himalaya.template.json +15 -0
- package/templates/fitness-gym/icon.png +0 -0
- package/templates/fitness-gym/platforms.json +1 -0
- package/templates/fitness-gym/tier5-src/_shared/app-locale.ts +61 -0
- package/templates/fitness-gym/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/fitness-gym/tier5-src/_shared/booking-session.ts +224 -0
- package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +280 -0
- package/templates/fitness-gym/tier5-src/_shared/branded-load-state.ts +109 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-history.ts +51 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-model.ts +56 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-presenter.ts +576 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-transport.ts +148 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-contract.ts +228 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-query.ts +193 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +400 -0
- package/templates/fitness-gym/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +523 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-account.ts +194 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-booking-saved.ts +88 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-bookings.ts +318 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-copy.ts +116 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-media.ts +29 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/fitness-gym/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/fitness-gym/tier5-src/_shared/host-events.ts +66 -0
- package/templates/fitness-gym/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance-purchase.ts +216 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/fitness-gym/tier5-src/_shared/iap-worker.ts +127 -0
- package/templates/fitness-gym/tier5-src/_shared/inbox-rooms.ts +68 -0
- package/templates/fitness-gym/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/fitness-gym/tier5-src/_shared/member-access.ts +63 -0
- package/templates/fitness-gym/tier5-src/_shared/member-account-routes.ts +52 -0
- package/templates/fitness-gym/tier5-src/_shared/member-bookings.ts +107 -0
- package/templates/fitness-gym/tier5-src/_shared/member-screen.ts +99 -0
- package/templates/fitness-gym/tier5-src/_shared/notification-target.ts +141 -0
- package/templates/fitness-gym/tier5-src/_shared/offset-page.ts +10 -0
- package/templates/fitness-gym/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/fitness-gym/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/fitness-gym/tier5-src/_shared/payment-setup.ts +6 -0
- package/templates/fitness-gym/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/fitness-gym/tier5-src/_shared/program-description.ts +11 -0
- package/templates/fitness-gym/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/fitness-gym/tier5-src/_shared/program-standing.ts +46 -0
- package/templates/fitness-gym/tier5-src/_shared/rich-body.ts +78 -0
- package/templates/fitness-gym/tier5-src/_shared/rich-content-link.ts +34 -0
- package/templates/fitness-gym/tier5-src/_shared/sign-in-sheet.ts +18 -0
- package/templates/fitness-gym/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/fitness-gym/tier5-src/_shared/weekly-goal.ts +107 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-member-links.ts +114 -0
- package/templates/fitness-gym/tier5-src/_shared/wix-service-price.ts +146 -0
- package/templates/fitness-gym/tier5-src/business-chat/index.ts +732 -0
- package/templates/fitness-gym/tier5-src/business-contact/index.ts +6 -0
- package/templates/fitness-gym/tier5-src/himi-booking-account/index.ts +267 -0
- package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +468 -0
- package/templates/fitness-gym/tier5-src/himi-booking-service/index.ts +1190 -0
- package/templates/fitness-gym/tier5-src/himi-booking-services/index.ts +791 -0
- package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +1729 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +988 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +656 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-notifications/index.ts +256 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-plans/index.ts +495 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/facts.ts +52 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +845 -0
- package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +191 -0
- package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +619 -0
- package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +1007 -0
- package/templates/fitness-gym/tier5-src/wix-spaces-my-subscriptions/index.ts +84 -0
- package/templates/fitness-gym/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
- package/templates/fitness-gym/tokens.json +414 -0
- package/templates/gym-fitness/config.ts +12 -0
- package/templates/gym-fitness/dev/index.ts +1 -1
- package/templates/gym-fitness/l10n/en.json +1 -1
- 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/program-fields.ts +16 -0
- package/templates/gym-fitness/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/gym-fitness/tier5-src/_shared/source-badges.ts +72 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +37 -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/medical-services/dev/index.ts +2 -1
- package/templates/medical-services/tier5-src/_shared/booking-session.ts +3 -1
- package/templates/medical-services/tier5-src/_shared/member-access.ts +17 -6
- package/templates/medical-services/tier5-src/himi-booking-account/index.ts +16 -1
- package/templates/medical-services/tier5-src/himi-store-account/index.ts +13 -4
- package/templates/nonprofit-cause/l10n/en.json +1 -1
- package/templates/nonprofit-cause/tier5-src/_shared/member-access.ts +17 -6
- package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/nonprofit-cause/tier5-src/_shared/programs-section.ts +5 -8
- 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/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 +988 -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 +100 -0
- package/templates/podcast-creator/l10n/en.json +22 -1
- package/templates/podcast-creator/l10n/es.json +22 -0
- package/templates/podcast-creator/l10n/fr.json +18 -0
- package/templates/podcast-creator/l10n/he.json +15 -0
- package/templates/podcast-creator/tier5-src/_shared/member-access.ts +17 -6
- package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/podcast-creator/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/podcast-creator/tier5-src/himi-branded-lite-podcasts/index.ts +14 -234
- 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/portfolio-creative/l10n/en.json +1 -1
- package/templates/portfolio-creative/tier5-src/_shared/member-access.ts +17 -6
- package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/portfolio-creative/tier5-src/_shared/programs-section.ts +5 -8
- 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/restaurant/l10n/en.json +1 -1
- package/templates/restaurant/tier5-src/_shared/member-access.ts +17 -6
- package/templates/restaurant/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/restaurant/tier5-src/_shared/programs-section.ts +5 -8
- 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/retail-store/l10n/en.json +1 -1
- package/templates/retail-store/tier5-src/_shared/member-access.ts +17 -6
- package/templates/retail-store/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/retail-store/tier5-src/_shared/programs-section.ts +5 -8
- 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/salon-spa/dev/index.ts +1 -1
- 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/himi-booking-account/index.ts +16 -1
- package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +37 -4
- package/templates/salon-spa/tier5-src/himi-store-account/index.ts +13 -4
- 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 -1
- package/templates/yoga-studio/l10n/en.json +1 -1
- 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/program-fields.ts +16 -0
- package/templates/yoga-studio/tier5-src/_shared/programs-section.ts +5 -8
- package/templates/yoga-studio/tier5-src/_shared/source-badges.ts +72 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +37 -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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { WixPlanOrder, WixPlanPricing } from "@himalaya/wix-pricing-plans";
|
|
2
|
+
import { copyParam, copyTemplate } from "./himi-copy.js";
|
|
3
|
+
import { formatCurrency, formatDateMedium } from "./engine-intl.js";
|
|
4
|
+
|
|
5
|
+
export function planDuration(pricing?: WixPlanPricing): string {
|
|
6
|
+
if (pricing?.singlePaymentUnlimited) return copyParam("plans.unlimited", "Unlimited duration");
|
|
7
|
+
const cycle = pricing?.subscription;
|
|
8
|
+
if (cycle && !cycle.cycleCount) return copyParam("plans.untilCanceled", "Until canceled");
|
|
9
|
+
const duration = cycle?.cycleDuration ?? pricing?.singlePaymentForDuration;
|
|
10
|
+
const count = (duration?.count ?? 0) * (cycle ? cycle.cycleCount ?? 0 : 1);
|
|
11
|
+
const unit = duration?.unit?.toLowerCase().replace(/s$/, "");
|
|
12
|
+
if (!count || !unit) return "";
|
|
13
|
+
const units: Record<string, [string, string]> = { day: ["day", "days"], week: ["week", "weeks"], month: ["month", "months"], year: ["year", "years"] };
|
|
14
|
+
const pair = units[unit];
|
|
15
|
+
if (!pair) return "";
|
|
16
|
+
return copyTemplate("plans.validFor", "Valid for {count} {unit}", { count, unit: copyParam(`plans.${unit}.${count === 1 ? "one" : "other"}`, pair[count === 1 ? 0 : 1]) });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function orderDate(value?: string): string {
|
|
20
|
+
return value && Number.isFinite(Date.parse(value)) ? formatDateMedium(new Date(value)) : "";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The purchased order owns its price; today's plan is never a price fallback. */
|
|
24
|
+
export function orderPrice(order: WixPlanOrder): string {
|
|
25
|
+
const cycle = order.currentCycle?.index ?? 1;
|
|
26
|
+
const span = order.pricing?.prices?.find(({ duration }) => {
|
|
27
|
+
const from = duration?.cycleFrom ?? 1;
|
|
28
|
+
return cycle >= from && (!duration?.numberOfCycles || cycle < from + duration.numberOfCycles);
|
|
29
|
+
});
|
|
30
|
+
const currency = order.priceDetails?.currency ?? order.pricing?.currency ?? span?.price?.currency;
|
|
31
|
+
return purchasedMoney(span?.price?.total, span?.price?.currency) || span?.price?.formattedTotal
|
|
32
|
+
|| purchasedMoney(order.priceDetails?.total, order.priceDetails?.currency)
|
|
33
|
+
|| purchasedMoney(order.pricing?.total, order.pricing?.currency)
|
|
34
|
+
|| purchasedMoney(order.priceDetails?.planPrice, currency)
|
|
35
|
+
|| purchasedMoney(order.planPrice, currency);
|
|
36
|
+
}
|
|
37
|
+
function purchasedMoney(value?: string, currency?: string): string {
|
|
38
|
+
return value !== undefined && value !== "" && Number.isFinite(Number(value)) && currency
|
|
39
|
+
? formatCurrency(Number(value), currency) : "";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function orderStatus(order: WixPlanOrder): string {
|
|
43
|
+
const status = order.status ?? "";
|
|
44
|
+
const labels: Record<string, string> = { ACTIVE: "Active", PENDING: "Pending", PAUSED: "Paused", CANCELED: "Canceled", ENDED: "Expired", DRAFT: "Pending payment" };
|
|
45
|
+
return copyParam(`subscriptionDetail.status.${status}`, labels[status] ?? "Status unavailable");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function orderFacts(order: WixPlanOrder): Array<{ id: string; label: string; value: string; positive: boolean; notPositive: boolean }> {
|
|
49
|
+
const payment: Record<string, string> = { ONLINE: "Online", OFFLINE: "Offline", EXTERNAL: "External" };
|
|
50
|
+
const statuses: Record<string, string> = { PAID: "Paid", UNPAID: "Unpaid", FAILED: "Failed", PENDING: "Pending", REFUNDED: "Refunded", NOT_APPLICABLE: "Not applicable" };
|
|
51
|
+
const pairs: Array<[string, string, string]> = [
|
|
52
|
+
["purchaseDate", "Purchase date", orderDate(order.createdDate)],
|
|
53
|
+
["startDate", "Start date", orderDate(order.startDate)],
|
|
54
|
+
["endDate", "End date", orderDate(order.earliestEndDate ?? order.endDate)],
|
|
55
|
+
["paymentMethod", "Payment method", payment[order.type ?? ""] ? copyParam(`subscriptionDetail.payment.${order.type}`, payment[order.type!]) : ""],
|
|
56
|
+
["lastPaymentStatus", "Last payment status", statuses[order.lastPaymentStatus ?? ""] ? copyParam(`subscriptionDetail.paymentStatus.${order.lastPaymentStatus}`, statuses[order.lastPaymentStatus!]) : ""],
|
|
57
|
+
];
|
|
58
|
+
if (order.autoRenewCanceled || order.cancellation?.effectiveAt === "NEXT_PAYMENT_DATE") {
|
|
59
|
+
pairs.push(["scheduledEnd", "Scheduled end", orderDate(order.earliestEndDate ?? order.endDate ?? order.currentCycle?.endedDate)]);
|
|
60
|
+
} else if (order.status === "ACTIVE" && (order.pricing?.subscription ?? order.priceDetails?.subscription) && order.currentCycle?.endedDate) {
|
|
61
|
+
pairs.push(["periodEnd", "Current period ends", orderDate(order.currentCycle.endedDate)]);
|
|
62
|
+
}
|
|
63
|
+
return pairs.filter(([, , value]) => Boolean(value)).map(([id, label, value]) => ({ id, label: copyParam(`subscriptionDetail.${id}`, label), value, positive: id === "lastPaymentStatus" && order.lastPaymentStatus === "PAID", notPositive: id !== "lastPaymentStatus" || order.lastPaymentStatus !== "PAID" }));
|
|
64
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// [rico] #3370 — an entity's Ricos body, prepared for a RichContent component and its plain-text fallback.
|
|
2
|
+
// One rule for every worker that renders a body (the blog post and the owner post detail today; #3372's
|
|
3
|
+
// verticals next), so they cannot drift apart.
|
|
4
|
+
// Inside the platform source this import is a relative path, so node test runs resolve it; an app's copy
|
|
5
|
+
// imports "@himalaya/wix-rich-content".
|
|
6
|
+
import { encodeRichContent, parseRicosJson, ricosToPlainText } from "@himalaya/wix-rich-content";
|
|
7
|
+
|
|
8
|
+
/** What a body-rendering worker publishes: `<name>Json` for `documentJsonPath`, and the plain text. */
|
|
9
|
+
export interface RichBody {
|
|
10
|
+
/** The document as ONE JSON string (media sized, disallowed links dropped); "" when there is no document
|
|
11
|
+
* or the encoder rejected it. RichContent draws nothing for "", so a screen gates its plain text on it. */
|
|
12
|
+
bodyJson: string;
|
|
13
|
+
/** The plain text: the document's own text when it has any, else `fallback`. */
|
|
14
|
+
bodyText: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** [rico] #3372 — the media width for a document drawn in a LIST row (a feed post, a comment, a CMS item): the
|
|
18
|
+
* list-image size (WIX_LIST_IMAGE), so a scrolling list never downloads every image at detail size. */
|
|
19
|
+
export const ROW_IMAGE_WIDTH = 1000;
|
|
20
|
+
|
|
21
|
+
/** Prepares `richContent` (a Ricos document, as a Wix API returns it, or its JSON string). No document, or one
|
|
22
|
+
* that is not a document, gives `{ bodyJson: "", bodyText: fallback }`. A document past the viewer's limits
|
|
23
|
+
* gives bodyJson "" and its plain text — except one rejected as too deep, which is not walked again (the
|
|
24
|
+
* plain-text walk has no depth limit), so `fallback` stands in for it. `imageWidth` sizes its media (default
|
|
25
|
+
* the 1400 px detail budget). */
|
|
26
|
+
export function richBody(richContent: unknown, fallback = "", imageWidth = 1400): RichBody {
|
|
27
|
+
const doc = parseRicosJson(richContent);
|
|
28
|
+
if (!doc) return { bodyJson: "", bodyText: fallback };
|
|
29
|
+
// 1400 px by default — the detail-image budget, which is also the encoder's maximum; list rows pass
|
|
30
|
+
// ROW_IMAGE_WIDTH.
|
|
31
|
+
const { json, rejected } = encodeRichContent(doc, { imageWidth });
|
|
32
|
+
const text = rejected === "too_deep" ? "" : ricosToPlainText(doc);
|
|
33
|
+
return { bodyJson: json, bodyText: text || fallback };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** A Wix description may be Ricos (including serialized JSON), HTML or ordinary text.
|
|
37
|
+
* Keep rich documents on the existing bounded encoder path. Non-document JSON and
|
|
38
|
+
* clearly malformed serialization use an independent fallback. Ambiguous bracketed
|
|
39
|
+
* prose stays readable; this does not attempt to repair arbitrary JSON syntax. */
|
|
40
|
+
export function descriptionBody(value: unknown, fallback = "", imageWidth = 1400): RichBody {
|
|
41
|
+
if (typeof value !== "string") return richBody(value, fallback, imageWidth);
|
|
42
|
+
const text = value.trim();
|
|
43
|
+
if (/^[{[]/.test(text)) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed: unknown = JSON.parse(text);
|
|
46
|
+
// Passing the parsed value avoids parsing a valid Ricos document twice; a
|
|
47
|
+
// different JSON structure is rejected by the same existing document check.
|
|
48
|
+
if (parsed && typeof parsed === "object") return richBody(parsed, fallback, imageWidth);
|
|
49
|
+
} catch {
|
|
50
|
+
const objectLike = /^\{\s*(?:["'}]|nodes\b)/.test(text);
|
|
51
|
+
// Only reject scalar-looking malformed arrays when their syntax is clearly
|
|
52
|
+
// unfinished (or contains JS's non-JSON `undefined`). Balanced bracketed
|
|
53
|
+
// prose such as "[1,000]" and "[12:30, 13:30]" is not JSON and stays readable.
|
|
54
|
+
const arrayTokens = text.replace(/"(?:\\.|[^"\\])*"/g, "")
|
|
55
|
+
.replace(/\b(?:true|false|null|undefined)\b/g, "")
|
|
56
|
+
.replace(/-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/g, "");
|
|
57
|
+
const arrayLike = /^\[\s*[{"]/.test(text)
|
|
58
|
+
|| (text.startsWith("[") && /^[\s[\]{},:]*$/.test(arrayTokens)
|
|
59
|
+
&& (/,\s*]?$/.test(text) || /\bundefined\b/.test(text) || !text.endsWith("]")));
|
|
60
|
+
if (objectLike || arrayLike) return { bodyJson: "", bodyText: fallback };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Legacy HTML descriptions stay text. Preserve paragraph breaks and ordinary prose's
|
|
64
|
+
// bare '<' (e.g. "ages < 8"), without relying on browser-only DOM APIs in workers.
|
|
65
|
+
const plain = text
|
|
66
|
+
.replace(/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi, "")
|
|
67
|
+
.replace(/<br\s*\/?\s*>/gi, "\n")
|
|
68
|
+
.replace(/<\/(?:p|div|h[1-6]|li)\s*>/gi, "\n\n")
|
|
69
|
+
.replace(/<\/?[a-z][^>]*>/gi, "")
|
|
70
|
+
.replace(/&(?:nbsp|amp|lt|gt|quot|apos|#39);/gi, (entity) => ({
|
|
71
|
+
" ": " ", "&": "&", "<": "<", ">": ">", """: '"', "'": "'", "'": "'",
|
|
72
|
+
})[entity.toLowerCase()] ?? entity)
|
|
73
|
+
.replace(/[\t\r ]+/g, " ")
|
|
74
|
+
.replace(/ *\n */g, "\n")
|
|
75
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
76
|
+
.trim();
|
|
77
|
+
return { bodyJson: "", bodyText: plain || fallback };
|
|
78
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// [rico] #3370 — a RichContent `on_link` tap reaches the worker as `{ url }` (the renderers merge the tapped
|
|
2
|
+
// link into the action's args). Only http(s) with a host, mailto and tel ever reach the OS; anything
|
|
3
|
+
// else is dropped here, before any dispatch. The renderers already refuse other schemes, but the action
|
|
4
|
+
// arrives here as plain data, so the worker checks it again rather than trusting whoever sent it.
|
|
5
|
+
import { open, defaultMode } from "@himalaya/open-url";
|
|
6
|
+
|
|
7
|
+
/** The viewer's link rule, verbatim (`LINK` in @himalaya/wix-rich-content's display.ts, which the package does
|
|
8
|
+
* not export); a parity test pins this copy to the original. */
|
|
9
|
+
const LINK = /^(https?:\/\/[^\s/?#]\S*|mailto:\S+|tel:\S+)$/i;
|
|
10
|
+
/** ASCII whitespace only, as the viewer trims a link before applying the rule. */
|
|
11
|
+
const trimAscii = (s: string): string => s.replace(/^[\t\n\v\f\r ]+|[\t\n\v\f\r ]+$/g, "");
|
|
12
|
+
|
|
13
|
+
/** The url of a link tap (`{ url }`, `{ args: { url } }` or a bare string), or "" when it is missing or
|
|
14
|
+
* not an http(s), mailto or tel link. */
|
|
15
|
+
export function richLinkUrl(arg: unknown): string {
|
|
16
|
+
const a = arg as { url?: unknown; args?: { url?: unknown } } | null | undefined;
|
|
17
|
+
const raw = typeof arg === "string" ? arg
|
|
18
|
+
: typeof a?.url === "string" ? a.url
|
|
19
|
+
: typeof a?.args?.url === "string" ? a.args.url : "";
|
|
20
|
+
const url = trimAscii(raw);
|
|
21
|
+
return LINK.test(url) ? url : "";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Opens a link tap through `capability.open_url` (http(s) in the in-app browser, mailto/tel in the system
|
|
25
|
+
* handler). False when the link is blocked, nothing took it, or the host threw. */
|
|
26
|
+
export async function openRichLink(arg: unknown): Promise<boolean> {
|
|
27
|
+
const url = richLinkUrl(arg);
|
|
28
|
+
if (!url) return false;
|
|
29
|
+
try {
|
|
30
|
+
return (await open(url, defaultMode(url))).opened;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// A sign-in sheet can be a form page rather than a drawer. `sheetStyle: "page"` keeps the iOS sheet
|
|
2
|
+
// and opens a full-screen modal on Android and web, whose sheet is a bottom drawer. A host older
|
|
3
|
+
// than the param ignores it and draws its own sheet.
|
|
4
|
+
//
|
|
5
|
+
// Opt-in per app: the app passes `signInSheetStyle: "page"` beside `signInPresentation`. These
|
|
6
|
+
// workers are shared (Salon & Spa runs them too), and an app that opens its other sign-ins as a
|
|
7
|
+
// plain sheet must not get a page from some of them and a drawer from the rest.
|
|
8
|
+
|
|
9
|
+
/** The app's `signInSheetStyle` param, read beside `signInPresentation`: "page", else "". */
|
|
10
|
+
export function signInPageStyle(value: unknown): "page" | "" {
|
|
11
|
+
return value === "page" ? "page" : "";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The nav args a sign-in opened with `presentation` adds: `sheetStyle` on a sheet the app asked
|
|
15
|
+
* to open as a page, else none. */
|
|
16
|
+
export function signInSheetStyle(presentation: string | undefined, style: "page" | ""): { sheetStyle?: "page" } {
|
|
17
|
+
return presentation === "sheet" && style === "page" ? { sheetStyle: "page" } : {};
|
|
18
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The video carousel's two looks: the caption ON the cover (a brand label chip over the
|
|
2
|
+
// image) or UNDER it. Every slide carries both placements; the descriptor's
|
|
3
|
+
// `videoCaption` appear param picks one, and these flags hide the other
|
|
4
|
+
// (`hiddenWhen` hides on TRUE). So a screen switches look by changing ONE param,
|
|
5
|
+
// with no second carousel and no change to the slide tree.
|
|
6
|
+
export type VideoCaption = "overlay" | "below";
|
|
7
|
+
|
|
8
|
+
/** The placement a param asks for. Anything but "below" is the default, "overlay". */
|
|
9
|
+
export function videoCaptionOf(value: unknown): VideoCaption {
|
|
10
|
+
return value === "below" ? "below" : "overlay";
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface CaptionFlags {
|
|
14
|
+
captionOnImage: boolean;
|
|
15
|
+
captionBelow: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Stamp each card with the gates its slide reads (`$item.captionOnImage` / `$item.captionBelow`). */
|
|
19
|
+
export function withCaption<T extends object>(cards: T[], caption: VideoCaption): (T & CaptionFlags)[] {
|
|
20
|
+
return cards.map((card) => ({ ...card, captionOnImage: caption === "overlay", captionBelow: caption === "below" }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// The weekly session goal (`provisioning.goals.weeklySessions`) over a member's own bookings —
|
|
2
|
+
// shared by the home weekly-goal Gauge (himi-branded-lite-home) and the My Bookings "This week"
|
|
3
|
+
// card (himi-booking-bookings), so the two can never count differently.
|
|
4
|
+
//
|
|
5
|
+
// WHAT COUNTS as a session toward the goal: a CONFIRMED booking whose start falls in the CURRENT
|
|
6
|
+
// calendar week (Monday 00:00 local → now) and is already in the past. An allow-list, not a
|
|
7
|
+
// deny-list: CREATED (checkout never completed), PENDING / PENDING_APPROVAL / PENDING_CHECKOUT,
|
|
8
|
+
// WAITING_LIST, CANCELED and DECLINED — and any status Wix adds later — do not count. That is
|
|
9
|
+
// "booked and it happened", not verified
|
|
10
|
+
// attendance: the member-scoped queryBookings row carries no attendance/check-in field (the Wix
|
|
11
|
+
// Attendance API is owner-scoped), so a no-show still counts. Future bookings this week do not
|
|
12
|
+
// count — they have not happened yet.
|
|
13
|
+
//
|
|
14
|
+
// DETERMINISM: nothing here runs at worker boot; every clock read is an argument. PURE (no network,
|
|
15
|
+
// no bridge) so the rules are unit-tested directly; the read lives with its caller.
|
|
16
|
+
|
|
17
|
+
import type { MemberBookingRow } from "./member-bookings.js";
|
|
18
|
+
import { copyParam, copyTemplate } from "./himi-copy.js";
|
|
19
|
+
|
|
20
|
+
export const MAX_WEEKLY_SESSION_GOAL = 21;
|
|
21
|
+
|
|
22
|
+
/** The one status that means the session was booked and held (as memberBookingRow normalizes
|
|
23
|
+
* it: upper-case, `_` → space). */
|
|
24
|
+
const COUNTS_AS_SESSION = /^CONFIRMED$/;
|
|
25
|
+
|
|
26
|
+
/** At most this many pages of past bookings are read for one week's count. */
|
|
27
|
+
export const MAX_WEEKLY_PAGES = 4;
|
|
28
|
+
|
|
29
|
+
/** The onAppear `weeklyGoal` param → a goal in [1, 21], or 0 = no goal provisioned. */
|
|
30
|
+
export function parseWeeklyGoal(raw: unknown): number {
|
|
31
|
+
const n = typeof raw === "number" ? raw : typeof raw === "string" && raw.trim() !== "" ? Number(raw) : NaN;
|
|
32
|
+
return Number.isInteger(n) && n >= 1 ? Math.min(n, MAX_WEEKLY_SESSION_GOAL) : 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Monday 00:00 local of `now`'s week, epoch ms. */
|
|
36
|
+
export function weekStartMs(now: number): number {
|
|
37
|
+
const d = new Date(now);
|
|
38
|
+
d.setHours(0, 0, 0, 0);
|
|
39
|
+
d.setDate(d.getDate() - ((d.getDay() + 6) % 7));
|
|
40
|
+
return d.getTime();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Sessions toward the goal among `rows` — see the file header for what counts. */
|
|
44
|
+
export function weeklySessionsDone(rows: readonly MemberBookingRow[], now: number): number {
|
|
45
|
+
const from = weekStartMs(now);
|
|
46
|
+
const seen = new Set<string>();
|
|
47
|
+
for (const row of rows) {
|
|
48
|
+
const start = Date.parse(row.start);
|
|
49
|
+
if (!Number.isFinite(start) || start < from || start >= now) continue;
|
|
50
|
+
if (!COUNTS_AS_SESSION.test((row.status || "").trim().toUpperCase())) continue;
|
|
51
|
+
seen.add(row.id || `${row.start}|${row.title}`);
|
|
52
|
+
}
|
|
53
|
+
return seen.size;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface BookingsPage {
|
|
57
|
+
items: MemberBookingRow[];
|
|
58
|
+
nextCursor?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Sessions toward the goal from PAST bookings read newest-first: `first` is the first page, and
|
|
62
|
+
* `next(cursor)` reads more only while the oldest row so far is still inside this week (a page of
|
|
63
|
+
* 50 almost always reaches back before Monday). Bounded to MAX_WEEKLY_PAGES reads; a failing
|
|
64
|
+
* read rejects, so the caller hides the count rather than under-counting. */
|
|
65
|
+
export async function weeklySessionsFromPages(
|
|
66
|
+
first: BookingsPage,
|
|
67
|
+
next: (cursor: string) => Promise<BookingsPage>,
|
|
68
|
+
now: number,
|
|
69
|
+
): Promise<number> {
|
|
70
|
+
const from = weekStartMs(now);
|
|
71
|
+
const rows = [...first.items];
|
|
72
|
+
let page = first;
|
|
73
|
+
for (let read = 1; read < MAX_WEEKLY_PAGES && page.nextCursor; read++) {
|
|
74
|
+
const oldest = page.items[page.items.length - 1];
|
|
75
|
+
if (oldest && Date.parse(oldest.start) < from) break;
|
|
76
|
+
page = await next(page.nextCursor);
|
|
77
|
+
rows.push(...page.items);
|
|
78
|
+
}
|
|
79
|
+
return weeklySessionsDone(rows, now);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface WeeklyGoalProgress {
|
|
83
|
+
done: number;
|
|
84
|
+
goal: number;
|
|
85
|
+
/** 0..1 — the Gauge / ProgressBar fill. */
|
|
86
|
+
fraction: number;
|
|
87
|
+
met: boolean;
|
|
88
|
+
/** "1 of 2 sessions this week" */
|
|
89
|
+
label: string;
|
|
90
|
+
/** "1 more to reach your weekly goal" / "Weekly goal reached. Great consistency." */
|
|
91
|
+
remainingLabel: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function weeklyGoalProgress(done: number, goal: number): WeeklyGoalProgress {
|
|
95
|
+
const safeGoal = Math.max(1, goal);
|
|
96
|
+
const met = done >= safeGoal;
|
|
97
|
+
return {
|
|
98
|
+
done,
|
|
99
|
+
goal: safeGoal,
|
|
100
|
+
fraction: Math.min(done / safeGoal, 1),
|
|
101
|
+
met,
|
|
102
|
+
label: copyTemplate("weeklyGoal.progress", "{done} of {goal} sessions this week", { done, goal: safeGoal }),
|
|
103
|
+
remainingLabel: met
|
|
104
|
+
? copyParam("weeklyGoal.met", "Weekly goal reached. Great consistency.")
|
|
105
|
+
: copyTemplate("weeklyGoal.remaining", "{count} more to reach your weekly goal", { count: safeGoal - done }),
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -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,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
|
+
}
|