@myrjfa/state 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +18 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -2
- package/dist/lib/actions/actions.d.ts +1 -20
- package/dist/lib/actions/actions.d.ts.map +1 -1
- package/dist/lib/actions/actions.js +10 -50
- package/dist/lib/actions/auth.d.ts +22 -12
- package/dist/lib/actions/auth.d.ts.map +1 -1
- package/dist/lib/actions/booking.d.ts +30 -0
- package/dist/lib/actions/booking.d.ts.map +1 -0
- package/dist/lib/actions/booking.js +77 -0
- package/dist/lib/actions/fetcher.d.ts +3 -0
- package/dist/lib/actions/fetcher.d.ts.map +1 -1
- package/dist/lib/actions/fetcher.js +6 -44
- package/dist/lib/actions/{serverActions.d.ts → severActions.d.ts} +1 -1
- package/dist/lib/actions/severActions.d.ts.map +1 -0
- package/dist/lib/actions/{serverActions.js → severActions.js} +2 -5
- package/dist/lib/authSessionManager.d.ts.map +1 -1
- package/dist/lib/authSessionManager.js +7 -14
- package/dist/lib/context/ChatContext.d.ts +1 -1
- package/dist/lib/context/ChatContext.d.ts.map +1 -1
- package/dist/lib/models/adventure.d.ts +75 -0
- package/dist/lib/models/adventure.d.ts.map +1 -0
- package/dist/lib/models/adventure.js +1 -0
- package/dist/lib/models/blog.d.ts +6 -7
- package/dist/lib/models/blog.d.ts.map +1 -1
- package/dist/lib/models/booking.d.ts +47 -0
- package/dist/lib/models/booking.d.ts.map +1 -0
- package/dist/lib/models/booking.js +1 -0
- package/dist/lib/models/guide.d.ts +43 -0
- package/dist/lib/models/guide.d.ts.map +1 -0
- package/dist/lib/models/guide.js +1 -0
- package/dist/lib/models/{notifications.d.ts → notfications.d.ts} +1 -1
- package/dist/lib/models/notfications.d.ts.map +1 -0
- package/dist/lib/models/opportunities/freelance.d.ts +94 -54
- package/dist/lib/models/opportunities/freelance.d.ts.map +1 -1
- package/dist/lib/models/opportunities/internship.d.ts +94 -54
- package/dist/lib/models/opportunities/internship.d.ts.map +1 -1
- package/dist/lib/models/opportunities/job.d.ts +104 -64
- package/dist/lib/models/opportunities/job.d.ts.map +1 -1
- package/dist/lib/models/opportunities/opportunity.d.ts +107 -67
- package/dist/lib/models/opportunities/opportunity.d.ts.map +1 -1
- package/dist/lib/models/opportunities/opportunity.js +0 -1
- package/dist/lib/models/opportunities/volunteerJob.d.ts +94 -54
- package/dist/lib/models/opportunities/volunteerJob.d.ts.map +1 -1
- package/dist/lib/models/package.d.ts +264 -0
- package/dist/lib/models/package.d.ts.map +1 -0
- package/dist/lib/models/package.js +58 -0
- package/dist/lib/models/portfolio.d.ts +2 -2
- package/dist/lib/models/props.d.ts +7 -21
- package/dist/lib/models/props.d.ts.map +1 -1
- package/dist/lib/models/props.js +36 -0
- package/dist/lib/models/rental.d.ts +85 -0
- package/dist/lib/models/rental.d.ts.map +1 -0
- package/dist/lib/models/rental.js +1 -0
- package/dist/lib/models/review.d.ts +1 -1
- package/dist/lib/models/review.d.ts.map +1 -1
- package/dist/lib/models/stay.d.ts +459 -0
- package/dist/lib/models/stay.d.ts.map +1 -0
- package/dist/lib/models/stay.js +214 -0
- package/dist/lib/models/tile.d.ts +26 -1
- package/dist/lib/models/tile.d.ts.map +1 -1
- package/dist/lib/models/user.d.ts +52 -19
- package/dist/lib/models/user.d.ts.map +1 -1
- package/dist/lib/models/user.js +10 -5
- package/dist/lib/userAtom.d.ts +44 -24
- package/dist/lib/userAtom.d.ts.map +1 -1
- package/dist/lib/userAtom.js +11 -13
- package/dist/lib/utils.js +4 -4
- package/package.json +5 -2
- package/dist/lib/actions/serverActions.d.ts.map +0 -1
- package/dist/lib/models/notifications.d.ts.map +0 -1
- package/dist/lib/utils/socialMediaUrl.d.ts +0 -25
- package/dist/lib/utils/socialMediaUrl.d.ts.map +0 -1
- package/dist/lib/utils/socialMediaUrl.js +0 -97
- /package/dist/lib/models/{notifications.js → notfications.js} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
export * from './lib/utils';
|
|
2
2
|
export * from './lib/actions/auth';
|
|
3
3
|
export * from './lib/authSessionManager';
|
|
4
|
+
export { default as AuthSessionManager } from './lib/authSessionManager';
|
|
4
5
|
export * from './lib/userAtom';
|
|
5
6
|
export * from './lib/actions/fetcher';
|
|
6
7
|
export * from './lib/actions/actions';
|
|
7
|
-
export * from './lib/actions/
|
|
8
|
+
export * from './lib/actions/severActions';
|
|
9
|
+
export * from './lib/actions/user';
|
|
10
|
+
export * from './lib/actions/booking';
|
|
11
|
+
export { default as QueryProvider } from './lib/QueryProvider';
|
|
8
12
|
export * from './lib/hooks/use-mobile';
|
|
9
13
|
export * from './lib/models/user';
|
|
10
|
-
export * from './lib/models/
|
|
14
|
+
export * from './lib/models/notfications';
|
|
11
15
|
export * from './lib/models/review';
|
|
12
16
|
export * from './lib/models/props';
|
|
17
|
+
export * from './lib/models/tile';
|
|
18
|
+
export * from './lib/models/portfolio';
|
|
13
19
|
export * from './lib/actions/chat';
|
|
14
20
|
export * from './lib/actions/socket';
|
|
15
21
|
export * from './lib/hooks/useChatSocket';
|
|
16
22
|
export * from './lib/models/chat';
|
|
17
23
|
export * from './lib/context/ChatContext';
|
|
18
24
|
export * from './lib/utils/fileCompression';
|
|
25
|
+
export * from './lib/models/adventure';
|
|
26
|
+
export * from './lib/models/rental';
|
|
27
|
+
export * from './lib/models/blog';
|
|
28
|
+
export * from './lib/models/package';
|
|
29
|
+
export * from './lib/models/opportunities/opportunity';
|
|
30
|
+
export * from './lib/data/countryStates';
|
|
31
|
+
export * from './lib/models/booking';
|
|
32
|
+
export * from './lib/models/application';
|
|
33
|
+
export * from './lib/models/guide';
|
|
34
|
+
export * from './lib/models/stay';
|
|
19
35
|
//# 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,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACzE,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE/D,cAAc,wBAAwB,CAAC;AAEvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AAEvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
export * from './lib/utils';
|
|
2
2
|
export * from './lib/actions/auth';
|
|
3
3
|
export * from './lib/authSessionManager';
|
|
4
|
+
export { default as AuthSessionManager } from './lib/authSessionManager';
|
|
4
5
|
export * from './lib/userAtom';
|
|
5
6
|
export * from './lib/actions/fetcher';
|
|
6
7
|
export * from './lib/actions/actions';
|
|
7
|
-
export * from './lib/actions/
|
|
8
|
+
export * from './lib/actions/severActions';
|
|
9
|
+
export * from './lib/actions/user';
|
|
10
|
+
export * from './lib/actions/booking';
|
|
11
|
+
export { default as QueryProvider } from './lib/QueryProvider';
|
|
8
12
|
export * from './lib/hooks/use-mobile';
|
|
9
13
|
export * from './lib/models/user';
|
|
10
|
-
export * from './lib/models/
|
|
14
|
+
export * from './lib/models/notfications';
|
|
11
15
|
export * from './lib/models/review';
|
|
12
16
|
export * from './lib/models/props';
|
|
17
|
+
export * from './lib/models/tile';
|
|
18
|
+
export * from './lib/models/portfolio';
|
|
13
19
|
export * from './lib/actions/chat';
|
|
14
20
|
export * from './lib/actions/socket';
|
|
15
21
|
export * from './lib/hooks/useChatSocket';
|
|
16
22
|
export * from './lib/models/chat';
|
|
17
23
|
export * from './lib/context/ChatContext';
|
|
18
24
|
export * from './lib/utils/fileCompression';
|
|
25
|
+
export * from './lib/models/adventure';
|
|
26
|
+
export * from './lib/models/rental';
|
|
27
|
+
export * from './lib/models/blog';
|
|
28
|
+
export * from './lib/models/package';
|
|
29
|
+
export * from './lib/models/opportunities/opportunity';
|
|
30
|
+
export * from './lib/data/countryStates';
|
|
31
|
+
export * from './lib/models/booking';
|
|
32
|
+
export * from './lib/models/application';
|
|
33
|
+
export * from './lib/models/guide';
|
|
34
|
+
export * from './lib/models/stay';
|
|
@@ -1,7 +1,6 @@
|
|
|
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";
|
|
5
4
|
export declare function getCurrentUser(): Promise<User | null>;
|
|
6
5
|
export declare function userDetails(query: string, role: "user" | "host" | "admin"): Promise<{
|
|
7
6
|
success: boolean;
|
|
@@ -47,17 +46,9 @@ export declare function getUserContact(username: string, role: string): Promise<
|
|
|
47
46
|
phoneNumber: string;
|
|
48
47
|
} | null;
|
|
49
48
|
}>;
|
|
50
|
-
export declare function getReviewsById(id: string, type: reviewTargetType
|
|
51
|
-
page?: number;
|
|
52
|
-
limit?: number;
|
|
53
|
-
sortBy?: string;
|
|
54
|
-
sortOrder?: string;
|
|
55
|
-
rating?: number;
|
|
56
|
-
}): Promise<{
|
|
49
|
+
export declare function getReviewsById(id: string, type: reviewTargetType): Promise<{
|
|
57
50
|
success: boolean;
|
|
58
51
|
reviews: Review[];
|
|
59
|
-
totalCount: number;
|
|
60
|
-
hasMore: boolean;
|
|
61
52
|
message?: string;
|
|
62
53
|
error?: string;
|
|
63
54
|
}>;
|
|
@@ -177,14 +168,4 @@ export declare function toggleAllNotification(read: boolean): Promise<{
|
|
|
177
168
|
error: any;
|
|
178
169
|
message?: undefined;
|
|
179
170
|
}>;
|
|
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
|
-
}>;
|
|
190
171
|
//# 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,CAA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AAED,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO;;;;;;;;GAejE;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO;;;;;;;;GAexD"}
|
|
@@ -9,9 +9,6 @@ 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
|
-
}
|
|
15
12
|
console.error('Failed to fetch user details: ', error);
|
|
16
13
|
return null;
|
|
17
14
|
}
|
|
@@ -29,9 +26,6 @@ export async function userDetails(query, role) {
|
|
|
29
26
|
};
|
|
30
27
|
}
|
|
31
28
|
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
|
-
}
|
|
35
29
|
console.error('Failed to fetch user details: ', error);
|
|
36
30
|
return { success: false, user: null, status: error.status, error: error.message };
|
|
37
31
|
}
|
|
@@ -130,31 +124,22 @@ export async function getUserContact(username, role) {
|
|
|
130
124
|
}
|
|
131
125
|
}
|
|
132
126
|
// rating and reviews
|
|
133
|
-
export async function getReviewsById(id, type
|
|
127
|
+
export async function getReviewsById(id, type) {
|
|
134
128
|
try {
|
|
135
|
-
const
|
|
136
|
-
let endpoint = `/reviews/entity/${id}/${type}?page=${page}&limit=${limit}&sortBy=${sortBy}&sortOrder=${sortOrder}`;
|
|
137
|
-
if (rating)
|
|
138
|
-
endpoint += `&rating=${rating}`;
|
|
129
|
+
const endpoint = `/reviews/entity/${id}/${type}`;
|
|
139
130
|
const data = await get(endpoint);
|
|
131
|
+
// const data = { data: sampleReviews, message: "success" };
|
|
140
132
|
return {
|
|
141
133
|
success: true,
|
|
142
|
-
reviews: data.data
|
|
143
|
-
totalCount: data.data.totalCount,
|
|
144
|
-
hasMore: data.data.hasMore,
|
|
134
|
+
reviews: data.data?.reviews || [],
|
|
145
135
|
message: data.message,
|
|
146
136
|
};
|
|
147
137
|
}
|
|
148
138
|
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
|
-
}
|
|
152
139
|
console.error('Failed to get reviews: ', error);
|
|
153
140
|
return {
|
|
154
|
-
success:
|
|
141
|
+
success: true,
|
|
155
142
|
reviews: [],
|
|
156
|
-
totalCount: 0,
|
|
157
|
-
hasMore: false,
|
|
158
143
|
error: error.message,
|
|
159
144
|
};
|
|
160
145
|
}
|
|
@@ -180,12 +165,9 @@ export async function getRatingById(id, type) {
|
|
|
180
165
|
};
|
|
181
166
|
}
|
|
182
167
|
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
|
-
}
|
|
186
168
|
console.error('Failed to get reviews: ', error);
|
|
187
169
|
return {
|
|
188
|
-
success:
|
|
170
|
+
success: true,
|
|
189
171
|
ratings: [],
|
|
190
172
|
error: error.message,
|
|
191
173
|
};
|
|
@@ -291,7 +273,7 @@ export async function getNotifications(limit) {
|
|
|
291
273
|
}
|
|
292
274
|
export async function toggleNotification(id, read) {
|
|
293
275
|
try {
|
|
294
|
-
const endpoint = `/
|
|
276
|
+
const endpoint = `/notfication/${id}`;
|
|
295
277
|
const data = await patch(endpoint, { isRead: read });
|
|
296
278
|
return {
|
|
297
279
|
success: true,
|
|
@@ -299,7 +281,7 @@ export async function toggleNotification(id, read) {
|
|
|
299
281
|
};
|
|
300
282
|
}
|
|
301
283
|
catch (error) {
|
|
302
|
-
console.error('Failed to toggle
|
|
284
|
+
console.error('Failed to toggle notfication: ', error);
|
|
303
285
|
return {
|
|
304
286
|
success: false,
|
|
305
287
|
error: error.message,
|
|
@@ -308,7 +290,7 @@ export async function toggleNotification(id, read) {
|
|
|
308
290
|
}
|
|
309
291
|
export async function toggleAllNotification(read) {
|
|
310
292
|
try {
|
|
311
|
-
const endpoint = `/
|
|
293
|
+
const endpoint = `/notfication/update/all`;
|
|
312
294
|
const data = await patch(endpoint, { isRead: read });
|
|
313
295
|
return {
|
|
314
296
|
success: true,
|
|
@@ -316,32 +298,10 @@ export async function toggleAllNotification(read) {
|
|
|
316
298
|
};
|
|
317
299
|
}
|
|
318
300
|
catch (error) {
|
|
319
|
-
console.error('Failed to toggle all
|
|
301
|
+
console.error('Failed to toggle all notfications: ', error);
|
|
320
302
|
return {
|
|
321
303
|
success: false,
|
|
322
304
|
error: error.message,
|
|
323
305
|
};
|
|
324
306
|
}
|
|
325
307
|
}
|
|
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?:
|
|
36
|
+
socialLinks?: Record<string, string> | undefined;
|
|
37
37
|
userResume?: string | undefined;
|
|
38
38
|
skills?: {
|
|
39
39
|
skill: string;
|
|
@@ -50,11 +50,16 @@ export declare function signIn(formData: {
|
|
|
50
50
|
gstNumber?: string | undefined;
|
|
51
51
|
panCard?: string | undefined;
|
|
52
52
|
verifiedBusiness?: "true" | "false" | "inProgress" | undefined;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
properties?: {
|
|
54
|
+
country: string;
|
|
55
|
+
type: string;
|
|
56
|
+
name: string;
|
|
57
|
+
address: string;
|
|
58
|
+
city: string;
|
|
59
|
+
state: string;
|
|
60
|
+
pinCode?: string | undefined;
|
|
61
|
+
registrationNumber?: string | undefined;
|
|
62
|
+
}[] | undefined;
|
|
58
63
|
};
|
|
59
64
|
message: string;
|
|
60
65
|
success?: undefined;
|
|
@@ -103,7 +108,7 @@ export declare function verifyEmailOtp(email: string, otp: string, role: "user"
|
|
|
103
108
|
accessToken?: string | undefined;
|
|
104
109
|
refreshToken?: string | undefined;
|
|
105
110
|
verifiedIdCard?: boolean | undefined;
|
|
106
|
-
socialLinks?:
|
|
111
|
+
socialLinks?: Record<string, string> | undefined;
|
|
107
112
|
userResume?: string | undefined;
|
|
108
113
|
skills?: {
|
|
109
114
|
skill: string;
|
|
@@ -120,11 +125,16 @@ export declare function verifyEmailOtp(email: string, otp: string, role: "user"
|
|
|
120
125
|
gstNumber?: string | undefined;
|
|
121
126
|
panCard?: string | undefined;
|
|
122
127
|
verifiedBusiness?: "true" | "false" | "inProgress" | undefined;
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
properties?: {
|
|
129
|
+
country: string;
|
|
130
|
+
type: string;
|
|
131
|
+
name: string;
|
|
132
|
+
address: string;
|
|
133
|
+
city: string;
|
|
134
|
+
state: string;
|
|
135
|
+
pinCode?: string | undefined;
|
|
136
|
+
registrationNumber?: string | undefined;
|
|
137
|
+
}[] | undefined;
|
|
128
138
|
};
|
|
129
139
|
message: string;
|
|
130
140
|
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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Booking, CreateBookingRequest } from "../models/booking";
|
|
2
|
+
export declare function createBooking(bookingData: CreateBookingRequest): Promise<{
|
|
3
|
+
success: boolean;
|
|
4
|
+
booking: Booking | null;
|
|
5
|
+
message?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function getMyBookings(): Promise<{
|
|
9
|
+
success: boolean;
|
|
10
|
+
bookings: Booking[];
|
|
11
|
+
message?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function getBookingById(bookingId: string): Promise<{
|
|
15
|
+
success: boolean;
|
|
16
|
+
booking: Booking | null;
|
|
17
|
+
message?: string;
|
|
18
|
+
error?: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function updateBookingStatus(bookingId: string, statusData: {
|
|
21
|
+
status?: string;
|
|
22
|
+
paymentStatus?: string;
|
|
23
|
+
paymentId?: string;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
success: boolean;
|
|
26
|
+
booking: Booking | null;
|
|
27
|
+
message?: string;
|
|
28
|
+
error?: string;
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=booking.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"booking.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/booking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAElE,wBAAsB,aAAa,CAAC,WAAW,EAAE,oBAAoB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAiB/J;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAiB1H;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBhJ;AAED,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAiBlO"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { get, patch, post } from "./fetcher";
|
|
2
|
+
export async function createBooking(bookingData) {
|
|
3
|
+
try {
|
|
4
|
+
const endpoint = `/bookings/create`;
|
|
5
|
+
const data = await post(endpoint, bookingData);
|
|
6
|
+
return {
|
|
7
|
+
success: true,
|
|
8
|
+
booking: data.data,
|
|
9
|
+
message: data.message,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
console.error('Failed to create booking: ', error);
|
|
14
|
+
return {
|
|
15
|
+
success: false,
|
|
16
|
+
booking: null,
|
|
17
|
+
error: error.message,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export async function getMyBookings() {
|
|
22
|
+
try {
|
|
23
|
+
const endpoint = `/bookings/my`;
|
|
24
|
+
const data = await get(endpoint);
|
|
25
|
+
return {
|
|
26
|
+
success: true,
|
|
27
|
+
bookings: data.data,
|
|
28
|
+
message: data.message,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error('Failed to fetch bookings: ', error);
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
bookings: [],
|
|
36
|
+
error: error.message,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function getBookingById(bookingId) {
|
|
41
|
+
try {
|
|
42
|
+
const endpoint = `/bookings/${bookingId}`;
|
|
43
|
+
const data = await get(endpoint);
|
|
44
|
+
return {
|
|
45
|
+
success: true,
|
|
46
|
+
booking: data.data,
|
|
47
|
+
message: data.message,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('Failed to fetch booking by id: ', error);
|
|
52
|
+
return {
|
|
53
|
+
success: false,
|
|
54
|
+
booking: null,
|
|
55
|
+
error: error.message,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export async function updateBookingStatus(bookingId, statusData) {
|
|
60
|
+
try {
|
|
61
|
+
const endpoint = `/bookings/${bookingId}/status`;
|
|
62
|
+
const data = await patch(endpoint, statusData);
|
|
63
|
+
return {
|
|
64
|
+
success: true,
|
|
65
|
+
booking: data.data,
|
|
66
|
+
message: data.message,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error('Failed to update booking status: ', error);
|
|
71
|
+
return {
|
|
72
|
+
success: false,
|
|
73
|
+
booking: null,
|
|
74
|
+
error: error.message,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
type FetchMethod = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
2
|
+
export declare function refreshToken<T>(input: string, method: FetchMethod, body?: any): Promise<T>;
|
|
1
3
|
export declare function get<T>(url: string, includeAuth?: boolean): Promise<T>;
|
|
2
4
|
export declare function post<T>(url: string, body: any): Promise<T>;
|
|
3
5
|
export declare function put<T>(url: string, body: any): Promise<T>;
|
|
4
6
|
export declare function patch<T>(url: string, body: any): Promise<T>;
|
|
5
7
|
export declare function del<T>(url: string, body?: any): Promise<T>;
|
|
8
|
+
export {};
|
|
6
9
|
//# sourceMappingURL=fetcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/fetcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/fetcher.ts"],"names":[],"mappings":"AAKA,KAAK,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAsE/D,wBAAsB,YAAY,CAAC,CAAC,EAChC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,WAAW,EACnB,IAAI,CAAC,EAAE,GAAG,GACX,OAAO,CAAC,CAAC,CAAC,CAiBZ;AAID,wBAAsB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,GAAE,OAAc,cAEpE;AAED,wBAAsB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,cAEnD;AAED,wBAAsB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,cAElD;AAED,wBAAsB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,cAEpD;AAED,wBAAsB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,cAEnD"}
|
|
@@ -1,33 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
class ApiError extends Error {
|
|
4
|
-
constructor(statusCode, message) {
|
|
5
|
-
super(message);
|
|
6
|
-
this.statusCode = statusCode;
|
|
7
|
-
this.name = 'ApiError';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
import { ApiError } from "next/dist/server/api-utils";
|
|
2
|
+
import { getCookieHeader, getRole } from "./severActions";
|
|
10
3
|
const baseURL = process.env.NEXT_PUBLIC_API_URL;
|
|
11
|
-
/**
|
|
12
|
-
* #2 — Stable device fingerprint stored in localStorage.
|
|
13
|
-
* Survives browser sessions (unlike cookies which can expire/be cleared).
|
|
14
|
-
* Generated once per browser using crypto.randomUUID().
|
|
15
|
-
*/
|
|
16
|
-
function getOrCreateDeviceId() {
|
|
17
|
-
if (typeof window === 'undefined')
|
|
18
|
-
return null; // SSR guard
|
|
19
|
-
try {
|
|
20
|
-
let deviceId = localStorage.getItem('_trippeaze_device_id');
|
|
21
|
-
if (!deviceId) {
|
|
22
|
-
deviceId = crypto.randomUUID();
|
|
23
|
-
localStorage.setItem('_trippeaze_device_id', deviceId);
|
|
24
|
-
}
|
|
25
|
-
return deviceId;
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
4
|
async function customFetch(input, method, body, options = {}) {
|
|
32
5
|
const { includeAuth = false, retry = true } = options;
|
|
33
6
|
const url = `${baseURL}${input}`;
|
|
@@ -35,20 +8,12 @@ async function customFetch(input, method, body, options = {}) {
|
|
|
35
8
|
let headers = isFormData
|
|
36
9
|
? { Accept: 'application/json' }
|
|
37
10
|
: { 'Content-Type': 'application/json', Accept: 'application/json' };
|
|
38
|
-
// #2: Attach stable device ID so backend can correctly identify the same browser
|
|
39
|
-
const deviceId = getOrCreateDeviceId();
|
|
40
|
-
if (deviceId) {
|
|
41
|
-
headers['X-Device-Id'] = deviceId;
|
|
42
|
-
}
|
|
43
11
|
if (includeAuth) {
|
|
44
12
|
try {
|
|
45
13
|
const cookieHeader = await getCookieHeader();
|
|
46
14
|
headers = { ...headers, Cookie: cookieHeader };
|
|
47
15
|
}
|
|
48
16
|
catch (error) {
|
|
49
|
-
if (error && typeof error === 'object' && ('$$typeof' in error || error.digest === 'DYNAMIC_SERVER_USAGE')) {
|
|
50
|
-
throw error; // Re-throw Next.js PPR bail-out
|
|
51
|
-
}
|
|
52
17
|
// If we can't get cookies (CSR context), credentials: 'include' will handle it
|
|
53
18
|
console.warn('Could not get cookies for auth header:', error);
|
|
54
19
|
}
|
|
@@ -80,8 +45,8 @@ async function customFetch(input, method, body, options = {}) {
|
|
|
80
45
|
}
|
|
81
46
|
throw new ApiError(errorBody.statusCode, errorBody.error);
|
|
82
47
|
}
|
|
83
|
-
// Token refresh function
|
|
84
|
-
async function refreshToken(input, method, body) {
|
|
48
|
+
// Token refresh function
|
|
49
|
+
export async function refreshToken(input, method, body) {
|
|
85
50
|
const role = await getRole();
|
|
86
51
|
try {
|
|
87
52
|
const roleForEndpoint = role == "admin" ? "user" : role;
|
|
@@ -98,13 +63,10 @@ async function refreshToken(input, method, body) {
|
|
|
98
63
|
}
|
|
99
64
|
}
|
|
100
65
|
catch (error) {
|
|
101
|
-
|
|
102
|
-
throw error; // Re-throw Next.js PPR bail-out
|
|
103
|
-
}
|
|
104
|
-
throw new ApiError(error.statusCode ?? 500, error.error || error.message || 'Unknown error');
|
|
66
|
+
throw new ApiError(error.statusCode ?? 500, error.error);
|
|
105
67
|
}
|
|
106
68
|
}
|
|
107
|
-
// ✅
|
|
69
|
+
// ✅ Sever-safe exported functions
|
|
108
70
|
export async function get(url, includeAuth = true) {
|
|
109
71
|
return customFetch(url, 'GET', undefined, { includeAuth });
|
|
110
72
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"severActions.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/severActions.ts"],"names":[],"mappings":"AAKA,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAKvD;AAED,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQtD"}
|
|
@@ -3,8 +3,8 @@ import { cookies } from 'next/headers';
|
|
|
3
3
|
import { validRoles } from '../utils';
|
|
4
4
|
export async function getCookieHeader() {
|
|
5
5
|
const cookieStore = await cookies();
|
|
6
|
-
return
|
|
7
|
-
.map((
|
|
6
|
+
return cookieStore.getAll()
|
|
7
|
+
.map((cookie) => `${cookie.name}=${cookie.value}`)
|
|
8
8
|
.join('; ');
|
|
9
9
|
}
|
|
10
10
|
export async function getRole() {
|
|
@@ -13,9 +13,6 @@ export async function getRole() {
|
|
|
13
13
|
return (role && validRoles.includes(role)) ? role : null;
|
|
14
14
|
}
|
|
15
15
|
catch (err) {
|
|
16
|
-
if (err && typeof err === 'object' && ('$$typeof' in err || err.digest === 'DYNAMIC_SERVER_USAGE')) {
|
|
17
|
-
throw err;
|
|
18
|
-
}
|
|
19
16
|
console.error('Invalid token', err);
|
|
20
17
|
return null;
|
|
21
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authSessionManager.d.ts","sourceRoot":"","sources":["../../src/lib/authSessionManager.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,kBAAkB,
|
|
1
|
+
{"version":3,"file":"authSessionManager.d.ts","sourceRoot":"","sources":["../../src/lib/authSessionManager.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,kBAAkB,SA8BzC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useAtom } from 'jotai'; // Import useSetAtom
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useQuery } from '@tanstack/react-query';
|
|
5
|
-
import { initializeAuthSessionAtom } from './userAtom'; // Import the atom itself
|
|
5
|
+
import { initializeAuthSessionAtom, resetAuthState } from './userAtom'; // Import the atom itself
|
|
6
6
|
import { validateSession } from './actions/auth';
|
|
7
7
|
export default function AuthSessionManager() {
|
|
8
8
|
const [, initializeAuthSession] = useAtom(initializeAuthSessionAtom);
|
|
@@ -24,18 +24,11 @@ export default function AuthSessionManager() {
|
|
|
24
24
|
},
|
|
25
25
|
staleTime: 15 * 60 * 1000,
|
|
26
26
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// Aggressively resetting here was causing false logouts after browser restart.
|
|
34
|
-
// useEffect(() => {
|
|
35
|
-
// if (isError) {
|
|
36
|
-
// console.log("Session validation failed. Logging out.");
|
|
37
|
-
// resetAuthState();
|
|
38
|
-
// }
|
|
39
|
-
// }, [isError, resetAuthState]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (isError) {
|
|
29
|
+
console.log("Session validation failed. Logging out.");
|
|
30
|
+
resetAuthState();
|
|
31
|
+
}
|
|
32
|
+
}, [isError, resetAuthState]);
|
|
40
33
|
return null;
|
|
41
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Socket } from "socket.io-client";
|
|
3
3
|
import type { Conversation, Message } from "../models/chat";
|
|
4
|
-
import type { Notif } from "../models/
|
|
4
|
+
import type { Notif } from "../models/notfications";
|
|
5
5
|
interface ChatContextType {
|
|
6
6
|
socket: Socket | null;
|
|
7
7
|
isConnected: boolean;
|