@go-avro/avro-js 0.1.8 → 0.1.9

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.
@@ -7,6 +7,7 @@ import { CancelToken, ClientId, RetryStrategy } from '../types/client.js';
7
7
  import { StandardError } from '../types/error.js';
8
8
  import { CacheData } from '../types/cache.js';
9
9
  import { Waiver } from '../types/api/Waiver.js';
10
+ import { ProposalTerms } from '../types/api/ProposalTerms.js';
10
11
  import type { EmailSucceededPayload, EmailFailedPayload, EmailType } from '../types/api/EmailNotification.js';
11
12
  import type { BulkDeleteBillsResponse, BulkEmailBillsResponse } from './hooks/bills.js';
12
13
  import { type QueryPersistOptions } from './persist.js';
@@ -189,6 +190,23 @@ declare module './QueryClient.js' {
189
190
  msg: string;
190
191
  }>;
191
192
  useGetProposal(proposal_id: string): UseQueryResult<any, StandardError>;
193
+ useGetProposalTerms(): UseQueryResult<ProposalTerms[], StandardError>;
194
+ useCreateProposalTerms(): ReturnType<typeof useMutation<{
195
+ id: string;
196
+ }, StandardError, {
197
+ name: string;
198
+ body: string;
199
+ }>>;
200
+ useUpdateProposalTerms(): ReturnType<typeof useMutation<{
201
+ msg: string;
202
+ }, StandardError, {
203
+ termsId: string;
204
+ updates: {
205
+ name?: string;
206
+ body?: string;
207
+ archived?: boolean;
208
+ };
209
+ }>>;
192
210
  useAutocompleteAddress(address: string, options?: {
193
211
  size?: number;
194
212
  minLength?: number;
@@ -267,6 +285,7 @@ declare module './QueryClient.js' {
267
285
  status: string;
268
286
  payment_option_id: string;
269
287
  }[];
288
+ terms_version_id?: string;
270
289
  }>>;
271
290
  useCreateMessage(chatId: string): ReturnType<typeof useMutation<{
272
291
  id: string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,38 @@
1
+ import { useMutation, useQuery } from '@tanstack/react-query';
2
+ import { AvroQueryClient } from '../QueryClient.js';
3
+ import { keys } from '../realtime.js';
4
+ AvroQueryClient.prototype.useGetProposalTerms = function () {
5
+ return useQuery({
6
+ queryKey: keys.list('proposal_terms', this.companyId),
7
+ queryFn: () => this.get({ path: `/company/${this.companyId}/proposal_terms` }),
8
+ enabled: Boolean(this.companyId),
9
+ });
10
+ };
11
+ AvroQueryClient.prototype.useCreateProposalTerms = function () {
12
+ return useMutation({
13
+ mutationFn: async (data) => {
14
+ return this.post({
15
+ path: `/company/${this.companyId}/proposal_terms`,
16
+ data: JSON.stringify(data),
17
+ headers: { 'Content-Type': 'application/json' },
18
+ });
19
+ },
20
+ onSuccess: () => {
21
+ this.syncAfterMutation('proposal_terms');
22
+ },
23
+ });
24
+ };
25
+ AvroQueryClient.prototype.useUpdateProposalTerms = function () {
26
+ return useMutation({
27
+ mutationFn: async ({ termsId, updates, }) => {
28
+ return this.put({
29
+ path: `/proposal_terms/${termsId}`,
30
+ data: JSON.stringify(updates),
31
+ headers: { 'Content-Type': 'application/json' },
32
+ });
33
+ },
34
+ onSuccess: () => {
35
+ this.syncAfterMutation('proposal_terms');
36
+ },
37
+ });
38
+ };
@@ -198,6 +198,10 @@ export const REGISTRY = {
198
198
  fetchOne: (client, id) => client.get({ path: `/proposal/${id}` }),
199
199
  alsoInvalidate: [['tasks']],
200
200
  },
201
+ proposal_terms: {
202
+ ns: 'proposal_terms',
203
+ fetchOne: (client, id) => client.get({ path: `/proposal_terms/${id}` }),
204
+ },
201
205
  month: { ns: 'months', fetchMany: bulk('fetchMonths'), listMatch: matchLineItems },
202
206
  prepayment: {
203
207
  ns: 'prepayments',
package/dist/index.d.ts CHANGED
@@ -36,6 +36,7 @@ import './client/hooks/labels.js';
36
36
  import './client/hooks/groups.js';
37
37
  import './client/hooks/skills.js';
38
38
  import './client/hooks/proposal.js';
39
+ import './client/hooks/proposal_terms.js';
39
40
  import './client/hooks/timecards.js';
40
41
  import './client/hooks/waivers.js';
41
42
  import './client/hooks/email.js';
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ import './client/hooks/labels.js';
33
33
  import './client/hooks/groups.js';
34
34
  import './client/hooks/skills.js';
35
35
  import './client/hooks/proposal.js';
36
+ import './client/hooks/proposal_terms.js';
36
37
  import './client/hooks/timecards.js';
37
38
  import './client/hooks/waivers.js';
38
39
  import './client/hooks/email.js';
@@ -0,0 +1,17 @@
1
+ export interface ProposalTermsVersion {
2
+ id: string;
3
+ terms_id: string;
4
+ name: string;
5
+ version: number;
6
+ body: string;
7
+ time_created: number | null;
8
+ }
9
+ export interface ProposalTerms {
10
+ id: string;
11
+ company_id: string;
12
+ name: string;
13
+ archived: boolean;
14
+ current_version: ProposalTermsVersion | null;
15
+ time_created: number | null;
16
+ time_updated: number | null;
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -35,6 +35,7 @@ export * from './api/Plan.js';
35
35
  export * from './api/PlanPayment.js';
36
36
  export * from './api/Prepayment.js';
37
37
  export * from './api/ProcessingFeeLineItem.js';
38
+ export * from './api/ProposalTerms.js';
38
39
  export * from './api/Reaction.js';
39
40
  export * from './api/Route.js';
40
41
  export * from './api/RouteJob.js';
package/dist/types/api.js CHANGED
@@ -32,6 +32,7 @@ export * from './api/Plan.js';
32
32
  export * from './api/PlanPayment.js';
33
33
  export * from './api/Prepayment.js';
34
34
  export * from './api/ProcessingFeeLineItem.js';
35
+ export * from './api/ProposalTerms.js';
35
36
  export * from './api/Reaction.js';
36
37
  export * from './api/Route.js';
37
38
  export * from './api/RouteJob.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AVRO_JS_VERSION = "0.1.8";
1
+ export declare const AVRO_JS_VERSION = "0.1.9";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
2
2
  // Regenerated from package.json by the `prebuild` npm hook.
3
- export const AVRO_JS_VERSION = '0.1.8';
3
+ export const AVRO_JS_VERSION = '0.1.9';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",