@onabl/contracts 0.2.1 → 0.3.1

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/forms.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare const FormConfigMetaSchema: z.ZodObject<{
5
5
  slug: z.ZodString;
6
6
  currency: z.ZodString;
7
7
  currencySymbol: z.ZodString;
8
+ locale: z.ZodOptional<z.ZodString>;
8
9
  footerNote: z.ZodString;
9
10
  quoteValidDays: z.ZodNumber;
10
11
  declineReasons: z.ZodArray<z.ZodString>;
@@ -16,6 +17,7 @@ export declare const FormConfigSchema: z.ZodObject<{
16
17
  slug: z.ZodString;
17
18
  currency: z.ZodString;
18
19
  currencySymbol: z.ZodString;
20
+ locale: z.ZodOptional<z.ZodString>;
19
21
  footerNote: z.ZodString;
20
22
  quoteValidDays: z.ZodNumber;
21
23
  declineReasons: z.ZodArray<z.ZodString>;
@@ -1 +1 @@
1
- {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AA4BpD,eAAO,MAAM,oBAAoB;;;;;;;;iBAUjB,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBb,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;iBAcjC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../src/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AA4BpD,eAAO,MAAM,oBAAoB;;;;;;;;;iBAWjB,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkBb,CAAC;AAEjB,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;iBAcjC,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
package/dist/forms.js CHANGED
@@ -31,6 +31,7 @@ exports.FormConfigMetaSchema = zod_1.z
31
31
  slug: zod_1.z.string(),
32
32
  currency: zod_1.z.string(),
33
33
  currencySymbol: zod_1.z.string(),
34
+ locale: zod_1.z.string().optional(),
34
35
  footerNote: zod_1.z.string(),
35
36
  quoteValidDays: zod_1.z.number(),
36
37
  declineReasons: zod_1.z.array(zod_1.z.string()),
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ export declare const PAYMENT_METHODS: readonly ["EFT", "CARD", "CASH", "OTHER"];
3
+ export type PaymentMethod = (typeof PAYMENT_METHODS)[number];
4
+ export declare const RecordPaymentSchema: z.ZodObject<{
5
+ amount: z.ZodNumber;
6
+ method: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
7
+ EFT: "EFT";
8
+ CARD: "CARD";
9
+ CASH: "CASH";
10
+ OTHER: "OTHER";
11
+ }>>>;
12
+ reference: z.ZodOptional<z.ZodString>;
13
+ receivedAt: z.ZodOptional<z.ZodISODateTime>;
14
+ note: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ export type RecordPayment = z.infer<typeof RecordPaymentSchema>;
17
+ export declare const PaymentSummarySchema: z.ZodObject<{
18
+ id: z.ZodString;
19
+ amount: z.ZodString;
20
+ method: z.ZodEnum<{
21
+ EFT: "EFT";
22
+ CARD: "CARD";
23
+ CASH: "CASH";
24
+ OTHER: "OTHER";
25
+ }>;
26
+ reference: z.ZodNullable<z.ZodString>;
27
+ receivedAt: z.ZodString;
28
+ note: z.ZodNullable<z.ZodString>;
29
+ }, z.core.$strip>;
30
+ export type PaymentSummary = z.infer<typeof PaymentSummarySchema>;
31
+ //# sourceMappingURL=invoices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoices.d.ts","sourceRoot":"","sources":["../src/invoices.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,eAAe,2CAA4C,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAO9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAIhE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;iBAO/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentSummarySchema = exports.RecordPaymentSchema = exports.PAYMENT_METHODS = void 0;
4
+ // packages/contracts/src/invoices.ts
5
+ // E2 — the payment ledger. Request validation for POST /invoices/:uuid/payments
6
+ // (tenant-authenticated, not part of the public-api.ts surface — no external
7
+ // consumer needs this, it's the dashboard's "Record payment" action).
8
+ const zod_1 = require("zod");
9
+ exports.PAYMENT_METHODS = ["EFT", "CARD", "CASH", "OTHER"];
10
+ exports.RecordPaymentSchema = zod_1.z.object({
11
+ amount: zod_1.z.number().positive(),
12
+ method: zod_1.z.enum(exports.PAYMENT_METHODS).optional().default("OTHER"),
13
+ reference: zod_1.z.string().max(200).optional(),
14
+ // The actual payment date, tenant-set and backdatable — defaults to now when omitted.
15
+ receivedAt: zod_1.z.iso.datetime().optional(),
16
+ note: zod_1.z.string().max(2000).optional(),
17
+ });
18
+ // Dashboard-only payment history entry — never exposed on the public invoice
19
+ // response (no recordedBy, no internal-note leakage to the customer).
20
+ exports.PaymentSummarySchema = zod_1.z.object({
21
+ id: zod_1.z.string(),
22
+ amount: zod_1.z.string(),
23
+ method: zod_1.z.enum(exports.PAYMENT_METHODS),
24
+ reference: zod_1.z.string().nullable(),
25
+ receivedAt: zod_1.z.string(),
26
+ note: zod_1.z.string().nullable(),
27
+ });
@@ -36,6 +36,7 @@ export declare const PublicFormConfigSchema: z.ZodObject<{
36
36
  slug: z.ZodString;
37
37
  currency: z.ZodString;
38
38
  currencySymbol: z.ZodString;
39
+ locale: z.ZodOptional<z.ZodString>;
39
40
  footerNote: z.ZodString;
40
41
  quoteValidDays: z.ZodNumber;
41
42
  declineReasons: z.ZodArray<z.ZodString>;
@@ -86,6 +87,7 @@ export declare const PublicFormSchema: z.ZodObject<{
86
87
  slug: z.ZodString;
87
88
  currency: z.ZodString;
88
89
  currencySymbol: z.ZodString;
90
+ locale: z.ZodOptional<z.ZodString>;
89
91
  footerNote: z.ZodString;
90
92
  quoteValidDays: z.ZodNumber;
91
93
  declineReasons: z.ZodArray<z.ZodString>;
@@ -107,6 +109,7 @@ export declare const PublicFormSchema: z.ZodObject<{
107
109
  slug: z.ZodString;
108
110
  currency: z.ZodString;
109
111
  currencySymbol: z.ZodString;
112
+ locale: z.ZodOptional<z.ZodString>;
110
113
  footerNote: z.ZodString;
111
114
  quoteValidDays: z.ZodNumber;
112
115
  declineReasons: z.ZodArray<z.ZodString>;
@@ -203,6 +206,7 @@ export declare const QuoteSchema: z.ZodObject<{
203
206
  logoUrl: z.ZodNullable<z.ZodString>;
204
207
  currency: z.ZodString;
205
208
  currencySymbol: z.ZodString;
209
+ locale: z.ZodOptional<z.ZodString>;
206
210
  footerNote: z.ZodOptional<z.ZodString>;
207
211
  declineReasons: z.ZodArray<z.ZodString>;
208
212
  displayGroups: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
@@ -220,6 +224,17 @@ export declare const QuoteAcceptResponseSchema: z.ZodObject<{
220
224
  export declare const QuoteDeclineResponseSchema: z.ZodObject<{
221
225
  declined: z.ZodLiteral<true>;
222
226
  }, z.core.$strip>;
227
+ /**
228
+ * Invoice lifecycle (E1). One authoritative enum; every UI reads it instead of
229
+ * re-deriving state from timestamp columns. `DRAFT` is reachable only via
230
+ * manual invoice creation (Part 3); `VOID` / `WRITTEN_OFF` only via the E4
231
+ * void/write-off flow. `OVERDUE` is deliberately NOT a lifecycle value — it is
232
+ * an orthogonal, milestone-aware display flag (`overdue` below).
233
+ */
234
+ export declare const INVOICE_STATUSES: readonly ["DRAFT", "SENT", "VIEWED", "PARTIALLY_PAID", "PAID", "VOID", "WRITTEN_OFF"];
235
+ export type InvoiceStatus = (typeof INVOICE_STATUSES)[number];
236
+ /** The `2026-09-01` baseline's invoice status set — the response transformer collapses {@link INVOICE_STATUSES} back to these for callers pinned to that version. */
237
+ export declare const LEGACY_INVOICE_STATUSES_2026_09_01: readonly ["UNPAID", "POP_UPLOADED", "PAID"];
223
238
  export declare const InvoiceSchema: z.ZodObject<{
224
239
  uuid: z.ZodString;
225
240
  invoiceNumber: z.ZodString;
@@ -227,11 +242,24 @@ export declare const InvoiceSchema: z.ZodObject<{
227
242
  dueDate: z.ZodString;
228
243
  issueDate: z.ZodString;
229
244
  paidAt: z.ZodNullable<z.ZodString>;
245
+ balancePaidAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
230
246
  status: z.ZodEnum<{
231
- UNPAID: "UNPAID";
232
- POP_UPLOADED: "POP_UPLOADED";
247
+ DRAFT: "DRAFT";
248
+ SENT: "SENT";
249
+ VIEWED: "VIEWED";
250
+ PARTIALLY_PAID: "PARTIALLY_PAID";
233
251
  PAID: "PAID";
252
+ VOID: "VOID";
253
+ WRITTEN_OFF: "WRITTEN_OFF";
234
254
  }>;
255
+ overdue: z.ZodOptional<z.ZodBoolean>;
256
+ popStatus: z.ZodOptional<z.ZodEnum<{
257
+ none: "none";
258
+ deposit_uploaded: "deposit_uploaded";
259
+ balance_uploaded: "balance_uploaded";
260
+ }>>;
261
+ statusChangedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
262
+ outstanding: z.ZodOptional<z.ZodString>;
235
263
  depositPercent: z.ZodNullable<z.ZodNumber>;
236
264
  depositAmount: z.ZodNullable<z.ZodString>;
237
265
  balanceAmount: z.ZodNullable<z.ZodString>;
@@ -265,6 +293,7 @@ export declare const InvoiceSchema: z.ZodObject<{
265
293
  quoteReference: z.ZodString;
266
294
  quoteUuid: z.ZodString;
267
295
  currencySymbol: z.ZodString;
296
+ locale: z.ZodOptional<z.ZodString>;
268
297
  currency: z.ZodString;
269
298
  displayGroups: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
270
299
  customerName: z.ZodNullable<z.ZodString>;
@@ -291,6 +320,7 @@ export type Quote = z.infer<typeof QuoteSchema>;
291
320
  export type QuoteAcceptResponse = z.infer<typeof QuoteAcceptResponseSchema>;
292
321
  export type QuoteDeclineResponse = z.infer<typeof QuoteDeclineResponseSchema>;
293
322
  export type Invoice = z.infer<typeof InvoiceSchema>;
323
+ export type InvoicePopStatus = NonNullable<Invoice["popStatus"]>;
294
324
  export type PopUrlUpdateResponse = z.infer<typeof PopUrlUpdateResponseSchema>;
295
325
  export type PresignResponse = z.infer<typeof PresignResponseSchema>;
296
326
  //# sourceMappingURL=public-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,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O,CAAC,WAAW,CAAC,CAAC,CAAC;AACjE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PresignResponseSchema = exports.PopUrlUpdateResponseSchema = exports.InvoiceSchema = exports.QuoteDeclineResponseSchema = exports.QuoteAcceptResponseSchema = exports.QuoteSchema = exports.SubmissionCreateResponseSchema = exports.ValidateCodeResponseSchema = exports.PublicFormSchema = exports.PublicFormConfigSchema = exports.PublicFormFieldSchema = void 0;
3
+ exports.PresignResponseSchema = exports.PopUrlUpdateResponseSchema = exports.InvoiceSchema = exports.LEGACY_INVOICE_STATUSES_2026_09_01 = exports.INVOICE_STATUSES = exports.QuoteDeclineResponseSchema = exports.QuoteAcceptResponseSchema = exports.QuoteSchema = exports.SubmissionCreateResponseSchema = exports.ValidateCodeResponseSchema = exports.PublicFormSchema = exports.PublicFormConfigSchema = exports.PublicFormFieldSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const FieldTypeSchema = zod_1.z.enum(["number", "text", "radio", "select", "toggle", "multicheck", "hidden", "date"]);
6
6
  /**
@@ -55,6 +55,7 @@ exports.PublicFormConfigSchema = zod_1.z
55
55
  slug: zod_1.z.string(),
56
56
  currency: zod_1.z.string(),
57
57
  currencySymbol: zod_1.z.string(),
58
+ locale: zod_1.z.string().optional(),
58
59
  footerNote: zod_1.z.string(),
59
60
  quoteValidDays: zod_1.z.number(),
60
61
  declineReasons: zod_1.z.array(zod_1.z.string()),
@@ -79,6 +80,7 @@ exports.PublicFormSchema = zod_1.z
79
80
  slug: zod_1.z.string(),
80
81
  currency: zod_1.z.string(),
81
82
  currencySymbol: zod_1.z.string(),
83
+ locale: zod_1.z.string().optional(),
82
84
  footerNote: zod_1.z.string(),
83
85
  quoteValidDays: zod_1.z.number(),
84
86
  declineReasons: zod_1.z.array(zod_1.z.string()),
@@ -141,6 +143,7 @@ exports.QuoteSchema = zod_1.z
141
143
  logoUrl: zod_1.z.string().nullable(),
142
144
  currency: zod_1.z.string(),
143
145
  currencySymbol: zod_1.z.string(),
146
+ locale: zod_1.z.string().optional(),
144
147
  footerNote: zod_1.z.string().optional(),
145
148
  declineReasons: zod_1.z.array(zod_1.z.string()),
146
149
  displayGroups: zod_1.z.array(DisplayGroupSchema),
@@ -155,6 +158,16 @@ exports.QuoteSchema = zod_1.z
155
158
  exports.QuoteAcceptResponseSchema = zod_1.z.object({ accepted: zod_1.z.literal(true) });
156
159
  exports.QuoteDeclineResponseSchema = zod_1.z.object({ declined: zod_1.z.literal(true) });
157
160
  // ─── GET /invoices/:uuid ─────────────────────────────────────────────────────
161
+ /**
162
+ * Invoice lifecycle (E1). One authoritative enum; every UI reads it instead of
163
+ * re-deriving state from timestamp columns. `DRAFT` is reachable only via
164
+ * manual invoice creation (Part 3); `VOID` / `WRITTEN_OFF` only via the E4
165
+ * void/write-off flow. `OVERDUE` is deliberately NOT a lifecycle value — it is
166
+ * an orthogonal, milestone-aware display flag (`overdue` below).
167
+ */
168
+ exports.INVOICE_STATUSES = ["DRAFT", "SENT", "VIEWED", "PARTIALLY_PAID", "PAID", "VOID", "WRITTEN_OFF"];
169
+ /** The `2026-09-01` baseline's invoice status set — the response transformer collapses {@link INVOICE_STATUSES} back to these for callers pinned to that version. */
170
+ exports.LEGACY_INVOICE_STATUSES_2026_09_01 = ["UNPAID", "POP_UPLOADED", "PAID"];
158
171
  exports.InvoiceSchema = zod_1.z
159
172
  .object({
160
173
  uuid: zod_1.z.string(),
@@ -163,7 +176,21 @@ exports.InvoiceSchema = zod_1.z
163
176
  dueDate: zod_1.z.string(),
164
177
  issueDate: zod_1.z.string(),
165
178
  paidAt: zod_1.z.string().nullable(),
166
- status: zod_1.z.enum(["UNPAID", "POP_UPLOADED", "PAID"]),
179
+ // Deposit invoices only: the balance milestone was confirmed. null on
180
+ // non-deposit invoices, absent on responses from before this field existed.
181
+ balancePaidAt: zod_1.z.string().nullable().optional(),
182
+ status: zod_1.z.enum(exports.INVOICE_STATUSES),
183
+ // Milestone-aware: true when the earliest unmet due date (the deposit date
184
+ // while a deposit is pending, else the payment due date) is in the past and
185
+ // the invoice is neither paid nor void. Derived at read time, not stored.
186
+ overdue: zod_1.z.boolean().optional(),
187
+ // Whether a proof-of-payment is uploaded and still awaiting tenant
188
+ // confirmation, and against which milestone. Orthogonal to `status`.
189
+ popStatus: zod_1.z.enum(["none", "deposit_uploaded", "balance_uploaded"]).optional(),
190
+ statusChangedAt: zod_1.z.string().nullable().optional(),
191
+ // E2 — total minus every recorded payment. Additive; absent on responses
192
+ // from before the payment ledger existed.
193
+ outstanding: zod_1.z.string().optional(),
167
194
  depositPercent: zod_1.z.number().nullable(),
168
195
  depositAmount: zod_1.z.string().nullable(),
169
196
  balanceAmount: zod_1.z.string().nullable(),
@@ -193,6 +220,7 @@ exports.InvoiceSchema = zod_1.z
193
220
  quoteReference: zod_1.z.string(),
194
221
  quoteUuid: zod_1.z.string(),
195
222
  currencySymbol: zod_1.z.string(),
223
+ locale: zod_1.z.string().optional(),
196
224
  currency: zod_1.z.string(),
197
225
  displayGroups: zod_1.z.array(DisplayGroupSchema),
198
226
  customerName: zod_1.z.string().nullable(),
@@ -45,8 +45,8 @@ export declare const SendMessageSchema: z.ZodObject<{
45
45
  export declare const SubmissionFilterQuerySchema: z.ZodObject<{
46
46
  formId: z.ZodOptional<z.ZodString>;
47
47
  status: z.ZodOptional<z.ZodEnum<{
48
- SUBMITTED: "SUBMITTED";
49
48
  VIEWED: "VIEWED";
49
+ SUBMITTED: "SUBMITTED";
50
50
  ACCEPTED: "ACCEPTED";
51
51
  DECLINED: "DECLINED";
52
52
  IN_RECOVERY: "IN_RECOVERY";
package/dist/tenants.d.ts CHANGED
@@ -23,6 +23,7 @@ export declare const UpdateSettingsSchema: z.ZodObject<{
23
23
  industry: z.ZodOptional<z.ZodString>;
24
24
  currency: z.ZodOptional<z.ZodString>;
25
25
  currencySymbol: z.ZodOptional<z.ZodString>;
26
+ locale: z.ZodOptional<z.ZodString>;
26
27
  numberingPrefix: z.ZodOptional<z.ZodString>;
27
28
  }, z.core.$strip>;
28
29
  export type UpdateSettings = z.infer<typeof UpdateSettingsSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"tenants.d.ts","sourceRoot":"","sources":["../src/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;iBAyB/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"tenants.d.ts","sourceRoot":"","sources":["../src/tenants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0B/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,uBAAuB;;iBAElC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
package/dist/tenants.js CHANGED
@@ -27,6 +27,7 @@ exports.UpdateSettingsSchema = zod_1.z.object({
27
27
  industry: zod_1.z.string().trim().max(100).optional(),
28
28
  currency: zod_1.z.string().length(3).optional(),
29
29
  currencySymbol: zod_1.z.string().trim().min(1).max(4).optional(),
30
+ locale: zod_1.z.string().trim().min(2).max(35).optional(),
30
31
  numberingPrefix: zod_1.z.string().trim().min(2).max(5).optional(),
31
32
  });
32
33
  exports.UpdateDefaultFormSchema = zod_1.z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onabl/contracts",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "description": "Zod request/response validation schemas for onabl's public API — the SDK's typed contract with the API.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,9 +16,9 @@
16
16
  ],
17
17
  "exports": {
18
18
  "./*": {
19
+ "types": "./dist/*.d.ts",
19
20
  "import": "./dist/*.js",
20
- "require": "./dist/*.js",
21
- "types": "./dist/*.d.ts"
21
+ "require": "./dist/*.js"
22
22
  }
23
23
  },
24
24
  "devDependencies": {
@@ -27,7 +27,7 @@
27
27
  "@onabl/typescript-config": "0.0.1"
28
28
  },
29
29
  "dependencies": {
30
- "@onabl/types": "0.3.0"
30
+ "@onabl/types": "0.4.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "zod": "^4"