@wix/himalaya-cli 0.2051.0 → 0.2053.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/wix-sdk/stores-v1/src/display.d.ts +7 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/wix-stores.mjs +1 -1
- package/guides/sdk-reference.json +1 -1
- package/package.json +2 -2
- package/templates/beauty-salon/dev/index.ts +1109 -147
- package/templates/beauty-salon/l10n/ar.json +122 -6
- package/templates/beauty-salon/l10n/cs.json +122 -6
- package/templates/beauty-salon/l10n/da.json +122 -6
- package/templates/beauty-salon/l10n/de.json +122 -6
- package/templates/beauty-salon/l10n/el.json +122 -6
- package/templates/beauty-salon/l10n/en.json +81 -9
- package/templates/beauty-salon/l10n/es.json +122 -6
- package/templates/beauty-salon/l10n/fi.json +122 -6
- package/templates/beauty-salon/l10n/fr.json +122 -6
- package/templates/beauty-salon/l10n/he.json +100 -5
- package/templates/beauty-salon/l10n/hu.json +122 -6
- package/templates/beauty-salon/l10n/id.json +122 -6
- package/templates/beauty-salon/l10n/it.json +122 -6
- package/templates/beauty-salon/l10n/ja.json +122 -6
- package/templates/beauty-salon/l10n/ko.json +122 -6
- package/templates/beauty-salon/l10n/lt.json +122 -6
- package/templates/beauty-salon/l10n/nl.json +122 -6
- package/templates/beauty-salon/l10n/no.json +122 -6
- package/templates/beauty-salon/l10n/pl.json +122 -6
- package/templates/beauty-salon/l10n/pt.json +122 -6
- package/templates/beauty-salon/l10n/ru.json +122 -6
- package/templates/beauty-salon/l10n/sv.json +122 -6
- package/templates/beauty-salon/l10n/th.json +122 -6
- package/templates/beauty-salon/l10n/tr.json +122 -6
- package/templates/beauty-salon/l10n/uk.json +122 -6
- package/templates/beauty-salon/l10n/vi.json +122 -6
- package/templates/beauty-salon/l10n/zh.json +122 -6
- package/templates/beauty-salon/tier5-src/_shared/about-text.ts +8 -0
- package/templates/beauty-salon/tier5-src/_shared/himi-store-search.ts +77 -0
- package/templates/beauty-salon/tier5-src/himi-branded-lite-category/index.ts +22 -8
- package/templates/beauty-salon/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/branded-lite/dev/index.ts +1589 -143
- package/templates/branded-lite/l10n/ar.json +46 -6
- package/templates/branded-lite/l10n/cs.json +46 -6
- package/templates/branded-lite/l10n/da.json +46 -6
- package/templates/branded-lite/l10n/de.json +46 -6
- package/templates/branded-lite/l10n/el.json +46 -6
- package/templates/branded-lite/l10n/en.json +46 -11
- package/templates/branded-lite/l10n/es.json +46 -6
- package/templates/branded-lite/l10n/fi.json +46 -6
- package/templates/branded-lite/l10n/fr.json +46 -6
- package/templates/branded-lite/l10n/he.json +38 -5
- package/templates/branded-lite/l10n/hu.json +46 -6
- package/templates/branded-lite/l10n/id.json +46 -6
- package/templates/branded-lite/l10n/it.json +46 -6
- package/templates/branded-lite/l10n/ja.json +46 -6
- package/templates/branded-lite/l10n/ko.json +46 -6
- package/templates/branded-lite/l10n/lt.json +46 -6
- package/templates/branded-lite/l10n/nl.json +46 -6
- package/templates/branded-lite/l10n/no.json +46 -6
- package/templates/branded-lite/l10n/pl.json +46 -6
- package/templates/branded-lite/l10n/pt.json +46 -6
- package/templates/branded-lite/l10n/ru.json +46 -6
- package/templates/branded-lite/l10n/sv.json +46 -6
- package/templates/branded-lite/l10n/th.json +46 -6
- package/templates/branded-lite/l10n/tr.json +46 -6
- package/templates/branded-lite/l10n/uk.json +46 -6
- package/templates/branded-lite/l10n/vi.json +46 -6
- package/templates/branded-lite/l10n/zh.json +46 -6
- package/templates/branded-lite/tier5-src/_shared/about-text.ts +8 -0
- package/templates/branded-lite/tier5-src/_shared/himi-store-search.ts +77 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-category/index.ts +22 -8
- package/templates/branded-lite/tier5-src/himi-branded-lite-shop/index.ts +31 -14
- package/templates/branded-lite/tier5-src/wix-spaces-member-detail/index.ts +247 -34
- package/templates/community-club/dev/index.ts +1362 -155
- package/templates/community-club/l10n/ar.json +123 -12
- package/templates/community-club/l10n/cs.json +123 -12
- package/templates/community-club/l10n/da.json +123 -12
- package/templates/community-club/l10n/de.json +123 -12
- package/templates/community-club/l10n/el.json +123 -12
- package/templates/community-club/l10n/en.json +86 -15
- package/templates/community-club/l10n/es.json +123 -12
- package/templates/community-club/l10n/fi.json +123 -12
- package/templates/community-club/l10n/fr.json +123 -12
- package/templates/community-club/l10n/he.json +102 -10
- package/templates/community-club/l10n/hu.json +123 -12
- package/templates/community-club/l10n/id.json +123 -12
- package/templates/community-club/l10n/it.json +123 -12
- package/templates/community-club/l10n/ja.json +123 -12
- package/templates/community-club/l10n/ko.json +123 -12
- package/templates/community-club/l10n/lt.json +123 -12
- package/templates/community-club/l10n/nl.json +123 -12
- package/templates/community-club/l10n/no.json +123 -12
- package/templates/community-club/l10n/pl.json +123 -12
- package/templates/community-club/l10n/pt.json +123 -12
- package/templates/community-club/l10n/ru.json +123 -12
- package/templates/community-club/l10n/sv.json +123 -12
- package/templates/community-club/l10n/th.json +123 -12
- package/templates/community-club/l10n/tr.json +123 -12
- package/templates/community-club/l10n/uk.json +123 -12
- package/templates/community-club/l10n/vi.json +123 -12
- package/templates/community-club/l10n/zh.json +123 -12
- package/templates/community-club/tier5-src/_shared/about-text.ts +8 -0
- package/templates/community-club/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/community-club/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/events-meetups/dev/index.ts +1362 -155
- package/templates/events-meetups/l10n/ar.json +123 -12
- package/templates/events-meetups/l10n/cs.json +123 -12
- package/templates/events-meetups/l10n/da.json +123 -12
- package/templates/events-meetups/l10n/de.json +123 -12
- package/templates/events-meetups/l10n/el.json +123 -12
- package/templates/events-meetups/l10n/en.json +86 -15
- package/templates/events-meetups/l10n/es.json +123 -12
- package/templates/events-meetups/l10n/fi.json +123 -12
- package/templates/events-meetups/l10n/fr.json +123 -12
- package/templates/events-meetups/l10n/he.json +102 -10
- package/templates/events-meetups/l10n/hu.json +123 -12
- package/templates/events-meetups/l10n/id.json +123 -12
- package/templates/events-meetups/l10n/it.json +123 -12
- package/templates/events-meetups/l10n/ja.json +123 -12
- package/templates/events-meetups/l10n/ko.json +123 -12
- package/templates/events-meetups/l10n/lt.json +123 -12
- package/templates/events-meetups/l10n/nl.json +123 -12
- package/templates/events-meetups/l10n/no.json +123 -12
- package/templates/events-meetups/l10n/pl.json +123 -12
- package/templates/events-meetups/l10n/pt.json +123 -12
- package/templates/events-meetups/l10n/ru.json +123 -12
- package/templates/events-meetups/l10n/sv.json +123 -12
- package/templates/events-meetups/l10n/th.json +123 -12
- package/templates/events-meetups/l10n/tr.json +123 -12
- package/templates/events-meetups/l10n/uk.json +123 -12
- package/templates/events-meetups/l10n/vi.json +123 -12
- package/templates/events-meetups/l10n/zh.json +123 -12
- package/templates/events-meetups/tier5-src/_shared/about-text.ts +8 -0
- package/templates/events-meetups/tier5-src/_shared/detail-presence.ts +51 -0
- package/templates/events-meetups/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/gym-fitness/dev/index.ts +1109 -147
- package/templates/gym-fitness/l10n/ar.json +122 -6
- package/templates/gym-fitness/l10n/cs.json +122 -6
- package/templates/gym-fitness/l10n/da.json +122 -6
- package/templates/gym-fitness/l10n/de.json +122 -6
- package/templates/gym-fitness/l10n/el.json +122 -6
- package/templates/gym-fitness/l10n/en.json +81 -9
- package/templates/gym-fitness/l10n/es.json +122 -6
- package/templates/gym-fitness/l10n/fi.json +122 -6
- package/templates/gym-fitness/l10n/fr.json +122 -6
- package/templates/gym-fitness/l10n/he.json +100 -5
- package/templates/gym-fitness/l10n/hu.json +122 -6
- package/templates/gym-fitness/l10n/id.json +122 -6
- package/templates/gym-fitness/l10n/it.json +122 -6
- package/templates/gym-fitness/l10n/ja.json +122 -6
- package/templates/gym-fitness/l10n/ko.json +122 -6
- package/templates/gym-fitness/l10n/lt.json +122 -6
- package/templates/gym-fitness/l10n/nl.json +122 -6
- package/templates/gym-fitness/l10n/no.json +122 -6
- package/templates/gym-fitness/l10n/pl.json +122 -6
- package/templates/gym-fitness/l10n/pt.json +122 -6
- package/templates/gym-fitness/l10n/ru.json +122 -6
- package/templates/gym-fitness/l10n/sv.json +122 -6
- package/templates/gym-fitness/l10n/th.json +122 -6
- package/templates/gym-fitness/l10n/tr.json +122 -6
- package/templates/gym-fitness/l10n/uk.json +122 -6
- package/templates/gym-fitness/l10n/vi.json +122 -6
- package/templates/gym-fitness/l10n/zh.json +122 -6
- package/templates/gym-fitness/tier5-src/_shared/about-text.ts +8 -0
- package/templates/gym-fitness/tier5-src/_shared/himi-store-search.ts +77 -0
- package/templates/gym-fitness/tier5-src/himi-branded-lite-category/index.ts +22 -8
- package/templates/gym-fitness/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/nonprofit-cause/dev/index.ts +1360 -153
- package/templates/nonprofit-cause/l10n/ar.json +123 -6
- package/templates/nonprofit-cause/l10n/cs.json +123 -6
- package/templates/nonprofit-cause/l10n/da.json +123 -6
- package/templates/nonprofit-cause/l10n/de.json +123 -6
- package/templates/nonprofit-cause/l10n/el.json +123 -6
- package/templates/nonprofit-cause/l10n/en.json +86 -9
- package/templates/nonprofit-cause/l10n/es.json +123 -6
- package/templates/nonprofit-cause/l10n/fi.json +123 -6
- package/templates/nonprofit-cause/l10n/fr.json +123 -6
- package/templates/nonprofit-cause/l10n/he.json +102 -5
- package/templates/nonprofit-cause/l10n/hu.json +123 -6
- package/templates/nonprofit-cause/l10n/id.json +123 -6
- package/templates/nonprofit-cause/l10n/it.json +123 -6
- package/templates/nonprofit-cause/l10n/ja.json +123 -6
- package/templates/nonprofit-cause/l10n/ko.json +123 -6
- package/templates/nonprofit-cause/l10n/lt.json +123 -6
- package/templates/nonprofit-cause/l10n/nl.json +123 -6
- package/templates/nonprofit-cause/l10n/no.json +123 -6
- package/templates/nonprofit-cause/l10n/pl.json +123 -6
- package/templates/nonprofit-cause/l10n/pt.json +123 -6
- package/templates/nonprofit-cause/l10n/ru.json +123 -6
- package/templates/nonprofit-cause/l10n/sv.json +123 -6
- package/templates/nonprofit-cause/l10n/th.json +123 -6
- package/templates/nonprofit-cause/l10n/tr.json +123 -6
- package/templates/nonprofit-cause/l10n/uk.json +123 -6
- package/templates/nonprofit-cause/l10n/vi.json +123 -6
- package/templates/nonprofit-cause/l10n/zh.json +123 -6
- package/templates/nonprofit-cause/tier5-src/_shared/about-text.ts +8 -0
- package/templates/nonprofit-cause/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/personal-fitness-trainer/dev/index.ts +650 -75
- package/templates/personal-fitness-trainer/tier5-src/_shared/about-text.ts +8 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/group-member-count.ts +15 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/himi-media.ts +33 -0
- package/templates/personal-fitness-trainer/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/personal-fitness-trainer/tokens.json +6 -0
- package/templates/podcast-creator/dev/index.ts +1115 -153
- package/templates/podcast-creator/l10n/ar.json +117 -6
- package/templates/podcast-creator/l10n/cs.json +117 -6
- package/templates/podcast-creator/l10n/da.json +117 -6
- package/templates/podcast-creator/l10n/de.json +117 -6
- package/templates/podcast-creator/l10n/el.json +117 -6
- package/templates/podcast-creator/l10n/en.json +81 -9
- package/templates/podcast-creator/l10n/es.json +117 -6
- package/templates/podcast-creator/l10n/fi.json +117 -6
- package/templates/podcast-creator/l10n/fr.json +117 -6
- package/templates/podcast-creator/l10n/he.json +96 -5
- package/templates/podcast-creator/l10n/hu.json +117 -6
- package/templates/podcast-creator/l10n/id.json +117 -6
- package/templates/podcast-creator/l10n/it.json +117 -6
- package/templates/podcast-creator/l10n/ja.json +117 -6
- package/templates/podcast-creator/l10n/ko.json +117 -6
- package/templates/podcast-creator/l10n/lt.json +117 -6
- package/templates/podcast-creator/l10n/nl.json +117 -6
- package/templates/podcast-creator/l10n/no.json +117 -6
- package/templates/podcast-creator/l10n/pl.json +117 -6
- package/templates/podcast-creator/l10n/pt.json +117 -6
- package/templates/podcast-creator/l10n/ru.json +117 -6
- package/templates/podcast-creator/l10n/sv.json +117 -6
- package/templates/podcast-creator/l10n/th.json +117 -6
- package/templates/podcast-creator/l10n/tr.json +117 -6
- package/templates/podcast-creator/l10n/uk.json +117 -6
- package/templates/podcast-creator/l10n/vi.json +117 -6
- package/templates/podcast-creator/l10n/zh.json +117 -6
- package/templates/podcast-creator/tier5-src/_shared/about-text.ts +8 -0
- package/templates/podcast-creator/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/portfolio-creative/dev/index.ts +1113 -151
- package/templates/portfolio-creative/l10n/ar.json +122 -12
- package/templates/portfolio-creative/l10n/cs.json +122 -12
- package/templates/portfolio-creative/l10n/da.json +122 -12
- package/templates/portfolio-creative/l10n/de.json +122 -12
- package/templates/portfolio-creative/l10n/el.json +122 -12
- package/templates/portfolio-creative/l10n/en.json +81 -15
- package/templates/portfolio-creative/l10n/es.json +122 -12
- package/templates/portfolio-creative/l10n/fi.json +122 -12
- package/templates/portfolio-creative/l10n/fr.json +122 -12
- package/templates/portfolio-creative/l10n/he.json +100 -10
- package/templates/portfolio-creative/l10n/hu.json +122 -12
- package/templates/portfolio-creative/l10n/id.json +122 -12
- package/templates/portfolio-creative/l10n/it.json +122 -12
- package/templates/portfolio-creative/l10n/ja.json +122 -12
- package/templates/portfolio-creative/l10n/ko.json +122 -12
- package/templates/portfolio-creative/l10n/lt.json +122 -12
- package/templates/portfolio-creative/l10n/nl.json +122 -12
- package/templates/portfolio-creative/l10n/no.json +122 -12
- package/templates/portfolio-creative/l10n/pl.json +122 -12
- package/templates/portfolio-creative/l10n/pt.json +122 -12
- package/templates/portfolio-creative/l10n/ru.json +122 -12
- package/templates/portfolio-creative/l10n/sv.json +122 -12
- package/templates/portfolio-creative/l10n/th.json +122 -12
- package/templates/portfolio-creative/l10n/tr.json +122 -12
- package/templates/portfolio-creative/l10n/uk.json +122 -12
- package/templates/portfolio-creative/l10n/vi.json +122 -12
- package/templates/portfolio-creative/l10n/zh.json +122 -12
- package/templates/portfolio-creative/tier5-src/_shared/about-text.ts +8 -0
- package/templates/portfolio-creative/tier5-src/_shared/himi-store-search.ts +77 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-category/index.ts +22 -8
- package/templates/portfolio-creative/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/restaurant/dev/index.ts +1114 -152
- package/templates/restaurant/l10n/ar.json +117 -6
- package/templates/restaurant/l10n/cs.json +117 -6
- package/templates/restaurant/l10n/da.json +117 -6
- package/templates/restaurant/l10n/de.json +117 -6
- package/templates/restaurant/l10n/el.json +117 -6
- package/templates/restaurant/l10n/en.json +81 -9
- package/templates/restaurant/l10n/es.json +117 -6
- package/templates/restaurant/l10n/fi.json +117 -6
- package/templates/restaurant/l10n/fr.json +117 -6
- package/templates/restaurant/l10n/he.json +96 -5
- package/templates/restaurant/l10n/hu.json +117 -6
- package/templates/restaurant/l10n/id.json +117 -6
- package/templates/restaurant/l10n/it.json +117 -6
- package/templates/restaurant/l10n/ja.json +117 -6
- package/templates/restaurant/l10n/ko.json +117 -6
- package/templates/restaurant/l10n/lt.json +117 -6
- package/templates/restaurant/l10n/nl.json +117 -6
- package/templates/restaurant/l10n/no.json +117 -6
- package/templates/restaurant/l10n/pl.json +117 -6
- package/templates/restaurant/l10n/pt.json +117 -6
- package/templates/restaurant/l10n/ru.json +117 -6
- package/templates/restaurant/l10n/sv.json +117 -6
- package/templates/restaurant/l10n/th.json +117 -6
- package/templates/restaurant/l10n/tr.json +117 -6
- package/templates/restaurant/l10n/uk.json +117 -6
- package/templates/restaurant/l10n/vi.json +117 -6
- package/templates/restaurant/l10n/zh.json +117 -6
- package/templates/restaurant/tier5-src/_shared/about-text.ts +8 -0
- package/templates/restaurant/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/retail-store/dev/index.ts +1115 -153
- package/templates/retail-store/l10n/ar.json +122 -12
- package/templates/retail-store/l10n/cs.json +122 -12
- package/templates/retail-store/l10n/da.json +122 -12
- package/templates/retail-store/l10n/de.json +122 -12
- package/templates/retail-store/l10n/el.json +122 -12
- package/templates/retail-store/l10n/en.json +81 -15
- package/templates/retail-store/l10n/es.json +122 -12
- package/templates/retail-store/l10n/fi.json +122 -12
- package/templates/retail-store/l10n/fr.json +122 -12
- package/templates/retail-store/l10n/he.json +100 -10
- package/templates/retail-store/l10n/hu.json +122 -12
- package/templates/retail-store/l10n/id.json +122 -12
- package/templates/retail-store/l10n/it.json +122 -12
- package/templates/retail-store/l10n/ja.json +122 -12
- package/templates/retail-store/l10n/ko.json +122 -12
- package/templates/retail-store/l10n/lt.json +122 -12
- package/templates/retail-store/l10n/nl.json +122 -12
- package/templates/retail-store/l10n/no.json +122 -12
- package/templates/retail-store/l10n/pl.json +122 -12
- package/templates/retail-store/l10n/pt.json +122 -12
- package/templates/retail-store/l10n/ru.json +122 -12
- package/templates/retail-store/l10n/sv.json +122 -12
- package/templates/retail-store/l10n/th.json +122 -12
- package/templates/retail-store/l10n/tr.json +122 -12
- package/templates/retail-store/l10n/uk.json +122 -12
- package/templates/retail-store/l10n/vi.json +122 -12
- package/templates/retail-store/l10n/zh.json +122 -12
- package/templates/retail-store/tier5-src/_shared/about-text.ts +8 -0
- package/templates/retail-store/tier5-src/_shared/himi-store-search.ts +77 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-category/index.ts +22 -8
- package/templates/retail-store/tier5-src/himi-branded-lite-shop/index.ts +31 -14
- package/templates/retail-store/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/yoga-studio/dev/index.ts +1109 -147
- package/templates/yoga-studio/l10n/ar.json +117 -6
- package/templates/yoga-studio/l10n/cs.json +117 -6
- package/templates/yoga-studio/l10n/da.json +117 -6
- package/templates/yoga-studio/l10n/de.json +117 -6
- package/templates/yoga-studio/l10n/el.json +117 -6
- package/templates/yoga-studio/l10n/en.json +81 -9
- package/templates/yoga-studio/l10n/es.json +117 -6
- package/templates/yoga-studio/l10n/fi.json +117 -6
- package/templates/yoga-studio/l10n/fr.json +117 -6
- package/templates/yoga-studio/l10n/he.json +96 -5
- package/templates/yoga-studio/l10n/hu.json +117 -6
- package/templates/yoga-studio/l10n/id.json +117 -6
- package/templates/yoga-studio/l10n/it.json +117 -6
- package/templates/yoga-studio/l10n/ja.json +117 -6
- package/templates/yoga-studio/l10n/ko.json +117 -6
- package/templates/yoga-studio/l10n/lt.json +117 -6
- package/templates/yoga-studio/l10n/nl.json +117 -6
- package/templates/yoga-studio/l10n/no.json +117 -6
- package/templates/yoga-studio/l10n/pl.json +117 -6
- package/templates/yoga-studio/l10n/pt.json +117 -6
- package/templates/yoga-studio/l10n/ru.json +117 -6
- package/templates/yoga-studio/l10n/sv.json +117 -6
- package/templates/yoga-studio/l10n/th.json +117 -6
- package/templates/yoga-studio/l10n/tr.json +117 -6
- package/templates/yoga-studio/l10n/uk.json +117 -6
- package/templates/yoga-studio/l10n/vi.json +117 -6
- package/templates/yoga-studio/l10n/zh.json +117 -6
- package/templates/yoga-studio/tier5-src/_shared/about-text.ts +8 -0
- package/templates/yoga-studio/tier5-src/wix-spaces-member-detail/index.ts +769 -0
- package/templates/beauty-salon/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/branded-lite/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/community-club/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/events-meetups/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/gym-fitness/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/nonprofit-cause/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/personal-fitness-trainer/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/podcast-creator/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/portfolio-creative/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/restaurant/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/retail-store/tier5-src/wix-spaces-view-profile/index.ts +0 -119
- package/templates/yoga-studio/tier5-src/wix-spaces-view-profile/index.ts +0 -119
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
// Tier-5 bundle: Wix Spaces clone — Member detail (ON-DEVICE, site-scoped, REAL writes).
|
|
2
|
+
// himalaya.input.id carries the member id. load() reads the header first (getMember, the only read that
|
|
3
|
+
// can fail the screen), then About, badges and posts in parallel: each secondary read hides its own
|
|
4
|
+
// section when it fails or comes back empty, and never touches the header or the buttons.
|
|
5
|
+
// The Follow control reflects the live relationship (getFollowCounts + isFollowingMember, each read
|
|
6
|
+
// defensively, so a 403 never blanks the screen); toggleFollow writes through the real Members v3
|
|
7
|
+
// MemberFollowers API. A visitor never writes: Follow opens sign-in (the descriptor routes it).
|
|
8
|
+
//
|
|
9
|
+
// `self: "1"` (himi_view_profile) shows the SIGNED-IN member's own profile instead: the id comes from
|
|
10
|
+
// getMyMember, never from input; a private profile is still shown (it is the reader's own); a visitor
|
|
11
|
+
// gets the Sign in state and makes no member read. Self mode also reads the member's groups and gives
|
|
12
|
+
// the About section its own states (content / empty / failed) and a 5-line collapsed form.
|
|
13
|
+
import { classifyLoadError, defineService } from "@himalaya/state";
|
|
14
|
+
import { share as shareSheet } from "@himalaya/share";
|
|
15
|
+
import { snackbar as showSnackbar } from "@himalaya/ui";
|
|
16
|
+
import {
|
|
17
|
+
getMember,
|
|
18
|
+
getMyMember,
|
|
19
|
+
followMember,
|
|
20
|
+
unfollowMember,
|
|
21
|
+
getFollowCounts,
|
|
22
|
+
isFollowingMember,
|
|
23
|
+
queryMemberAbouts,
|
|
24
|
+
type WixMember,
|
|
25
|
+
} from "@himalaya/wix-members";
|
|
26
|
+
import { query as queryBadges, queryBadgeAssignments } from "@himalaya/wix-badges";
|
|
27
|
+
import { queryPosts as queryBlogPosts, type WixPost as WixBlogPost } from "@himalaya/wix-blog";
|
|
28
|
+
import { queryPosts as queryForumPosts, type WixPost as WixForumPost } from "@himalaya/wix-forum";
|
|
29
|
+
import { getGroup, listMemberships, type WixGroup, type WixGroupMembership } from "@himalaya/wix-groups";
|
|
30
|
+
import { aboutPlainText } from "../_shared/about-text.js";
|
|
31
|
+
import { wixMediaUrl } from "@himalaya/wix-media";
|
|
32
|
+
import { formatDateMedium, formatMonthYear } from "../_shared/engine-intl.js";
|
|
33
|
+
import { appLocale } from "../_shared/app-locale.js";
|
|
34
|
+
import { copyParam, copyTemplate, stashCopy } from "../_shared/himi-copy.js";
|
|
35
|
+
import { presence, presenceAfterError, detailInputId, isNotFoundError, type PresenceFlags } from "../_shared/detail-presence.js";
|
|
36
|
+
import { groupMemberCount } from "../_shared/group-member-count.js";
|
|
37
|
+
import { groupImage } from "../_shared/himi-media.js";
|
|
38
|
+
|
|
39
|
+
import { readAccess, readAccessDenied, readSignInFlags, signInError, NO_READ_SIGN_IN, type ReadAccess } from "../_shared/member-read.js";
|
|
40
|
+
import { memberAccess, memberAccessChanged } from "../_shared/member-access.js";
|
|
41
|
+
|
|
42
|
+
const POST_LIMIT = 3;
|
|
43
|
+
const GROUP_LIMIT = 10;
|
|
44
|
+
const MEMBERSHIP_PAGE_LIMIT = 50;
|
|
45
|
+
// The descriptor's 64pt square preview at up to 3x density.
|
|
46
|
+
const POST_THUMB_IMAGE = { width: 192, height: 192 };
|
|
47
|
+
/** The collapsed About holds 5 lines; a longer text gets Show more. Approximated from the text, because a
|
|
48
|
+
* worker cannot measure: about 45 characters per line at the phone's footnote size. */
|
|
49
|
+
const ABOUT_LINES = 5;
|
|
50
|
+
const ABOUT_CHARS_PER_LINE = 45;
|
|
51
|
+
|
|
52
|
+
interface PostRow {
|
|
53
|
+
id: string;
|
|
54
|
+
title: string;
|
|
55
|
+
meta: string;
|
|
56
|
+
thumb: string;
|
|
57
|
+
/** No preview image: the row hides its thumbnail slot instead of an empty box. */
|
|
58
|
+
noThumb: boolean;
|
|
59
|
+
}
|
|
60
|
+
interface BadgeRow { id: string; title: string }
|
|
61
|
+
interface GroupRow { id: string; title: string; meta: string; image: string; initial: string; noImage: boolean; hasImage: boolean }
|
|
62
|
+
/** The self-mode About section: not read yet, read with text, read with no text, or the read failed. */
|
|
63
|
+
type AboutPhase = "pending" | "content" | "empty" | "failed";
|
|
64
|
+
|
|
65
|
+
interface S extends PresenceFlags {
|
|
66
|
+
signInRequired: boolean; noSignIn: boolean;
|
|
67
|
+
status: "loading" | "ready";
|
|
68
|
+
id: string;
|
|
69
|
+
name: string;
|
|
70
|
+
initial: string;
|
|
71
|
+
photo: string;
|
|
72
|
+
joined: string;
|
|
73
|
+
hasJoined: boolean;
|
|
74
|
+
slug: string;
|
|
75
|
+
shareUrl: string;
|
|
76
|
+
/** Hides the top-bar Share action once a loaded member turns out to have no public profile page. */
|
|
77
|
+
noShare: boolean;
|
|
78
|
+
isFollowing: boolean;
|
|
79
|
+
followers: number | null;
|
|
80
|
+
following: number | null;
|
|
81
|
+
followCount: string;
|
|
82
|
+
/** Backward-compatible label used by the wix-spaces-clone fixture. */
|
|
83
|
+
followLabel: string;
|
|
84
|
+
followBusy: boolean;
|
|
85
|
+
/** True for a visitor: Follow and Message open sign-in instead of acting. */
|
|
86
|
+
isGuest: boolean;
|
|
87
|
+
/** `server` or `offline`, only meaningful while the load has failed. */
|
|
88
|
+
errorVariant: string;
|
|
89
|
+
hasAbout: boolean;
|
|
90
|
+
aboutJson: string;
|
|
91
|
+
hasBadges: boolean;
|
|
92
|
+
badges: BadgeRow[];
|
|
93
|
+
hasBlogPosts: boolean;
|
|
94
|
+
blogPosts: PostRow[];
|
|
95
|
+
hasForumPosts: boolean;
|
|
96
|
+
forumPosts: PostRow[];
|
|
97
|
+
/** One-shot snackbar after a failed follow write. */
|
|
98
|
+
snackbarMessage: string;
|
|
99
|
+
noSnackbar: boolean;
|
|
100
|
+
/** The Follow / Following swap, and the guest variant of Follow. */
|
|
101
|
+
hideFollow: boolean;
|
|
102
|
+
hideFollowing: boolean;
|
|
103
|
+
/** Section gates, the negation of the `has*` flags. */
|
|
104
|
+
hideAbout: boolean;
|
|
105
|
+
hideBadges: boolean;
|
|
106
|
+
hideBlogPosts: boolean;
|
|
107
|
+
hideForumPosts: boolean;
|
|
108
|
+
hideCounts: boolean;
|
|
109
|
+
hideJoined: boolean;
|
|
110
|
+
/** Visitor buttons (open sign-in) and member buttons (act) never show together. */
|
|
111
|
+
hideGuestActions: boolean;
|
|
112
|
+
hideMemberActions: boolean;
|
|
113
|
+
/** The retryable ErrorState: hidden unless the load failed for a reason other than sign-in. */
|
|
114
|
+
hideError: boolean;
|
|
115
|
+
unfollowTitle: string;
|
|
116
|
+
// ── Self mode (himi_view_profile) ──
|
|
117
|
+
/** The member's profile title ("Yoga teacher"); hidden when empty. */
|
|
118
|
+
title: string;
|
|
119
|
+
hideTitle: boolean;
|
|
120
|
+
/** The two counts as separate numbers for the hero's Following | Followers row; the row hides when both are unknown. */
|
|
121
|
+
followersNumber: string;
|
|
122
|
+
followingNumber: string;
|
|
123
|
+
hideCountRow: boolean;
|
|
124
|
+
hideFollowersNumber: boolean;
|
|
125
|
+
hideFollowingNumber: boolean;
|
|
126
|
+
/** The rule between the two counts: only when both are known (Wix can answer one direction only). */
|
|
127
|
+
hideCountDivider: boolean;
|
|
128
|
+
aboutPhase: AboutPhase;
|
|
129
|
+
/** The About as plain text, for the collapsed 5-line form. */
|
|
130
|
+
aboutPlain: string;
|
|
131
|
+
aboutLong: boolean;
|
|
132
|
+
aboutExpanded: boolean;
|
|
133
|
+
/** About section gates: the whole section, the full rich text, the collapsed text, Show more / Show less, empty, failed. */
|
|
134
|
+
hideAboutSection: boolean;
|
|
135
|
+
hideAboutRich: boolean;
|
|
136
|
+
hideAboutCollapsed: boolean;
|
|
137
|
+
hideAboutMore: boolean;
|
|
138
|
+
hideAboutLess: boolean;
|
|
139
|
+
hideAboutEmpty: boolean;
|
|
140
|
+
hideAboutFailed: boolean;
|
|
141
|
+
hasGroups: boolean;
|
|
142
|
+
groups: GroupRow[];
|
|
143
|
+
hideGroups: boolean;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function name(m: WixMember): string {
|
|
147
|
+
const nick = m.profile?.nickname?.trim();
|
|
148
|
+
if (nick) return nick;
|
|
149
|
+
const full = [m.contact?.firstName, m.contact?.lastName].filter(Boolean).join(" ").trim();
|
|
150
|
+
return full || "Member";
|
|
151
|
+
}
|
|
152
|
+
/** Each counter on its own: a missing one is hidden, never shown as 0, and an explicit 0 stays visible. */
|
|
153
|
+
function followCountFor(followers: number | null, following: number | null): string {
|
|
154
|
+
return [
|
|
155
|
+
followers === null ? "" : followers === 1 ? copyParam("member.followers.one", "1 follower") : copyTemplate("member.followers.other", "{count} followers", { count: followers }),
|
|
156
|
+
following === null ? "" : copyTemplate("member.following", "{count} following", { count: following }),
|
|
157
|
+
].filter(Boolean).join(" · ");
|
|
158
|
+
}
|
|
159
|
+
/** An About has content when a node holds text or media; a cleared About leaves empty paragraphs behind. */
|
|
160
|
+
function hasAboutContent(nodes: unknown[]): boolean {
|
|
161
|
+
return nodes.some((n) => {
|
|
162
|
+
const node = n as { type?: string; textData?: { text?: string }; nodes?: unknown[] } | null;
|
|
163
|
+
if (!node || typeof node !== "object") return false;
|
|
164
|
+
if (typeof node.textData?.text === "string" && node.textData.text.trim()) return true;
|
|
165
|
+
if (["IMAGE", "VIDEO", "GALLERY", "GIF", "FILE"].includes(String(node.type))) return true;
|
|
166
|
+
return Array.isArray(node.nodes) && hasAboutContent(node.nodes);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
/** More than ABOUT_LINES lines at the phone's width: each paragraph takes at least one line. */
|
|
170
|
+
function aboutIsLong(plain: string): boolean {
|
|
171
|
+
const lines = plain.split("\n").reduce((sum, p) => sum + Math.max(1, Math.ceil(p.length / ABOUT_CHARS_PER_LINE)), 0);
|
|
172
|
+
return lines > ABOUT_LINES;
|
|
173
|
+
}
|
|
174
|
+
/** "Jul 2026" from the member's createdDate; "" when the date is missing or unreadable. */
|
|
175
|
+
function joinedFor(createdDate: string | undefined): string {
|
|
176
|
+
if (!createdDate) return "";
|
|
177
|
+
const d = new Date(createdDate);
|
|
178
|
+
if (Number.isNaN(d.getTime())) return "";
|
|
179
|
+
const month = formatMonthYear(d, appLocale());
|
|
180
|
+
return copyTemplate("member.joined", "Joined {month}", { month });
|
|
181
|
+
}
|
|
182
|
+
/** `<siteUrl>/profile/<slug>/profile`, the website's own path; "" without a real http(s) site or a slug. */
|
|
183
|
+
export function profileUrl(siteUrl: string, slug: string): string {
|
|
184
|
+
if (!siteUrl || !slug) return "";
|
|
185
|
+
const m = /^(https?):\/\/([^\s/?#\\@]+)((?:\/[^\s?#\\]*)?)(?:[?#].*)?$/i.exec(siteUrl);
|
|
186
|
+
if (!m) return "";
|
|
187
|
+
return `${m[1].toLowerCase()}://${m[2].toLowerCase()}${m[3].replace(/\/$/, "")}/profile/${encodeURIComponent(slug)}/profile`;
|
|
188
|
+
}
|
|
189
|
+
function derive(s: S): S {
|
|
190
|
+
const followCount = followCountFor(s.followers, s.following);
|
|
191
|
+
return {
|
|
192
|
+
...s,
|
|
193
|
+
hideFollow: s.isGuest || s.isFollowing, hideFollowing: s.isGuest || !s.isFollowing,
|
|
194
|
+
hideGuestActions: !s.isGuest, hideMemberActions: s.isGuest,
|
|
195
|
+
hideError: s.hideLoadError || s.signInRequired,
|
|
196
|
+
unfollowTitle: copyTemplate("member.unfollowTitle", "Unfollow {name}?", { name: s.name }),
|
|
197
|
+
hideAbout: !s.hasAbout, hideBadges: !s.hasBadges, hideBlogPosts: !s.hasBlogPosts, hideForumPosts: !s.hasForumPosts,
|
|
198
|
+
hideCounts: !followCount, hideJoined: !s.hasJoined,
|
|
199
|
+
noSnackbar: !s.snackbarMessage,
|
|
200
|
+
followCount,
|
|
201
|
+
followLabel: s.isFollowing ? "Following ✓" : "Follow",
|
|
202
|
+
...selfFlags(s),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/** The self-mode flags. Each About form is shown by exactly one phase, so loading, content, empty and
|
|
206
|
+
* failed never paint together; Show more / Show less follow the collapsed / expanded form. */
|
|
207
|
+
function selfFlags(s: S): Partial<S> {
|
|
208
|
+
const content = s.aboutPhase === "content";
|
|
209
|
+
const collapsed = content && s.aboutLong && !s.aboutExpanded;
|
|
210
|
+
return {
|
|
211
|
+
hideTitle: !s.title,
|
|
212
|
+
followersNumber: s.followers === null ? "" : String(s.followers),
|
|
213
|
+
followingNumber: s.following === null ? "" : String(s.following),
|
|
214
|
+
hideCountRow: s.followers === null && s.following === null,
|
|
215
|
+
hideFollowersNumber: s.followers === null,
|
|
216
|
+
hideFollowingNumber: s.following === null,
|
|
217
|
+
hideCountDivider: s.followers === null || s.following === null,
|
|
218
|
+
hideAboutSection: s.aboutPhase === "pending",
|
|
219
|
+
hideAboutRich: !content || collapsed,
|
|
220
|
+
hideAboutCollapsed: !collapsed,
|
|
221
|
+
hideAboutMore: !collapsed,
|
|
222
|
+
hideAboutLess: !(content && s.aboutLong && s.aboutExpanded),
|
|
223
|
+
hideAboutEmpty: s.aboutPhase !== "empty",
|
|
224
|
+
hideAboutFailed: s.aboutPhase !== "failed",
|
|
225
|
+
hideGroups: !s.hasGroups,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function postMeta(date: string | undefined, minutes: number | undefined): string {
|
|
229
|
+
const bits: string[] = [];
|
|
230
|
+
if (date) { const d = new Date(date); if (!Number.isNaN(d.getTime())) bits.push(formatDateMedium(d, appLocale())); }
|
|
231
|
+
if (minutes) bits.push(copyTemplate("member.readTime", "{minutes} min read", { minutes }));
|
|
232
|
+
return bits.join(" · ");
|
|
233
|
+
}
|
|
234
|
+
function postRow(id: string, title: string | undefined, meta: string, thumb: string): PostRow {
|
|
235
|
+
return { id, title: title || "", meta, thumb, noThumb: !thumb };
|
|
236
|
+
}
|
|
237
|
+
function blogRow(p: WixBlogPost): PostRow {
|
|
238
|
+
const m = p.media;
|
|
239
|
+
return postRow(p.id, p.title, postMeta(p.firstPublishedDate, p.minutesToRead), wixMediaUrl(m?.wixMedia?.image?.url, POST_THUMB_IMAGE) || wixMediaUrl(m?.embedMedia?.thumbnail?.url, POST_THUMB_IMAGE));
|
|
240
|
+
}
|
|
241
|
+
function forumRow(p: WixForumPost): PostRow {
|
|
242
|
+
const first = (p.images ?? [])[0] as { url?: string } | string | undefined;
|
|
243
|
+
return postRow(p.id, p.title, postMeta(p.createdDate, undefined), wixMediaUrl(typeof first === "string" ? first : first?.url, POST_THUMB_IMAGE));
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const INITIAL: S = derive({
|
|
247
|
+
status: "loading",
|
|
248
|
+
id: "",
|
|
249
|
+
name: "",
|
|
250
|
+
initial: "",
|
|
251
|
+
photo: "",
|
|
252
|
+
joined: "",
|
|
253
|
+
hasJoined: false,
|
|
254
|
+
slug: "",
|
|
255
|
+
shareUrl: "",
|
|
256
|
+
noShare: true,
|
|
257
|
+
isFollowing: false,
|
|
258
|
+
followers: null,
|
|
259
|
+
following: null,
|
|
260
|
+
followCount: "",
|
|
261
|
+
followLabel: "Follow",
|
|
262
|
+
followBusy: false,
|
|
263
|
+
isGuest: true,
|
|
264
|
+
errorVariant: "server",
|
|
265
|
+
hasAbout: false,
|
|
266
|
+
aboutJson: "",
|
|
267
|
+
hasBadges: false,
|
|
268
|
+
badges: [],
|
|
269
|
+
hasBlogPosts: false,
|
|
270
|
+
blogPosts: [],
|
|
271
|
+
hasForumPosts: false,
|
|
272
|
+
forumPosts: [],
|
|
273
|
+
snackbarMessage: "",
|
|
274
|
+
noSnackbar: true,
|
|
275
|
+
hideFollow: false,
|
|
276
|
+
hideFollowing: true,
|
|
277
|
+
hideAbout: true,
|
|
278
|
+
hideBadges: true,
|
|
279
|
+
hideBlogPosts: true,
|
|
280
|
+
hideForumPosts: true,
|
|
281
|
+
hideCounts: true,
|
|
282
|
+
hideJoined: true,
|
|
283
|
+
hideGuestActions: false,
|
|
284
|
+
hideMemberActions: true,
|
|
285
|
+
hideError: true,
|
|
286
|
+
unfollowTitle: "",
|
|
287
|
+
title: "",
|
|
288
|
+
hideTitle: true,
|
|
289
|
+
followersNumber: "",
|
|
290
|
+
followingNumber: "",
|
|
291
|
+
hideCountRow: true,
|
|
292
|
+
hideFollowersNumber: true,
|
|
293
|
+
hideFollowingNumber: true,
|
|
294
|
+
hideCountDivider: true,
|
|
295
|
+
aboutPhase: "pending",
|
|
296
|
+
aboutPlain: "",
|
|
297
|
+
aboutLong: false,
|
|
298
|
+
aboutExpanded: false,
|
|
299
|
+
hideAboutSection: true,
|
|
300
|
+
hideAboutRich: true,
|
|
301
|
+
hideAboutCollapsed: true,
|
|
302
|
+
hideAboutMore: true,
|
|
303
|
+
hideAboutLess: true,
|
|
304
|
+
hideAboutEmpty: true,
|
|
305
|
+
hideAboutFailed: true,
|
|
306
|
+
hasGroups: false,
|
|
307
|
+
groups: [],
|
|
308
|
+
hideGroups: true,
|
|
309
|
+
...presence("loading"), ...NO_READ_SIGN_IN,
|
|
310
|
+
});
|
|
311
|
+
let loadVersion = 0;
|
|
312
|
+
let followRevision = 0;
|
|
313
|
+
let loadedAccess: ReadAccess | undefined;
|
|
314
|
+
let cachedAccess: ReadAccess | undefined;
|
|
315
|
+
// The session bit counts too: self mode accepts a signed-in session whose email has not arrived, so email and
|
|
316
|
+
// scope alone ("" before and after) cannot tell that session from a sign-out.
|
|
317
|
+
function sameAccess(a: ReadAccess | undefined, b: ReadAccess | undefined): boolean {
|
|
318
|
+
return !!a && !!b && a.tenant === b.tenant && a.member.scope === b.member.scope && a.member.email === b.member.email
|
|
319
|
+
&& a.member.signedIn === b.member.signedIn;
|
|
320
|
+
}
|
|
321
|
+
/** The shared read check with the session bit: one identity read, compared field by field by sameAccess. */
|
|
322
|
+
async function assertReadAccess(access: ReadAccess): Promise<void> {
|
|
323
|
+
if (!sameAccess(await readAccess(), access)) throw memberAccessChanged();
|
|
324
|
+
}
|
|
325
|
+
let siteUrlParam = "";
|
|
326
|
+
let sectionsEnabled = false;
|
|
327
|
+
let blogEnabled = false;
|
|
328
|
+
let forumEnabled = false;
|
|
329
|
+
let groupsEnabled = false;
|
|
330
|
+
/** Badges show by default (a site's badges need no Badges screen); an app that drops the section turns the read off. */
|
|
331
|
+
let badgesEnabled = true;
|
|
332
|
+
/** Self mode: the signed-in member's own profile. `selfId` is that member's id, learned from getMyMember. */
|
|
333
|
+
let selfMode = false;
|
|
334
|
+
let selfId = "";
|
|
335
|
+
const pendingFollows = new Set<string>();
|
|
336
|
+
|
|
337
|
+
/** The member this screen shows: the reader in self mode, else the id the host baked into the screen. */
|
|
338
|
+
function targetId(): string {
|
|
339
|
+
return selfMode ? selfId : detailInputId();
|
|
340
|
+
}
|
|
341
|
+
function groupRow(group: WixGroup, membership: WixGroupMembership): GroupRow {
|
|
342
|
+
const title = (group.name || copyParam("groups.groupFallbackName", "Group")).trim();
|
|
343
|
+
const count = group.membersCount ?? group.memberCount;
|
|
344
|
+
const image = groupImage(group);
|
|
345
|
+
return { id: String(membership.groupId), title, meta: typeof count === "number" ? groupMemberCount(count) : "", image, initial: (title[0] || "G").toUpperCase(), noImage: !image, hasImage: !!image };
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/** Use the shared classifier so programming errors are never called connectivity failures. */
|
|
349
|
+
function errorVariantOf(e: unknown): string {
|
|
350
|
+
return classifyLoadError(e) === "offline" ? "offline" : "server";
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const svc = defineService<S, {
|
|
354
|
+
prepare: (s: S, context?: { access: ReadAccess; cached?: S }) => S;
|
|
355
|
+
load: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
356
|
+
retry: (s: S) => Promise<S | undefined>;
|
|
357
|
+
toggleFollow: (s: S) => Promise<S | undefined>;
|
|
358
|
+
follow: (s: S) => Promise<S | undefined>;
|
|
359
|
+
unfollow: (s: S) => Promise<S | undefined>;
|
|
360
|
+
resetToSkeleton: (s: S) => S;
|
|
361
|
+
retryFollow: (s: S, arg?: unknown) => Promise<S | undefined>;
|
|
362
|
+
share: (s: S) => Promise<S | undefined>;
|
|
363
|
+
applySections: (s: S) => S | undefined;
|
|
364
|
+
setBusy: (s: S, busy: boolean) => S;
|
|
365
|
+
syncBusy: (s: S) => S;
|
|
366
|
+
toggleAbout: (s: S) => S;
|
|
367
|
+
retryAbout: (s: S) => Promise<S | undefined>;
|
|
368
|
+
}>("spacesMemberDetail", {
|
|
369
|
+
state: INITIAL,
|
|
370
|
+
// Member data stays off the disk snapshot: self mode holds the signed-in member's own profile, private or not.
|
|
371
|
+
// Nothing is lost: `prepare` keeps a cached profile only for an access verified in this run (cachedAccess).
|
|
372
|
+
notPersisted: Object.keys(INITIAL) as (keyof S)[],
|
|
373
|
+
notHydrated: Object.keys(INITIAL) as (keyof S)[],
|
|
374
|
+
actions: {
|
|
375
|
+
// A revisit keeps the cached profile on screen: only the first load starts from the skeleton.
|
|
376
|
+
prepare: (_s, context) => {
|
|
377
|
+
const { access, cached } = context ?? {};
|
|
378
|
+
const keep = cached?.found && cached.id === targetId() && sameAccess(cachedAccess, access);
|
|
379
|
+
// Cached content becomes actionable again only after the same reader/site has been verified.
|
|
380
|
+
loadedAccess = keep ? access : undefined;
|
|
381
|
+
if (!keep) cachedAccess = undefined;
|
|
382
|
+
return derive(keep ? { ...cached, ...sectionsOf(cached), snackbarMessage: "" } : { ...INITIAL });
|
|
383
|
+
},
|
|
384
|
+
resetToSkeleton: (): S => ({ ...INITIAL }),
|
|
385
|
+
load: async (s, arg): Promise<S | undefined> => {
|
|
386
|
+
stashCopy(arg);
|
|
387
|
+
if (arg && typeof arg === "object") {
|
|
388
|
+
const a = arg as Record<string, unknown>;
|
|
389
|
+
if (typeof a.siteUrl === "string") siteUrlParam = a.siteUrl.trim();
|
|
390
|
+
sectionsEnabled = a.sections === "1" || a.sections === true;
|
|
391
|
+
if (a.blog !== undefined) blogEnabled = a.blog === "1" || a.blog === true;
|
|
392
|
+
if (a.forum !== undefined) forumEnabled = a.forum === "1" || a.forum === true;
|
|
393
|
+
if (a.groups !== undefined) groupsEnabled = a.groups === "1" || a.groups === true;
|
|
394
|
+
if (a.badges !== undefined) badgesEnabled = a.badges === "1" || a.badges === true;
|
|
395
|
+
selfMode = a.self === "1" || a.self === true;
|
|
396
|
+
}
|
|
397
|
+
const version = ++loadVersion;
|
|
398
|
+
// Self mode learns the id from getMyMember below; until then it is the last reader's id (or "").
|
|
399
|
+
let id = targetId();
|
|
400
|
+
// The bridge may be resolving a different reader even for the same profile ID.
|
|
401
|
+
// Keep the cache private until identity is known; restore it before the network re-read
|
|
402
|
+
// for the same reader, so pending member/relationship reads still allow cached actions.
|
|
403
|
+
loadedAccess = undefined;
|
|
404
|
+
await svc.resetToSkeleton();
|
|
405
|
+
if (version !== loadVersion) return undefined;
|
|
406
|
+
if (!id && !selfMode) return { ...INITIAL, status: "ready", noShare: true, ...presence("missing") };
|
|
407
|
+
let access: ReadAccess | undefined;
|
|
408
|
+
let prior: S | undefined;
|
|
409
|
+
try {
|
|
410
|
+
access = await readAccess();
|
|
411
|
+
if (version !== loadVersion) return undefined;
|
|
412
|
+
await svc.prepare({ access, cached: s });
|
|
413
|
+
const prepared = svc.getState();
|
|
414
|
+
prior = prepared.found && prepared.id === id ? prepared : undefined;
|
|
415
|
+
const followAtStart = followRevision;
|
|
416
|
+
let m: WixMember;
|
|
417
|
+
if (selfMode) {
|
|
418
|
+
// A visitor owns no profile: the Sign in state, and no member read at all. A session whose email has
|
|
419
|
+
// not arrived yet is still a member (as the Profile tab's session check counts it).
|
|
420
|
+
if (!access.member.signedIn) throw signInError();
|
|
421
|
+
const mine = await getMyMember({ fieldsets: ["FULL"] });
|
|
422
|
+
// A newer load (another member) may have started: this answer must not become the profile's id.
|
|
423
|
+
if (version !== loadVersion) return undefined;
|
|
424
|
+
m = ((mine as unknown as { member?: WixMember }).member) ?? (mine as unknown as WixMember);
|
|
425
|
+
if (!m?.id) throw new Error("The signed-in member could not be read.");
|
|
426
|
+
id = selfId = String(m.id);
|
|
427
|
+
if (prior && prior.id !== id) prior = undefined;
|
|
428
|
+
} else {
|
|
429
|
+
const res = await getMember(id);
|
|
430
|
+
m = ((res as unknown as { member?: WixMember }).member) ?? (res as unknown as WixMember);
|
|
431
|
+
}
|
|
432
|
+
const n = name(m);
|
|
433
|
+
// Anonymous public reads may omit status fields (UNKNOWN). Explicit refusals hide the profile.
|
|
434
|
+
// The reader's own profile is shown whatever its privacy: only its owner sees this screen.
|
|
435
|
+
const known = (v: string | undefined): v is string => !!v && v !== "UNKNOWN";
|
|
436
|
+
if (!selfMode && ((known(m.privacyStatus) && m.privacyStatus !== "PUBLIC") || (known(m.status) && m.status !== "APPROVED"))) {
|
|
437
|
+
await assertReadAccess(access);
|
|
438
|
+
if (version !== loadVersion) return undefined;
|
|
439
|
+
loadedAccess = undefined;
|
|
440
|
+
cachedAccess = undefined;
|
|
441
|
+
sections = {};
|
|
442
|
+
return { ...INITIAL, status: "ready", id, ...presence("missing") };
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
// A forbidden/missing aggregate is unknown, while the public profile
|
|
447
|
+
// remains readable. The descriptor collapses an empty count label.
|
|
448
|
+
let followers: number | null = null;
|
|
449
|
+
let following: number | null = null;
|
|
450
|
+
try {
|
|
451
|
+
const counts = await getFollowCounts(id);
|
|
452
|
+
followers = counts.followers;
|
|
453
|
+
following = counts.following;
|
|
454
|
+
} catch { /* unavailable counts stay hidden */ }
|
|
455
|
+
|
|
456
|
+
let isFollowing = false;
|
|
457
|
+
if (!selfMode) {
|
|
458
|
+
try {
|
|
459
|
+
isFollowing = await isFollowingMember(id);
|
|
460
|
+
} catch { /* default false */ }
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
await assertReadAccess(access);
|
|
464
|
+
if (version !== loadVersion) return undefined;
|
|
465
|
+
// A cached Follow/Unfollow may finish while these reads are pending. Re-read
|
|
466
|
+
// rather than let their older relationship/counts undo the confirmed write.
|
|
467
|
+
if (followAtStart !== followRevision) return svc.load();
|
|
468
|
+
loadedAccess = access;
|
|
469
|
+
cachedAccess = access;
|
|
470
|
+
const slug = m.profile?.slug?.trim() || "";
|
|
471
|
+
const shareUrl = profileUrl(siteUrlParam, slug);
|
|
472
|
+
const joined = joinedFor(m.createdDate);
|
|
473
|
+
// A revisit keeps the sections it already showed until their re-reads land, so nothing shifts.
|
|
474
|
+
const header = derive({
|
|
475
|
+
...INITIAL, ...(prior ? sectionsOf(prior) : {}), status: "ready",
|
|
476
|
+
id,
|
|
477
|
+
name: n,
|
|
478
|
+
initial: (n[0] || "#").toUpperCase(),
|
|
479
|
+
photo: m.profile?.photo?.url || "",
|
|
480
|
+
title: m.profile?.title?.trim() || "",
|
|
481
|
+
joined, hasJoined: !!joined,
|
|
482
|
+
slug, shareUrl, noShare: !shareUrl,
|
|
483
|
+
isFollowing,
|
|
484
|
+
followers,
|
|
485
|
+
following,
|
|
486
|
+
isGuest: !access.member.email,
|
|
487
|
+
followBusy: pendingFollows.has(JSON.stringify([access.tenant, access.member.scope, access.member.email, id])),
|
|
488
|
+
...presence("found"),
|
|
489
|
+
});
|
|
490
|
+
// The header paints now; the secondary sections arrive one by one below.
|
|
491
|
+
sections = {};
|
|
492
|
+
if (sectionsEnabled) void publishSections(id, version, access);
|
|
493
|
+
return header;
|
|
494
|
+
} catch (e) {
|
|
495
|
+
if (version !== loadVersion) return undefined;
|
|
496
|
+
// Only an availability failure for this same reader may retain a cached profile.
|
|
497
|
+
// A refusal, deletion or context switch must clear it.
|
|
498
|
+
let currentAccess = false;
|
|
499
|
+
if (access) {
|
|
500
|
+
try { await assertReadAccess(access); currentAccess = true; } catch { /* changed identity/site */ }
|
|
501
|
+
}
|
|
502
|
+
if (version !== loadVersion) return undefined;
|
|
503
|
+
if (prior && access && currentAccess && !readAccessDenied(e) && !isNotFoundError(e)) {
|
|
504
|
+
loadedAccess = access;
|
|
505
|
+
return derive({ ...prior, snackbarMessage: "", followBusy: pendingFollows.has(JSON.stringify([access.tenant, access.member.scope, access.member.email, id])) });
|
|
506
|
+
}
|
|
507
|
+
loadedAccess = undefined;
|
|
508
|
+
cachedAccess = undefined;
|
|
509
|
+
sections = {};
|
|
510
|
+
const flags = await readSignInFlags(e);
|
|
511
|
+
return version === loadVersion ? derive({ ...INITIAL, status: "ready", id, noShare: true, ...presenceAfterError(e), ...flags, errorVariant: errorVariantOf(e) }) : undefined;
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
retry: async (): Promise<S | undefined> => svc.load(),
|
|
515
|
+
// Directional actions do not reverse a stale Follow/Unfollow tap after relationship state changes.
|
|
516
|
+
follow: async (s): Promise<S | undefined> => s.isFollowing ? undefined : svc.toggleFollow(),
|
|
517
|
+
unfollow: async (s): Promise<S | undefined> => s.isFollowing ? svc.toggleFollow() : undefined,
|
|
518
|
+
// REAL WRITE: two-state toggle. A visitor never reaches it (the descriptor opens sign-in), and a
|
|
519
|
+
// guest that does is ignored. Flips the relationship, then adjusts the follower total.
|
|
520
|
+
toggleFollow: async (s): Promise<S | undefined> => {
|
|
521
|
+
if (!s.found || !s.id) return undefined;
|
|
522
|
+
const access = loadedAccess;
|
|
523
|
+
if (!access || targetId() !== s.id) return undefined;
|
|
524
|
+
if (!access.member.email) return undefined;
|
|
525
|
+
const pendingKey = JSON.stringify([access.tenant, access.member.scope, access.member.email, s.id]);
|
|
526
|
+
if (pendingFollows.has(pendingKey)) return undefined;
|
|
527
|
+
const version = loadVersion;
|
|
528
|
+
const current = () => version === loadVersion && access === loadedAccess && targetId() === s.id;
|
|
529
|
+
// Serialize this reader's writes to one member within this worker, including after
|
|
530
|
+
// navigation back to it. Another member or reader/site can act while this request is
|
|
531
|
+
// pending. Separate worker instances are isolated contexts and cannot share this guard.
|
|
532
|
+
pendingFollows.add(pendingKey);
|
|
533
|
+
// The button is disabled while the write is in flight, at its final size.
|
|
534
|
+
await svc.setBusy(true);
|
|
535
|
+
try {
|
|
536
|
+
await assertReadAccess(access);
|
|
537
|
+
if (!current()) return undefined;
|
|
538
|
+
if (s.isFollowing) await unfollowMember(s.id);
|
|
539
|
+
else await followMember(s.id);
|
|
540
|
+
await assertReadAccess(access);
|
|
541
|
+
if (!current()) {
|
|
542
|
+
// The write is confirmed, but a reload overlapped it and may have read the old
|
|
543
|
+
// relationship. Same reader and member: re-read instead of leaving a stale label.
|
|
544
|
+
if (targetId() === s.id) await svc.load();
|
|
545
|
+
return undefined;
|
|
546
|
+
}
|
|
547
|
+
followRevision++;
|
|
548
|
+
const isFollowing = !s.isFollowing;
|
|
549
|
+
const followers = s.followers === null ? null : Math.max(0, s.followers + (isFollowing ? 1 : -1));
|
|
550
|
+
return derive({ ...svc.getState(), isFollowing, followers, followBusy: false, snackbarMessage: "" });
|
|
551
|
+
} catch {
|
|
552
|
+
// A failed write belongs only to the reader who loaded this profile. Compare explicitly: a
|
|
553
|
+
// context change discards this completion; a failure for the same reader keeps the old state
|
|
554
|
+
// and raises the retry snackbar.
|
|
555
|
+
const now = await readAccess();
|
|
556
|
+
if (now.member.email !== access.member.email || now.member.scope !== access.member.scope || now.tenant !== access.tenant) return undefined;
|
|
557
|
+
if (!current()) return undefined;
|
|
558
|
+
// Imperative presentation is a one-shot event, not persisted screen state that can
|
|
559
|
+
// replay after a remount. The native presenter owns dismissal and Retry routing.
|
|
560
|
+
void showSnackbar({
|
|
561
|
+
message: s.isFollowing ? copyParam("member.unfollowError", "Couldn't unfollow. Try again.") : copyParam("member.followError", "Couldn't follow. Try again."),
|
|
562
|
+
tone: "danger", durationMs: 4000,
|
|
563
|
+
action: { label: copyParam("common.retryCta", "Retry"), actionId: "tier5.spacesMemberDetail.retryFollow", args: { id: s.id, version, following: s.isFollowing } },
|
|
564
|
+
}).catch(() => { /* an unavailable presenter must not fail the worker */ });
|
|
565
|
+
return derive({ ...svc.getState(), followBusy: false, snackbarMessage: "" });
|
|
566
|
+
} finally {
|
|
567
|
+
pendingFollows.delete(pendingKey);
|
|
568
|
+
void svc.syncBusy();
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
retryFollow: async (s, arg): Promise<S | undefined> => {
|
|
572
|
+
const failed = arg as { id?: unknown; version?: unknown; following?: unknown } | undefined;
|
|
573
|
+
if (!failed || failed.id !== s.id || failed.version !== loadVersion || failed.following !== s.isFollowing) return undefined;
|
|
574
|
+
// toggleFollow revalidates the captured reader/site again before issuing the write.
|
|
575
|
+
return svc.toggleFollow();
|
|
576
|
+
},
|
|
577
|
+
applySections: (s) => (s.found && s.id === targetId() ? derive({ ...s, ...sections }) : undefined),
|
|
578
|
+
// Show more / Show less: in place, one tap. Not cached, so the screen opens collapsed again.
|
|
579
|
+
toggleAbout: (s) => derive({ ...s, aboutExpanded: !s.aboutExpanded }),
|
|
580
|
+
// Try again on the About section alone: the section keeps its failed state until the read lands.
|
|
581
|
+
retryAbout: async (s): Promise<S | undefined> => {
|
|
582
|
+
const access = loadedAccess;
|
|
583
|
+
if (!s.found || !access || s.id !== targetId()) return undefined;
|
|
584
|
+
await readAbout(s.id, sectionLander(s.id, loadVersion, access).land);
|
|
585
|
+
return undefined;
|
|
586
|
+
},
|
|
587
|
+
setBusy: (s, busy) => derive({ ...s, followBusy: busy, snackbarMessage: busy ? "" : s.snackbarMessage }),
|
|
588
|
+
syncBusy: (s): S => {
|
|
589
|
+
const access = loadedAccess;
|
|
590
|
+
if (!access || !s.found || s.id !== targetId()) return s;
|
|
591
|
+
return derive({ ...s, followBusy: pendingFollows.has(JSON.stringify([access.tenant, access.member.scope, access.member.email, s.id])) });
|
|
592
|
+
},
|
|
593
|
+
share: async (s): Promise<S | undefined> => {
|
|
594
|
+
const access = loadedAccess;
|
|
595
|
+
const version = loadVersion;
|
|
596
|
+
if (!s.found || !s.shareUrl || !access || targetId() !== s.id) return undefined;
|
|
597
|
+
try {
|
|
598
|
+
await assertReadAccess(access);
|
|
599
|
+
if (version !== loadVersion || loadedAccess !== access || targetId() !== s.id) return undefined;
|
|
600
|
+
await shareSheet({ subject: s.name, url: s.shareUrl });
|
|
601
|
+
} catch { /* changed identity, unavailable presenter or cancellation makes no share */ }
|
|
602
|
+
// A one-shot presentation never writes a captured screen snapshot back after an await.
|
|
603
|
+
return undefined;
|
|
604
|
+
},
|
|
605
|
+
},
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
/** What each secondary read has found so far; `applySections` folds it into the state. */
|
|
609
|
+
let sections: Partial<S> = {};
|
|
610
|
+
function sectionsOf(s: S): Partial<S> {
|
|
611
|
+
return {
|
|
612
|
+
hasAbout: s.hasAbout, aboutJson: s.aboutJson, hasBadges: s.hasBadges, badges: s.badges,
|
|
613
|
+
aboutPhase: s.aboutPhase, aboutPlain: s.aboutPlain, aboutLong: s.aboutLong,
|
|
614
|
+
hasGroups: groupsEnabled && s.hasGroups, groups: groupsEnabled ? s.groups : [],
|
|
615
|
+
// A disabled vertical cannot keep contributing cached content, even on an offline revisit.
|
|
616
|
+
hasBlogPosts: blogEnabled && s.hasBlogPosts, blogPosts: blogEnabled ? s.blogPosts : [],
|
|
617
|
+
hasForumPosts: forumEnabled && s.hasForumPosts, forumPosts: forumEnabled ? s.forumPosts : [],
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/** Each secondary read lands in its own state write, so a slow read never delays another section and a
|
|
622
|
+
* failed one only hides its own. They never change the header or the action row. An availability failure
|
|
623
|
+
* keeps cached content; an authoritative refusal or missing result clears only that section. */
|
|
624
|
+
function sectionLander(id: string, version: number, access: ReadAccess) {
|
|
625
|
+
const still = () => version === loadVersion && targetId() === id && sameAccess(loadedAccess, access);
|
|
626
|
+
const land = async (patch: Partial<S>) => {
|
|
627
|
+
if (!still()) return;
|
|
628
|
+
try { await assertReadAccess(access); }
|
|
629
|
+
catch {
|
|
630
|
+
if (still()) {
|
|
631
|
+
loadedAccess = undefined;
|
|
632
|
+
cachedAccess = undefined;
|
|
633
|
+
sections = {};
|
|
634
|
+
await svc.resetToSkeleton();
|
|
635
|
+
}
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
if (!still()) return;
|
|
639
|
+
sections = { ...sections, ...patch };
|
|
640
|
+
await svc.applySections();
|
|
641
|
+
};
|
|
642
|
+
return { still, land };
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
async function publishSections(id: string, version: number, access: ReadAccess): Promise<void> {
|
|
646
|
+
const { still, land } = sectionLander(id, version, access);
|
|
647
|
+
const reads: Array<Promise<void>> = [];
|
|
648
|
+
reads.push(readAbout(id, land));
|
|
649
|
+
if (badgesEnabled) reads.push((async () => {
|
|
650
|
+
try {
|
|
651
|
+
// Badges v4 (a Visitor can read both): the badges this member holds, then the site's badges that match them.
|
|
652
|
+
// The site's badge list is paged until every held badge is found, so a held badge is never lost past page one.
|
|
653
|
+
const ids = new Set<string>();
|
|
654
|
+
let assignmentCursor: string | undefined;
|
|
655
|
+
let assignmentsComplete = false;
|
|
656
|
+
const assignmentCursors = new Set<string>();
|
|
657
|
+
for (let page = 0; page < 10; page++) {
|
|
658
|
+
if (!still()) return;
|
|
659
|
+
await assertReadAccess(access);
|
|
660
|
+
if (!still()) return;
|
|
661
|
+
// The cursor encodes the filter, so only the first page carries it (and a follow-up sends no limit).
|
|
662
|
+
const held = await queryBadgeAssignments({ query: assignmentCursor ? { cursorPaging: { cursor: assignmentCursor } } : { filter: { memberId: { $in: [id] } }, cursorPaging: { limit: 100 } } });
|
|
663
|
+
for (const a of held.badgeAssignments ?? []) if (a.badgeId) ids.add(a.badgeId);
|
|
664
|
+
assignmentCursor = held.pagingMetadata?.cursors?.next;
|
|
665
|
+
if (!held.pagingMetadata?.hasNext) { assignmentsComplete = true; break; }
|
|
666
|
+
if (!assignmentCursor || assignmentCursors.has(assignmentCursor)) throw new Error("Badge assignments did not advance");
|
|
667
|
+
assignmentCursors.add(assignmentCursor);
|
|
668
|
+
}
|
|
669
|
+
if (!assignmentsComplete) throw new Error("Badge assignments are longer than the pages read");
|
|
670
|
+
const badges: Array<{ id: string; title: string }> = [];
|
|
671
|
+
let cursor: string | undefined;
|
|
672
|
+
let catalogComplete = ids.size === 0;
|
|
673
|
+
const catalogCursors = new Set<string>();
|
|
674
|
+
for (let page = 0; page < 50 && ids.size > 0; page++) {
|
|
675
|
+
if (!still()) return;
|
|
676
|
+
await assertReadAccess(access);
|
|
677
|
+
if (!still()) return;
|
|
678
|
+
// A follow-up page carries the cursor alone: Badges v4 rejects a limit beside it.
|
|
679
|
+
const res = await queryBadges({ query: { cursorPaging: cursor ? { cursor } : { limit: 100 } } });
|
|
680
|
+
for (const b of res.badges ?? []) if (b.id && ids.has(b.id) && (b.title || "").trim()) {
|
|
681
|
+
badges.push({ id: b.id, title: (b.title as string).trim() });
|
|
682
|
+
ids.delete(b.id);
|
|
683
|
+
}
|
|
684
|
+
cursor = res.pagingMetadata?.cursors?.next;
|
|
685
|
+
if (!res.pagingMetadata?.hasNext || ids.size === 0) { catalogComplete = true; break; }
|
|
686
|
+
if (!cursor || catalogCursors.has(cursor)) throw new Error("Badge catalog did not advance");
|
|
687
|
+
catalogCursors.add(cursor);
|
|
688
|
+
}
|
|
689
|
+
if (!catalogComplete) throw new Error("Badge catalog is longer than the pages read");
|
|
690
|
+
await land({ hasBadges: badges.length > 0, badges });
|
|
691
|
+
} catch (e) {
|
|
692
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasBadges: false, badges: [] });
|
|
693
|
+
}
|
|
694
|
+
})());
|
|
695
|
+
// Self mode only: the groups the reader belongs to. Wix answers memberships for the caller's own id only.
|
|
696
|
+
if (selfMode && groupsEnabled) reads.push((async () => {
|
|
697
|
+
try {
|
|
698
|
+
// A full page (as My Groups reads it): pending requests must not crowd out the joined groups shown, and a
|
|
699
|
+
// group listed twice is shown once (its id keys the carousel card).
|
|
700
|
+
const res = await listMemberships(id, { limit: MEMBERSHIP_PAGE_LIMIT });
|
|
701
|
+
const seen = new Set<string>();
|
|
702
|
+
const memberships = ((res as { memberships?: WixGroupMembership[] }).memberships ?? [])
|
|
703
|
+
.filter((m) => {
|
|
704
|
+
if (typeof m?.groupId !== "string" || !m.groupId || (m.status ?? "").toUpperCase() !== "JOINED" || seen.has(m.groupId)) return false;
|
|
705
|
+
seen.add(m.groupId);
|
|
706
|
+
return true;
|
|
707
|
+
})
|
|
708
|
+
.slice(0, GROUP_LIMIT);
|
|
709
|
+
const reads = await Promise.allSettled(memberships.map((m) => getGroup(String(m.groupId))));
|
|
710
|
+
const rows: GroupRow[] = [];
|
|
711
|
+
reads.forEach((read, i) => {
|
|
712
|
+
if (read.status !== "fulfilled") return;
|
|
713
|
+
// Social Groups wraps the entity as `{ group }`; the typed signature claims a bare group.
|
|
714
|
+
const group = ((read.value as unknown as { group?: WixGroup }).group ?? read.value) as WixGroup;
|
|
715
|
+
if (group && typeof group === "object") rows.push(groupRow(group, memberships[i]));
|
|
716
|
+
});
|
|
717
|
+
await land({ hasGroups: rows.length > 0, groups: rows });
|
|
718
|
+
} catch (e) {
|
|
719
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasGroups: false, groups: [] });
|
|
720
|
+
}
|
|
721
|
+
})());
|
|
722
|
+
if (blogEnabled) reads.push((async () => {
|
|
723
|
+
try {
|
|
724
|
+
const res = await queryBlogPosts({ query: { filter: { memberId: id }, paging: { limit: POST_LIMIT } } });
|
|
725
|
+
const rows = (res.posts ?? []).slice(0, POST_LIMIT).filter((p) => p.id).map(blogRow);
|
|
726
|
+
await land({ hasBlogPosts: rows.length > 0, blogPosts: rows });
|
|
727
|
+
} catch (e) {
|
|
728
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasBlogPosts: false, blogPosts: [] });
|
|
729
|
+
}
|
|
730
|
+
})());
|
|
731
|
+
if (forumEnabled) reads.push((async () => {
|
|
732
|
+
try {
|
|
733
|
+
const res = await queryForumPosts({ filter: { ownerId: { $eq: id } }, paging: { limit: POST_LIMIT } });
|
|
734
|
+
const rows = (res.posts ?? []).filter((p) => p.id && p.ownerId === id).slice(0, POST_LIMIT).map(forumRow);
|
|
735
|
+
await land({ hasForumPosts: rows.length > 0, forumPosts: rows });
|
|
736
|
+
} catch (e) {
|
|
737
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasForumPosts: false, forumPosts: [] });
|
|
738
|
+
}
|
|
739
|
+
})());
|
|
740
|
+
await Promise.all(reads);
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
/** The About read, also run alone by `retryAbout`. On the member profile a failure that is not a refusal
|
|
744
|
+
* keeps what the section showed. Self mode gives the section its own verdict instead: text, no text
|
|
745
|
+
* (the empty state invites the member to add one), or failed (Try again — never the empty state, so a
|
|
746
|
+
* member is not invited to write over a text that merely failed to load). */
|
|
747
|
+
async function readAbout(id: string, land: (patch: Partial<S>) => Promise<void>): Promise<void> {
|
|
748
|
+
try {
|
|
749
|
+
const res = await queryMemberAbouts({ query: { filter: { memberId: id } } });
|
|
750
|
+
const content = res.memberAbouts?.find((a) => a.memberId === id || !a.memberId)?.content;
|
|
751
|
+
const nodes = (content as { nodes?: unknown[] } | undefined)?.nodes;
|
|
752
|
+
if (content && Array.isArray(nodes) && hasAboutContent(nodes)) {
|
|
753
|
+
const aboutPlain = aboutPlainText(content);
|
|
754
|
+
await land({ hasAbout: true, aboutJson: JSON.stringify(content), aboutPhase: "content", aboutPlain, aboutLong: aboutIsLong(aboutPlain) });
|
|
755
|
+
} else {
|
|
756
|
+
await land({ hasAbout: false, aboutJson: "", aboutPhase: "empty", aboutPlain: "", aboutLong: false });
|
|
757
|
+
}
|
|
758
|
+
} catch (e) {
|
|
759
|
+
if (readAccessDenied(e) || isNotFoundError(e)) await land({ hasAbout: false, aboutJson: "", aboutPhase: selfMode ? "failed" : "empty", aboutPlain: "", aboutLong: false });
|
|
760
|
+
else if (selfMode) await land({ aboutPhase: "failed" });
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// A host older than `hydrationOptOut` ignores notPersisted/notHydrated and restores the whole snapshot: reset it
|
|
765
|
+
// before anything paints, so a previous member's profile never shows (as wix-spaces-view-profile does).
|
|
766
|
+
if (!(globalThis as { himalaya?: { hydrationOptOut?: boolean } }).himalaya?.hydrationOptOut) Object.assign(svc.getState(), INITIAL);
|
|
767
|
+
svc.prepare();
|
|
768
|
+
svc.load();
|
|
769
|
+
export { svc };
|