@clinchdate/api-client 1.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/README.MD +711 -0
- package/dist/client.d.ts +30 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +196 -0
- package/dist/client.js.map +1 -0
- package/dist/config/environments.d.ts +24 -0
- package/dist/config/environments.d.ts.map +1 -0
- package/dist/config/environments.js +24 -0
- package/dist/config/environments.js.map +1 -0
- package/dist/config.d.ts +21 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +44 -0
- package/dist/config.js.map +1 -0
- package/dist/hooks/useAuth.d.ts +13 -0
- package/dist/hooks/useAuth.d.ts.map +1 -0
- package/dist/hooks/useAuth.js +66 -0
- package/dist/hooks/useAuth.js.map +1 -0
- package/dist/hooks/useCall.d.ts +55 -0
- package/dist/hooks/useCall.d.ts.map +1 -0
- package/dist/hooks/useCall.js +148 -0
- package/dist/hooks/useCall.js.map +1 -0
- package/dist/hooks/useChat.d.ts +13 -0
- package/dist/hooks/useChat.d.ts.map +1 -0
- package/dist/hooks/useChat.js +76 -0
- package/dist/hooks/useChat.js.map +1 -0
- package/dist/hooks/useMatch.d.ts +15 -0
- package/dist/hooks/useMatch.d.ts.map +1 -0
- package/dist/hooks/useMatch.js +72 -0
- package/dist/hooks/useMatch.js.map +1 -0
- package/dist/hooks/useUser.d.ts +22 -0
- package/dist/hooks/useUser.d.ts.map +1 -0
- package/dist/hooks/useUser.js +170 -0
- package/dist/hooks/useUser.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptors/auth.interceptor.d.ts +14 -0
- package/dist/interceptors/auth.interceptor.d.ts.map +1 -0
- package/dist/interceptors/auth.interceptor.js +61 -0
- package/dist/interceptors/auth.interceptor.js.map +1 -0
- package/dist/interceptors/error.interceptor.d.ts +12 -0
- package/dist/interceptors/error.interceptor.d.ts.map +1 -0
- package/dist/interceptors/error.interceptor.js +50 -0
- package/dist/interceptors/error.interceptor.js.map +1 -0
- package/dist/interceptors/response.interceptor.d.ts +2 -0
- package/dist/interceptors/response.interceptor.d.ts.map +1 -0
- package/dist/interceptors/response.interceptor.js +2 -0
- package/dist/interceptors/response.interceptor.js.map +1 -0
- package/dist/services/auth.service.d.ts +12 -0
- package/dist/services/auth.service.d.ts.map +1 -0
- package/dist/services/auth.service.js +37 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/base.service.d.ts +10 -0
- package/dist/services/base.service.d.ts.map +1 -0
- package/dist/services/base.service.js +22 -0
- package/dist/services/base.service.js.map +1 -0
- package/dist/services/call.service.d.ts +80 -0
- package/dist/services/call.service.d.ts.map +1 -0
- package/dist/services/call.service.js +57 -0
- package/dist/services/call.service.js.map +1 -0
- package/dist/services/chat.service.d.ts +16 -0
- package/dist/services/chat.service.d.ts.map +1 -0
- package/dist/services/chat.service.js +33 -0
- package/dist/services/chat.service.js.map +1 -0
- package/dist/services/index.d.ts +23 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +23 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/match.service.d.ts +14 -0
- package/dist/services/match.service.d.ts.map +1 -0
- package/dist/services/match.service.js +23 -0
- package/dist/services/match.service.js.map +1 -0
- package/dist/services/notification.service.d.ts +16 -0
- package/dist/services/notification.service.d.ts.map +1 -0
- package/dist/services/notification.service.js +31 -0
- package/dist/services/notification.service.js.map +1 -0
- package/dist/services/payment.service.d.ts +15 -0
- package/dist/services/payment.service.d.ts.map +1 -0
- package/dist/services/payment.service.js +32 -0
- package/dist/services/payment.service.js.map +1 -0
- package/dist/services/user.service.d.ts +16 -0
- package/dist/services/user.service.d.ts.map +1 -0
- package/dist/services/user.service.js +34 -0
- package/dist/services/user.service.js.map +1 -0
- package/dist/types/auth.types.d.ts +49 -0
- package/dist/types/auth.types.d.ts.map +1 -0
- package/dist/types/auth.types.js +2 -0
- package/dist/types/auth.types.js.map +1 -0
- package/dist/types/chat.types.d.ts +35 -0
- package/dist/types/chat.types.d.ts.map +1 -0
- package/dist/types/chat.types.js +2 -0
- package/dist/types/chat.types.js.map +1 -0
- package/dist/types/common.types.d.ts +39 -0
- package/dist/types/common.types.d.ts.map +1 -0
- package/dist/types/common.types.js +25 -0
- package/dist/types/common.types.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/match.types.d.ts +40 -0
- package/dist/types/match.types.d.ts.map +1 -0
- package/dist/types/match.types.js +2 -0
- package/dist/types/match.types.js.map +1 -0
- package/dist/types/notification.types.d.ts +26 -0
- package/dist/types/notification.types.d.ts.map +1 -0
- package/dist/types/notification.types.js +2 -0
- package/dist/types/notification.types.js.map +1 -0
- package/dist/types/payment.types.d.ts +47 -0
- package/dist/types/payment.types.d.ts.map +1 -0
- package/dist/types/payment.types.js +2 -0
- package/dist/types/payment.types.js.map +1 -0
- package/dist/types/user.types.d.ts +50 -0
- package/dist/types/user.types.d.ts.map +1 -0
- package/dist/types/user.types.js +2 -0
- package/dist/types/user.types.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { callService } from '../services/call.service';
|
|
3
|
+
export function useCall() {
|
|
4
|
+
const [loading, setLoading] = useState(false);
|
|
5
|
+
const [error, setError] = useState(null);
|
|
6
|
+
const clearError = useCallback(() => setError(null), []);
|
|
7
|
+
const createVideoRoom = useCallback(async (roomName, maxParticipants = 2) => {
|
|
8
|
+
setLoading(true);
|
|
9
|
+
setError(null);
|
|
10
|
+
try {
|
|
11
|
+
return await callService.createVideoRoom(roomName, maxParticipants);
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
setError(err.message);
|
|
15
|
+
throw err;
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
setLoading(false);
|
|
19
|
+
}
|
|
20
|
+
}, []);
|
|
21
|
+
const joinVideoCall = useCallback(async (roomName) => {
|
|
22
|
+
setLoading(true);
|
|
23
|
+
setError(null);
|
|
24
|
+
try {
|
|
25
|
+
return await callService.joinVideoCall(roomName);
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
setError(err.message);
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
setLoading(false);
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
const endVideoCall = useCallback(async (roomSid) => {
|
|
36
|
+
setLoading(true);
|
|
37
|
+
setError(null);
|
|
38
|
+
try {
|
|
39
|
+
return await callService.endVideoCall(roomSid);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
setError(err.message);
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
finally {
|
|
46
|
+
setLoading(false);
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
const muteAudio = useCallback(async (roomSid) => {
|
|
50
|
+
try {
|
|
51
|
+
return await callService.muteAudio(roomSid);
|
|
52
|
+
}
|
|
53
|
+
catch (err) {
|
|
54
|
+
setError(err.message);
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}, []);
|
|
58
|
+
const unmuteAudio = useCallback(async (roomSid) => {
|
|
59
|
+
try {
|
|
60
|
+
return await callService.unmuteAudio(roomSid);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
setError(err.message);
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
}, []);
|
|
67
|
+
const initiateAudioCall = useCallback(async (recipientId) => {
|
|
68
|
+
setLoading(true);
|
|
69
|
+
setError(null);
|
|
70
|
+
try {
|
|
71
|
+
return await callService.initiateAudioCall(recipientId);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
setError(err.message);
|
|
75
|
+
throw err;
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
setLoading(false);
|
|
79
|
+
}
|
|
80
|
+
}, []);
|
|
81
|
+
const acceptAudioCall = useCallback(async (callId) => {
|
|
82
|
+
setLoading(true);
|
|
83
|
+
setError(null);
|
|
84
|
+
try {
|
|
85
|
+
return await callService.acceptAudioCall(callId);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
setError(err.message);
|
|
89
|
+
throw err;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
setLoading(false);
|
|
93
|
+
}
|
|
94
|
+
}, []);
|
|
95
|
+
const rejectAudioCall = useCallback(async (callId) => {
|
|
96
|
+
try {
|
|
97
|
+
return await callService.rejectAudioCall(callId);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
setError(err.message);
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}, []);
|
|
104
|
+
const endAudioCall = useCallback(async (callId) => {
|
|
105
|
+
setLoading(true);
|
|
106
|
+
setError(null);
|
|
107
|
+
try {
|
|
108
|
+
return await callService.endAudioCall(callId);
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
setError(err.message);
|
|
112
|
+
throw err;
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
setLoading(false);
|
|
116
|
+
}
|
|
117
|
+
}, []);
|
|
118
|
+
const getCallHistory = useCallback(async (limit = 20) => {
|
|
119
|
+
setLoading(true);
|
|
120
|
+
setError(null);
|
|
121
|
+
try {
|
|
122
|
+
return await callService.getCallHistory(limit);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
setError(err.message);
|
|
126
|
+
throw err;
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
setLoading(false);
|
|
130
|
+
}
|
|
131
|
+
}, []);
|
|
132
|
+
return {
|
|
133
|
+
loading,
|
|
134
|
+
error,
|
|
135
|
+
clearError,
|
|
136
|
+
createVideoRoom,
|
|
137
|
+
joinVideoCall,
|
|
138
|
+
endVideoCall,
|
|
139
|
+
muteAudio,
|
|
140
|
+
unmuteAudio,
|
|
141
|
+
initiateAudioCall,
|
|
142
|
+
acceptAudioCall,
|
|
143
|
+
rejectAudioCall,
|
|
144
|
+
endAudioCall,
|
|
145
|
+
getCallHistory,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=useCall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCall.js","sourceRoot":"","sources":["../../src/hooks/useCall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,UAAU,OAAO;IACrB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAExD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAIzD,MAAM,eAAe,GAAG,WAAW,CACjC,KAAK,EAAE,QAAgB,EAAE,kBAA0B,CAAC,EAAE,EAAE;QACtD,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,QAAQ,CAAC,IAAI,CAAC,CAAC;QACf,IAAI,CAAC;YACH,OAAO,MAAM,WAAW,CAAC,eAAe,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,QAAQ,CAAE,GAAW,CAAC,OAAO,CAAC,CAAC;YAC/B,MAAM,GAAG,CAAC;QACZ,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH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;QAEX,iBAAiB;QACjB,eAAe;QACf,eAAe;QACf,YAAY;QACZ,cAAc;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Message, Conversation } from '../types/chat.types';
|
|
2
|
+
import { ApiClientError } from '../types/common.types';
|
|
3
|
+
export declare function useChat(): {
|
|
4
|
+
conversations: Conversation[];
|
|
5
|
+
messages: Message[];
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: ApiClientError | null;
|
|
8
|
+
clearError: () => void;
|
|
9
|
+
getConversations: () => Promise<Conversation[] | undefined>;
|
|
10
|
+
getMessages: (matchId: string) => Promise<Message[] | undefined>;
|
|
11
|
+
sendMessage: (matchId: string, text: string, recipientId: string) => Promise<Message>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=useChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useChat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,wBAAgB,OAAO;;;;;;;2BA0B2B,MAAM;2BAmBpC,MAAM,QAAQ,MAAM,eAAe,MAAM;EA+B5D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { ChatService } from '../services/chat.service';
|
|
3
|
+
import { ApiClientError } from '../types/common.types';
|
|
4
|
+
const chatService = new ChatService();
|
|
5
|
+
export function useChat() {
|
|
6
|
+
const [conversations, setConversations] = useState([]);
|
|
7
|
+
const [messages, setMessages] = useState([]);
|
|
8
|
+
const [loading, setLoading] = useState(false);
|
|
9
|
+
const [error, setError] = useState(null);
|
|
10
|
+
const clearError = useCallback(() => setError(null), []);
|
|
11
|
+
const getConversations = useCallback(async () => {
|
|
12
|
+
setLoading(true);
|
|
13
|
+
try {
|
|
14
|
+
const data = await chatService.getConversations();
|
|
15
|
+
setConversations(data);
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
const apiError = err instanceof ApiClientError
|
|
20
|
+
? err
|
|
21
|
+
: new ApiClientError('UNKNOWN', 'Failed to fetch conversations');
|
|
22
|
+
setError(apiError);
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
setLoading(false);
|
|
27
|
+
}
|
|
28
|
+
}, []);
|
|
29
|
+
const getMessages = useCallback(async (matchId) => {
|
|
30
|
+
setLoading(true);
|
|
31
|
+
try {
|
|
32
|
+
const data = await chatService.getMessages(matchId);
|
|
33
|
+
setMessages(data);
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
const apiError = err instanceof ApiClientError
|
|
38
|
+
? err
|
|
39
|
+
: new ApiClientError('UNKNOWN', 'Failed to fetch messages');
|
|
40
|
+
setError(apiError);
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
setLoading(false);
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
const sendMessage = useCallback(async (matchId, text, recipientId) => {
|
|
48
|
+
try {
|
|
49
|
+
const message = await chatService.sendMessage({
|
|
50
|
+
text,
|
|
51
|
+
matchId,
|
|
52
|
+
recipientId,
|
|
53
|
+
});
|
|
54
|
+
setMessages((prev) => [...prev, message]);
|
|
55
|
+
return message;
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
const apiError = err instanceof ApiClientError
|
|
59
|
+
? err
|
|
60
|
+
: new ApiClientError('UNKNOWN', 'Failed to send message');
|
|
61
|
+
setError(apiError);
|
|
62
|
+
throw apiError;
|
|
63
|
+
}
|
|
64
|
+
}, []);
|
|
65
|
+
return {
|
|
66
|
+
conversations,
|
|
67
|
+
messages,
|
|
68
|
+
loading,
|
|
69
|
+
error,
|
|
70
|
+
clearError,
|
|
71
|
+
getConversations,
|
|
72
|
+
getMessages,
|
|
73
|
+
sendMessage,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=useChat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useChat.js","sourceRoot":"","sources":["../../src/hooks/useChat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC,MAAM,UAAU,OAAO;IACrB,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAiB,EAAE,CAAC,CAAC;IACvE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAY,EAAE,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAC;IAEhE,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;IAEzD,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC9C,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC,gBAAgB,EAAE,CAAC;YAClD,gBAAgB,CAAC,IAAI,CAAC,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,QAAQ,GACZ,GAAG,YAAY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AAO,GAAG,EAAE,CAAC;YACb,MAAM,QAAQ,GACZ,GAAG,YAAY,cAAc;gBAC3B,CAAC,CAAC,GAAG;gBACL,CAAC,CAAC,IAAI,cAAc,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC;YAC9D,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnB,MAAM,QAAQ,CAAC;QACjB,CAAC;IACH,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO;QACL,aAAa;QACb,QAAQ;QACR,OAAO;QACP,KAAK;QACL,UAAU;QACV,gBAAgB;QAChB,WAAW;QACX,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Match, SwipeRequest } from '../types/match.types';
|
|
2
|
+
import { ApiClientError } from '../types/common.types';
|
|
3
|
+
export declare function useMatch(): {
|
|
4
|
+
matches: Match[];
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: ApiClientError | null;
|
|
7
|
+
clearError: () => void;
|
|
8
|
+
getMatches: () => Promise<import("..").GetMatchesResponse | undefined>;
|
|
9
|
+
swipe: (request: SwipeRequest) => Promise<{
|
|
10
|
+
isMatch: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
unmatch: (matchId: string) => Promise<void>;
|
|
13
|
+
reportUser: (userId: string, reason: string) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useMatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMatch.d.ts","sourceRoot":"","sources":["../../src/hooks/useMatch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,wBAAgB,QAAQ;;;;;;qBAyBJ,YAAY;;;uBAmBc,MAAM;yBAcJ,MAAM,UAAU,MAAM;EAgBrE"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { MatchService } from '../services/match.service';
|
|
3
|
+
import { ApiClientError } from '../types/common.types';
|
|
4
|
+
const matchService = new MatchService();
|
|
5
|
+
export function useMatch() {
|
|
6
|
+
const [matches, setMatches] = useState([]);
|
|
7
|
+
const [loading, setLoading] = useState(false);
|
|
8
|
+
const [error, setError] = useState(null);
|
|
9
|
+
const getMatches = useCallback(async () => {
|
|
10
|
+
setLoading(true);
|
|
11
|
+
setError(null);
|
|
12
|
+
try {
|
|
13
|
+
const response = await matchService.getMatches();
|
|
14
|
+
setMatches(response.matches);
|
|
15
|
+
return response;
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
const apiError = err instanceof ApiClientError
|
|
19
|
+
? err
|
|
20
|
+
: new ApiClientError('UNKNOWN', 'Failed to fetch matches');
|
|
21
|
+
setError(apiError);
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
setLoading(false);
|
|
26
|
+
}
|
|
27
|
+
}, []);
|
|
28
|
+
const swipe = useCallback(async (request) => {
|
|
29
|
+
try {
|
|
30
|
+
const result = await matchService.swipe(request);
|
|
31
|
+
if (result.isMatch) {
|
|
32
|
+
await getMatches();
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
catch (err) {
|
|
37
|
+
const apiError = err instanceof ApiClientError
|
|
38
|
+
? err
|
|
39
|
+
: new ApiClientError('UNKNOWN', 'Swipe action failed');
|
|
40
|
+
setError(apiError);
|
|
41
|
+
throw apiError;
|
|
42
|
+
}
|
|
43
|
+
}, [getMatches]);
|
|
44
|
+
const unmatch = useCallback(async (matchId) => {
|
|
45
|
+
try {
|
|
46
|
+
await matchService.unmatch(matchId);
|
|
47
|
+
setMatches((prev) => prev.filter((m) => m.id !== matchId));
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
const apiError = err instanceof ApiClientError
|
|
51
|
+
? err
|
|
52
|
+
: new ApiClientError('UNKNOWN', 'Unmatch failed');
|
|
53
|
+
setError(apiError);
|
|
54
|
+
throw apiError;
|
|
55
|
+
}
|
|
56
|
+
}, []);
|
|
57
|
+
const reportUser = useCallback(async (userId, reason) => {
|
|
58
|
+
try {
|
|
59
|
+
await matchService.reportUser(userId, reason);
|
|
60
|
+
}
|
|
61
|
+
catch (err) {
|
|
62
|
+
const apiError = err instanceof ApiClientError
|
|
63
|
+
? err
|
|
64
|
+
: new ApiClientError('UNKNOWN', 'Report failed');
|
|
65
|
+
setError(apiError);
|
|
66
|
+
throw apiError;
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
const clearError = useCallback(() => setError(null), []);
|
|
70
|
+
return { matches, loading, error, clearError, getMatches, swipe, unmatch, reportUser };
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=useMatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMatch.js","sourceRoot":"","sources":["../../src/hooks/useMatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,YAAY,GAAG,IAAI,YAAY,EAAE,CAAC;AAExC,MAAM,UAAU,QAAQ;IACtB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAU,EAAE,CAAC,CAAC;IACpD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAC;IAEhE,MAAM,UAAU,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QACxC,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,Q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common.types';
|
|
3
|
+
export declare function useUser(): {
|
|
4
|
+
profile: User | null;
|
|
5
|
+
discoverUsers: User[];
|
|
6
|
+
blockedUsers: User[];
|
|
7
|
+
loading: boolean;
|
|
8
|
+
error: ApiClientError | null;
|
|
9
|
+
clearError: () => void;
|
|
10
|
+
setProfile: import("react").Dispatch<import("react").SetStateAction<User | null>>;
|
|
11
|
+
getProfile: (userId?: string) => Promise<User>;
|
|
12
|
+
updateProfile: (data: UpdateProfileRequest) => Promise<User>;
|
|
13
|
+
uploadAvatar: (file: File) => Promise<{
|
|
14
|
+
url: string;
|
|
15
|
+
}>;
|
|
16
|
+
deleteAccount: () => Promise<void>;
|
|
17
|
+
getDiscoverUsers: (limit?: number) => Promise<User[] | undefined>;
|
|
18
|
+
blockUser: (userId: string) => Promise<void>;
|
|
19
|
+
unblockUser: (userId: string) => Promise<void>;
|
|
20
|
+
getBlockedUsers: () => Promise<User[] | undefined>;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUser.d.ts","sourceRoot":"","sources":["../../src/hooks/useUser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,wBAAgB,OAAO;;;;;;;;0BAO0B,MAAM;0BAmBN,oBAAoB;yBAmBrB,IAAI;;;;+BAsCC,MAAM;wBAmBZ,MAAM;0BAcJ,MAAM;;EAoDtD"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
import { UserService } from '../services/user.service';
|
|
3
|
+
import { ApiClientError } from '../types/common.types';
|
|
4
|
+
const userService = new UserService();
|
|
5
|
+
export function useUser() {
|
|
6
|
+
const [profile, setProfile] = useState(null);
|
|
7
|
+
const [discoverUsers, setDiscoverUsers] = useState([]);
|
|
8
|
+
const [blockedUsers, setBlockedUsers] = useState([]);
|
|
9
|
+
const [loading, setLoading] = useState(false);
|
|
10
|
+
const [error, setError] = useState(null);
|
|
11
|
+
const getProfile = useCallback(async (userId) => {
|
|
12
|
+
setLoading(true);
|
|
13
|
+
setError(null);
|
|
14
|
+
try {
|
|
15
|
+
const data = await userService.getProfile(userId);
|
|
16
|
+
if (!userId)
|
|
17
|
+
setProfile(data);
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
const apiError = err instanceof ApiClientError
|
|
22
|
+
? err
|
|
23
|
+
: new ApiClientError('UNKNOWN', 'Failed to fetch profile');
|
|
24
|
+
setError(apiError);
|
|
25
|
+
throw apiError;
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
setLoading(false);
|
|
29
|
+
}
|
|
30
|
+
}, []);
|
|
31
|
+
const updateProfile = useCallback(async (data) => {
|
|
32
|
+
setLoading(true);
|
|
33
|
+
setError(null);
|
|
34
|
+
try {
|
|
35
|
+
const updated = await userService.updateProfile(data);
|
|
36
|
+
setProfile(updated);
|
|
37
|
+
return updated;
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const apiError = err instanceof ApiClientError
|
|
41
|
+
? err
|
|
42
|
+
: new ApiClientError('UNKNOWN', 'Failed to update profile');
|
|
43
|
+
setError(apiError);
|
|
44
|
+
throw apiError;
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
setLoading(false);
|
|
48
|
+
}
|
|
49
|
+
}, []);
|
|
50
|
+
const uploadAvatar = useCallback(async (file) => {
|
|
51
|
+
setLoading(true);
|
|
52
|
+
setError(null);
|
|
53
|
+
try {
|
|
54
|
+
const result = await userService.uploadAvatar(file);
|
|
55
|
+
setProfile((prev) => (prev ? { ...prev, avatar: result.url } : prev));
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
const apiError = err instanceof ApiClientError
|
|
60
|
+
? err
|
|
61
|
+
: new ApiClientError('UNKNOWN', 'Failed to upload avatar');
|
|
62
|
+
setError(apiError);
|
|
63
|
+
throw apiError;
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
setLoading(false);
|
|
67
|
+
}
|
|
68
|
+
}, []);
|
|
69
|
+
const deleteAccount = useCallback(async () => {
|
|
70
|
+
setLoading(true);
|
|
71
|
+
setError(null);
|
|
72
|
+
try {
|
|
73
|
+
await userService.deleteAccount();
|
|
74
|
+
setProfile(null);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
const apiError = err instanceof ApiClientError
|
|
78
|
+
? err
|
|
79
|
+
: new ApiClientError('UNKNOWN', 'Failed to delete account');
|
|
80
|
+
setError(apiError);
|
|
81
|
+
throw apiError;
|
|
82
|
+
}
|
|
83
|
+
finally {
|
|
84
|
+
setLoading(false);
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
87
|
+
const getDiscoverUsers = useCallback(async (limit = 10) => {
|
|
88
|
+
setLoading(true);
|
|
89
|
+
setError(null);
|
|
90
|
+
try {
|
|
91
|
+
const users = await userService.getDiscoverUsers(limit);
|
|
92
|
+
setDiscoverUsers(users);
|
|
93
|
+
return users;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
const apiError = err instanceof ApiClientError
|
|
97
|
+
? err
|
|
98
|
+
: new ApiClientError('UNKNOWN', 'Failed to fetch discover users');
|
|
99
|
+
setError(apiError);
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
setLoading(false);
|
|
104
|
+
}
|
|
105
|
+
}, []);
|
|
106
|
+
const blockUser = useCallback(async (userId) => {
|
|
107
|
+
try {
|
|
108
|
+
await userService.blockUser(userId);
|
|
109
|
+
setDiscoverUsers((prev) => prev.filter((u) => u.id !== userId));
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
const apiError = err instanceof ApiClientError
|
|
113
|
+
? err
|
|
114
|
+
: new ApiClientError('UNKNOWN', 'Failed to block user');
|
|
115
|
+
setError(apiError);
|
|
116
|
+
throw apiError;
|
|
117
|
+
}
|
|
118
|
+
}, []);
|
|
119
|
+
const unblockUser = useCallback(async (userId) => {
|
|
120
|
+
try {
|
|
121
|
+
await userService.unblockUser(userId);
|
|
122
|
+
setBlockedUsers((prev) => prev.filter((u) => u.id !== userId));
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
const apiError = err instanceof ApiClientError
|
|
126
|
+
? err
|
|
127
|
+
: new ApiClientError('UNKNOWN', 'Failed to unblock user');
|
|
128
|
+
setError(apiError);
|
|
129
|
+
throw apiError;
|
|
130
|
+
}
|
|
131
|
+
}, []);
|
|
132
|
+
const getBlockedUsers = useCallback(async () => {
|
|
133
|
+
setLoading(true);
|
|
134
|
+
setError(null);
|
|
135
|
+
try {
|
|
136
|
+
const users = await userService.getBlockedUsers();
|
|
137
|
+
setBlockedUsers(users);
|
|
138
|
+
return users;
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
const apiError = err instanceof ApiClientError
|
|
142
|
+
? err
|
|
143
|
+
: new ApiClientError('UNKNOWN', 'Failed to fetch blocked users');
|
|
144
|
+
setError(apiError);
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
finally {
|
|
148
|
+
setLoading(false);
|
|
149
|
+
}
|
|
150
|
+
}, []);
|
|
151
|
+
const clearError = useCallback(() => setError(null), []);
|
|
152
|
+
return {
|
|
153
|
+
profile,
|
|
154
|
+
discoverUsers,
|
|
155
|
+
blockedUsers,
|
|
156
|
+
loading,
|
|
157
|
+
error,
|
|
158
|
+
clearError,
|
|
159
|
+
setProfile,
|
|
160
|
+
getProfile,
|
|
161
|
+
updateProfile,
|
|
162
|
+
uploadAvatar,
|
|
163
|
+
deleteAccount,
|
|
164
|
+
getDiscoverUsers,
|
|
165
|
+
blockUser,
|
|
166
|
+
unblockUser,
|
|
167
|
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B;QAChB,SAAS;QACT,WAAW;QACX,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { configure, getConfig, isConfigured, resetConfig } from './config';
|
|
2
|
+
export type { ApiClientConfig, TokenPair } from './config';
|
|
3
|
+
export { httpClient, ApiError, resetHttpClient } from './client';
|
|
4
|
+
export type { ApiErrorResponse } from './client';
|
|
5
|
+
export * from './types/common.types';
|
|
6
|
+
export * from './types/auth.types';
|
|
7
|
+
export * from './types/user.types';
|
|
8
|
+
export * from './types/match.types';
|
|
9
|
+
export * from './types/chat.types';
|
|
10
|
+
export * from './types/notification.types';
|
|
11
|
+
export * from './types/payment.types';
|
|
12
|
+
export { AuthService, authService, UserService, userService, MatchService, matchService, ChatService, chatService, NotificationService, notificationService, PaymentService, paymentService, CallService, callService, BaseService, } from './services';
|
|
13
|
+
export { useAuth } from './hooks/useAuth';
|
|
14
|
+
export { useUser } from './hooks/useUser';
|
|
15
|
+
export { useMatch } from './hooks/useMatch';
|
|
16
|
+
export { useChat } from './hooks/useChat';
|
|
17
|
+
export { useCall } from './hooks/useCall';
|
|
18
|
+
export declare const services: {
|
|
19
|
+
auth: import("./services").AuthService;
|
|
20
|
+
user: import("./services").UserService;
|
|
21
|
+
match: import("./services").MatchService;
|
|
22
|
+
chat: import("./services").ChatService;
|
|
23
|
+
notification: import("./services").NotificationService;
|
|
24
|
+
payment: import("./services").PaymentService;
|
|
25
|
+
call: import("./services").CallService;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC3E,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG3D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACjE,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAa1C,eAAO,MAAM,QAAQ;;;;;;;;CAQpB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { configure, getConfig, isConfigured, resetConfig } from './config';
|
|
2
|
+
export { httpClient, ApiError, resetHttpClient } from './client';
|
|
3
|
+
export * from './types/common.types';
|
|
4
|
+
export * from './types/auth.types';
|
|
5
|
+
export * from './types/user.types';
|
|
6
|
+
export * from './types/match.types';
|
|
7
|
+
export * from './types/chat.types';
|
|
8
|
+
export * from './types/notification.types';
|
|
9
|
+
export * from './types/payment.types';
|
|
10
|
+
export { AuthService, authService, UserService, userService, MatchService, matchService, ChatService, chatService, NotificationService, notificationService, PaymentService, paymentService, CallService, callService, BaseService, } from './services';
|
|
11
|
+
export { useAuth } from './hooks/useAuth';
|
|
12
|
+
export { useUser } from './hooks/useUser';
|
|
13
|
+
export { useMatch } from './hooks/useMatch';
|
|
14
|
+
export { useChat } from './hooks/useChat';
|
|
15
|
+
export { useCall } from './hooks/useCall';
|
|
16
|
+
import { authService as _auth, userService as _user, matchService as _match, chatService as _chat, notificationService as _notif, paymentService as _pay, callService as _call, } from './services';
|
|
17
|
+
export const services = {
|
|
18
|
+
auth: _auth,
|
|
19
|
+
user: _user,
|
|
20
|
+
match: _match,
|
|
21
|
+
chat: _chat,
|
|
22
|
+
notification: _notif,
|
|
23
|
+
payment: _pay,
|
|
24
|
+
call: _call,
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI3E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIjE,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AAGtC,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,OAAO,EACL,WAAW,IAAI,KAAK,EACpB,WAAW,IAAI,KAAK,EACpB,YAAY,IAAI,MAAM,EACtB,WAAW,IAAI,KAAK,EACpB,mBAAmB,IAAI,MAAM,EAC7B,cAAc,IAAI,IAAI,EACtB,WAAW,IAAI,KAAK,GACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,KAAK;IACX,YAAY,EAAE,MAAM;IACpB,OAAO,EAAE,IAAI;IACb,IAAI,EAAE,KAAK;CACZ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
export declare class AuthInterceptor {
|
|
3
|
+
private static accessToken;
|
|
4
|
+
private static isRefreshing;
|
|
5
|
+
private static refreshSubscribers;
|
|
6
|
+
static install(axiosInstance: AxiosInstance): void;
|
|
7
|
+
static setTokens(accessToken: string, refreshToken: string): void;
|
|
8
|
+
static clearTokens(): void;
|
|
9
|
+
static getAccessToken(): string | null;
|
|
10
|
+
private static addRefreshSubscriber;
|
|
11
|
+
private static onRefreshed;
|
|
12
|
+
private static refreshAccessToken;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=auth.interceptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.interceptor.d.ts","sourceRoot":"","sources":["../../src/interceptors/auth.interceptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA8B,MAAM,OAAO,CAAC;AAElE,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,WAAW,CAAuB;IACjD,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IACpC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAsC;IAEvE,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAkDlD,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI;IAOjE,MAAM,CAAC,WAAW,IAAI,IAAI;IAI1B,MAAM,CAAC,cAAc,IAAI,MAAM,GAAG,IAAI;IAItC,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAInC,OAAO,CAAC,MAAM,CAAC,WAAW;mBAKL,kBAAkB;CAKxC"}
|