@myrjfa/state 0.3.1
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/hooks/usePersistentDraftState.d.ts +20 -0
- package/dist/hooks/usePersistentDraftState.d.ts.map +1 -0
- package/dist/hooks/usePersistentDraftState.js +47 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +45 -0
- package/dist/lib/QueryProvider.d.ts +4 -0
- package/dist/lib/QueryProvider.d.ts.map +1 -0
- package/dist/lib/QueryProvider.js +10 -0
- package/dist/lib/actions/actions.d.ts +192 -0
- package/dist/lib/actions/actions.d.ts.map +1 -0
- package/dist/lib/actions/actions.js +392 -0
- package/dist/lib/actions/adminDashboard.d.ts +4 -0
- package/dist/lib/actions/adminDashboard.d.ts.map +1 -0
- package/dist/lib/actions/adminDashboard.js +29 -0
- package/dist/lib/actions/adventure.d.ts +104 -0
- package/dist/lib/actions/adventure.d.ts.map +1 -0
- package/dist/lib/actions/adventure.js +203 -0
- package/dist/lib/actions/application.d.ts +35 -0
- package/dist/lib/actions/application.d.ts.map +1 -0
- package/dist/lib/actions/application.js +573 -0
- package/dist/lib/actions/auth.d.ts +286 -0
- package/dist/lib/actions/auth.d.ts.map +1 -0
- package/dist/lib/actions/auth.js +155 -0
- package/dist/lib/actions/blog.d.ts +61 -0
- package/dist/lib/actions/blog.d.ts.map +1 -0
- package/dist/lib/actions/blog.js +762 -0
- package/dist/lib/actions/booking.d.ts +45 -0
- package/dist/lib/actions/booking.d.ts.map +1 -0
- package/dist/lib/actions/booking.js +91 -0
- package/dist/lib/actions/brand.d.ts +83 -0
- package/dist/lib/actions/brand.d.ts.map +1 -0
- package/dist/lib/actions/brand.js +28 -0
- package/dist/lib/actions/chat.d.ts +266 -0
- package/dist/lib/actions/chat.d.ts.map +1 -0
- package/dist/lib/actions/chat.js +741 -0
- package/dist/lib/actions/companion.d.ts +174 -0
- package/dist/lib/actions/companion.d.ts.map +1 -0
- package/dist/lib/actions/companion.js +276 -0
- package/dist/lib/actions/event.d.ts +178 -0
- package/dist/lib/actions/event.d.ts.map +1 -0
- package/dist/lib/actions/event.js +214 -0
- package/dist/lib/actions/fetcher.d.ts +6 -0
- package/dist/lib/actions/fetcher.d.ts.map +1 -0
- package/dist/lib/actions/fetcher.js +148 -0
- package/dist/lib/actions/guide.d.ts +55 -0
- package/dist/lib/actions/guide.d.ts.map +1 -0
- package/dist/lib/actions/guide.js +128 -0
- package/dist/lib/actions/hostDashboard.d.ts +122 -0
- package/dist/lib/actions/hostDashboard.d.ts.map +1 -0
- package/dist/lib/actions/hostDashboard.js +329 -0
- package/dist/lib/actions/location.d.ts +141 -0
- package/dist/lib/actions/location.d.ts.map +1 -0
- package/dist/lib/actions/location.js +113 -0
- package/dist/lib/actions/notifications.d.ts +91 -0
- package/dist/lib/actions/notifications.d.ts.map +1 -0
- package/dist/lib/actions/notifications.js +83 -0
- package/dist/lib/actions/opportunity.d.ts +44 -0
- package/dist/lib/actions/opportunity.d.ts.map +1 -0
- package/dist/lib/actions/opportunity.js +318 -0
- package/dist/lib/actions/package.d.ts +85 -0
- package/dist/lib/actions/package.d.ts.map +1 -0
- package/dist/lib/actions/package.js +167 -0
- package/dist/lib/actions/place.d.ts +191 -0
- package/dist/lib/actions/place.d.ts.map +1 -0
- package/dist/lib/actions/place.js +57 -0
- package/dist/lib/actions/portfolio.d.ts +65 -0
- package/dist/lib/actions/portfolio.d.ts.map +1 -0
- package/dist/lib/actions/portfolio.js +62 -0
- package/dist/lib/actions/property.d.ts +17 -0
- package/dist/lib/actions/property.d.ts.map +1 -0
- package/dist/lib/actions/property.js +16 -0
- package/dist/lib/actions/rental.d.ts +87 -0
- package/dist/lib/actions/rental.d.ts.map +1 -0
- package/dist/lib/actions/rental.js +205 -0
- package/dist/lib/actions/review.d.ts +8 -0
- package/dist/lib/actions/review.d.ts.map +1 -0
- package/dist/lib/actions/review.js +102 -0
- package/dist/lib/actions/room.d.ts +39 -0
- package/dist/lib/actions/room.d.ts.map +1 -0
- package/dist/lib/actions/room.js +74 -0
- package/dist/lib/actions/serverActions.d.ts +4 -0
- package/dist/lib/actions/serverActions.d.ts.map +1 -0
- package/dist/lib/actions/serverActions.js +37 -0
- package/dist/lib/actions/socket.d.ts +7 -0
- package/dist/lib/actions/socket.d.ts.map +1 -0
- package/dist/lib/actions/socket.js +26 -0
- package/dist/lib/actions/stay.d.ts +97 -0
- package/dist/lib/actions/stay.d.ts.map +1 -0
- package/dist/lib/actions/stay.js +138 -0
- package/dist/lib/actions/travelPackage.d.ts +104 -0
- package/dist/lib/actions/travelPackage.d.ts.map +1 -0
- package/dist/lib/actions/travelPackage.js +487 -0
- package/dist/lib/actions/user.d.ts +23 -0
- package/dist/lib/actions/user.d.ts.map +1 -0
- package/dist/lib/actions/user.js +55 -0
- package/dist/lib/actions.d.ts +556 -0
- package/dist/lib/actions.d.ts.map +1 -0
- package/dist/lib/actions.js +1330 -0
- package/dist/lib/adminDashboardActions.d.ts +73 -0
- package/dist/lib/adminDashboardActions.d.ts.map +1 -0
- package/dist/lib/adminDashboardActions.js +98 -0
- package/dist/lib/adventureActions.d.ts +102 -0
- package/dist/lib/adventureActions.d.ts.map +1 -0
- package/dist/lib/adventureActions.js +202 -0
- package/dist/lib/adventureDummyData.d.ts +3 -0
- package/dist/lib/adventureDummyData.d.ts.map +1 -0
- package/dist/lib/adventureDummyData.js +138 -0
- package/dist/lib/adventureFormPage.d.ts +39 -0
- package/dist/lib/adventureFormPage.d.ts.map +1 -0
- package/dist/lib/adventureFormPage.js +70 -0
- package/dist/lib/authSessionManager.d.ts +2 -0
- package/dist/lib/authSessionManager.d.ts.map +1 -0
- package/dist/lib/authSessionManager.js +35 -0
- package/dist/lib/authorizationActions.d.ts +77 -0
- package/dist/lib/authorizationActions.d.ts.map +1 -0
- package/dist/lib/authorizationActions.js +61 -0
- package/dist/lib/brandActions.d.ts +83 -0
- package/dist/lib/brandActions.d.ts.map +1 -0
- package/dist/lib/brandActions.js +28 -0
- package/dist/lib/companionActions.d.ts +174 -0
- package/dist/lib/companionActions.d.ts.map +1 -0
- package/dist/lib/companionActions.js +276 -0
- package/dist/lib/companionDummyData.d.ts +99 -0
- package/dist/lib/companionDummyData.d.ts.map +1 -0
- package/dist/lib/companionDummyData.js +203 -0
- package/dist/lib/context/ChatContext.d.ts +51 -0
- package/dist/lib/context/ChatContext.d.ts.map +1 -0
- package/dist/lib/context/ChatContext.js +445 -0
- package/dist/lib/data/adventureDummyData.d.ts +3 -0
- package/dist/lib/data/adventureDummyData.d.ts.map +1 -0
- package/dist/lib/data/adventureDummyData.js +138 -0
- package/dist/lib/data/adventureFormPage.d.ts +28 -0
- package/dist/lib/data/adventureFormPage.d.ts.map +1 -0
- package/dist/lib/data/adventureFormPage.js +58 -0
- package/dist/lib/data/companionDummyData.d.ts +99 -0
- package/dist/lib/data/companionDummyData.d.ts.map +1 -0
- package/dist/lib/data/companionDummyData.js +203 -0
- package/dist/lib/data/countryStates.d.ts +31 -0
- package/dist/lib/data/countryStates.d.ts.map +1 -0
- package/dist/lib/data/countryStates.js +7117 -0
- package/dist/lib/data/destinations.d.ts +14 -0
- package/dist/lib/data/destinations.d.ts.map +1 -0
- package/dist/lib/data/destinations.js +203 -0
- package/dist/lib/data/eventFormPage.d.ts +38 -0
- package/dist/lib/data/eventFormPage.d.ts.map +1 -0
- package/dist/lib/data/eventFormPage.js +56 -0
- package/dist/lib/data/eventsDummyData.d.ts +54 -0
- package/dist/lib/data/eventsDummyData.d.ts.map +1 -0
- package/dist/lib/data/eventsDummyData.js +586 -0
- package/dist/lib/data/guideDummyData.d.ts +3 -0
- package/dist/lib/data/guideDummyData.d.ts.map +1 -0
- package/dist/lib/data/guideDummyData.js +66 -0
- package/dist/lib/data/opportunityFormData.d.ts +13 -0
- package/dist/lib/data/opportunityFormData.d.ts.map +1 -0
- package/dist/lib/data/opportunityFormData.js +62 -0
- package/dist/lib/data/opportunityFormPage.d.ts +12 -0
- package/dist/lib/data/opportunityFormPage.d.ts.map +1 -0
- package/dist/lib/data/opportunityFormPage.js +33 -0
- package/dist/lib/data/packageDummyData.d.ts +3 -0
- package/dist/lib/data/packageDummyData.d.ts.map +1 -0
- package/dist/lib/data/packageDummyData.js +56 -0
- package/dist/lib/data/rentalDummyData.d.ts +3 -0
- package/dist/lib/data/rentalDummyData.d.ts.map +1 -0
- package/dist/lib/data/rentalDummyData.js +382 -0
- package/dist/lib/data/rentalFormPage.d.ts +11 -0
- package/dist/lib/data/rentalFormPage.d.ts.map +1 -0
- package/dist/lib/data/rentalFormPage.js +86 -0
- package/dist/lib/data/staysDummyData.d.ts +72 -0
- package/dist/lib/data/staysDummyData.d.ts.map +1 -0
- package/dist/lib/data/staysDummyData.js +694 -0
- package/dist/lib/data/storeDummyData.d.ts +33 -0
- package/dist/lib/data/storeDummyData.d.ts.map +1 -0
- package/dist/lib/data/storeDummyData.js +336 -0
- package/dist/lib/data/travelPackageFormData.d.ts +19 -0
- package/dist/lib/data/travelPackageFormData.d.ts.map +1 -0
- package/dist/lib/data/travelPackageFormData.js +51 -0
- package/dist/lib/data/travelPackageFormPage.d.ts +22 -0
- package/dist/lib/data/travelPackageFormPage.d.ts.map +1 -0
- package/dist/lib/data/travelPackageFormPage.js +40 -0
- package/dist/lib/data/vehicleData.d.ts +2 -0
- package/dist/lib/data/vehicleData.d.ts.map +1 -0
- package/dist/lib/data/vehicleData.js +187 -0
- package/dist/lib/data/vehicleModels.d.ts +2 -0
- package/dist/lib/data/vehicleModels.d.ts.map +1 -0
- package/dist/lib/data/vehicleModels.js +128 -0
- package/dist/lib/destinations.d.ts +14 -0
- package/dist/lib/destinations.d.ts.map +1 -0
- package/dist/lib/destinations.js +203 -0
- package/dist/lib/discountActions.d.ts +43 -0
- package/dist/lib/discountActions.d.ts.map +1 -0
- package/dist/lib/discountActions.js +69 -0
- package/dist/lib/entitySubmission.d.ts +21 -0
- package/dist/lib/entitySubmission.d.ts.map +1 -0
- package/dist/lib/entitySubmission.js +10 -0
- package/dist/lib/eventActions.d.ts +176 -0
- package/dist/lib/eventActions.d.ts.map +1 -0
- package/dist/lib/eventActions.js +222 -0
- package/dist/lib/eventFormPage.d.ts +49 -0
- package/dist/lib/eventFormPage.d.ts.map +1 -0
- package/dist/lib/eventFormPage.js +84 -0
- package/dist/lib/eventsDummyData.d.ts +54 -0
- package/dist/lib/eventsDummyData.d.ts.map +1 -0
- package/dist/lib/eventsDummyData.js +586 -0
- package/dist/lib/guideActions.d.ts +53 -0
- package/dist/lib/guideActions.d.ts.map +1 -0
- package/dist/lib/guideActions.js +127 -0
- package/dist/lib/guideDummyData.d.ts +3 -0
- package/dist/lib/guideDummyData.d.ts.map +1 -0
- package/dist/lib/guideDummyData.js +66 -0
- package/dist/lib/hooks/use-mobile.d.ts +2 -0
- package/dist/lib/hooks/use-mobile.d.ts.map +1 -0
- package/dist/lib/hooks/use-mobile.js +15 -0
- package/dist/lib/hooks/useChatSocket.d.ts +6 -0
- package/dist/lib/hooks/useChatSocket.d.ts.map +1 -0
- package/dist/lib/hooks/useChatSocket.js +35 -0
- package/dist/lib/hooks/useHostCalendarSelection.d.ts +51 -0
- package/dist/lib/hooks/useHostCalendarSelection.d.ts.map +1 -0
- package/dist/lib/hooks/useHostCalendarSelection.js +200 -0
- package/dist/lib/hooks/usePersistentDraftState.d.ts +20 -0
- package/dist/lib/hooks/usePersistentDraftState.d.ts.map +1 -0
- package/dist/lib/hooks/usePersistentDraftState.js +47 -0
- package/dist/lib/hostDashboardActions.d.ts +189 -0
- package/dist/lib/hostDashboardActions.d.ts.map +1 -0
- package/dist/lib/hostDashboardActions.js +400 -0
- package/dist/lib/imageUpload.d.ts +4 -0
- package/dist/lib/imageUpload.d.ts.map +1 -0
- package/dist/lib/imageUpload.js +36 -0
- package/dist/lib/locationActions.d.ts +141 -0
- package/dist/lib/locationActions.d.ts.map +1 -0
- package/dist/lib/locationActions.js +113 -0
- package/dist/lib/loyaltyActions.d.ts +32 -0
- package/dist/lib/loyaltyActions.d.ts.map +1 -0
- package/dist/lib/loyaltyActions.js +92 -0
- package/dist/lib/models/adventure.d.ts +90 -0
- package/dist/lib/models/adventure.d.ts.map +1 -0
- package/dist/lib/models/adventure.js +1 -0
- package/dist/lib/models/application.d.ts +26 -0
- package/dist/lib/models/application.d.ts.map +1 -0
- package/dist/lib/models/application.js +130 -0
- package/dist/lib/models/authorization.d.ts +107 -0
- package/dist/lib/models/authorization.d.ts.map +1 -0
- package/dist/lib/models/authorization.js +263 -0
- package/dist/lib/models/blog.d.ts +66 -0
- package/dist/lib/models/blog.d.ts.map +1 -0
- package/dist/lib/models/blog.js +181 -0
- package/dist/lib/models/booking.d.ts +90 -0
- package/dist/lib/models/booking.d.ts.map +1 -0
- package/dist/lib/models/booking.js +1 -0
- package/dist/lib/models/chat.d.ts +384 -0
- package/dist/lib/models/chat.d.ts.map +1 -0
- package/dist/lib/models/chat.js +5 -0
- package/dist/lib/models/discount.d.ts +611 -0
- package/dist/lib/models/discount.d.ts.map +1 -0
- package/dist/lib/models/discount.js +128 -0
- package/dist/lib/models/enquiry.d.ts +34 -0
- package/dist/lib/models/enquiry.d.ts.map +1 -0
- package/dist/lib/models/enquiry.js +140 -0
- package/dist/lib/models/forms.d.ts +384 -0
- package/dist/lib/models/forms.d.ts.map +1 -0
- package/dist/lib/models/forms.js +121 -0
- package/dist/lib/models/guide.d.ts +42 -0
- package/dist/lib/models/guide.d.ts.map +1 -0
- package/dist/lib/models/guide.js +1 -0
- package/dist/lib/models/loyalty.d.ts +88 -0
- package/dist/lib/models/loyalty.d.ts.map +1 -0
- package/dist/lib/models/loyalty.js +1 -0
- package/dist/lib/models/notifications.d.ts +99 -0
- package/dist/lib/models/notifications.d.ts.map +1 -0
- package/dist/lib/models/notifications.js +63 -0
- package/dist/lib/models/opportunities/freelance.d.ts +641 -0
- package/dist/lib/models/opportunities/freelance.d.ts.map +1 -0
- package/dist/lib/models/opportunities/freelance.js +12 -0
- package/dist/lib/models/opportunities/internship.d.ts +618 -0
- package/dist/lib/models/opportunities/internship.d.ts.map +1 -0
- package/dist/lib/models/opportunities/internship.js +7 -0
- package/dist/lib/models/opportunities/job.d.ts +754 -0
- package/dist/lib/models/opportunities/job.d.ts.map +1 -0
- package/dist/lib/models/opportunities/job.js +26 -0
- package/dist/lib/models/opportunities/opportunity.d.ts +729 -0
- package/dist/lib/models/opportunities/opportunity.d.ts.map +1 -0
- package/dist/lib/models/opportunities/opportunity.js +232 -0
- package/dist/lib/models/opportunities/volunteerJob.d.ts +595 -0
- package/dist/lib/models/opportunities/volunteerJob.d.ts.map +1 -0
- package/dist/lib/models/opportunities/volunteerJob.js +5 -0
- package/dist/lib/models/package.d.ts +422 -0
- package/dist/lib/models/package.d.ts.map +1 -0
- package/dist/lib/models/package.js +58 -0
- package/dist/lib/models/portfolio.d.ts +43 -0
- package/dist/lib/models/portfolio.d.ts.map +1 -0
- package/dist/lib/models/portfolio.js +70 -0
- package/dist/lib/models/pricing.d.ts +255 -0
- package/dist/lib/models/pricing.d.ts.map +1 -0
- package/dist/lib/models/pricing.js +145 -0
- package/dist/lib/models/props.d.ts +67 -0
- package/dist/lib/models/props.d.ts.map +1 -0
- package/dist/lib/models/props.js +191 -0
- package/dist/lib/models/rental.d.ts +95 -0
- package/dist/lib/models/rental.d.ts.map +1 -0
- package/dist/lib/models/rental.js +1 -0
- package/dist/lib/models/review.d.ts +50 -0
- package/dist/lib/models/review.d.ts.map +1 -0
- package/dist/lib/models/review.js +74 -0
- package/dist/lib/models/stay.d.ts +462 -0
- package/dist/lib/models/stay.d.ts.map +1 -0
- package/dist/lib/models/stay.js +215 -0
- package/dist/lib/models/store.d.ts +71 -0
- package/dist/lib/models/store.d.ts.map +1 -0
- package/dist/lib/models/store.js +1 -0
- package/dist/lib/models/tile.d.ts +57 -0
- package/dist/lib/models/tile.d.ts.map +1 -0
- package/dist/lib/models/tile.js +1 -0
- package/dist/lib/models/travelPackage.d.ts +844 -0
- package/dist/lib/models/travelPackage.d.ts.map +1 -0
- package/dist/lib/models/travelPackage.js +324 -0
- package/dist/lib/models/user.d.ts +241 -0
- package/dist/lib/models/user.d.ts.map +1 -0
- package/dist/lib/models/user.js +115 -0
- package/dist/lib/multistepDraft.d.ts +4 -0
- package/dist/lib/multistepDraft.d.ts.map +1 -0
- package/dist/lib/multistepDraft.js +18 -0
- package/dist/lib/opportunityFormData.d.ts +13 -0
- package/dist/lib/opportunityFormData.d.ts.map +1 -0
- package/dist/lib/opportunityFormData.js +62 -0
- package/dist/lib/opportunityFormPage.d.ts +39 -0
- package/dist/lib/opportunityFormPage.d.ts.map +1 -0
- package/dist/lib/opportunityFormPage.js +34 -0
- package/dist/lib/packageActions.d.ts +86 -0
- package/dist/lib/packageActions.d.ts.map +1 -0
- package/dist/lib/packageActions.js +168 -0
- package/dist/lib/packageDummyData.d.ts +3 -0
- package/dist/lib/packageDummyData.d.ts.map +1 -0
- package/dist/lib/packageDummyData.js +57 -0
- package/dist/lib/placeActions.d.ts +192 -0
- package/dist/lib/placeActions.d.ts.map +1 -0
- package/dist/lib/placeActions.js +57 -0
- package/dist/lib/pricingActions.d.ts +13 -0
- package/dist/lib/pricingActions.d.ts.map +1 -0
- package/dist/lib/pricingActions.js +16 -0
- package/dist/lib/propertyActions.d.ts +17 -0
- package/dist/lib/propertyActions.d.ts.map +1 -0
- package/dist/lib/propertyActions.js +16 -0
- package/dist/lib/rentalActions.d.ts +86 -0
- package/dist/lib/rentalActions.d.ts.map +1 -0
- package/dist/lib/rentalActions.js +234 -0
- package/dist/lib/rentalDummyData.d.ts +3 -0
- package/dist/lib/rentalDummyData.d.ts.map +1 -0
- package/dist/lib/rentalDummyData.js +367 -0
- package/dist/lib/rentalFormPage.d.ts +46 -0
- package/dist/lib/rentalFormPage.d.ts.map +1 -0
- package/dist/lib/rentalFormPage.js +94 -0
- package/dist/lib/roomActions.d.ts +39 -0
- package/dist/lib/roomActions.d.ts.map +1 -0
- package/dist/lib/roomActions.js +74 -0
- package/dist/lib/stayActions.d.ts +97 -0
- package/dist/lib/stayActions.d.ts.map +1 -0
- package/dist/lib/stayActions.js +138 -0
- package/dist/lib/staysDummyData.d.ts +72 -0
- package/dist/lib/staysDummyData.d.ts.map +1 -0
- package/dist/lib/staysDummyData.js +694 -0
- package/dist/lib/storeActions.d.ts +25 -0
- package/dist/lib/storeActions.d.ts.map +1 -0
- package/dist/lib/storeActions.js +46 -0
- package/dist/lib/storeDummyData.d.ts +9 -0
- package/dist/lib/storeDummyData.d.ts.map +1 -0
- package/dist/lib/storeDummyData.js +336 -0
- package/dist/lib/travelPackageActions.d.ts +102 -0
- package/dist/lib/travelPackageActions.d.ts.map +1 -0
- package/dist/lib/travelPackageActions.js +487 -0
- package/dist/lib/travelPackageFormData.d.ts +20 -0
- package/dist/lib/travelPackageFormData.d.ts.map +1 -0
- package/dist/lib/travelPackageFormData.js +54 -0
- package/dist/lib/travelPackageFormPage.d.ts +32 -0
- package/dist/lib/travelPackageFormPage.d.ts.map +1 -0
- package/dist/lib/travelPackageFormPage.js +43 -0
- package/dist/lib/userAtom.d.ts +294 -0
- package/dist/lib/userAtom.d.ts.map +1 -0
- package/dist/lib/userAtom.js +139 -0
- package/dist/lib/util.d.ts +11 -0
- package/dist/lib/util.d.ts.map +1 -0
- package/dist/lib/util.js +82 -0
- package/dist/lib/utils/entitySubmission.d.ts +21 -0
- package/dist/lib/utils/entitySubmission.d.ts.map +1 -0
- package/dist/lib/utils/entitySubmission.js +10 -0
- package/dist/lib/utils/fileCompression.d.ts +16 -0
- package/dist/lib/utils/fileCompression.d.ts.map +1 -0
- package/dist/lib/utils/fileCompression.js +56 -0
- package/dist/lib/utils/imageUpload.d.ts +4 -0
- package/dist/lib/utils/imageUpload.d.ts.map +1 -0
- package/dist/lib/utils/imageUpload.js +36 -0
- package/dist/lib/utils/socialMediaUrl.d.ts +25 -0
- package/dist/lib/utils/socialMediaUrl.d.ts.map +1 -0
- package/dist/lib/utils/socialMediaUrl.js +97 -0
- package/dist/lib/utils/tileConverters.d.ts +8 -0
- package/dist/lib/utils/tileConverters.d.ts.map +1 -0
- package/dist/lib/utils/tileConverters.js +59 -0
- package/dist/lib/utils.d.ts +53 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +183 -0
- package/dist/lib/vehicleData.d.ts +2 -0
- package/dist/lib/vehicleData.d.ts.map +1 -0
- package/dist/lib/vehicleData.js +181 -0
- package/dist/lib/vehicleModels.d.ts +2 -0
- package/dist/lib/vehicleModels.d.ts.map +1 -0
- package/dist/lib/vehicleModels.js +128 -0
- package/package.json +61 -0
|
@@ -0,0 +1,741 @@
|
|
|
1
|
+
import { get, post, patch, put, del } from "./fetcher";
|
|
2
|
+
const BASE_PATH = "/chat";
|
|
3
|
+
const idString = (value) => String(value || "");
|
|
4
|
+
const normalizeActorRef = (actor) => ({
|
|
5
|
+
actorId: idString(actor?.actorId),
|
|
6
|
+
actorModel: actor?.actorModel,
|
|
7
|
+
});
|
|
8
|
+
export const normalizeChatMessage = (message) => ({
|
|
9
|
+
...message,
|
|
10
|
+
_id: idString(message?._id),
|
|
11
|
+
conversationId: idString(message?.conversationId),
|
|
12
|
+
senderId: idString(message?.senderId),
|
|
13
|
+
senderModel: message?.senderModel,
|
|
14
|
+
content: {
|
|
15
|
+
text: message?.content?.text || "",
|
|
16
|
+
media: message?.content?.media || [],
|
|
17
|
+
linkPreview: message?.content?.linkPreview || undefined,
|
|
18
|
+
referenceId: message?.content?.referenceId,
|
|
19
|
+
referenceType: message?.content?.referenceType,
|
|
20
|
+
mentions: (message?.content?.mentions || []).map(normalizeActorRef),
|
|
21
|
+
},
|
|
22
|
+
reactions: (message?.reactions || []).map((reaction) => ({
|
|
23
|
+
...normalizeActorRef(reaction),
|
|
24
|
+
emoji: reaction.emoji,
|
|
25
|
+
createdAt: reaction.createdAt,
|
|
26
|
+
})),
|
|
27
|
+
readBy: (message?.readBy || []).map((receipt) => ({
|
|
28
|
+
...normalizeActorRef(receipt),
|
|
29
|
+
readAt: receipt.readAt,
|
|
30
|
+
})),
|
|
31
|
+
deliveredTo: (message?.deliveredTo || []).map((receipt) => ({
|
|
32
|
+
...normalizeActorRef(receipt),
|
|
33
|
+
deliveredAt: receipt.deliveredAt,
|
|
34
|
+
})),
|
|
35
|
+
});
|
|
36
|
+
export const normalizeConversation = (conversation) => ({
|
|
37
|
+
...conversation,
|
|
38
|
+
_id: idString(conversation?._id),
|
|
39
|
+
type: conversation?.type || "individual",
|
|
40
|
+
participants: (conversation?.participants || []).map((participant) => ({
|
|
41
|
+
...normalizeActorRef(participant),
|
|
42
|
+
accountType: participant.accountType,
|
|
43
|
+
username: participant.username || "",
|
|
44
|
+
displayName: participant.displayName || participant.username || "",
|
|
45
|
+
profilePic: participant.profilePic || "",
|
|
46
|
+
chatRole: participant.chatRole || "member",
|
|
47
|
+
joinedAt: participant.joinedAt || conversation?.createdAt,
|
|
48
|
+
lastReadAt: participant.lastReadAt || null,
|
|
49
|
+
unreadCount: Number(participant.unreadCount || 0),
|
|
50
|
+
restrictedUntil: participant.restrictedUntil || null,
|
|
51
|
+
})),
|
|
52
|
+
features: {
|
|
53
|
+
milestones: Boolean(conversation?.features?.milestones),
|
|
54
|
+
expenses: Boolean(conversation?.features?.expenses),
|
|
55
|
+
events: conversation?.features?.events !== false,
|
|
56
|
+
},
|
|
57
|
+
groupSettings: {
|
|
58
|
+
announcementsOnly: Boolean(conversation?.groupSettings?.announcementsOnly),
|
|
59
|
+
joinApprovalRequired: Boolean(conversation?.groupSettings?.joinApprovalRequired),
|
|
60
|
+
},
|
|
61
|
+
context: conversation?.context,
|
|
62
|
+
lastMessage: conversation?.lastMessage
|
|
63
|
+
? {
|
|
64
|
+
text: conversation.lastMessage.text || "",
|
|
65
|
+
senderId: idString(conversation.lastMessage.senderId),
|
|
66
|
+
senderModel: conversation.lastMessage.senderModel,
|
|
67
|
+
sentAt: conversation.lastMessage.sentAt,
|
|
68
|
+
}
|
|
69
|
+
: undefined,
|
|
70
|
+
preference: {
|
|
71
|
+
conversationId: idString(conversation?.preference?.conversationId || conversation?._id),
|
|
72
|
+
actorId: idString(conversation?.preference?.actorId),
|
|
73
|
+
actorModel: conversation?.preference?.actorModel,
|
|
74
|
+
pinnedAt: conversation?.preference?.pinnedAt || null,
|
|
75
|
+
favouritedAt: conversation?.preference?.favouritedAt || null,
|
|
76
|
+
archivedAt: conversation?.preference?.archivedAt || null,
|
|
77
|
+
mutedUntil: conversation?.preference?.mutedUntil || null,
|
|
78
|
+
notificationLevel: conversation?.preference?.notificationLevel || "all",
|
|
79
|
+
markedUnreadAt: conversation?.preference?.markedUnreadAt || null,
|
|
80
|
+
draftText: conversation?.preference?.draftText || "",
|
|
81
|
+
draftUpdatedAt: conversation?.preference?.draftUpdatedAt || null,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
const normalizePreference = (preference) => ({
|
|
85
|
+
conversationId: idString(preference?.conversationId),
|
|
86
|
+
actorId: idString(preference?.actorId),
|
|
87
|
+
actorModel: preference?.actorModel,
|
|
88
|
+
pinnedAt: preference?.pinnedAt || null,
|
|
89
|
+
favouritedAt: preference?.favouritedAt || null,
|
|
90
|
+
archivedAt: preference?.archivedAt || null,
|
|
91
|
+
mutedUntil: preference?.mutedUntil || null,
|
|
92
|
+
notificationLevel: preference?.notificationLevel || "all",
|
|
93
|
+
markedUnreadAt: preference?.markedUnreadAt || null,
|
|
94
|
+
draftText: preference?.draftText || "",
|
|
95
|
+
draftUpdatedAt: preference?.draftUpdatedAt || null,
|
|
96
|
+
});
|
|
97
|
+
const normalizeActorLine = (line) => ({ ...line, ...normalizeActorRef(line) });
|
|
98
|
+
const normalizeBalanceLine = (line) => ({
|
|
99
|
+
...normalizeActorLine(line),
|
|
100
|
+
// Canonical backend balance rows use `balance`; shared UI retains the
|
|
101
|
+
// established `netBalance` field.
|
|
102
|
+
netBalance: Number(line?.netBalance ?? line?.balance ?? 0),
|
|
103
|
+
});
|
|
104
|
+
const normalizeExpense = (expense) => ({ ...expense, _id: idString(expense?._id), conversationId: idString(expense?.conversationId), createdBy: normalizeActorRef(expense?.createdBy), paidBy: (expense?.paidBy || []).map(normalizeActorLine), splits: (expense?.splits || []).map(normalizeActorLine) });
|
|
105
|
+
const normalizeMilestone = (milestone) => ({ ...milestone, _id: idString(milestone?._id), conversationId: idString(milestone?.conversationId), createdBy: normalizeActorRef(milestone?.createdBy), checks: (milestone?.checks || []).map(normalizeActorLine) });
|
|
106
|
+
const normalizePoll = (poll) => ({
|
|
107
|
+
...poll,
|
|
108
|
+
_id: idString(poll?._id),
|
|
109
|
+
conversationId: idString(poll?.conversationId),
|
|
110
|
+
createdBy: normalizeActorRef(poll?.createdBy),
|
|
111
|
+
votes: (poll?.votes || []).map(normalizeActorLine),
|
|
112
|
+
});
|
|
113
|
+
const normalizeEvent = (event) => ({
|
|
114
|
+
...event,
|
|
115
|
+
_id: idString(event?._id),
|
|
116
|
+
conversationId: idString(event?.conversationId),
|
|
117
|
+
createdBy: normalizeActorRef(event?.createdBy),
|
|
118
|
+
invitedActors: (event?.invitedActors || []).map(normalizeActorRef),
|
|
119
|
+
rsvps: (event?.rsvps || []).map(normalizeActorLine),
|
|
120
|
+
});
|
|
121
|
+
export const chatApi = {
|
|
122
|
+
searchParticipants: async (query) => {
|
|
123
|
+
const response = await get(`${BASE_PATH}/participants?q=${encodeURIComponent(query)}`);
|
|
124
|
+
return (response.data || []).map((participant) => ({
|
|
125
|
+
actorId: idString(participant.actorId),
|
|
126
|
+
actorModel: participant.actorModel,
|
|
127
|
+
username: participant.username || "",
|
|
128
|
+
displayName: participant.displayName || participant.username || "Trippeaze member",
|
|
129
|
+
profilePic: participant.profilePic || "",
|
|
130
|
+
}));
|
|
131
|
+
},
|
|
132
|
+
createGroup: async (data) => {
|
|
133
|
+
const response = await post(`${BASE_PATH}/groups`, data);
|
|
134
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
135
|
+
},
|
|
136
|
+
// Conversations
|
|
137
|
+
getConversations: async (params) => {
|
|
138
|
+
try {
|
|
139
|
+
const query = new URLSearchParams();
|
|
140
|
+
if (params?.filter)
|
|
141
|
+
query.set("filter", params.filter);
|
|
142
|
+
if (params?.q)
|
|
143
|
+
query.set("q", params.q);
|
|
144
|
+
if (params?.before)
|
|
145
|
+
query.set("before", params.before);
|
|
146
|
+
if (params?.limit)
|
|
147
|
+
query.set("limit", String(params.limit));
|
|
148
|
+
const response = await get(`${BASE_PATH}/conversations?${query.toString()}`);
|
|
149
|
+
return (response.data || []).map(normalizeConversation);
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
console.error(error);
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
getConversation: async (id) => {
|
|
157
|
+
try {
|
|
158
|
+
const response = await get(`${BASE_PATH}/conversations/${id}`);
|
|
159
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
console.error(error);
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
createConversation: async (data) => {
|
|
167
|
+
try {
|
|
168
|
+
const response = await post(`${BASE_PATH}/conversations`, data);
|
|
169
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
console.error(error);
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
updateConversation: async (id, data) => {
|
|
177
|
+
try {
|
|
178
|
+
const response = await patch(`${BASE_PATH}/conversations/${id}`, data);
|
|
179
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
console.error(error);
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
deleteConversation: async (id) => {
|
|
187
|
+
try {
|
|
188
|
+
const response = await del(`${BASE_PATH}/conversations/${id}`);
|
|
189
|
+
return response.data;
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
console.error(error);
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
addParticipants: async (id, participantIds) => {
|
|
197
|
+
try {
|
|
198
|
+
const response = await post(`${BASE_PATH}/conversations/${id}/participants`, { participantIds });
|
|
199
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
console.error(error);
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
removeParticipant: async (convId, actorId, actorModel) => {
|
|
207
|
+
try {
|
|
208
|
+
const response = await del(`${BASE_PATH}/conversations/${convId}/participants/${actorModel}/${actorId}`);
|
|
209
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
console.error(error);
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
updateParticipant: async (convId, actorId, actorModel, data) => {
|
|
217
|
+
try {
|
|
218
|
+
const response = await patch(`${BASE_PATH}/conversations/${convId}/participants/${actorModel}/${actorId}`, data);
|
|
219
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
console.error(error);
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
// Messages
|
|
227
|
+
getMessages: async (convId, params) => {
|
|
228
|
+
try {
|
|
229
|
+
const qs = new URLSearchParams();
|
|
230
|
+
if (params?.limit)
|
|
231
|
+
qs.set("limit", String(params.limit));
|
|
232
|
+
if (params?.before)
|
|
233
|
+
qs.set("before", params.before);
|
|
234
|
+
if (params?.around)
|
|
235
|
+
qs.set("around", params.around);
|
|
236
|
+
if (params?.radius)
|
|
237
|
+
qs.set("radius", String(params.radius));
|
|
238
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/messages?${qs.toString()}`);
|
|
239
|
+
return (response.data || []).map(normalizeChatMessage);
|
|
240
|
+
}
|
|
241
|
+
catch (error) {
|
|
242
|
+
console.error(error);
|
|
243
|
+
return [];
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
getMessage: async (convId, id) => {
|
|
247
|
+
try {
|
|
248
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/messages/${id}`);
|
|
249
|
+
return {
|
|
250
|
+
...response,
|
|
251
|
+
data: response.data ? normalizeChatMessage(response.data) : null,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
console.error(error);
|
|
256
|
+
return { error: error, data: null };
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
sendMessage: async (convId, data) => {
|
|
260
|
+
try {
|
|
261
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/messages`, data);
|
|
262
|
+
return response.data ? normalizeChatMessage(response.data) : null;
|
|
263
|
+
}
|
|
264
|
+
catch (error) {
|
|
265
|
+
console.error(error);
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
editMessage: async (id, text) => {
|
|
270
|
+
try {
|
|
271
|
+
const response = await patch(`${BASE_PATH}/messages/${id}`, { text });
|
|
272
|
+
return response.data ? normalizeChatMessage(response.data) : null;
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
console.error(error);
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
addMessageReaction: async (id, emoji) => {
|
|
280
|
+
try {
|
|
281
|
+
const response = await patch(`${BASE_PATH}/messages/${id}/reaction`, { emoji });
|
|
282
|
+
return response.data ? normalizeChatMessage(response.data) : null;
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
console.error(error);
|
|
286
|
+
return null;
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
deleteMessage: async (id) => {
|
|
290
|
+
try {
|
|
291
|
+
const response = await del(`${BASE_PATH}/messages/${id}`);
|
|
292
|
+
return response.data ? normalizeChatMessage(response.data) : null;
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
console.error(error);
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
addReaction: async (id, emoji) => {
|
|
300
|
+
try {
|
|
301
|
+
const response = await patch(`${BASE_PATH}/messages/${id}/reaction`, { emoji });
|
|
302
|
+
return response.data ? normalizeChatMessage(response.data) : null;
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
console.error(error);
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
removeReaction: async (id) => {
|
|
310
|
+
try {
|
|
311
|
+
const response = await patch(`${BASE_PATH}/messages/${id}/reaction`, { emoji: "" });
|
|
312
|
+
return response.data ? normalizeChatMessage(response.data) : null;
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
console.error(error);
|
|
316
|
+
return null;
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
markRead: async (convId, messageIds) => {
|
|
320
|
+
try {
|
|
321
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/read`, { messageIds });
|
|
322
|
+
return response.data;
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
console.error(error);
|
|
326
|
+
return null;
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
blockParticipant: async (targetId, targetModel) => {
|
|
330
|
+
const response = await post(`${BASE_PATH}/blocks/${targetModel}/${targetId}`, {});
|
|
331
|
+
return response.data;
|
|
332
|
+
},
|
|
333
|
+
restrictParticipant: async (convId, actorId, actorModel, restrictedUntil) => {
|
|
334
|
+
const response = await patch(`${BASE_PATH}/conversations/${convId}/participants/${actorModel}/${actorId}/restriction`, { restrictedUntil });
|
|
335
|
+
return response.data ? normalizeConversation(response.data) : null;
|
|
336
|
+
},
|
|
337
|
+
getConversationPreference: async (id) => {
|
|
338
|
+
const response = await get(`${BASE_PATH}/conversations/${id}/preferences`);
|
|
339
|
+
return normalizePreference(response.data);
|
|
340
|
+
},
|
|
341
|
+
updateConversationPreference: async (id, data) => {
|
|
342
|
+
const response = await patch(`${BASE_PATH}/conversations/${id}/preferences`, data);
|
|
343
|
+
return normalizePreference(response.data);
|
|
344
|
+
},
|
|
345
|
+
markConversationUnread: async (id) => {
|
|
346
|
+
const response = await post(`${BASE_PATH}/conversations/${id}/mark-unread`, {});
|
|
347
|
+
return normalizePreference(response.data);
|
|
348
|
+
},
|
|
349
|
+
unblockParticipant: async (targetId, targetModel) => {
|
|
350
|
+
const response = await del(`${BASE_PATH}/blocks/${targetModel}/${targetId}`);
|
|
351
|
+
return response.data;
|
|
352
|
+
},
|
|
353
|
+
getBlockStatus: async (targetId, targetModel) => {
|
|
354
|
+
const response = await get(`${BASE_PATH}/blocks/${targetModel}/${targetId}`);
|
|
355
|
+
return response.data;
|
|
356
|
+
},
|
|
357
|
+
getEvents: async (convId) => {
|
|
358
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/events`);
|
|
359
|
+
return (response.data || []).map(normalizeEvent);
|
|
360
|
+
},
|
|
361
|
+
createEvent: async (convId, data) => {
|
|
362
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/events`, data);
|
|
363
|
+
return normalizeEvent(response.data);
|
|
364
|
+
},
|
|
365
|
+
updateEvent: async (eventId, data) => {
|
|
366
|
+
const response = await patch(`${BASE_PATH}/events/${eventId}`, data);
|
|
367
|
+
return normalizeEvent(response.data);
|
|
368
|
+
},
|
|
369
|
+
deleteEvent: async (eventId) => {
|
|
370
|
+
const response = await del(`${BASE_PATH}/events/${eventId}`);
|
|
371
|
+
return response.data;
|
|
372
|
+
},
|
|
373
|
+
rsvpEvent: async (eventId, status) => {
|
|
374
|
+
const response = await post(`${BASE_PATH}/events/${eventId}/rsvp`, { status });
|
|
375
|
+
return normalizeEvent(response.data);
|
|
376
|
+
},
|
|
377
|
+
getEventCalendarUrl: (eventId) => `${BASE_PATH}/events/${eventId}/calendar`,
|
|
378
|
+
createGroupInvite: async (convId, data) => {
|
|
379
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/invites`, data);
|
|
380
|
+
return response.data;
|
|
381
|
+
},
|
|
382
|
+
getGroupInvites: async (convId) => {
|
|
383
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/invites`);
|
|
384
|
+
return response.data || [];
|
|
385
|
+
},
|
|
386
|
+
revokeGroupInvite: async (inviteId) => {
|
|
387
|
+
const response = await del(`${BASE_PATH}/invites/${inviteId}`);
|
|
388
|
+
return response.data;
|
|
389
|
+
},
|
|
390
|
+
joinGroupWithToken: async (token) => {
|
|
391
|
+
const response = await post(`${BASE_PATH}/join/${encodeURIComponent(token)}`, {});
|
|
392
|
+
return response.data;
|
|
393
|
+
},
|
|
394
|
+
getGroupJoinRequests: async (convId) => {
|
|
395
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/join-requests`);
|
|
396
|
+
return response.data || [];
|
|
397
|
+
},
|
|
398
|
+
reviewGroupJoinRequest: async (requestId, status) => {
|
|
399
|
+
const response = await patch(`${BASE_PATH}/join-requests/${requestId}`, { status });
|
|
400
|
+
return response.data;
|
|
401
|
+
},
|
|
402
|
+
moderateMessage: async (messageId, reason) => {
|
|
403
|
+
const response = await post(`${BASE_PATH}/messages/${messageId}/moderate`, { reason });
|
|
404
|
+
return normalizeChatMessage(response.data);
|
|
405
|
+
},
|
|
406
|
+
reportContent: async (convId, data) => {
|
|
407
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/reports`, data);
|
|
408
|
+
return response.data;
|
|
409
|
+
},
|
|
410
|
+
getPaymentProfile: async () => {
|
|
411
|
+
const response = await get(`${BASE_PATH}/payment-profile`);
|
|
412
|
+
return response.data;
|
|
413
|
+
},
|
|
414
|
+
updatePaymentProfile: async (methods) => {
|
|
415
|
+
const response = await put(`${BASE_PATH}/payment-profile`, { methods });
|
|
416
|
+
return response.data;
|
|
417
|
+
},
|
|
418
|
+
getSharedPaymentDetails: async (convId, target) => {
|
|
419
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/payment-details/${target.actorModel}/${target.actorId}`);
|
|
420
|
+
return response.data;
|
|
421
|
+
},
|
|
422
|
+
getPaymentIntents: async (convId) => {
|
|
423
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/payment-intents`);
|
|
424
|
+
return response.data || [];
|
|
425
|
+
},
|
|
426
|
+
createPaymentIntent: async (convId, data) => {
|
|
427
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/payment-intents`, data);
|
|
428
|
+
return response.data;
|
|
429
|
+
},
|
|
430
|
+
verifyPaymentIntent: async (paymentIntentId, data) => {
|
|
431
|
+
const response = await post(`${BASE_PATH}/payment-intents/${paymentIntentId}/verify`, data);
|
|
432
|
+
return response.data;
|
|
433
|
+
},
|
|
434
|
+
confirmPaymentIntent: async (paymentIntentId, disputed = false, reason) => {
|
|
435
|
+
const response = await post(`${BASE_PATH}/payment-intents/${paymentIntentId}/confirm`, { disputed, reason });
|
|
436
|
+
return response.data;
|
|
437
|
+
},
|
|
438
|
+
getChatBusinessProfile: async () => {
|
|
439
|
+
const response = await get(`${BASE_PATH}/business-profile`);
|
|
440
|
+
return response.data;
|
|
441
|
+
},
|
|
442
|
+
updateChatBusinessProfile: async (data) => {
|
|
443
|
+
const response = await put(`${BASE_PATH}/business-profile`, data);
|
|
444
|
+
return response.data;
|
|
445
|
+
},
|
|
446
|
+
getChatQuickReplies: async () => {
|
|
447
|
+
const response = await get(`${BASE_PATH}/quick-replies`);
|
|
448
|
+
return response.data;
|
|
449
|
+
},
|
|
450
|
+
saveChatQuickReply: async (data, quickReplyId) => {
|
|
451
|
+
const response = quickReplyId
|
|
452
|
+
? await patch(`${BASE_PATH}/quick-replies/${quickReplyId}`, data)
|
|
453
|
+
: await post(`${BASE_PATH}/quick-replies`, data);
|
|
454
|
+
return response.data;
|
|
455
|
+
},
|
|
456
|
+
deleteChatQuickReply: async (quickReplyId) => {
|
|
457
|
+
await del(`${BASE_PATH}/quick-replies/${quickReplyId}`);
|
|
458
|
+
},
|
|
459
|
+
getHostConversationState: async (conversationId) => {
|
|
460
|
+
const response = await get(`${BASE_PATH}/conversations/${conversationId}/host-state`);
|
|
461
|
+
return response.data;
|
|
462
|
+
},
|
|
463
|
+
updateHostConversationState: async (conversationId, data) => {
|
|
464
|
+
const response = await patch(`${BASE_PATH}/conversations/${conversationId}/host-state`, data);
|
|
465
|
+
return response.data;
|
|
466
|
+
},
|
|
467
|
+
getOwnedPublishedChatListings: async (query = "") => {
|
|
468
|
+
const response = await get(`${BASE_PATH}/owned-listings${query ? `?q=${encodeURIComponent(query)}` : ""}`);
|
|
469
|
+
return response.data;
|
|
470
|
+
},
|
|
471
|
+
requestChatCopilotAssistance: async (conversationId, data) => {
|
|
472
|
+
const response = await post(`${BASE_PATH}/conversations/${conversationId}/ai/assist`, data);
|
|
473
|
+
return response.data;
|
|
474
|
+
},
|
|
475
|
+
// Deferred Phase 4 methods remain exported for the existing hidden UI.
|
|
476
|
+
getMilestones: async (convId) => {
|
|
477
|
+
try {
|
|
478
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/milestones`);
|
|
479
|
+
return (response.data || []).map(normalizeMilestone);
|
|
480
|
+
}
|
|
481
|
+
catch (error) {
|
|
482
|
+
console.error(error);
|
|
483
|
+
return [];
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
createMilestone: async (convId, data) => {
|
|
487
|
+
try {
|
|
488
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/milestones`, data);
|
|
489
|
+
return { ...response, data: response.data ? normalizeMilestone(response.data) : null };
|
|
490
|
+
}
|
|
491
|
+
catch (error) {
|
|
492
|
+
console.error(error);
|
|
493
|
+
return { error: error, data: null };
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
toggleMilestone: async (id, note) => {
|
|
497
|
+
try {
|
|
498
|
+
const response = await patch(`${BASE_PATH}/milestones/${id}/toggle`, { note });
|
|
499
|
+
return { ...response, data: response.data ? normalizeMilestone(response.data) : null };
|
|
500
|
+
}
|
|
501
|
+
catch (error) {
|
|
502
|
+
console.error(error);
|
|
503
|
+
return { error: error, data: null };
|
|
504
|
+
}
|
|
505
|
+
},
|
|
506
|
+
updateMilestone: async (id, data) => {
|
|
507
|
+
try {
|
|
508
|
+
const response = await patch(`${BASE_PATH}/milestones/${id}`, data);
|
|
509
|
+
return { ...response, data: response.data ? normalizeMilestone(response.data) : null };
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
console.error(error);
|
|
513
|
+
return { error: error, data: null };
|
|
514
|
+
}
|
|
515
|
+
},
|
|
516
|
+
deleteMilestone: async (id) => {
|
|
517
|
+
try {
|
|
518
|
+
const response = await del(`${BASE_PATH}/milestones/${id}`);
|
|
519
|
+
return response;
|
|
520
|
+
}
|
|
521
|
+
catch (error) {
|
|
522
|
+
console.error(error);
|
|
523
|
+
return { error: error, data: null };
|
|
524
|
+
}
|
|
525
|
+
},
|
|
526
|
+
// Expenses
|
|
527
|
+
getExpenses: async (convId) => {
|
|
528
|
+
try {
|
|
529
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/expenses`);
|
|
530
|
+
return (response.data || []).map(normalizeExpense);
|
|
531
|
+
}
|
|
532
|
+
catch (error) {
|
|
533
|
+
console.error(error);
|
|
534
|
+
return [];
|
|
535
|
+
}
|
|
536
|
+
},
|
|
537
|
+
createExpense: async (convId, data) => {
|
|
538
|
+
try {
|
|
539
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/expenses`, data);
|
|
540
|
+
return response;
|
|
541
|
+
}
|
|
542
|
+
catch (error) {
|
|
543
|
+
console.error(error);
|
|
544
|
+
return { error: error, data: null };
|
|
545
|
+
}
|
|
546
|
+
},
|
|
547
|
+
updateExpense: async (id, data) => {
|
|
548
|
+
try {
|
|
549
|
+
const response = await patch(`${BASE_PATH}/expenses/${id}`, data);
|
|
550
|
+
return response;
|
|
551
|
+
}
|
|
552
|
+
catch (error) {
|
|
553
|
+
console.error(error);
|
|
554
|
+
return { error: error, data: null };
|
|
555
|
+
}
|
|
556
|
+
},
|
|
557
|
+
settleSplit: async (id, targetActorId, amount, targetActorModel) => {
|
|
558
|
+
try {
|
|
559
|
+
const response = await post(`${BASE_PATH}/conversations/${id}/settleExpense`, { targetActorId, targetActorModel, amount });
|
|
560
|
+
return response;
|
|
561
|
+
}
|
|
562
|
+
catch (error) {
|
|
563
|
+
console.error(error);
|
|
564
|
+
return { error: error, data: null };
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
deleteExpense: async (id) => {
|
|
568
|
+
try {
|
|
569
|
+
const response = await del(`${BASE_PATH}/expenses/${id}`);
|
|
570
|
+
return response;
|
|
571
|
+
}
|
|
572
|
+
catch (error) {
|
|
573
|
+
console.error(error);
|
|
574
|
+
return { error: error, data: null };
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
getBalances: async (convId) => {
|
|
578
|
+
try {
|
|
579
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/balances`);
|
|
580
|
+
return response.data ? {
|
|
581
|
+
...response.data,
|
|
582
|
+
balances: (response.data.balances || []).map(normalizeBalanceLine),
|
|
583
|
+
settlements: (response.data.settlements || []).map((settlement) => ({
|
|
584
|
+
...settlement,
|
|
585
|
+
from: normalizeActorRef(settlement.from),
|
|
586
|
+
to: normalizeActorRef(settlement.to),
|
|
587
|
+
})),
|
|
588
|
+
} : null;
|
|
589
|
+
}
|
|
590
|
+
catch (error) {
|
|
591
|
+
console.error(error);
|
|
592
|
+
return null;
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
getExpenseCategories: async (convId) => {
|
|
596
|
+
try {
|
|
597
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/expense-categories`);
|
|
598
|
+
return response.data;
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
console.error(error);
|
|
602
|
+
return [];
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
uploadFiles: async (formData) => {
|
|
606
|
+
try {
|
|
607
|
+
const response = await post(`${BASE_PATH}/upload`, formData);
|
|
608
|
+
return response;
|
|
609
|
+
}
|
|
610
|
+
catch (error) {
|
|
611
|
+
console.error(error);
|
|
612
|
+
return { error: error, data: null };
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
getExpenseAnalytics: async (convId) => {
|
|
616
|
+
try {
|
|
617
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/expense-analytics`);
|
|
618
|
+
return response.data;
|
|
619
|
+
}
|
|
620
|
+
catch (error) {
|
|
621
|
+
console.error(error);
|
|
622
|
+
return null;
|
|
623
|
+
}
|
|
624
|
+
},
|
|
625
|
+
// Polls
|
|
626
|
+
getPolls: async (convId) => {
|
|
627
|
+
try {
|
|
628
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/polls`);
|
|
629
|
+
return response.data;
|
|
630
|
+
}
|
|
631
|
+
catch (error) {
|
|
632
|
+
console.error(error);
|
|
633
|
+
return [];
|
|
634
|
+
}
|
|
635
|
+
},
|
|
636
|
+
getPollById: async (pollId) => {
|
|
637
|
+
try {
|
|
638
|
+
const response = await get(`${BASE_PATH}/polls/${pollId}`);
|
|
639
|
+
return response.data ? normalizePoll(response.data) : null;
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
console.error(error);
|
|
643
|
+
return null;
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
createPoll: async (convId, data) => {
|
|
647
|
+
try {
|
|
648
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/polls`, data);
|
|
649
|
+
return response;
|
|
650
|
+
}
|
|
651
|
+
catch (error) {
|
|
652
|
+
console.error(error);
|
|
653
|
+
return { error: error, data: null };
|
|
654
|
+
}
|
|
655
|
+
},
|
|
656
|
+
updatePoll: async (pollId, data) => {
|
|
657
|
+
try {
|
|
658
|
+
const response = await patch(`${BASE_PATH}/polls/${pollId}`, data);
|
|
659
|
+
return { ...response, data: response.data ? normalizePoll(response.data) : null };
|
|
660
|
+
}
|
|
661
|
+
catch (error) {
|
|
662
|
+
console.error(error);
|
|
663
|
+
return { error, data: null };
|
|
664
|
+
}
|
|
665
|
+
},
|
|
666
|
+
searchConversationMessages: async (convId, params) => {
|
|
667
|
+
const qs = new URLSearchParams();
|
|
668
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
669
|
+
if (value !== undefined && value !== "")
|
|
670
|
+
qs.set(key, String(value));
|
|
671
|
+
});
|
|
672
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/search?${qs.toString()}`);
|
|
673
|
+
return {
|
|
674
|
+
results: (response.data?.results || []).map((result) => ({
|
|
675
|
+
message: normalizeChatMessage(result.message),
|
|
676
|
+
context: result.context || {},
|
|
677
|
+
})),
|
|
678
|
+
nextCursor: response.data?.nextCursor || null,
|
|
679
|
+
};
|
|
680
|
+
},
|
|
681
|
+
getSharedContent: async (convId, section, before) => {
|
|
682
|
+
const qs = new URLSearchParams({ section });
|
|
683
|
+
if (before)
|
|
684
|
+
qs.set("before", before);
|
|
685
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/shared-content?${qs.toString()}`);
|
|
686
|
+
const messageSections = new Set(["media", "documents", "links", "locations", "polls", "listings", "bookings"]);
|
|
687
|
+
return {
|
|
688
|
+
...response.data,
|
|
689
|
+
items: messageSections.has(section)
|
|
690
|
+
? (response.data?.items || []).map(normalizeChatMessage)
|
|
691
|
+
: response.data?.items || [],
|
|
692
|
+
};
|
|
693
|
+
},
|
|
694
|
+
getConversationStorage: async (convId) => {
|
|
695
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/storage`);
|
|
696
|
+
return response.data;
|
|
697
|
+
},
|
|
698
|
+
starMessage: async (messageId) => {
|
|
699
|
+
const response = await put(`${BASE_PATH}/messages/${messageId}/star`, {});
|
|
700
|
+
return response.data;
|
|
701
|
+
},
|
|
702
|
+
unstarMessage: async (messageId) => {
|
|
703
|
+
const response = await del(`${BASE_PATH}/messages/${messageId}/star`);
|
|
704
|
+
return response.data;
|
|
705
|
+
},
|
|
706
|
+
getStarredMessages: async (convId) => {
|
|
707
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/starred`);
|
|
708
|
+
return (response.data || []).map((star) => ({
|
|
709
|
+
...star,
|
|
710
|
+
conversationId: idString(star.conversationId),
|
|
711
|
+
messageId: normalizeChatMessage(star.messageId),
|
|
712
|
+
}));
|
|
713
|
+
},
|
|
714
|
+
pinMessage: async (messageId, expiresAt) => {
|
|
715
|
+
const response = await post(`${BASE_PATH}/messages/${messageId}/pin`, { expiresAt });
|
|
716
|
+
return response.data;
|
|
717
|
+
},
|
|
718
|
+
unpinMessage: async (messageId) => {
|
|
719
|
+
const response = await del(`${BASE_PATH}/messages/${messageId}/pin`);
|
|
720
|
+
return response.data;
|
|
721
|
+
},
|
|
722
|
+
getPinnedMessages: async (convId) => {
|
|
723
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/pins`);
|
|
724
|
+
return (response.data || []).map((pin) => ({
|
|
725
|
+
...pin,
|
|
726
|
+
conversationId: idString(pin.conversationId),
|
|
727
|
+
pinnedBy: normalizeActorRef(pin.pinnedBy),
|
|
728
|
+
messageId: normalizeChatMessage(pin.messageId),
|
|
729
|
+
}));
|
|
730
|
+
},
|
|
731
|
+
votePoll: async (pollId, optionIndex) => {
|
|
732
|
+
try {
|
|
733
|
+
const response = await patch(`${BASE_PATH}/polls/${pollId}/vote`, { optionIndex });
|
|
734
|
+
return { ...response, data: response.data ? normalizePoll(response.data) : null };
|
|
735
|
+
}
|
|
736
|
+
catch (error) {
|
|
737
|
+
console.error(error);
|
|
738
|
+
return { error: error, data: null };
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
};
|