@voyantjs/transactions-react 0.2.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.
@@ -0,0 +1,249 @@
1
+ import { z } from "zod";
2
+ export declare const paginatedEnvelope: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
3
+ data: z.ZodArray<T>;
4
+ total: z.ZodNumber;
5
+ limit: z.ZodNumber;
6
+ offset: z.ZodNumber;
7
+ }, z.core.$strip>;
8
+ export declare const singleEnvelope: <T extends z.ZodTypeAny>(item: T) => z.ZodObject<{
9
+ data: T;
10
+ }, z.core.$strip>;
11
+ export declare const successEnvelope: z.ZodObject<{
12
+ success: z.ZodBoolean;
13
+ }, z.core.$strip>;
14
+ export declare const offerRecordSchema: z.ZodObject<{
15
+ offerNumber: z.ZodString;
16
+ title: z.ZodString;
17
+ status: z.ZodDefault<z.ZodEnum<{
18
+ draft: "draft";
19
+ published: "published";
20
+ sent: "sent";
21
+ accepted: "accepted";
22
+ expired: "expired";
23
+ withdrawn: "withdrawn";
24
+ converted: "converted";
25
+ }>>;
26
+ currency: z.ZodString;
27
+ id: z.ZodString;
28
+ personId: z.ZodNullable<z.ZodString>;
29
+ organizationId: z.ZodNullable<z.ZodString>;
30
+ opportunityId: z.ZodNullable<z.ZodString>;
31
+ quoteId: z.ZodNullable<z.ZodString>;
32
+ marketId: z.ZodNullable<z.ZodString>;
33
+ sourceChannelId: z.ZodNullable<z.ZodString>;
34
+ baseCurrency: z.ZodNullable<z.ZodString>;
35
+ fxRateSetId: z.ZodNullable<z.ZodString>;
36
+ subtotalAmountCents: z.ZodNumber;
37
+ taxAmountCents: z.ZodNumber;
38
+ feeAmountCents: z.ZodNumber;
39
+ totalAmountCents: z.ZodNumber;
40
+ costAmountCents: z.ZodNumber;
41
+ validFrom: z.ZodNullable<z.ZodString>;
42
+ validUntil: z.ZodNullable<z.ZodString>;
43
+ sentAt: z.ZodNullable<z.ZodString>;
44
+ acceptedAt: z.ZodNullable<z.ZodString>;
45
+ convertedAt: z.ZodNullable<z.ZodString>;
46
+ notes: z.ZodNullable<z.ZodString>;
47
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
48
+ createdAt: z.ZodString;
49
+ updatedAt: z.ZodString;
50
+ }, z.core.$strip>;
51
+ export type OfferRecord = z.infer<typeof offerRecordSchema>;
52
+ export declare const orderRecordSchema: z.ZodObject<{
53
+ orderNumber: z.ZodString;
54
+ title: z.ZodString;
55
+ status: z.ZodDefault<z.ZodEnum<{
56
+ draft: "draft";
57
+ expired: "expired";
58
+ pending: "pending";
59
+ confirmed: "confirmed";
60
+ fulfilled: "fulfilled";
61
+ cancelled: "cancelled";
62
+ }>>;
63
+ currency: z.ZodString;
64
+ id: z.ZodString;
65
+ offerId: z.ZodNullable<z.ZodString>;
66
+ personId: z.ZodNullable<z.ZodString>;
67
+ organizationId: z.ZodNullable<z.ZodString>;
68
+ opportunityId: z.ZodNullable<z.ZodString>;
69
+ quoteId: z.ZodNullable<z.ZodString>;
70
+ marketId: z.ZodNullable<z.ZodString>;
71
+ sourceChannelId: z.ZodNullable<z.ZodString>;
72
+ baseCurrency: z.ZodNullable<z.ZodString>;
73
+ fxRateSetId: z.ZodNullable<z.ZodString>;
74
+ subtotalAmountCents: z.ZodNumber;
75
+ taxAmountCents: z.ZodNumber;
76
+ feeAmountCents: z.ZodNumber;
77
+ totalAmountCents: z.ZodNumber;
78
+ costAmountCents: z.ZodNumber;
79
+ orderedAt: z.ZodNullable<z.ZodString>;
80
+ confirmedAt: z.ZodNullable<z.ZodString>;
81
+ cancelledAt: z.ZodNullable<z.ZodString>;
82
+ expiresAt: z.ZodNullable<z.ZodString>;
83
+ notes: z.ZodNullable<z.ZodString>;
84
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
85
+ createdAt: z.ZodString;
86
+ updatedAt: z.ZodString;
87
+ }, z.core.$strip>;
88
+ export type OrderRecord = z.infer<typeof orderRecordSchema>;
89
+ export declare const offerListResponse: z.ZodObject<{
90
+ data: z.ZodArray<z.ZodObject<{
91
+ offerNumber: z.ZodString;
92
+ title: z.ZodString;
93
+ status: z.ZodDefault<z.ZodEnum<{
94
+ draft: "draft";
95
+ published: "published";
96
+ sent: "sent";
97
+ accepted: "accepted";
98
+ expired: "expired";
99
+ withdrawn: "withdrawn";
100
+ converted: "converted";
101
+ }>>;
102
+ currency: z.ZodString;
103
+ id: z.ZodString;
104
+ personId: z.ZodNullable<z.ZodString>;
105
+ organizationId: z.ZodNullable<z.ZodString>;
106
+ opportunityId: z.ZodNullable<z.ZodString>;
107
+ quoteId: z.ZodNullable<z.ZodString>;
108
+ marketId: z.ZodNullable<z.ZodString>;
109
+ sourceChannelId: z.ZodNullable<z.ZodString>;
110
+ baseCurrency: z.ZodNullable<z.ZodString>;
111
+ fxRateSetId: z.ZodNullable<z.ZodString>;
112
+ subtotalAmountCents: z.ZodNumber;
113
+ taxAmountCents: z.ZodNumber;
114
+ feeAmountCents: z.ZodNumber;
115
+ totalAmountCents: z.ZodNumber;
116
+ costAmountCents: z.ZodNumber;
117
+ validFrom: z.ZodNullable<z.ZodString>;
118
+ validUntil: z.ZodNullable<z.ZodString>;
119
+ sentAt: z.ZodNullable<z.ZodString>;
120
+ acceptedAt: z.ZodNullable<z.ZodString>;
121
+ convertedAt: z.ZodNullable<z.ZodString>;
122
+ notes: z.ZodNullable<z.ZodString>;
123
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
124
+ createdAt: z.ZodString;
125
+ updatedAt: z.ZodString;
126
+ }, z.core.$strip>>;
127
+ total: z.ZodNumber;
128
+ limit: z.ZodNumber;
129
+ offset: z.ZodNumber;
130
+ }, z.core.$strip>;
131
+ export declare const offerSingleResponse: z.ZodObject<{
132
+ data: z.ZodObject<{
133
+ offerNumber: z.ZodString;
134
+ title: z.ZodString;
135
+ status: z.ZodDefault<z.ZodEnum<{
136
+ draft: "draft";
137
+ published: "published";
138
+ sent: "sent";
139
+ accepted: "accepted";
140
+ expired: "expired";
141
+ withdrawn: "withdrawn";
142
+ converted: "converted";
143
+ }>>;
144
+ currency: z.ZodString;
145
+ id: z.ZodString;
146
+ personId: z.ZodNullable<z.ZodString>;
147
+ organizationId: z.ZodNullable<z.ZodString>;
148
+ opportunityId: z.ZodNullable<z.ZodString>;
149
+ quoteId: z.ZodNullable<z.ZodString>;
150
+ marketId: z.ZodNullable<z.ZodString>;
151
+ sourceChannelId: z.ZodNullable<z.ZodString>;
152
+ baseCurrency: z.ZodNullable<z.ZodString>;
153
+ fxRateSetId: z.ZodNullable<z.ZodString>;
154
+ subtotalAmountCents: z.ZodNumber;
155
+ taxAmountCents: z.ZodNumber;
156
+ feeAmountCents: z.ZodNumber;
157
+ totalAmountCents: z.ZodNumber;
158
+ costAmountCents: z.ZodNumber;
159
+ validFrom: z.ZodNullable<z.ZodString>;
160
+ validUntil: z.ZodNullable<z.ZodString>;
161
+ sentAt: z.ZodNullable<z.ZodString>;
162
+ acceptedAt: z.ZodNullable<z.ZodString>;
163
+ convertedAt: z.ZodNullable<z.ZodString>;
164
+ notes: z.ZodNullable<z.ZodString>;
165
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
166
+ createdAt: z.ZodString;
167
+ updatedAt: z.ZodString;
168
+ }, z.core.$strip>;
169
+ }, z.core.$strip>;
170
+ export declare const orderListResponse: z.ZodObject<{
171
+ data: z.ZodArray<z.ZodObject<{
172
+ orderNumber: z.ZodString;
173
+ title: z.ZodString;
174
+ status: z.ZodDefault<z.ZodEnum<{
175
+ draft: "draft";
176
+ expired: "expired";
177
+ pending: "pending";
178
+ confirmed: "confirmed";
179
+ fulfilled: "fulfilled";
180
+ cancelled: "cancelled";
181
+ }>>;
182
+ currency: z.ZodString;
183
+ id: z.ZodString;
184
+ offerId: z.ZodNullable<z.ZodString>;
185
+ personId: z.ZodNullable<z.ZodString>;
186
+ organizationId: z.ZodNullable<z.ZodString>;
187
+ opportunityId: z.ZodNullable<z.ZodString>;
188
+ quoteId: z.ZodNullable<z.ZodString>;
189
+ marketId: z.ZodNullable<z.ZodString>;
190
+ sourceChannelId: z.ZodNullable<z.ZodString>;
191
+ baseCurrency: z.ZodNullable<z.ZodString>;
192
+ fxRateSetId: z.ZodNullable<z.ZodString>;
193
+ subtotalAmountCents: z.ZodNumber;
194
+ taxAmountCents: z.ZodNumber;
195
+ feeAmountCents: z.ZodNumber;
196
+ totalAmountCents: z.ZodNumber;
197
+ costAmountCents: z.ZodNumber;
198
+ orderedAt: z.ZodNullable<z.ZodString>;
199
+ confirmedAt: z.ZodNullable<z.ZodString>;
200
+ cancelledAt: z.ZodNullable<z.ZodString>;
201
+ expiresAt: z.ZodNullable<z.ZodString>;
202
+ notes: z.ZodNullable<z.ZodString>;
203
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
204
+ createdAt: z.ZodString;
205
+ updatedAt: z.ZodString;
206
+ }, z.core.$strip>>;
207
+ total: z.ZodNumber;
208
+ limit: z.ZodNumber;
209
+ offset: z.ZodNumber;
210
+ }, z.core.$strip>;
211
+ export declare const orderSingleResponse: z.ZodObject<{
212
+ data: z.ZodObject<{
213
+ orderNumber: z.ZodString;
214
+ title: z.ZodString;
215
+ status: z.ZodDefault<z.ZodEnum<{
216
+ draft: "draft";
217
+ expired: "expired";
218
+ pending: "pending";
219
+ confirmed: "confirmed";
220
+ fulfilled: "fulfilled";
221
+ cancelled: "cancelled";
222
+ }>>;
223
+ currency: z.ZodString;
224
+ id: z.ZodString;
225
+ offerId: z.ZodNullable<z.ZodString>;
226
+ personId: z.ZodNullable<z.ZodString>;
227
+ organizationId: z.ZodNullable<z.ZodString>;
228
+ opportunityId: z.ZodNullable<z.ZodString>;
229
+ quoteId: z.ZodNullable<z.ZodString>;
230
+ marketId: z.ZodNullable<z.ZodString>;
231
+ sourceChannelId: z.ZodNullable<z.ZodString>;
232
+ baseCurrency: z.ZodNullable<z.ZodString>;
233
+ fxRateSetId: z.ZodNullable<z.ZodString>;
234
+ subtotalAmountCents: z.ZodNumber;
235
+ taxAmountCents: z.ZodNumber;
236
+ feeAmountCents: z.ZodNumber;
237
+ totalAmountCents: z.ZodNumber;
238
+ costAmountCents: z.ZodNumber;
239
+ orderedAt: z.ZodNullable<z.ZodString>;
240
+ confirmedAt: z.ZodNullable<z.ZodString>;
241
+ cancelledAt: z.ZodNullable<z.ZodString>;
242
+ expiresAt: z.ZodNullable<z.ZodString>;
243
+ notes: z.ZodNullable<z.ZodString>;
244
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
245
+ createdAt: z.ZodString;
246
+ updatedAt: z.ZodString;
247
+ }, z.core.$strip>;
248
+ }, z.core.$strip>;
249
+ //# sourceMappingURL=schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;;;;iBAM7D,CAAA;AAEJ,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC;;iBAA6B,CAAA;AAC3F,eAAO,MAAM,eAAe;;iBAAqC,CAAA;AAEjE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwB5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwB5B,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAE3D,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuC,CAAA;AACrE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoC,CAAA;AACpE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAuC,CAAA;AACrE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAoC,CAAA"}
@@ -0,0 +1,64 @@
1
+ import { insertOfferSchema, insertOrderSchema } from "@voyantjs/transactions";
2
+ import { z } from "zod";
3
+ export const paginatedEnvelope = (item) => z.object({
4
+ data: z.array(item),
5
+ total: z.number().int(),
6
+ limit: z.number().int(),
7
+ offset: z.number().int(),
8
+ });
9
+ export const singleEnvelope = (item) => z.object({ data: item });
10
+ export const successEnvelope = z.object({ success: z.boolean() });
11
+ export const offerRecordSchema = insertOfferSchema.extend({
12
+ id: z.string(),
13
+ personId: z.string().nullable(),
14
+ organizationId: z.string().nullable(),
15
+ opportunityId: z.string().nullable(),
16
+ quoteId: z.string().nullable(),
17
+ marketId: z.string().nullable(),
18
+ sourceChannelId: z.string().nullable(),
19
+ baseCurrency: z.string().nullable(),
20
+ fxRateSetId: z.string().nullable(),
21
+ subtotalAmountCents: z.number().int(),
22
+ taxAmountCents: z.number().int(),
23
+ feeAmountCents: z.number().int(),
24
+ totalAmountCents: z.number().int(),
25
+ costAmountCents: z.number().int(),
26
+ validFrom: z.string().nullable(),
27
+ validUntil: z.string().nullable(),
28
+ sentAt: z.string().nullable(),
29
+ acceptedAt: z.string().nullable(),
30
+ convertedAt: z.string().nullable(),
31
+ notes: z.string().nullable(),
32
+ metadata: z.record(z.string(), z.unknown()).nullable().optional(),
33
+ createdAt: z.string(),
34
+ updatedAt: z.string(),
35
+ });
36
+ export const orderRecordSchema = insertOrderSchema.extend({
37
+ id: z.string(),
38
+ offerId: z.string().nullable(),
39
+ personId: z.string().nullable(),
40
+ organizationId: z.string().nullable(),
41
+ opportunityId: z.string().nullable(),
42
+ quoteId: z.string().nullable(),
43
+ marketId: z.string().nullable(),
44
+ sourceChannelId: z.string().nullable(),
45
+ baseCurrency: z.string().nullable(),
46
+ fxRateSetId: z.string().nullable(),
47
+ subtotalAmountCents: z.number().int(),
48
+ taxAmountCents: z.number().int(),
49
+ feeAmountCents: z.number().int(),
50
+ totalAmountCents: z.number().int(),
51
+ costAmountCents: z.number().int(),
52
+ orderedAt: z.string().nullable(),
53
+ confirmedAt: z.string().nullable(),
54
+ cancelledAt: z.string().nullable(),
55
+ expiresAt: z.string().nullable(),
56
+ notes: z.string().nullable(),
57
+ metadata: z.record(z.string(), z.unknown()).nullable().optional(),
58
+ createdAt: z.string(),
59
+ updatedAt: z.string(),
60
+ });
61
+ export const offerListResponse = paginatedEnvelope(offerRecordSchema);
62
+ export const offerSingleResponse = singleEnvelope(offerRecordSchema);
63
+ export const orderListResponse = paginatedEnvelope(orderRecordSchema);
64
+ export const orderSingleResponse = singleEnvelope(orderRecordSchema);
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@voyantjs/transactions-react",
3
+ "version": "0.2.0",
4
+ "license": "FSL-1.1-Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/voyantjs/voyant.git",
8
+ "directory": "packages/transactions-react"
9
+ },
10
+ "type": "module",
11
+ "exports": {
12
+ ".": "./src/index.ts",
13
+ "./provider": "./src/provider.tsx",
14
+ "./hooks": "./src/hooks/index.ts",
15
+ "./client": "./src/client.ts",
16
+ "./query-keys": "./src/query-keys.ts"
17
+ },
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "clean": "rm -rf dist",
21
+ "prepack": "pnpm run build",
22
+ "typecheck": "tsc --noEmit",
23
+ "lint": "biome check src/",
24
+ "test": "vitest run --passWithNoTests"
25
+ },
26
+ "peerDependencies": {
27
+ "@voyantjs/transactions": "workspace:*",
28
+ "@tanstack/react-query": "^5.0.0",
29
+ "react": "^19.0.0",
30
+ "react-dom": "^19.0.0",
31
+ "zod": "^4.0.0"
32
+ },
33
+ "devDependencies": {
34
+ "@tanstack/react-query": "^5.96.2",
35
+ "@types/react": "^19.2.14",
36
+ "@types/react-dom": "^19.2.3",
37
+ "@voyantjs/react": "workspace:*",
38
+ "@voyantjs/transactions": "workspace:*",
39
+ "@voyantjs/voyant-typescript-config": "workspace:*",
40
+ "react": "^19.2.4",
41
+ "react-dom": "^19.2.4",
42
+ "typescript": "^6.0.2",
43
+ "vitest": "^4.1.2",
44
+ "zod": "^4.3.6"
45
+ },
46
+ "dependencies": {
47
+ "@voyantjs/react": "workspace:*"
48
+ },
49
+ "files": [
50
+ "dist"
51
+ ],
52
+ "publishConfig": {
53
+ "access": "public",
54
+ "exports": {
55
+ ".": {
56
+ "types": "./dist/index.d.ts",
57
+ "import": "./dist/index.js"
58
+ },
59
+ "./provider": {
60
+ "types": "./dist/provider.d.ts",
61
+ "import": "./dist/provider.js"
62
+ },
63
+ "./hooks": {
64
+ "types": "./dist/hooks/index.d.ts",
65
+ "import": "./dist/hooks/index.js"
66
+ },
67
+ "./client": {
68
+ "types": "./dist/client.d.ts",
69
+ "import": "./dist/client.js"
70
+ },
71
+ "./query-keys": {
72
+ "types": "./dist/query-keys.d.ts",
73
+ "import": "./dist/query-keys.js"
74
+ }
75
+ },
76
+ "main": "./dist/index.js",
77
+ "types": "./dist/index.d.ts"
78
+ }
79
+ }