@wix/himalaya-cli 0.1870.0 → 0.1872.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/app-module.d.ts +3 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/stdlib/wix-sdk/portfolio/src/index.d.ts +19 -0
- package/dist/cli.mjs +90 -39
- package/fixtures/wix-canned.json +8 -0
- package/guides/android-ux.md +3 -2
- package/guides/designing-himi-screens.md +10 -4
- package/guides/ios-ux.md +3 -2
- package/guides/release-notes.md +18 -0
- package/guides/sdk-reference.json +8 -1
- package/package.json +2 -2
- package/template-icons/professional-services.png +0 -0
- package/templates/bare-fashion/config.ts +37 -2
- package/templates/bare-fashion/dev/index.ts +4006 -48
- package/templates/bare-fashion/himalaya.content.json +15 -0
- package/templates/bare-fashion/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/bare-fashion/tier5-src/_shared/member-account-routes.ts +56 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +295 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-account-settings/index.ts +58 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-account-settings/login-info.ts +274 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-account-settings/personal-info.ts +881 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
- package/templates/bare-fashion/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/beauty-salon/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/branded-lite/dev/index.ts +22 -1
- package/templates/branded-lite/l10n/ar.json +10 -0
- package/templates/branded-lite/l10n/cs.json +10 -0
- package/templates/branded-lite/l10n/da.json +10 -0
- package/templates/branded-lite/l10n/de.json +10 -0
- package/templates/branded-lite/l10n/el.json +10 -0
- package/templates/branded-lite/l10n/es.json +10 -0
- package/templates/branded-lite/l10n/fi.json +10 -0
- package/templates/branded-lite/l10n/fr.json +10 -0
- package/templates/branded-lite/l10n/he.json +8 -0
- package/templates/branded-lite/l10n/hu.json +10 -0
- package/templates/branded-lite/l10n/id.json +10 -0
- package/templates/branded-lite/l10n/it.json +10 -0
- package/templates/branded-lite/l10n/ja.json +10 -0
- package/templates/branded-lite/l10n/ko.json +10 -0
- package/templates/branded-lite/l10n/lt.json +10 -0
- package/templates/branded-lite/l10n/nl.json +10 -0
- package/templates/branded-lite/l10n/no.json +10 -0
- package/templates/branded-lite/l10n/pl.json +10 -0
- package/templates/branded-lite/l10n/pt.json +10 -0
- package/templates/branded-lite/l10n/ru.json +10 -0
- package/templates/branded-lite/l10n/sv.json +10 -0
- package/templates/branded-lite/l10n/th.json +10 -0
- package/templates/branded-lite/l10n/tr.json +10 -0
- package/templates/branded-lite/l10n/uk.json +10 -0
- package/templates/branded-lite/l10n/vi.json +10 -0
- package/templates/branded-lite/l10n/zh.json +10 -0
- package/templates/branded-lite/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/branded-lite/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/branded-lite/tier5-src/_shared/portfolio-details.ts +70 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-coupons/index.ts +13 -2
- package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio/index.ts +90 -9
- package/templates/branded-lite/tier5-src/himi-branded-lite-portfolio-project/index.ts +53 -4
- package/templates/branded-lite/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/branded-lite/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/branded-lite/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/brandy/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/community-club/dev/index.ts +20 -0
- package/templates/community-club/l10n/ar.json +10 -0
- package/templates/community-club/l10n/cs.json +10 -0
- package/templates/community-club/l10n/da.json +10 -0
- package/templates/community-club/l10n/de.json +10 -0
- package/templates/community-club/l10n/el.json +10 -0
- package/templates/community-club/l10n/es.json +10 -0
- package/templates/community-club/l10n/fi.json +10 -0
- package/templates/community-club/l10n/fr.json +10 -0
- package/templates/community-club/l10n/he.json +8 -0
- package/templates/community-club/l10n/hu.json +10 -0
- package/templates/community-club/l10n/id.json +10 -0
- package/templates/community-club/l10n/it.json +10 -0
- package/templates/community-club/l10n/ja.json +10 -0
- package/templates/community-club/l10n/ko.json +10 -0
- package/templates/community-club/l10n/lt.json +10 -0
- package/templates/community-club/l10n/nl.json +10 -0
- package/templates/community-club/l10n/no.json +10 -0
- package/templates/community-club/l10n/pl.json +10 -0
- package/templates/community-club/l10n/pt.json +10 -0
- package/templates/community-club/l10n/ru.json +10 -0
- package/templates/community-club/l10n/sv.json +10 -0
- package/templates/community-club/l10n/th.json +10 -0
- package/templates/community-club/l10n/tr.json +10 -0
- package/templates/community-club/l10n/uk.json +10 -0
- package/templates/community-club/l10n/vi.json +10 -0
- package/templates/community-club/l10n/zh.json +10 -0
- package/templates/community-club/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/community-club/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/community-club/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/community-club/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/community-club/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/community-club-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/community-club-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/conference/config.ts +43 -1
- package/templates/conference/dev/index.ts +4147 -0
- package/templates/conference/himalaya.content.json +18 -0
- package/templates/conference/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/conference/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/conference/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +295 -0
- package/templates/conference/tier5-src/himi-branded-lite-account-settings/index.ts +58 -0
- package/templates/conference/tier5-src/himi-branded-lite-account-settings/login-info.ts +274 -0
- package/templates/conference/tier5-src/himi-branded-lite-account-settings/personal-info.ts +881 -0
- package/templates/conference/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
- package/templates/conference/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
- package/templates/conference/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/conference/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/conference/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/conference/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/events-meetups/dev/index.ts +20 -0
- package/templates/events-meetups/l10n/ar.json +10 -0
- package/templates/events-meetups/l10n/cs.json +10 -0
- package/templates/events-meetups/l10n/da.json +10 -0
- package/templates/events-meetups/l10n/de.json +10 -0
- package/templates/events-meetups/l10n/el.json +10 -0
- package/templates/events-meetups/l10n/es.json +10 -0
- package/templates/events-meetups/l10n/fi.json +10 -0
- package/templates/events-meetups/l10n/fr.json +10 -0
- package/templates/events-meetups/l10n/he.json +8 -0
- package/templates/events-meetups/l10n/hu.json +10 -0
- package/templates/events-meetups/l10n/id.json +10 -0
- package/templates/events-meetups/l10n/it.json +10 -0
- package/templates/events-meetups/l10n/ja.json +10 -0
- package/templates/events-meetups/l10n/ko.json +10 -0
- package/templates/events-meetups/l10n/lt.json +10 -0
- package/templates/events-meetups/l10n/nl.json +10 -0
- package/templates/events-meetups/l10n/no.json +10 -0
- package/templates/events-meetups/l10n/pl.json +10 -0
- package/templates/events-meetups/l10n/pt.json +10 -0
- package/templates/events-meetups/l10n/ru.json +10 -0
- package/templates/events-meetups/l10n/sv.json +10 -0
- package/templates/events-meetups/l10n/th.json +10 -0
- package/templates/events-meetups/l10n/tr.json +10 -0
- package/templates/events-meetups/l10n/uk.json +10 -0
- package/templates/events-meetups/l10n/vi.json +10 -0
- package/templates/events-meetups/l10n/zh.json +10 -0
- package/templates/events-meetups/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/events-meetups/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/events-meetups/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/events-meetups/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/events-meetups/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/events-meetups-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/events-meetups-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/fitness-gym/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/gym-fitness/dev/index.ts +20 -0
- package/templates/gym-fitness/l10n/ar.json +10 -0
- package/templates/gym-fitness/l10n/cs.json +10 -0
- package/templates/gym-fitness/l10n/da.json +10 -0
- package/templates/gym-fitness/l10n/de.json +10 -0
- package/templates/gym-fitness/l10n/el.json +10 -0
- package/templates/gym-fitness/l10n/es.json +10 -0
- package/templates/gym-fitness/l10n/fi.json +10 -0
- package/templates/gym-fitness/l10n/fr.json +10 -0
- package/templates/gym-fitness/l10n/he.json +8 -0
- package/templates/gym-fitness/l10n/hu.json +10 -0
- package/templates/gym-fitness/l10n/id.json +10 -0
- package/templates/gym-fitness/l10n/it.json +10 -0
- package/templates/gym-fitness/l10n/ja.json +10 -0
- package/templates/gym-fitness/l10n/ko.json +10 -0
- package/templates/gym-fitness/l10n/lt.json +10 -0
- package/templates/gym-fitness/l10n/nl.json +10 -0
- package/templates/gym-fitness/l10n/no.json +10 -0
- package/templates/gym-fitness/l10n/pl.json +10 -0
- package/templates/gym-fitness/l10n/pt.json +10 -0
- package/templates/gym-fitness/l10n/ru.json +10 -0
- package/templates/gym-fitness/l10n/sv.json +10 -0
- package/templates/gym-fitness/l10n/th.json +10 -0
- package/templates/gym-fitness/l10n/tr.json +10 -0
- package/templates/gym-fitness/l10n/uk.json +10 -0
- package/templates/gym-fitness/l10n/vi.json +10 -0
- package/templates/gym-fitness/l10n/zh.json +10 -0
- package/templates/gym-fitness/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/gym-fitness/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/gym-fitness/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/gym-fitness/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/gym-fitness/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/medical-services/config.ts +42 -0
- package/templates/medical-services/dev/index.ts +4136 -0
- package/templates/medical-services/himalaya.content.json +18 -0
- package/templates/medical-services/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/medical-services/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +295 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-account-settings/index.ts +58 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-account-settings/login-info.ts +274 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-account-settings/personal-info.ts +881 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
- package/templates/medical-services/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
- package/templates/medical-services/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/nonprofit-cause/dev/index.ts +20 -0
- package/templates/nonprofit-cause/l10n/ar.json +10 -0
- package/templates/nonprofit-cause/l10n/cs.json +10 -0
- package/templates/nonprofit-cause/l10n/da.json +10 -0
- package/templates/nonprofit-cause/l10n/de.json +10 -0
- package/templates/nonprofit-cause/l10n/el.json +10 -0
- package/templates/nonprofit-cause/l10n/es.json +10 -0
- package/templates/nonprofit-cause/l10n/fi.json +10 -0
- package/templates/nonprofit-cause/l10n/fr.json +10 -0
- package/templates/nonprofit-cause/l10n/he.json +8 -0
- package/templates/nonprofit-cause/l10n/hu.json +10 -0
- package/templates/nonprofit-cause/l10n/id.json +10 -0
- package/templates/nonprofit-cause/l10n/it.json +10 -0
- package/templates/nonprofit-cause/l10n/ja.json +10 -0
- package/templates/nonprofit-cause/l10n/ko.json +10 -0
- package/templates/nonprofit-cause/l10n/lt.json +10 -0
- package/templates/nonprofit-cause/l10n/nl.json +10 -0
- package/templates/nonprofit-cause/l10n/no.json +10 -0
- package/templates/nonprofit-cause/l10n/pl.json +10 -0
- package/templates/nonprofit-cause/l10n/pt.json +10 -0
- package/templates/nonprofit-cause/l10n/ru.json +10 -0
- package/templates/nonprofit-cause/l10n/sv.json +10 -0
- package/templates/nonprofit-cause/l10n/th.json +10 -0
- package/templates/nonprofit-cause/l10n/tr.json +10 -0
- package/templates/nonprofit-cause/l10n/uk.json +10 -0
- package/templates/nonprofit-cause/l10n/vi.json +10 -0
- package/templates/nonprofit-cause/l10n/zh.json +10 -0
- package/templates/nonprofit-cause/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/nonprofit-cause/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/nonprofit-cause/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/nonprofit-cause/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/nonprofit-cause/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/owner-lite/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/owner-lite/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/podcast-creator/dev/index.ts +20 -0
- package/templates/podcast-creator/l10n/ar.json +10 -0
- package/templates/podcast-creator/l10n/cs.json +10 -0
- package/templates/podcast-creator/l10n/da.json +10 -0
- package/templates/podcast-creator/l10n/de.json +10 -0
- package/templates/podcast-creator/l10n/el.json +10 -0
- package/templates/podcast-creator/l10n/es.json +10 -0
- package/templates/podcast-creator/l10n/fi.json +10 -0
- package/templates/podcast-creator/l10n/fr.json +10 -0
- package/templates/podcast-creator/l10n/he.json +8 -0
- package/templates/podcast-creator/l10n/hu.json +10 -0
- package/templates/podcast-creator/l10n/id.json +10 -0
- package/templates/podcast-creator/l10n/it.json +10 -0
- package/templates/podcast-creator/l10n/ja.json +10 -0
- package/templates/podcast-creator/l10n/ko.json +10 -0
- package/templates/podcast-creator/l10n/lt.json +10 -0
- package/templates/podcast-creator/l10n/nl.json +10 -0
- package/templates/podcast-creator/l10n/no.json +10 -0
- package/templates/podcast-creator/l10n/pl.json +10 -0
- package/templates/podcast-creator/l10n/pt.json +10 -0
- package/templates/podcast-creator/l10n/ru.json +10 -0
- package/templates/podcast-creator/l10n/sv.json +10 -0
- package/templates/podcast-creator/l10n/th.json +10 -0
- package/templates/podcast-creator/l10n/tr.json +10 -0
- package/templates/podcast-creator/l10n/uk.json +10 -0
- package/templates/podcast-creator/l10n/vi.json +10 -0
- package/templates/podcast-creator/l10n/zh.json +10 -0
- package/templates/podcast-creator/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/podcast-creator/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/podcast-creator/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/podcast-creator/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/podcast-creator/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/portfolio-creative/dev/index.ts +22 -1
- package/templates/portfolio-creative/l10n/ar.json +10 -0
- package/templates/portfolio-creative/l10n/cs.json +10 -0
- package/templates/portfolio-creative/l10n/da.json +10 -0
- package/templates/portfolio-creative/l10n/de.json +10 -0
- package/templates/portfolio-creative/l10n/el.json +10 -0
- package/templates/portfolio-creative/l10n/es.json +10 -0
- package/templates/portfolio-creative/l10n/fi.json +10 -0
- package/templates/portfolio-creative/l10n/fr.json +10 -0
- package/templates/portfolio-creative/l10n/he.json +8 -0
- package/templates/portfolio-creative/l10n/hu.json +10 -0
- package/templates/portfolio-creative/l10n/id.json +10 -0
- package/templates/portfolio-creative/l10n/it.json +10 -0
- package/templates/portfolio-creative/l10n/ja.json +10 -0
- package/templates/portfolio-creative/l10n/ko.json +10 -0
- package/templates/portfolio-creative/l10n/lt.json +10 -0
- package/templates/portfolio-creative/l10n/nl.json +10 -0
- package/templates/portfolio-creative/l10n/no.json +10 -0
- package/templates/portfolio-creative/l10n/pl.json +10 -0
- package/templates/portfolio-creative/l10n/pt.json +10 -0
- package/templates/portfolio-creative/l10n/ru.json +10 -0
- package/templates/portfolio-creative/l10n/sv.json +10 -0
- package/templates/portfolio-creative/l10n/th.json +10 -0
- package/templates/portfolio-creative/l10n/tr.json +10 -0
- package/templates/portfolio-creative/l10n/uk.json +10 -0
- package/templates/portfolio-creative/l10n/vi.json +10 -0
- package/templates/portfolio-creative/l10n/zh.json +10 -0
- package/templates/portfolio-creative/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/portfolio-creative/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/portfolio-creative/tier5-src/_shared/portfolio-details.ts +70 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio/index.ts +90 -9
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-portfolio-project/index.ts +53 -4
- package/templates/portfolio-creative/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/portfolio-creative/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/portfolio-creative/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/professional-services/README.md +55 -0
- package/templates/professional-services/config.ts +436 -0
- package/templates/professional-services/dev/index.ts +44772 -0
- package/templates/professional-services/himalaya.content.json +100 -0
- package/templates/professional-services/himalaya.template.json +16 -0
- package/templates/professional-services/icon.png +0 -0
- package/templates/professional-services/platforms.json +1 -0
- package/templates/professional-services/tier5-src/_shared/app-locale.ts +70 -0
- package/templates/professional-services/tier5-src/_shared/booking-location.ts +147 -0
- package/templates/professional-services/tier5-src/_shared/booking-session.ts +224 -0
- package/templates/professional-services/tier5-src/_shared/branded-lite-hosted.ts +282 -0
- package/templates/professional-services/tier5-src/_shared/branded-load-state.ts +109 -0
- package/templates/professional-services/tier5-src/_shared/business-chat-copy.ts +40 -0
- package/templates/professional-services/tier5-src/_shared/business-chat-history.ts +51 -0
- package/templates/professional-services/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/professional-services/tier5-src/_shared/business-chat-model.ts +56 -0
- package/templates/professional-services/tier5-src/_shared/business-chat-presenter.ts +587 -0
- package/templates/professional-services/tier5-src/_shared/business-chat-transport.ts +164 -0
- package/templates/professional-services/tier5-src/_shared/chat-live.ts +242 -0
- package/templates/professional-services/tier5-src/_shared/collection-contract.ts +232 -0
- package/templates/professional-services/tier5-src/_shared/collection-query.ts +201 -0
- package/templates/professional-services/tier5-src/_shared/collection-service.ts +429 -0
- package/templates/professional-services/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/professional-services/tier5-src/_shared/engine-intl.ts +538 -0
- package/templates/professional-services/tier5-src/_shared/event-registration.ts +86 -0
- package/templates/professional-services/tier5-src/_shared/events-inline-options.ts +77 -0
- package/templates/professional-services/tier5-src/_shared/faq-list.ts +405 -0
- package/templates/professional-services/tier5-src/_shared/featured-event.ts +63 -0
- package/templates/professional-services/tier5-src/_shared/group-member-count.ts +15 -0
- package/templates/professional-services/tier5-src/_shared/group-privacy.ts +14 -0
- package/templates/professional-services/tier5-src/_shared/guest-sign-in.ts +36 -0
- package/templates/professional-services/tier5-src/_shared/himi-account.ts +222 -0
- package/templates/professional-services/tier5-src/_shared/himi-blog-hidden.ts +66 -0
- package/templates/professional-services/tier5-src/_shared/himi-blog-post-row.ts +214 -0
- package/templates/professional-services/tier5-src/_shared/himi-blog-saved.ts +64 -0
- package/templates/professional-services/tier5-src/_shared/himi-booking-saved.ts +88 -0
- package/templates/professional-services/tier5-src/_shared/himi-bookings.ts +318 -0
- package/templates/professional-services/tier5-src/_shared/himi-copy.ts +123 -0
- package/templates/professional-services/tier5-src/_shared/himi-events.ts +92 -0
- package/templates/professional-services/tier5-src/_shared/himi-media.ts +33 -0
- package/templates/professional-services/tier5-src/_shared/himi-store.ts +7 -0
- package/templates/professional-services/tier5-src/_shared/himi-text.ts +24 -0
- package/templates/professional-services/tier5-src/_shared/host-events.ts +66 -0
- package/templates/professional-services/tier5-src/_shared/hosted-checkout.ts +70 -0
- package/templates/professional-services/tier5-src/_shared/iap-attendance-form.ts +106 -0
- package/templates/professional-services/tier5-src/_shared/iap-attendance-purchase.ts +235 -0
- package/templates/professional-services/tier5-src/_shared/iap-attendance.ts +38 -0
- package/templates/professional-services/tier5-src/_shared/iap-worker.ts +127 -0
- package/templates/professional-services/tier5-src/_shared/inbox-rooms.ts +163 -0
- package/templates/professional-services/tier5-src/_shared/local-preferences.ts +38 -0
- package/templates/professional-services/tier5-src/_shared/member-access.ts +63 -0
- package/templates/professional-services/tier5-src/_shared/member-account-routes.ts +56 -0
- package/templates/professional-services/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/professional-services/tier5-src/_shared/member-bookings.ts +107 -0
- package/templates/professional-services/tier5-src/_shared/member-read.ts +82 -0
- package/templates/professional-services/tier5-src/_shared/member-screen.ts +99 -0
- package/templates/professional-services/tier5-src/_shared/notification-target.ts +141 -0
- package/templates/professional-services/tier5-src/_shared/offset-page.ts +10 -0
- package/templates/professional-services/tier5-src/_shared/online-actions.ts +76 -0
- package/templates/professional-services/tier5-src/_shared/owner-load-error.ts +348 -0
- package/templates/professional-services/tier5-src/_shared/payment-setup.ts +6 -0
- package/templates/professional-services/tier5-src/_shared/portfolio-details.ts +70 -0
- package/templates/professional-services/tier5-src/_shared/pricing-plan-display.ts +64 -0
- package/templates/professional-services/tier5-src/_shared/relative-time.ts +21 -0
- package/templates/professional-services/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/professional-services/tier5-src/_shared/rich-body.ts +78 -0
- package/templates/professional-services/tier5-src/_shared/rich-content-link.ts +34 -0
- package/templates/professional-services/tier5-src/_shared/sign-in-sheet.ts +18 -0
- package/templates/professional-services/tier5-src/_shared/staff-name.ts +18 -0
- package/templates/professional-services/tier5-src/_shared/weekly-goal.ts +111 -0
- package/templates/professional-services/tier5-src/_shared/wix-bi.ts +85 -0
- package/templates/professional-services/tier5-src/_shared/wix-member-links.ts +114 -0
- package/templates/professional-services/tier5-src/_shared/wix-service-price.ts +146 -0
- package/templates/professional-services/tier5-src/business-chat/index.ts +797 -0
- package/templates/professional-services/tier5-src/business-contact/index.ts +6 -0
- package/templates/professional-services/tier5-src/himi-blog-feed/index.ts +444 -0
- package/templates/professional-services/tier5-src/himi-blog-post/index.ts +1239 -0
- package/templates/professional-services/tier5-src/himi-booking-account/index.ts +278 -0
- package/templates/professional-services/tier5-src/himi-booking-bookings/index.ts +475 -0
- package/templates/professional-services/tier5-src/himi-booking-service/index.ts +1197 -0
- package/templates/professional-services/tier5-src/himi-booking-services/index.ts +795 -0
- package/templates/professional-services/tier5-src/himi-booking-time/index.ts +1840 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-coupons/index.ts +96 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-faq/index.ts +6 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-file-share/index.ts +12 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-group/index.ts +310 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-group-about/index.ts +240 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-my-groups/index.ts +237 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-notifications/index.ts +263 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-plans/index.ts +498 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-portfolio/index.ts +136 -0
- package/templates/professional-services/tier5-src/himi-branded-lite-portfolio-project/index.ts +198 -0
- package/templates/professional-services/tier5-src/himi-events-detail/index.ts +1306 -0
- package/templates/professional-services/tier5-src/himi-events-list/index.ts +171 -0
- package/templates/professional-services/tier5-src/himi-events-my-events/index.ts +227 -0
- package/templates/professional-services/tier5-src/himi-events-rsvp/index.ts +230 -0
- package/templates/professional-services/tier5-src/himi-professional-services-community/index.ts +318 -0
- package/templates/professional-services/tier5-src/himi-professional-services-home/index.ts +772 -0
- package/templates/professional-services/tier5-src/himi-store-account/index.ts +1514 -0
- package/templates/professional-services/tier5-src/wix-spaces-coupon-detail/index.ts +43 -0
- package/templates/professional-services/tier5-src/wix-spaces-my-subscriptions/index.ts +89 -0
- package/templates/professional-services/tier5-src/wix-spaces-subscription-detail/index.ts +139 -0
- package/templates/professional-services/tokens.json +456 -0
- package/templates/restaurant/dev/index.ts +20 -0
- package/templates/restaurant/l10n/ar.json +10 -0
- package/templates/restaurant/l10n/cs.json +10 -0
- package/templates/restaurant/l10n/da.json +10 -0
- package/templates/restaurant/l10n/de.json +10 -0
- package/templates/restaurant/l10n/el.json +10 -0
- package/templates/restaurant/l10n/es.json +10 -0
- package/templates/restaurant/l10n/fi.json +10 -0
- package/templates/restaurant/l10n/fr.json +10 -0
- package/templates/restaurant/l10n/he.json +8 -0
- package/templates/restaurant/l10n/hu.json +10 -0
- package/templates/restaurant/l10n/id.json +10 -0
- package/templates/restaurant/l10n/it.json +10 -0
- package/templates/restaurant/l10n/ja.json +10 -0
- package/templates/restaurant/l10n/ko.json +10 -0
- package/templates/restaurant/l10n/lt.json +10 -0
- package/templates/restaurant/l10n/nl.json +10 -0
- package/templates/restaurant/l10n/no.json +10 -0
- package/templates/restaurant/l10n/pl.json +10 -0
- package/templates/restaurant/l10n/pt.json +10 -0
- package/templates/restaurant/l10n/ru.json +10 -0
- package/templates/restaurant/l10n/sv.json +10 -0
- package/templates/restaurant/l10n/th.json +10 -0
- package/templates/restaurant/l10n/tr.json +10 -0
- package/templates/restaurant/l10n/uk.json +10 -0
- package/templates/restaurant/l10n/vi.json +10 -0
- package/templates/restaurant/l10n/zh.json +10 -0
- package/templates/restaurant/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/restaurant/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/restaurant/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/restaurant/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/restaurant/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/restaurant-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/restaurant-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/retail-store/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/retail-store/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/retail-store-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/retail-store-owner/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/salon-spa/config.ts +42 -0
- package/templates/salon-spa/dev/index.ts +4136 -0
- package/templates/salon-spa/himalaya.content.json +18 -0
- package/templates/salon-spa/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/salon-spa/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +295 -0
- package/templates/salon-spa/tier5-src/himi-branded-lite-account-settings/index.ts +58 -0
- package/templates/salon-spa/tier5-src/himi-branded-lite-account-settings/login-info.ts +274 -0
- package/templates/salon-spa/tier5-src/himi-branded-lite-account-settings/personal-info.ts +881 -0
- package/templates/salon-spa/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
- package/templates/salon-spa/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
- package/templates/salon-spa/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/wholesale-store/config.ts +43 -1
- package/templates/wholesale-store/dev/index.ts +4136 -0
- package/templates/wholesale-store/himalaya.content.json +18 -0
- package/templates/wholesale-store/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/wholesale-store/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +295 -0
- package/templates/wholesale-store/tier5-src/himi-branded-lite-account-settings/index.ts +58 -0
- package/templates/wholesale-store/tier5-src/himi-branded-lite-account-settings/login-info.ts +274 -0
- package/templates/wholesale-store/tier5-src/himi-branded-lite-account-settings/personal-info.ts +881 -0
- package/templates/wholesale-store/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
- package/templates/wholesale-store/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
- package/templates/wholesale-store/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/yoga-studio/dev/index.ts +20 -0
- package/templates/yoga-studio/l10n/ar.json +10 -0
- package/templates/yoga-studio/l10n/cs.json +10 -0
- package/templates/yoga-studio/l10n/da.json +10 -0
- package/templates/yoga-studio/l10n/de.json +10 -0
- package/templates/yoga-studio/l10n/el.json +10 -0
- package/templates/yoga-studio/l10n/es.json +10 -0
- package/templates/yoga-studio/l10n/fi.json +10 -0
- package/templates/yoga-studio/l10n/fr.json +10 -0
- package/templates/yoga-studio/l10n/he.json +8 -0
- package/templates/yoga-studio/l10n/hu.json +10 -0
- package/templates/yoga-studio/l10n/id.json +10 -0
- package/templates/yoga-studio/l10n/it.json +10 -0
- package/templates/yoga-studio/l10n/ja.json +10 -0
- package/templates/yoga-studio/l10n/ko.json +10 -0
- package/templates/yoga-studio/l10n/lt.json +10 -0
- package/templates/yoga-studio/l10n/nl.json +10 -0
- package/templates/yoga-studio/l10n/no.json +10 -0
- package/templates/yoga-studio/l10n/pl.json +10 -0
- package/templates/yoga-studio/l10n/pt.json +10 -0
- package/templates/yoga-studio/l10n/ru.json +10 -0
- package/templates/yoga-studio/l10n/sv.json +10 -0
- package/templates/yoga-studio/l10n/th.json +10 -0
- package/templates/yoga-studio/l10n/tr.json +10 -0
- package/templates/yoga-studio/l10n/uk.json +10 -0
- package/templates/yoga-studio/l10n/vi.json +10 -0
- package/templates/yoga-studio/l10n/zh.json +10 -0
- package/templates/yoga-studio/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/yoga-studio/tier5-src/_shared/himi-events.ts +27 -0
- package/templates/yoga-studio/tier5-src/himi-events-detail/index.ts +3 -1
- package/templates/yoga-studio/tier5-src/himi-events-list/index.ts +38 -8
- package/templates/yoga-studio/tier5-src/himi-events-my-events/index.ts +4 -2
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-contract.ts +6 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/himi-events.ts +27 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
2
|
+
import { planDuration } from "../_shared/pricing-plan-display.js";
|
|
3
|
+
import { detailInputId } from "../_shared/detail-presence.js";
|
|
4
|
+
import { descriptionBody } from "../_shared/rich-body.js";
|
|
5
|
+
import { paymentSetupMessage } from "../_shared/payment-setup.js";
|
|
6
|
+
import { offlineWriteMessage, offlineWritesEnabled, withOnlineWrites } from "../_shared/online-actions.js";
|
|
7
|
+
import { connectivity } from "@himalaya/state";
|
|
8
|
+
import { defineService as registerService } from "../_shared/collection-service.js";
|
|
9
|
+
import { createOnlineOrder, listPublicPlans, type WixPlan } from "@himalaya/wix-pricing-plans";
|
|
10
|
+
import { createRedirectSession } from "@himalaya/wix-redirects";
|
|
11
|
+
import { open as openUrl } from "@himalaya/open-url";
|
|
12
|
+
import { session as wixPlatformSession } from "@himalaya/wix-platform";
|
|
13
|
+
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
14
|
+
import { activePlanIds, entitlement, isPaymentSetupFailure, payCashierOrder } from "@himalaya/checkout";
|
|
15
|
+
import { hostSessionFromGlobal, iapPriceFields, type IapCatalogItem } from "@himalaya/iap";
|
|
16
|
+
import { applePlanPeriod, createIapCommerce, isAppleSellablePlan, pricingPlanOrders } from "@himalaya/iap-checkout";
|
|
17
|
+
import { iapPriceCopy, iapPurchaseCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
|
|
18
|
+
import { formatCurrency } from "../_shared/engine-intl.js";
|
|
19
|
+
import { isHostedWorker, hostedSitePageOpener } from "../_shared/hosted-checkout.js";
|
|
20
|
+
|
|
21
|
+
/** Wix Pricing Plans appDefId — the vertical that owns a plan order, so the `appId` its
|
|
22
|
+
* cashier order is paid under (mirrors AppDefId.PRICING_PLANS in Wix's RN apps). */
|
|
23
|
+
const WIX_PRICING_PLANS_APP_ID = "1522827f-c56c-a5c9-2ac9-00f9e6ae12d3";
|
|
24
|
+
|
|
25
|
+
/** metaSiteId for the cashier payment config; "" is tolerated (the native cashier can
|
|
26
|
+
* resolve it from the app's signed Wix session). */
|
|
27
|
+
async function resolveMsid(): Promise<string> {
|
|
28
|
+
try {
|
|
29
|
+
const st = await wixPlatformSession.signedInstanceStatus();
|
|
30
|
+
return st.msid ?? "";
|
|
31
|
+
} catch {
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface PlanRow {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
/** Plan description (owner-authored pitch) — collapses when absent. */
|
|
40
|
+
description: string;
|
|
41
|
+
/** "N-day free trial" badge from pricing.freeTrialDays — collapses at 0. */
|
|
42
|
+
trialBadge: string;
|
|
43
|
+
noTrialBadge: boolean;
|
|
44
|
+
/** Formatted price, e.g. "$29". */
|
|
45
|
+
priceLine: string;
|
|
46
|
+
/** Cadence / validity line, e.g. "per month" / "one-time". */
|
|
47
|
+
periodLine: string;
|
|
48
|
+
/** First 3 benefit strings (also flattened below for `$item.` bindings). */
|
|
49
|
+
perks: string[];
|
|
50
|
+
benefitRows: Array<{ id: string; text: string }>;
|
|
51
|
+
expanded: boolean; benefitsCollapsed: boolean; benefitsState: string;
|
|
52
|
+
validity: string;
|
|
53
|
+
terms: string;
|
|
54
|
+
noTerms: boolean;
|
|
55
|
+
noBenefits: boolean;
|
|
56
|
+
perk1: string;
|
|
57
|
+
perk2: string;
|
|
58
|
+
perk3: string;
|
|
59
|
+
/** "Popular" for the site's primary plan; "" otherwise. */
|
|
60
|
+
badge: string;
|
|
61
|
+
noBadge: boolean;
|
|
62
|
+
/** Inverse of noBadge — primary Join weight only on the recommended plan. */
|
|
63
|
+
hasBadge: boolean;
|
|
64
|
+
/** Purchasable URL when the plan data carries one; "" otherwise. */
|
|
65
|
+
joinUrl: string;
|
|
66
|
+
/** No price (or a zero price): an online order activates it at once, with nothing to pay. */
|
|
67
|
+
free: boolean;
|
|
68
|
+
joined: boolean;
|
|
69
|
+
appleSupported: boolean;
|
|
70
|
+
/** The App Store period Apple must renew it at ("" for a one-time plan): offered only on a matching price. */
|
|
71
|
+
applePeriod: string;
|
|
72
|
+
joinLabel: string;
|
|
73
|
+
joinDisabled: boolean;
|
|
74
|
+
/** An App Store sale of this plan is under way: Join shows its spinner. */
|
|
75
|
+
joinBusy: boolean;
|
|
76
|
+
joinNote: string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface State {
|
|
80
|
+
status: "loading" | "ready" | "error";
|
|
81
|
+
rows: PlanRow[];
|
|
82
|
+
emptyText: string;
|
|
83
|
+
actionMessage: string;
|
|
84
|
+
hideActionNotice: boolean;
|
|
85
|
+
hideOfflineError: boolean;
|
|
86
|
+
isLoading: boolean;
|
|
87
|
+
notLoading: boolean;
|
|
88
|
+
isErrored: boolean;
|
|
89
|
+
notErrored: boolean;
|
|
90
|
+
hasRows: boolean;
|
|
91
|
+
noRows: boolean;
|
|
92
|
+
noEmpty: boolean;
|
|
93
|
+
detail: PlanRow;
|
|
94
|
+
hideDetail: boolean;
|
|
95
|
+
hideDetailNotFound: boolean;
|
|
96
|
+
paymentUnavailable: boolean;
|
|
97
|
+
paymentAvailable: boolean;
|
|
98
|
+
needsSignIn: boolean;
|
|
99
|
+
noSignIn: boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function money(plan: WixPlan): string {
|
|
103
|
+
const price = plan.pricing?.price;
|
|
104
|
+
const raw = price?.value;
|
|
105
|
+
if (raw == null || raw === "" || Number.isNaN(Number(raw))) return "";
|
|
106
|
+
try {
|
|
107
|
+
return price?.currency ? formatCurrency(Number(raw), price.currency) : raw;
|
|
108
|
+
} catch {
|
|
109
|
+
return `${raw}`;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function cycleText(count?: number, unit?: string): string {
|
|
114
|
+
const n = count ?? 0;
|
|
115
|
+
const u = (unit || "").toLowerCase();
|
|
116
|
+
if (!n || !u) return "";
|
|
117
|
+
const noun = u.endsWith("s") ? u.slice(0, -1) : u;
|
|
118
|
+
return n === 1 ? `per ${noun}` : `every ${n} ${noun}s`;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function period(plan: WixPlan): string {
|
|
122
|
+
const pricing = plan.pricing;
|
|
123
|
+
if (pricing?.subscription?.cycleDuration) {
|
|
124
|
+
const { count, unit } = pricing.subscription.cycleDuration;
|
|
125
|
+
return cycleText(count, unit) || copyParam("plans.periodRecurring", "recurring");
|
|
126
|
+
}
|
|
127
|
+
if (pricing?.singlePaymentForDuration) return copyParam("plans.periodOneTime", "One-time payment");
|
|
128
|
+
if (pricing?.singlePaymentUnlimited) return copyParam("plans.periodOneTime", "One-time payment");
|
|
129
|
+
return "";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** A purchasable URL when the plan payload carries one (none of the documented
|
|
133
|
+
* fields is one today — raw payloads are probed defensively so a future field
|
|
134
|
+
* lights up open_url without a worker change). */
|
|
135
|
+
function joinUrl(plan: WixPlan): string {
|
|
136
|
+
const raw = plan as unknown as Record<string, unknown>;
|
|
137
|
+
for (const key of ["purchaseUrl", "checkoutUrl", "url"]) {
|
|
138
|
+
const value = raw[key];
|
|
139
|
+
if (typeof value === "string" && /^https?:\/\//i.test(value)) return value;
|
|
140
|
+
}
|
|
141
|
+
return "";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function isFreePlan(plan: WixPlan): boolean {
|
|
145
|
+
const raw = plan.pricing?.price?.value;
|
|
146
|
+
return raw !== undefined && raw !== "" && Number(raw) === 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Apple sells the plan only on the terms it bills: a recurring plan as a renewing App Store price. Only a
|
|
150
|
+
* settled price says whether it renews; while one reloads, the purchase fields keep the last route. */
|
|
151
|
+
function appleOffered(row: PlanRow, view: { route: string; renews?: true; subscriptionPeriod?: string }): boolean {
|
|
152
|
+
return row.appleSupported && (view.route !== "appleIap" || row.applePeriod === (view.renews ? view.subscriptionPeriod ?? "" : ""));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function planRow(plan: WixPlan): PlanRow {
|
|
156
|
+
const name = (plan.name || copyParam("plans.planFallbackName", "Plan")).trim();
|
|
157
|
+
const perks = (plan.perks?.values ?? [])
|
|
158
|
+
.map((perk) => (perk ?? "").trim())
|
|
159
|
+
.filter(Boolean);
|
|
160
|
+
const badge = plan.primary ? copyParam("plans.popularBadge", "Popular") : "";
|
|
161
|
+
const trialDays = plan.pricing?.freeTrialDays ?? 0;
|
|
162
|
+
const trialBadge = trialDays > 0 ? copyTemplate("plans.trialBadge", "{days}-day free trial", { days: trialDays }) : "";
|
|
163
|
+
return {
|
|
164
|
+
id: plan.id || "",
|
|
165
|
+
name,
|
|
166
|
+
description: descriptionBody(plan.description).bodyText,
|
|
167
|
+
trialBadge,
|
|
168
|
+
noTrialBadge: !trialBadge,
|
|
169
|
+
priceLine: money(plan),
|
|
170
|
+
periodLine: period(plan),
|
|
171
|
+
perks,
|
|
172
|
+
benefitRows: perks.map((text, index) => ({ id: `${plan.id}.benefit.${index}`, text })),
|
|
173
|
+
noBenefits: perks.length === 0,
|
|
174
|
+
expanded: false, benefitsCollapsed: true, benefitsState: "collapsed",
|
|
175
|
+
validity: planDuration(plan.pricing),
|
|
176
|
+
terms: (plan as WixPlan & { termsAndConditions?: string }).termsAndConditions ?? "",
|
|
177
|
+
noTerms: !(plan as WixPlan & { termsAndConditions?: string }).termsAndConditions,
|
|
178
|
+
perk1: perks[0] ?? "",
|
|
179
|
+
perk2: perks[1] ?? "",
|
|
180
|
+
perk3: perks[2] ?? "",
|
|
181
|
+
badge,
|
|
182
|
+
noBadge: !badge,
|
|
183
|
+
hasBadge: !!badge,
|
|
184
|
+
joinUrl: joinUrl(plan),
|
|
185
|
+
free: isFreePlan(plan),
|
|
186
|
+
appleSupported: isAppleSellablePlan(plan.pricing),
|
|
187
|
+
applePeriod: applePlanPeriod(plan.pricing),
|
|
188
|
+
joined: false, joinLabel: copyParam("plans.joinCta", "Continue"), joinDisabled: true, joinBusy: false, joinNote: "",
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function ready(rows: PlanRow[], actionMessage = ""): State {
|
|
193
|
+
return {
|
|
194
|
+
status: "ready",
|
|
195
|
+
rows,
|
|
196
|
+
emptyText: rows.length ? "" : copyParam("plans.emptyText", "No membership plans are published yet."),
|
|
197
|
+
actionMessage,
|
|
198
|
+
hideActionNotice: !actionMessage || actionMessage === offlineWriteMessage || actionMessage === paymentSetupMessage("plans"),
|
|
199
|
+
hideOfflineError: actionMessage !== offlineWriteMessage,
|
|
200
|
+
isLoading: false,
|
|
201
|
+
notLoading: true,
|
|
202
|
+
isErrored: false,
|
|
203
|
+
notErrored: true,
|
|
204
|
+
hasRows: rows.length > 0,
|
|
205
|
+
noRows: rows.length === 0,
|
|
206
|
+
noEmpty: rows.length > 0,
|
|
207
|
+
detail: planRow({ id: "" }), hideDetail: true, hideDetailNotFound: true, paymentUnavailable: false, paymentAvailable: true, needsSignIn: false, noSignIn: true,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function idOf(arg: unknown): string {
|
|
212
|
+
if (typeof arg === "string") return arg;
|
|
213
|
+
const value = (arg as { id?: unknown } | undefined)?.id;
|
|
214
|
+
return typeof value === "string" ? value : "";
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Detail actions carry no live service binding in their arguments. The worker owns the ID. */
|
|
218
|
+
function joinId(state: State, arg: unknown): string {
|
|
219
|
+
const id = idOf(arg);
|
|
220
|
+
const current = detailInputId();
|
|
221
|
+
// Input changes reach the worker before the next load reducer. An old detail
|
|
222
|
+
// can still be painted in that gap; neither its implicit nor explicit ID may charge it.
|
|
223
|
+
if (current) return state.detail.id === current && (!id || id === current) ? current : "";
|
|
224
|
+
return id;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const commerce = createIapCommerce({ adapters: [pricingPlanOrders], onChange: () => { void svc.pricingPublish(); } });
|
|
228
|
+
let detailMember = false;
|
|
229
|
+
const expandedPlans = new Set<string>();
|
|
230
|
+
let rows: PlanRow[] = [];
|
|
231
|
+
let items: IapCatalogItem[] = [];
|
|
232
|
+
let message = "";
|
|
233
|
+
let messagePlanId = "";
|
|
234
|
+
let started = false;
|
|
235
|
+
let loading = 0;
|
|
236
|
+
let contentReady = false;
|
|
237
|
+
const joining = new Set<string>();
|
|
238
|
+
/** A hosted paid plan's page is being prepared by the host (one ticket at a time). */
|
|
239
|
+
let hostedPlanOpenInFlight = false;
|
|
240
|
+
const memberSession = hostSessionFromGlobal();
|
|
241
|
+
let regularGeneration = -1;
|
|
242
|
+
let regularAccess = new Set<string>();
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
function pricedState(state: State): State {
|
|
246
|
+
if (!contentReady) return state;
|
|
247
|
+
const priced = rows.map(row => {
|
|
248
|
+
const reference = { kind: "pricingPlan", id: row.id };
|
|
249
|
+
const view = commerce.pricing.view(reference);
|
|
250
|
+
const price = iapPriceFields(view, iapPriceCopy("plans"));
|
|
251
|
+
const purchase = commerce.purchaseFields(reference, iapPurchaseCopy("plans"));
|
|
252
|
+
const apple = purchase.appleRoute;
|
|
253
|
+
const regularReady = regularGeneration === memberSession.current().generation && (!memberSession.identityBound || memberSession.current().kind === "member");
|
|
254
|
+
const joined = apple ? purchase.accessReady : regularReady && regularAccess.has(row.id);
|
|
255
|
+
return { ...row, expanded: expandedPlans.has(row.id), benefitsCollapsed: !expandedPlans.has(row.id), benefitsState: expandedPlans.has(row.id) ? "expanded" : "collapsed", priceLine: view.route === "disabled" ? row.priceLine : price.priceText,
|
|
256
|
+
periodLine: apple && !view.renews ? price.priceNote : view.route === "regular" || view.route === "disabled" || view.renews ? row.periodLine : "",
|
|
257
|
+
trialBadge: apple || price.actionDisabled ? "" : row.trialBadge,
|
|
258
|
+
validity: apple && !view.renews ? "" : row.validity,
|
|
259
|
+
noTrialBadge: apple || price.actionDisabled || row.noTrialBadge,
|
|
260
|
+
joined,
|
|
261
|
+
joinLabel: joined ? copyParam("plans.joinedLabel", "Current plan") : apple ? purchase.buyLabel : row.joinLabel,
|
|
262
|
+
joinDisabled: joined || (apple ? purchase.buyDisabled || !appleOffered(row, view) : price.actionDisabled || !regularReady) || joining.has(row.id),
|
|
263
|
+
joinBusy: apple && purchase.buyBusy,
|
|
264
|
+
joinNote: apple ? appleOffered(row, view) ? purchase.buyNote : iapPriceCopy("plans").purchaseUnavailable : price.actionNote };
|
|
265
|
+
});
|
|
266
|
+
const detail = priced.find(row => row.id === detailInputId()) ?? null;
|
|
267
|
+
const owned = detailInputId() ? detail?.joined ? detail : undefined : priced.find(row => row.joined);
|
|
268
|
+
const notice = !detailInputId() || messagePlanId === detailInputId() ? message : "";
|
|
269
|
+
const poll = commerce.pollDirective("himiBrandedPlans.iapPoll");
|
|
270
|
+
return { ...state, ...ready(priced, notice || (owned ? copyTemplate("plans.joinedMessage", "You've joined {name}.", { name: owned.name }) : "")), detail: detail ?? planRow({ id: "" }), hideDetail: !detail, hideDetailNotFound: Boolean(detail), paymentUnavailable: notice === paymentSetupMessage("plans"), paymentAvailable: notice !== paymentSetupMessage("plans"), needsSignIn: Boolean(detailInputId()) && !detailMember, noSignIn: !detailInputId() || detailMember, ...(poll ? { _poll: poll } : {}) };
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async function regularJoinMessage(row: PlanRow, reference: { kind: string; id: string }): Promise<string> {
|
|
274
|
+
const generation = memberSession.current().generation;
|
|
275
|
+
const sourceDetail = detailInputId();
|
|
276
|
+
const isCurrent = (): boolean => generation === memberSession.current().generation && detailInputId() === sourceDetail;
|
|
277
|
+
const mayContinue = (): boolean => isCurrent() && commerce.pricing.continueCheckoutGuard(reference).allowed;
|
|
278
|
+
if (!mayContinue()) return "";
|
|
279
|
+
if (row.joinUrl) {
|
|
280
|
+
try {
|
|
281
|
+
const result = await openUrl(row.joinUrl, "in_app_browser");
|
|
282
|
+
if (result.opened) { return ""; }
|
|
283
|
+
} catch {
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (!mayContinue()) return "";
|
|
287
|
+
// Hosted inside a host shell (Spaces) a plan cannot be paid in-app: classic Pricing Plans is not on
|
|
288
|
+
// ecom, so the host's member checkout has no checkout to open, and the redirect session needs a
|
|
289
|
+
// headless OAuth client a hosted app does not have. An online order created here would only be
|
|
290
|
+
// left behind as a DRAFT, so none is — the member joins on the site: the HOST opens the site's own
|
|
291
|
+
// plans page signed in as the lent member (`himi.host.memberSitePage {page:"plans"}`), or this
|
|
292
|
+
// message stands when it cannot. A FREE plan has nothing to pay: its online order activates at
|
|
293
|
+
// once, so it still joins in-app.
|
|
294
|
+
if (isHostedWorker() && !row.free) {
|
|
295
|
+
// One host open at a time: the host keeps a single ticket, so a second plan's prepare would replace the
|
|
296
|
+
// first's and drop it. The checkout guard is re-read right before the host opens the page.
|
|
297
|
+
if (hostedPlanOpenInFlight) return "";
|
|
298
|
+
hostedPlanOpenInFlight = true;
|
|
299
|
+
let opened: boolean | "withdrawn";
|
|
300
|
+
try {
|
|
301
|
+
opened = await hostedSitePageOpener({ page: "plans", planId: row.id })(
|
|
302
|
+
async () => mayContinue());
|
|
303
|
+
} finally {
|
|
304
|
+
hostedPlanOpenInFlight = false;
|
|
305
|
+
}
|
|
306
|
+
if (!isCurrent()) return "";
|
|
307
|
+
if (opened === "withdrawn") return "";
|
|
308
|
+
if (opened === true) {
|
|
309
|
+
return copyTemplate("plans.continueOnSiteMessage", "Finish joining {name} on the site.", { name: row.name });
|
|
310
|
+
}
|
|
311
|
+
return copyTemplate("plans.joinOnSiteMessage", "Memberships are purchased on the website — visit the site to join {name}.", { name: row.name });
|
|
312
|
+
}
|
|
313
|
+
// A link may fail to open. Its fallback becomes a write and needs its own preflight.
|
|
314
|
+
if (!mayContinue()) return "";
|
|
315
|
+
if (offlineWritesEnabled && !connectivity().online) return offlineWriteMessage;
|
|
316
|
+
try {
|
|
317
|
+
const created = await createOnlineOrder(row.id);
|
|
318
|
+
const snapshotId = created.purchaseFlowId;
|
|
319
|
+
if (!isCurrent()) return "";
|
|
320
|
+
if (created.order?.status === "ACTIVE") {
|
|
321
|
+
regularAccess.add(row.id);
|
|
322
|
+
return copyTemplate("plans.joinedMessage", "You've joined {name}.", { name: row.name });
|
|
323
|
+
}
|
|
324
|
+
const pay = await payCashierOrder({
|
|
325
|
+
appId: WIX_PRICING_PLANS_APP_ID,
|
|
326
|
+
snapshotId: snapshotId ?? "",
|
|
327
|
+
msid: await resolveMsid(),
|
|
328
|
+
mayCharge: mayContinue,
|
|
329
|
+
cashierUrl: async () => {
|
|
330
|
+
if (!mayContinue()) return undefined;
|
|
331
|
+
const redirect = await createRedirectSession({
|
|
332
|
+
paidPlansCheckout: { planId: row.id },
|
|
333
|
+
callbacks: { postFlowUrl: "himalaya-himi-branded-lite://screen/himi_plans" },
|
|
334
|
+
});
|
|
335
|
+
return mayContinue() ? redirect.redirectSession?.fullUrl : undefined;
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
if (pay.kind === "paid") {
|
|
339
|
+
const access = await entitlement(row.id);
|
|
340
|
+
if (!isCurrent()) return "";
|
|
341
|
+
if (access.entitled) regularAccess.add(row.id);
|
|
342
|
+
return access.entitled
|
|
343
|
+
? copyTemplate("plans.joinedMessage", "You've joined {name}.", { name: row.name })
|
|
344
|
+
: copyParam("plans.purchaseProcessingText", "Processing your purchase…");
|
|
345
|
+
}
|
|
346
|
+
if (pay.kind === "handoff") { return ""; }
|
|
347
|
+
if (pay.kind === "cancelled") {
|
|
348
|
+
return copyParam("plans.joinCancelledMessage", "Payment cancelled — you haven't joined.");
|
|
349
|
+
}
|
|
350
|
+
if (isPaymentSetupFailure(pay)) return paymentSetupMessage("plans");
|
|
351
|
+
} catch (error) {
|
|
352
|
+
if (isPaymentSetupFailure(error)) return paymentSetupMessage("plans");
|
|
353
|
+
}
|
|
354
|
+
return copyTemplate("plans.joinOnSiteMessage", "Memberships are purchased on the website — visit the site to join {name}.", { name: row.name });
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
const defineService = withOnlineWrites<State>(registerService, ["join"], {
|
|
358
|
+
messageFields: ["actionMessage"],
|
|
359
|
+
derive: state => ({ ...state, hideActionNotice: true, hideOfflineError: false }),
|
|
360
|
+
requiresConnectivity: (_action, state: State, arg) => {
|
|
361
|
+
const row = state.rows.find(candidate => candidate.id === joinId(state, arg));
|
|
362
|
+
if (!row || commerce.purchaseFields({ kind: "pricingPlan", id: row.id }, iapPurchaseCopy("plans")).appleRoute) return true;
|
|
363
|
+
return !row.joinUrl && !(isHostedWorker() && !row.free);
|
|
364
|
+
},
|
|
365
|
+
});
|
|
366
|
+
const svc = defineService<State, {
|
|
367
|
+
beginDetailLoad: (state: State) => State;
|
|
368
|
+
load: (state: State, arg?: unknown) => Promise<State | undefined>;
|
|
369
|
+
pricingPublish: (state: State) => State;
|
|
370
|
+
pricingRefresh: (state: State) => Promise<undefined>;
|
|
371
|
+
iapPoll: (state: State) => Promise<undefined>;
|
|
372
|
+
toggleBenefits: (state: State, arg?: unknown) => State;
|
|
373
|
+
join: (state: State, arg?: unknown) => Promise<State | undefined>;
|
|
374
|
+
}>("himiBrandedPlans", {
|
|
375
|
+
state: {
|
|
376
|
+
status: "loading",
|
|
377
|
+
rows: [],
|
|
378
|
+
emptyText: "",
|
|
379
|
+
actionMessage: "",
|
|
380
|
+
hideActionNotice: true,
|
|
381
|
+
hideOfflineError: true,
|
|
382
|
+
isLoading: true,
|
|
383
|
+
notLoading: false,
|
|
384
|
+
isErrored: false,
|
|
385
|
+
notErrored: true,
|
|
386
|
+
hasRows: false,
|
|
387
|
+
noRows: true,
|
|
388
|
+
noEmpty: true,
|
|
389
|
+
detail: planRow({ id: "" }), hideDetail: true, hideDetailNotFound: true, paymentUnavailable: false, paymentAvailable: true, needsSignIn: false, noSignIn: true,
|
|
390
|
+
},
|
|
391
|
+
notHydrated: ["rows", "actionMessage", "detail", "hideDetail", "hideDetailNotFound"],
|
|
392
|
+
actions: {
|
|
393
|
+
beginDetailLoad: state => ({ ...state, status: "loading", isLoading: true, notLoading: false,
|
|
394
|
+
notErrored: true, isErrored: false, noEmpty: true, detail: planRow({ id: "" }),
|
|
395
|
+
hideDetail: true, hideDetailNotFound: true, actionMessage: "", hideActionNotice: true, hideOfflineError: true }),
|
|
396
|
+
toggleBenefits: (state, arg) => {
|
|
397
|
+
const id = idOf(arg);
|
|
398
|
+
if (expandedPlans.has(id)) expandedPlans.delete(id); else expandedPlans.add(id);
|
|
399
|
+
return pricedState(state);
|
|
400
|
+
},
|
|
401
|
+
pricingPublish: pricedState,
|
|
402
|
+
pricingRefresh: async () => { await commerce.loadPrices(items); return undefined; },
|
|
403
|
+
iapPoll: async () => { await commerce.poll(); void svc.pricingPublish(); return undefined; },
|
|
404
|
+
load: async (state, arg) => {
|
|
405
|
+
stashCopy(arg);
|
|
406
|
+
const seq = ++loading;
|
|
407
|
+
if (detailInputId() && state.detail.id !== detailInputId()) {
|
|
408
|
+
contentReady = false;
|
|
409
|
+
void svc.beginDetailLoad();
|
|
410
|
+
}
|
|
411
|
+
const generation = memberSession.current().generation;
|
|
412
|
+
regularGeneration = -1;
|
|
413
|
+
regularAccess = new Set();
|
|
414
|
+
try {
|
|
415
|
+
const [response, member] = await Promise.all([listPublicPlans(), detailInputId() ? memberSession.identityBound ? Promise.resolve(memberSession.current().kind === "member") : memberAccess().then(value => Boolean(value.email)) : Promise.resolve(false)]);
|
|
416
|
+
if (seq !== loading || generation !== memberSession.current().generation) return undefined;
|
|
417
|
+
detailMember = member;
|
|
418
|
+
message = "";
|
|
419
|
+
contentReady = true;
|
|
420
|
+
rows = (response.plans ?? []).filter(plan => !plan.archived).map(planRow);
|
|
421
|
+
items = rows.map(row => ({ reference: { kind: "pricingPlan", id: row.id }, commerceDisplayPrice: row.priceLine }));
|
|
422
|
+
void svc.pricingPublish();
|
|
423
|
+
const access = rows.length > 0 && memberSession.current().kind === "member" ? await activePlanIds() : [];
|
|
424
|
+
if (seq !== loading || generation !== memberSession.current().generation) return undefined;
|
|
425
|
+
regularAccess = new Set(access);
|
|
426
|
+
regularGeneration = generation;
|
|
427
|
+
await commerce.loadPrices(items);
|
|
428
|
+
await (started ? commerce.reconcile() : commerce.start());
|
|
429
|
+
if (seq !== loading || generation !== memberSession.current().generation) return undefined;
|
|
430
|
+
started = true;
|
|
431
|
+
void svc.pricingPublish();
|
|
432
|
+
return undefined;
|
|
433
|
+
} catch {
|
|
434
|
+
if (seq !== loading || generation !== memberSession.current().generation) return undefined;
|
|
435
|
+
contentReady = false;
|
|
436
|
+
// Bridge errors (e.g. a 501 from a serve bridge without the route) land
|
|
437
|
+
// here — a graceful error card with retry, never a dead screen.
|
|
438
|
+
return {
|
|
439
|
+
...state,
|
|
440
|
+
status: "error",
|
|
441
|
+
isLoading: false,
|
|
442
|
+
notLoading: true,
|
|
443
|
+
isErrored: true,
|
|
444
|
+
notErrored: false,
|
|
445
|
+
noEmpty: true,
|
|
446
|
+
detail: planRow({ id: "" }), hideDetail: true, hideDetailNotFound: true,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
join: async (state, arg) => {
|
|
451
|
+
const row = state.rows.find((candidate) => candidate.id === joinId(state, arg));
|
|
452
|
+
if ((detailInputId() && !detailMember) || !row || joining.has(row.id)) return undefined;
|
|
453
|
+
const reference = { kind: "pricingPlan", id: row.id };
|
|
454
|
+
const purchase = commerce.purchaseFields(reference, iapPurchaseCopy("plans"));
|
|
455
|
+
if (purchase.accessReady) return undefined;
|
|
456
|
+
if (purchase.appleRoute) {
|
|
457
|
+
if (!appleOffered(row, commerce.pricing.view(reference))) return undefined;
|
|
458
|
+
await commerce.buy({ reference });
|
|
459
|
+
void svc.pricingPublish();
|
|
460
|
+
return undefined;
|
|
461
|
+
}
|
|
462
|
+
if (regularGeneration !== memberSession.current().generation || (memberSession.identityBound && memberSession.current().kind !== "member") || regularAccess.has(row.id) || !commerce.pricing.checkoutGuard(reference).allowed) return undefined;
|
|
463
|
+
joining.add(row.id);
|
|
464
|
+
void svc.pricingPublish();
|
|
465
|
+
const generation = memberSession.current().generation;
|
|
466
|
+
try {
|
|
467
|
+
const outcome = await regularJoinMessage(row, reference);
|
|
468
|
+
// An older plan's completion must not replace the current detail's notice.
|
|
469
|
+
if (generation === memberSession.current().generation && (!detailInputId() || detailInputId() === row.id)) {
|
|
470
|
+
message = outcome;
|
|
471
|
+
messagePlanId = row.id;
|
|
472
|
+
}
|
|
473
|
+
return undefined;
|
|
474
|
+
} finally {
|
|
475
|
+
joining.delete(row.id);
|
|
476
|
+
void svc.pricingPublish();
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
},
|
|
480
|
+
});
|
|
481
|
+
|
|
482
|
+
// Kick the first load at module scope, like every other list bundle
|
|
483
|
+
// (himi-store-shop, himi-booking-services, himi-events-list, himi-blog-feed …).
|
|
484
|
+
// Relying on the descriptor's onAppear alone left the screen pinned on its
|
|
485
|
+
// loading skeleton indefinitely on iOS. onAppear still fires afterwards and
|
|
486
|
+
// re-loads with the screen's copy pack; it passes no required params here
|
|
487
|
+
// (`appear(..., undefined, "<prefix>.")`), so a param-less first load is safe.
|
|
488
|
+
resetUnhydratedKeysOnOlderRuntime(svc, { ...svc.getState(), rows: [], actionMessage: "", detail: planRow({ id: "" }), hideDetail: true, hideDetailNotFound: true }, ["rows", "actionMessage", "detail", "hideDetail", "hideDetailNotFound"]);
|
|
489
|
+
memberSession.subscribe(() => {
|
|
490
|
+
message = "";
|
|
491
|
+
detailMember = false;
|
|
492
|
+
regularGeneration = -1;
|
|
493
|
+
regularAccess = new Set();
|
|
494
|
+
void svc.pricingPublish();
|
|
495
|
+
void svc.load();
|
|
496
|
+
});
|
|
497
|
+
svc.load();
|
|
498
|
+
export { svc };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { descriptionBody } from "../_shared/rich-body.js";
|
|
2
|
+
// himi-branded-lite-portfolio — real, public Wix Portfolio projects.
|
|
3
|
+
// Empty and error states stay explicit; media IDs are normalized for every host.
|
|
4
|
+
//
|
|
5
|
+
// Collections: each row names its first visible collection (`collection`), and `collections` are
|
|
6
|
+
// the filter chips (All + each collection that holds a listed project). `projects` is the list for
|
|
7
|
+
// the chip that is on; "all" (the default) is every project, as before.
|
|
8
|
+
import { defineService } from "../_shared/collection-service.js";
|
|
9
|
+
import { listCollections, listProjects, portfolioCoverRef, type WixPortfolioProject } from "@himalaya/wix-portfolio";
|
|
10
|
+
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
11
|
+
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
12
|
+
import { collectionNames, projectCollection, projectDetails } from "../_shared/portfolio-details.js";
|
|
13
|
+
|
|
14
|
+
interface Row {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
subtitle: string;
|
|
18
|
+
image: string;
|
|
19
|
+
initial: string;
|
|
20
|
+
hasImage: boolean;
|
|
21
|
+
noImage: boolean;
|
|
22
|
+
/** The project's collection name ("" when it is in none). */
|
|
23
|
+
collection: string;
|
|
24
|
+
collectionId: string;
|
|
25
|
+
hasCollection: boolean;
|
|
26
|
+
noCollection: boolean;
|
|
27
|
+
/** The "Location" detail ("" when none). */
|
|
28
|
+
location: string;
|
|
29
|
+
noLocation: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** `notSelected` is `selected`'s inverse, so a chip row can hide its "on" variant with `hiddenWhen`. */
|
|
32
|
+
interface Chip { id: string; label: string; selected: boolean; notSelected: boolean }
|
|
33
|
+
const chipOf = (id: string, label: string, selected: boolean): Chip => ({ id, label, selected, notSelected: !selected });
|
|
34
|
+
interface S {
|
|
35
|
+
status: "loading" | "ready" | "error";
|
|
36
|
+
projects: Row[];
|
|
37
|
+
emptyText: string;
|
|
38
|
+
isMock: boolean;
|
|
39
|
+
notMock: boolean;
|
|
40
|
+
mockBanner: string;
|
|
41
|
+
/** All + one chip per collection that holds a listed project; [] when there is none. */
|
|
42
|
+
collections: Chip[];
|
|
43
|
+
noCollections: boolean;
|
|
44
|
+
selectedCollection: string;
|
|
45
|
+
/** State gates for a screen's skeleton, error and empty components. */
|
|
46
|
+
isLoading: boolean;
|
|
47
|
+
notLoading: boolean;
|
|
48
|
+
notErrored: boolean;
|
|
49
|
+
/** False only when the read is done and found no project at all. Not `noEmpty`: the collection
|
|
50
|
+
* chrome reads a top-level `noEmpty: false` as "the domain shows its own empty state" and hides
|
|
51
|
+
* its designed one (collection-service `noEmptySource`). */
|
|
52
|
+
noEmptyProjects: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const gates = (status: S["status"], empty: boolean) => ({
|
|
56
|
+
isLoading: status === "loading", notLoading: status !== "loading", notErrored: status !== "error", noEmptyProjects: !(status === "ready" && empty),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const ALL = "all";
|
|
60
|
+
|
|
61
|
+
function norm(project: WixPortfolioProject, names: Map<string, string>): Row {
|
|
62
|
+
const title = (project.title || "Project").trim() || "Project";
|
|
63
|
+
const image = wixMediaUrl(portfolioCoverRef(project.coverImage));
|
|
64
|
+
const collection = projectCollection(project, names);
|
|
65
|
+
const location = projectDetails(project).location;
|
|
66
|
+
return {
|
|
67
|
+
id: project.id || project.slug || title,
|
|
68
|
+
title,
|
|
69
|
+
subtitle: descriptionBody(project.description).bodyText,
|
|
70
|
+
image,
|
|
71
|
+
initial: (title[0] || "#").toUpperCase(),
|
|
72
|
+
hasImage: Boolean(image),
|
|
73
|
+
noImage: !image,
|
|
74
|
+
collection: collection.name,
|
|
75
|
+
collectionId: collection.id,
|
|
76
|
+
hasCollection: Boolean(collection.name),
|
|
77
|
+
noCollection: !collection.name,
|
|
78
|
+
location,
|
|
79
|
+
noLocation: !location,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Every row read by the last load; `projects` is this list filtered by the chip that is on. */
|
|
84
|
+
let allRows: Row[] = [];
|
|
85
|
+
|
|
86
|
+
function chipsFor(rows: Row[], names: Map<string, string>, selected: string): Chip[] {
|
|
87
|
+
const used = [...names.entries()].filter(([id]) => rows.some((row) => row.collectionId === id));
|
|
88
|
+
// One collection only: a chip row with "All" and that one says nothing.
|
|
89
|
+
if (used.length < 2) return [];
|
|
90
|
+
return [
|
|
91
|
+
chipOf(ALL, copyParam("portfolio.allChip", "All"), selected === ALL),
|
|
92
|
+
...used.map(([id, label]) => chipOf(id, label, selected === id)),
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function view(s: S, selected: string, names?: Map<string, string>): S {
|
|
97
|
+
const chips = names ? chipsFor(allRows, names, selected) : s.collections.map((chip) => chipOf(chip.id, chip.label, chip.id === selected));
|
|
98
|
+
const valid = selected === ALL || chips.some((chip) => chip.id === selected) ? selected : ALL;
|
|
99
|
+
const projects = valid === ALL ? allRows : allRows.filter((row) => row.collectionId === valid);
|
|
100
|
+
return {
|
|
101
|
+
...s,
|
|
102
|
+
projects,
|
|
103
|
+
collections: valid === selected ? chips : chips.map((chip) => chipOf(chip.id, chip.label, chip.id === ALL)),
|
|
104
|
+
noCollections: chips.length === 0,
|
|
105
|
+
selectedCollection: valid,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const svc = defineService<S, { load: (s: S, arg?: unknown) => Promise<S>; setCollection: (s: S, arg?: unknown) => S }>("himiBrandedPortfolio", {
|
|
110
|
+
state: { status: "loading", projects: [], emptyText: "", isMock: false, notMock: true, mockBanner: "", collections: [], noCollections: true, selectedCollection: ALL, ...gates("loading", true) },
|
|
111
|
+
actions: {
|
|
112
|
+
load: async (s, arg) => {
|
|
113
|
+
stashCopy(arg);
|
|
114
|
+
try {
|
|
115
|
+
const [response, collections] = await Promise.all([
|
|
116
|
+
listProjects(50),
|
|
117
|
+
// The chips are extra: a failed collections read leaves the list without them.
|
|
118
|
+
listCollections(100).then((r) => r.collections ?? []).catch(() => []),
|
|
119
|
+
]);
|
|
120
|
+
const names = collectionNames(collections);
|
|
121
|
+
allRows = (response.projects ?? []).filter((project) => project.hidden !== true).map((project) => norm(project, names));
|
|
122
|
+
return view({ ...s, status: "ready", emptyText: allRows.length ? "" : "No published projects are available yet.", isMock: false, notMock: true, mockBanner: "", ...gates("ready", allRows.length === 0) }, s.selectedCollection || ALL, names);
|
|
123
|
+
} catch {
|
|
124
|
+
allRows = [];
|
|
125
|
+
return { ...s, status: "error", projects: [], emptyText: "Portfolio projects could not be loaded. Try again.", isMock: false, notMock: true, mockBanner: "", collections: [], noCollections: true, selectedCollection: ALL, ...gates("error", true) };
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
// A chip tap: { id } — "all" or a collection id.
|
|
129
|
+
setCollection: (s, arg) => {
|
|
130
|
+
const id = (arg as { id?: unknown } | undefined)?.id;
|
|
131
|
+
return view(s, typeof id === "string" && id ? id : ALL);
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
svc.load();
|
|
136
|
+
export { svc };
|