@wix/himalaya-cli 0.1835.0 → 0.1837.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/sdk/local-db/src/index.d.ts +15 -1
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/define-app.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/core.mjs +1 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{9258d331cc401dff7b183ce732d49df2e480ea113b52198a4a10790167519c09.bin → 12b7dd1ca5ed350a30ed6a0085a4c31f30b46688e3795c425f145dfdd3830b31.bin} +1 -1
- package/dist/browser-plane/sw.js +8 -8
- package/dist/cli.mjs +1010 -705
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/app-config.md +42 -0
- package/guides/component-index.md +198 -0
- package/guides/designing-himi-screens.md +6 -5
- package/guides/getting-started.md +5 -1
- package/guides/himi-json-output.md +14 -1
- package/guides/himi-skill.md +5 -1
- package/guides/himi-test.md +6 -1
- package/guides/index.json +6 -0
- package/guides/release-notes.md +8 -0
- package/guides/sdk-reference.json +1 -1
- package/guides/skill.md +4 -0
- package/guides/tier-5-add-a-screen.md +10 -5
- package/guides/web-ux.md +2 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +305 -2
- package/templates/beauty-salon/l10n/ar.json +77 -0
- package/templates/beauty-salon/l10n/cs.json +77 -0
- package/templates/beauty-salon/l10n/da.json +77 -0
- package/templates/beauty-salon/l10n/de.json +77 -0
- package/templates/beauty-salon/l10n/el.json +77 -0
- package/templates/beauty-salon/l10n/en.json +85 -1
- package/templates/beauty-salon/l10n/es.json +77 -0
- package/templates/beauty-salon/l10n/fi.json +77 -0
- package/templates/beauty-salon/l10n/fr.json +77 -0
- package/templates/beauty-salon/l10n/he.json +64 -0
- package/templates/beauty-salon/l10n/hu.json +77 -0
- package/templates/beauty-salon/l10n/id.json +77 -0
- package/templates/beauty-salon/l10n/it.json +77 -0
- package/templates/beauty-salon/l10n/ja.json +77 -0
- package/templates/beauty-salon/l10n/ko.json +77 -0
- package/templates/beauty-salon/l10n/lt.json +77 -0
- package/templates/beauty-salon/l10n/nl.json +77 -0
- package/templates/beauty-salon/l10n/no.json +77 -0
- package/templates/beauty-salon/l10n/pl.json +77 -0
- package/templates/beauty-salon/l10n/pt.json +77 -0
- package/templates/beauty-salon/l10n/ru.json +77 -0
- package/templates/beauty-salon/l10n/sv.json +77 -0
- package/templates/beauty-salon/l10n/th.json +77 -0
- package/templates/beauty-salon/l10n/tr.json +77 -0
- package/templates/beauty-salon/l10n/uk.json +77 -0
- package/templates/beauty-salon/l10n/vi.json +77 -0
- package/templates/beauty-salon/l10n/zh.json +77 -0
- package/templates/beauty-salon/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/beauty-salon/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/branded-lite/dev/index.ts +305 -2
- package/templates/branded-lite/l10n/ar.json +77 -0
- package/templates/branded-lite/l10n/cs.json +77 -0
- package/templates/branded-lite/l10n/da.json +77 -0
- package/templates/branded-lite/l10n/de.json +77 -0
- package/templates/branded-lite/l10n/el.json +77 -0
- package/templates/branded-lite/l10n/en.json +85 -1
- package/templates/branded-lite/l10n/es.json +77 -0
- package/templates/branded-lite/l10n/fi.json +77 -0
- package/templates/branded-lite/l10n/fr.json +77 -0
- package/templates/branded-lite/l10n/he.json +64 -0
- package/templates/branded-lite/l10n/hu.json +77 -0
- package/templates/branded-lite/l10n/id.json +77 -0
- package/templates/branded-lite/l10n/it.json +77 -0
- package/templates/branded-lite/l10n/ja.json +77 -0
- package/templates/branded-lite/l10n/ko.json +77 -0
- package/templates/branded-lite/l10n/lt.json +77 -0
- package/templates/branded-lite/l10n/nl.json +77 -0
- package/templates/branded-lite/l10n/no.json +77 -0
- package/templates/branded-lite/l10n/pl.json +77 -0
- package/templates/branded-lite/l10n/pt.json +77 -0
- package/templates/branded-lite/l10n/ru.json +77 -0
- package/templates/branded-lite/l10n/sv.json +77 -0
- package/templates/branded-lite/l10n/th.json +77 -0
- package/templates/branded-lite/l10n/tr.json +77 -0
- package/templates/branded-lite/l10n/uk.json +77 -0
- package/templates/branded-lite/l10n/vi.json +77 -0
- package/templates/branded-lite/l10n/zh.json +77 -0
- package/templates/branded-lite/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/branded-lite/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/community-club/dev/index.ts +305 -2
- package/templates/community-club/l10n/ar.json +77 -0
- package/templates/community-club/l10n/cs.json +77 -0
- package/templates/community-club/l10n/da.json +77 -0
- package/templates/community-club/l10n/de.json +77 -0
- package/templates/community-club/l10n/el.json +77 -0
- package/templates/community-club/l10n/en.json +85 -1
- package/templates/community-club/l10n/es.json +77 -0
- package/templates/community-club/l10n/fi.json +77 -0
- package/templates/community-club/l10n/fr.json +77 -0
- package/templates/community-club/l10n/he.json +64 -0
- package/templates/community-club/l10n/hu.json +77 -0
- package/templates/community-club/l10n/id.json +77 -0
- package/templates/community-club/l10n/it.json +77 -0
- package/templates/community-club/l10n/ja.json +77 -0
- package/templates/community-club/l10n/ko.json +77 -0
- package/templates/community-club/l10n/lt.json +77 -0
- package/templates/community-club/l10n/nl.json +77 -0
- package/templates/community-club/l10n/no.json +77 -0
- package/templates/community-club/l10n/pl.json +77 -0
- package/templates/community-club/l10n/pt.json +77 -0
- package/templates/community-club/l10n/ru.json +77 -0
- package/templates/community-club/l10n/sv.json +77 -0
- package/templates/community-club/l10n/th.json +77 -0
- package/templates/community-club/l10n/tr.json +77 -0
- package/templates/community-club/l10n/uk.json +77 -0
- package/templates/community-club/l10n/vi.json +77 -0
- package/templates/community-club/l10n/zh.json +77 -0
- package/templates/community-club/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/community-club/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/events-meetups/dev/index.ts +305 -2
- package/templates/events-meetups/l10n/ar.json +77 -0
- package/templates/events-meetups/l10n/cs.json +77 -0
- package/templates/events-meetups/l10n/da.json +77 -0
- package/templates/events-meetups/l10n/de.json +77 -0
- package/templates/events-meetups/l10n/el.json +77 -0
- package/templates/events-meetups/l10n/en.json +85 -1
- package/templates/events-meetups/l10n/es.json +77 -0
- package/templates/events-meetups/l10n/fi.json +77 -0
- package/templates/events-meetups/l10n/fr.json +77 -0
- package/templates/events-meetups/l10n/he.json +64 -0
- package/templates/events-meetups/l10n/hu.json +77 -0
- package/templates/events-meetups/l10n/id.json +77 -0
- package/templates/events-meetups/l10n/it.json +77 -0
- package/templates/events-meetups/l10n/ja.json +77 -0
- package/templates/events-meetups/l10n/ko.json +77 -0
- package/templates/events-meetups/l10n/lt.json +77 -0
- package/templates/events-meetups/l10n/nl.json +77 -0
- package/templates/events-meetups/l10n/no.json +77 -0
- package/templates/events-meetups/l10n/pl.json +77 -0
- package/templates/events-meetups/l10n/pt.json +77 -0
- package/templates/events-meetups/l10n/ru.json +77 -0
- package/templates/events-meetups/l10n/sv.json +77 -0
- package/templates/events-meetups/l10n/th.json +77 -0
- package/templates/events-meetups/l10n/tr.json +77 -0
- package/templates/events-meetups/l10n/uk.json +77 -0
- package/templates/events-meetups/l10n/vi.json +77 -0
- package/templates/events-meetups/l10n/zh.json +77 -0
- package/templates/events-meetups/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/events-meetups/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/gym-fitness/dev/index.ts +305 -2
- package/templates/gym-fitness/l10n/ar.json +77 -0
- package/templates/gym-fitness/l10n/cs.json +77 -0
- package/templates/gym-fitness/l10n/da.json +77 -0
- package/templates/gym-fitness/l10n/de.json +77 -0
- package/templates/gym-fitness/l10n/el.json +77 -0
- package/templates/gym-fitness/l10n/en.json +85 -1
- package/templates/gym-fitness/l10n/es.json +77 -0
- package/templates/gym-fitness/l10n/fi.json +77 -0
- package/templates/gym-fitness/l10n/fr.json +77 -0
- package/templates/gym-fitness/l10n/he.json +64 -0
- package/templates/gym-fitness/l10n/hu.json +77 -0
- package/templates/gym-fitness/l10n/id.json +77 -0
- package/templates/gym-fitness/l10n/it.json +77 -0
- package/templates/gym-fitness/l10n/ja.json +77 -0
- package/templates/gym-fitness/l10n/ko.json +77 -0
- package/templates/gym-fitness/l10n/lt.json +77 -0
- package/templates/gym-fitness/l10n/nl.json +77 -0
- package/templates/gym-fitness/l10n/no.json +77 -0
- package/templates/gym-fitness/l10n/pl.json +77 -0
- package/templates/gym-fitness/l10n/pt.json +77 -0
- package/templates/gym-fitness/l10n/ru.json +77 -0
- package/templates/gym-fitness/l10n/sv.json +77 -0
- package/templates/gym-fitness/l10n/th.json +77 -0
- package/templates/gym-fitness/l10n/tr.json +77 -0
- package/templates/gym-fitness/l10n/uk.json +77 -0
- package/templates/gym-fitness/l10n/vi.json +77 -0
- package/templates/gym-fitness/l10n/zh.json +77 -0
- package/templates/gym-fitness/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/gym-fitness/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/nonprofit-cause/dev/index.ts +305 -2
- package/templates/nonprofit-cause/l10n/ar.json +77 -0
- package/templates/nonprofit-cause/l10n/cs.json +77 -0
- package/templates/nonprofit-cause/l10n/da.json +77 -0
- package/templates/nonprofit-cause/l10n/de.json +77 -0
- package/templates/nonprofit-cause/l10n/el.json +77 -0
- package/templates/nonprofit-cause/l10n/en.json +85 -1
- package/templates/nonprofit-cause/l10n/es.json +77 -0
- package/templates/nonprofit-cause/l10n/fi.json +77 -0
- package/templates/nonprofit-cause/l10n/fr.json +77 -0
- package/templates/nonprofit-cause/l10n/he.json +64 -0
- package/templates/nonprofit-cause/l10n/hu.json +77 -0
- package/templates/nonprofit-cause/l10n/id.json +77 -0
- package/templates/nonprofit-cause/l10n/it.json +77 -0
- package/templates/nonprofit-cause/l10n/ja.json +77 -0
- package/templates/nonprofit-cause/l10n/ko.json +77 -0
- package/templates/nonprofit-cause/l10n/lt.json +77 -0
- package/templates/nonprofit-cause/l10n/nl.json +77 -0
- package/templates/nonprofit-cause/l10n/no.json +77 -0
- package/templates/nonprofit-cause/l10n/pl.json +77 -0
- package/templates/nonprofit-cause/l10n/pt.json +77 -0
- package/templates/nonprofit-cause/l10n/ru.json +77 -0
- package/templates/nonprofit-cause/l10n/sv.json +77 -0
- package/templates/nonprofit-cause/l10n/th.json +77 -0
- package/templates/nonprofit-cause/l10n/tr.json +77 -0
- package/templates/nonprofit-cause/l10n/uk.json +77 -0
- package/templates/nonprofit-cause/l10n/vi.json +77 -0
- package/templates/nonprofit-cause/l10n/zh.json +77 -0
- package/templates/nonprofit-cause/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/personal-fitness-trainer/config.ts +1 -1
- package/templates/personal-fitness-trainer/dev/index.ts +129 -1
- package/templates/personal-fitness-trainer/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/personal-fitness-trainer/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/podcast-creator/dev/index.ts +305 -2
- package/templates/podcast-creator/l10n/ar.json +77 -0
- package/templates/podcast-creator/l10n/cs.json +77 -0
- package/templates/podcast-creator/l10n/da.json +77 -0
- package/templates/podcast-creator/l10n/de.json +77 -0
- package/templates/podcast-creator/l10n/el.json +77 -0
- package/templates/podcast-creator/l10n/en.json +85 -1
- package/templates/podcast-creator/l10n/es.json +77 -0
- package/templates/podcast-creator/l10n/fi.json +77 -0
- package/templates/podcast-creator/l10n/fr.json +77 -0
- package/templates/podcast-creator/l10n/he.json +64 -0
- package/templates/podcast-creator/l10n/hu.json +77 -0
- package/templates/podcast-creator/l10n/id.json +77 -0
- package/templates/podcast-creator/l10n/it.json +77 -0
- package/templates/podcast-creator/l10n/ja.json +77 -0
- package/templates/podcast-creator/l10n/ko.json +77 -0
- package/templates/podcast-creator/l10n/lt.json +77 -0
- package/templates/podcast-creator/l10n/nl.json +77 -0
- package/templates/podcast-creator/l10n/no.json +77 -0
- package/templates/podcast-creator/l10n/pl.json +77 -0
- package/templates/podcast-creator/l10n/pt.json +77 -0
- package/templates/podcast-creator/l10n/ru.json +77 -0
- package/templates/podcast-creator/l10n/sv.json +77 -0
- package/templates/podcast-creator/l10n/th.json +77 -0
- package/templates/podcast-creator/l10n/tr.json +77 -0
- package/templates/podcast-creator/l10n/uk.json +77 -0
- package/templates/podcast-creator/l10n/vi.json +77 -0
- package/templates/podcast-creator/l10n/zh.json +77 -0
- package/templates/podcast-creator/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/podcast-creator/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/portfolio-creative/dev/index.ts +305 -2
- package/templates/portfolio-creative/l10n/ar.json +77 -0
- package/templates/portfolio-creative/l10n/cs.json +77 -0
- package/templates/portfolio-creative/l10n/da.json +77 -0
- package/templates/portfolio-creative/l10n/de.json +77 -0
- package/templates/portfolio-creative/l10n/el.json +77 -0
- package/templates/portfolio-creative/l10n/en.json +85 -1
- package/templates/portfolio-creative/l10n/es.json +77 -0
- package/templates/portfolio-creative/l10n/fi.json +77 -0
- package/templates/portfolio-creative/l10n/fr.json +77 -0
- package/templates/portfolio-creative/l10n/he.json +64 -0
- package/templates/portfolio-creative/l10n/hu.json +77 -0
- package/templates/portfolio-creative/l10n/id.json +77 -0
- package/templates/portfolio-creative/l10n/it.json +77 -0
- package/templates/portfolio-creative/l10n/ja.json +77 -0
- package/templates/portfolio-creative/l10n/ko.json +77 -0
- package/templates/portfolio-creative/l10n/lt.json +77 -0
- package/templates/portfolio-creative/l10n/nl.json +77 -0
- package/templates/portfolio-creative/l10n/no.json +77 -0
- package/templates/portfolio-creative/l10n/pl.json +77 -0
- package/templates/portfolio-creative/l10n/pt.json +77 -0
- package/templates/portfolio-creative/l10n/ru.json +77 -0
- package/templates/portfolio-creative/l10n/sv.json +77 -0
- package/templates/portfolio-creative/l10n/th.json +77 -0
- package/templates/portfolio-creative/l10n/tr.json +77 -0
- package/templates/portfolio-creative/l10n/uk.json +77 -0
- package/templates/portfolio-creative/l10n/vi.json +77 -0
- package/templates/portfolio-creative/l10n/zh.json +77 -0
- package/templates/portfolio-creative/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/restaurant/dev/index.ts +305 -2
- package/templates/restaurant/l10n/ar.json +77 -0
- package/templates/restaurant/l10n/cs.json +77 -0
- package/templates/restaurant/l10n/da.json +77 -0
- package/templates/restaurant/l10n/de.json +77 -0
- package/templates/restaurant/l10n/el.json +77 -0
- package/templates/restaurant/l10n/en.json +85 -1
- package/templates/restaurant/l10n/es.json +77 -0
- package/templates/restaurant/l10n/fi.json +77 -0
- package/templates/restaurant/l10n/fr.json +77 -0
- package/templates/restaurant/l10n/he.json +64 -0
- package/templates/restaurant/l10n/hu.json +77 -0
- package/templates/restaurant/l10n/id.json +77 -0
- package/templates/restaurant/l10n/it.json +77 -0
- package/templates/restaurant/l10n/ja.json +77 -0
- package/templates/restaurant/l10n/ko.json +77 -0
- package/templates/restaurant/l10n/lt.json +77 -0
- package/templates/restaurant/l10n/nl.json +77 -0
- package/templates/restaurant/l10n/no.json +77 -0
- package/templates/restaurant/l10n/pl.json +77 -0
- package/templates/restaurant/l10n/pt.json +77 -0
- package/templates/restaurant/l10n/ru.json +77 -0
- package/templates/restaurant/l10n/sv.json +77 -0
- package/templates/restaurant/l10n/th.json +77 -0
- package/templates/restaurant/l10n/tr.json +77 -0
- package/templates/restaurant/l10n/uk.json +77 -0
- package/templates/restaurant/l10n/vi.json +77 -0
- package/templates/restaurant/l10n/zh.json +77 -0
- package/templates/restaurant/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/restaurant/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/retail-store/dev/index.ts +305 -2
- package/templates/retail-store/l10n/ar.json +77 -0
- package/templates/retail-store/l10n/cs.json +77 -0
- package/templates/retail-store/l10n/da.json +77 -0
- package/templates/retail-store/l10n/de.json +77 -0
- package/templates/retail-store/l10n/el.json +77 -0
- package/templates/retail-store/l10n/en.json +85 -1
- package/templates/retail-store/l10n/es.json +77 -0
- package/templates/retail-store/l10n/fi.json +77 -0
- package/templates/retail-store/l10n/fr.json +77 -0
- package/templates/retail-store/l10n/he.json +64 -0
- package/templates/retail-store/l10n/hu.json +77 -0
- package/templates/retail-store/l10n/id.json +77 -0
- package/templates/retail-store/l10n/it.json +77 -0
- package/templates/retail-store/l10n/ja.json +77 -0
- package/templates/retail-store/l10n/ko.json +77 -0
- package/templates/retail-store/l10n/lt.json +77 -0
- package/templates/retail-store/l10n/nl.json +77 -0
- package/templates/retail-store/l10n/no.json +77 -0
- package/templates/retail-store/l10n/pl.json +77 -0
- package/templates/retail-store/l10n/pt.json +77 -0
- package/templates/retail-store/l10n/ru.json +77 -0
- package/templates/retail-store/l10n/sv.json +77 -0
- package/templates/retail-store/l10n/th.json +77 -0
- package/templates/retail-store/l10n/tr.json +77 -0
- package/templates/retail-store/l10n/uk.json +77 -0
- package/templates/retail-store/l10n/vi.json +77 -0
- package/templates/retail-store/l10n/zh.json +77 -0
- package/templates/retail-store/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/retail-store/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
- package/templates/yoga-studio/dev/index.ts +305 -2
- package/templates/yoga-studio/l10n/ar.json +77 -0
- package/templates/yoga-studio/l10n/cs.json +77 -0
- package/templates/yoga-studio/l10n/da.json +77 -0
- package/templates/yoga-studio/l10n/de.json +77 -0
- package/templates/yoga-studio/l10n/el.json +77 -0
- package/templates/yoga-studio/l10n/en.json +85 -1
- package/templates/yoga-studio/l10n/es.json +77 -0
- package/templates/yoga-studio/l10n/fi.json +77 -0
- package/templates/yoga-studio/l10n/fr.json +77 -0
- package/templates/yoga-studio/l10n/he.json +64 -0
- package/templates/yoga-studio/l10n/hu.json +77 -0
- package/templates/yoga-studio/l10n/id.json +77 -0
- package/templates/yoga-studio/l10n/it.json +77 -0
- package/templates/yoga-studio/l10n/ja.json +77 -0
- package/templates/yoga-studio/l10n/ko.json +77 -0
- package/templates/yoga-studio/l10n/lt.json +77 -0
- package/templates/yoga-studio/l10n/nl.json +77 -0
- package/templates/yoga-studio/l10n/no.json +77 -0
- package/templates/yoga-studio/l10n/pl.json +77 -0
- package/templates/yoga-studio/l10n/pt.json +77 -0
- package/templates/yoga-studio/l10n/ru.json +77 -0
- package/templates/yoga-studio/l10n/sv.json +77 -0
- package/templates/yoga-studio/l10n/th.json +77 -0
- package/templates/yoga-studio/l10n/tr.json +77 -0
- package/templates/yoga-studio/l10n/uk.json +77 -0
- package/templates/yoga-studio/l10n/vi.json +77 -0
- package/templates/yoga-studio/l10n/zh.json +77 -0
- package/templates/yoga-studio/tier5-src/_shared/push-permission.ts +75 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +103 -4
- package/templates/yoga-studio/tier5-src/himi-branded-lite-notifsettings/index.ts +108 -6
|
@@ -5,6 +5,7 @@ import { isProgramEnded } from "../_shared/program-fields.js";
|
|
|
5
5
|
import { fetchMemberBookings, type MemberBookingRow } from "../_shared/member-bookings.js";
|
|
6
6
|
import { hostSiteFromInput, hostedExploreCards, hostedHiddenFlags, type HostedExploreCard } from "../_shared/branded-lite-hosted.js";
|
|
7
7
|
import { memberAccess, assertMemberAccess } from "../_shared/member-access.js";
|
|
8
|
+
import { askForPush, readPhonePush, refreshGrantedTokenOnce, type PhonePush } from "../_shared/push-permission.js";
|
|
8
9
|
import { defineService as registerHome } from "../_shared/home-service.js";
|
|
9
10
|
import { navigate } from "@himalaya/state";
|
|
10
11
|
import { withIapPresentation } from "../_shared/iap-presentation.js";
|
|
@@ -283,6 +284,12 @@ interface State {
|
|
|
283
284
|
/** Inverse of onboardingHidden — hide the post-onboarding primary Shop CTA
|
|
284
285
|
* while the welcome card is still up (one primary: Got it). */
|
|
285
286
|
onboardingActive: boolean;
|
|
287
|
+
/** The in-context push ask (Turn on / Not now). Hidden unless a signed-in member's phone can
|
|
288
|
+
* still show the system prompt and this phone has not answered the card. */
|
|
289
|
+
pushAskHidden: boolean;
|
|
290
|
+
/** Which benefit line the ask shows (hiddenWhen flags, so TRUE hides): the one that fits the
|
|
291
|
+
* installed verticals, the general one in hosted mode. */
|
|
292
|
+
hidePushBodyOrders: boolean; hidePushBodyBookings: boolean; hidePushBodyOrdersBookings: boolean; hidePushBodyGeneral: boolean;
|
|
286
293
|
heroTitle: string;
|
|
287
294
|
heroSubtitle: string;
|
|
288
295
|
heroPrice: string;
|
|
@@ -378,6 +385,51 @@ function onboardingSeen(): boolean {
|
|
|
378
385
|
try { return storage()?.getItem(ONBOARDING_KEY) === "1"; } catch { return false; }
|
|
379
386
|
}
|
|
380
387
|
|
|
388
|
+
// The push ask is answered once per phone, either way: "Not now" must not come back every launch.
|
|
389
|
+
const PUSH_ASKED_KEY = "himi.brandedLite.pushAsked";
|
|
390
|
+
let pushCheckGeneration = 0;
|
|
391
|
+
/** Also held in memory: a host without storage must still keep "Not now" for this run. */
|
|
392
|
+
let pushAskAnsweredThisRun = false;
|
|
393
|
+
function pushAskAnswered(): boolean {
|
|
394
|
+
if (pushAskAnsweredThisRun) return true;
|
|
395
|
+
try { return storage()?.getItem(PUSH_ASKED_KEY) === "1"; } catch { return false; }
|
|
396
|
+
}
|
|
397
|
+
function rememberPushAskAnswered(): void {
|
|
398
|
+
pushAskAnsweredThisRun = true;
|
|
399
|
+
try { storage()?.setItem(PUSH_ASKED_KEY, "1"); } catch { /* best-effort: held in memory for this run */ }
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/** Whether the system prompt can still be shown. iOS and macOS say so ("undetermined"); Android 13+
|
|
403
|
+
* reports "denied" before its first ask too, so there a refusal cannot be told from never asked.
|
|
404
|
+
* An iOS phone that refused, and Android below 13 (no runtime dialog), have Notification
|
|
405
|
+
* settings' Settings path instead. */
|
|
406
|
+
function promptPossible(phone: PhonePush): boolean {
|
|
407
|
+
return phone.status === "undetermined" || (phone.status === "denied" && phone.deniedMayPrompt);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
type PushBody = "orders" | "bookings" | "ordersBookings" | "general";
|
|
411
|
+
/** Ping routes member pushes for orders and bookings; anything else is replies and updates. */
|
|
412
|
+
function pushBodyFor(verticals: string[], hosted: boolean): PushBody {
|
|
413
|
+
if (hosted) return "general";
|
|
414
|
+
const orders = verticals.includes("store"), bookings = verticals.includes("bookings");
|
|
415
|
+
return orders && bookings ? "ordersBookings" : orders ? "orders" : bookings ? "bookings" : "general";
|
|
416
|
+
}
|
|
417
|
+
function pushBodyFlags(body: PushBody): Pick<State, "hidePushBodyOrders" | "hidePushBodyBookings" | "hidePushBodyOrdersBookings" | "hidePushBodyGeneral"> {
|
|
418
|
+
return { hidePushBodyOrders: body !== "orders", hidePushBodyBookings: body !== "bookings",
|
|
419
|
+
hidePushBodyOrdersBookings: body !== "ordersBookings", hidePushBodyGeneral: body !== "general" };
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/** The moment of value is after sign-in: Ping delivers member notifications (orders, bookings,
|
|
423
|
+
* chat) only to a signed-in member, so a visitor has nothing to be notified about yet. */
|
|
424
|
+
async function shouldAskForPush(): Promise<boolean> {
|
|
425
|
+
const phone = await readPhonePush();
|
|
426
|
+
// Every launch, answered or not: a grant still needs this launch's token, and shells older than
|
|
427
|
+
// the native refresh registered it only from the launch prompt this app no longer shows.
|
|
428
|
+
await refreshGrantedTokenOnce(phone.status);
|
|
429
|
+
if (pushAskAnswered() || !promptPossible(phone)) return false;
|
|
430
|
+
return (await memberAccess()).signedIn === true;
|
|
431
|
+
}
|
|
432
|
+
|
|
381
433
|
// The user's own layout choice, persisted by the appearance worker under the
|
|
382
434
|
// same shared LAYOUT_KEY. Best-effort — a missing store just means we fall back
|
|
383
435
|
// to owner-default / content-recommendation.
|
|
@@ -1085,6 +1137,8 @@ function baseState(): State {
|
|
|
1085
1137
|
refreshedAt: "",
|
|
1086
1138
|
effectiveLayout: resolveEffectiveLayout(undefined, 0),
|
|
1087
1139
|
onboardingHidden: onboardingSeen(),
|
|
1140
|
+
pushAskHidden: true,
|
|
1141
|
+
...pushBodyFlags("general"),
|
|
1088
1142
|
// derive() recomputes this from onboardingHidden, but State requires it and this
|
|
1089
1143
|
// literal is a full State by contract — every other derived flag above is passed
|
|
1090
1144
|
// explicitly for the same reason. Omitting it made baseState() not a State.
|
|
@@ -1327,6 +1381,7 @@ async function refresh(state: State, arg?: unknown): Promise<State | undefined>
|
|
|
1327
1381
|
const generation = ++personalGeneration;
|
|
1328
1382
|
// Personalized work must never hold public browsing behind identity/network.
|
|
1329
1383
|
svc.clearPersonal();
|
|
1384
|
+
void svc.checkPushAsk();
|
|
1330
1385
|
void refreshPersonal(generation, arg);
|
|
1331
1386
|
const publicState = await refreshPublic(state, arg);
|
|
1332
1387
|
if (!publicState || generation !== personalGeneration) return undefined;
|
|
@@ -1344,7 +1399,10 @@ async function refresh(state: State, arg?: unknown): Promise<State | undefined>
|
|
|
1344
1399
|
memberProgressLabel: current.memberProgressLabel, memberProgressFraction: current.memberProgressFraction,
|
|
1345
1400
|
hideMemberProgress: current.hideMemberProgress, personalError: current.personalError, hidePersonalError: current.hidePersonalError,
|
|
1346
1401
|
// The weekly goal is PERSONAL (member bookings); the public refresh resets it, so keep it.
|
|
1347
|
-
weeklyClassCount: current.weeklyClassCount, weeklyClassGoalFraction: current.weeklyClassGoalFraction, weeklyGoalLabel: current.weeklyGoalLabel
|
|
1402
|
+
weeklyClassCount: current.weeklyClassCount, weeklyClassGoalFraction: current.weeklyClassGoalFraction, weeklyGoalLabel: current.weeklyGoalLabel,
|
|
1403
|
+
// Decided by checkPushAsk, which may have landed while the public read was in flight.
|
|
1404
|
+
pushAskHidden: current.pushAskHidden, hidePushBodyOrders: current.hidePushBodyOrders, hidePushBodyBookings: current.hidePushBodyBookings,
|
|
1405
|
+
hidePushBodyOrdersBookings: current.hidePushBodyOrdersBookings, hidePushBodyGeneral: current.hidePushBodyGeneral });
|
|
1348
1406
|
}
|
|
1349
1407
|
|
|
1350
1408
|
const defineService = withIapPresentation<State>({
|
|
@@ -1366,6 +1424,9 @@ const svc = defineService<State, {
|
|
|
1366
1424
|
// constraint allows an undefined return for exactly this; the declaration did not.
|
|
1367
1425
|
refresh: (state: State, arg?: unknown) => Promise<State | undefined>;
|
|
1368
1426
|
dismissOnboarding: (state: State) => State;
|
|
1427
|
+
checkPushAsk: (state: State, arg?: unknown) => Promise<State | undefined>;
|
|
1428
|
+
turnOnPush: (state: State) => Promise<State | undefined>;
|
|
1429
|
+
dismissPushAsk: (state: State) => State;
|
|
1369
1430
|
clearPersonal: (state: State) => State;
|
|
1370
1431
|
memberProgramsLoaded: (state: State, arg: { generation: number; rows: MemberProgramCard[]; attempt?: number }) => State | undefined;
|
|
1371
1432
|
openShopCategory: (state: State, arg?: unknown) => State;
|
|
@@ -1375,9 +1436,10 @@ const svc = defineService<State, {
|
|
|
1375
1436
|
state: baseState(),
|
|
1376
1437
|
// The host's site is read fresh at every boot: a snapshot of the last session's site must not
|
|
1377
1438
|
// decide this one's verticals or name (an owner installs or removes one; another site opens).
|
|
1378
|
-
notHydrated: ["hosted", "hostedName", "hostedCards", "homeCategories", "noHomeCategories", "memberPrograms", "noMemberPrograms"],
|
|
1439
|
+
notHydrated: ["hosted", "hostedName", "hostedCards", "homeCategories", "noHomeCategories", "memberPrograms", "noMemberPrograms", "pushAskHidden"],
|
|
1379
1440
|
// A member's standing never reaches the on-device snapshot either: the next boot may be another member's.
|
|
1380
|
-
|
|
1441
|
+
// Nor does the push ask: an early paint from the snapshot would show last run's card.
|
|
1442
|
+
notPersisted: ["memberPrograms", "noMemberPrograms", "pushAskHidden"],
|
|
1381
1443
|
actions: {
|
|
1382
1444
|
clearPersonal: state => derive({ ...state, nextBooking: [], hideNextBooking: true, memberProgressLabel: "", memberProgressFraction: 0, hideMemberProgress: true, memberPrograms: [], noMemberPrograms: true, personalError: false, hidePersonalError: true,
|
|
1383
1445
|
weeklyClassCount: 0, weeklyClassGoalFraction: 0, weeklyGoalLabel: "" }),
|
|
@@ -1419,6 +1481,42 @@ const svc = defineService<State, {
|
|
|
1419
1481
|
try { storage()?.setItem(ONBOARDING_KEY, "1"); } catch { /* best-effort */ }
|
|
1420
1482
|
return derive({ ...state, onboardingHidden: true });
|
|
1421
1483
|
},
|
|
1484
|
+
checkPushAsk: async (_state: State, arg?: unknown): Promise<State | undefined> => {
|
|
1485
|
+
stashCopy(arg);
|
|
1486
|
+
// Only the newest check publishes: an older one (e.g. a visitor's) must not undo a later
|
|
1487
|
+
// revisit's answer for the member who has signed in since.
|
|
1488
|
+
const generation = ++pushCheckGeneration;
|
|
1489
|
+
// Re-read the answer after the awaits: "Not now" tapped meanwhile must win.
|
|
1490
|
+
const hidden = !(await shouldAskForPush()) || pushAskAnswered();
|
|
1491
|
+
if (generation !== pushCheckGeneration) return undefined;
|
|
1492
|
+
const live: State = svc.getState();
|
|
1493
|
+
const body = pushBodyFlags(pushBodyFor(parseVerticals(undefined), !!hostedSite));
|
|
1494
|
+
const same = live.pushAskHidden === hidden && (Object.keys(body) as (keyof typeof body)[]).every((k) => live[k] === body[k]);
|
|
1495
|
+
return same ? undefined : derive({ ...live, ...body, pushAskHidden: hidden });
|
|
1496
|
+
},
|
|
1497
|
+
// The ONLY path to the system prompt. Never a Settings trip: whatever the answer, the card is done.
|
|
1498
|
+
turnOnPush: async (): Promise<State | undefined> => {
|
|
1499
|
+
// Re-check before prompting: a card restored from an older session may outlive the member.
|
|
1500
|
+
// The tap decides on its own fresh check and then outranks every check started before it
|
|
1501
|
+
// (a Home refresh must not cancel it). The permission is the phone's, not the member's, so a
|
|
1502
|
+
// sign-out racing the tap costs nothing but timing.
|
|
1503
|
+
const stillEligible = await shouldAskForPush();
|
|
1504
|
+
++pushCheckGeneration;
|
|
1505
|
+
// A failed check hides the card for now but does not use up the offer; "Not now" tapped
|
|
1506
|
+
// while the check ran wins.
|
|
1507
|
+
if (stillEligible && !pushAskAnswered()) {
|
|
1508
|
+
const status = await askForPush();
|
|
1509
|
+
// Remembered only once the OS has an answer: a request that failed before any dialog
|
|
1510
|
+
// ("undetermined" or unreadable) leaves the offer for the next visit.
|
|
1511
|
+
if (status === "granted" || status === "denied") rememberPushAskAnswered();
|
|
1512
|
+
}
|
|
1513
|
+
const live: State = svc.getState();
|
|
1514
|
+
return derive({ ...live, pushAskHidden: true });
|
|
1515
|
+
},
|
|
1516
|
+
dismissPushAsk: (state) => {
|
|
1517
|
+
rememberPushAskAnswered();
|
|
1518
|
+
return derive({ ...state, pushAskHidden: true });
|
|
1519
|
+
},
|
|
1422
1520
|
},
|
|
1423
1521
|
});
|
|
1424
1522
|
|
|
@@ -1427,7 +1525,8 @@ const svc = defineService<State, {
|
|
|
1427
1525
|
// name. In place, because on those runtimes getState() IS the stored state (as himi-player-home does).
|
|
1428
1526
|
if ((globalThis as { himalaya?: { hydrationOptOut?: unknown } }).himalaya?.hydrationOptOut !== true) {
|
|
1429
1527
|
const live = (svc as { getState?: () => State | undefined }).getState?.();
|
|
1430
|
-
|
|
1528
|
+
// pushAskHidden too: a card restored from the last session may not be this member's.
|
|
1529
|
+
if (live && typeof live === "object") Object.assign(live, hostedBoot, { homeCategories: [], noHomeCategories: true, pushAskHidden: true });
|
|
1431
1530
|
}
|
|
1432
1531
|
|
|
1433
1532
|
svc.refresh();
|
|
@@ -6,9 +6,16 @@ import { withOnlineWrites } from "../_shared/online-actions.js";
|
|
|
6
6
|
// (_shared/branded-load-state.ts).
|
|
7
7
|
// any exist. INTERACTIVE: tapping a row toggles that topic On/Off — optimistic +
|
|
8
8
|
// best-effort upsertMyNotificationPreferences (a no-op on sample rows).
|
|
9
|
-
|
|
9
|
+
//
|
|
10
|
+
// A saved preference is only half the truth: the PHONE's permission decides whether anything
|
|
11
|
+
// arrives. So the screen also reads it (declares "push"): denied ⇒ "off on this phone" + Open
|
|
12
|
+
// Settings, never asked ⇒ an offer to turn on, and either way the switches are dimmed. `load`
|
|
13
|
+
// arms a poll the host fires the moment the app returns to the foreground, which is the return
|
|
14
|
+
// from the OS settings.
|
|
15
|
+
import { defineService as registerService, type PollDirective } from "@himalaya/state";
|
|
16
|
+
import { askForPush, openPushSettings, readPhonePush, refreshGrantedToken, refreshGrantedTokenOnce, type PushStatus } from "../_shared/push-permission.js";
|
|
10
17
|
import { withEmptyFlags } from "../_shared/empty-flags.js";
|
|
11
|
-
import { stashCopy } from "../_shared/himi-copy.js";
|
|
18
|
+
import { copyParam, stashCopy } from "../_shared/himi-copy.js";
|
|
12
19
|
import { memberAccess, assertMemberAccess, type MemberAccess } from "../_shared/member-access.js";
|
|
13
20
|
import { LOADING, loaded, loadFailed, type LoadCopy, type LoadFlags } from "../_shared/branded-load-state.js";
|
|
14
21
|
import {
|
|
@@ -41,8 +48,42 @@ interface S extends LoadFlags {
|
|
|
41
48
|
* query failed. A failed query must never render the sentence that claims the
|
|
42
49
|
* customer has no content. */
|
|
43
50
|
notMockEmpty: boolean; notMockUnavailable: boolean;
|
|
51
|
+
/** The phone's notification permission; "loading" until read, "error" without push. */
|
|
52
|
+
pushStatus: PushStatus | "loading";
|
|
53
|
+
/** hiddenWhen flags: the "off on this phone" card shows only when denied, the turn-on offer
|
|
54
|
+
* only when never asked. Both hidden while loading or without push. */
|
|
55
|
+
hidePushOff: boolean; hidePushAsk: boolean;
|
|
56
|
+
/** The off card's one button: "Open Settings" where only Settings can change it, "Turn on" on
|
|
57
|
+
* Android 13+, whose "denied" also means never asked (the action prompts, then falls to Settings). */
|
|
58
|
+
hideOffSettingsCta: boolean; hideOffTurnOnCta: boolean;
|
|
59
|
+
/** The topic switches' opacity: dimmed while the phone blocks notifications. */
|
|
60
|
+
topicsOpacity: number;
|
|
61
|
+
pushMessage: string;
|
|
62
|
+
/** Transient: the runtime strips it and arms the foreground-refresh poll. */
|
|
63
|
+
_poll?: PollDirective;
|
|
44
64
|
}
|
|
45
65
|
|
|
66
|
+
const DIMMED = 0.45;
|
|
67
|
+
|
|
68
|
+
/** The push half of the view for a status. Pure, so every branch is pinned by the tests. */
|
|
69
|
+
type PushView = Pick<S, "pushStatus" | "hidePushOff" | "hidePushAsk" | "hideOffSettingsCta" | "hideOffTurnOnCta" | "topicsOpacity">;
|
|
70
|
+
export function pushView(pushStatus: S["pushStatus"], deniedMayPrompt = false): PushView {
|
|
71
|
+
const blocked = pushStatus === "denied" || pushStatus === "undetermined";
|
|
72
|
+
const off = pushStatus === "denied";
|
|
73
|
+
return {
|
|
74
|
+
pushStatus, hidePushOff: !off, hidePushAsk: pushStatus !== "undetermined",
|
|
75
|
+
hideOffSettingsCta: !off || deniedMayPrompt, hideOffTurnOnCta: !off || !deniedMayPrompt,
|
|
76
|
+
topicsOpacity: blocked ? DIMMED : 1,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Whether this phone's "denied" may still hide a first ask (last read; see readPhonePush). */
|
|
81
|
+
let deniedMayPrompt = false;
|
|
82
|
+
const viewOf = (status: S["pushStatus"]): PushView => pushView(status, deniedMayPrompt);
|
|
83
|
+
|
|
84
|
+
const POLL: PollDirective = { id: "himi-branded-notifsettings-push", intervalMs: 60_000, action: "himiBrandedNotifSettings.checkPush", immediate: false };
|
|
85
|
+
const OPEN_FAILED = () => copyParam("notifsettings.openSettingsFailed", "Change notifications for this app in your phone's settings.");
|
|
86
|
+
|
|
46
87
|
/** Whether this topic is actually being DELIVERED — not merely what the recipient
|
|
47
88
|
* asked for. `isDeliveredNow` prefers the server's `granted` verdict, so a topic the
|
|
48
89
|
* member unmuted under a channel-wide mute renders OFF instead of promising a
|
|
@@ -97,20 +138,50 @@ const COPY: LoadCopy<Row> = {
|
|
|
97
138
|
|
|
98
139
|
const defineService = withOnlineWrites(registerService, ["toggle"], { messageFields: ["actionMessage"] });
|
|
99
140
|
const INITIAL = { ...LOADING, topics: [] as Row[], emptyText: "", actionMessage: "", preferencesMember: null };
|
|
141
|
+
const PUSH_INITIAL = { ...pushView("loading"), pushMessage: "" };
|
|
142
|
+
const PUSH_FIELDS = ["pushStatus", "hidePushOff", "hidePushAsk", "hideOffSettingsCta", "hideOffTurnOnCta", "topicsOpacity", "pushMessage"] as const;
|
|
143
|
+
/** Bumped by every action that writes the permission: a load started earlier must not overwrite it. */
|
|
144
|
+
let pushWrites = 0;
|
|
145
|
+
function pushFieldsOf(state: S): Pick<S, (typeof PUSH_FIELDS)[number]> {
|
|
146
|
+
return Object.fromEntries(PUSH_FIELDS.map((k) => [k, state[k]])) as Pick<S, (typeof PUSH_FIELDS)[number]>;
|
|
147
|
+
}
|
|
100
148
|
const signInRequired = () => new Error("Unauthenticated: sign in to manage notifications");
|
|
101
149
|
let loadVersion = 0;
|
|
102
150
|
const svc = defineService<S, {
|
|
103
151
|
prepare: (s: S) => S;
|
|
104
152
|
load: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
105
153
|
toggle: (s: S, p?: { id?: string; value?: unknown }) => Promise<S | undefined>;
|
|
154
|
+
checkPush: (s: S) => Promise<S | undefined>;
|
|
155
|
+
enablePush: (s: S) => Promise<S>;
|
|
156
|
+
openPushSettings: (s: S) => Promise<S>;
|
|
106
157
|
}>("himiBrandedNotifSettings", withEmptyFlags({
|
|
107
|
-
state: INITIAL,
|
|
158
|
+
state: { ...INITIAL, ...PUSH_INITIAL },
|
|
159
|
+
// The phone's permission is read fresh each run: last run's answer may have changed in Settings.
|
|
160
|
+
notHydrated: [...PUSH_FIELDS],
|
|
161
|
+
// Nor persisted: an early paint from the snapshot would show last run's card before the worker reads the OS.
|
|
162
|
+
notPersisted: [...PUSH_FIELDS],
|
|
108
163
|
actions: {
|
|
109
|
-
|
|
164
|
+
// The push view too: a warm worker must not show last visit's card while this load reads the OS.
|
|
165
|
+
// `pushStatus` is kept: a poll comparing against it must not mistake a reload for a change.
|
|
166
|
+
prepare: (s) => ({ ...s, ...INITIAL, ...PUSH_INITIAL, pushStatus: s.pushStatus }),
|
|
110
167
|
load: async (s, arg): Promise<S | undefined> => {
|
|
111
168
|
stashCopy(arg);
|
|
112
169
|
const version = ++loadVersion;
|
|
113
170
|
await svc.prepare();
|
|
171
|
+
// Independent of the member (a visitor's phone permission is just as real), and read HERE rather
|
|
172
|
+
// than by a second action, which could commit after this one with no topics.
|
|
173
|
+
const phoneRead = readPhonePush();
|
|
174
|
+
const writesAtStart = pushWrites;
|
|
175
|
+
const pushOf = async () => {
|
|
176
|
+
const phone = await phoneRead;
|
|
177
|
+
// A grant made (or seen) while this load waited on the topics wins over its older read.
|
|
178
|
+
if (pushWrites !== writesAtStart) return pushFieldsOf(current());
|
|
179
|
+
deniedMayPrompt = phone.deniedMayPrompt;
|
|
180
|
+
// A grant first seen here (e.g. turned on in Settings before this screen opened) still needs
|
|
181
|
+
// this session's token.
|
|
182
|
+
await refreshGrantedTokenOnce(phone.status);
|
|
183
|
+
return { ...viewOf(phone.status), pushMessage: "" };
|
|
184
|
+
};
|
|
114
185
|
try {
|
|
115
186
|
const member = await memberAccess();
|
|
116
187
|
if (!member.email) throw signInRequired();
|
|
@@ -121,12 +192,14 @@ const svc = defineService<S, {
|
|
|
121
192
|
await assertMemberAccess(member);
|
|
122
193
|
const prefs = readPreferences(prefsRes);
|
|
123
194
|
const topics = readTopics(topicsRes).map((t) => norm(t, prefs));
|
|
124
|
-
|
|
195
|
+
const push = await pushOf();
|
|
196
|
+
return version === loadVersion ? { ...current(), ...loaded("topics", topics, COPY), ...push, preferencesMember: member, actionMessage: "", _poll: POLL } : undefined;
|
|
125
197
|
} catch {
|
|
126
198
|
const member = await memberAccess();
|
|
127
199
|
// An authenticated denial is not repaired by an endless sign-in loop.
|
|
128
200
|
const failure = member.email ? new Error(COPY.error) : signInRequired();
|
|
129
|
-
|
|
201
|
+
const push = await pushOf();
|
|
202
|
+
return version === loadVersion ? { ...current(), ...loadFailed("topics", failure, COPY), ...push, preferencesMember: null, actionMessage: "", _poll: POLL } : undefined;
|
|
130
203
|
}
|
|
131
204
|
},
|
|
132
205
|
// Flip one topic's On/Off. Optimistic (updates the row immediately); the real
|
|
@@ -166,8 +239,37 @@ const svc = defineService<S, {
|
|
|
166
239
|
}
|
|
167
240
|
return svc.getState().preferencesMember === s.preferencesMember ? { ...svc.getState(), topics } : undefined;
|
|
168
241
|
},
|
|
242
|
+
// onAppear's kick and every poll tick (the host fires it on return from the OS settings).
|
|
243
|
+
checkPush: async (s): Promise<S | undefined> => {
|
|
244
|
+
const phone = await readPhonePush();
|
|
245
|
+
deniedMayPrompt = phone.deniedMayPrompt;
|
|
246
|
+
const status = phone.status;
|
|
247
|
+
if (status === s.pushStatus) return undefined;
|
|
248
|
+
pushWrites++;
|
|
249
|
+
// Turned on in the OS settings while away: register this session's token.
|
|
250
|
+
await refreshGrantedToken(status);
|
|
251
|
+
return { ...current(), ...viewOf(status), pushMessage: "" };
|
|
252
|
+
},
|
|
253
|
+
// "Turn on notifications" (never asked): the system prompt, and nothing else. The answer is
|
|
254
|
+
// awaited BEFORE the state is read: topics may have loaded while the prompt was up.
|
|
255
|
+
enablePush: async (): Promise<S> => {
|
|
256
|
+
const status = await askForPush();
|
|
257
|
+
pushWrites++;
|
|
258
|
+
return { ...current(), ...viewOf(status), pushMessage: "" };
|
|
259
|
+
},
|
|
260
|
+
// "Open Settings" (denied). A request first: on Android "denied" also means never asked, and
|
|
261
|
+
// a request is the only way to find out. Anything but a grant goes to the OS settings.
|
|
262
|
+
openPushSettings: async (): Promise<S> => {
|
|
263
|
+
const status = await askForPush();
|
|
264
|
+
pushWrites++;
|
|
265
|
+
if (status === "granted") return { ...current(), ...viewOf(status), pushMessage: "" };
|
|
266
|
+
const opened = await openPushSettings();
|
|
267
|
+
return { ...current(), ...viewOf(status), pushMessage: opened ? "" : OPEN_FAILED() };
|
|
268
|
+
},
|
|
169
269
|
},
|
|
170
270
|
}, { topics: "noTopics" }));
|
|
271
|
+
/** The live state, typed: the actions above read it after an await (TS7022 without the annotation). */
|
|
272
|
+
function current(): S { return svc.getState() as S; }
|
|
171
273
|
svc.prepare();
|
|
172
274
|
svc.load();
|
|
173
275
|
export { svc };
|