@wix/himalaya-cli 0.1767.0 → 0.1769.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-config.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/app-module.d.ts +7 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +9 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/sdui.mjs +1 -0
- package/dist/browser-plane/assets.json +5 -5
- package/dist/browser-plane/preview-deferred/{cba469735852da3b19235ce6d163f0e0bb4fd2e751c0042493147e4d9c143d92.bin → 7977d7340513225ef7609b9983b621e2b48c10deb7427e059e595d2fc66f7983.bin} +1 -1
- package/dist/browser-plane/sw.js +8 -8
- package/dist/cli.mjs +234 -89
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/capabilities.md +6 -4
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +4 -0
- package/guides/himi-json-output.md +19 -7
- package/guides/one-app-to-himi-app.md +19 -9
- package/guides/qa-builds.md +73 -84
- package/package.json +2 -2
- package/templates/beauty-salon/l10n/ar.json +45 -0
- package/templates/beauty-salon/l10n/cs.json +45 -0
- package/templates/beauty-salon/l10n/da.json +45 -0
- package/templates/beauty-salon/l10n/de.json +45 -0
- package/templates/beauty-salon/l10n/el.json +45 -0
- package/templates/beauty-salon/l10n/en.json +1 -1
- package/templates/beauty-salon/l10n/es.json +45 -0
- package/templates/beauty-salon/l10n/fi.json +45 -0
- package/templates/beauty-salon/l10n/fr.json +45 -0
- package/templates/beauty-salon/l10n/he.json +36 -0
- package/templates/beauty-salon/l10n/hu.json +45 -0
- package/templates/beauty-salon/l10n/id.json +45 -0
- package/templates/beauty-salon/l10n/it.json +45 -0
- package/templates/beauty-salon/l10n/ja.json +45 -0
- package/templates/beauty-salon/l10n/ko.json +45 -0
- package/templates/beauty-salon/l10n/lt.json +45 -0
- package/templates/beauty-salon/l10n/nl.json +45 -0
- package/templates/beauty-salon/l10n/no.json +45 -0
- package/templates/beauty-salon/l10n/pl.json +45 -0
- package/templates/beauty-salon/l10n/pt.json +45 -0
- package/templates/beauty-salon/l10n/ru.json +45 -0
- package/templates/beauty-salon/l10n/sv.json +45 -0
- package/templates/beauty-salon/l10n/th.json +45 -0
- package/templates/beauty-salon/l10n/tr.json +45 -0
- package/templates/beauty-salon/l10n/uk.json +45 -0
- package/templates/beauty-salon/l10n/vi.json +45 -0
- package/templates/beauty-salon/l10n/zh.json +45 -0
- package/templates/beauty-salon/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/beauty-salon/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/beauty-salon/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/beauty-salon/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/beauty-salon/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/beauty-salon/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/beauty-salon/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/beauty-salon-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/branded-lite/config.ts +11 -1
- package/templates/branded-lite/dev/index.ts +1088 -86
- package/templates/branded-lite/himalaya.content.json +3 -0
- package/templates/branded-lite/l10n/ar.json +259 -0
- package/templates/branded-lite/l10n/cs.json +259 -0
- package/templates/branded-lite/l10n/da.json +259 -0
- package/templates/branded-lite/l10n/de.json +259 -0
- package/templates/branded-lite/l10n/el.json +259 -0
- package/templates/branded-lite/l10n/en.json +65 -2
- package/templates/branded-lite/l10n/es.json +259 -0
- package/templates/branded-lite/l10n/fi.json +259 -0
- package/templates/branded-lite/l10n/fr.json +259 -0
- package/templates/branded-lite/l10n/he.json +209 -0
- package/templates/branded-lite/l10n/hu.json +259 -0
- package/templates/branded-lite/l10n/id.json +259 -0
- package/templates/branded-lite/l10n/it.json +259 -0
- package/templates/branded-lite/l10n/ja.json +259 -0
- package/templates/branded-lite/l10n/ko.json +259 -0
- package/templates/branded-lite/l10n/lt.json +259 -0
- package/templates/branded-lite/l10n/nl.json +259 -0
- package/templates/branded-lite/l10n/no.json +259 -0
- package/templates/branded-lite/l10n/pl.json +259 -0
- package/templates/branded-lite/l10n/pt.json +259 -0
- package/templates/branded-lite/l10n/ru.json +259 -0
- package/templates/branded-lite/l10n/sv.json +259 -0
- package/templates/branded-lite/l10n/th.json +259 -0
- package/templates/branded-lite/l10n/tr.json +259 -0
- package/templates/branded-lite/l10n/uk.json +259 -0
- package/templates/branded-lite/l10n/vi.json +259 -0
- package/templates/branded-lite/l10n/zh.json +259 -0
- package/templates/branded-lite/recipes/programs-card.json +2 -2
- package/templates/branded-lite/recipes/programs-carousel.json +2 -2
- package/templates/branded-lite/recipes/programs-participant-carousel.json +2 -2
- package/templates/branded-lite/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/branded-lite/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/branded-lite/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/branded-lite/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/branded-lite/tier5-src/_shared/inbox-search.ts +119 -0
- package/templates/branded-lite/tier5-src/_shared/member-inbox-transport.ts +64 -0
- package/templates/branded-lite/tier5-src/_shared/member-thread-rows.ts +233 -0
- package/templates/branded-lite/tier5-src/_shared/program-standing.ts +21 -0
- package/templates/branded-lite/tier5-src/_shared/programs-section.ts +8 -4
- package/templates/branded-lite/tier5-src/business-chat/index.ts +73 -22
- package/templates/branded-lite/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/branded-lite/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-inbox/index.ts +777 -54
- package/templates/branded-lite/tier5-src/himi-branded-lite-member-programs/index.ts +23 -7
- package/templates/branded-lite/tier5-src/himi-branded-lite-program/index.ts +17 -3
- package/templates/branded-lite/tier5-src/himi-branded-lite-program-participant/index.ts +336 -0
- package/templates/branded-lite/tier5-src/himi-branded-lite-program-participant/model.ts +206 -0
- package/templates/branded-lite/tier5-src/wix-spaces-chat-thread/index.ts +426 -143
- package/templates/branded-lite/tier5-src/wix-spaces-new-message/index.ts +4 -2
- package/templates/brandy/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/brandy/tier5-src/_shared/business-chat-message-model.ts +177 -0
- package/templates/brandy/tier5-src/_shared/business-chat-transport.ts +164 -0
- package/templates/brandy/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/brandy/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/brandy/tier5-src/_shared/inbox-search.ts +119 -0
- package/templates/brandy/tier5-src/_shared/member-inbox-transport.ts +64 -0
- package/templates/brandy/tier5-src/_shared/member-thread-rows.ts +233 -0
- package/templates/brandy/tier5-src/himi-branded-lite-inbox/index.ts +777 -54
- package/templates/brandy/tier5-src/wix-spaces-chat-thread/index.ts +426 -143
- package/templates/community-club/l10n/ar.json +30 -0
- package/templates/community-club/l10n/cs.json +30 -0
- package/templates/community-club/l10n/da.json +30 -0
- package/templates/community-club/l10n/de.json +30 -0
- package/templates/community-club/l10n/el.json +30 -0
- package/templates/community-club/l10n/en.json +2 -2
- package/templates/community-club/l10n/es.json +30 -0
- package/templates/community-club/l10n/fi.json +30 -0
- package/templates/community-club/l10n/fr.json +30 -0
- package/templates/community-club/l10n/he.json +24 -0
- package/templates/community-club/l10n/hu.json +30 -0
- package/templates/community-club/l10n/id.json +30 -0
- package/templates/community-club/l10n/it.json +30 -0
- package/templates/community-club/l10n/ja.json +30 -0
- package/templates/community-club/l10n/ko.json +30 -0
- package/templates/community-club/l10n/lt.json +30 -0
- package/templates/community-club/l10n/nl.json +30 -0
- package/templates/community-club/l10n/no.json +30 -0
- package/templates/community-club/l10n/pl.json +30 -0
- package/templates/community-club/l10n/pt.json +30 -0
- package/templates/community-club/l10n/ru.json +30 -0
- package/templates/community-club/l10n/sv.json +30 -0
- package/templates/community-club/l10n/th.json +30 -0
- package/templates/community-club/l10n/tr.json +30 -0
- package/templates/community-club/l10n/uk.json +30 -0
- package/templates/community-club/l10n/vi.json +30 -0
- package/templates/community-club/l10n/zh.json +30 -0
- package/templates/community-club/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/community-club/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/community-club/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/community-club/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/community-club/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/community-club-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/conference/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/conference/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/conference/tier5-src/_shared/chat-live.ts +242 -0
- package/templates/conference/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/conference/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/conference/tier5-src/business-chat/index.ts +73 -22
- package/templates/events-meetups/l10n/ar.json +30 -0
- package/templates/events-meetups/l10n/cs.json +30 -0
- package/templates/events-meetups/l10n/da.json +30 -0
- package/templates/events-meetups/l10n/de.json +30 -0
- package/templates/events-meetups/l10n/el.json +30 -0
- package/templates/events-meetups/l10n/en.json +1 -1
- package/templates/events-meetups/l10n/es.json +30 -0
- package/templates/events-meetups/l10n/fi.json +30 -0
- package/templates/events-meetups/l10n/fr.json +30 -0
- package/templates/events-meetups/l10n/he.json +24 -0
- package/templates/events-meetups/l10n/hu.json +30 -0
- package/templates/events-meetups/l10n/id.json +30 -0
- package/templates/events-meetups/l10n/it.json +30 -0
- package/templates/events-meetups/l10n/ja.json +30 -0
- package/templates/events-meetups/l10n/ko.json +30 -0
- package/templates/events-meetups/l10n/lt.json +30 -0
- package/templates/events-meetups/l10n/nl.json +30 -0
- package/templates/events-meetups/l10n/no.json +30 -0
- package/templates/events-meetups/l10n/pl.json +30 -0
- package/templates/events-meetups/l10n/pt.json +30 -0
- package/templates/events-meetups/l10n/ru.json +30 -0
- package/templates/events-meetups/l10n/sv.json +30 -0
- package/templates/events-meetups/l10n/th.json +30 -0
- package/templates/events-meetups/l10n/tr.json +30 -0
- package/templates/events-meetups/l10n/uk.json +30 -0
- package/templates/events-meetups/l10n/vi.json +30 -0
- package/templates/events-meetups/l10n/zh.json +30 -0
- package/templates/events-meetups/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/events-meetups/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/events-meetups/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/events-meetups/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/events-meetups/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/events-meetups-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/fitness-gym/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/fitness-gym/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/fitness-gym/tier5-src/_shared/chat-live.ts +242 -0
- package/templates/fitness-gym/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/fitness-gym/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/fitness-gym/tier5-src/_shared/program-standing.ts +21 -0
- package/templates/fitness-gym/tier5-src/business-chat/index.ts +73 -22
- package/templates/fitness-gym/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/fitness-gym/tier5-src/himi-branded-lite-member-programs/index.ts +23 -7
- package/templates/fitness-gym/tier5-src/himi-branded-lite-program/index.ts +17 -3
- package/templates/gym-fitness/l10n/ar.json +45 -0
- package/templates/gym-fitness/l10n/cs.json +45 -0
- package/templates/gym-fitness/l10n/da.json +45 -0
- package/templates/gym-fitness/l10n/de.json +45 -0
- package/templates/gym-fitness/l10n/el.json +45 -0
- package/templates/gym-fitness/l10n/en.json +1 -1
- package/templates/gym-fitness/l10n/es.json +45 -0
- package/templates/gym-fitness/l10n/fi.json +45 -0
- package/templates/gym-fitness/l10n/fr.json +45 -0
- package/templates/gym-fitness/l10n/he.json +36 -0
- package/templates/gym-fitness/l10n/hu.json +45 -0
- package/templates/gym-fitness/l10n/id.json +45 -0
- package/templates/gym-fitness/l10n/it.json +45 -0
- package/templates/gym-fitness/l10n/ja.json +45 -0
- package/templates/gym-fitness/l10n/ko.json +45 -0
- package/templates/gym-fitness/l10n/lt.json +45 -0
- package/templates/gym-fitness/l10n/nl.json +45 -0
- package/templates/gym-fitness/l10n/no.json +45 -0
- package/templates/gym-fitness/l10n/pl.json +45 -0
- package/templates/gym-fitness/l10n/pt.json +45 -0
- package/templates/gym-fitness/l10n/ru.json +45 -0
- package/templates/gym-fitness/l10n/sv.json +45 -0
- package/templates/gym-fitness/l10n/th.json +45 -0
- package/templates/gym-fitness/l10n/tr.json +45 -0
- package/templates/gym-fitness/l10n/uk.json +45 -0
- package/templates/gym-fitness/l10n/vi.json +45 -0
- package/templates/gym-fitness/l10n/zh.json +45 -0
- package/templates/gym-fitness/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/gym-fitness/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/gym-fitness/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/gym-fitness/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/gym-fitness/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/gym-fitness/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/gym-fitness/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/gym-fitness-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/medical-services/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/medical-services/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/medical-services/tier5-src/_shared/chat-live.ts +242 -0
- package/templates/medical-services/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/medical-services/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/medical-services/tier5-src/business-chat/index.ts +73 -22
- package/templates/medical-services/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/nonprofit-cause/l10n/ar.json +30 -0
- package/templates/nonprofit-cause/l10n/cs.json +30 -0
- package/templates/nonprofit-cause/l10n/da.json +30 -0
- package/templates/nonprofit-cause/l10n/de.json +30 -0
- package/templates/nonprofit-cause/l10n/el.json +30 -0
- package/templates/nonprofit-cause/l10n/en.json +1 -1
- package/templates/nonprofit-cause/l10n/es.json +30 -0
- package/templates/nonprofit-cause/l10n/fi.json +30 -0
- package/templates/nonprofit-cause/l10n/fr.json +30 -0
- package/templates/nonprofit-cause/l10n/he.json +24 -0
- package/templates/nonprofit-cause/l10n/hu.json +30 -0
- package/templates/nonprofit-cause/l10n/id.json +30 -0
- package/templates/nonprofit-cause/l10n/it.json +30 -0
- package/templates/nonprofit-cause/l10n/ja.json +30 -0
- package/templates/nonprofit-cause/l10n/ko.json +30 -0
- package/templates/nonprofit-cause/l10n/lt.json +30 -0
- package/templates/nonprofit-cause/l10n/nl.json +30 -0
- package/templates/nonprofit-cause/l10n/no.json +30 -0
- package/templates/nonprofit-cause/l10n/pl.json +30 -0
- package/templates/nonprofit-cause/l10n/pt.json +30 -0
- package/templates/nonprofit-cause/l10n/ru.json +30 -0
- package/templates/nonprofit-cause/l10n/sv.json +30 -0
- package/templates/nonprofit-cause/l10n/th.json +30 -0
- package/templates/nonprofit-cause/l10n/tr.json +30 -0
- package/templates/nonprofit-cause/l10n/uk.json +30 -0
- package/templates/nonprofit-cause/l10n/vi.json +30 -0
- package/templates/nonprofit-cause/l10n/zh.json +30 -0
- package/templates/nonprofit-cause/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/nonprofit-cause/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/nonprofit-cause/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/nonprofit-cause/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/nonprofit-cause/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/nonprofit-cause-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/owner-lite/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/personal-fitness-trainer/dev/index.ts +2 -1
- package/templates/personal-fitness-trainer/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/personal-fitness-trainer/tier5-src/_shared/chat-live.ts +242 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/personal-fitness-trainer/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/personal-fitness-trainer/tier5-src/business-chat/index.ts +73 -22
- package/templates/personal-fitness-trainer/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/podcast-creator/l10n/ar.json +35 -0
- package/templates/podcast-creator/l10n/cs.json +35 -0
- package/templates/podcast-creator/l10n/da.json +35 -0
- package/templates/podcast-creator/l10n/de.json +35 -0
- package/templates/podcast-creator/l10n/el.json +35 -0
- package/templates/podcast-creator/l10n/en.json +1 -1
- package/templates/podcast-creator/l10n/es.json +35 -0
- package/templates/podcast-creator/l10n/fi.json +35 -0
- package/templates/podcast-creator/l10n/fr.json +35 -0
- package/templates/podcast-creator/l10n/he.json +28 -0
- package/templates/podcast-creator/l10n/hu.json +35 -0
- package/templates/podcast-creator/l10n/id.json +35 -0
- package/templates/podcast-creator/l10n/it.json +35 -0
- package/templates/podcast-creator/l10n/ja.json +35 -0
- package/templates/podcast-creator/l10n/ko.json +35 -0
- package/templates/podcast-creator/l10n/lt.json +35 -0
- package/templates/podcast-creator/l10n/nl.json +35 -0
- package/templates/podcast-creator/l10n/no.json +35 -0
- package/templates/podcast-creator/l10n/pl.json +35 -0
- package/templates/podcast-creator/l10n/pt.json +35 -0
- package/templates/podcast-creator/l10n/ru.json +35 -0
- package/templates/podcast-creator/l10n/sv.json +35 -0
- package/templates/podcast-creator/l10n/th.json +35 -0
- package/templates/podcast-creator/l10n/tr.json +35 -0
- package/templates/podcast-creator/l10n/uk.json +35 -0
- package/templates/podcast-creator/l10n/vi.json +35 -0
- package/templates/podcast-creator/l10n/zh.json +35 -0
- package/templates/podcast-creator/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/podcast-creator/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/podcast-creator/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/podcast-creator/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/podcast-creator/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/podcast-creator-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/portfolio-creative/l10n/ar.json +35 -0
- package/templates/portfolio-creative/l10n/cs.json +35 -0
- package/templates/portfolio-creative/l10n/da.json +35 -0
- package/templates/portfolio-creative/l10n/de.json +35 -0
- package/templates/portfolio-creative/l10n/el.json +35 -0
- package/templates/portfolio-creative/l10n/en.json +1 -1
- package/templates/portfolio-creative/l10n/es.json +35 -0
- package/templates/portfolio-creative/l10n/fi.json +35 -0
- package/templates/portfolio-creative/l10n/fr.json +35 -0
- package/templates/portfolio-creative/l10n/he.json +28 -0
- package/templates/portfolio-creative/l10n/hu.json +35 -0
- package/templates/portfolio-creative/l10n/id.json +35 -0
- package/templates/portfolio-creative/l10n/it.json +35 -0
- package/templates/portfolio-creative/l10n/ja.json +35 -0
- package/templates/portfolio-creative/l10n/ko.json +35 -0
- package/templates/portfolio-creative/l10n/lt.json +35 -0
- package/templates/portfolio-creative/l10n/nl.json +35 -0
- package/templates/portfolio-creative/l10n/no.json +35 -0
- package/templates/portfolio-creative/l10n/pl.json +35 -0
- package/templates/portfolio-creative/l10n/pt.json +35 -0
- package/templates/portfolio-creative/l10n/ru.json +35 -0
- package/templates/portfolio-creative/l10n/sv.json +35 -0
- package/templates/portfolio-creative/l10n/th.json +35 -0
- package/templates/portfolio-creative/l10n/tr.json +35 -0
- package/templates/portfolio-creative/l10n/uk.json +35 -0
- package/templates/portfolio-creative/l10n/vi.json +35 -0
- package/templates/portfolio-creative/l10n/zh.json +35 -0
- package/templates/portfolio-creative/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/portfolio-creative/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/portfolio-creative/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/portfolio-creative/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/portfolio-creative/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/portfolio-creative-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/restaurant/l10n/ar.json +35 -0
- package/templates/restaurant/l10n/cs.json +35 -0
- package/templates/restaurant/l10n/da.json +35 -0
- package/templates/restaurant/l10n/de.json +35 -0
- package/templates/restaurant/l10n/el.json +35 -0
- package/templates/restaurant/l10n/en.json +1 -1
- package/templates/restaurant/l10n/es.json +35 -0
- package/templates/restaurant/l10n/fi.json +35 -0
- package/templates/restaurant/l10n/fr.json +35 -0
- package/templates/restaurant/l10n/he.json +28 -0
- package/templates/restaurant/l10n/hu.json +35 -0
- package/templates/restaurant/l10n/id.json +35 -0
- package/templates/restaurant/l10n/it.json +35 -0
- package/templates/restaurant/l10n/ja.json +35 -0
- package/templates/restaurant/l10n/ko.json +35 -0
- package/templates/restaurant/l10n/lt.json +35 -0
- package/templates/restaurant/l10n/nl.json +35 -0
- package/templates/restaurant/l10n/no.json +35 -0
- package/templates/restaurant/l10n/pl.json +35 -0
- package/templates/restaurant/l10n/pt.json +35 -0
- package/templates/restaurant/l10n/ru.json +35 -0
- package/templates/restaurant/l10n/sv.json +35 -0
- package/templates/restaurant/l10n/th.json +35 -0
- package/templates/restaurant/l10n/tr.json +35 -0
- package/templates/restaurant/l10n/uk.json +35 -0
- package/templates/restaurant/l10n/vi.json +35 -0
- package/templates/restaurant/l10n/zh.json +35 -0
- package/templates/restaurant/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/restaurant/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/restaurant/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/restaurant/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/restaurant/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/restaurant-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/retail-store/l10n/ar.json +35 -0
- package/templates/retail-store/l10n/cs.json +35 -0
- package/templates/retail-store/l10n/da.json +35 -0
- package/templates/retail-store/l10n/de.json +35 -0
- package/templates/retail-store/l10n/el.json +35 -0
- package/templates/retail-store/l10n/en.json +1 -1
- package/templates/retail-store/l10n/es.json +35 -0
- package/templates/retail-store/l10n/fi.json +35 -0
- package/templates/retail-store/l10n/fr.json +35 -0
- package/templates/retail-store/l10n/he.json +28 -0
- package/templates/retail-store/l10n/hu.json +35 -0
- package/templates/retail-store/l10n/id.json +35 -0
- package/templates/retail-store/l10n/it.json +35 -0
- package/templates/retail-store/l10n/ja.json +35 -0
- package/templates/retail-store/l10n/ko.json +35 -0
- package/templates/retail-store/l10n/lt.json +35 -0
- package/templates/retail-store/l10n/nl.json +35 -0
- package/templates/retail-store/l10n/no.json +35 -0
- package/templates/retail-store/l10n/pl.json +35 -0
- package/templates/retail-store/l10n/pt.json +35 -0
- package/templates/retail-store/l10n/ru.json +35 -0
- package/templates/retail-store/l10n/sv.json +35 -0
- package/templates/retail-store/l10n/th.json +35 -0
- package/templates/retail-store/l10n/tr.json +35 -0
- package/templates/retail-store/l10n/uk.json +35 -0
- package/templates/retail-store/l10n/vi.json +35 -0
- package/templates/retail-store/l10n/zh.json +35 -0
- package/templates/retail-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/retail-store/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/retail-store/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/retail-store/tier5-src/_shared/program-standing.ts +67 -0
- package/templates/retail-store/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/retail-store-owner/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/salon-spa/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/salon-spa/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/salon-spa/tier5-src/_shared/chat-live.ts +242 -0
- package/templates/salon-spa/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/salon-spa/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/salon-spa/tier5-src/business-chat/index.ts +73 -22
- package/templates/salon-spa/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/wholesale-store/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/wholesale-store/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/wholesale-store/tier5-src/_shared/chat-live.ts +242 -0
- package/templates/wholesale-store/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/wholesale-store/tier5-src/_shared/inbox-rooms.ts +101 -11
- package/templates/wholesale-store/tier5-src/business-chat/index.ts +73 -22
- package/templates/yoga-studio/config.ts +9 -0
- package/templates/yoga-studio/dev/index.ts +1134 -133
- package/templates/yoga-studio/himalaya.content.json +3 -0
- package/templates/yoga-studio/l10n/ar.json +150 -0
- package/templates/yoga-studio/l10n/cs.json +150 -0
- package/templates/yoga-studio/l10n/da.json +150 -0
- package/templates/yoga-studio/l10n/de.json +150 -0
- package/templates/yoga-studio/l10n/el.json +150 -0
- package/templates/yoga-studio/l10n/en.json +70 -1
- package/templates/yoga-studio/l10n/es.json +150 -0
- package/templates/yoga-studio/l10n/fi.json +150 -0
- package/templates/yoga-studio/l10n/fr.json +150 -0
- package/templates/yoga-studio/l10n/he.json +122 -0
- package/templates/yoga-studio/l10n/hu.json +150 -0
- package/templates/yoga-studio/l10n/id.json +150 -0
- package/templates/yoga-studio/l10n/it.json +150 -0
- package/templates/yoga-studio/l10n/ja.json +150 -0
- package/templates/yoga-studio/l10n/ko.json +150 -0
- package/templates/yoga-studio/l10n/lt.json +150 -0
- package/templates/yoga-studio/l10n/nl.json +150 -0
- package/templates/yoga-studio/l10n/no.json +150 -0
- package/templates/yoga-studio/l10n/pl.json +150 -0
- package/templates/yoga-studio/l10n/pt.json +150 -0
- package/templates/yoga-studio/l10n/ru.json +150 -0
- package/templates/yoga-studio/l10n/sv.json +150 -0
- package/templates/yoga-studio/l10n/th.json +150 -0
- package/templates/yoga-studio/l10n/tr.json +150 -0
- package/templates/yoga-studio/l10n/uk.json +150 -0
- package/templates/yoga-studio/l10n/vi.json +150 -0
- package/templates/yoga-studio/l10n/zh.json +150 -0
- package/templates/yoga-studio/tier5-src/_shared/branded-lite-hosted.ts +1 -0
- package/templates/yoga-studio/tier5-src/_shared/business-chat-transport.ts +20 -4
- package/templates/yoga-studio/tier5-src/_shared/engine-intl.ts +6 -0
- package/templates/yoga-studio/tier5-src/_shared/program-fields.ts +16 -0
- package/templates/yoga-studio/tier5-src/_shared/program-standing.ts +21 -0
- package/templates/yoga-studio/tier5-src/himi-booking-time/index.ts +56 -12
- package/templates/yoga-studio/tier5-src/himi-branded-lite-home/index.ts +5 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-member-programs/index.ts +23 -7
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program/index.ts +17 -3
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program-participant/index.ts +336 -0
- package/templates/yoga-studio/tier5-src/himi-branded-lite-program-participant/model.ts +206 -0
- package/templates/yoga-studio-owner/tier5-src/_shared/engine-intl.ts +6 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// The member Inbox search: the request body and the reading of the answer of
|
|
2
|
+
// `POST https://manage.wix.com/_serverless/chat-search/v2/search` (the call the Wix app's own Inbox search makes).
|
|
3
|
+
//
|
|
4
|
+
// The REQUEST is the Wix app's (`{query, participantIds, chatroomsPaginator, messagesPaginator}`). The ANSWER's shape has
|
|
5
|
+
// NOT been read live: only the request was recovered from the app's source. The reader below accepts the shapes that
|
|
6
|
+
// service family uses for lists (`{items}` or a bare array, an entry that is the record or wraps it) and for cursors
|
|
7
|
+
// (`next.before`, `nextPointer`), and reads a field it does not find as absent, never as an error. Probe the answer with a
|
|
8
|
+
// member session and pin the real shape in the test before relying on a field.
|
|
9
|
+
import { BUSINESS_SCREEN, dateLabel, inboxRows, isBusinessRoom, type InboxRow, type InboxRowsOptions } from "./inbox-rooms.js";
|
|
10
|
+
|
|
11
|
+
type RecordValue = Record<string, unknown>;
|
|
12
|
+
const object = (value: unknown): RecordValue =>
|
|
13
|
+
value !== null && typeof value === "object" && !Array.isArray(value) ? value as RecordValue : {};
|
|
14
|
+
const text = (value: unknown): string => (typeof value === "string" ? value.trim() : "");
|
|
15
|
+
|
|
16
|
+
export const SEARCH_CHATS_PAGE = 15;
|
|
17
|
+
export const SEARCH_MESSAGES_PAGE = 10;
|
|
18
|
+
/** The last message the server returns with each matching chat. */
|
|
19
|
+
const LAST_MESSAGE_LIMIT = 1;
|
|
20
|
+
|
|
21
|
+
export interface SearchCursors { chats?: string; messages?: string }
|
|
22
|
+
|
|
23
|
+
export function searchBody(query: string, cursors: SearchCursors = {}): Record<string, unknown> {
|
|
24
|
+
return {
|
|
25
|
+
query,
|
|
26
|
+
participantIds: [],
|
|
27
|
+
chatroomsPaginator: { pageSize: SEARCH_CHATS_PAGE, lastMessageLimit: LAST_MESSAGE_LIMIT, ...(cursors.chats ? { nextPointer: cursors.chats } : {}) },
|
|
28
|
+
messagesPaginator: { pageSize: SEARCH_MESSAGES_PAGE, ...(cursors.messages ? { nextPointer: cursors.messages } : {}) },
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** One matching message: flat, so a list row can bind it. `id` is unique per hit (a room can match many times);
|
|
33
|
+
* `roomId` is the room a tap opens, with `screenId` and `kind` exactly as an InboxRow carries them. */
|
|
34
|
+
export interface SearchHit {
|
|
35
|
+
id: string; roomId: string; title: string; snippet: string; dateLabel: string;
|
|
36
|
+
screenId: InboxRow["screenId"]; kind: InboxRow["kind"]; photo: string; noPhoto: boolean; initial: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface SearchPage {
|
|
40
|
+
chats: InboxRow[];
|
|
41
|
+
messages: SearchHit[];
|
|
42
|
+
/** "" = no more of that kind. */
|
|
43
|
+
chatsCursor: string;
|
|
44
|
+
messagesCursor: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const listOf = (value: unknown): unknown[] => {
|
|
48
|
+
if (Array.isArray(value)) return value;
|
|
49
|
+
const items = object(value).items;
|
|
50
|
+
return Array.isArray(items) ? items : [];
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** A cursor the service hands back: a string or a number; "" when the list is finished. */
|
|
54
|
+
function cursorOf(...candidates: unknown[]): string {
|
|
55
|
+
for (const value of candidates) {
|
|
56
|
+
if (typeof value === "string" && value) return value;
|
|
57
|
+
if (typeof value === "number" && Number.isSafeInteger(value) && value >= 0) return String(value);
|
|
58
|
+
}
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** The matched message's text: its summary, else the text part of its data. */
|
|
63
|
+
function snippetOf(message: RecordValue): string {
|
|
64
|
+
const summary = text(message.summary);
|
|
65
|
+
if (summary) return summary;
|
|
66
|
+
for (const part of listOf(message.data)) {
|
|
67
|
+
const value = text(object(object(part).data).text);
|
|
68
|
+
if (value) return value;
|
|
69
|
+
}
|
|
70
|
+
return "";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface ReadSearchOptions extends InboxRowsOptions {
|
|
74
|
+
fallbackTitle: string;
|
|
75
|
+
/** Names for rooms the answer gives only an id for (the rooms already on screen). */
|
|
76
|
+
knownRooms?: ReadonlyMap<string, InboxRow>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function readSearch(response: unknown, options: ReadSearchOptions): SearchPage {
|
|
80
|
+
const root = object(response);
|
|
81
|
+
const chatsNode = object(root.chatrooms);
|
|
82
|
+
const messagesNode = object(root.messages);
|
|
83
|
+
// A chat entry is the chatroom, or a wrapper holding it.
|
|
84
|
+
const rooms = listOf(root.chatrooms).map((entry) => (object(entry).chatroom ? object(entry).chatroom : entry));
|
|
85
|
+
const chats = inboxRows(rooms, options.fallbackTitle, { scope: "all", yesterday: options.yesterday, now: options.now });
|
|
86
|
+
const known = new Map<string, InboxRow>([...(options.knownRooms ?? []), ...chats.map((row): [string, InboxRow] => [row.id, row])]);
|
|
87
|
+
const messages: SearchHit[] = [];
|
|
88
|
+
const seen = new Set<string>();
|
|
89
|
+
for (const entry of listOf(root.messages)) {
|
|
90
|
+
const wrapper = object(entry);
|
|
91
|
+
const message = object(wrapper.message ?? entry);
|
|
92
|
+
const roomId = text(wrapper.chatroomId) || text(message.chatroomId) || text(object(wrapper.chatroom).id);
|
|
93
|
+
if (!roomId) continue;
|
|
94
|
+
const messageId = text(message.id) || text(message._id) || text(wrapper.id);
|
|
95
|
+
const id = `${roomId}:${messageId || messages.length}`;
|
|
96
|
+
if (seen.has(id)) continue;
|
|
97
|
+
seen.add(id);
|
|
98
|
+
const room = known.get(roomId);
|
|
99
|
+
// A room not on screen and not among the chat results: the hit's own room record says whether it is the business's.
|
|
100
|
+
const business = !room && isBusinessRoom(wrapper.chatroom);
|
|
101
|
+
const title = room?.title || text(object(object(wrapper.chatroom).displayData).name) || options.fallbackTitle;
|
|
102
|
+
const at = typeof message.createdAt === "number" ? message.createdAt : 0;
|
|
103
|
+
messages.push({
|
|
104
|
+
id, roomId, title,
|
|
105
|
+
snippet: snippetOf(message),
|
|
106
|
+
dateLabel: dateLabel(at, options.yesterday ?? "Yesterday", options.now),
|
|
107
|
+
screenId: room?.screenId ?? (business ? BUSINESS_SCREEN : "himi_chat_thread"),
|
|
108
|
+
kind: room ? room.kind : business ? "" : "chatroom",
|
|
109
|
+
photo: room?.photo ?? "",
|
|
110
|
+
noPhoto: !room?.photo,
|
|
111
|
+
initial: room?.initial ?? (title[0] ?? "#").toUpperCase(),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
chats, messages,
|
|
116
|
+
chatsCursor: cursorOf(object(chatsNode.next).before, chatsNode.nextPointer, root.chatroomsNextPointer, object(root.chatroomsPaginator).nextPointer),
|
|
117
|
+
messagesCursor: cursorOf(object(messagesNode.next).before, messagesNode.nextPointer, root.messagesNextPointer, object(root.messagesPaginator).nextPointer),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// The member Inbox's Wix calls, on the same fenced, token-cached transport as the business chat
|
|
2
|
+
// (business-chat-transport.ts): the member-role chat-web SDK for the list and the per-room actions, plus the two calls the
|
|
3
|
+
// SDK has no helper for (mark every room read, and search). Every call is fenced: the member is re-checked before the
|
|
4
|
+
// request goes out and before its answer is used, so a sign-out or account switch never leaks one member's rooms to the next.
|
|
5
|
+
import { archiveChatroom, deleteChatroom, getMessagesPage, listChatroomsPage, markChatroomRead, markChatroomUnread, type Chatroom } from "@himalaya/wix-chat-web";
|
|
6
|
+
import { bridge, fence, withToken, type ChatIdentity } from "./business-chat-transport.js";
|
|
7
|
+
import { searchBody, type SearchCursors } from "./inbox-search.js";
|
|
8
|
+
|
|
9
|
+
const MANAGE = "https://manage.wix.com";
|
|
10
|
+
const MEMBER = { role: "member" } as const;
|
|
11
|
+
export const INBOX_PAGE_SIZE = 30;
|
|
12
|
+
|
|
13
|
+
/** `unreadIds`: rooms the server lists as unread (`unreadChatroomIds`), which includes a room the member marked unread
|
|
14
|
+
* (its `unreadCount` stays 0). */
|
|
15
|
+
export interface InboxPage { items: Chatroom[]; nextPointer?: number | string; unreadIds: string[] }
|
|
16
|
+
|
|
17
|
+
/** One page of the member's conversations (the archive when `archived`), from `cursor` when given. */
|
|
18
|
+
export const listInboxPage = (identity: ChatIdentity, query: { archived: boolean; cursor?: string }): Promise<InboxPage> =>
|
|
19
|
+
fence(identity, async () => {
|
|
20
|
+
const page = await withToken(identity, (chatToken) => listChatroomsPage({
|
|
21
|
+
...MEMBER, chatToken, pageSize: INBOX_PAGE_SIZE,
|
|
22
|
+
...(query.archived ? { archived: true } : {}),
|
|
23
|
+
...(query.cursor ? { nextPointer: query.cursor } : {}),
|
|
24
|
+
}));
|
|
25
|
+
return { items: page.items, nextPointer: page.nextPointer, unreadIds: page.unreadChatroomIds ?? [] };
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/** Does the member have any archived conversation? One row is enough to know. */
|
|
29
|
+
export const hasArchivedRooms = (identity: ChatIdentity): Promise<boolean> => fence(identity, async () =>
|
|
30
|
+
(await withToken(identity, (chatToken) => listChatroomsPage({ ...MEMBER, chatToken, pageSize: 1, archived: true }))).items.length > 0);
|
|
31
|
+
|
|
32
|
+
export const setRoomArchived = (identity: ChatIdentity, roomId: string, archived: boolean): Promise<void> =>
|
|
33
|
+
fence(identity, () => withToken(identity, (chatToken) => archiveChatroom(roomId, archived, { ...MEMBER, chatToken })));
|
|
34
|
+
|
|
35
|
+
export const deleteRoom = (identity: ChatIdentity, roomId: string): Promise<void> =>
|
|
36
|
+
fence(identity, () => withToken(identity, (chatToken) => deleteChatroom(roomId, { ...MEMBER, chatToken })));
|
|
37
|
+
|
|
38
|
+
export const markRoomUnread = (identity: ChatIdentity, roomId: string): Promise<void> =>
|
|
39
|
+
fence(identity, () => withToken(identity, (chatToken) => markChatroomUnread(roomId, undefined, { ...MEMBER, chatToken })));
|
|
40
|
+
|
|
41
|
+
/** Marking read needs the room's newest message sequence. The list entry usually carries it (`knownSequence`); when it
|
|
42
|
+
* does not, the newest message is read for it. A room with no message has nothing to read. */
|
|
43
|
+
export const markRoomRead = (identity: ChatIdentity, roomId: string, knownSequence?: number): Promise<void> =>
|
|
44
|
+
fence(identity, () => withToken(identity, async (chatToken) => {
|
|
45
|
+
let sequence = knownSequence;
|
|
46
|
+
if (sequence === undefined) {
|
|
47
|
+
const newest = (await getMessagesPage(roomId, { ...MEMBER, chatToken, pageSize: 1, ordering: "Desc" })).items[0];
|
|
48
|
+
if (!newest) return;
|
|
49
|
+
sequence = newest.sequence;
|
|
50
|
+
}
|
|
51
|
+
if (sequence === undefined) throw new Error("inbox_room_has_no_message_sequence");
|
|
52
|
+
await markChatroomRead(roomId, sequence, { ...MEMBER, chatToken });
|
|
53
|
+
}));
|
|
54
|
+
|
|
55
|
+
/** Every room read: `PUT chat-web/v1/chatrooms/mark-all-read`, the call the Wix app's "Mark all as read" makes (chat-sdk
|
|
56
|
+
* `setAllRoomsAsRead`). Not yet probed with a member session. */
|
|
57
|
+
export const markAllRoomsRead = (identity: ChatIdentity): Promise<void> =>
|
|
58
|
+
fence(identity, () => withToken(identity, async (chatToken) => {
|
|
59
|
+
await bridge().call("PUT", `${MANAGE}/_api/chat-web/v1/chatrooms/mark-all-read?chatToken=${encodeURIComponent(chatToken)}`, {});
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
/** The raw search answer (read by `readSearch`). The host authorises the call as the member. */
|
|
63
|
+
export const searchInbox = (identity: ChatIdentity, query: string, cursors: SearchCursors = {}): Promise<unknown> =>
|
|
64
|
+
fence(identity, () => bridge().call("POST", `${MANAGE}/_serverless/chat-search/v2/search`, searchBody(query, cursors)));
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
// The rows of the member chat thread (wix-spaces-chat-thread): one row per chat-web message, oldest first, with a day
|
|
2
|
+
// label on the first message of each day.
|
|
3
|
+
//
|
|
4
|
+
// A row always carries the original fields the Spaces thread screen binds (text, when, mine, badge, avatar, one image,
|
|
5
|
+
// day label). Everything else is ADDITIVE, and the parts that read the message body more deeply (images, files, a card,
|
|
6
|
+
// the unsupported fallback, the outgoing queue) are filled only when the screen opted in with `richThread`; otherwise
|
|
7
|
+
// they hold neutral values (`hasX` false, `hideX` true), so a screen that does not ask for them sees the same rows as before.
|
|
8
|
+
//
|
|
9
|
+
// Every visual part has BOTH polarities: `hasX` is true when the part is there, `hideX` is the opposite, for a screen
|
|
10
|
+
// that hides on TRUE (`hiddenWhen`).
|
|
11
|
+
import type { ChatMessage } from "@himalaya/wix-chat-web";
|
|
12
|
+
import { formatClock, formatMonthDay, formatMonthDayTime } from "./engine-intl.js";
|
|
13
|
+
import { initials } from "./himi-text.js";
|
|
14
|
+
import { copyParam } from "./himi-copy.js";
|
|
15
|
+
import { normalizeMessages, type PartRow } from "./business-chat-message-model.js";
|
|
16
|
+
|
|
17
|
+
/** Where an outgoing message of this visit stands. "" is a message the server already holds. */
|
|
18
|
+
export type SendState = "" | "sending" | "sent" | "failed";
|
|
19
|
+
|
|
20
|
+
/** A message the member sent from this screen that the server has not listed yet (or could not take). `id` is the
|
|
21
|
+
* idempotency id the send carries, so a retry of the same entry is the same message to chat-web. */
|
|
22
|
+
export interface OutboxEntry { id: string; roomId: string; text: string; at: number; state: Exclude<SendState, ""> }
|
|
23
|
+
|
|
24
|
+
export interface ImageItem { id: string; url: string; description: string }
|
|
25
|
+
export interface AttachmentItem { id: string; kind: "file" | "audio" | "video"; url: string; label: string }
|
|
26
|
+
|
|
27
|
+
export interface Row {
|
|
28
|
+
id: string; text: string; when: string; leadFill: string; mine: boolean; notMine: boolean;
|
|
29
|
+
senderBadge: string; avatarUrl: string; avatarInitials: string;
|
|
30
|
+
/** An incoming member message with no sender photo: the screen draws the initials. Never for my own messages or the
|
|
31
|
+
* business (business, staff), which keep their own avatar. */
|
|
32
|
+
noPhoto: boolean;
|
|
33
|
+
imageUrl: string; imageDescription: string; imageHidden: boolean; dayLabel: string; dayHidden: boolean;
|
|
34
|
+
/** Avatar only on the last bubble of a run from the same sender (never on my own). */
|
|
35
|
+
showAvatar: boolean; hideAvatar: boolean;
|
|
36
|
+
/** Locale clock time ("" when the message has no time). */
|
|
37
|
+
time: string;
|
|
38
|
+
/** Outgoing rows only: "10:42 · Sent", "Sending…" or "Couldn't send". "" for incoming rows. */
|
|
39
|
+
statusText: string; hideStatus: boolean;
|
|
40
|
+
sendState: SendState; failed: boolean; notFailed: boolean;
|
|
41
|
+
hasText: boolean; hideText: boolean;
|
|
42
|
+
images: ImageItem[]; hasImages: boolean; hideImages: boolean;
|
|
43
|
+
/** Files, recordings and videos, as link rows; `attachmentUrl`/`Label`/`Kind` are the first one. */
|
|
44
|
+
attachments: AttachmentItem[]; attachmentUrl: string; attachmentLabel: string; attachmentKind: string;
|
|
45
|
+
hasAttachment: boolean; hideAttachment: boolean;
|
|
46
|
+
cardTitle: string; cardCaption: string; cardImageUrl: string; cardCtaLabel: string; cardCtaUrl: string;
|
|
47
|
+
hasCard: boolean; hideCard: boolean; hideCardTitle: boolean; hideCardCaption: boolean; hideCardImage: boolean; hideCardCta: boolean;
|
|
48
|
+
/** A message with nothing the thread can show: the fallback line instead of a blank bubble. */
|
|
49
|
+
unsupportedText: string; hasUnsupported: boolean; hideUnsupported: boolean;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface RowOptions {
|
|
53
|
+
/** The screen opted in to the richer rows (`richThread`). */
|
|
54
|
+
rich?: boolean;
|
|
55
|
+
/** Sends of this visit that the server may not list yet. */
|
|
56
|
+
outbox?: readonly OutboxEntry[];
|
|
57
|
+
/** Authorized download URLs of private attachments, by media id (see `privateMediaOf`). */
|
|
58
|
+
mediaUrls?: ReadonlyMap<string, string>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const NO_VISUALS = {
|
|
62
|
+
hasText: true, hideText: false,
|
|
63
|
+
images: [] as ImageItem[], hasImages: false, hideImages: true,
|
|
64
|
+
attachments: [] as AttachmentItem[], attachmentUrl: "", attachmentLabel: "", attachmentKind: "", hasAttachment: false, hideAttachment: true,
|
|
65
|
+
cardTitle: "", cardCaption: "", cardImageUrl: "", cardCtaLabel: "", cardCtaUrl: "",
|
|
66
|
+
hasCard: false, hideCard: true, hideCardTitle: true, hideCardCaption: true, hideCardImage: true, hideCardCta: true,
|
|
67
|
+
unsupportedText: "", hasUnsupported: false, hideUnsupported: true,
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const PRIVATE_MEDIA = "WixMediaPrivate";
|
|
71
|
+
|
|
72
|
+
/** The private attachments of these messages: each needs an authorized download URL (never its raw link). */
|
|
73
|
+
export function privateMediaOf(messages: readonly unknown[]): PartRow[] {
|
|
74
|
+
const found: PartRow[] = [];
|
|
75
|
+
for (const row of normalizeMessages([...messages])) {
|
|
76
|
+
for (const part of row.parts) {
|
|
77
|
+
if ((part.kind === "image" || part.kind === "file" || part.kind === "audio" || part.kind === "video") && part.mediaProvider === PRIVATE_MEDIA && part.mediaId) found.push(part);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return found;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** chat-web marks the business side as "business", "businessUser" or "user" (the same predicate
|
|
84
|
+
* as wix-owner-inbox-thread); a visitor or member is anything else. */
|
|
85
|
+
function isBusinessSender(m: ChatMessage): boolean {
|
|
86
|
+
const type = String(m.sender?.type ?? "").toLowerCase();
|
|
87
|
+
return type === "business" || type === "businessuser" || type === "user";
|
|
88
|
+
}
|
|
89
|
+
export const dayKeyOf = (d: Date): string => `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
90
|
+
|
|
91
|
+
/** What a message shows beyond its text, from the shared message model (the business chat reads the same parts). */
|
|
92
|
+
function visualsOf(m: ChatMessage, myUserId: string, mediaUrls: ReadonlyMap<string, string>, legacyText: string): typeof NO_VISUALS & { richText: string } {
|
|
93
|
+
const parts = normalizeMessages([m], myUserId)[0]?.parts ?? [];
|
|
94
|
+
// A private attachment is shown only through its authorized URL; a public one through its own https link.
|
|
95
|
+
const urlOf = (part: PartRow): string => (part.mediaProvider === PRIVATE_MEDIA ? (part.mediaId ? mediaUrls.get(part.mediaId) ?? "" : "") : part.url);
|
|
96
|
+
// A caption equal to the unavailable reason is the model's English diagnostic, not the sender's words.
|
|
97
|
+
const captionOf = (part: PartRow): string => (part.caption && part.caption !== part.unavailableReason ? part.caption : "");
|
|
98
|
+
const images: ImageItem[] = [];
|
|
99
|
+
const attachments: AttachmentItem[] = [];
|
|
100
|
+
for (const part of parts) {
|
|
101
|
+
if (part.kind === "image") {
|
|
102
|
+
const url = urlOf(part);
|
|
103
|
+
if (url) images.push({ id: part.id, url, description: captionOf(part) || copyParam("chatThread.imageDescription", "Photo in this conversation") });
|
|
104
|
+
} else if (part.kind === "file" || part.kind === "audio" || part.kind === "video") {
|
|
105
|
+
const url = urlOf(part);
|
|
106
|
+
if (url) attachments.push({ id: part.id, kind: part.kind, url, label: (part.fileName || captionOf(part) || copyParam("chatThread.openAttachment", "Open attachment")).slice(0, 40) });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const card = parts.find((part) => part.kind === "card");
|
|
110
|
+
const lines = (card?.text ?? "").split("\n");
|
|
111
|
+
const cardTitle = card ? (lines[0] ?? "").trim() : "";
|
|
112
|
+
const cardCaption = card ? lines.slice(1).join("\n").trim() : "";
|
|
113
|
+
const cardImageUrl = card?.url ?? "";
|
|
114
|
+
const cta = card?.buttons?.find((button) => button.url);
|
|
115
|
+
const hasCard = !!card && !!(cardTitle || cardCaption || cardImageUrl || cta);
|
|
116
|
+
const visual = images.length > 0 || attachments.length > 0 || hasCard;
|
|
117
|
+
const bodyText = parts.filter((part) => part.kind === "text" || part.kind === "system").map((part) => part.text).filter(Boolean).join("\n");
|
|
118
|
+
// The server's own preview line stands in only when nothing else says what the message is.
|
|
119
|
+
const richText = bodyText || (visual ? "" : legacyText);
|
|
120
|
+
const unsupported = !richText && !visual;
|
|
121
|
+
const first = attachments[0];
|
|
122
|
+
return {
|
|
123
|
+
richText,
|
|
124
|
+
hasText: richText !== "", hideText: richText === "",
|
|
125
|
+
images, hasImages: images.length > 0, hideImages: images.length === 0,
|
|
126
|
+
attachments, attachmentUrl: first?.url ?? "", attachmentLabel: first?.label ?? "", attachmentKind: first?.kind ?? "",
|
|
127
|
+
hasAttachment: !!first, hideAttachment: !first,
|
|
128
|
+
cardTitle: hasCard ? cardTitle : "", cardCaption: hasCard ? cardCaption : "", cardImageUrl: hasCard ? cardImageUrl : "",
|
|
129
|
+
cardCtaLabel: hasCard ? cta?.label ?? "" : "", cardCtaUrl: hasCard ? cta?.url ?? "" : "",
|
|
130
|
+
hasCard, hideCard: !hasCard, hideCardTitle: !(hasCard && cardTitle), hideCardCaption: !(hasCard && cardCaption),
|
|
131
|
+
hideCardImage: !(hasCard && cardImageUrl), hideCardCta: !(hasCard && cta),
|
|
132
|
+
unsupportedText: unsupported ? copyParam("chatThread.unsupportedText", "This message can't be shown here yet.") : "",
|
|
133
|
+
hasUnsupported: unsupported, hideUnsupported: !unsupported,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** "10:42 · Sent", "Sending…" or "Couldn't send" for one of my messages. */
|
|
138
|
+
export function statusOf(state: SendState, time: string): string {
|
|
139
|
+
if (state === "sending") return copyParam("chatThread.statusSending", "Sending message…");
|
|
140
|
+
if (state === "failed") return copyParam("chatThread.statusFailed", "Couldn't send");
|
|
141
|
+
const sent = copyParam("chatThread.statusSent", "Sent");
|
|
142
|
+
return time ? `${time} · ${sent}` : sent;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
type Entry = Row & { timestamp: number; dayKey: string; senderKey: string };
|
|
146
|
+
|
|
147
|
+
function norm(m: ChatMessage, i: number, myUserId: string, options: RowOptions): Entry {
|
|
148
|
+
const mm = m as unknown as {
|
|
149
|
+
id?: string; summary?: string; data?: Array<{ mimeType?: string; data?: { text?: string; uri?: string; thumbnailUrl?: string } }>;
|
|
150
|
+
payload?: { text?: string }; content?: string; createdAt?: number; createdDate?: string;
|
|
151
|
+
senderDisplayData?: { name?: string; image?: { url?: string } };
|
|
152
|
+
};
|
|
153
|
+
const legacyText = mm.data?.find((part) => part.data?.text)?.data?.text || mm.summary || mm.payload?.text || mm.content || "";
|
|
154
|
+
const ms = mm.createdAt || (mm.createdDate ? Date.parse(mm.createdDate) : 0);
|
|
155
|
+
const date = ms ? new Date(ms) : null;
|
|
156
|
+
const senderName = mm.senderDisplayData?.name || "";
|
|
157
|
+
const avatarUrl = mm.senderDisplayData?.image?.url || "";
|
|
158
|
+
const image = mm.data?.find((part) => part.mimeType?.startsWith("image/") || part.data?.thumbnailUrl);
|
|
159
|
+
const rawImageUrl = image?.data?.thumbnailUrl || image?.data?.uri || "";
|
|
160
|
+
// Mine when the message sender matches my user id (resolved once per load).
|
|
161
|
+
const mine = !!(myUserId && m.sender?.userId && m.sender.userId === myUserId);
|
|
162
|
+
const rich = options.rich ? visualsOf(m, myUserId, options.mediaUrls ?? new Map(), legacyText) : undefined;
|
|
163
|
+
const { richText: _richText, ...visuals } = rich ?? { ...NO_VISUALS, richText: "" };
|
|
164
|
+
// The screen's one-image binding follows the authorized list when the screen opted in; a raw link of a private file never reaches it.
|
|
165
|
+
const imageUrl = rich ? rich.images[0]?.url ?? "" : rawImageUrl;
|
|
166
|
+
const time = date ? formatClock(date) : "";
|
|
167
|
+
return {
|
|
168
|
+
id: mm.id || `m${i}`, text: rich ? rich.richText : legacyText || "Message", when: date ? formatMonthDayTime(date) : "", leadFill: mine ? " " : "", mine, notMine: !mine,
|
|
169
|
+
senderBadge: isBusinessSender(m) ? copyParam("chatThread.businessBadge", "Business") : "",
|
|
170
|
+
avatarUrl, avatarInitials: initials(senderName), noPhoto: !mine && !isBusinessSender(m) && !avatarUrl,
|
|
171
|
+
imageUrl, imageDescription: imageUrl ? (rich ? rich.images[0]!.description : `${senderName || "Message"} attachment`) : "", imageHidden: !imageUrl, dayLabel: "", dayHidden: true,
|
|
172
|
+
showAvatar: false, hideAvatar: true, time,
|
|
173
|
+
statusText: mine ? statusOf("", time) : "", hideStatus: !mine,
|
|
174
|
+
sendState: "", failed: false, notFailed: true,
|
|
175
|
+
...visuals,
|
|
176
|
+
timestamp: ms, dayKey: date ? dayKeyOf(date) : "",
|
|
177
|
+
senderKey: mine ? "me" : m.sender?.userId || senderName || "other",
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** One of my own messages the server does not list (yet): sending, sent or failed. */
|
|
182
|
+
function queued(entry: OutboxEntry, newestStored: number): Entry {
|
|
183
|
+
const date = new Date(entry.at);
|
|
184
|
+
const time = formatClock(date);
|
|
185
|
+
const failed = entry.state === "failed";
|
|
186
|
+
return {
|
|
187
|
+
id: entry.id, text: entry.text, when: formatMonthDayTime(date), leadFill: " ", mine: true, notMine: false,
|
|
188
|
+
senderBadge: "", avatarUrl: "", avatarInitials: "", noPhoto: false, imageUrl: "", imageDescription: "", imageHidden: true, dayLabel: "", dayHidden: true,
|
|
189
|
+
showAvatar: false, hideAvatar: true, time: failed ? "" : time,
|
|
190
|
+
statusText: statusOf(entry.state, time), hideStatus: false,
|
|
191
|
+
sendState: entry.state, failed, notFailed: !failed,
|
|
192
|
+
...NO_VISUALS,
|
|
193
|
+
// After every message the server holds: the phone's clock and the server's differ, and a send is the newest by construction.
|
|
194
|
+
timestamp: Math.max(entry.at, newestStored), dayKey: dayKeyOf(date), senderKey: "me",
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** My own message shown after its send was accepted but its re-read failed: a row with no time (the original fallback). */
|
|
199
|
+
export function localSentRow(id: string, text: string): Row {
|
|
200
|
+
const { timestamp: _t, dayKey: _d, senderKey: _s, ...row } = { ...queued({ id, roomId: "", text, at: 0, state: "sent" }, 0) };
|
|
201
|
+
return { ...row, when: "", time: "", statusText: statusOf("", ""), dayLabel: "", dayHidden: true };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** Oldest first, one row per message id, and a day label on the first message of each day. The outbox entries the
|
|
205
|
+
* server already lists are dropped (its row wins); the rest follow the messages they were sent after. */
|
|
206
|
+
export function rowsOf(messages: ChatMessage[], myUserId: string, options: RowOptions = {}): Row[] {
|
|
207
|
+
const stored = messages.map((m, i) => norm(m, i, myUserId, options));
|
|
208
|
+
const known = new Set(stored.map((row) => row.id));
|
|
209
|
+
const newestStored = stored.reduce((newest, row) => Math.max(newest, row.timestamp), 0);
|
|
210
|
+
const waiting = (options.outbox ?? []).filter((entry) => !known.has(entry.id)).map((entry) => queued(entry, newestStored));
|
|
211
|
+
const sorted = [...stored, ...waiting].sort((a, b) => a.timestamp - b.timestamp);
|
|
212
|
+
const today = new Date();
|
|
213
|
+
const todayKey = dayKeyOf(today);
|
|
214
|
+
const yesterdayKey = dayKeyOf(new Date(today.getFullYear(), today.getMonth(), today.getDate() - 1));
|
|
215
|
+
const seen = new Set<string>();
|
|
216
|
+
const entries: Array<Entry & { startsDay: boolean }> = [];
|
|
217
|
+
let previousDay = "";
|
|
218
|
+
for (const entry of sorted) {
|
|
219
|
+
if (seen.has(entry.id)) continue;
|
|
220
|
+
seen.add(entry.id);
|
|
221
|
+
const startsDay = !!entry.dayKey && entry.dayKey !== previousDay;
|
|
222
|
+
if (entry.dayKey) previousDay = entry.dayKey;
|
|
223
|
+
const dayLabel = !startsDay ? "" : entry.dayKey === todayKey ? copyParam("chatThread.today", "Today") : entry.dayKey === yesterdayKey ? copyParam("chatThread.yesterday", "Yesterday") : formatMonthDay(new Date(entry.timestamp));
|
|
224
|
+
entries.push({ ...entry, dayLabel, dayHidden: !dayLabel, startsDay });
|
|
225
|
+
}
|
|
226
|
+
return entries.map(({ timestamp: _t, dayKey: _d, senderKey, startsDay: _s, ...row }, at) => {
|
|
227
|
+
const next = entries[at + 1];
|
|
228
|
+
// The last bubble of a run: nothing follows, another sender follows, or the next message opens a new day.
|
|
229
|
+
const lastOfRun = !next || next.senderKey !== senderKey || next.startsDay;
|
|
230
|
+
const showAvatar = !row.mine && lastOfRun;
|
|
231
|
+
return { ...row, showAvatar, hideAvatar: !showAvatar };
|
|
232
|
+
});
|
|
233
|
+
}
|