@myrjfa/state 2.3.1 → 2.3.3

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 (179) hide show
  1. package/dist/lib/actions/actions.d.ts +6 -6
  2. package/dist/lib/actions/auth.d.ts +23 -19
  3. package/dist/lib/actions/auth.d.ts.map +1 -1
  4. package/dist/lib/actions/auth.js +24 -5
  5. package/dist/lib/actions/chat.d.ts +20 -14
  6. package/dist/lib/actions/chat.d.ts.map +1 -1
  7. package/dist/lib/actions/chat.js +2 -2
  8. package/dist/lib/actions/fetcher.d.ts.map +1 -1
  9. package/dist/lib/actions/fetcher.js +15 -8
  10. package/dist/lib/actions.d.ts +12 -12
  11. package/dist/lib/actions.d.ts.map +1 -1
  12. package/dist/lib/actions.js +3 -1
  13. package/dist/lib/authSessionManager.d.ts.map +1 -1
  14. package/dist/lib/authSessionManager.js +77 -13
  15. package/dist/lib/authSessionPolicy.d.ts +34 -0
  16. package/dist/lib/authSessionPolicy.d.ts.map +1 -1
  17. package/dist/lib/authSessionPolicy.js +52 -0
  18. package/dist/lib/context/ChatContext.d.ts.map +1 -1
  19. package/dist/lib/context/ChatContext.js +12 -6
  20. package/dist/lib/models/authorization.d.ts +4 -3
  21. package/dist/lib/models/authorization.d.ts.map +1 -1
  22. package/dist/lib/models/authorization.js +10 -4
  23. package/dist/lib/models/blog.d.ts +4 -4
  24. package/dist/lib/models/chat.d.ts +10 -2
  25. package/dist/lib/models/chat.d.ts.map +1 -1
  26. package/dist/lib/models/chat.js +8 -0
  27. package/dist/lib/models/discount.d.ts +52 -52
  28. package/dist/lib/models/notifications.d.ts +2 -2
  29. package/dist/lib/models/opportunities/freelance.d.ts +34 -34
  30. package/dist/lib/models/opportunities/internship.d.ts +34 -34
  31. package/dist/lib/models/opportunities/job.d.ts +34 -34
  32. package/dist/lib/models/opportunities/opportunity.d.ts +34 -34
  33. package/dist/lib/models/opportunities/volunteerJob.d.ts +34 -34
  34. package/dist/lib/models/package.d.ts +16 -16
  35. package/dist/lib/models/portfolio.d.ts +2 -2
  36. package/dist/lib/models/pricing.d.ts +12 -12
  37. package/dist/lib/models/review.d.ts +2 -2
  38. package/dist/lib/models/stay.d.ts +18 -18
  39. package/dist/lib/models/travelPackage.d.ts +36 -36
  40. package/dist/lib/models/user.d.ts +12 -12
  41. package/dist/lib/userAtom.d.ts +126 -25
  42. package/dist/lib/userAtom.d.ts.map +1 -1
  43. package/dist/lib/userAtom.js +79 -45
  44. package/package.json +1 -1
  45. package/dist/lib/actions/adminDashboard.d.ts +0 -4
  46. package/dist/lib/actions/adminDashboard.d.ts.map +0 -1
  47. package/dist/lib/actions/adminDashboard.js +0 -29
  48. package/dist/lib/actions/adventure.d.ts +0 -104
  49. package/dist/lib/actions/adventure.d.ts.map +0 -1
  50. package/dist/lib/actions/adventure.js +0 -203
  51. package/dist/lib/actions/application.d.ts +0 -35
  52. package/dist/lib/actions/application.d.ts.map +0 -1
  53. package/dist/lib/actions/application.js +0 -573
  54. package/dist/lib/actions/blog.d.ts +0 -61
  55. package/dist/lib/actions/blog.d.ts.map +0 -1
  56. package/dist/lib/actions/blog.js +0 -762
  57. package/dist/lib/actions/brand.d.ts +0 -83
  58. package/dist/lib/actions/brand.d.ts.map +0 -1
  59. package/dist/lib/actions/brand.js +0 -28
  60. package/dist/lib/actions/companion.d.ts +0 -174
  61. package/dist/lib/actions/companion.d.ts.map +0 -1
  62. package/dist/lib/actions/companion.js +0 -276
  63. package/dist/lib/actions/event.d.ts +0 -178
  64. package/dist/lib/actions/event.d.ts.map +0 -1
  65. package/dist/lib/actions/event.js +0 -214
  66. package/dist/lib/actions/guide.d.ts +0 -55
  67. package/dist/lib/actions/guide.d.ts.map +0 -1
  68. package/dist/lib/actions/guide.js +0 -128
  69. package/dist/lib/actions/hostDashboard.d.ts +0 -122
  70. package/dist/lib/actions/hostDashboard.d.ts.map +0 -1
  71. package/dist/lib/actions/hostDashboard.js +0 -329
  72. package/dist/lib/actions/location.d.ts +0 -141
  73. package/dist/lib/actions/location.d.ts.map +0 -1
  74. package/dist/lib/actions/location.js +0 -113
  75. package/dist/lib/actions/notifications.d.ts +0 -91
  76. package/dist/lib/actions/notifications.d.ts.map +0 -1
  77. package/dist/lib/actions/notifications.js +0 -83
  78. package/dist/lib/actions/opportunity.d.ts +0 -44
  79. package/dist/lib/actions/opportunity.d.ts.map +0 -1
  80. package/dist/lib/actions/opportunity.js +0 -318
  81. package/dist/lib/actions/package.d.ts +0 -85
  82. package/dist/lib/actions/package.d.ts.map +0 -1
  83. package/dist/lib/actions/package.js +0 -167
  84. package/dist/lib/actions/place.d.ts +0 -191
  85. package/dist/lib/actions/place.d.ts.map +0 -1
  86. package/dist/lib/actions/place.js +0 -57
  87. package/dist/lib/actions/portfolio.d.ts +0 -65
  88. package/dist/lib/actions/portfolio.d.ts.map +0 -1
  89. package/dist/lib/actions/portfolio.js +0 -62
  90. package/dist/lib/actions/property.d.ts +0 -17
  91. package/dist/lib/actions/property.d.ts.map +0 -1
  92. package/dist/lib/actions/property.js +0 -16
  93. package/dist/lib/actions/rental.d.ts +0 -87
  94. package/dist/lib/actions/rental.d.ts.map +0 -1
  95. package/dist/lib/actions/rental.js +0 -205
  96. package/dist/lib/actions/review.d.ts +0 -8
  97. package/dist/lib/actions/review.d.ts.map +0 -1
  98. package/dist/lib/actions/review.js +0 -102
  99. package/dist/lib/actions/room.d.ts +0 -39
  100. package/dist/lib/actions/room.d.ts.map +0 -1
  101. package/dist/lib/actions/room.js +0 -74
  102. package/dist/lib/actions/stay.d.ts +0 -97
  103. package/dist/lib/actions/stay.d.ts.map +0 -1
  104. package/dist/lib/actions/stay.js +0 -138
  105. package/dist/lib/actions/travelPackage.d.ts +0 -104
  106. package/dist/lib/actions/travelPackage.d.ts.map +0 -1
  107. package/dist/lib/actions/travelPackage.js +0 -487
  108. package/dist/lib/data/adventureDummyData.d.ts +0 -3
  109. package/dist/lib/data/adventureDummyData.d.ts.map +0 -1
  110. package/dist/lib/data/adventureDummyData.js +0 -138
  111. package/dist/lib/data/adventureFormPage.d.ts +0 -28
  112. package/dist/lib/data/adventureFormPage.d.ts.map +0 -1
  113. package/dist/lib/data/adventureFormPage.js +0 -58
  114. package/dist/lib/data/companionDummyData.d.ts +0 -99
  115. package/dist/lib/data/companionDummyData.d.ts.map +0 -1
  116. package/dist/lib/data/companionDummyData.js +0 -203
  117. package/dist/lib/data/destinations.d.ts +0 -14
  118. package/dist/lib/data/destinations.d.ts.map +0 -1
  119. package/dist/lib/data/destinations.js +0 -203
  120. package/dist/lib/data/eventFormPage.d.ts +0 -38
  121. package/dist/lib/data/eventFormPage.d.ts.map +0 -1
  122. package/dist/lib/data/eventFormPage.js +0 -56
  123. package/dist/lib/data/eventsDummyData.d.ts +0 -54
  124. package/dist/lib/data/eventsDummyData.d.ts.map +0 -1
  125. package/dist/lib/data/eventsDummyData.js +0 -586
  126. package/dist/lib/data/guideDummyData.d.ts +0 -3
  127. package/dist/lib/data/guideDummyData.d.ts.map +0 -1
  128. package/dist/lib/data/guideDummyData.js +0 -66
  129. package/dist/lib/data/opportunityFormData.d.ts +0 -13
  130. package/dist/lib/data/opportunityFormData.d.ts.map +0 -1
  131. package/dist/lib/data/opportunityFormData.js +0 -62
  132. package/dist/lib/data/opportunityFormPage.d.ts +0 -12
  133. package/dist/lib/data/opportunityFormPage.d.ts.map +0 -1
  134. package/dist/lib/data/opportunityFormPage.js +0 -33
  135. package/dist/lib/data/packageDummyData.d.ts +0 -3
  136. package/dist/lib/data/packageDummyData.d.ts.map +0 -1
  137. package/dist/lib/data/packageDummyData.js +0 -56
  138. package/dist/lib/data/rentalDummyData.d.ts +0 -3
  139. package/dist/lib/data/rentalDummyData.d.ts.map +0 -1
  140. package/dist/lib/data/rentalDummyData.js +0 -382
  141. package/dist/lib/data/rentalFormPage.d.ts +0 -11
  142. package/dist/lib/data/rentalFormPage.d.ts.map +0 -1
  143. package/dist/lib/data/rentalFormPage.js +0 -86
  144. package/dist/lib/data/staysDummyData.d.ts +0 -72
  145. package/dist/lib/data/staysDummyData.d.ts.map +0 -1
  146. package/dist/lib/data/staysDummyData.js +0 -694
  147. package/dist/lib/data/storeDummyData.d.ts +0 -33
  148. package/dist/lib/data/storeDummyData.d.ts.map +0 -1
  149. package/dist/lib/data/storeDummyData.js +0 -336
  150. package/dist/lib/data/travelPackageFormData.d.ts +0 -19
  151. package/dist/lib/data/travelPackageFormData.d.ts.map +0 -1
  152. package/dist/lib/data/travelPackageFormData.js +0 -51
  153. package/dist/lib/data/travelPackageFormPage.d.ts +0 -22
  154. package/dist/lib/data/travelPackageFormPage.d.ts.map +0 -1
  155. package/dist/lib/data/travelPackageFormPage.js +0 -40
  156. package/dist/lib/data/vehicleData.d.ts +0 -2
  157. package/dist/lib/data/vehicleData.d.ts.map +0 -1
  158. package/dist/lib/data/vehicleData.js +0 -187
  159. package/dist/lib/data/vehicleModels.d.ts +0 -2
  160. package/dist/lib/data/vehicleModels.d.ts.map +0 -1
  161. package/dist/lib/data/vehicleModels.js +0 -128
  162. package/dist/lib/hooks/usePersistentDraftState.d.ts +0 -20
  163. package/dist/lib/hooks/usePersistentDraftState.d.ts.map +0 -1
  164. package/dist/lib/hooks/usePersistentDraftState.js +0 -47
  165. package/dist/lib/models/forms.d.ts +0 -384
  166. package/dist/lib/models/forms.d.ts.map +0 -1
  167. package/dist/lib/models/forms.js +0 -121
  168. package/dist/lib/pricingActions.d.ts +0 -13
  169. package/dist/lib/pricingActions.d.ts.map +0 -1
  170. package/dist/lib/pricingActions.js +0 -16
  171. package/dist/lib/utils/entitySubmission.d.ts +0 -21
  172. package/dist/lib/utils/entitySubmission.d.ts.map +0 -1
  173. package/dist/lib/utils/entitySubmission.js +0 -10
  174. package/dist/lib/utils/imageUpload.d.ts +0 -4
  175. package/dist/lib/utils/imageUpload.d.ts.map +0 -1
  176. package/dist/lib/utils/imageUpload.js +0 -36
  177. package/dist/lib/utils/tileConverters.d.ts +0 -8
  178. package/dist/lib/utils/tileConverters.d.ts.map +0 -1
  179. package/dist/lib/utils/tileConverters.js +0 -59
@@ -1,113 +0,0 @@
1
- import { get, post } from "./fetcher";
2
- // ─── Location fetching ────────────────────────────────────────────────────────
3
- export async function fetchLocationBySlugPath(slugPath) {
4
- try {
5
- const data = await get(`/locations/by-path?slugPath=${encodeURIComponent(slugPath)}`);
6
- return { success: true, location: data.data };
7
- }
8
- catch (err) {
9
- return { success: false, error: err.message };
10
- }
11
- }
12
- export async function fetchLocationChildren(id) {
13
- try {
14
- const data = await get(`/locations/${id}/children`);
15
- return { success: true, children: data.data };
16
- }
17
- catch (err) {
18
- return { success: false, error: err.message, children: [] };
19
- }
20
- }
21
- export async function fetchLocationBreadcrumb(id) {
22
- try {
23
- const data = await get(`/locations/${id}/breadcrumb`);
24
- return data.data ?? [];
25
- }
26
- catch {
27
- return [];
28
- }
29
- }
30
- export async function searchLocations(q, opts = {}) {
31
- try {
32
- const params = new URLSearchParams({ q, limit: String(opts.limit ?? 8) });
33
- if (opts.type)
34
- params.set("type", opts.type);
35
- const data = await get(`/locations/search?${params}`);
36
- return data.data ?? { results: [], total: 0 };
37
- }
38
- catch {
39
- return { results: [], total: 0 };
40
- }
41
- }
42
- // ─── Itineraries ──────────────────────────────────────────────────────────────
43
- export async function fetchLocationItineraries(id, page = 1) {
44
- try {
45
- const data = await get(`/locations/${id}/itineraries?page=${page}&limit=6`);
46
- return data.data ?? { itineraries: [], total: 0 };
47
- }
48
- catch {
49
- return { itineraries: [], total: 0 };
50
- }
51
- }
52
- // ─── Forum ────────────────────────────────────────────────────────────────────
53
- export async function fetchThreads(locationId, opts = {}) {
54
- try {
55
- const params = new URLSearchParams({
56
- sort: opts.sort ?? "latest",
57
- page: String(opts.page ?? 1),
58
- limit: "20",
59
- });
60
- if (opts.category)
61
- params.set("category", opts.category);
62
- const data = await get(`/locations/${locationId}/threads?${params}`);
63
- return data.data ?? { threads: [], total: 0 };
64
- }
65
- catch {
66
- return { threads: [], total: 0 };
67
- }
68
- }
69
- export async function createThread(payload) {
70
- try {
71
- const data = await post("/locations/threads", payload);
72
- return { success: true, thread: data.data };
73
- }
74
- catch (err) {
75
- return { success: false, error: err.message };
76
- }
77
- }
78
- export async function fetchComments(threadId, page = 1) {
79
- try {
80
- const data = await get(`/locations/threads/${threadId}/comments?page=${page}&limit=50`);
81
- return data.data ?? { comments: [], total: 0 };
82
- }
83
- catch {
84
- return { comments: [], total: 0 };
85
- }
86
- }
87
- export async function fetchThread(threadId) {
88
- try {
89
- const data = await get(`/locations/threads/${threadId}`);
90
- return { success: true, thread: data.data };
91
- }
92
- catch (err) {
93
- return { success: false, error: err.message };
94
- }
95
- }
96
- export async function createComment(threadId, payload) {
97
- try {
98
- const data = await post(`/locations/threads/${threadId}/comments`, payload);
99
- return { success: true, comment: data.data };
100
- }
101
- catch (err) {
102
- return { success: false, error: err.message };
103
- }
104
- }
105
- export async function voteThread(threadId, vote) {
106
- try {
107
- await post(`/locations/threads/${threadId}/vote`, { vote });
108
- return { success: true };
109
- }
110
- catch (err) {
111
- return { success: false, error: err.message };
112
- }
113
- }
@@ -1,91 +0,0 @@
1
- export declare function getAllNotifications(): Promise<{
2
- success: boolean;
3
- message: string;
4
- notifs: {
5
- message: string;
6
- _id: string;
7
- read: boolean;
8
- type?: "new_message" | "milestone_completed" | "expense_added" | "group_invite" | "mention" | "application_received" | "application_status" | "application_shortlisted" | "id_verification_request" | "id_verified" | "id_rejected" | "package_enquiry" | "package_approval" | "package_denial" | "package_rating" | "package_review" | "opportunity_assigned" | "opportunity_approval" | "opportunity_denial" | "opportunity_rating" | "opportunity_review" | "blog_like" | "blog_comment" | "blog_posted" | "blog_approval" | "blog_denial" | "booking_confirmed" | "system" | "general" | undefined;
9
- metadata?: {
10
- status?: string | undefined;
11
- rating?: number | undefined;
12
- title?: string | undefined;
13
- conversationId?: string | undefined;
14
- messageId?: string | undefined;
15
- senderId?: string | undefined;
16
- senderName?: string | undefined;
17
- conversationName?: string | undefined;
18
- milestoneId?: string | undefined;
19
- expenseId?: string | undefined;
20
- referenceId?: string | undefined;
21
- referenceType?: string | undefined;
22
- } | undefined;
23
- userId?: string | undefined;
24
- timestamp?: any;
25
- link?: string | undefined;
26
- category?: "opportunity" | "blog" | "application" | "system" | "general" | "chat" | "package" | "account" | "booking" | undefined;
27
- }[];
28
- unreadCount: number;
29
- error?: undefined;
30
- } | {
31
- success: boolean;
32
- error: any;
33
- notifs: never[];
34
- unreadCount: number;
35
- message?: undefined;
36
- }>;
37
- export declare function getNotifications(limit: number): Promise<{
38
- success: boolean;
39
- message: string;
40
- notifs: {
41
- message: string;
42
- _id: string;
43
- read: boolean;
44
- type?: "new_message" | "milestone_completed" | "expense_added" | "group_invite" | "mention" | "application_received" | "application_status" | "application_shortlisted" | "id_verification_request" | "id_verified" | "id_rejected" | "package_enquiry" | "package_approval" | "package_denial" | "package_rating" | "package_review" | "opportunity_assigned" | "opportunity_approval" | "opportunity_denial" | "opportunity_rating" | "opportunity_review" | "blog_like" | "blog_comment" | "blog_posted" | "blog_approval" | "blog_denial" | "booking_confirmed" | "system" | "general" | undefined;
45
- metadata?: {
46
- status?: string | undefined;
47
- rating?: number | undefined;
48
- title?: string | undefined;
49
- conversationId?: string | undefined;
50
- messageId?: string | undefined;
51
- senderId?: string | undefined;
52
- senderName?: string | undefined;
53
- conversationName?: string | undefined;
54
- milestoneId?: string | undefined;
55
- expenseId?: string | undefined;
56
- referenceId?: string | undefined;
57
- referenceType?: string | undefined;
58
- } | undefined;
59
- userId?: string | undefined;
60
- timestamp?: any;
61
- link?: string | undefined;
62
- category?: "opportunity" | "blog" | "application" | "system" | "general" | "chat" | "package" | "account" | "booking" | undefined;
63
- }[];
64
- unreadCount: number;
65
- error?: undefined;
66
- } | {
67
- success: boolean;
68
- error: any;
69
- notifs: never[];
70
- unreadCount: number;
71
- message?: undefined;
72
- }>;
73
- export declare function toggleNotification(id: string, read: boolean): Promise<{
74
- success: boolean;
75
- message: string;
76
- error?: undefined;
77
- } | {
78
- success: boolean;
79
- error: any;
80
- message?: undefined;
81
- }>;
82
- export declare function toggleAllNotification(read: boolean): Promise<{
83
- success: boolean;
84
- message: string;
85
- error?: undefined;
86
- } | {
87
- success: boolean;
88
- error: any;
89
- message?: undefined;
90
- }>;
91
- //# sourceMappingURL=notifications.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/notifications.ts"],"names":[],"mappings":"AAkBA,wBAAsB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsBxC;AAMD,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsBnD;AAMD,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;;;;;;;;GAiBjE;AAMD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO;;;;;;;;GAexD"}
@@ -1,83 +0,0 @@
1
- import { get, patch } from "./fetcher";
2
- // notifications
3
- export async function getAllNotifications() {
4
- try {
5
- const endpoint = `/notification?all=true`;
6
- const data = await get(endpoint);
7
- return {
8
- success: true,
9
- message: data.message,
10
- notifs: data.data.notifications,
11
- unreadCount: data.data.unreadCount,
12
- };
13
- }
14
- catch (error) {
15
- console.error("Failed to fetch notifications: ", error);
16
- return {
17
- success: false,
18
- error: error.message,
19
- notifs: [],
20
- unreadCount: 0,
21
- };
22
- }
23
- }
24
- // notifications
25
- export async function getNotifications(limit) {
26
- try {
27
- const endpoint = `/notification?limit=${limit}`;
28
- const data = await get(endpoint);
29
- return {
30
- success: true,
31
- message: data.message,
32
- notifs: data.data.notifications,
33
- unreadCount: data.data.unreadCount,
34
- };
35
- }
36
- catch (error) {
37
- console.error("Failed to fetch notifications: ", error);
38
- return {
39
- success: false,
40
- error: error.message,
41
- notifs: [],
42
- unreadCount: 0,
43
- };
44
- }
45
- }
46
- // notifications
47
- export async function toggleNotification(id, read) {
48
- try {
49
- const endpoint = `/notfication/${id}`;
50
- const data = await patch(endpoint, {
51
- isRead: read,
52
- });
53
- return {
54
- success: true,
55
- message: data.message,
56
- };
57
- }
58
- catch (error) {
59
- console.error("Failed to toggle notfication: ", error);
60
- return {
61
- success: false,
62
- error: error.message,
63
- };
64
- }
65
- }
66
- // notifications
67
- export async function toggleAllNotification(read) {
68
- try {
69
- const endpoint = `/notfication/update/all`;
70
- const data = await patch(endpoint, { isRead: read });
71
- return {
72
- success: true,
73
- message: data.message,
74
- };
75
- }
76
- catch (error) {
77
- console.error("Failed to toggle all notfications: ", error);
78
- return {
79
- success: false,
80
- error: error.message,
81
- };
82
- }
83
- }
@@ -1,44 +0,0 @@
1
- import type { OppMetaData, Opportunity } from "../models/opportunities/opportunity";
2
- import type { TileProps } from "../models/tile";
3
- export declare function getOpportunityTilesByStatus(status: string[], limit?: number): Promise<{
4
- success: boolean;
5
- tiles: TileProps[];
6
- message?: string;
7
- error?: string;
8
- }>;
9
- export declare function relatedOpportunityTiles(slug: string, limit: number): Promise<{
10
- success: boolean;
11
- tiles: TileProps[];
12
- message?: string;
13
- error?: string;
14
- }>;
15
- export declare function opportunityDetails(slug: string): Promise<{
16
- success: boolean;
17
- opportunity: Opportunity | null;
18
- message?: string;
19
- error?: string;
20
- }>;
21
- export declare function opportunityMetaData(slug: string): Promise<{
22
- success: boolean;
23
- metadata: OppMetaData | null;
24
- message?: string;
25
- error?: string;
26
- }>;
27
- export declare function createOpportunity(formData: FormData): Promise<{
28
- success: boolean;
29
- slug?: string;
30
- message?: string;
31
- error?: string;
32
- }>;
33
- export declare function editOpportunity(formData: FormData, slug: string): Promise<{
34
- success: boolean;
35
- slug?: string;
36
- message?: string;
37
- error?: string;
38
- }>;
39
- export declare function deleteOpportunity(slug: string): Promise<{
40
- success: boolean;
41
- message?: string;
42
- error?: string;
43
- }>;
44
- //# sourceMappingURL=opportunity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opportunity.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/opportunity.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAQhD,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,MAAM,EAAE,EAChB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CA8BD;AAID,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CA8BD;AA8CD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAoBD;AA8CD,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/D,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CA2BD;AA8CD,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC;IACnE,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAmBD;AA8CD,wBAAsB,eAAe,CACnC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC,CAmBD;AAID,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAejE"}
@@ -1,318 +0,0 @@
1
- import { del, get, patch, post } from "./fetcher";
2
- // opportunity
3
- export async function getOpportunityTilesByStatus(status, limit) {
4
- try {
5
- const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? "&limit=" + limit : ""}`;
6
- const data = await get(endpoint);
7
- return {
8
- success: true,
9
- message: data.message,
10
- tiles: data.data.map((opportunity) => ({
11
- slug: opportunity.slug || "",
12
- image: opportunity.images?.[0] || "/images/placeholder.svg",
13
- title: opportunity.title || "",
14
- description: opportunity.description || "",
15
- location: opportunity.city + ", " + opportunity.state || "",
16
- date: opportunity.createdAt,
17
- rating: opportunity.rating,
18
- skills: opportunity.skills || [],
19
- className: opportunity.classname,
20
- })),
21
- };
22
- }
23
- catch (error) {
24
- console.error("Failed to add oppotunities by status: ", error);
25
- return {
26
- success: false,
27
- error: error.message,
28
- tiles: [],
29
- };
30
- }
31
- }
32
- export async function relatedOpportunityTiles(slug, limit) {
33
- try {
34
- const endpoint = `/newHostPost/getAllOppTiles?status=open${limit ? "&limit=" + limit : ""}`;
35
- const data = await get(endpoint);
36
- return {
37
- success: true,
38
- message: data.message,
39
- tiles: data.data.map((opportunity) => ({
40
- slug: opportunity.slug || "",
41
- image: opportunity.images?.[0] || "/images/placeholder.svg",
42
- title: opportunity.title || "",
43
- description: opportunity.description || "",
44
- location: opportunity.city + ", " + opportunity.state || "",
45
- date: opportunity.createdAt,
46
- rating: opportunity.rating,
47
- skills: opportunity.skills || [],
48
- className: opportunity.classname,
49
- })),
50
- };
51
- }
52
- catch (error) {
53
- console.error("Failed to fetch related oppotunities: ", error);
54
- return {
55
- success: false,
56
- error: error.message,
57
- tiles: [],
58
- };
59
- }
60
- }
61
- // all opportunities (may not be required or may delete in future)
62
- // export async function getAllOpportunities(): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
63
- // try {
64
- // const res = await fetch('/sample/opportunity.json');
65
- // const opportunities = await res.json() as Opportunity[];
66
- // return {
67
- // success: true,
68
- // message: "fetch success",
69
- // opportunities: opportunities,
70
- // }
71
- // } catch (error: any) {
72
- // console.error('Failed to fetch all oppotunities: ', error);
73
- // return {
74
- // success: false,
75
- // error: error.message,
76
- // opportunities: []
77
- // };
78
- // }
79
- // };
80
- // for admin dashboard
81
- // export async function getOpportunitiesByStatus(status: string[], limit?: number): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
82
- // try {
83
- // const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
84
- // const data: {
85
- // data: Opportunity[], message: string
86
- // } = await get(endpoint);
87
- // return {
88
- // success: true,
89
- // message: data.message,
90
- // opportunities: data.data,
91
- // }
92
- // } catch (error: any) {
93
- // console.error('Failed to fetch opportunities by status: ', error);
94
- // return {
95
- // success: false,
96
- // error: error.message,
97
- // opportunities: []
98
- // };
99
- // }
100
- // };
101
- export async function opportunityDetails(slug) {
102
- try {
103
- const endpoint = `/newHostPost/getPost/${slug}`;
104
- const data = await get(endpoint);
105
- return {
106
- success: true,
107
- message: data.message,
108
- opportunity: data.data,
109
- };
110
- }
111
- catch (error) {
112
- console.error("Failed to fetch oppotunity details: ", error);
113
- return {
114
- success: false,
115
- error: error.message,
116
- opportunity: null,
117
- };
118
- }
119
- }
120
- // all opportunities (may not be required or may delete in future)
121
- // export async function getAllOpportunities(): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
122
- // try {
123
- // const res = await fetch('/sample/opportunity.json');
124
- // const opportunities = await res.json() as Opportunity[];
125
- // return {
126
- // success: true,
127
- // message: "fetch success",
128
- // opportunities: opportunities,
129
- // }
130
- // } catch (error: any) {
131
- // console.error('Failed to fetch all oppotunities: ', error);
132
- // return {
133
- // success: false,
134
- // error: error.message,
135
- // opportunities: []
136
- // };
137
- // }
138
- // };
139
- // for admin dashboard
140
- // export async function getOpportunitiesByStatus(status: string[], limit?: number): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
141
- // try {
142
- // const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
143
- // const data: {
144
- // data: Opportunity[], message: string
145
- // } = await get(endpoint);
146
- // return {
147
- // success: true,
148
- // message: data.message,
149
- // opportunities: data.data,
150
- // }
151
- // } catch (error: any) {
152
- // console.error('Failed to fetch opportunities by status: ', error);
153
- // return {
154
- // success: false,
155
- // error: error.message,
156
- // opportunities: []
157
- // };
158
- // }
159
- // };
160
- export async function opportunityMetaData(slug) {
161
- try {
162
- const endpoint = `/newHostPost/getOppMetaData/${slug}`;
163
- const data = await get(endpoint);
164
- const opportunity = data.data;
165
- return {
166
- success: true,
167
- message: data.message,
168
- metadata: {
169
- image: opportunity.images?.[0] || "/images/placeholder.svg",
170
- title: opportunity.title || "Trippeaze",
171
- location: opportunity.city + ", " + opportunity.state || "india",
172
- skills: opportunity.skills || [],
173
- hostingType: opportunity.hostingType || "hostel",
174
- },
175
- };
176
- }
177
- catch (error) {
178
- console.error("Failed to add oppotunities by status: ", error);
179
- return {
180
- success: false,
181
- error: error.message,
182
- metadata: null,
183
- };
184
- }
185
- }
186
- // all opportunities (may not be required or may delete in future)
187
- // export async function getAllOpportunities(): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
188
- // try {
189
- // const res = await fetch('/sample/opportunity.json');
190
- // const opportunities = await res.json() as Opportunity[];
191
- // return {
192
- // success: true,
193
- // message: "fetch success",
194
- // opportunities: opportunities,
195
- // }
196
- // } catch (error: any) {
197
- // console.error('Failed to fetch all oppotunities: ', error);
198
- // return {
199
- // success: false,
200
- // error: error.message,
201
- // opportunities: []
202
- // };
203
- // }
204
- // };
205
- // for admin dashboard
206
- // export async function getOpportunitiesByStatus(status: string[], limit?: number): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
207
- // try {
208
- // const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
209
- // const data: {
210
- // data: Opportunity[], message: string
211
- // } = await get(endpoint);
212
- // return {
213
- // success: true,
214
- // message: data.message,
215
- // opportunities: data.data,
216
- // }
217
- // } catch (error: any) {
218
- // console.error('Failed to fetch opportunities by status: ', error);
219
- // return {
220
- // success: false,
221
- // error: error.message,
222
- // opportunities: []
223
- // };
224
- // }
225
- // };
226
- export async function createOpportunity(formData) {
227
- try {
228
- const endpoint = `/newHostPost/create`;
229
- const data = await post(endpoint, formData);
230
- return {
231
- success: true,
232
- slug: data.data,
233
- message: data.message,
234
- };
235
- }
236
- catch (error) {
237
- console.error("Failed to save opportuntiy: ", error);
238
- return {
239
- success: false,
240
- error: error.message,
241
- };
242
- }
243
- }
244
- // all opportunities (may not be required or may delete in future)
245
- // export async function getAllOpportunities(): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
246
- // try {
247
- // const res = await fetch('/sample/opportunity.json');
248
- // const opportunities = await res.json() as Opportunity[];
249
- // return {
250
- // success: true,
251
- // message: "fetch success",
252
- // opportunities: opportunities,
253
- // }
254
- // } catch (error: any) {
255
- // console.error('Failed to fetch all oppotunities: ', error);
256
- // return {
257
- // success: false,
258
- // error: error.message,
259
- // opportunities: []
260
- // };
261
- // }
262
- // };
263
- // for admin dashboard
264
- // export async function getOpportunitiesByStatus(status: string[], limit?: number): Promise<{ success: boolean, opportunities: Opportunity[], message?: string, error?: string }> {
265
- // try {
266
- // const endpoint = `/newHostPost/getAllOppTiles?status=${status}${limit ? ("&limit=" + limit) : ""}`;
267
- // const data: {
268
- // data: Opportunity[], message: string
269
- // } = await get(endpoint);
270
- // return {
271
- // success: true,
272
- // message: data.message,
273
- // opportunities: data.data,
274
- // }
275
- // } catch (error: any) {
276
- // console.error('Failed to fetch opportunities by status: ', error);
277
- // return {
278
- // success: false,
279
- // error: error.message,
280
- // opportunities: []
281
- // };
282
- // }
283
- // };
284
- export async function editOpportunity(formData, slug) {
285
- try {
286
- const endpoint = `/newHostPost/update/${slug}`;
287
- const data = await patch(endpoint, formData);
288
- return {
289
- success: true,
290
- slug: data.data,
291
- message: data.message,
292
- };
293
- }
294
- catch (error) {
295
- console.error("Failed to save opportuntiy: ", error);
296
- return {
297
- success: false,
298
- error: error.message,
299
- };
300
- }
301
- }
302
- export async function deleteOpportunity(slug) {
303
- try {
304
- const endpoint = `/newHostPost/delete/${slug}`;
305
- const data = await del(endpoint);
306
- return {
307
- success: true,
308
- message: data.message,
309
- };
310
- }
311
- catch (error) {
312
- console.error("Failed to delete opportunity: ", error);
313
- return {
314
- success: false,
315
- error: error.message,
316
- };
317
- }
318
- }