@myrjfa/state 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/lib/actions/actions.d.ts +56 -7
- package/dist/lib/actions/actions.d.ts.map +1 -1
- package/dist/lib/actions/actions.js +50 -10
- package/dist/lib/actions/auth.d.ts +12 -2
- package/dist/lib/actions/auth.d.ts.map +1 -1
- package/dist/lib/actions/chat.d.ts +80 -11
- package/dist/lib/actions/chat.d.ts.map +1 -1
- package/dist/lib/actions/chat.js +81 -20
- package/dist/lib/actions/fetcher.d.ts +0 -3
- package/dist/lib/actions/fetcher.d.ts.map +1 -1
- package/dist/lib/actions/fetcher.js +44 -6
- package/dist/lib/{severActions.d.ts → actions/serverActions.d.ts} +1 -1
- package/dist/lib/actions/serverActions.d.ts.map +1 -0
- package/dist/lib/actions/{severActions.js → serverActions.js} +3 -0
- package/dist/lib/actions/user.d.ts +23 -0
- package/dist/lib/actions/user.d.ts.map +1 -0
- package/dist/lib/actions/user.js +55 -0
- package/dist/lib/authSessionManager.d.ts.map +1 -1
- package/dist/lib/authSessionManager.js +14 -7
- package/dist/lib/context/ChatContext.d.ts +7 -0
- package/dist/lib/context/ChatContext.d.ts.map +1 -1
- package/dist/lib/context/ChatContext.js +121 -11
- package/dist/lib/models/blog.d.ts +3 -2
- package/dist/lib/models/blog.d.ts.map +1 -1
- package/dist/lib/models/chat.d.ts +32 -7
- package/dist/lib/models/chat.d.ts.map +1 -1
- package/dist/lib/models/notifications.d.ts +94 -0
- package/dist/lib/models/notifications.d.ts.map +1 -0
- package/dist/lib/models/notifications.js +60 -0
- package/dist/lib/models/opportunities/freelance.d.ts +48 -20
- package/dist/lib/models/opportunities/freelance.d.ts.map +1 -1
- package/dist/lib/models/opportunities/internship.d.ts +48 -20
- package/dist/lib/models/opportunities/internship.d.ts.map +1 -1
- package/dist/lib/models/opportunities/job.d.ts +58 -30
- package/dist/lib/models/opportunities/job.d.ts.map +1 -1
- package/dist/lib/models/opportunities/opportunity.d.ts +61 -33
- package/dist/lib/models/opportunities/opportunity.d.ts.map +1 -1
- package/dist/lib/models/opportunities/opportunity.js +1 -0
- package/dist/lib/models/opportunities/volunteerJob.d.ts +48 -20
- package/dist/lib/models/opportunities/volunteerJob.d.ts.map +1 -1
- package/dist/lib/models/portfolio.d.ts +2 -2
- package/dist/lib/models/props.d.ts +21 -4
- package/dist/lib/models/props.d.ts.map +1 -1
- package/dist/lib/models/user.d.ts +19 -4
- package/dist/lib/models/user.d.ts.map +1 -1
- package/dist/lib/models/user.js +5 -0
- package/dist/lib/userAtom.d.ts +24 -4
- package/dist/lib/userAtom.d.ts.map +1 -1
- package/dist/lib/userAtom.js +13 -11
- package/dist/lib/utils/fileCompression.d.ts +16 -0
- package/dist/lib/utils/fileCompression.d.ts.map +1 -0
- package/dist/lib/utils/fileCompression.js +56 -0
- package/dist/lib/utils/socialMediaUrl.d.ts +25 -0
- package/dist/lib/utils/socialMediaUrl.d.ts.map +1 -0
- package/dist/lib/utils/socialMediaUrl.js +97 -0
- package/dist/lib/utils.js +4 -4
- package/package.json +3 -1
- package/dist/lib/actions/severActions.d.ts +0 -3
- package/dist/lib/actions/severActions.d.ts.map +0 -1
- package/dist/lib/actions.d.ts +0 -141
- package/dist/lib/actions.d.ts.map +0 -1
- package/dist/lib/actions.js +0 -307
- package/dist/lib/auth.d.ts +0 -150
- package/dist/lib/auth.d.ts.map +0 -1
- package/dist/lib/auth.js +0 -125
- package/dist/lib/fetcher.d.ts +0 -9
- package/dist/lib/fetcher.d.ts.map +0 -1
- package/dist/lib/fetcher.js +0 -84
- package/dist/lib/models/notfications.d.ts +0 -26
- package/dist/lib/models/notfications.d.ts.map +0 -1
- package/dist/lib/models/notfications.js +0 -46
- package/dist/lib/models/volunteerJob.d.ts +0 -398
- package/dist/lib/models/volunteerJob.d.ts.map +0 -1
- package/dist/lib/models/volunteerJob.js +0 -152
- package/dist/lib/severActions.d.ts.map +0 -1
- package/dist/lib/severActions.js +0 -19
- package/dist/lib/socket.d.ts +0 -7
- package/dist/lib/socket.d.ts.map +0 -1
- package/dist/lib/socket.js +0 -22
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@ export * from './lib/authSessionManager';
|
|
|
4
4
|
export * from './lib/userAtom';
|
|
5
5
|
export * from './lib/actions/fetcher';
|
|
6
6
|
export * from './lib/actions/actions';
|
|
7
|
-
export * from './lib/actions/
|
|
7
|
+
export * from './lib/actions/serverActions';
|
|
8
8
|
export * from './lib/hooks/use-mobile';
|
|
9
9
|
export * from './lib/models/user';
|
|
10
|
-
export * from './lib/models/
|
|
10
|
+
export * from './lib/models/notifications';
|
|
11
11
|
export * from './lib/models/review';
|
|
12
12
|
export * from './lib/models/props';
|
|
13
13
|
export * from './lib/actions/chat';
|
|
@@ -15,4 +15,5 @@ export * from './lib/actions/socket';
|
|
|
15
15
|
export * from './lib/hooks/useChatSocket';
|
|
16
16
|
export * from './lib/models/chat';
|
|
17
17
|
export * from './lib/context/ChatContext';
|
|
18
|
+
export * from './lib/utils/fileCompression';
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAE5C,cAAc,wBAAwB,CAAC;AAEvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AAEnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ export * from './lib/authSessionManager';
|
|
|
4
4
|
export * from './lib/userAtom';
|
|
5
5
|
export * from './lib/actions/fetcher';
|
|
6
6
|
export * from './lib/actions/actions';
|
|
7
|
-
export * from './lib/actions/
|
|
7
|
+
export * from './lib/actions/serverActions';
|
|
8
8
|
export * from './lib/hooks/use-mobile';
|
|
9
9
|
export * from './lib/models/user';
|
|
10
|
-
export * from './lib/models/
|
|
10
|
+
export * from './lib/models/notifications';
|
|
11
11
|
export * from './lib/models/review';
|
|
12
12
|
export * from './lib/models/props';
|
|
13
13
|
export * from './lib/actions/chat';
|
|
@@ -15,3 +15,4 @@ export * from './lib/actions/socket';
|
|
|
15
15
|
export * from './lib/hooks/useChatSocket';
|
|
16
16
|
export * from './lib/models/chat';
|
|
17
17
|
export * from './lib/context/ChatContext';
|
|
18
|
+
export * from './lib/utils/fileCompression';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Review, reviewTargetType, reviewType } from "../models/review";
|
|
2
2
|
import { tileType } from "../models/tile";
|
|
3
3
|
import { User } from "../models/user";
|
|
4
|
+
import { Interest, UserRole } from "../models/props";
|
|
4
5
|
export declare function getCurrentUser(): Promise<User | null>;
|
|
5
6
|
export declare function userDetails(query: string, role: "user" | "host" | "admin"): Promise<{
|
|
6
7
|
success: boolean;
|
|
@@ -46,9 +47,17 @@ export declare function getUserContact(username: string, role: string): Promise<
|
|
|
46
47
|
phoneNumber: string;
|
|
47
48
|
} | null;
|
|
48
49
|
}>;
|
|
49
|
-
export declare function getReviewsById(id: string, type: reviewTargetType
|
|
50
|
+
export declare function getReviewsById(id: string, type: reviewTargetType, options?: {
|
|
51
|
+
page?: number;
|
|
52
|
+
limit?: number;
|
|
53
|
+
sortBy?: string;
|
|
54
|
+
sortOrder?: string;
|
|
55
|
+
rating?: number;
|
|
56
|
+
}): Promise<{
|
|
50
57
|
success: boolean;
|
|
51
58
|
reviews: Review[];
|
|
59
|
+
totalCount: number;
|
|
60
|
+
hasMore: boolean;
|
|
52
61
|
message?: string;
|
|
53
62
|
error?: string;
|
|
54
63
|
}>;
|
|
@@ -86,10 +95,25 @@ export declare function getAllNotifications(): Promise<{
|
|
|
86
95
|
notifs: {
|
|
87
96
|
message: string;
|
|
88
97
|
_id: string;
|
|
89
|
-
userId: string;
|
|
90
|
-
timestamp: Date;
|
|
91
98
|
read: boolean;
|
|
92
|
-
|
|
99
|
+
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" | "system" | "general" | undefined;
|
|
100
|
+
userId?: string | undefined;
|
|
101
|
+
timestamp?: any;
|
|
102
|
+
link?: string | undefined;
|
|
103
|
+
category?: "system" | "general" | "chat" | "application" | "opportunity" | "package" | "blog" | "account" | undefined;
|
|
104
|
+
metadata?: {
|
|
105
|
+
status?: string | undefined;
|
|
106
|
+
title?: string | undefined;
|
|
107
|
+
conversationId?: string | undefined;
|
|
108
|
+
messageId?: string | undefined;
|
|
109
|
+
senderId?: string | undefined;
|
|
110
|
+
senderName?: string | undefined;
|
|
111
|
+
conversationName?: string | undefined;
|
|
112
|
+
milestoneId?: string | undefined;
|
|
113
|
+
expenseId?: string | undefined;
|
|
114
|
+
referenceId?: string | undefined;
|
|
115
|
+
referenceType?: string | undefined;
|
|
116
|
+
} | undefined;
|
|
93
117
|
}[];
|
|
94
118
|
unreadCount: number;
|
|
95
119
|
error?: undefined;
|
|
@@ -106,10 +130,25 @@ export declare function getNotifications(limit: number): Promise<{
|
|
|
106
130
|
notifs: {
|
|
107
131
|
message: string;
|
|
108
132
|
_id: string;
|
|
109
|
-
userId: string;
|
|
110
|
-
timestamp: Date;
|
|
111
133
|
read: boolean;
|
|
112
|
-
|
|
134
|
+
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" | "system" | "general" | undefined;
|
|
135
|
+
userId?: string | undefined;
|
|
136
|
+
timestamp?: any;
|
|
137
|
+
link?: string | undefined;
|
|
138
|
+
category?: "system" | "general" | "chat" | "application" | "opportunity" | "package" | "blog" | "account" | undefined;
|
|
139
|
+
metadata?: {
|
|
140
|
+
status?: string | undefined;
|
|
141
|
+
title?: string | undefined;
|
|
142
|
+
conversationId?: string | undefined;
|
|
143
|
+
messageId?: string | undefined;
|
|
144
|
+
senderId?: string | undefined;
|
|
145
|
+
senderName?: string | undefined;
|
|
146
|
+
conversationName?: string | undefined;
|
|
147
|
+
milestoneId?: string | undefined;
|
|
148
|
+
expenseId?: string | undefined;
|
|
149
|
+
referenceId?: string | undefined;
|
|
150
|
+
referenceType?: string | undefined;
|
|
151
|
+
} | undefined;
|
|
113
152
|
}[];
|
|
114
153
|
unreadCount: number;
|
|
115
154
|
error?: undefined;
|
|
@@ -138,4 +177,14 @@ export declare function toggleAllNotification(read: boolean): Promise<{
|
|
|
138
177
|
error: any;
|
|
139
178
|
message?: undefined;
|
|
140
179
|
}>;
|
|
180
|
+
export declare function callAlert(payload: {
|
|
181
|
+
targetId: string;
|
|
182
|
+
targetRole?: UserRole;
|
|
183
|
+
purpose?: string;
|
|
184
|
+
pageContext?: string;
|
|
185
|
+
}): Promise<void>;
|
|
186
|
+
export declare function submitInterestRequest(data: Interest): Promise<{
|
|
187
|
+
success: boolean;
|
|
188
|
+
error?: string;
|
|
189
|
+
}>;
|
|
141
190
|
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAKrD,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,CAa3D;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAA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OAAO,CAAC,IAAI,CAAC,CAMhB;AAGD,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAUzG"}
|
|
@@ -9,6 +9,9 @@ export async function getCurrentUser() {
|
|
|
9
9
|
return data?.data;
|
|
10
10
|
}
|
|
11
11
|
catch (error) {
|
|
12
|
+
if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
|
|
13
|
+
throw error; // Re-throw Next.js PPR bail-out
|
|
14
|
+
}
|
|
12
15
|
console.error('Failed to fetch user details: ', error);
|
|
13
16
|
return null;
|
|
14
17
|
}
|
|
@@ -26,6 +29,9 @@ export async function userDetails(query, role) {
|
|
|
26
29
|
};
|
|
27
30
|
}
|
|
28
31
|
catch (error) {
|
|
32
|
+
if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
|
|
33
|
+
throw error; // Re-throw Next.js PPR bail-out
|
|
34
|
+
}
|
|
29
35
|
console.error('Failed to fetch user details: ', error);
|
|
30
36
|
return { success: false, user: null, status: error.status, error: error.message };
|
|
31
37
|
}
|
|
@@ -124,22 +130,31 @@ export async function getUserContact(username, role) {
|
|
|
124
130
|
}
|
|
125
131
|
}
|
|
126
132
|
// rating and reviews
|
|
127
|
-
export async function getReviewsById(id, type) {
|
|
133
|
+
export async function getReviewsById(id, type, options = {}) {
|
|
128
134
|
try {
|
|
129
|
-
const
|
|
135
|
+
const { page = 1, limit = 5, sortBy = 'createdAt', sortOrder = 'desc', rating } = options;
|
|
136
|
+
let endpoint = `/reviews/entity/${id}/${type}?page=${page}&limit=${limit}&sortBy=${sortBy}&sortOrder=${sortOrder}`;
|
|
137
|
+
if (rating)
|
|
138
|
+
endpoint += `&rating=${rating}`;
|
|
130
139
|
const data = await get(endpoint);
|
|
131
|
-
// const data = { data: sampleReviews, message: "success" };
|
|
132
140
|
return {
|
|
133
141
|
success: true,
|
|
134
|
-
reviews: data.data,
|
|
142
|
+
reviews: data.data.reviews,
|
|
143
|
+
totalCount: data.data.totalCount,
|
|
144
|
+
hasMore: data.data.hasMore,
|
|
135
145
|
message: data.message,
|
|
136
146
|
};
|
|
137
147
|
}
|
|
138
148
|
catch (error) {
|
|
149
|
+
if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
|
|
150
|
+
throw error; // Re-throw Next.js PPR bail-out
|
|
151
|
+
}
|
|
139
152
|
console.error('Failed to get reviews: ', error);
|
|
140
153
|
return {
|
|
141
|
-
success:
|
|
154
|
+
success: false,
|
|
142
155
|
reviews: [],
|
|
156
|
+
totalCount: 0,
|
|
157
|
+
hasMore: false,
|
|
143
158
|
error: error.message,
|
|
144
159
|
};
|
|
145
160
|
}
|
|
@@ -165,9 +180,12 @@ export async function getRatingById(id, type) {
|
|
|
165
180
|
};
|
|
166
181
|
}
|
|
167
182
|
catch (error) {
|
|
183
|
+
if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
|
|
184
|
+
throw error; // Re-throw Next.js PPR bail-out
|
|
185
|
+
}
|
|
168
186
|
console.error('Failed to get reviews: ', error);
|
|
169
187
|
return {
|
|
170
|
-
success:
|
|
188
|
+
success: false,
|
|
171
189
|
ratings: [],
|
|
172
190
|
error: error.message,
|
|
173
191
|
};
|
|
@@ -273,7 +291,7 @@ export async function getNotifications(limit) {
|
|
|
273
291
|
}
|
|
274
292
|
export async function toggleNotification(id, read) {
|
|
275
293
|
try {
|
|
276
|
-
const endpoint = `/
|
|
294
|
+
const endpoint = `/notification/${id}`;
|
|
277
295
|
const data = await patch(endpoint, { isRead: read });
|
|
278
296
|
return {
|
|
279
297
|
success: true,
|
|
@@ -281,7 +299,7 @@ export async function toggleNotification(id, read) {
|
|
|
281
299
|
};
|
|
282
300
|
}
|
|
283
301
|
catch (error) {
|
|
284
|
-
console.error('Failed to toggle
|
|
302
|
+
console.error('Failed to toggle notification: ', error);
|
|
285
303
|
return {
|
|
286
304
|
success: false,
|
|
287
305
|
error: error.message,
|
|
@@ -290,7 +308,7 @@ export async function toggleNotification(id, read) {
|
|
|
290
308
|
}
|
|
291
309
|
export async function toggleAllNotification(read) {
|
|
292
310
|
try {
|
|
293
|
-
const endpoint = `/
|
|
311
|
+
const endpoint = `/notification/update/all`;
|
|
294
312
|
const data = await patch(endpoint, { isRead: read });
|
|
295
313
|
return {
|
|
296
314
|
success: true,
|
|
@@ -298,10 +316,32 @@ export async function toggleAllNotification(read) {
|
|
|
298
316
|
};
|
|
299
317
|
}
|
|
300
318
|
catch (error) {
|
|
301
|
-
console.error('Failed to toggle all
|
|
319
|
+
console.error('Failed to toggle all notifications: ', error);
|
|
302
320
|
return {
|
|
303
321
|
success: false,
|
|
304
322
|
error: error.message,
|
|
305
323
|
};
|
|
306
324
|
}
|
|
307
325
|
}
|
|
326
|
+
// #5 — Call button usage alert
|
|
327
|
+
export async function callAlert(payload) {
|
|
328
|
+
try {
|
|
329
|
+
await post(`/users/call-alert`, payload);
|
|
330
|
+
}
|
|
331
|
+
catch {
|
|
332
|
+
// Non-fatal — silently ignore
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
// #6 — Opportunity/Package interest request
|
|
336
|
+
export async function submitInterestRequest(data) {
|
|
337
|
+
try {
|
|
338
|
+
const endpoint = data.type === 'opportunity'
|
|
339
|
+
? '/newHostPost/interest'
|
|
340
|
+
: '/packages/interest';
|
|
341
|
+
await post(endpoint, data);
|
|
342
|
+
return { success: true };
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
return { success: false, error: error.message };
|
|
346
|
+
}
|
|
347
|
+
}
|
|
@@ -33,7 +33,7 @@ export declare function signIn(formData: {
|
|
|
33
33
|
accessToken?: string | undefined;
|
|
34
34
|
refreshToken?: string | undefined;
|
|
35
35
|
verifiedIdCard?: boolean | undefined;
|
|
36
|
-
socialLinks?: Record<
|
|
36
|
+
socialLinks?: Partial<Record<"instagram" | "linkedin" | "youtube" | "googleBusiness", string>> | undefined;
|
|
37
37
|
userResume?: string | undefined;
|
|
38
38
|
skills?: {
|
|
39
39
|
skill: string;
|
|
@@ -50,6 +50,11 @@ export declare function signIn(formData: {
|
|
|
50
50
|
gstNumber?: string | undefined;
|
|
51
51
|
panCard?: string | undefined;
|
|
52
52
|
verifiedBusiness?: "true" | "false" | "inProgress" | undefined;
|
|
53
|
+
businessDocument?: string | undefined;
|
|
54
|
+
businessIdType?: "PAN" | "GST" | "Udyam" | "PersonalPAN" | undefined;
|
|
55
|
+
businessIdNumber?: string | undefined;
|
|
56
|
+
businessApiVerificationStatus?: "pending" | "verified" | "failed" | undefined;
|
|
57
|
+
businessVerificationDenialReason?: string | undefined;
|
|
53
58
|
};
|
|
54
59
|
message: string;
|
|
55
60
|
success?: undefined;
|
|
@@ -98,7 +103,7 @@ export declare function verifyEmailOtp(email: string, otp: string, role: "user"
|
|
|
98
103
|
accessToken?: string | undefined;
|
|
99
104
|
refreshToken?: string | undefined;
|
|
100
105
|
verifiedIdCard?: boolean | undefined;
|
|
101
|
-
socialLinks?: Record<
|
|
106
|
+
socialLinks?: Partial<Record<"instagram" | "linkedin" | "youtube" | "googleBusiness", string>> | undefined;
|
|
102
107
|
userResume?: string | undefined;
|
|
103
108
|
skills?: {
|
|
104
109
|
skill: string;
|
|
@@ -115,6 +120,11 @@ export declare function verifyEmailOtp(email: string, otp: string, role: "user"
|
|
|
115
120
|
gstNumber?: string | undefined;
|
|
116
121
|
panCard?: string | undefined;
|
|
117
122
|
verifiedBusiness?: "true" | "false" | "inProgress" | undefined;
|
|
123
|
+
businessDocument?: string | undefined;
|
|
124
|
+
businessIdType?: "PAN" | "GST" | "Udyam" | "PersonalPAN" | undefined;
|
|
125
|
+
businessIdNumber?: string | undefined;
|
|
126
|
+
businessApiVerificationStatus?: "pending" | "verified" | "failed" | undefined;
|
|
127
|
+
businessVerificationDenialReason?: string | undefined;
|
|
118
128
|
};
|
|
119
129
|
message: string;
|
|
120
130
|
success?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/auth.ts"],"names":[],"mappings":"AAGA,wBAAsB,MAAM,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CAChB
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/auth.ts"],"names":[],"mappings":"AAGA,wBAAsB,MAAM,CAAC,QAAQ,EAAE;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAeA;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAa9G;AAED,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAcrF;AAED,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBzI;AAED,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBzJ;AAED,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBlJ;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAevG"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { Message } from "../models/chat";
|
|
1
|
+
import { Message, Milestone, Participant } from "../models/chat";
|
|
2
2
|
export declare const chatApi: {
|
|
3
3
|
getConversations: () => Promise<any[]>;
|
|
4
4
|
getConversation: (id: string) => Promise<any>;
|
|
5
5
|
createConversation: (data: any) => Promise<any>;
|
|
6
6
|
updateConversation: (id: string, data: any) => Promise<any>;
|
|
7
7
|
deleteConversation: (id: string) => Promise<any>;
|
|
8
|
-
addParticipants: (id: string, userIds: string[]) => Promise<
|
|
8
|
+
addParticipants: (id: string, userIds: string[]) => Promise<{
|
|
9
|
+
error: unknown;
|
|
10
|
+
data: Participant[];
|
|
11
|
+
}>;
|
|
9
12
|
removeParticipant: (convId: string, userId: string) => Promise<any>;
|
|
10
13
|
updateParticipant: (convId: string, userId: string, data: any) => Promise<any>;
|
|
11
14
|
getMessages: (convId: string, params?: {
|
|
@@ -26,17 +29,66 @@ export declare const chatApi: {
|
|
|
26
29
|
addReaction: (id: string, emoji: string) => Promise<any>;
|
|
27
30
|
removeReaction: (id: string) => Promise<any>;
|
|
28
31
|
markRead: (convId: string, messageIds: string[]) => Promise<any>;
|
|
29
|
-
getMilestones: (convId: string) => Promise<
|
|
30
|
-
createMilestone: (convId: string, data: any) => Promise<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
getMilestones: (convId: string) => Promise<Milestone[]>;
|
|
33
|
+
createMilestone: (convId: string, data: any) => Promise<{
|
|
34
|
+
error: string;
|
|
35
|
+
data: any;
|
|
36
|
+
} | {
|
|
37
|
+
error: unknown;
|
|
38
|
+
data: null;
|
|
39
|
+
}>;
|
|
40
|
+
toggleMilestone: (id: string, note?: string) => Promise<{
|
|
41
|
+
error: string;
|
|
42
|
+
data: any;
|
|
43
|
+
} | {
|
|
44
|
+
error: unknown;
|
|
45
|
+
data: null;
|
|
46
|
+
}>;
|
|
47
|
+
updateMilestone: (id: string, data: any) => Promise<{
|
|
48
|
+
error: string;
|
|
49
|
+
data: any;
|
|
50
|
+
} | {
|
|
51
|
+
error: unknown;
|
|
52
|
+
data: null;
|
|
53
|
+
}>;
|
|
54
|
+
deleteMilestone: (id: string) => Promise<{
|
|
55
|
+
error: string;
|
|
56
|
+
data: any;
|
|
57
|
+
} | {
|
|
58
|
+
error: unknown;
|
|
59
|
+
data: null;
|
|
60
|
+
}>;
|
|
34
61
|
getExpenses: (convId: string) => Promise<any[]>;
|
|
35
|
-
createExpense: (convId: string, data: any) => Promise<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
62
|
+
createExpense: (convId: string, data: any) => Promise<{
|
|
63
|
+
error: string;
|
|
64
|
+
data: any;
|
|
65
|
+
} | {
|
|
66
|
+
error: unknown;
|
|
67
|
+
data: null;
|
|
68
|
+
}>;
|
|
69
|
+
updateExpense: (id: string, data: any) => Promise<{
|
|
70
|
+
error: string;
|
|
71
|
+
data: any;
|
|
72
|
+
} | {
|
|
73
|
+
error: unknown;
|
|
74
|
+
data: null;
|
|
75
|
+
}>;
|
|
76
|
+
settleSplit: (id: string, targetUserId: string, amount: number) => Promise<{
|
|
77
|
+
error: string;
|
|
78
|
+
data: any;
|
|
79
|
+
} | {
|
|
80
|
+
error: unknown;
|
|
81
|
+
data: null;
|
|
82
|
+
}>;
|
|
83
|
+
deleteExpense: (id: string) => Promise<{
|
|
84
|
+
error: string;
|
|
85
|
+
data: any;
|
|
86
|
+
} | {
|
|
87
|
+
error: unknown;
|
|
88
|
+
data: null;
|
|
89
|
+
}>;
|
|
39
90
|
getBalances: (convId: string) => Promise<any>;
|
|
91
|
+
getExpenseCategories: (convId: string) => Promise<string[]>;
|
|
40
92
|
uploadFiles: (formData: FormData) => Promise<{
|
|
41
93
|
error: string;
|
|
42
94
|
data: any;
|
|
@@ -44,5 +96,22 @@ export declare const chatApi: {
|
|
|
44
96
|
error: unknown;
|
|
45
97
|
data: null;
|
|
46
98
|
}>;
|
|
99
|
+
getExpenseAnalytics: (convId: string) => Promise<any>;
|
|
100
|
+
getPolls: (convId: string) => Promise<any[]>;
|
|
101
|
+
getPollById: (pollId: string) => Promise<any>;
|
|
102
|
+
createPoll: (convId: string, data: any) => Promise<{
|
|
103
|
+
error: string;
|
|
104
|
+
data: Message;
|
|
105
|
+
} | {
|
|
106
|
+
error: unknown;
|
|
107
|
+
data: null;
|
|
108
|
+
}>;
|
|
109
|
+
votePoll: (pollId: string, optionIndex: number) => Promise<{
|
|
110
|
+
error: string;
|
|
111
|
+
data: Message;
|
|
112
|
+
} | {
|
|
113
|
+
error: unknown;
|
|
114
|
+
data: null;
|
|
115
|
+
}>;
|
|
47
116
|
};
|
|
48
117
|
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":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AM;0BASH,MAAM;yBASP,MAAM,QAAQ,GAAG;eAEC,MAAM;cAAQ,OAAO;;;;;uBAOzC,MAAM,eAAe,MAAM;eAEN,MAAM;cAAQ,OAAO;;;;;CAOtE,CAAC"}
|
package/dist/lib/actions/chat.js
CHANGED
|
@@ -55,11 +55,11 @@ export const chatApi = {
|
|
|
55
55
|
addParticipants: async (id, userIds) => {
|
|
56
56
|
try {
|
|
57
57
|
const response = await post(`${BASE_PATH}/conversations/${id}/participants`, { userIds });
|
|
58
|
-
return response
|
|
58
|
+
return response;
|
|
59
59
|
}
|
|
60
60
|
catch (error) {
|
|
61
61
|
console.error(error);
|
|
62
|
-
return
|
|
62
|
+
return { error: error, data: [] };
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
removeParticipant: async (convId, userId) => {
|
|
@@ -192,41 +192,41 @@ export const chatApi = {
|
|
|
192
192
|
createMilestone: async (convId, data) => {
|
|
193
193
|
try {
|
|
194
194
|
const response = await post(`${BASE_PATH}/conversations/${convId}/milestones`, data);
|
|
195
|
-
return response
|
|
195
|
+
return response;
|
|
196
196
|
}
|
|
197
197
|
catch (error) {
|
|
198
198
|
console.error(error);
|
|
199
|
-
return null;
|
|
199
|
+
return { error: error, data: null };
|
|
200
200
|
}
|
|
201
201
|
},
|
|
202
202
|
toggleMilestone: async (id, note) => {
|
|
203
203
|
try {
|
|
204
204
|
const response = await patch(`${BASE_PATH}/milestones/${id}/toggle`, { note });
|
|
205
|
-
return response
|
|
205
|
+
return response;
|
|
206
206
|
}
|
|
207
207
|
catch (error) {
|
|
208
208
|
console.error(error);
|
|
209
|
-
return null;
|
|
209
|
+
return { error: error, data: null };
|
|
210
210
|
}
|
|
211
211
|
},
|
|
212
212
|
updateMilestone: async (id, data) => {
|
|
213
213
|
try {
|
|
214
214
|
const response = await patch(`${BASE_PATH}/milestones/${id}`, data);
|
|
215
|
-
return response
|
|
215
|
+
return response;
|
|
216
216
|
}
|
|
217
217
|
catch (error) {
|
|
218
218
|
console.error(error);
|
|
219
|
-
return null;
|
|
219
|
+
return { error: error, data: null };
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
deleteMilestone: async (id) => {
|
|
223
223
|
try {
|
|
224
224
|
const response = await del(`${BASE_PATH}/milestones/${id}`);
|
|
225
|
-
return response
|
|
225
|
+
return response;
|
|
226
226
|
}
|
|
227
227
|
catch (error) {
|
|
228
228
|
console.error(error);
|
|
229
|
-
return null;
|
|
229
|
+
return { error: error, data: null };
|
|
230
230
|
}
|
|
231
231
|
},
|
|
232
232
|
// Expenses
|
|
@@ -243,41 +243,41 @@ export const chatApi = {
|
|
|
243
243
|
createExpense: async (convId, data) => {
|
|
244
244
|
try {
|
|
245
245
|
const response = await post(`${BASE_PATH}/conversations/${convId}/expenses`, data);
|
|
246
|
-
return response
|
|
246
|
+
return response;
|
|
247
247
|
}
|
|
248
248
|
catch (error) {
|
|
249
249
|
console.error(error);
|
|
250
|
-
return null;
|
|
250
|
+
return { error: error, data: null };
|
|
251
251
|
}
|
|
252
252
|
},
|
|
253
253
|
updateExpense: async (id, data) => {
|
|
254
254
|
try {
|
|
255
255
|
const response = await patch(`${BASE_PATH}/expenses/${id}`, data);
|
|
256
|
-
return response
|
|
256
|
+
return response;
|
|
257
257
|
}
|
|
258
258
|
catch (error) {
|
|
259
259
|
console.error(error);
|
|
260
|
-
return null;
|
|
260
|
+
return { error: error, data: null };
|
|
261
261
|
}
|
|
262
262
|
},
|
|
263
|
-
settleSplit: async (id, targetUserId) => {
|
|
263
|
+
settleSplit: async (id, targetUserId, amount) => {
|
|
264
264
|
try {
|
|
265
|
-
const response = await post(`${BASE_PATH}/
|
|
266
|
-
return response
|
|
265
|
+
const response = await post(`${BASE_PATH}/conversations/${id}/settleExpense`, { targetUserId, amount });
|
|
266
|
+
return response;
|
|
267
267
|
}
|
|
268
268
|
catch (error) {
|
|
269
269
|
console.error(error);
|
|
270
|
-
return null;
|
|
270
|
+
return { error: error, data: null };
|
|
271
271
|
}
|
|
272
272
|
},
|
|
273
273
|
deleteExpense: async (id) => {
|
|
274
274
|
try {
|
|
275
275
|
const response = await del(`${BASE_PATH}/expenses/${id}`);
|
|
276
|
-
return response
|
|
276
|
+
return response;
|
|
277
277
|
}
|
|
278
278
|
catch (error) {
|
|
279
279
|
console.error(error);
|
|
280
|
-
return null;
|
|
280
|
+
return { error: error, data: null };
|
|
281
281
|
}
|
|
282
282
|
},
|
|
283
283
|
getBalances: async (convId) => {
|
|
@@ -290,6 +290,16 @@ export const chatApi = {
|
|
|
290
290
|
return null;
|
|
291
291
|
}
|
|
292
292
|
},
|
|
293
|
+
getExpenseCategories: async (convId) => {
|
|
294
|
+
try {
|
|
295
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/expense-categories`);
|
|
296
|
+
return response.data;
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
console.error(error);
|
|
300
|
+
return [];
|
|
301
|
+
}
|
|
302
|
+
},
|
|
293
303
|
uploadFiles: async (formData) => {
|
|
294
304
|
try {
|
|
295
305
|
const response = await post(`${BASE_PATH}/upload`, formData);
|
|
@@ -300,4 +310,55 @@ export const chatApi = {
|
|
|
300
310
|
return { error: error, data: null };
|
|
301
311
|
}
|
|
302
312
|
},
|
|
313
|
+
getExpenseAnalytics: async (convId) => {
|
|
314
|
+
try {
|
|
315
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/expense-analytics`);
|
|
316
|
+
return response.data;
|
|
317
|
+
}
|
|
318
|
+
catch (error) {
|
|
319
|
+
console.error(error);
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
// Polls
|
|
324
|
+
getPolls: async (convId) => {
|
|
325
|
+
try {
|
|
326
|
+
const response = await get(`${BASE_PATH}/conversations/${convId}/polls`);
|
|
327
|
+
return response.data;
|
|
328
|
+
}
|
|
329
|
+
catch (error) {
|
|
330
|
+
console.error(error);
|
|
331
|
+
return [];
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
getPollById: async (pollId) => {
|
|
335
|
+
try {
|
|
336
|
+
const response = await get(`${BASE_PATH}/polls/${pollId}`);
|
|
337
|
+
return response.data;
|
|
338
|
+
}
|
|
339
|
+
catch (error) {
|
|
340
|
+
console.error(error);
|
|
341
|
+
return null;
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
createPoll: async (convId, data) => {
|
|
345
|
+
try {
|
|
346
|
+
const response = await post(`${BASE_PATH}/conversations/${convId}/polls`, data);
|
|
347
|
+
return response;
|
|
348
|
+
}
|
|
349
|
+
catch (error) {
|
|
350
|
+
console.error(error);
|
|
351
|
+
return { error: error, data: null };
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
votePoll: async (pollId, optionIndex) => {
|
|
355
|
+
try {
|
|
356
|
+
const response = await patch(`${BASE_PATH}/polls/${pollId}/vote`, { optionIndex });
|
|
357
|
+
return response;
|
|
358
|
+
}
|
|
359
|
+
catch (error) {
|
|
360
|
+
console.error(error);
|
|
361
|
+
return { error: error, data: null };
|
|
362
|
+
}
|
|
363
|
+
}
|
|
303
364
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
type FetchMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
2
|
-
export declare function refreshToken<T>(input: string, method: FetchMethod, body?: any): Promise<T>;
|
|
3
1
|
export declare function get<T>(url: string, includeAuth?: boolean): Promise<T>;
|
|
4
2
|
export declare function post<T>(url: string, body: any): Promise<T>;
|
|
5
3
|
export declare function put<T>(url: string, body: any): Promise<T>;
|
|
6
4
|
export declare function patch<T>(url: string, body: any): Promise<T>;
|
|
7
5
|
export declare function del<T>(url: string, body?: any): Promise<T>;
|
|
8
|
-
export {};
|
|
9
6
|
//# sourceMappingURL=fetcher.d.ts.map
|