@workhive/api 1.3.4 → 1.4.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/client.d.ts +141 -6
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +228 -12
- package/dist/context.d.ts +103 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +24 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +20 -1
- package/dist/hooks/use-billing-status.d.ts +7 -0
- package/dist/hooks/use-billing-status.d.ts.map +1 -0
- package/dist/hooks/use-billing-status.js +17 -0
- package/dist/hooks/use-card.d.ts +2 -0
- package/dist/hooks/use-card.d.ts.map +1 -0
- package/dist/hooks/use-card.js +12 -0
- package/dist/hooks/use-cards.d.ts +5 -0
- package/dist/hooks/use-cards.d.ts.map +1 -0
- package/dist/hooks/use-cards.js +12 -0
- package/dist/hooks/use-create-card.d.ts +10 -0
- package/dist/hooks/use-create-card.d.ts.map +1 -0
- package/dist/hooks/use-create-card.js +13 -0
- package/dist/hooks/use-delete-card.d.ts +15 -0
- package/dist/hooks/use-delete-card.d.ts.map +1 -0
- package/dist/hooks/use-delete-card.js +38 -0
- package/dist/hooks/use-email-drafts.d.ts +32 -0
- package/dist/hooks/use-email-drafts.d.ts.map +1 -0
- package/dist/hooks/use-email-drafts.js +98 -0
- package/dist/hooks/use-gmail-connection-members.d.ts +2 -0
- package/dist/hooks/use-gmail-connection-members.d.ts.map +1 -0
- package/dist/hooks/use-gmail-connection-members.js +13 -0
- package/dist/hooks/use-gmail-connections.d.ts +5 -0
- package/dist/hooks/use-gmail-connections.d.ts.map +1 -0
- package/dist/hooks/use-gmail-connections.js +21 -0
- package/dist/hooks/use-gmail-messages.d.ts +2 -0
- package/dist/hooks/use-gmail-messages.d.ts.map +1 -0
- package/dist/hooks/use-gmail-messages.js +13 -0
- package/dist/hooks/use-gmail-signature.d.ts +2 -0
- package/dist/hooks/use-gmail-signature.d.ts.map +1 -0
- package/dist/hooks/use-gmail-signature.js +12 -0
- package/dist/hooks/use-gmail-thread-search-infinite.d.ts +2 -0
- package/dist/hooks/use-gmail-thread-search-infinite.d.ts.map +1 -0
- package/dist/hooks/use-gmail-thread-search-infinite.js +21 -0
- package/dist/hooks/use-gmail-thread-search.d.ts +2 -0
- package/dist/hooks/use-gmail-thread-search.d.ts.map +1 -0
- package/dist/hooks/use-gmail-thread-search.js +12 -0
- package/dist/hooks/use-gmail-threads-infinite.d.ts +5 -0
- package/dist/hooks/use-gmail-threads-infinite.d.ts.map +1 -0
- package/dist/hooks/use-gmail-threads-infinite.js +24 -0
- package/dist/hooks/use-gmail-threads.d.ts +7 -0
- package/dist/hooks/use-gmail-threads.d.ts.map +1 -0
- package/dist/hooks/use-gmail-threads.js +23 -0
- package/dist/hooks/use-inbox-badge-count.d.ts +6 -0
- package/dist/hooks/use-inbox-badge-count.d.ts.map +1 -0
- package/dist/hooks/use-inbox-badge-count.js +17 -0
- package/dist/hooks/use-inbox-thread-search.d.ts +2 -0
- package/dist/hooks/use-inbox-thread-search.d.ts.map +1 -0
- package/dist/hooks/use-inbox-thread-search.js +12 -0
- package/dist/hooks/use-inbox-threads-infinite.d.ts.map +1 -1
- package/dist/hooks/use-inbox-threads-infinite.js +1 -0
- package/dist/hooks/use-link-gmail-thread-contact.d.ts +7 -0
- package/dist/hooks/use-link-gmail-thread-contact.d.ts.map +1 -0
- package/dist/hooks/use-link-gmail-thread-contact.js +15 -0
- package/dist/hooks/use-manage-gmail-connection-members.d.ts +13 -0
- package/dist/hooks/use-manage-gmail-connection-members.d.ts.map +1 -0
- package/dist/hooks/use-manage-gmail-connection-members.js +25 -0
- package/dist/hooks/use-mark-inbox-thread-read.d.ts +3 -1
- package/dist/hooks/use-mark-inbox-thread-read.d.ts.map +1 -1
- package/dist/hooks/use-mark-inbox-thread-read.js +36 -14
- package/dist/hooks/use-mark-inbox-thread-unread.d.ts +3 -1
- package/dist/hooks/use-mark-inbox-thread-unread.d.ts.map +1 -1
- package/dist/hooks/use-mark-inbox-thread-unread.js +37 -14
- package/dist/hooks/use-me.d.ts.map +1 -1
- package/dist/hooks/use-me.js +2 -1
- package/dist/hooks/use-message-snippets.d.ts +1 -1
- package/dist/hooks/use-message-snippets.d.ts.map +1 -1
- package/dist/hooks/use-message-snippets.js +4 -3
- package/dist/hooks/use-missed-unseen-count.d.ts +8 -0
- package/dist/hooks/use-missed-unseen-count.d.ts.map +1 -0
- package/dist/hooks/use-missed-unseen-count.js +19 -0
- package/dist/hooks/use-patch-card.d.ts +15 -0
- package/dist/hooks/use-patch-card.d.ts.map +1 -0
- package/dist/hooks/use-patch-card.js +48 -0
- package/dist/hooks/use-phone-number.d.ts.map +1 -1
- package/dist/hooks/use-phone-number.js +2 -1
- package/dist/hooks/use-phone-numbers.d.ts.map +1 -1
- package/dist/hooks/use-phone-numbers.js +2 -1
- package/dist/hooks/use-send-gmail-message.d.ts +6 -0
- package/dist/hooks/use-send-gmail-message.d.ts.map +1 -0
- package/dist/hooks/use-send-gmail-message.js +21 -0
- package/dist/hooks/use-send-inbox-message.d.ts.map +1 -1
- package/dist/hooks/use-send-inbox-message.js +16 -13
- package/dist/hooks/use-tasks.d.ts +4 -0
- package/dist/hooks/use-tasks.d.ts.map +1 -1
- package/dist/hooks/use-tasks.js +14 -2
- package/dist/hooks/use-update-inbox-thread-status.d.ts +3 -1
- package/dist/hooks/use-update-inbox-thread-status.d.ts.map +1 -1
- package/dist/hooks/use-update-inbox-thread-status.js +36 -14
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/query-keys.d.ts +58 -0
- package/dist/query-keys.d.ts.map +1 -1
- package/dist/query-keys.js +50 -0
- package/dist/types.d.ts +370 -14
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/context.d.ts
CHANGED
|
@@ -10,12 +10,19 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
10
10
|
offset?: number;
|
|
11
11
|
status?: "potential" | "qualified" | "disqualified";
|
|
12
12
|
formId?: string;
|
|
13
|
+
formIds?: string[];
|
|
13
14
|
ownerIds?: string[];
|
|
15
|
+
setterIds?: string[];
|
|
14
16
|
pipelineIds?: string[];
|
|
15
17
|
search?: string;
|
|
16
18
|
sortBy?: "date" | "status" | "next_task";
|
|
17
19
|
sortOrder?: "asc" | "desc";
|
|
18
20
|
showArchivedOnly?: boolean;
|
|
21
|
+
allPipelines?: boolean;
|
|
22
|
+
taskType?: string;
|
|
23
|
+
dueDateFilter?: string;
|
|
24
|
+
dueDateTimezone?: string;
|
|
25
|
+
showCompletedOnly?: boolean;
|
|
19
26
|
}): Promise<import("./types").LeadSubmissionsResponse>;
|
|
20
27
|
getContactLeadSubmissions(contactId: string): Promise<import("./types").ContactLeadSubmissionsResponse>;
|
|
21
28
|
getContactMeetings(contactId: string): Promise<{
|
|
@@ -25,6 +32,7 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
25
32
|
getTasks(params?: {
|
|
26
33
|
status?: string;
|
|
27
34
|
related_card_id?: string;
|
|
35
|
+
contact_id?: string;
|
|
28
36
|
limit?: number;
|
|
29
37
|
offset?: number;
|
|
30
38
|
sort_by?: string;
|
|
@@ -32,6 +40,9 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
32
40
|
}): Promise<{
|
|
33
41
|
tasks: import("./types").TaskListItem[];
|
|
34
42
|
}>;
|
|
43
|
+
createTask(body: import("./types").CreateTaskInput): Promise<{
|
|
44
|
+
task: import("./types").TaskListItem;
|
|
45
|
+
}>;
|
|
35
46
|
postTaskOutcome(taskId: string, body: {
|
|
36
47
|
outcomeType: string;
|
|
37
48
|
notes?: string;
|
|
@@ -53,12 +64,28 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
53
64
|
getMeeting(meetingId: string): Promise<{
|
|
54
65
|
meeting: import("./types").Meeting;
|
|
55
66
|
}>;
|
|
56
|
-
|
|
67
|
+
getPipelineCards(pipelineId: string, params?: {
|
|
68
|
+
showArchivedOnly?: boolean;
|
|
69
|
+
}, opts?: {
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
}): Promise<import("./types").PipelineCardsResponse>;
|
|
72
|
+
getCard(pipelineId: string, cardId: string, opts?: {
|
|
73
|
+
signal?: AbortSignal;
|
|
74
|
+
}): Promise<{
|
|
57
75
|
card: import("./types").PipelineCard;
|
|
58
76
|
}>;
|
|
59
77
|
patchCard(pipelineId: string, cardId: string, body: Record<string, unknown>): Promise<{
|
|
60
78
|
card: import("./types").PipelineCard;
|
|
61
79
|
}>;
|
|
80
|
+
createCard(pipelineId: string, body: import("./types").CreateCardPayload): Promise<{
|
|
81
|
+
card: import("./types").PipelineCard;
|
|
82
|
+
message: string;
|
|
83
|
+
}>;
|
|
84
|
+
deleteCard(pipelineId: string, cardId: string, action?: "archive" | "delete"): Promise<{
|
|
85
|
+
success: boolean;
|
|
86
|
+
message: string;
|
|
87
|
+
card?: import("./types").PipelineCard;
|
|
88
|
+
}>;
|
|
62
89
|
getPostMeetingBookedPrompt(cardId: string, pipelineId: string): Promise<import("./types").PostMeetingBookedPromptResponse & {
|
|
63
90
|
scenario?: string | null;
|
|
64
91
|
}>;
|
|
@@ -140,13 +167,19 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
140
167
|
phone_number: import("./types").PhoneNumberRecord;
|
|
141
168
|
}>;
|
|
142
169
|
deletePhoneNumber(phoneNumberId: string): Promise<void>;
|
|
143
|
-
postVoiceToken(phoneNumberId: string): Promise<import("./types").VoiceTokenResponse>;
|
|
170
|
+
postVoiceToken(phoneNumberId: string, mode?: "incoming" | "outbound"): Promise<import("./types").VoiceTokenResponse>;
|
|
144
171
|
uploadInboxMedia(phoneNumberId: string, formData: FormData): Promise<import("./types").UploadInboxMediaResponse>;
|
|
145
172
|
getInboxThreads(phoneNumberId: string, params?: {
|
|
146
173
|
status?: "active" | "archived";
|
|
147
174
|
limit?: number;
|
|
148
175
|
cursor?: string;
|
|
176
|
+
contact_id?: string;
|
|
177
|
+
unread_only?: boolean;
|
|
149
178
|
}): Promise<import("./types").InboxThreadsResponse>;
|
|
179
|
+
searchInboxThreads(phoneNumberId: string, params: {
|
|
180
|
+
q: string;
|
|
181
|
+
limit?: number;
|
|
182
|
+
}): Promise<import("./types").InboxThreadSearchResponse>;
|
|
150
183
|
getInboxCalls(phoneNumberId: string, params?: {
|
|
151
184
|
limit?: number;
|
|
152
185
|
cursor?: string;
|
|
@@ -155,6 +188,9 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
155
188
|
getInboxThreadMessages(threadId: string): Promise<import("./types").InboxMessagesResponse>;
|
|
156
189
|
createInboxCall(payload: import("./types").CreateInboxCallPayload): Promise<import("./types").InboxCallEvent>;
|
|
157
190
|
getInboxCallRecordingUrl(callEventId: string): string;
|
|
191
|
+
getInboxBadgeCount(): Promise<import("./types").InboxBadgeCountResponse>;
|
|
192
|
+
getMissedUnseenCount(phoneNumberId: string): Promise<import("./types").MissedUnseenCountResponse>;
|
|
193
|
+
markCallsSeen(phoneNumberId: string): Promise<void>;
|
|
158
194
|
sendInboxMessage(phoneNumberId: string, body: import("./types").SendInboxMessagePayload): Promise<import("./types").SendInboxMessageResponse>;
|
|
159
195
|
markInboxThreadRead(threadId: string): Promise<{
|
|
160
196
|
ok: true;
|
|
@@ -184,7 +220,7 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
184
220
|
rating?: string;
|
|
185
221
|
lang?: string;
|
|
186
222
|
}): Promise<import("./types").InboxGifsResponse>;
|
|
187
|
-
getMessageSnippets(): Promise<import("./types").MessageSnippetsResponse>;
|
|
223
|
+
getMessageSnippets(channel?: "sms" | "email"): Promise<import("./types").MessageSnippetsResponse>;
|
|
188
224
|
createMessageSnippet(body: import("./types").CreateMessageSnippetPayload): Promise<{
|
|
189
225
|
snippet: import("./types").MessageSnippet;
|
|
190
226
|
}>;
|
|
@@ -194,6 +230,70 @@ export declare const ApiProvider: import("react").Provider<{
|
|
|
194
230
|
deleteMessageSnippet(id: string): Promise<{
|
|
195
231
|
ok: true;
|
|
196
232
|
}>;
|
|
233
|
+
createCheckoutSession(body: {
|
|
234
|
+
action: string;
|
|
235
|
+
priceKey?: string;
|
|
236
|
+
quantity?: number;
|
|
237
|
+
}): Promise<{
|
|
238
|
+
url: string;
|
|
239
|
+
}>;
|
|
240
|
+
createPortalSession(): Promise<{
|
|
241
|
+
url: string;
|
|
242
|
+
}>;
|
|
243
|
+
getBillingStatus(): Promise<{
|
|
244
|
+
billing: import("./types").MeOrganizationBilling;
|
|
245
|
+
}>;
|
|
246
|
+
toggleAutoTopUp(enabled: boolean): Promise<{
|
|
247
|
+
autoTopUpEnabled: boolean;
|
|
248
|
+
}>;
|
|
249
|
+
updateSeats(action: "add" | "remove"): Promise<import("./types").SeatUpdateResponse>;
|
|
250
|
+
registerPushToken(body: import("./types").RegisterPushTokenPayload): Promise<import("./types").RegisterPushTokenResponse>;
|
|
251
|
+
unregisterPushToken(apnsToken: string, platform?: "ios"): Promise<import("./types").UnregisterPushTokenResponse>;
|
|
252
|
+
connectGmail(connectionType?: "personal" | "shared"): Promise<{
|
|
253
|
+
authUrl: string;
|
|
254
|
+
}>;
|
|
255
|
+
getGmailConnections(): Promise<import("./types").GmailConnectionsResponse>;
|
|
256
|
+
disconnectGmail(connectionId: string): Promise<{
|
|
257
|
+
success: boolean;
|
|
258
|
+
}>;
|
|
259
|
+
getGmailThreads(connectionId: string, params?: {
|
|
260
|
+
status?: string;
|
|
261
|
+
page?: number;
|
|
262
|
+
page_size?: number;
|
|
263
|
+
unread_only?: boolean;
|
|
264
|
+
}): Promise<import("./types").GmailThreadsPageResponse>;
|
|
265
|
+
getGmailThreadMessages(connectionId: string, threadId: string): Promise<import("./types").InboxMessagesResponse>;
|
|
266
|
+
sendGmailMessage(connectionId: string, body: import("./types").SendGmailMessagePayload): Promise<import("./types").SendGmailMessageResponse>;
|
|
267
|
+
getGmailSignature(connectionId: string): Promise<import("./types").GmailSignatureResponse>;
|
|
268
|
+
putGmailThreadDraft(connectionId: string, threadId: string, body: string): Promise<{
|
|
269
|
+
ok: true;
|
|
270
|
+
}>;
|
|
271
|
+
linkGmailThreadContact(connectionId: string, threadId: string, body: import("./types").LinkGmailThreadContactPayload): Promise<import("./types").LinkGmailThreadContactResponse>;
|
|
272
|
+
searchGmailThreads(connectionId: string, params: {
|
|
273
|
+
q: string;
|
|
274
|
+
limit?: number;
|
|
275
|
+
cursor?: string;
|
|
276
|
+
}): Promise<import("./types").GmailThreadSearchResponse>;
|
|
277
|
+
triggerGmailSync(connectionId: string): Promise<{
|
|
278
|
+
ok: boolean;
|
|
279
|
+
}>;
|
|
280
|
+
getGmailConnectionMembers(connectionId: string): Promise<{
|
|
281
|
+
members: import("./types").GmailConnectionMember[];
|
|
282
|
+
}>;
|
|
283
|
+
addGmailConnectionMember(connectionId: string, userId: string): Promise<{
|
|
284
|
+
member: import("./types").GmailConnectionMember;
|
|
285
|
+
}>;
|
|
286
|
+
removeGmailConnectionMember(connectionId: string, userId: string): Promise<{
|
|
287
|
+
success: boolean;
|
|
288
|
+
}>;
|
|
289
|
+
createEmailDraft(connectionId: string, payload: import("./types").CreateEmailDraftPayload): Promise<import("./types").CreateEmailDraftResponse>;
|
|
290
|
+
updateEmailDraft(connectionId: string, draftId: string, payload: import("./types").UpdateEmailDraftPayload): Promise<{
|
|
291
|
+
ok: true;
|
|
292
|
+
}>;
|
|
293
|
+
getEmailDrafts(connectionId: string): Promise<import("./types").EmailDraftsListResponse>;
|
|
294
|
+
deleteEmailDraft(connectionId: string, draftId: string): Promise<{
|
|
295
|
+
ok: true;
|
|
296
|
+
}>;
|
|
197
297
|
} | null>;
|
|
198
298
|
export declare function useApiClient(): ApiClient;
|
|
199
299
|
//# sourceMappingURL=context.d.ts.map
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA;;GAEG;A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B,CAAC;cAAqB,CAAC;YAAmB,CAAC;;;aAA+nB,CAAC;cAAuB,CAAC;cAAuB,CAAC;YAAqB,CAAC;;;;;;;;;;;;;;gBAA0vE,CAAC;gBAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;cAAgsG,CAAC;YAAc,CAAC;iBAAmB,CAAC;mBAAqB,CAAC;;;;;;;;;;;aAAisE,CAAC;cAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;SAT7rqC,CAAA;AAE9C,wBAAgB,YAAY,IAAI,SAAS,CAMxC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { GetLeadSubmissionsParams } from './use-leads';
|
|
|
3
3
|
export { useContactLeadSubmissions } from './use-contact-lead-submissions';
|
|
4
4
|
export { useContactMeetings } from './use-contact-meetings';
|
|
5
5
|
export { useContactCalls } from './use-contact-calls';
|
|
6
|
-
export { useTasks } from './use-tasks';
|
|
6
|
+
export { useTasks, useCreateTask } from './use-tasks';
|
|
7
7
|
export type { GetTasksParams } from './use-tasks';
|
|
8
8
|
export { useMeetings } from './use-meetings';
|
|
9
9
|
export type { GetMeetingsParams } from './use-meetings';
|
|
@@ -28,5 +28,28 @@ export { useMarkInboxThreadRead } from './use-mark-inbox-thread-read';
|
|
|
28
28
|
export { useMarkInboxThreadUnread } from './use-mark-inbox-thread-unread';
|
|
29
29
|
export { useUpdateInboxThreadStatus } from './use-update-inbox-thread-status';
|
|
30
30
|
export { useDeleteInboxThread } from './use-delete-inbox-thread';
|
|
31
|
+
export { useInboxBadgeCount } from './use-inbox-badge-count';
|
|
32
|
+
export { useMissedUnseenCount } from './use-missed-unseen-count';
|
|
31
33
|
export { useMessageSnippets } from './use-message-snippets';
|
|
34
|
+
export { useCard } from './use-card';
|
|
35
|
+
export { useCards } from './use-cards';
|
|
36
|
+
export type { UseCardsParams } from './use-cards';
|
|
37
|
+
export { usePatchCard } from './use-patch-card';
|
|
38
|
+
export type { PatchCardVariables } from './use-patch-card';
|
|
39
|
+
export { useCreateCard } from './use-create-card';
|
|
40
|
+
export type { CreateCardVariables } from './use-create-card';
|
|
41
|
+
export { useDeleteCard } from './use-delete-card';
|
|
42
|
+
export type { DeleteCardVariables } from './use-delete-card';
|
|
43
|
+
export { useBillingStatus } from './use-billing-status';
|
|
44
|
+
export { useGmailConnections, useTriggerGmailSync } from './use-gmail-connections';
|
|
45
|
+
export { useGmailThreads } from './use-gmail-threads';
|
|
46
|
+
export { useGmailMessages } from './use-gmail-messages';
|
|
47
|
+
export { useSendGmailMessage } from './use-send-gmail-message';
|
|
48
|
+
export { useLinkGmailThreadContact } from './use-link-gmail-thread-contact';
|
|
49
|
+
export { useGmailThreadSearchInfinite } from './use-gmail-thread-search-infinite';
|
|
50
|
+
export { useInboxThreadSearch } from './use-inbox-thread-search';
|
|
51
|
+
export { useGmailConnectionMembers } from './use-gmail-connection-members';
|
|
52
|
+
export { useGmailSignature } from './use-gmail-signature';
|
|
53
|
+
export { useAddGmailConnectionMember, useRemoveGmailConnectionMember } from './use-manage-gmail-connection-members';
|
|
54
|
+
export { useEmailDrafts, useCreateEmailDraft, useUpdateEmailDraft, useDeleteEmailDraft } from './use-email-drafts';
|
|
32
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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AAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAA;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAA;AACnH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -2,7 +2,7 @@ export { useLeads } from './use-leads';
|
|
|
2
2
|
export { useContactLeadSubmissions } from './use-contact-lead-submissions';
|
|
3
3
|
export { useContactMeetings } from './use-contact-meetings';
|
|
4
4
|
export { useContactCalls } from './use-contact-calls';
|
|
5
|
-
export { useTasks } from './use-tasks';
|
|
5
|
+
export { useTasks, useCreateTask } from './use-tasks';
|
|
6
6
|
export { useMeetings } from './use-meetings';
|
|
7
7
|
export { usePipelines } from './use-pipelines';
|
|
8
8
|
export { useStages } from './use-stages';
|
|
@@ -20,4 +20,23 @@ export { useMarkInboxThreadRead } from './use-mark-inbox-thread-read';
|
|
|
20
20
|
export { useMarkInboxThreadUnread } from './use-mark-inbox-thread-unread';
|
|
21
21
|
export { useUpdateInboxThreadStatus } from './use-update-inbox-thread-status';
|
|
22
22
|
export { useDeleteInboxThread } from './use-delete-inbox-thread';
|
|
23
|
+
export { useInboxBadgeCount } from './use-inbox-badge-count';
|
|
24
|
+
export { useMissedUnseenCount } from './use-missed-unseen-count';
|
|
23
25
|
export { useMessageSnippets } from './use-message-snippets';
|
|
26
|
+
export { useCard } from './use-card';
|
|
27
|
+
export { useCards } from './use-cards';
|
|
28
|
+
export { usePatchCard } from './use-patch-card';
|
|
29
|
+
export { useCreateCard } from './use-create-card';
|
|
30
|
+
export { useDeleteCard } from './use-delete-card';
|
|
31
|
+
export { useBillingStatus } from './use-billing-status';
|
|
32
|
+
export { useGmailConnections, useTriggerGmailSync } from './use-gmail-connections';
|
|
33
|
+
export { useGmailThreads } from './use-gmail-threads';
|
|
34
|
+
export { useGmailMessages } from './use-gmail-messages';
|
|
35
|
+
export { useSendGmailMessage } from './use-send-gmail-message';
|
|
36
|
+
export { useLinkGmailThreadContact } from './use-link-gmail-thread-contact';
|
|
37
|
+
export { useGmailThreadSearchInfinite } from './use-gmail-thread-search-infinite';
|
|
38
|
+
export { useInboxThreadSearch } from './use-inbox-thread-search';
|
|
39
|
+
export { useGmailConnectionMembers } from './use-gmail-connection-members';
|
|
40
|
+
export { useGmailSignature } from './use-gmail-signature';
|
|
41
|
+
export { useAddGmailConnectionMember, useRemoveGmailConnectionMember } from './use-manage-gmail-connection-members';
|
|
42
|
+
export { useEmailDrafts, useCreateEmailDraft, useUpdateEmailDraft, useDeleteEmailDraft } from './use-email-drafts';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MeOrganizationBilling } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Billing status derived from the /api/me response.
|
|
4
|
+
* Avoids an extra network request by extracting billing from the existing `useMe` query.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useBillingStatus(): import("@tanstack/react-query").DefinedUseQueryResult<MeOrganizationBilling | null, Error>;
|
|
7
|
+
//# sourceMappingURL=use-billing-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-billing-status.d.ts","sourceRoot":"","sources":["../../src/hooks/use-billing-status.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAErD;;;GAGG;AACH,wBAAgB,gBAAgB,+FAY/B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useMe } from './use-me';
|
|
3
|
+
/**
|
|
4
|
+
* Billing status derived from the /api/me response.
|
|
5
|
+
* Avoids an extra network request by extracting billing from the existing `useMe` query.
|
|
6
|
+
*/
|
|
7
|
+
export function useBillingStatus() {
|
|
8
|
+
const { data: meData, isLoading: meLoading, error: meError } = useMe();
|
|
9
|
+
const billing = meData?.organization?.billing ?? null;
|
|
10
|
+
return useQuery({
|
|
11
|
+
queryKey: ['billing-status'],
|
|
12
|
+
queryFn: () => billing,
|
|
13
|
+
enabled: !meLoading && !meError,
|
|
14
|
+
initialData: billing,
|
|
15
|
+
staleTime: 30000,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-card.d.ts","sourceRoot":"","sources":["../../src/hooks/use-card.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,oFASvE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../context';
|
|
3
|
+
import { cardKeys } from '../query-keys';
|
|
4
|
+
export function useCard(cardId, pipelineId) {
|
|
5
|
+
const client = useApiClient();
|
|
6
|
+
return useQuery({
|
|
7
|
+
queryKey: cardKeys.detail(cardId),
|
|
8
|
+
queryFn: ({ signal }) => client.getCard(pipelineId, cardId, { signal }).then((r) => r.card),
|
|
9
|
+
enabled: !!cardId && !!pipelineId,
|
|
10
|
+
staleTime: 30000,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface UseCardsParams {
|
|
2
|
+
showArchivedOnly?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function useCards(pipelineId: string | null, params?: UseCardsParams): import("@tanstack/react-query").UseQueryResult<import("..").PipelineCardsResponse, Error>;
|
|
5
|
+
//# sourceMappingURL=use-cards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cards.d.ts","sourceRoot":"","sources":["../../src/hooks/use-cards.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,cAAc;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,cAAc,6FAQ1E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../context';
|
|
3
|
+
import { cardKeys } from '../query-keys';
|
|
4
|
+
export function useCards(pipelineId, params) {
|
|
5
|
+
const client = useApiClient();
|
|
6
|
+
return useQuery({
|
|
7
|
+
queryKey: cardKeys.list(pipelineId, params),
|
|
8
|
+
queryFn: ({ signal }) => client.getPipelineCards(pipelineId, params, { signal }),
|
|
9
|
+
enabled: !!pipelineId,
|
|
10
|
+
staleTime: 30000,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CreateCardPayload } from '../types';
|
|
2
|
+
export interface CreateCardVariables {
|
|
3
|
+
pipelineId: string;
|
|
4
|
+
body: CreateCardPayload;
|
|
5
|
+
}
|
|
6
|
+
export declare function useCreateCard(): import("@tanstack/react-query").UseMutationResult<{
|
|
7
|
+
card: import("..").PipelineCard;
|
|
8
|
+
message: string;
|
|
9
|
+
}, Error, CreateCardVariables, unknown>;
|
|
10
|
+
//# sourceMappingURL=use-create-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-create-card.d.ts","sourceRoot":"","sources":["../../src/hooks/use-create-card.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,iBAAiB,CAAA;CACxB;AAED,wBAAgB,aAAa;;;wCAY5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../context';
|
|
3
|
+
import { cardKeys } from '../query-keys';
|
|
4
|
+
export function useCreateCard() {
|
|
5
|
+
const client = useApiClient();
|
|
6
|
+
const queryClient = useQueryClient();
|
|
7
|
+
return useMutation({
|
|
8
|
+
mutationFn: ({ pipelineId, body }) => client.createCard(pipelineId, body),
|
|
9
|
+
onSuccess: (_data, { pipelineId }) => {
|
|
10
|
+
queryClient.invalidateQueries({ queryKey: cardKeys.list(pipelineId) });
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PipelineCard, PipelineCardsResponse } from '../types';
|
|
2
|
+
export interface DeleteCardVariables {
|
|
3
|
+
pipelineId: string;
|
|
4
|
+
cardId: string;
|
|
5
|
+
action?: 'archive' | 'delete';
|
|
6
|
+
}
|
|
7
|
+
export declare function useDeleteCard(): import("@tanstack/react-query").UseMutationResult<{
|
|
8
|
+
success: boolean;
|
|
9
|
+
message: string;
|
|
10
|
+
card?: PipelineCard;
|
|
11
|
+
}, Error, DeleteCardVariables, {
|
|
12
|
+
previousCard: PipelineCard | undefined;
|
|
13
|
+
previousLists: [readonly unknown[], PipelineCardsResponse | undefined][];
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=use-delete-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-delete-card.d.ts","sourceRoot":"","sources":["../../src/hooks/use-delete-card.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEnE,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CAC9B;AAED,wBAAgB,aAAa;;;;;;;GA+C5B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../context';
|
|
3
|
+
import { cardKeys } from '../query-keys';
|
|
4
|
+
export function useDeleteCard() {
|
|
5
|
+
const client = useApiClient();
|
|
6
|
+
const queryClient = useQueryClient();
|
|
7
|
+
return useMutation({
|
|
8
|
+
mutationFn: ({ pipelineId, cardId, action = 'archive' }) => client.deleteCard(pipelineId, cardId, action),
|
|
9
|
+
onMutate: async ({ cardId }) => {
|
|
10
|
+
await queryClient.cancelQueries({ queryKey: cardKeys.detail(cardId) });
|
|
11
|
+
await queryClient.cancelQueries({ queryKey: cardKeys.lists() });
|
|
12
|
+
const previousCard = queryClient.getQueryData(cardKeys.detail(cardId));
|
|
13
|
+
const previousLists = queryClient.getQueriesData({
|
|
14
|
+
queryKey: cardKeys.lists(),
|
|
15
|
+
});
|
|
16
|
+
queryClient.removeQueries({ queryKey: cardKeys.detail(cardId) });
|
|
17
|
+
queryClient.setQueriesData({ queryKey: cardKeys.lists() }, (old) => {
|
|
18
|
+
if (!old?.cards)
|
|
19
|
+
return old;
|
|
20
|
+
return { ...old, cards: old.cards.filter((card) => card.id !== cardId) };
|
|
21
|
+
});
|
|
22
|
+
return { previousCard, previousLists };
|
|
23
|
+
},
|
|
24
|
+
onError: (_err, { cardId }, context) => {
|
|
25
|
+
if (context?.previousCard) {
|
|
26
|
+
queryClient.setQueryData(cardKeys.detail(cardId), context.previousCard);
|
|
27
|
+
}
|
|
28
|
+
if (context?.previousLists) {
|
|
29
|
+
context.previousLists.forEach(([queryKey, data]) => {
|
|
30
|
+
queryClient.setQueryData(queryKey, data);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
onSuccess: (_data, { pipelineId }) => {
|
|
35
|
+
queryClient.invalidateQueries({ queryKey: cardKeys.list(pipelineId) });
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CreateEmailDraftPayload, UpdateEmailDraftPayload, EmailDraft } from '../types';
|
|
2
|
+
/** Fetch all standalone drafts for a Gmail connection. */
|
|
3
|
+
export declare function useEmailDrafts(connectionId: string | undefined): import("@tanstack/react-query").UseQueryResult<import("..").EmailDraftsListResponse, Error>;
|
|
4
|
+
/** Create a standalone email draft. */
|
|
5
|
+
export declare function useCreateEmailDraft(): import("@tanstack/react-query").UseMutationResult<import("..").CreateEmailDraftResponse, Error, {
|
|
6
|
+
connectionId: string;
|
|
7
|
+
payload: CreateEmailDraftPayload;
|
|
8
|
+
}, unknown>;
|
|
9
|
+
/** Update a standalone email draft (optimistic). */
|
|
10
|
+
export declare function useUpdateEmailDraft(): import("@tanstack/react-query").UseMutationResult<{
|
|
11
|
+
ok: true;
|
|
12
|
+
}, Error, {
|
|
13
|
+
connectionId: string;
|
|
14
|
+
draftId: string;
|
|
15
|
+
payload: UpdateEmailDraftPayload;
|
|
16
|
+
}, {
|
|
17
|
+
previous: {
|
|
18
|
+
drafts: EmailDraft[];
|
|
19
|
+
} | undefined;
|
|
20
|
+
}>;
|
|
21
|
+
/** Delete a standalone email draft (optimistic removal). */
|
|
22
|
+
export declare function useDeleteEmailDraft(): import("@tanstack/react-query").UseMutationResult<{
|
|
23
|
+
ok: true;
|
|
24
|
+
}, Error, {
|
|
25
|
+
connectionId: string;
|
|
26
|
+
draftId: string;
|
|
27
|
+
}, {
|
|
28
|
+
previous: {
|
|
29
|
+
drafts: EmailDraft[];
|
|
30
|
+
} | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
//# sourceMappingURL=use-email-drafts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-email-drafts.d.ts","sourceRoot":"","sources":["../../src/hooks/use-email-drafts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACvB,UAAU,EACX,MAAM,UAAU,CAAA;AAEjB,0DAA0D;AAC1D,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,+FAS9D;AAED,uCAAuC;AACvC,wBAAgB,mBAAmB;kBASf,MAAM;aACX,uBAAuB;YAQrC;AAED,oDAAoD;AACpD,wBAAgB,mBAAmB;;;kBAUf,MAAM;aACX,MAAM;aACN,uBAAuB;;;gBAKoB,UAAU,EAAE;;GAmCrE;AAED,4DAA4D;AAC5D,wBAAgB,mBAAmB;;;kBASf,MAAM;aACX,MAAM;;;gBAKqC,UAAU,EAAE;;GAuBrE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../context';
|
|
3
|
+
import { gmailKeys } from '../query-keys';
|
|
4
|
+
/** Fetch all standalone drafts for a Gmail connection. */
|
|
5
|
+
export function useEmailDrafts(connectionId) {
|
|
6
|
+
const client = useApiClient();
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: gmailKeys.drafts(connectionId ?? ''),
|
|
9
|
+
queryFn: () => client.getEmailDrafts(connectionId),
|
|
10
|
+
enabled: Boolean(connectionId),
|
|
11
|
+
staleTime: 30000,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/** Create a standalone email draft. */
|
|
15
|
+
export function useCreateEmailDraft() {
|
|
16
|
+
const client = useApiClient();
|
|
17
|
+
const queryClient = useQueryClient();
|
|
18
|
+
return useMutation({
|
|
19
|
+
mutationFn: ({ connectionId, payload, }) => client.createEmailDraft(connectionId, payload),
|
|
20
|
+
onSuccess: (_data, variables) => {
|
|
21
|
+
queryClient.invalidateQueries({
|
|
22
|
+
queryKey: gmailKeys.drafts(variables.connectionId),
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** Update a standalone email draft (optimistic). */
|
|
28
|
+
export function useUpdateEmailDraft() {
|
|
29
|
+
const client = useApiClient();
|
|
30
|
+
const queryClient = useQueryClient();
|
|
31
|
+
return useMutation({
|
|
32
|
+
mutationFn: ({ connectionId, draftId, payload, }) => client.updateEmailDraft(connectionId, draftId, payload),
|
|
33
|
+
onMutate: async (variables) => {
|
|
34
|
+
const key = gmailKeys.drafts(variables.connectionId);
|
|
35
|
+
await queryClient.cancelQueries({ queryKey: key });
|
|
36
|
+
const previous = queryClient.getQueryData(key);
|
|
37
|
+
queryClient.setQueryData(key, (old) => {
|
|
38
|
+
if (!old)
|
|
39
|
+
return old;
|
|
40
|
+
return {
|
|
41
|
+
drafts: old.drafts.map((d) => d.id === variables.draftId
|
|
42
|
+
? {
|
|
43
|
+
...d,
|
|
44
|
+
...(variables.payload.to !== undefined && { to_addresses: variables.payload.to }),
|
|
45
|
+
...(variables.payload.cc !== undefined && { cc_addresses: variables.payload.cc }),
|
|
46
|
+
...(variables.payload.bcc !== undefined && { bcc_addresses: variables.payload.bcc }),
|
|
47
|
+
...(variables.payload.subject !== undefined && { subject: variables.payload.subject }),
|
|
48
|
+
...(variables.payload.html_body !== undefined && { html_body: variables.payload.html_body }),
|
|
49
|
+
updated_at: new Date().toISOString(),
|
|
50
|
+
}
|
|
51
|
+
: d),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
return { previous };
|
|
55
|
+
},
|
|
56
|
+
onError: (_err, variables, context) => {
|
|
57
|
+
if (context?.previous) {
|
|
58
|
+
queryClient.setQueryData(gmailKeys.drafts(variables.connectionId), context.previous);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
onSettled: (_data, _error, variables) => {
|
|
62
|
+
queryClient.invalidateQueries({
|
|
63
|
+
queryKey: gmailKeys.drafts(variables.connectionId),
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** Delete a standalone email draft (optimistic removal). */
|
|
69
|
+
export function useDeleteEmailDraft() {
|
|
70
|
+
const client = useApiClient();
|
|
71
|
+
const queryClient = useQueryClient();
|
|
72
|
+
return useMutation({
|
|
73
|
+
mutationFn: ({ connectionId, draftId, }) => client.deleteEmailDraft(connectionId, draftId),
|
|
74
|
+
onMutate: async (variables) => {
|
|
75
|
+
const key = gmailKeys.drafts(variables.connectionId);
|
|
76
|
+
await queryClient.cancelQueries({ queryKey: key });
|
|
77
|
+
const previous = queryClient.getQueryData(key);
|
|
78
|
+
queryClient.setQueryData(key, (old) => {
|
|
79
|
+
if (!old)
|
|
80
|
+
return old;
|
|
81
|
+
return {
|
|
82
|
+
drafts: old.drafts.filter((d) => d.id !== variables.draftId),
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
return { previous };
|
|
86
|
+
},
|
|
87
|
+
onError: (_err, variables, context) => {
|
|
88
|
+
if (context?.previous) {
|
|
89
|
+
queryClient.setQueryData(gmailKeys.drafts(variables.connectionId), context.previous);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
onSettled: (_data, _error, variables) => {
|
|
93
|
+
queryClient.invalidateQueries({
|
|
94
|
+
queryKey: gmailKeys.drafts(variables.connectionId),
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-gmail-connection-members.d.ts","sourceRoot":"","sources":["../../src/hooks/use-gmail-connection-members.ts"],"names":[],"mappings":"AAIA,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,+FAUpE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../context';
|
|
3
|
+
import { gmailKeys } from '../query-keys';
|
|
4
|
+
export function useGmailConnectionMembers(connectionId) {
|
|
5
|
+
const client = useApiClient();
|
|
6
|
+
return useQuery({
|
|
7
|
+
queryKey: gmailKeys.members(connectionId ?? ''),
|
|
8
|
+
queryFn: () => client.getGmailConnectionMembers(connectionId),
|
|
9
|
+
enabled: !!connectionId,
|
|
10
|
+
staleTime: 5 * 60 * 1000,
|
|
11
|
+
select: (data) => data.members,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useGmailConnections(): import("@tanstack/react-query").UseQueryResult<import("..").GmailConnectionsResponse, Error>;
|
|
2
|
+
export declare function useTriggerGmailSync(): import("@tanstack/react-query").UseMutationResult<{
|
|
3
|
+
ok: boolean;
|
|
4
|
+
}, Error, string, unknown>;
|
|
5
|
+
//# sourceMappingURL=use-gmail-connections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-gmail-connections.d.ts","sourceRoot":"","sources":["../../src/hooks/use-gmail-connections.ts"],"names":[],"mappings":"AAIA,wBAAgB,mBAAmB,iGAOlC;AAED,wBAAgB,mBAAmB;;2BAUlC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { useApiClient } from '../context';
|
|
3
|
+
import { gmailKeys } from '../query-keys';
|
|
4
|
+
export function useGmailConnections() {
|
|
5
|
+
const client = useApiClient();
|
|
6
|
+
return useQuery({
|
|
7
|
+
queryKey: gmailKeys.connections(),
|
|
8
|
+
queryFn: () => client.getGmailConnections(),
|
|
9
|
+
staleTime: 30000,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export function useTriggerGmailSync() {
|
|
13
|
+
const client = useApiClient();
|
|
14
|
+
const queryClient = useQueryClient();
|
|
15
|
+
return useMutation({
|
|
16
|
+
mutationFn: (connectionId) => client.triggerGmailSync(connectionId),
|
|
17
|
+
onSuccess: () => {
|
|
18
|
+
queryClient.invalidateQueries({ queryKey: gmailKeys.connections() });
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-gmail-messages.d.ts","sourceRoot":"","sources":["../../src/hooks/use-gmail-messages.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,QAAQ,EAAE,MAAM,GAAG,SAAS,6FAU7B"}
|