@myrjfa/state 3.0.0 → 3.0.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.
Files changed (333) hide show
  1. package/dist/index.d.ts +33 -16
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +33 -16
  4. package/dist/lib/{adminDashboardActions.d.ts → actions/adminDashboard.d.ts} +2 -28
  5. package/dist/lib/actions/adminDashboard.d.ts.map +1 -0
  6. package/dist/lib/{adminDashboardActions.js → actions/adminDashboard.js} +1 -1
  7. package/dist/lib/{adventureActions.d.ts → actions/adventure.d.ts} +3 -3
  8. package/dist/lib/actions/adventure.d.ts.map +1 -0
  9. package/dist/lib/{adventureActions.js → actions/adventure.js} +2 -2
  10. package/dist/lib/{analyticsActions.d.ts → actions/analytics.d.ts} +2 -2
  11. package/dist/lib/actions/analytics.d.ts.map +1 -0
  12. package/dist/lib/{analyticsActions.js → actions/analytics.js} +1 -1
  13. package/dist/lib/actions/application.d.ts +46 -0
  14. package/dist/lib/actions/application.d.ts.map +1 -0
  15. package/dist/lib/actions/application.js +123 -0
  16. package/dist/lib/actions/auth.d.ts +27 -0
  17. package/dist/lib/actions/auth.d.ts.map +1 -1
  18. package/dist/lib/actions/auth.js +47 -8
  19. package/dist/lib/{authorizationActions.d.ts → actions/authorization.d.ts} +2 -2
  20. package/dist/lib/actions/authorization.d.ts.map +1 -0
  21. package/dist/lib/{authorizationActions.js → actions/authorization.js} +1 -1
  22. package/dist/lib/{b2bActions.d.ts → actions/b2b.d.ts} +4 -9
  23. package/dist/lib/actions/b2b.d.ts.map +1 -0
  24. package/dist/lib/{b2bActions.js → actions/b2b.js} +1 -1
  25. package/dist/lib/actions/blog.d.ts +79 -0
  26. package/dist/lib/actions/blog.d.ts.map +1 -0
  27. package/dist/lib/actions/blog.js +243 -0
  28. package/dist/lib/actions/booking.d.ts +29 -5
  29. package/dist/lib/actions/booking.d.ts.map +1 -1
  30. package/dist/lib/actions/booking.js +29 -23
  31. package/dist/lib/actions/brand.d.ts +29 -0
  32. package/dist/lib/actions/brand.d.ts.map +1 -0
  33. package/dist/lib/{brandActions.js → actions/brand.js} +1 -1
  34. package/dist/lib/actions/chat.d.ts +27 -2
  35. package/dist/lib/actions/chat.d.ts.map +1 -1
  36. package/dist/lib/actions/chat.js +45 -1
  37. package/dist/lib/{communityActions.d.ts → actions/community.d.ts} +3 -3
  38. package/dist/lib/actions/community.d.ts.map +1 -0
  39. package/dist/lib/{communityActions.js → actions/community.js} +1 -1
  40. package/dist/lib/{companionActions.d.ts → actions/companion.d.ts} +11 -3
  41. package/dist/lib/actions/companion.d.ts.map +1 -0
  42. package/dist/lib/{companionActions.js → actions/companion.js} +30 -80
  43. package/dist/lib/actions/contact.d.ts +13 -0
  44. package/dist/lib/actions/contact.d.ts.map +1 -0
  45. package/dist/lib/actions/contact.js +24 -0
  46. package/dist/lib/{creatorMarketplaceActions.d.ts → actions/creatorMarketplace.d.ts} +4 -9
  47. package/dist/lib/actions/creatorMarketplace.d.ts.map +1 -0
  48. package/dist/lib/{creatorMarketplaceActions.js → actions/creatorMarketplace.js} +1 -1
  49. package/dist/lib/actions/deviceSession.d.ts +17 -0
  50. package/dist/lib/actions/deviceSession.d.ts.map +1 -0
  51. package/dist/lib/actions/deviceSession.js +34 -0
  52. package/dist/lib/{discountActions.d.ts → actions/discount.d.ts} +3 -16
  53. package/dist/lib/actions/discount.d.ts.map +1 -0
  54. package/dist/lib/{discountActions.js → actions/discount.js} +1 -1
  55. package/dist/lib/{eventActions.d.ts → actions/event.d.ts} +1 -1
  56. package/dist/lib/actions/event.d.ts.map +1 -0
  57. package/dist/lib/{eventActions.js → actions/event.js} +2 -2
  58. package/dist/lib/actions/fetcher.d.ts +2 -2
  59. package/dist/lib/actions/fetcher.d.ts.map +1 -1
  60. package/dist/lib/actions/fetcher.js +2 -2
  61. package/dist/lib/actions/geocoding.d.ts +8 -0
  62. package/dist/lib/actions/geocoding.d.ts.map +1 -0
  63. package/dist/lib/actions/geocoding.js +29 -0
  64. package/dist/lib/{guideActions.d.ts → actions/guide.d.ts} +3 -3
  65. package/dist/lib/actions/guide.d.ts.map +1 -0
  66. package/dist/lib/{guideActions.js → actions/guide.js} +2 -2
  67. package/dist/lib/{hostDashboardActions.d.ts → actions/hostDashboard.d.ts} +2 -1
  68. package/dist/lib/actions/hostDashboard.d.ts.map +1 -0
  69. package/dist/lib/{hostDashboardActions.js → actions/hostDashboard.js} +6 -2
  70. package/dist/lib/actions/itinerary.d.ts +12 -0
  71. package/dist/lib/actions/itinerary.d.ts.map +1 -0
  72. package/dist/lib/actions/itinerary.js +36 -0
  73. package/dist/lib/actions/itineraryOrder.d.ts +55 -0
  74. package/dist/lib/actions/itineraryOrder.d.ts.map +1 -0
  75. package/dist/lib/actions/itineraryOrder.js +15 -0
  76. package/dist/lib/actions/listingInterest.d.ts +6 -0
  77. package/dist/lib/actions/listingInterest.d.ts.map +1 -0
  78. package/dist/lib/actions/listingInterest.js +18 -0
  79. package/dist/lib/{locationActions.d.ts → actions/location.d.ts} +5 -76
  80. package/dist/lib/actions/location.d.ts.map +1 -0
  81. package/dist/lib/{locationActions.js → actions/location.js} +5 -1
  82. package/dist/lib/{loyaltyActions.d.ts → actions/loyalty.d.ts} +2 -2
  83. package/dist/lib/actions/loyalty.d.ts.map +1 -0
  84. package/dist/lib/{loyaltyActions.js → actions/loyalty.js} +1 -1
  85. package/dist/lib/{marketplaceContractActions.d.ts → actions/marketplaceContract.d.ts} +2 -2
  86. package/dist/lib/actions/marketplaceContract.d.ts.map +1 -0
  87. package/dist/lib/{marketplaceContractActions.js → actions/marketplaceContract.js} +1 -1
  88. package/dist/lib/actions/{actions.d.ts → notification.d.ts} +3 -94
  89. package/dist/lib/actions/notification.d.ts.map +1 -0
  90. package/dist/lib/actions/notification.js +42 -0
  91. package/dist/lib/actions/opportunity.d.ts +108 -0
  92. package/dist/lib/actions/opportunity.d.ts.map +1 -0
  93. package/dist/lib/actions/opportunity.js +329 -0
  94. package/dist/lib/{packageActions.d.ts → actions/package.d.ts} +5 -14
  95. package/dist/lib/actions/package.d.ts.map +1 -0
  96. package/dist/lib/{packageActions.js → actions/package.js} +2 -2
  97. package/dist/lib/actions/place.d.ts +37 -0
  98. package/dist/lib/actions/place.d.ts.map +1 -0
  99. package/dist/lib/{placeActions.js → actions/place.js} +1 -1
  100. package/dist/lib/actions/portfolio.d.ts +58 -0
  101. package/dist/lib/actions/portfolio.d.ts.map +1 -0
  102. package/dist/lib/actions/portfolio.js +48 -0
  103. package/dist/lib/actions/profile.d.ts +36 -0
  104. package/dist/lib/actions/profile.d.ts.map +1 -0
  105. package/dist/lib/actions/profile.js +76 -0
  106. package/dist/lib/actions/property.d.ts +17 -0
  107. package/dist/lib/actions/property.d.ts.map +1 -0
  108. package/dist/lib/actions/property.js +16 -0
  109. package/dist/lib/{rentalActions.d.ts → actions/rental.d.ts} +3 -3
  110. package/dist/lib/actions/rental.d.ts.map +1 -0
  111. package/dist/lib/{rentalActions.js → actions/rental.js} +2 -2
  112. package/dist/lib/actions/review.d.ts +44 -0
  113. package/dist/lib/actions/review.d.ts.map +1 -0
  114. package/dist/lib/actions/review.js +101 -0
  115. package/dist/lib/{roomActions.d.ts → actions/room.d.ts} +1 -1
  116. package/dist/lib/actions/room.d.ts.map +1 -0
  117. package/dist/lib/{roomActions.js → actions/room.js} +1 -1
  118. package/dist/lib/actions/serverActions.js +1 -1
  119. package/dist/lib/{socialAutomationActions.d.ts → actions/socialAutomation.d.ts} +3 -3
  120. package/dist/lib/actions/socialAutomation.d.ts.map +1 -0
  121. package/dist/lib/{socialAutomationActions.js → actions/socialAutomation.js} +1 -1
  122. package/dist/lib/actions/socket.d.ts +5 -0
  123. package/dist/lib/actions/socket.d.ts.map +1 -1
  124. package/dist/lib/actions/socket.js +14 -0
  125. package/dist/lib/{stayActions.d.ts → actions/stay.d.ts} +1 -1
  126. package/dist/lib/actions/stay.d.ts.map +1 -0
  127. package/dist/lib/{stayActions.js → actions/stay.js} +1 -2
  128. package/dist/lib/{storeActions.d.ts → actions/store.d.ts} +2 -2
  129. package/dist/lib/actions/store.d.ts.map +1 -0
  130. package/dist/lib/{storeActions.js → actions/store.js} +1 -1
  131. package/dist/lib/actions/subscription.d.ts +9 -0
  132. package/dist/lib/actions/subscription.d.ts.map +1 -0
  133. package/dist/lib/actions/subscription.js +17 -0
  134. package/dist/lib/{travelPackageActions.d.ts → actions/travelPackage.d.ts} +4 -4
  135. package/dist/lib/actions/travelPackage.d.ts.map +1 -0
  136. package/dist/lib/{travelPackageActions.js → actions/travelPackage.js} +3 -51
  137. package/dist/lib/actions/user.d.ts +24 -0
  138. package/dist/lib/actions/user.d.ts.map +1 -1
  139. package/dist/lib/actions/user.js +57 -0
  140. package/dist/lib/actions/verification.d.ts +15 -0
  141. package/dist/lib/actions/verification.d.ts.map +1 -0
  142. package/dist/lib/actions/verification.js +78 -0
  143. package/dist/lib/actions/wishlist.d.ts +14 -0
  144. package/dist/lib/actions/wishlist.d.ts.map +1 -0
  145. package/dist/lib/actions/wishlist.js +29 -0
  146. package/dist/lib/context/ChatContext.d.ts.map +1 -1
  147. package/dist/lib/context/QueryProvider.d.ts.map +1 -0
  148. package/dist/lib/data/adventure.d.ts +3 -0
  149. package/dist/lib/data/adventure.d.ts.map +1 -0
  150. package/dist/lib/{companionDummyData.d.ts → data/companion.d.ts} +1 -1
  151. package/dist/lib/data/companion.d.ts.map +1 -0
  152. package/dist/lib/data/destinations.d.ts.map +1 -0
  153. package/dist/lib/{eventsDummyData.d.ts → data/event.d.ts} +2 -2
  154. package/dist/lib/data/event.d.ts.map +1 -0
  155. package/dist/lib/{eventsDummyData.js → data/event.js} +1 -1
  156. package/dist/lib/data/guide.d.ts +3 -0
  157. package/dist/lib/data/guide.d.ts.map +1 -0
  158. package/dist/lib/data/package.d.ts +3 -0
  159. package/dist/lib/data/package.d.ts.map +1 -0
  160. package/dist/lib/{packageDummyData.js → data/package.js} +1 -1
  161. package/dist/lib/data/rental.d.ts +3 -0
  162. package/dist/lib/data/rental.d.ts.map +1 -0
  163. package/dist/lib/{staysDummyData.d.ts → data/stay.d.ts} +1 -1
  164. package/dist/lib/data/stay.d.ts.map +1 -0
  165. package/dist/lib/{storeDummyData.d.ts → data/store.d.ts} +3 -3
  166. package/dist/lib/data/store.d.ts.map +1 -0
  167. package/dist/lib/{vehicleData.d.ts → data/vehicle.d.ts} +1 -1
  168. package/dist/lib/data/vehicle.d.ts.map +1 -0
  169. package/dist/lib/{adventureFormPage.d.ts → forms/adventure.d.ts} +2 -2
  170. package/dist/lib/forms/adventure.d.ts.map +1 -0
  171. package/dist/lib/{adventureFormPage.js → forms/adventure.js} +1 -1
  172. package/dist/lib/forms/entitySubmission.d.ts.map +1 -0
  173. package/dist/lib/{eventFormPage.d.ts → forms/event.d.ts} +1 -1
  174. package/dist/lib/forms/event.d.ts.map +1 -0
  175. package/dist/lib/forms/multistepDraft.d.ts.map +1 -0
  176. package/dist/lib/{opportunityFormPage.d.ts → forms/opportunity.d.ts} +7 -7
  177. package/dist/lib/forms/opportunity.d.ts.map +1 -0
  178. package/dist/lib/{opportunityFormData.d.ts → forms/opportunityData.d.ts} +1 -1
  179. package/dist/lib/forms/opportunityData.d.ts.map +1 -0
  180. package/dist/lib/{rentalFormPage.d.ts → forms/rental.d.ts} +2 -2
  181. package/dist/lib/forms/rental.d.ts.map +1 -0
  182. package/dist/lib/{rentalFormPage.js → forms/rental.js} +1 -1
  183. package/dist/lib/{travelPackageFormPage.d.ts → forms/travelPackage.d.ts} +19 -5
  184. package/dist/lib/forms/travelPackage.d.ts.map +1 -0
  185. package/dist/lib/{travelPackageFormPage.js → forms/travelPackage.js} +2 -2
  186. package/dist/lib/{travelPackageFormData.d.ts → forms/travelPackageData.d.ts} +2 -2
  187. package/dist/lib/forms/travelPackageData.d.ts.map +1 -0
  188. package/dist/lib/hooks/useContextualConversation.d.ts +1 -1
  189. package/dist/lib/hooks/useContextualConversation.d.ts.map +1 -1
  190. package/dist/lib/hooks/usePersistentDraftState.d.ts.map +1 -0
  191. package/dist/lib/models/authentication.d.ts +24 -0
  192. package/dist/lib/models/authentication.d.ts.map +1 -0
  193. package/dist/lib/models/authentication.js +1 -0
  194. package/dist/lib/models/authorization.d.ts +1 -1
  195. package/dist/lib/models/authorization.d.ts.map +1 -1
  196. package/dist/lib/models/authorization.js +7 -2
  197. package/dist/lib/models/blog.d.ts +10 -10
  198. package/dist/lib/{brandActions.d.ts → models/brand.d.ts} +4 -30
  199. package/dist/lib/models/brand.d.ts.map +1 -0
  200. package/dist/lib/models/brand.js +1 -0
  201. package/dist/lib/models/chat.d.ts +51 -3
  202. package/dist/lib/models/chat.d.ts.map +1 -1
  203. package/dist/lib/models/discount.d.ts +25 -12
  204. package/dist/lib/models/discount.d.ts.map +1 -1
  205. package/dist/lib/models/itinerary.d.ts +115 -0
  206. package/dist/lib/models/itinerary.d.ts.map +1 -1
  207. package/dist/lib/models/location.d.ts +114 -0
  208. package/dist/lib/models/location.d.ts.map +1 -0
  209. package/dist/lib/models/location.js +1 -0
  210. package/dist/lib/models/marketplace.d.ts +8 -0
  211. package/dist/lib/models/marketplace.d.ts.map +1 -1
  212. package/dist/lib/models/notifications.d.ts +2 -2
  213. package/dist/lib/models/opportunities/freelance.d.ts +6 -6
  214. package/dist/lib/models/opportunities/internship.d.ts +6 -6
  215. package/dist/lib/models/opportunities/job.d.ts +6 -6
  216. package/dist/lib/models/opportunities/opportunity.d.ts +6 -6
  217. package/dist/lib/models/opportunities/volunteerJob.d.ts +6 -6
  218. package/dist/lib/models/package.d.ts +6 -6
  219. package/dist/lib/{placeActions.d.ts → models/place.d.ts} +3 -36
  220. package/dist/lib/models/place.d.ts.map +1 -0
  221. package/dist/lib/models/place.js +1 -0
  222. package/dist/lib/models/portfolio.d.ts +8 -8
  223. package/dist/lib/models/review.d.ts +6 -6
  224. package/dist/lib/models/stay.d.ts +19 -19
  225. package/dist/lib/models/travelPackage.d.ts +7 -7
  226. package/dist/lib/models/travelPackage.d.ts.map +1 -1
  227. package/dist/lib/models/travelPackage.js +3 -3
  228. package/dist/lib/{vehicleModels.d.ts → models/vehicle.d.ts} +1 -1
  229. package/dist/lib/models/vehicle.d.ts.map +1 -0
  230. package/dist/lib/models/verification.d.ts +28 -0
  231. package/dist/lib/models/verification.d.ts.map +1 -0
  232. package/dist/lib/models/verification.js +1 -0
  233. package/dist/lib/utils/entityTiles.d.ts +11 -0
  234. package/dist/lib/utils/entityTiles.d.ts.map +1 -0
  235. package/dist/lib/{util.js → utils/entityTiles.js} +2 -2
  236. package/dist/lib/utils/imageUpload.d.ts.map +1 -0
  237. package/dist/lib/utils/packageAvailability.d.ts.map +1 -0
  238. package/dist/lib/{utils.d.ts → utils/text.d.ts} +2 -2
  239. package/dist/lib/utils/text.d.ts.map +1 -0
  240. package/package.json +2 -1
  241. package/dist/hooks/usePersistentDraftState.d.ts.map +0 -1
  242. package/dist/lib/QueryProvider.d.ts.map +0 -1
  243. package/dist/lib/actions/actions.d.ts.map +0 -1
  244. package/dist/lib/actions/actions.js +0 -374
  245. package/dist/lib/actions.d.ts +0 -557
  246. package/dist/lib/actions.d.ts.map +0 -1
  247. package/dist/lib/actions.js +0 -1330
  248. package/dist/lib/adminDashboardActions.d.ts.map +0 -1
  249. package/dist/lib/adventureActions.d.ts.map +0 -1
  250. package/dist/lib/adventureDummyData.d.ts +0 -3
  251. package/dist/lib/adventureDummyData.d.ts.map +0 -1
  252. package/dist/lib/adventureFormPage.d.ts.map +0 -1
  253. package/dist/lib/analyticsActions.d.ts.map +0 -1
  254. package/dist/lib/authorizationActions.d.ts.map +0 -1
  255. package/dist/lib/b2bActions.d.ts.map +0 -1
  256. package/dist/lib/brandActions.d.ts.map +0 -1
  257. package/dist/lib/communityActions.d.ts.map +0 -1
  258. package/dist/lib/companionActions.d.ts.map +0 -1
  259. package/dist/lib/companionDummyData.d.ts.map +0 -1
  260. package/dist/lib/creatorMarketplaceActions.d.ts.map +0 -1
  261. package/dist/lib/destinations.d.ts.map +0 -1
  262. package/dist/lib/discountActions.d.ts.map +0 -1
  263. package/dist/lib/entitySubmission.d.ts.map +0 -1
  264. package/dist/lib/eventActions.d.ts.map +0 -1
  265. package/dist/lib/eventFormPage.d.ts.map +0 -1
  266. package/dist/lib/eventsDummyData.d.ts.map +0 -1
  267. package/dist/lib/guideActions.d.ts.map +0 -1
  268. package/dist/lib/guideDummyData.d.ts +0 -3
  269. package/dist/lib/guideDummyData.d.ts.map +0 -1
  270. package/dist/lib/hostDashboardActions.d.ts.map +0 -1
  271. package/dist/lib/imageUpload.d.ts.map +0 -1
  272. package/dist/lib/itineraryActions.d.ts +0 -7
  273. package/dist/lib/itineraryActions.d.ts.map +0 -1
  274. package/dist/lib/itineraryActions.js +0 -26
  275. package/dist/lib/locationActions.d.ts.map +0 -1
  276. package/dist/lib/loyaltyActions.d.ts.map +0 -1
  277. package/dist/lib/marketplaceContractActions.d.ts.map +0 -1
  278. package/dist/lib/multistepDraft.d.ts.map +0 -1
  279. package/dist/lib/opportunityFormData.d.ts.map +0 -1
  280. package/dist/lib/opportunityFormPage.d.ts.map +0 -1
  281. package/dist/lib/packageActions.d.ts.map +0 -1
  282. package/dist/lib/packageAvailability.d.ts.map +0 -1
  283. package/dist/lib/packageDummyData.d.ts +0 -3
  284. package/dist/lib/packageDummyData.d.ts.map +0 -1
  285. package/dist/lib/placeActions.d.ts.map +0 -1
  286. package/dist/lib/propertyActions.d.ts +0 -17
  287. package/dist/lib/propertyActions.d.ts.map +0 -1
  288. package/dist/lib/propertyActions.js +0 -16
  289. package/dist/lib/rentalActions.d.ts.map +0 -1
  290. package/dist/lib/rentalDummyData.d.ts +0 -3
  291. package/dist/lib/rentalDummyData.d.ts.map +0 -1
  292. package/dist/lib/rentalFormPage.d.ts.map +0 -1
  293. package/dist/lib/roomActions.d.ts.map +0 -1
  294. package/dist/lib/socialAutomationActions.d.ts.map +0 -1
  295. package/dist/lib/stayActions.d.ts.map +0 -1
  296. package/dist/lib/staysDummyData.d.ts.map +0 -1
  297. package/dist/lib/storeActions.d.ts.map +0 -1
  298. package/dist/lib/storeDummyData.d.ts.map +0 -1
  299. package/dist/lib/travelPackageActions.d.ts.map +0 -1
  300. package/dist/lib/travelPackageFormData.d.ts.map +0 -1
  301. package/dist/lib/travelPackageFormPage.d.ts.map +0 -1
  302. package/dist/lib/util.d.ts +0 -11
  303. package/dist/lib/util.d.ts.map +0 -1
  304. package/dist/lib/utils.d.ts.map +0 -1
  305. package/dist/lib/vehicleData.d.ts.map +0 -1
  306. package/dist/lib/vehicleModels.d.ts.map +0 -1
  307. /package/dist/lib/{QueryProvider.d.ts → context/QueryProvider.d.ts} +0 -0
  308. /package/dist/lib/{QueryProvider.js → context/QueryProvider.js} +0 -0
  309. /package/dist/lib/{adventureDummyData.js → data/adventure.js} +0 -0
  310. /package/dist/lib/{companionDummyData.js → data/companion.js} +0 -0
  311. /package/dist/lib/{destinations.d.ts → data/destinations.d.ts} +0 -0
  312. /package/dist/lib/{destinations.js → data/destinations.js} +0 -0
  313. /package/dist/lib/{guideDummyData.js → data/guide.js} +0 -0
  314. /package/dist/lib/{rentalDummyData.js → data/rental.js} +0 -0
  315. /package/dist/lib/{staysDummyData.js → data/stay.js} +0 -0
  316. /package/dist/lib/{storeDummyData.js → data/store.js} +0 -0
  317. /package/dist/lib/{vehicleData.js → data/vehicle.js} +0 -0
  318. /package/dist/lib/{entitySubmission.d.ts → forms/entitySubmission.d.ts} +0 -0
  319. /package/dist/lib/{entitySubmission.js → forms/entitySubmission.js} +0 -0
  320. /package/dist/lib/{eventFormPage.js → forms/event.js} +0 -0
  321. /package/dist/lib/{multistepDraft.d.ts → forms/multistepDraft.d.ts} +0 -0
  322. /package/dist/lib/{multistepDraft.js → forms/multistepDraft.js} +0 -0
  323. /package/dist/lib/{opportunityFormPage.js → forms/opportunity.js} +0 -0
  324. /package/dist/lib/{opportunityFormData.js → forms/opportunityData.js} +0 -0
  325. /package/dist/lib/{travelPackageFormData.js → forms/travelPackageData.js} +0 -0
  326. /package/dist/{hooks → lib/hooks}/usePersistentDraftState.d.ts +0 -0
  327. /package/dist/{hooks → lib/hooks}/usePersistentDraftState.js +0 -0
  328. /package/dist/lib/{vehicleModels.js → models/vehicle.js} +0 -0
  329. /package/dist/lib/{imageUpload.d.ts → utils/imageUpload.d.ts} +0 -0
  330. /package/dist/lib/{imageUpload.js → utils/imageUpload.js} +0 -0
  331. /package/dist/lib/{packageAvailability.d.ts → utils/packageAvailability.d.ts} +0 -0
  332. /package/dist/lib/{packageAvailability.js → utils/packageAvailability.js} +0 -0
  333. /package/dist/lib/{utils.js → utils/text.js} +0 -0
@@ -1,1330 +0,0 @@
1
- import { del, get, patch, post } from "@myrjfa/state/dist/lib/actions/fetcher";
2
- import { convertBlogToTileProps, convertOpportunityToTileProps } from "./util";
3
- // opportunity
4
- export async function getOpportunityTilesByStatus(status, limit) {
5
- try {
6
- const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
7
- const data = await get(endpoint, false);
8
- return {
9
- success: true,
10
- message: data.message,
11
- tiles: data.data.map((opportunity) => convertOpportunityToTileProps(opportunity)),
12
- };
13
- }
14
- catch (error) {
15
- console.error('Failed to add oppotunities by status: ', error);
16
- return {
17
- success: false,
18
- error: error.message,
19
- tiles: []
20
- };
21
- }
22
- }
23
- ;
24
- export async function trendingOpportunityTiles(limit) {
25
- try {
26
- const endpoint = `/newHostPost/getAllOppTiles?status=open&sort=trending${limit ? ("&limit=" + limit) : ""}`;
27
- const data = await get(endpoint, false);
28
- return {
29
- success: true,
30
- message: data.message,
31
- tiles: data.data.map((opportunity) => convertOpportunityToTileProps(opportunity)),
32
- };
33
- }
34
- catch (error) {
35
- console.error('Failed to fetch trending oppotunities: ', error);
36
- return {
37
- success: false,
38
- error: error.message,
39
- tiles: []
40
- };
41
- }
42
- }
43
- ;
44
- export async function relatedOpportunityTiles(slug, limit) {
45
- try {
46
- const endpoint = `/newHostPost/getAllOppTiles?status=open${limit ? ("&limit=" + limit) : ""}`;
47
- const data = await get(endpoint, false);
48
- return {
49
- success: true,
50
- message: data.message,
51
- tiles: data.data.map((opportunity) => convertOpportunityToTileProps(opportunity)),
52
- };
53
- }
54
- catch (error) {
55
- console.error('Failed to fetch related oppotunities: ', error);
56
- return {
57
- success: false,
58
- error: error.message,
59
- tiles: []
60
- };
61
- }
62
- }
63
- ;
64
- export async function favouriteOpportunityTiles() {
65
- try {
66
- const endpoint = `/opportunities/favourites`;
67
- const data = await get(endpoint);
68
- return {
69
- success: true,
70
- message: data.message,
71
- tiles: data.data.map((opportunity) => convertOpportunityToTileProps(opportunity)),
72
- };
73
- }
74
- catch (error) {
75
- console.error('Failed to fetch favourite oppotunities: ', error);
76
- return {
77
- success: false,
78
- error: error.message,
79
- tiles: []
80
- };
81
- }
82
- }
83
- ;
84
- export async function favouriteUserTiles() {
85
- try {
86
- const endpoint = `/users/favourites/all`;
87
- const data = await get(endpoint);
88
- return {
89
- success: true,
90
- message: data.message,
91
- tiles: data.data,
92
- };
93
- }
94
- catch (error) {
95
- console.error('Failed to fetch favourite items: ', error);
96
- return {
97
- success: false,
98
- error: error.message,
99
- tiles: []
100
- };
101
- }
102
- }
103
- ;
104
- // all opportunities (may not be required or may delete in future)
105
- // export async function getAllOpportunities(): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
106
- // try {
107
- // const res = await fetch('/sample/opportunity.json');
108
- // const opportunities = await res.json() as Opportunity[];
109
- // return {
110
- // success: true,
111
- // message: "fetch success",
112
- // opportunities: opportunities,
113
- // }
114
- // } catch (error: any) {
115
- // console.error('Failed to fetch all oppotunities: ', error);
116
- // return {
117
- // success: false,
118
- // error: error.message,
119
- // opportunities: []
120
- // };
121
- // }
122
- // };
123
- // for admin dashboard
124
- // export async function getOpportunitiesByStatus(status: string[], limit?: number): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
125
- // try {
126
- // const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
127
- // const data: {
128
- // data: Opportunity[], message: string
129
- // } = await get(endpoint);
130
- // return {
131
- // success: true,
132
- // message: data.message,
133
- // opportunities: data.data,
134
- // }
135
- // } catch (error: any) {
136
- // console.error('Failed to fetch opportunities by status: ', error);
137
- // return {
138
- // success: false,
139
- // error: error.message,
140
- // opportunities: []
141
- // };
142
- // }
143
- // };
144
- export async function opportunityDetails(slug) {
145
- try {
146
- const endpoint = `/newHostPost/getPost/${slug}`;
147
- const data = await get(endpoint);
148
- return {
149
- success: true,
150
- message: data.message,
151
- opportunity: data.data,
152
- };
153
- }
154
- catch (error) {
155
- console.error('Failed to fetch oppotunity details: ', error);
156
- return {
157
- success: false,
158
- error: error.message,
159
- opportunity: null
160
- };
161
- }
162
- }
163
- ;
164
- export async function opportunityMetaData(slug) {
165
- try {
166
- const endpoint = `/newHostPost/getOppMetaData/${slug}`;
167
- const data = await get(endpoint);
168
- const opportunity = data.data;
169
- return {
170
- success: true,
171
- message: data.message,
172
- metadata: {
173
- image: opportunity.images?.[0] || "/images/placeholder.svg",
174
- title: opportunity.title || 'Trippeaze',
175
- location: opportunity.city + ', ' + opportunity.state || 'india',
176
- skills: opportunity.skills || [],
177
- hostingType: opportunity.hostingType || "hostel",
178
- opportunityType: opportunity.opportunityType,
179
- },
180
- };
181
- }
182
- catch (error) {
183
- console.error('Failed to add oppotunities by status: ', error);
184
- return {
185
- success: false,
186
- error: error.message,
187
- metadata: null
188
- };
189
- }
190
- }
191
- ;
192
- export async function createOpportunity(formData) {
193
- try {
194
- const endpoint = `/newHostPost/create`;
195
- const data = await post(endpoint, formData);
196
- return {
197
- success: true,
198
- slug: data.data,
199
- message: data.message,
200
- };
201
- }
202
- catch (error) {
203
- console.error("Failed to save opportuntiy: ", error);
204
- return {
205
- success: false,
206
- error: error.message,
207
- };
208
- }
209
- }
210
- export async function editOpportunity(formData, slug) {
211
- try {
212
- const endpoint = `/newHostPost/update/${slug}`;
213
- const data = await patch(endpoint, formData);
214
- return {
215
- success: true,
216
- slug: data.data,
217
- message: data.message,
218
- };
219
- }
220
- catch (error) {
221
- console.error("Failed to save opportuntiy: ", error);
222
- return {
223
- success: false,
224
- error: error.message,
225
- };
226
- }
227
- }
228
- // export async function approveOpportunity(formData: FormData, slug: string): Promise<{ success: boolean, slug?: string, message?: string, error?: string }> {
229
- // try {
230
- // const endpoint = `/admin/approve-post/${slug}`
231
- // const data: { message: string, data: string } = await patch(endpoint, formData);
232
- // return {
233
- // success: true,
234
- // slug: data.data,
235
- // message: data.message,
236
- // }
237
- // }
238
- // catch (error: any) {
239
- // console.error('Failed to save opportuntiy: ', error);
240
- // return {
241
- // success: false,
242
- // error: error.message,
243
- // };
244
- // }
245
- // }
246
- // blogs
247
- export async function getBlogTilesByStatus(status, limit) {
248
- try {
249
- const endpoint = `/blog/getAllBlogTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
250
- const data = await get(endpoint, false);
251
- return {
252
- success: true,
253
- message: data.message,
254
- tiles: data.data.map((blog) => convertBlogToTileProps(blog)),
255
- };
256
- }
257
- catch (error) {
258
- console.error('Failed to fetch blogs: ', error);
259
- return {
260
- success: false,
261
- error: error.message,
262
- tiles: [],
263
- };
264
- }
265
- }
266
- export async function relatedBlogTiles(slug, limit) {
267
- try {
268
- const endpoint = `/blog/getAllBlogTiles?status=posted${limit ? ("&limit=" + (limit + 1)) : ""}`;
269
- const data = await get(endpoint, false);
270
- return {
271
- success: true,
272
- message: data.message,
273
- tiles: data.data.filter((blog) => blog.slug != slug).slice(0, limit).map((blog) => convertBlogToTileProps(blog)),
274
- };
275
- }
276
- catch (error) {
277
- console.error('Failed to fetch related blogs: ', error);
278
- return {
279
- success: false,
280
- error: error.message,
281
- tiles: [],
282
- };
283
- }
284
- }
285
- ;
286
- export async function trendingBlogTiles(limit) {
287
- try {
288
- const endpoint = `/blog/getAllBlogTiles?status=posted${limit ? ("&limit=" + limit) : ""}`;
289
- const data = await get(endpoint, false);
290
- return {
291
- success: true,
292
- message: data.message,
293
- tiles: data.data.map((blog) => convertBlogToTileProps(blog)),
294
- };
295
- }
296
- catch (error) {
297
- console.error('Failed to fetch trending blogs: ', error);
298
- return {
299
- success: false,
300
- error: error.message,
301
- tiles: [],
302
- };
303
- }
304
- }
305
- ;
306
- export async function blogsByUsername(username, role) {
307
- try {
308
- // pending and admin blogs
309
- const endpoint = `/blog/getBlogsByUsername/${role}/${username}`;
310
- const data = await get(endpoint);
311
- return {
312
- success: true,
313
- message: "fetch success",
314
- tiles: data.data.map((blog) => convertBlogToTileProps(blog)),
315
- };
316
- }
317
- catch (error) {
318
- console.error('Failed to fetch blogs: ', error);
319
- return {
320
- success: false,
321
- error: error.message,
322
- tiles: [],
323
- };
324
- }
325
- }
326
- export async function getMyBlogs() {
327
- try {
328
- const endpoint = `/blog/getUserBlogs`;
329
- const data = await get(endpoint);
330
- return {
331
- success: true,
332
- message: "fetch success",
333
- blogs: data.data,
334
- };
335
- }
336
- catch (error) {
337
- console.error('Failed to fetch blogs: ', error);
338
- return {
339
- success: false,
340
- error: error.message,
341
- blogs: [],
342
- };
343
- }
344
- }
345
- // for admin dashboard
346
- export async function getAdminBlogs() {
347
- try {
348
- const [pendingRes, activeRes] = await Promise.all([
349
- get(`/blog/getAllBlogCards?status=pending`),
350
- get(`/blog/getAllBlogCards?status=posted`),
351
- ]);
352
- return { success: true, pending: pendingRes.data, active: activeRes.data };
353
- }
354
- catch (error) {
355
- return { success: false, pending: [], active: [], error: error.message };
356
- }
357
- }
358
- export async function pendingBlogs() {
359
- try {
360
- const endpoint = `/blog/getAllBlogCards?status=pending`;
361
- const data = await get(endpoint);
362
- return {
363
- success: true,
364
- message: "fetch success",
365
- blogs: data.data,
366
- };
367
- }
368
- catch (error) {
369
- console.error('Failed to fetch blogs: ', error);
370
- return {
371
- success: false,
372
- error: error.message,
373
- blogs: [],
374
- };
375
- }
376
- }
377
- export async function deleteBlog(slug) {
378
- try {
379
- const endpoint = `/blog/delete/${slug}`;
380
- const data = await del(endpoint);
381
- return {
382
- success: true,
383
- message: data.message,
384
- };
385
- }
386
- catch (error) {
387
- console.error('Failed to delete blog: ', error);
388
- return {
389
- success: false,
390
- error: error.message,
391
- };
392
- }
393
- }
394
- // may not be needed
395
- // export async function getAllBlogs(): Promise<{ success: boolean, blogs: Blog[], message?: string, error?: string }> {
396
- // try {
397
- // const res = await fetch('/sample/blogs.json');
398
- // const blogs = await res.json() as Blog[];
399
- // return {
400
- // success: true,
401
- // message: "fetch success",
402
- // blogs: blogs,
403
- // };
404
- // } catch (error: any) {
405
- // console.error('Failed to fetch blogs: ', error);
406
- // return {
407
- // success: false,
408
- // error: error.message,
409
- // blogs: [],
410
- // };
411
- // }
412
- // }
413
- // for admin dashboard
414
- export async function blogDetails(id) {
415
- try {
416
- const endpoint = `/blog/getBlogBySlug/${id}`;
417
- const data = await get(endpoint, false);
418
- return {
419
- success: true,
420
- message: "fetch success",
421
- blog: data.blog,
422
- };
423
- }
424
- catch (error) {
425
- console.error('Failed to fetch blogs: ', error);
426
- return {
427
- success: false,
428
- error: error.message,
429
- blog: null,
430
- };
431
- }
432
- }
433
- export async function blogMetaData(slug) {
434
- try {
435
- const endpoint = `/blog/getBlogMetaData/${slug}`;
436
- const data = await get(endpoint, false);
437
- const blog = data.data;
438
- return {
439
- success: true,
440
- message: data.message,
441
- metadata: {
442
- image: blog.blogImages?.[0] || "/images/placeholder.svg",
443
- title: blog.title || 'Trippeaze Blog',
444
- overview: blog.overview || 'Volunteer travel exchange platform - connect with global hosts and opportunities.',
445
- hashtags: blog.hashtags || "",
446
- },
447
- };
448
- }
449
- catch (error) {
450
- console.error('Failed to add oppotunities by status: ', error);
451
- return {
452
- success: false,
453
- error: error.message,
454
- metadata: null
455
- };
456
- }
457
- }
458
- ;
459
- export async function createBlog(formData) {
460
- try {
461
- const endpoint = `/blog/create`;
462
- const data = await post(endpoint, formData);
463
- return {
464
- success: true,
465
- slug: data.data,
466
- message: data.message,
467
- };
468
- }
469
- catch (error) {
470
- console.error("Failed to save blog: ", error);
471
- return {
472
- success: false,
473
- error: error.message,
474
- };
475
- }
476
- }
477
- export async function editBlog(formData, slug) {
478
- try {
479
- const endpoint = `/blog/update/${slug}`;
480
- const data = await patch(endpoint, formData);
481
- return {
482
- success: true,
483
- slug: data.data,
484
- message: data.message,
485
- };
486
- }
487
- catch (error) {
488
- console.error("Failed to save blog: ", error);
489
- return {
490
- success: false,
491
- error: error.message,
492
- };
493
- }
494
- }
495
- export async function toogleBlogLike(slug) {
496
- try {
497
- const endpoint = `/blog/${slug}/toogleLike`;
498
- const data = await get(endpoint);
499
- return {
500
- success: true,
501
- message: data.message,
502
- };
503
- }
504
- catch (error) {
505
- console.error(error);
506
- return {
507
- success: false,
508
- error: error,
509
- };
510
- }
511
- }
512
- // Application form
513
- export async function getVolunteerApplicationForm(slug) {
514
- try {
515
- const endpoint = `/applications/getApplicationByUserAndSlug/${slug}`;
516
- const data = await get(endpoint);
517
- return { success: true, message: data.message, application: data.data };
518
- }
519
- catch (error) {
520
- return {
521
- success: false,
522
- error: error.message,
523
- application: null,
524
- };
525
- }
526
- }
527
- export async function applicationDetails(applicationId) {
528
- try {
529
- const endpoint = `/applications/getSingleApplication/${applicationId}`;
530
- const data = await get(endpoint);
531
- return { success: true, message: data.message, application: data.data };
532
- }
533
- catch (error) {
534
- return {
535
- success: false,
536
- error: error.message,
537
- application: null,
538
- };
539
- }
540
- }
541
- export async function getApplicationsForOpportunity(slug) {
542
- try {
543
- const endpoint = `/applications/getUserApplication/${slug}`;
544
- const data = await get(endpoint);
545
- return { success: true, message: data.message, applications: data.data };
546
- }
547
- catch (error) {
548
- return {
549
- success: false,
550
- error: error.message,
551
- applications: [],
552
- };
553
- }
554
- }
555
- export async function saveApplicationForm(formData) {
556
- try {
557
- const endpoint = `/applications/applyForOpportunity`;
558
- const data = await post(endpoint, formData);
559
- return {
560
- success: true,
561
- message: data.message,
562
- };
563
- }
564
- catch (error) {
565
- return {
566
- success: false,
567
- error: error.message,
568
- };
569
- }
570
- }
571
- export async function updateApplicationStatus(status, id) {
572
- try {
573
- const endpoint = `/applications/updateApplicationStatus/${id}`;
574
- const data = await patch(endpoint, {
575
- status: status,
576
- });
577
- return {
578
- success: true,
579
- message: data.message,
580
- };
581
- }
582
- catch (error) {
583
- return {
584
- success: false,
585
- error: error.message,
586
- };
587
- }
588
- }
589
- export async function editApplication(formData, id) {
590
- try {
591
- const endpoint = `/applications/updateApplication/${id}`;
592
- const data = await patch(endpoint, formData);
593
- return {
594
- success: true,
595
- message: data.message,
596
- };
597
- }
598
- catch (error) {
599
- return {
600
- success: false,
601
- error: error.message,
602
- };
603
- }
604
- }
605
- // rating and reviews
606
- export async function getReviewsById(id, type, options) {
607
- try {
608
- const { page = 1, limit = 5, sortBy = 'createdAt', sortOrder = 'desc', rating } = options || {};
609
- let endpoint = `/reviews/entity/${id}/${type}?page=${page}&limit=${limit}&sortBy=${sortBy}&sortOrder=${sortOrder}`;
610
- if (rating)
611
- endpoint += `&rating=${rating}`;
612
- const data = await get(endpoint, false);
613
- return {
614
- success: true,
615
- reviews: data.data.reviews,
616
- totalCount: data.data.totalCount,
617
- hasMore: data.data.hasMore,
618
- message: data.message,
619
- };
620
- }
621
- catch (error) {
622
- console.error('Failed to get reviews: ', error);
623
- return {
624
- success: false,
625
- reviews: [],
626
- totalCount: 0,
627
- hasMore: false,
628
- error: error.message,
629
- };
630
- }
631
- }
632
- // opportunity
633
- export async function adminOpportunitiesByHost(username) {
634
- try {
635
- const data = await get(`/newHostPost/getOpportunitiesByUsername/${username}?status=open,pending,draft,denied,archived,closed`);
636
- return { success: true, opportunities: data.data || [] };
637
- }
638
- catch (error) {
639
- return { success: false, opportunities: [], error: error.message };
640
- }
641
- }
642
- export async function opportunityTilesByHost(username, status = ['open'], limit) {
643
- try {
644
- const statusQuery = Array.isArray(status) ? status.join(',') : status;
645
- const endpoint = `/newHostPost/getOpportunitiesByUsername/${username}?status=${statusQuery}${limit ? ("&limit=" + limit) : ""}`;
646
- const data = await get(endpoint);
647
- return {
648
- success: true,
649
- message: data.message,
650
- tiles: data.data.map((opportunity) => convertOpportunityToTileProps(opportunity)),
651
- };
652
- }
653
- catch (error) {
654
- console.error('Failed to fetch host oppotunities: ', error);
655
- return {
656
- success: false,
657
- error: error.message,
658
- tiles: []
659
- };
660
- }
661
- }
662
- ;
663
- // for host dashboard
664
- export async function opportunitiesByHost() {
665
- try {
666
- const endpoint = `/host/dashboard/listings?category=opportunity`;
667
- const data = await get(endpoint);
668
- return {
669
- success: true,
670
- message: data.message,
671
- opportunities: data.data?.listings || [],
672
- };
673
- }
674
- catch (error) {
675
- console.error("Failed to fetch oppotunities by host: ", error);
676
- return {
677
- success: false,
678
- error: error.message,
679
- opportunities: [],
680
- };
681
- }
682
- }
683
- // for admin dashboard
684
- // export async function getOpportunitiesByStatus(status: string[], limit?: number): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
685
- // try {
686
- // const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
687
- // const data: {
688
- // data: Opportunity[], message: string
689
- // } = await get(endpoint);
690
- // return {
691
- // success: true,
692
- // message: data.message,
693
- // opportunities: data.data,
694
- // }
695
- // } catch (error: any) {
696
- // console.error('Failed to fetch opportunities by status: ', error);
697
- // return {
698
- // success: false,
699
- // error: error.message,
700
- // opportunities: []
701
- // };
702
- // }
703
- // };
704
- export async function getHrOpportunities(username) {
705
- try {
706
- const endpoint = `/admin/${username}/opportunities`;
707
- const data = await get(endpoint);
708
- return {
709
- success: true,
710
- message: data.message,
711
- opportunities: data.data,
712
- };
713
- }
714
- catch (error) {
715
- console.error('Failed to fetch opportunities: ', error);
716
- return {
717
- success: false,
718
- error: error.message,
719
- opportunities: []
720
- };
721
- }
722
- }
723
- ;
724
- export async function getAdminOpportunities() {
725
- try {
726
- const endpoint = `/admin/approve-post`;
727
- const data = await get(endpoint);
728
- return {
729
- success: true,
730
- message: data.message,
731
- opportunities: data.data,
732
- };
733
- }
734
- catch (error) {
735
- console.error('Failed to fetch opportunities: ', error);
736
- return {
737
- success: false,
738
- error: error.message,
739
- opportunities: []
740
- };
741
- }
742
- }
743
- ;
744
- export async function deleteOpportunity(slug) {
745
- try {
746
- const endpoint = `/newHostPost/delete/${slug}`;
747
- const data = await del(endpoint);
748
- return {
749
- success: true,
750
- message: data.message,
751
- };
752
- }
753
- catch (error) {
754
- console.error('Failed to delete opportunity: ', error);
755
- return {
756
- success: false,
757
- error: error.message,
758
- };
759
- }
760
- }
761
- export async function addObserverToOpportunity(id, observer) {
762
- try {
763
- const endpoint = `/admin/observer/add`;
764
- const data = await patch(endpoint, { slug: id, ...observer });
765
- return {
766
- success: true,
767
- message: data.message,
768
- };
769
- }
770
- catch (error) {
771
- console.error('Failed to add observer to opportunity: ', error);
772
- return {
773
- success: false,
774
- error: error.message,
775
- };
776
- }
777
- }
778
- export async function notifyMatchingUsers(slug) {
779
- try {
780
- const data = await post(`/admin/opportunities/${slug}/notify-users`, {});
781
- return { success: true, count: data.data.count, message: data.message };
782
- }
783
- catch (error) {
784
- return { success: false, error: error.message };
785
- }
786
- }
787
- // export async function approveOpportunity(formData: FormData, slug: string): Promise<{ success: boolean, slug?: string, message?: string, error?: string }> {
788
- // try {
789
- // const endpoint = `/admin/approve-post/${slug}`
790
- // const data: { message: string, data: string } = await patch(endpoint, formData);
791
- // return {
792
- // success: true,
793
- // slug: data.data,
794
- // message: data.message,
795
- // }
796
- // }
797
- // catch (error: any) {
798
- // console.error('Failed to save opportuntiy: ', error);
799
- // return {
800
- // success: false,
801
- // error: error.message,
802
- // };
803
- // }
804
- // }
805
- // host
806
- // user/host
807
- export async function userDetails(username, role) {
808
- try {
809
- const accountRole = role === "host" ? "host" : "user";
810
- const endpoint = `/${accountRole}s/other-${accountRole}/${username}`;
811
- const data = await get(endpoint);
812
- return {
813
- success: true,
814
- user: data?.data,
815
- message: data.message
816
- };
817
- }
818
- catch (error) {
819
- if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE' || error.message?.includes('bail out of prerendering'))) {
820
- throw error;
821
- }
822
- console.error('Failed to fetch user details: ', error);
823
- return { success: false, user: null, status: error.status, error: error.message };
824
- }
825
- }
826
- export async function saveUserData(userData) {
827
- try {
828
- const endpoint = `/${userData.role ?? "user"}s/register`;
829
- // Registration is a public endpoint. It must not attach stale session
830
- // cookies or invoke the authenticated refresh-token retry flow.
831
- const data = await post(endpoint, userData, false);
832
- return {
833
- success: true,
834
- message: data.message
835
- };
836
- }
837
- catch (error) {
838
- return { success: false, status: error.status, error: error.message };
839
- }
840
- }
841
- export async function updateUserSkillExpertise(username, skill, expertise) {
842
- try {
843
- const endpoint = `/users/updateSkillExpertise/${username}`;
844
- const data = await patch(endpoint, { skill: skill, expertise: expertise });
845
- return { success: true, message: data.message };
846
- }
847
- catch (error) {
848
- console.error('Error updating skill expertise: ', error);
849
- return {
850
- success: false,
851
- error: error.message,
852
- };
853
- }
854
- }
855
- export async function sendVerificationEmail(email, role) {
856
- try {
857
- const endpoint = `/${role}s/resend-otp`;
858
- const data = await post(endpoint, { email: email });
859
- return {
860
- success: true,
861
- message: data.message,
862
- };
863
- }
864
- catch (error) {
865
- return { success: false, status: error.status, error: error.message };
866
- }
867
- }
868
- export async function updateUserData(role, formData, baseAccountType) {
869
- try {
870
- const accountType = baseAccountType || (role === "host" ? "host" : "user");
871
- const endpoint = accountType === "host" ? "/hosts/update" : "/users/update";
872
- const data = await patch(endpoint, formData);
873
- return { success: true, user: data.data, message: data.message };
874
- }
875
- catch (error) {
876
- return { success: false, error: error.message, user: null };
877
- }
878
- }
879
- // id kyc
880
- export async function submitId(formData) {
881
- try {
882
- const endpoint = `/users/upload/id`;
883
- const data = await patch(endpoint, formData);
884
- return { success: true, message: data.message };
885
- }
886
- catch (error) {
887
- console.error("Error submitting id: ", error);
888
- return {
889
- success: false,
890
- error: error.message,
891
- };
892
- }
893
- }
894
- export async function verifySelfie(formData, role) {
895
- try {
896
- const endpoint = `/${role}s/upload/id/selfie`;
897
- const data = await patch(endpoint, formData);
898
- return { success: true, message: data.message };
899
- }
900
- catch (error) {
901
- console.error('Error submitting selfie for verification: ', error);
902
- return {
903
- success: false,
904
- error: error.message,
905
- };
906
- }
907
- }
908
- export async function verifyId(username, role) {
909
- try {
910
- const endpoint = `/${role}s/verify/id/${username}`;
911
- const data = await get(endpoint);
912
- return { success: true, message: data.message };
913
- }
914
- catch (error) {
915
- console.error("Error verifying Id: ", error);
916
- return {
917
- success: false,
918
- error: error.message,
919
- };
920
- }
921
- }
922
- export async function rejectId(username, role) {
923
- try {
924
- const endpoint = `/${role}s/reject/id/${username}`;
925
- const data = await get(endpoint);
926
- return { success: true, message: data.message };
927
- }
928
- catch (error) {
929
- console.error('Error rejecting Id: ', error);
930
- return {
931
- success: false,
932
- error: error.message,
933
- };
934
- }
935
- }
936
- // ── Host Business Verification ────────────────────────────────────────────────
937
- export async function submitBusinessDoc(formData) {
938
- try {
939
- const data = await patch('/hosts/upload/business', formData);
940
- return { success: true, message: data.message };
941
- }
942
- catch (error) {
943
- return { success: false, error: error.message };
944
- }
945
- }
946
- export async function submitBusinessSelfie(formData) {
947
- try {
948
- const data = await patch('/hosts/upload/business/selfie', formData);
949
- return { success: true, message: data.message };
950
- }
951
- catch (error) {
952
- return { success: false, error: error.message };
953
- }
954
- }
955
- export async function verifyBusiness(username) {
956
- try {
957
- const data = await get(`/hosts/verify/business/${username}`);
958
- return { success: true, message: data.message };
959
- }
960
- catch (error) {
961
- return { success: false, error: error.message };
962
- }
963
- }
964
- export async function rejectBusiness(username, reason) {
965
- try {
966
- const params = reason ? `?reason=${encodeURIComponent(reason)}` : '';
967
- const data = await get(`/hosts/reject/business/${username}${params}`);
968
- return { success: true, message: data.message };
969
- }
970
- catch (error) {
971
- return { success: false, error: error.message };
972
- }
973
- }
974
- export async function updateSocialLink(type, url, role) {
975
- try {
976
- const endpoint = `/${role}s/updateSocialLink`;
977
- const data = await patch(endpoint, { type: type, url: url });
978
- return { success: true, message: data.message };
979
- }
980
- catch (error) {
981
- console.error('Error updating social media handle link: ', error);
982
- return {
983
- success: false,
984
- error: error.message,
985
- };
986
- }
987
- }
988
- export async function getOpportunityObservers() {
989
- try {
990
- const data = await get(`/admin/allUsers`);
991
- return {
992
- success: true,
993
- message: data.message,
994
- observers: data.data,
995
- };
996
- }
997
- catch (error) {
998
- console.error('Failed to get users with given role: ', error);
999
- return {
1000
- success: false,
1001
- error: error.message,
1002
- observers: [],
1003
- };
1004
- }
1005
- }
1006
- export async function getVariableUserData(accountType) {
1007
- try {
1008
- const endpoint = accountType === "host" ? `/hosts/variables` : `/users/variables`;
1009
- const data = await get(endpoint);
1010
- return {
1011
- success: true,
1012
- message: data.message,
1013
- data: data.data,
1014
- };
1015
- }
1016
- catch (error) {
1017
- console.error('Failed to get varaible user data: ', error);
1018
- return {
1019
- success: false,
1020
- error: error.message,
1021
- data: null,
1022
- };
1023
- }
1024
- }
1025
- export async function subscribeToNewsLetter(email) {
1026
- try {
1027
- const endpoint = `/subscription/create`;
1028
- const data = await post(endpoint, { email: email });
1029
- return { success: true, message: data.message };
1030
- }
1031
- catch (error) {
1032
- console.error('Error subscribing to newsletter: ', error);
1033
- return {
1034
- success: false,
1035
- error: error.message,
1036
- };
1037
- }
1038
- }
1039
- // subscribe
1040
- export async function subscribeToCareersPage(email) {
1041
- try {
1042
- const endpoint = `/subscription/create-job`;
1043
- const data = await post(endpoint, { email: email });
1044
- return { success: true, message: data.message };
1045
- }
1046
- catch (error) {
1047
- console.error("Error subscribing to newsletter: ", error);
1048
- return {
1049
- success: false,
1050
- error: error.message,
1051
- };
1052
- }
1053
- }
1054
- export async function contactUs(email, name, subject, message) {
1055
- try {
1056
- const baseUrl = process.env.NEXT_PUBLIC_API_URL;
1057
- if (!baseUrl) {
1058
- throw new Error("Contact form is unavailable right now.");
1059
- }
1060
- const response = await fetch(`${baseUrl}/contactUs`, {
1061
- method: "POST",
1062
- credentials: "include",
1063
- headers: {
1064
- "Content-Type": "application/json",
1065
- Accept: "application/json",
1066
- },
1067
- body: JSON.stringify({
1068
- email: email,
1069
- name: name,
1070
- subject: subject,
1071
- message: message,
1072
- }),
1073
- });
1074
- const data = (await response.json().catch(() => ({})));
1075
- if (!response.ok) {
1076
- throw new Error(data.error || data.message || "Failed to send message. Please try again later.");
1077
- }
1078
- return { success: true, message: data.message || "Message sent successfully!" };
1079
- }
1080
- catch (error) {
1081
- console.error("Error contacting trippeaze: ", error);
1082
- return {
1083
- success: false,
1084
- error: error?.message || "Failed to send message. Please try again later.",
1085
- };
1086
- }
1087
- }
1088
- // volunteer specific
1089
- // portfolio
1090
- export async function getUserPortfolio(id) {
1091
- try {
1092
- const endpoint = "/portfolio/getPost/" + id;
1093
- const data = await get(endpoint);
1094
- return { success: true, message: data.message, portfolios: data.data };
1095
- }
1096
- catch (error) {
1097
- if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
1098
- throw error;
1099
- }
1100
- console.error('Failed to fetch user details: ', error);
1101
- return { success: false, error: error.message, portfolios: [] };
1102
- }
1103
- }
1104
- export async function addPortfolioItem(formData) {
1105
- try {
1106
- const endpoint = "/portfolio/add";
1107
- const data = await post(endpoint, formData);
1108
- return { success: true, message: data.message, portfolio: data.data };
1109
- }
1110
- catch (error) {
1111
- if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
1112
- throw error;
1113
- }
1114
- console.error('Failed to fetch user details: ', error);
1115
- return { success: false, error: error.message, portfolio: null };
1116
- }
1117
- }
1118
- export async function removePortfolioItem(id) {
1119
- try {
1120
- const endpoint = "/portfolio/delete/" + id;
1121
- const data = await del(endpoint);
1122
- return {
1123
- success: true,
1124
- message: data.message,
1125
- };
1126
- }
1127
- catch (error) {
1128
- if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
1129
- throw error;
1130
- }
1131
- console.error('Failed to fetch user details: ', error);
1132
- return { success: false, error: error.message };
1133
- }
1134
- }
1135
- // resume
1136
- export async function saveUserResume(file) {
1137
- try {
1138
- const endpoint = `/users/resume-update`;
1139
- const formData = new FormData();
1140
- formData.append("resume", file);
1141
- const data = await patch(endpoint, formData);
1142
- return {
1143
- success: true,
1144
- message: data.message,
1145
- user: data.data,
1146
- };
1147
- }
1148
- catch (error) {
1149
- return { success: false, error: error.message, user: null };
1150
- }
1151
- }
1152
- // wishlist
1153
- export async function removeUserWishlist(slug) {
1154
- try {
1155
- const endpoint = `/users/wishlist/remove`;
1156
- const data = await post(endpoint, {
1157
- opportunityId: slug,
1158
- });
1159
- return { success: true, message: data.message, wishlist: data.data };
1160
- }
1161
- catch (error) {
1162
- console.error("Failed to add oppotunity to wishlist: ", error);
1163
- return {
1164
- success: false,
1165
- error: error.message,
1166
- wishlist: [],
1167
- };
1168
- }
1169
- }
1170
- // Application form
1171
- export async function getApplicationsOfVolunteer() {
1172
- try {
1173
- const endpoint = `/applications/getApplicationsOfVolunteer`;
1174
- const data = await get(endpoint);
1175
- return { success: true, message: data.message, applications: data.data };
1176
- }
1177
- catch (error) {
1178
- return {
1179
- success: false,
1180
- error: error.message,
1181
- applications: [],
1182
- };
1183
- }
1184
- }
1185
- export async function withdrawApplicationForm(id) {
1186
- try {
1187
- const endpoint = `/applications/deleteUserApply?id=${id}`;
1188
- const data = await del(endpoint);
1189
- return {
1190
- success: true,
1191
- message: data.message,
1192
- };
1193
- }
1194
- catch (error) {
1195
- return {
1196
- success: false,
1197
- error: error.message,
1198
- };
1199
- }
1200
- }
1201
- export async function getUserContact(username, role) {
1202
- try {
1203
- const endpoint = `/${role}s/getUserContact/${username}`;
1204
- const data = await get(endpoint);
1205
- return {
1206
- success: true,
1207
- message: data.message,
1208
- details: data.data,
1209
- };
1210
- }
1211
- catch (error) {
1212
- return {
1213
- success: false,
1214
- error: error.message,
1215
- details: null,
1216
- };
1217
- }
1218
- }
1219
- // notifications
1220
- export async function getAllNotifications() {
1221
- try {
1222
- const endpoint = `/notification?all=true`;
1223
- const data = await get(endpoint);
1224
- return {
1225
- success: true,
1226
- message: data.message,
1227
- notifs: data.data.notifications,
1228
- unreadCount: data.data.unreadCount,
1229
- };
1230
- }
1231
- catch (error) {
1232
- console.error("Failed to fetch notifications: ", error);
1233
- return {
1234
- success: false,
1235
- error: error.message,
1236
- notifs: [],
1237
- unreadCount: 0,
1238
- };
1239
- }
1240
- }
1241
- export async function getNotifications(limit) {
1242
- try {
1243
- const endpoint = `/notification?limit=${limit}`;
1244
- const data = await get(endpoint);
1245
- return {
1246
- success: true,
1247
- message: data.message,
1248
- notifs: data.data.notifications,
1249
- unreadCount: data.data.unreadCount,
1250
- };
1251
- }
1252
- catch (error) {
1253
- console.error("Failed to fetch notifications: ", error);
1254
- return {
1255
- success: false,
1256
- error: error.message,
1257
- notifs: [],
1258
- unreadCount: 0,
1259
- };
1260
- }
1261
- }
1262
- export async function toggleNotification(id, read) {
1263
- try {
1264
- const endpoint = `/notification/${id}`;
1265
- const data = await patch(endpoint, {
1266
- isRead: read,
1267
- });
1268
- return {
1269
- success: true,
1270
- message: data.message,
1271
- };
1272
- }
1273
- catch (error) {
1274
- console.error("Failed to toggle notfication: ", error);
1275
- return {
1276
- success: false,
1277
- error: error.message,
1278
- };
1279
- }
1280
- }
1281
- export async function toggleAllNotification(read) {
1282
- try {
1283
- const endpoint = `/notification`;
1284
- const data = await patch(endpoint, { isRead: read });
1285
- return {
1286
- success: true,
1287
- message: data.message,
1288
- };
1289
- }
1290
- catch (error) {
1291
- console.error('Failed to toggle all notifications: ', error);
1292
- return {
1293
- success: false,
1294
- error: error.message,
1295
- };
1296
- }
1297
- }
1298
- export async function getLoggedInDevices(role, baseAccountType) {
1299
- try {
1300
- const accountType = baseAccountType || (role === "host" ? "host" : "user");
1301
- const endpoint = accountType === "host" ? "/hosts/devices" : "/users/devices";
1302
- const data = await get(endpoint);
1303
- return { success: true, devices: data.data.devices };
1304
- }
1305
- catch (error) {
1306
- return { success: false, devices: [], error: error.message };
1307
- }
1308
- }
1309
- export async function logoutSingleDevice(role, deviceId, baseAccountType) {
1310
- try {
1311
- const accountType = baseAccountType || (role === "host" ? "host" : "user");
1312
- const endpoint = accountType === "host" ? `/hosts/devices/${deviceId}` : `/users/devices/${deviceId}`;
1313
- const data = await del(endpoint);
1314
- return { success: true, message: data.message };
1315
- }
1316
- catch (error) {
1317
- return { success: false, error: error.message };
1318
- }
1319
- }
1320
- export async function logoutAllOtherDevices(role, baseAccountType) {
1321
- try {
1322
- const accountType = baseAccountType || (role === "host" ? "host" : "user");
1323
- const endpoint = accountType === "host" ? "/hosts/devices/logout-all" : "/users/devices/logout-all";
1324
- const data = await del(endpoint);
1325
- return { success: true, message: data.message };
1326
- }
1327
- catch (error) {
1328
- return { success: false, error: error.message };
1329
- }
1330
- }