@go-avro/avro-js 0.0.6 → 0.0.8-beta.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.
|
@@ -164,6 +164,15 @@ declare module '../client/QueryClient' {
|
|
|
164
164
|
payment_option_id: string;
|
|
165
165
|
}[];
|
|
166
166
|
}>>;
|
|
167
|
+
useCreateMessage(chatId: string, body: {
|
|
168
|
+
content: string;
|
|
169
|
+
sent_at?: number;
|
|
170
|
+
}): ReturnType<typeof useMutation<{
|
|
171
|
+
id: string;
|
|
172
|
+
}, StandardError, {
|
|
173
|
+
content: string;
|
|
174
|
+
sent_at?: number;
|
|
175
|
+
}>>;
|
|
167
176
|
useCreateProposal(): ReturnType<typeof useMutation<{
|
|
168
177
|
id: string;
|
|
169
178
|
}, StandardError, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useInfiniteQuery } from "@tanstack/react-query";
|
|
1
|
+
import { useInfiniteQuery, useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { AvroQueryClient } from "../../client/QueryClient";
|
|
3
3
|
AvroQueryClient.prototype.useGetMessages = function (chatId, body) {
|
|
4
4
|
const queryClient = this.getQueryClient();
|
|
@@ -28,3 +28,21 @@ AvroQueryClient.prototype.useGetMessages = function (chatId, body) {
|
|
|
28
28
|
}
|
|
29
29
|
return result;
|
|
30
30
|
};
|
|
31
|
+
AvroQueryClient.prototype.useCreateMessage = function (chatId, body) {
|
|
32
|
+
const queryClient = this.getQueryClient();
|
|
33
|
+
return useMutation({
|
|
34
|
+
mutationFn: async ({ content, sent_at } = body) => {
|
|
35
|
+
const message = await this.post(`/chat/${chatId}/message`, {
|
|
36
|
+
message: {
|
|
37
|
+
content,
|
|
38
|
+
sent_at: sent_at ?? Math.floor(Date.now() / 1000),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
return message;
|
|
42
|
+
},
|
|
43
|
+
onMutate: (message) => {
|
|
44
|
+
queryClient.setQueryData(['message', message.id], message);
|
|
45
|
+
queryClient.invalidateQueries({ queryKey: ['messages', chatId] });
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
};
|
package/dist/types/api/Bill.d.ts
CHANGED
|
@@ -2,6 +2,13 @@ import { BillPayment } from "../../types/api/BillPayment";
|
|
|
2
2
|
import { BillUser } from "../../types/api/BillUser";
|
|
3
3
|
import { CustomLineItem } from "../../types/api/CustomLineItem";
|
|
4
4
|
import { PaymentType } from "../../types/api/PaymentType";
|
|
5
|
+
export declare const BillStatus: {
|
|
6
|
+
readonly SENT: "SENT";
|
|
7
|
+
readonly PAID: "PAID";
|
|
8
|
+
readonly PARTIALLY_PAID: "PARTIALLY_PAID";
|
|
9
|
+
readonly MANUALLY_PAID: "MANUALLY_PAID";
|
|
10
|
+
};
|
|
11
|
+
export type BillStatus = typeof BillStatus[keyof typeof BillStatus];
|
|
5
12
|
export interface Bill {
|
|
6
13
|
id: string;
|
|
7
14
|
invoice_id: number;
|
|
@@ -12,7 +19,7 @@ export interface Bill {
|
|
|
12
19
|
customer_email: string | null;
|
|
13
20
|
manual_emails: string[][];
|
|
14
21
|
users: BillUser[];
|
|
15
|
-
status:
|
|
22
|
+
status: BillStatus;
|
|
16
23
|
enabled_payment_methods: PaymentType[];
|
|
17
24
|
time_created: number;
|
|
18
25
|
time_updated: number;
|
package/dist/types/api/Bill.js
CHANGED