@wix/himalaya-cli 0.1848.0 → 0.1849.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/stdlib/flows/screens/src/business-contact.d.ts +5 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/screens.mjs +12 -5
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{be9ff72d96dfef67029e903c48401f39d4948392a51b16e90c5c6d7d91df7391.bin → 166f7ee733ea8d0fe7bba8b796232efd4f5413e22af4a8aeee20cae1069b2fd6.bin} +1 -1
- package/dist/browser-plane/sw.js +9 -9
- package/dist/cli.mjs +63 -48
- package/dist/preview-assets.generated.bin +0 -0
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +7 -3
- package/templates/beauty-salon/l10n/ar.json +10 -0
- package/templates/beauty-salon/l10n/cs.json +10 -0
- package/templates/beauty-salon/l10n/da.json +10 -0
- package/templates/beauty-salon/l10n/de.json +10 -0
- package/templates/beauty-salon/l10n/el.json +10 -0
- package/templates/beauty-salon/l10n/es.json +10 -0
- package/templates/beauty-salon/l10n/fi.json +10 -0
- package/templates/beauty-salon/l10n/fr.json +10 -0
- package/templates/beauty-salon/l10n/he.json +8 -0
- package/templates/beauty-salon/l10n/hu.json +10 -0
- package/templates/beauty-salon/l10n/id.json +10 -0
- package/templates/beauty-salon/l10n/it.json +10 -0
- package/templates/beauty-salon/l10n/ja.json +10 -0
- package/templates/beauty-salon/l10n/ko.json +10 -0
- package/templates/beauty-salon/l10n/lt.json +10 -0
- package/templates/beauty-salon/l10n/nl.json +10 -0
- package/templates/beauty-salon/l10n/no.json +10 -0
- package/templates/beauty-salon/l10n/pl.json +10 -0
- package/templates/beauty-salon/l10n/pt.json +10 -0
- package/templates/beauty-salon/l10n/ru.json +10 -0
- package/templates/beauty-salon/l10n/sv.json +10 -0
- package/templates/beauty-salon/l10n/th.json +10 -0
- package/templates/beauty-salon/l10n/tr.json +10 -0
- package/templates/beauty-salon/l10n/uk.json +10 -0
- package/templates/beauty-salon/l10n/vi.json +10 -0
- package/templates/beauty-salon/l10n/zh.json +10 -0
- package/templates/beauty-salon/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/beauty-salon/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/beauty-salon/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/beauty-salon/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/beauty-salon/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/beauty-salon/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/beauty-salon/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/beauty-salon/tier5-src/himi-branded-lite-agenda/index.ts +33 -6
- package/templates/beauty-salon/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/beauty-salon-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/beauty-salon-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/branded-lite/dev/index.ts +7 -3
- 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-service.ts +19 -3
- package/templates/branded-lite/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/branded-lite/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/branded-lite/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/branded-lite/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/branded-lite/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-agenda/index.ts +33 -6
- package/templates/branded-lite/tier5-src/himi-branded-lite-member-programs/index.ts +15 -4
- package/templates/branded-lite/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/brandy/tier5-src/_shared/collection-service.ts +19 -3
- package/templates/brandy/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/brandy/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/community-club/dev/index.ts +2 -1
- 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-service.ts +26 -3
- package/templates/community-club/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/community-club/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/community-club/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/community-club-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/community-club-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/community-club-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/conference/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/conference/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/conference/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/events-meetups/dev/index.ts +2 -1
- 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-service.ts +26 -3
- package/templates/events-meetups/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/events-meetups/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/events-meetups/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/events-meetups-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/events-meetups-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/events-meetups-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/fitness-gym/config.ts +55 -17
- package/templates/fitness-gym/dev/index.ts +5784 -2453
- package/templates/fitness-gym/himalaya.content.json +19 -1
- package/templates/fitness-gym/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/fitness-gym/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/fitness-gym/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/fitness-gym/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/fitness-gym/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/fitness-gym/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/fitness-gym/tier5-src/himi-branded-lite-account-settings/blocked-members.ts +295 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-account-settings/index.ts +58 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-account-settings/login-info.ts +274 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-account-settings/personal-info.ts +824 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-account-settings/privacy.ts +139 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-account-settings/shared.ts +136 -0
- package/templates/fitness-gym/tier5-src/himi-branded-lite-agenda/index.ts +33 -6
- package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +15 -4
- package/templates/fitness-gym/tier5-src/himi-fitcoach-goal/index.ts +5 -2
- package/templates/fitness-gym/tier5-src/himi-fitcoach-home/index.ts +57 -6
- package/templates/fitness-gym/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/fitness-gym/tier5-src/wix-spaces-delete-account/index.ts +59 -0
- package/templates/fitness-gym/tokens.json +6 -0
- package/templates/gym-fitness/dev/index.ts +7 -3
- 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-service.ts +26 -3
- package/templates/gym-fitness/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/gym-fitness/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/gym-fitness/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/gym-fitness/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/gym-fitness/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/gym-fitness/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/gym-fitness/tier5-src/himi-branded-lite-agenda/index.ts +33 -6
- package/templates/gym-fitness/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/gym-fitness-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/gym-fitness-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/medical-services/config.ts +1 -1
- package/templates/medical-services/dev/index.ts +3 -1
- package/templates/medical-services/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/medical-services/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/medical-services/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/medical-services/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/medical-services/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/medical-services/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/medical-services/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/medical-services/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/nonprofit-cause/dev/index.ts +2 -1
- 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-service.ts +26 -3
- package/templates/nonprofit-cause/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/nonprofit-cause/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/nonprofit-cause-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/nonprofit-cause-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/owner-lite/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/owner-lite/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/owner-lite/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/personal-fitness-trainer/dev/index.ts +7 -3
- package/templates/personal-fitness-trainer/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/personal-fitness-trainer/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-agenda/index.ts +33 -6
- package/templates/personal-fitness-trainer/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/podcast-creator/dev/index.ts +2 -1
- 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-service.ts +26 -3
- package/templates/podcast-creator/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/podcast-creator/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/podcast-creator-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/podcast-creator-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/portfolio-creative/dev/index.ts +2 -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-service.ts +26 -3
- package/templates/portfolio-creative/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/portfolio-creative/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/portfolio-creative-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/portfolio-creative-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/restaurant/dev/index.ts +2 -1
- 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-service.ts +26 -3
- package/templates/restaurant/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/restaurant/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/restaurant/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/restaurant-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/restaurant-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/restaurant-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/retail-store/dev/index.ts +2 -1
- package/templates/retail-store/l10n/ar.json +10 -0
- package/templates/retail-store/l10n/cs.json +10 -0
- package/templates/retail-store/l10n/da.json +10 -0
- package/templates/retail-store/l10n/de.json +10 -0
- package/templates/retail-store/l10n/el.json +10 -0
- package/templates/retail-store/l10n/es.json +10 -0
- package/templates/retail-store/l10n/fi.json +10 -0
- package/templates/retail-store/l10n/fr.json +10 -0
- package/templates/retail-store/l10n/he.json +8 -0
- package/templates/retail-store/l10n/hu.json +10 -0
- package/templates/retail-store/l10n/id.json +10 -0
- package/templates/retail-store/l10n/it.json +10 -0
- package/templates/retail-store/l10n/ja.json +10 -0
- package/templates/retail-store/l10n/ko.json +10 -0
- package/templates/retail-store/l10n/lt.json +10 -0
- package/templates/retail-store/l10n/nl.json +10 -0
- package/templates/retail-store/l10n/no.json +10 -0
- package/templates/retail-store/l10n/pl.json +10 -0
- package/templates/retail-store/l10n/pt.json +10 -0
- package/templates/retail-store/l10n/ru.json +10 -0
- package/templates/retail-store/l10n/sv.json +10 -0
- package/templates/retail-store/l10n/th.json +10 -0
- package/templates/retail-store/l10n/tr.json +10 -0
- package/templates/retail-store/l10n/uk.json +10 -0
- package/templates/retail-store/l10n/vi.json +10 -0
- package/templates/retail-store/l10n/zh.json +10 -0
- package/templates/retail-store/tier5-src/_shared/collection-service.ts +19 -3
- package/templates/retail-store/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/retail-store/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/retail-store-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/retail-store-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/retail-store-owner/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/salon-spa/config.ts +1 -1
- package/templates/salon-spa/dev/index.ts +5 -2
- package/templates/salon-spa/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/salon-spa/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/salon-spa/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/salon-spa/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/salon-spa/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/salon-spa/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/salon-spa/tier5-src/himi-branded-lite-agenda/index.ts +33 -6
- package/templates/salon-spa/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/wholesale-store/tier5-src/_shared/collection-service.ts +19 -3
- package/templates/wholesale-store/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/wholesale-store/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/yoga-studio/dev/index.ts +7 -3
- 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-service.ts +26 -3
- package/templates/yoga-studio/tier5-src/_shared/member-avatar.ts +76 -0
- package/templates/yoga-studio/tier5-src/_shared/result-snackbar.ts +26 -0
- package/templates/yoga-studio/tier5-src/himi-booking-bookings/index.ts +9 -2
- package/templates/yoga-studio/tier5-src/himi-booking-service/index.ts +11 -4
- package/templates/yoga-studio/tier5-src/himi-booking-services/index.ts +6 -2
- package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +70 -3
- package/templates/yoga-studio/tier5-src/himi-branded-lite-account-settings/login-info.ts +16 -4
- package/templates/yoga-studio/tier5-src/himi-branded-lite-agenda/index.ts +33 -6
- package/templates/yoga-studio/tier5-src/himi-branded-lite-member-programs/index.ts +15 -4
- package/templates/yoga-studio/tier5-src/himi-store-account/index.ts +13 -2
- package/templates/yoga-studio-owner/tier5-src/_shared/collection-service.ts +26 -3
- package/templates/yoga-studio-owner/tier5-src/_shared/himi-account.ts +209 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/member-avatar.ts +76 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// Privacy — the Public profile switch and the blocked members list. The switch saves at once
|
|
2
|
+
// (joinCommunity / leaveCommunity), so this modal has no Save. Turning it off asks first, because
|
|
3
|
+
// the member also leaves the site's community; turning it on does not. A member record with no
|
|
4
|
+
// privacy status shows no switch, only a notice.
|
|
5
|
+
import { defineService } from "@himalaya/state";
|
|
6
|
+
import { alert } from "@himalaya/ui";
|
|
7
|
+
import { getMyMember, joinCommunity, leaveCommunity } from "@himalaya/wix-members";
|
|
8
|
+
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
9
|
+
import { svc as blockedMembers } from "./blocked-members.js";
|
|
10
|
+
import {
|
|
11
|
+
businessNameOf, clean, fetchMember, isSignedOut, loadErrorVariant, sameAccess, signedOutError, type WixMemberResponse,
|
|
12
|
+
} from "./shared.js";
|
|
13
|
+
|
|
14
|
+
interface S {
|
|
15
|
+
phase: "loading" | "ready" | "error" | "signedOut";
|
|
16
|
+
errorVariant: "offline" | "server";
|
|
17
|
+
memberId: string;
|
|
18
|
+
memberEmail: string;
|
|
19
|
+
memberScope: string;
|
|
20
|
+
businessName: string;
|
|
21
|
+
/** "Choose if other members of {business} can see your profile." */
|
|
22
|
+
description: string;
|
|
23
|
+
/** The API returned PUBLIC or PRIVATE. Otherwise the switch is replaced by a notice. */
|
|
24
|
+
privacyKnown: boolean;
|
|
25
|
+
privacyUnknown: boolean;
|
|
26
|
+
isPublic: boolean;
|
|
27
|
+
statusLine: string;
|
|
28
|
+
busy: boolean;
|
|
29
|
+
/** A switch change that did not save. */
|
|
30
|
+
errorText: string;
|
|
31
|
+
noErrorText: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const EMPTY: S = {
|
|
35
|
+
phase: "loading", errorVariant: "server", memberId: "", memberEmail: "", memberScope: "", businessName: "",
|
|
36
|
+
description: "", privacyKnown: false, privacyUnknown: true, isPublic: false, statusLine: "", busy: false,
|
|
37
|
+
errorText: "", noErrorText: true,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
function statusLine(isPublic: boolean): string {
|
|
41
|
+
return isPublic
|
|
42
|
+
? copyParam("accountSettings.publicProfileOn", "Other members can see your profile.")
|
|
43
|
+
: copyParam("accountSettings.publicProfileOff", "Only you can see your profile.");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function withStatus(s: S, privacyStatus: unknown): S {
|
|
47
|
+
const status = clean(privacyStatus).toUpperCase();
|
|
48
|
+
const known = status === "PUBLIC" || status === "PRIVATE";
|
|
49
|
+
const isPublic = status === "PUBLIC";
|
|
50
|
+
return { ...s, privacyKnown: known, privacyUnknown: !known, isPublic, statusLine: known ? statusLine(isPublic) : "" };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let loadVersion = 0;
|
|
54
|
+
let mutationInFlight = false;
|
|
55
|
+
/** The member moved the switch again while a change was saving. That move is not saved, so the
|
|
56
|
+
* switch must be drawn again from the result, or it keeps showing the dropped position. */
|
|
57
|
+
let flipDropped = false;
|
|
58
|
+
|
|
59
|
+
const svc = defineService<S, {
|
|
60
|
+
load: (s: S, arg?: unknown) => Promise<S>;
|
|
61
|
+
showLoading: (s: S) => S;
|
|
62
|
+
begin: (s: S, patch: Partial<S>) => S;
|
|
63
|
+
setPublic: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
64
|
+
}>("himiBrandedAccountPrivacy", {
|
|
65
|
+
state: { ...EMPTY },
|
|
66
|
+
notHydrated: Object.keys(EMPTY) as (keyof S)[],
|
|
67
|
+
notPersisted: Object.keys(EMPTY) as (keyof S)[],
|
|
68
|
+
actions: {
|
|
69
|
+
showLoading: (s) => ({ ...EMPTY, businessName: s.businessName, description: s.description }),
|
|
70
|
+
begin: (s, patch) => ({ ...s, ...patch, noErrorText: !(patch.errorText ?? s.errorText) }),
|
|
71
|
+
load: async (_s, arg): Promise<S> => {
|
|
72
|
+
const version = ++loadVersion;
|
|
73
|
+
stashCopy(arg);
|
|
74
|
+
const businessName = businessNameOf(arg) || svc.getState().businessName;
|
|
75
|
+
const description = copyTemplate("accountSettings.privacyDescription", "Choose if other members of {business} can see your profile.", { business: businessName });
|
|
76
|
+
if (svc.getState().phase !== "loading") await svc.showLoading();
|
|
77
|
+
// The blocked members section loads with the modal; its own onAppear does the same on a device.
|
|
78
|
+
void blockedMembers.load(arg).catch(() => undefined);
|
|
79
|
+
try {
|
|
80
|
+
const { member, email, scope } = await fetchMember();
|
|
81
|
+
if (version !== loadVersion) return svc.getState();
|
|
82
|
+
return withStatus({ ...EMPTY, phase: "ready", memberId: clean(member.id), memberEmail: email, memberScope: scope, businessName, description }, member.privacyStatus);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
if (version !== loadVersion) return svc.getState();
|
|
85
|
+
return { ...EMPTY, businessName, description, phase: isSignedOut(error) ? "signedOut" : "error", errorVariant: loadErrorVariant(error) };
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
setPublic: async (s, arg): Promise<S | undefined> => {
|
|
89
|
+
if (s.phase !== "ready" || !s.privacyKnown || !s.memberId) return undefined;
|
|
90
|
+
if (mutationInFlight) { flipDropped = true; return undefined; }
|
|
91
|
+
const value = (arg as { value?: unknown } | undefined)?.value;
|
|
92
|
+
const wantPublic = value === true || value === "true";
|
|
93
|
+
if (wantPublic === s.isPublic) return undefined;
|
|
94
|
+
flipDropped = false;
|
|
95
|
+
// Draw the switch from `final`; after a dropped move, flip it first so the host redraws it.
|
|
96
|
+
const settle = async (final: S): Promise<S> => {
|
|
97
|
+
if (flipDropped) { flipDropped = false; await svc.begin({ isPublic: !final.isPublic }); }
|
|
98
|
+
return final;
|
|
99
|
+
};
|
|
100
|
+
mutationInFlight = true;
|
|
101
|
+
try {
|
|
102
|
+
// The switch already moved: follow it, so that a Cancel below moves it back.
|
|
103
|
+
await svc.begin({ isPublic: wantPublic, errorText: "" });
|
|
104
|
+
if (!wantPublic) {
|
|
105
|
+
let confirmed = false;
|
|
106
|
+
try {
|
|
107
|
+
const answer = await alert({
|
|
108
|
+
title: copyParam("accountSettings.makePrivateTitle", "Make your profile private?"),
|
|
109
|
+
message: copyTemplate("accountSettings.makePrivateBody", "Other members can't see your profile. You also leave the community of {business}.", { business: s.businessName }),
|
|
110
|
+
confirmLabel: copyParam("accountSettings.makePrivateConfirm", "Make private"),
|
|
111
|
+
cancelLabel: copyParam("common.cancelCta", "Cancel"),
|
|
112
|
+
});
|
|
113
|
+
confirmed = answer.confirmed;
|
|
114
|
+
} catch { /* no presenter: nothing was confirmed */ }
|
|
115
|
+
// Cancel: the switch and its status line go back to public together.
|
|
116
|
+
if (!confirmed) return await settle({ ...svc.getState(), isPublic: true, statusLine: statusLine(true) });
|
|
117
|
+
}
|
|
118
|
+
await svc.begin({ busy: true });
|
|
119
|
+
if (!(await sameAccess(s.memberEmail, s.memberScope))) throw signedOutError();
|
|
120
|
+
const response = wantPublic ? await joinCommunity() : await leaveCommunity();
|
|
121
|
+
if (response.member?.id !== s.memberId || !response.member.privacyStatus) throw new Error("The profile privacy update was not confirmed for this member.");
|
|
122
|
+
const refreshed = await getMyMember({ fieldsets: ["FULL"] }) as WixMemberResponse;
|
|
123
|
+
if (refreshed.member?.id !== s.memberId || !(await sameAccess(s.memberEmail, s.memberScope))) throw signedOutError();
|
|
124
|
+
// A stale read or a rejected write leaves the OLD status in the readback: that is not a save.
|
|
125
|
+
const status = clean(refreshed.member.privacyStatus).toUpperCase();
|
|
126
|
+
if (status !== (wantPublic ? "PUBLIC" : "PRIVATE")) throw new Error("The profile privacy update was not confirmed by the readback.");
|
|
127
|
+
return await settle({ ...withStatus(svc.getState(), status), busy: false, errorText: "", noErrorText: true });
|
|
128
|
+
} catch (error) {
|
|
129
|
+
// The member changed mid-save: show none of the previous member's privacy, only Sign in.
|
|
130
|
+
if (isSignedOut(error)) return { ...EMPTY, businessName: s.businessName, description: s.description, phase: "signedOut" };
|
|
131
|
+
const latest = svc.getState();
|
|
132
|
+
return await settle({ ...latest, isPublic: s.isPublic, statusLine: statusLine(s.isPublic), busy: false,
|
|
133
|
+
errorText: copyParam("accountSettings.privacyError", "Your privacy setting was not updated."), noErrorText: false });
|
|
134
|
+
} finally { mutationInFlight = false; }
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export { svc as privacy };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Shared by the Account settings menu and its three modals (Personal info, Login info with its
|
|
2
|
+
// Change password step, Privacy). Each modal is its own screen, so each boots this bundle in its
|
|
3
|
+
// own worker and loads the member itself: nothing here is shared state, only the checks.
|
|
4
|
+
import { dispatch } from "@himalaya/dispatch";
|
|
5
|
+
import { classifyLoadError } from "@himalaya/state";
|
|
6
|
+
import { getMyMember } from "@himalaya/wix-members";
|
|
7
|
+
import { getMyData } from "@himalaya/wix-users";
|
|
8
|
+
import { hostSiteFromInput } from "../_shared/branded-lite-hosted.js";
|
|
9
|
+
import { memberAccess } from "../_shared/member-access.js";
|
|
10
|
+
import type { MemberAccountRoutes } from "../_shared/member-account-routes.js";
|
|
11
|
+
|
|
12
|
+
export type WixMemberRecord = {
|
|
13
|
+
id?: string;
|
|
14
|
+
loginEmail?: string;
|
|
15
|
+
contact?: {
|
|
16
|
+
firstName?: string;
|
|
17
|
+
lastName?: string;
|
|
18
|
+
phones?: string[];
|
|
19
|
+
birthdate?: string;
|
|
20
|
+
company?: string;
|
|
21
|
+
jobTitle?: string;
|
|
22
|
+
customFields?: Record<string, { name?: string; value?: unknown } | undefined>;
|
|
23
|
+
};
|
|
24
|
+
profile?: { nickname?: string; title?: string; slug?: string; photo?: { id?: string; url?: string } };
|
|
25
|
+
privacyStatus?: string;
|
|
26
|
+
};
|
|
27
|
+
export type WixMemberResponse = { member?: WixMemberRecord };
|
|
28
|
+
|
|
29
|
+
export function rawText(value: unknown): string { return typeof value === "string" ? value : ""; }
|
|
30
|
+
export function clean(value: unknown): string { return rawText(value).trim(); }
|
|
31
|
+
|
|
32
|
+
export function signedOutError(): Error {
|
|
33
|
+
return Object.assign(new Error("signed_out"), { code: "signed_out" });
|
|
34
|
+
}
|
|
35
|
+
export function isSignedOut(error: unknown): boolean {
|
|
36
|
+
return (error as { code?: string } | null)?.code === "signed_out";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** The load-error variant the modals' ErrorState draws: `offline` only when the request never left. */
|
|
40
|
+
export function loadErrorVariant(error: unknown): "offline" | "server" {
|
|
41
|
+
return classifyLoadError(error) === "offline" ? "offline" : "server";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The site a hosted build was opened for (`himalaya.input.__himiHostSite`), or "" when the build
|
|
45
|
+
* is not hosted. A hosted build serves many businesses, so this wins over the build's own name. */
|
|
46
|
+
export const hostedBusinessName = clean(hostSiteFromInput((globalThis as { himalaya?: { input?: unknown } }).himalaya?.input)?.name);
|
|
47
|
+
|
|
48
|
+
/** The business name each modal shows as its subtitle and in its copy: the hosted site's, else the
|
|
49
|
+
* descriptor param (the build's own business). */
|
|
50
|
+
export function businessNameOf(arg: unknown): string {
|
|
51
|
+
return hostedBusinessName || clean((arg as { businessName?: unknown } | undefined)?.businessName);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** The signed-in member's own record, read with the member's token, and the identity it was read for. */
|
|
55
|
+
export async function fetchMember(siteUrlInput?: unknown): Promise<{ email: string; scope: string; siteUrl: string; member: WixMemberRecord & { id: string } }> {
|
|
56
|
+
const access = await memberAccess();
|
|
57
|
+
if (!access.email) throw signedOutError();
|
|
58
|
+
const response = await getMyMember({ fieldsets: ["FULL"] }) as WixMemberResponse;
|
|
59
|
+
if (!response.member?.id) throw new Error("The signed-in member profile is unavailable.");
|
|
60
|
+
const after = await memberAccess();
|
|
61
|
+
if (!after.email || after.email !== access.email || after.scope !== access.scope) throw signedOutError();
|
|
62
|
+
const siteUrl = clean(siteUrlInput).replace(/\/$/, "");
|
|
63
|
+
return { email: access.email, scope: access.scope, siteUrl, member: response.member as WixMemberRecord & { id: string } };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** The same member is still signed in, by email, scope and member id. */
|
|
67
|
+
export async function currentMemberRecordMatches(email: string, scope: string, memberId: string): Promise<boolean> {
|
|
68
|
+
const before = await memberAccess();
|
|
69
|
+
if (!before.email || before.email !== email || before.scope !== scope) return false;
|
|
70
|
+
const response = await getMyMember({ fieldsets: ["FULL"] }) as WixMemberResponse;
|
|
71
|
+
const after = await memberAccess();
|
|
72
|
+
return response.member?.id === memberId && after.email === email && after.scope === scope;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Who is signed in: a member, nobody, or `unavailable` when the host could not say at all.
|
|
76
|
+
* `memberAccess()` reads both failures as "nobody"; the menu must not ask a member to sign in
|
|
77
|
+
* because the identity read failed. Older hosts without `memberIdentity` answer through
|
|
78
|
+
* wix-users (the same rung memberAccess uses); a host that fails both ways is unavailable. */
|
|
79
|
+
export async function memberIdentityState(): Promise<"member" | "guest" | "unavailable"> {
|
|
80
|
+
let raw: unknown;
|
|
81
|
+
let unavailable = false;
|
|
82
|
+
try { raw = await dispatch("himi.wix.memberIdentity"); }
|
|
83
|
+
catch { unavailable = true; }
|
|
84
|
+
const value = raw as { email?: unknown; signedIn?: unknown; payload?: { email?: unknown; signedIn?: unknown } } | null;
|
|
85
|
+
// A host can say a member is signed in before it has the email.
|
|
86
|
+
if (clean(value?.email ?? value?.payload?.email) || (value?.signedIn ?? value?.payload?.signedIn) === true) return "member";
|
|
87
|
+
if (!unavailable) return "guest";
|
|
88
|
+
try {
|
|
89
|
+
const profile = await getMyData();
|
|
90
|
+
return clean(profile.email ?? profile.contactEmail) ? "member" : "guest";
|
|
91
|
+
} catch {
|
|
92
|
+
return "unavailable";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Same identity by email and scope alone (no network). */
|
|
97
|
+
export async function sameAccess(email: string, scope: string): Promise<boolean> {
|
|
98
|
+
const current = await memberAccess();
|
|
99
|
+
return !!current.email && current.email === email && current.scope === scope;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** An http(s) URL split at its authority (between `//` and the first `/`, `?` or `#`). A worker has
|
|
103
|
+
* no URL global, so the authority is split by hand. */
|
|
104
|
+
const HTTP_URL = /^https?:\/\/([^/?#]*)(?:[/?#]\S*)?$/i;
|
|
105
|
+
/** A website handoff needs a real http(s) site: the documented placeholder (example.com) never counts,
|
|
106
|
+
* and neither does a URL with userinfo (`https://shop.acme.com@evil.example` opens evil.example). */
|
|
107
|
+
export function siteHandoffAvailable(siteUrl: string): boolean {
|
|
108
|
+
const match = HTTP_URL.exec(siteUrl);
|
|
109
|
+
if (!match || siteUrl.includes("\\")) return false;
|
|
110
|
+
const authority = match[1];
|
|
111
|
+
if (authority.includes("@")) return false;
|
|
112
|
+
const host = authority.replace(/:\d+$/, "").toLowerCase();
|
|
113
|
+
if (!host || /[\s:]/.test(host)) return false;
|
|
114
|
+
return host !== "example.com" && !host.endsWith(".example.com");
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function memberInitials(firstName: string, lastName: string, nickname: string): string {
|
|
118
|
+
return ([firstName[0], lastName[0]].filter(Boolean).join("") || nickname.slice(0, 1) || "M").toUpperCase();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Login info's Password section.
|
|
122
|
+
* - `row`: this app changes the password (a native app on HimalayaCore 1.5.0 or later).
|
|
123
|
+
* - `notice-preview`: the web host, a preview of the app.
|
|
124
|
+
* - `notice-here`: inside another Wix app, an older binary, or an unknown platform and version. */
|
|
125
|
+
export type PasswordMode = "row" | "notice-preview" | "notice-here";
|
|
126
|
+
export function passwordMode(routes: Pick<MemberAccountRoutes, "passwordCredentials" | "webPreview">): PasswordMode {
|
|
127
|
+
if (routes.passwordCredentials) return "row";
|
|
128
|
+
return routes.webPreview ? "notice-preview" : "notice-here";
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** The case the Password section draws: the mode, and for a notice whether it links the website. */
|
|
132
|
+
export function passwordCase(mode: PasswordMode, siteLink: boolean): string {
|
|
133
|
+
if (mode === "row") return "row";
|
|
134
|
+
const base = mode === "notice-preview" ? "preview" : "here";
|
|
135
|
+
return siteLink ? `${base}-link` : base;
|
|
136
|
+
}
|
|
@@ -31,11 +31,13 @@ import { getMyMember } from "@himalaya/wix-members";
|
|
|
31
31
|
import { signInPageStyle, signInSheetStyle } from "../_shared/sign-in-sheet.js";
|
|
32
32
|
import { LOADING, loadFailed, type LoadFlags } from "../_shared/branded-load-state.js";
|
|
33
33
|
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
34
|
+
import { readResultSnackbar, resultSnackbarOn, showResultSnackbar } from "../_shared/result-snackbar.js";
|
|
34
35
|
import { slotStartInstant } from "../_shared/himi-bookings.js";
|
|
35
36
|
import { formatServicePrice } from "../_shared/wix-service-price.js";
|
|
36
37
|
import { compareText } from "../_shared/engine-intl.js";
|
|
37
38
|
import { assertMemberAccess, memberAccess, memberAccessChanged, type MemberAccess } from "../_shared/member-access.js";
|
|
38
39
|
import { atLeast } from "../_shared/member-account-routes.js";
|
|
40
|
+
import { MEMBER_AVATAR_KEYS, memberAvatarSource } from "../_shared/member-avatar.js";
|
|
39
41
|
import { get as getAppInfo } from "@himalaya/app-info";
|
|
40
42
|
import {
|
|
41
43
|
distinctChoices, effectiveLocation, locationMenu, readSharedLocation, serviceLocationChoices, writeSharedLocation,
|
|
@@ -65,6 +67,9 @@ export interface AgendaEvent {
|
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
interface S extends LoadFlags {
|
|
70
|
+
/** The signed-in member's photo and initials, for a screen that asks for its top-bar avatar
|
|
71
|
+
* (onAppear `memberAvatar: "1"`, _shared/member-avatar.ts). Never persisted or restored. */
|
|
72
|
+
memberImage: string; memberInitials: string;
|
|
68
73
|
firstWeekday: number;
|
|
69
74
|
today: string;
|
|
70
75
|
selectedDate: string;
|
|
@@ -399,6 +404,12 @@ let resultSeq = 0;
|
|
|
399
404
|
|
|
400
405
|
/** One action's outcome, for the result sheet: `ok` when it went through. */
|
|
401
406
|
function result(text: string, ok: boolean): ResultFields {
|
|
407
|
+
// Opted in (`resultSnackbar`): the platform snackbar, and no sheet opens.
|
|
408
|
+
if (resultSnackbarOn()) {
|
|
409
|
+
showResultSnackbar(text, ok ? "success" : "info");
|
|
410
|
+
lastResult = { resultOpen: false, resultOpenB: false, resultText: "", resultOk: ok, resultInfo: !ok };
|
|
411
|
+
return lastResult;
|
|
412
|
+
}
|
|
402
413
|
const b = ++resultSeq % 2 === 0;
|
|
403
414
|
lastResult = { resultOpen: !b, resultOpenB: b, resultText: text, resultOk: ok, resultInfo: !ok };
|
|
404
415
|
return lastResult;
|
|
@@ -449,7 +460,9 @@ function derive(s: S): S {
|
|
|
449
460
|
const loaded = s.status === "ready" && rowsOk !== false && !!services;
|
|
450
461
|
const locationEmpty = loaded && !!locationKey && shown.length === 0 && !bookedOnly;
|
|
451
462
|
const bookedEmpty = loaded && bookedOnly && shown.length === 0;
|
|
452
|
-
|
|
463
|
+
// The avatar fields are merged here too: a load that started before the member read finished
|
|
464
|
+
// returns a state built from its own start, which would drop them.
|
|
465
|
+
return avatar.merge({
|
|
453
466
|
...s,
|
|
454
467
|
filter: bookedOnly ? "booked" : "all",
|
|
455
468
|
// A visitor has no sessions of their own: the filter shows only to a signed-in member.
|
|
@@ -481,7 +494,7 @@ function derive(s: S): S {
|
|
|
481
494
|
sheetServiceId: sheet?.serviceId ?? "",
|
|
482
495
|
sheetSessionId: sheet?.sessionId ?? "",
|
|
483
496
|
sheetStart: sheet?.start ?? "",
|
|
484
|
-
};
|
|
497
|
+
});
|
|
485
498
|
}
|
|
486
499
|
|
|
487
500
|
/** Leave a waitlist. The registration id comes from the load; a place known only by its
|
|
@@ -644,7 +657,7 @@ const eventIdOf = (p: unknown): string => argOf(p, "eventId") || argOf(p, "id");
|
|
|
644
657
|
* first `ask` before it — fills in today and this week. */
|
|
645
658
|
function initial(): S {
|
|
646
659
|
return {
|
|
647
|
-
...LOADING, firstWeekday: 0, today: "", selectedDate: "", rangeStart: "", rangeEnd: "",
|
|
660
|
+
...LOADING, memberImage: "", memberInitials: "", firstWeekday: 0, today: "", selectedDate: "", rangeStart: "", rangeEnd: "",
|
|
648
661
|
decorations: [], events: [], scrollTo: "", signedIn: false, updateRequired: false, updateMessage: "", listHidden: true,
|
|
649
662
|
...emptyFlags(false, false), resultOpen: false, resultOpenB: false, resultText: "", resultOk: false, resultInfo: false,
|
|
650
663
|
sheetOpen: false, sheetTitle: "", sheetWhen: "", sheetMeta: "", sheetHideCalendar: true, sheetHideCancel: true, sheetHideLeave: true, sheetBusy: false, sheetServiceId: "", sheetSessionId: "", sheetStart: "",
|
|
@@ -677,8 +690,14 @@ let signInStyle: "page" | "" = "";
|
|
|
677
690
|
* default; an app with no such screen names its own (salon-spa: the Profile tab, `himi_account`). */
|
|
678
691
|
let signInScreenId = "himi_sign_in";
|
|
679
692
|
|
|
693
|
+
// The top-bar avatar: read only when the screen asks for it, republished through `avatarChanged`.
|
|
694
|
+
const avatar = memberAvatarSource(() => { void svc.avatarChanged(); });
|
|
695
|
+
/** The tab a booking started here returns to (load param `doneTab`), for View class's own `_nav`. */
|
|
696
|
+
let doneTab = "";
|
|
697
|
+
|
|
680
698
|
const svc = defineService<S, {
|
|
681
699
|
load: (s: S, p?: unknown) => Promise<S | undefined>;
|
|
700
|
+
avatarChanged: (s: S) => S;
|
|
682
701
|
retry: (s: S) => Promise<S | undefined>;
|
|
683
702
|
selectDate: (s: S, p?: unknown) => Promise<S | undefined>;
|
|
684
703
|
rangeChanged: (s: S, p?: unknown) => Promise<S | undefined>;
|
|
@@ -698,13 +717,18 @@ const svc = defineService<S, {
|
|
|
698
717
|
}>("himiBrandedAgenda", {
|
|
699
718
|
// An action's result belongs to that visit: a cold start must not replay it from saved state,
|
|
700
719
|
// nor reopen the location sheet.
|
|
701
|
-
notHydrated: ["resultOpen", "resultOpenB", "resultText", "resultOk", "resultInfo", "locationSheetOpen", "filter", "hideFilter", "bookedEmpty", "notBookedEmpty"],
|
|
720
|
+
notHydrated: ["resultOpen", "resultOpenB", "resultText", "resultOk", "resultInfo", "locationSheetOpen", "filter", "hideFilter", "bookedEmpty", "notBookedEmpty", ...MEMBER_AVATAR_KEYS],
|
|
702
721
|
// The optional Booked filter is the member's choice for this run: never written to the device.
|
|
703
|
-
notPersisted: ["filter", "hideFilter", "bookedEmpty", "notBookedEmpty"],
|
|
722
|
+
notPersisted: ["filter", "hideFilter", "bookedEmpty", "notBookedEmpty", ...MEMBER_AVATAR_KEYS],
|
|
704
723
|
state: initial(),
|
|
705
724
|
actions: {
|
|
725
|
+
avatarChanged: (s) => avatar.merge(s),
|
|
706
726
|
load: async (s, p) => {
|
|
707
727
|
stashCopy(p);
|
|
728
|
+
readResultSnackbar(p);
|
|
729
|
+
avatar.onLoad(p);
|
|
730
|
+
const tab = argOf(p, "doneTab");
|
|
731
|
+
if (/^[A-Za-z0-9_-]{1,64}$/.test(tab)) doneTab = tab;
|
|
708
732
|
const presentation = argOf(p, "signInPresentation");
|
|
709
733
|
if (presentation === "sheet" || presentation === "full_screen") {
|
|
710
734
|
signInPresentation = presentation;
|
|
@@ -803,7 +827,9 @@ const svc = defineService<S, {
|
|
|
803
827
|
const session = sessions.find((x) => x.key === sheetKey);
|
|
804
828
|
sheetKey = "";
|
|
805
829
|
return session
|
|
806
|
-
|
|
830
|
+
// `doneTab` (a load param): a booking started from this sheet returns to this tab. The
|
|
831
|
+
// descriptor's declared `nav` carries it too; this is the path binaries without `nav` take.
|
|
832
|
+
? navigate(derive(s), { screenId: "himi_service", args: { id: session.serviceId, sessionId: session.sessionId, start: session.start, ...(doneTab ? { doneTab } : {}) } })
|
|
807
833
|
: derive(s);
|
|
808
834
|
},
|
|
809
835
|
// From one slot's own close or dismissal (`slot`: "a" | "b"), or both when it names none.
|
|
@@ -985,4 +1011,5 @@ const svc = defineService<S, {
|
|
|
985
1011
|
},
|
|
986
1012
|
},
|
|
987
1013
|
});
|
|
1014
|
+
avatar.resetRestored(svc);
|
|
988
1015
|
export { svc };
|
|
@@ -31,6 +31,7 @@ import { isNotFoundError } from "../_shared/detail-presence.js";
|
|
|
31
31
|
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
32
32
|
import { formatCurrency, formatDateMedium } from "../_shared/engine-intl.js";
|
|
33
33
|
import { iapPriceCopy, resetUnhydratedKeysOnOlderRuntime } from "../_shared/iap-worker.js";
|
|
34
|
+
import { MEMBER_AVATAR_KEYS, memberAvatarSource } from "../_shared/member-avatar.js";
|
|
34
35
|
|
|
35
36
|
export const SERVICE = "himiBrandedMemberPrograms";
|
|
36
37
|
const PAGE_SIZE = 20;
|
|
@@ -89,6 +90,9 @@ interface Option { id: string; label: string }
|
|
|
89
90
|
|
|
90
91
|
export interface State {
|
|
91
92
|
status: "loading" | "ready" | "error";
|
|
93
|
+
/** The signed-in member's photo and initials, for a screen that asks for its top-bar avatar
|
|
94
|
+
* (onAppear `memberAvatar: "1"`, _shared/member-avatar.ts). Never persisted or restored. */
|
|
95
|
+
memberImage: string; memberInitials: string;
|
|
92
96
|
rows: ProgramRow[];
|
|
93
97
|
isLoading: boolean;
|
|
94
98
|
notLoading: boolean;
|
|
@@ -506,7 +510,7 @@ let scopeIncomplete = false;
|
|
|
506
510
|
let page: CollectionQueryState<ProgramContent> | undefined;
|
|
507
511
|
|
|
508
512
|
const INITIAL_STATE: State = {
|
|
509
|
-
status: "loading", rows: [], isLoading: true, notLoading: false, isErrored: false, notErrored: true, noEmpty: true, hideList: true,
|
|
513
|
+
status: "loading", memberImage: "", memberInitials: "", rows: [], isLoading: true, notLoading: false, isErrored: false, notErrored: true, noEmpty: true, hideList: true,
|
|
510
514
|
emptyText: "", errorText: "", identityLine: "", needsSignIn: false, noSignIn: true, nextCursor: "", noMore: true, noPageError: true, loadingMore: false,
|
|
511
515
|
statusFilter: "all", statusOptions: [], hideStatusFilter: true, categoryId: "", categoryChips: [], hideCategoryFilter: true,
|
|
512
516
|
hidePriceRetry: true, priceRetryText: "", summary: "",
|
|
@@ -620,17 +624,22 @@ type Actions = {
|
|
|
620
624
|
pricingPublish: (state: State) => State;
|
|
621
625
|
pricingStart: (state: State) => State;
|
|
622
626
|
pricingRefresh: (state: State) => Promise<undefined>;
|
|
627
|
+
avatarChanged: (state: State) => State;
|
|
623
628
|
};
|
|
624
629
|
|
|
630
|
+
// The top-bar avatar: read only when the screen asks for it, republished through `avatarChanged`.
|
|
631
|
+
const avatar = memberAvatarSource(() => { void svc.avatarChanged(); });
|
|
632
|
+
|
|
625
633
|
const actions: Actions = {
|
|
626
634
|
async load(_state, arg) {
|
|
627
635
|
stashCopy(arg);
|
|
628
636
|
stashParticipantScreen(arg);
|
|
637
|
+
avatar.onLoad(arg);
|
|
629
638
|
// A load of what the screen already shows is the screen coming back: it revalidates behind its rows.
|
|
630
639
|
await controller.query(criteria(), true, true);
|
|
631
640
|
return undefined;
|
|
632
641
|
},
|
|
633
|
-
async refresh(_state, arg) { stashCopy(arg); stashParticipantScreen(arg); await controller.query(criteria()); return undefined; },
|
|
642
|
+
async refresh(_state, arg) { stashCopy(arg); stashParticipantScreen(arg); avatar.onLoad(arg); await controller.query(criteria()); return undefined; },
|
|
634
643
|
async loadMore() { await controller.loadMore(); return undefined; },
|
|
635
644
|
async retry() { await controller.retry(); return undefined; },
|
|
636
645
|
setStatus(state, arg) {
|
|
@@ -661,11 +670,13 @@ const actions: Actions = {
|
|
|
661
670
|
pricingPublish: derive,
|
|
662
671
|
pricingStart: (state) => ({ ...derive(state), _poll: pricing.pollDirective(`${SERVICE}.pricingRefresh`) }),
|
|
663
672
|
pricingRefresh: async () => { await priceContent(); return undefined; },
|
|
673
|
+
avatarChanged: (state) => avatar.merge(state),
|
|
664
674
|
};
|
|
665
675
|
|
|
666
|
-
// Prices are this run's: never restored from a cold-boot snapshot.
|
|
667
|
-
const svc = register<State, Actions>(SERVICE, { state: INITIAL_STATE, actions, notHydrated: [...PRICING_NOT_HYDRATED] } as unknown as Parameters<typeof register<State, Actions>>[1]);
|
|
676
|
+
// Prices and the member's photo are this run's: never restored from a cold-boot snapshot.
|
|
677
|
+
const svc = register<State, Actions>(SERVICE, { state: INITIAL_STATE, actions, notHydrated: [...PRICING_NOT_HYDRATED, ...MEMBER_AVATAR_KEYS], notPersisted: [...MEMBER_AVATAR_KEYS] } as unknown as Parameters<typeof register<State, Actions>>[1]);
|
|
668
678
|
resetUnhydratedKeysOnOlderRuntime(svc, INITIAL_STATE, PRICING_NOT_HYDRATED);
|
|
679
|
+
avatar.resetRestored(svc);
|
|
669
680
|
void svc.pricingStart();
|
|
670
681
|
// Kick the first load at module scope, like every other list bundle; onAppear re-loads with the copy pack.
|
|
671
682
|
svc.load();
|
|
@@ -179,10 +179,13 @@ const svc = defineService<S, {
|
|
|
179
179
|
const signIn = strArg(arg, "signInScreenId");
|
|
180
180
|
const email = signIn ? await within(signedInEmail(), 4_500, "") : "member";
|
|
181
181
|
const current = now();
|
|
182
|
-
|
|
182
|
+
// `doneTab`: a confirmed booking pops back to this tab's root (the goal lives on Home) and
|
|
183
|
+
// says so in a snackbar, instead of leaving the member on Choose a time.
|
|
184
|
+
if (email) return navigate(current, { screenId: "himi_time", args: { id: s.serviceId, doneTab: strArg(arg, "returnTab") || "home" } });
|
|
183
185
|
return navigate(current, {
|
|
184
186
|
screenId: signIn, presentation: "sheet",
|
|
185
|
-
|
|
187
|
+
// `returnDoneTab`: Choose a time, resumed after sign-in, gets the same `doneTab` a member's tap passes.
|
|
188
|
+
args: { mode: "signin", modal: "1", returnScreenId: "himi_time", returnId: s.serviceId, returnTab: strArg(arg, "returnTab") || "home", returnDoneTab: strArg(arg, "returnTab") || "home" },
|
|
186
189
|
});
|
|
187
190
|
},
|
|
188
191
|
},
|
|
@@ -27,6 +27,7 @@ import { queryDataItems } from "@himalaya/wix-data";
|
|
|
27
27
|
import { getMyMember } from "@himalaya/wix-members";
|
|
28
28
|
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
29
29
|
import { open as openUrl } from "@himalaya/open-url";
|
|
30
|
+
import { get as getAppInfo, type AppInfo } from "@himalaya/app-info";
|
|
30
31
|
import { iapPriceFields, onlineProgramItem } from "@himalaya/iap";
|
|
31
32
|
import { createIapCommerce } from "@himalaya/iap-checkout";
|
|
32
33
|
import { loadMemberProfile } from "../_shared/himi-account.js";
|
|
@@ -81,6 +82,8 @@ export interface S {
|
|
|
81
82
|
yourPlanName: string; yourPlanLine: string; noYourPlan: boolean;
|
|
82
83
|
/** The outcome line of the last Get in touch link ("" when it opened). */
|
|
83
84
|
linkMessage: string;
|
|
85
|
+
/** About: "Version 1.2.0 (5)", read from the app ("" until known, and the line collapses). */
|
|
86
|
+
appVersionLine: string;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
const BOOT: S = {
|
|
@@ -96,6 +99,7 @@ const BOOT: S = {
|
|
|
96
99
|
offerName: "", offerBadge: "", noOfferBadge: true, offerPrice: "", offerPeriod: "", offerValidity: "", offerBenefits: [], noOffer: true,
|
|
97
100
|
yourPlanName: "", yourPlanLine: "", noYourPlan: true,
|
|
98
101
|
linkMessage: "",
|
|
102
|
+
appVersionLine: "",
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
// ── Reads ────────────────────────────────────────────────────────────────────
|
|
@@ -525,6 +529,21 @@ export function allowedLink(raw: string): string {
|
|
|
525
529
|
return "";
|
|
526
530
|
}
|
|
527
531
|
|
|
532
|
+
/** About's Privacy policy and Terms of use: an https page only, with no `user@` part. */
|
|
533
|
+
export function allowedPage(raw: string): string {
|
|
534
|
+
const url = raw.trim();
|
|
535
|
+
return /^https:\/\/[^/?#:@\s\\]+(?::\d+)?(?:[/?#]\S*)?$/i.test(url) ? url : "";
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/** "Version 1.2.0 (5)": the build number only when it differs from the version. */
|
|
539
|
+
export function versionLine(info: Pick<AppInfo, "version" | "buildNumber"> | undefined): string {
|
|
540
|
+
const version = clean(info?.version);
|
|
541
|
+
if (!version) return "";
|
|
542
|
+
const build = clean(info?.buildNumber);
|
|
543
|
+
const full = build && build !== version ? `${version} (${build})` : version;
|
|
544
|
+
return copyTemplate("about.versionLine", "Version {version}", { version: full });
|
|
545
|
+
}
|
|
546
|
+
|
|
528
547
|
/** The state keys that come from the member (or a price), dropped from a persisted snapshot. */
|
|
529
548
|
export const MEMBER_KEYS: Array<keyof S> = [
|
|
530
549
|
"linkMessage", "challenges", "offerPrice",
|
|
@@ -537,9 +556,17 @@ export const MEMBER_KEYS: Array<keyof S> = [
|
|
|
537
556
|
"yourPlanName", "yourPlanLine", "noYourPlan",
|
|
538
557
|
];
|
|
539
558
|
|
|
559
|
+
/** This run's own reads that are not the member's: kept out of a snapshot, and NOT reset by a
|
|
560
|
+
* sign-out (`clearMember` resets MEMBER_KEYS only). After an app update a restored "Version …"
|
|
561
|
+
* would name the old build until `loadAbout` answers. */
|
|
562
|
+
const RUN_KEYS: Array<keyof S> = ["appVersionLine"];
|
|
563
|
+
const TRANSIENT_KEYS: Array<keyof S> = [...MEMBER_KEYS, ...RUN_KEYS];
|
|
564
|
+
|
|
540
565
|
const svc = defineService<S, {
|
|
541
566
|
openLink: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
542
|
-
|
|
567
|
+
openPage: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
568
|
+
loadAbout: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
569
|
+
load:(s: S, arg?: unknown) => Promise<S>;
|
|
543
570
|
refresh: (s: S, arg?: unknown) => Promise<S>;
|
|
544
571
|
startRetry: (s: S) => S;
|
|
545
572
|
clearMember: (s: S) => S;
|
|
@@ -550,12 +577,12 @@ const svc = defineService<S, {
|
|
|
550
577
|
openGoal: (s: S, arg?: unknown) => S;
|
|
551
578
|
openForMember: (s: S, arg?: unknown) => Promise<S>;
|
|
552
579
|
}>(SERVICE, {
|
|
553
|
-
// Prices
|
|
554
|
-
// member. Every key `derive` takes from the member is in both lists: `notHydrated` stops the
|
|
580
|
+
// Prices, member data and the app version are this run's: a cold start never shows an old
|
|
581
|
+
// amount, another member or an old build. Every key `derive` takes from the member is in both lists: `notHydrated` stops the
|
|
555
582
|
// restore, `notPersisted` keeps the member's data off the device. A snapshot boots as a visitor
|
|
556
583
|
// (BOOT's values) until `load` reads the member again.
|
|
557
|
-
notHydrated:
|
|
558
|
-
notPersisted:
|
|
584
|
+
notHydrated: TRANSIENT_KEYS,
|
|
585
|
+
notPersisted: TRANSIENT_KEYS,
|
|
559
586
|
state: BOOT,
|
|
560
587
|
actions: {
|
|
561
588
|
// Call, email, maps (Get in touch). A failed open shows a line under the list.
|
|
@@ -568,6 +595,30 @@ const svc = defineService<S, {
|
|
|
568
595
|
const linkMessage = opened ? "" : copyParam("home.linkFailed", "This link could not be opened.");
|
|
569
596
|
return current.linkMessage === linkMessage ? undefined : commit({ ...current, linkMessage });
|
|
570
597
|
},
|
|
598
|
+
// About's Privacy policy and Terms of use. A failed open shows the same line as Get in touch.
|
|
599
|
+
openPage: async (_s, arg) => {
|
|
600
|
+
stashCopy(arg);
|
|
601
|
+
const url = allowedPage(strArg(arg, "url"));
|
|
602
|
+
let opened = false;
|
|
603
|
+
if (url) { try { opened = (await openUrl(url)).opened === true; } catch { opened = false; } }
|
|
604
|
+
const current = now();
|
|
605
|
+
const linkMessage = opened ? "" : copyParam("home.linkFailed", "This link could not be opened.");
|
|
606
|
+
return current.linkMessage === linkMessage ? undefined : commit({ ...current, linkMessage });
|
|
607
|
+
},
|
|
608
|
+
// About's grey version line. A runtime without app info leaves the line collapsed.
|
|
609
|
+
loadAbout: async (s, arg) => {
|
|
610
|
+
stashCopy(arg);
|
|
611
|
+
goalsCollection = strArg(arg, "goals") || goalsCollection;
|
|
612
|
+
// A cold About (a deep link) boots this worker with no Home read before it: read Home's data
|
|
613
|
+
// once, so the shared state never rests in "loading" and Home is ready behind it.
|
|
614
|
+
// Through the handle, as `refresh` does: an action's result is what publishes the state.
|
|
615
|
+
const homeRead = loadSeq === 0 && s.status === "loading" ? svc.load(arg) : undefined;
|
|
616
|
+
let line = "";
|
|
617
|
+
try { line = versionLine(await getAppInfo()); } catch { line = ""; }
|
|
618
|
+
if (homeRead) await homeRead;
|
|
619
|
+
const current = now();
|
|
620
|
+
return current.appVersionLine === line ? undefined : commit({ ...current, appVersionLine: line });
|
|
621
|
+
},
|
|
571
622
|
load: (s, arg) => {
|
|
572
623
|
stashCopy(arg);
|
|
573
624
|
goalsCollection = strArg(arg, "goals") || goalsCollection;
|
|
@@ -614,6 +665,6 @@ const svc = defineService<S, {
|
|
|
614
665
|
// getState() IS the stored state.
|
|
615
666
|
if ((globalThis as { himalaya?: { hydrationOptOut?: unknown } }).himalaya?.hydrationOptOut !== true) {
|
|
616
667
|
const live = (svc as { getState?: () => S | undefined }).getState?.();
|
|
617
|
-
if (live && typeof live === "object") for (const key of
|
|
668
|
+
if (live && typeof live === "object") for (const key of TRANSIENT_KEYS) (live as unknown as Record<string, unknown>)[key] = BOOT[key];
|
|
618
669
|
}
|
|
619
670
|
export { svc };
|
|
@@ -34,6 +34,8 @@ interface AuthRouteInput {
|
|
|
34
34
|
modal?: string;
|
|
35
35
|
/** Modal only: the tab whose stack the return screen opens on once the modal closes. */
|
|
36
36
|
returnTab?: string;
|
|
37
|
+
/** Passed to the return screen as `doneTab` (a booking returns to that tab once confirmed). */
|
|
38
|
+
returnDoneTab?: string;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
// The screen's boot input survives refresh; consuming it must survive too.
|
|
@@ -79,12 +81,20 @@ function leaveNav(): "dismiss" | "back" {
|
|
|
79
81
|
* only push a second copy of the screen the member is already on. */
|
|
80
82
|
function resumeTarget(s: Pick<S, "returnScreenId" | "returnId" | "returnChannelId">): { screenId: string; args?: Record<string, string> } | null {
|
|
81
83
|
if (!s.returnScreenId || s.returnScreenId === "himi_account") return null;
|
|
82
|
-
|
|
84
|
+
const doneTab = routeDoneTab();
|
|
85
|
+
return s.returnId || s.returnChannelId || doneTab ? {
|
|
83
86
|
screenId: s.returnScreenId,
|
|
84
|
-
args: { ...(s.returnId ? { id: s.returnId } : {}), ...(s.returnChannelId ? { channelId: s.returnChannelId } : {}) },
|
|
87
|
+
args: { ...(s.returnId ? { id: s.returnId } : {}), ...(s.returnChannelId ? { channelId: s.returnChannelId } : {}), ...(doneTab ? { doneTab } : {}) },
|
|
85
88
|
} : { screenId: s.returnScreenId };
|
|
86
89
|
}
|
|
87
90
|
|
|
91
|
+
/** The opener's `returnDoneTab` (a route param): the resumed screen gets it as `doneTab`, so a
|
|
92
|
+
* booking started before sign-in still returns to the tab it began in. Empty when not sent. */
|
|
93
|
+
function routeDoneTab(): string {
|
|
94
|
+
const tab = routeInput().returnDoneTab ?? "";
|
|
95
|
+
return /^[A-Za-z0-9_-]{1,64}$/.test(tab) ? tab : "";
|
|
96
|
+
}
|
|
97
|
+
|
|
88
98
|
/** Resume the member-only screen that sent the visitor here, once. The return path is
|
|
89
99
|
* consumed so a later refresh cannot fire it again; the host opens the target only if
|
|
90
100
|
* it is linkable, the same check an authored `himi.open` gets.
|
|
@@ -209,6 +219,7 @@ function openSignIn(next: S, args: Record<string, string>, after: { screenId: st
|
|
|
209
219
|
back.returnScreenId = after.screenId;
|
|
210
220
|
if (after.args?.id) back.returnId = after.args.id;
|
|
211
221
|
if (after.args?.channelId) back.returnChannelId = after.args.channelId;
|
|
222
|
+
if (after.args?.doneTab) back.returnDoneTab = after.args.doneTab;
|
|
212
223
|
}
|
|
213
224
|
if (!presentation) return navigate(next, { screenId, args: { ...args, ...back } });
|
|
214
225
|
const modalArgs: Record<string, string> = { ...args, modal: "1", ...signInSheetStyle(presentation, signInStyleRequested) };
|