@onabl/contracts 0.1.1 → 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.
package/README.md CHANGED
@@ -1 +1,21 @@
1
- # `contracts`
1
+ # `@onabl/contracts`
2
+
3
+ Zod schemas for onabl's public API — the request/response contract used by
4
+ `@onabl/js`. You won't normally install this directly; it comes in as a
5
+ dependency of `@onabl/js`, `@onabl/react`, or `@onabl/next`.
6
+
7
+ Install it directly only if you're validating onabl API payloads outside
8
+ the SDK (e.g. in your own backend, without going through `@onabl/js`):
9
+
10
+ ```bash
11
+ npm install @onabl/contracts
12
+ ```
13
+
14
+ ```ts
15
+ import {PublicFormSchema, QuoteSchema} from "@onabl/contracts/public-api";
16
+
17
+ const form = PublicFormSchema.parse(rawResponseBody);
18
+ ```
19
+
20
+ Schemas are grouped by resource under `@onabl/contracts/public-api` (forms,
21
+ submissions, quotes, invoices, discount codes).
package/dist/common.d.ts CHANGED
@@ -8,6 +8,17 @@ export declare const SearchPaginationQuerySchema: z.ZodObject<{
8
8
  offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
9
9
  search: z.ZodOptional<z.ZodString>;
10
10
  }, z.core.$strip>;
11
+ export declare const WebhookDeliveryQuerySchema: z.ZodObject<{
12
+ limit: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
13
+ offset: z.ZodDefault<z.ZodOptional<z.ZodCoercedNumber<unknown>>>;
14
+ event: z.ZodOptional<z.ZodString>;
15
+ status: z.ZodOptional<z.ZodEnum<{
16
+ delivered: "delivered";
17
+ pending: "pending";
18
+ failed: "failed";
19
+ }>>;
20
+ }, z.core.$strip>;
11
21
  export type PaginationQuery = z.infer<typeof PaginationQuerySchema>;
12
22
  export type SearchPaginationQuery = z.infer<typeof SearchPaginationQuerySchema>;
23
+ export type WebhookDeliveryQuery = z.infer<typeof WebhookDeliveryQuerySchema>;
13
24
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;iBAEtC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;iBAEtC,CAAC;AAKH,eAAO,MAAM,0BAA0B;;;;;;;;;iBAGrC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
package/dist/common.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SearchPaginationQuerySchema = exports.PaginationQuerySchema = void 0;
3
+ exports.WebhookDeliveryQuerySchema = exports.SearchPaginationQuerySchema = exports.PaginationQuerySchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.PaginationQuerySchema = zod_1.z.object({
6
6
  limit: zod_1.z.coerce.number().int().min(1).max(100).optional().default(50),
@@ -9,3 +9,10 @@ exports.PaginationQuerySchema = zod_1.z.object({
9
9
  exports.SearchPaginationQuerySchema = exports.PaginationQuerySchema.extend({
10
10
  search: zod_1.z.string().optional(),
11
11
  });
12
+ // §14.3 — dashboard delivery log filters. "status" mirrors the tri-state the
13
+ // UI actually shows (delivered / pending-retry / permanently failed), not the
14
+ // raw column names on WebhookDelivery.
15
+ exports.WebhookDeliveryQuerySchema = exports.PaginationQuerySchema.extend({
16
+ event: zod_1.z.string().optional(),
17
+ status: zod_1.z.enum(["delivered", "pending", "failed"]).optional(),
18
+ });
package/dist/forms.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare const FormConfigSchema: z.ZodObject<{
23
23
  steps: z.ZodArray<z.ZodObject<{
24
24
  id: z.ZodString;
25
25
  label: z.ZodString;
26
- title: z.ZodOptional<z.ZodString>;
26
+ description: z.ZodOptional<z.ZodString>;
27
27
  }, z.core.$strip>>;
28
28
  fields: z.ZodArray<z.ZodObject<{
29
29
  id: z.ZodString;
@@ -69,6 +69,7 @@ export declare const UpdateFormConfigSchema: z.ZodObject<{
69
69
  depositDueDays: z.ZodOptional<z.ZodNumber>;
70
70
  balanceDueDays: z.ZodOptional<z.ZodNumber>;
71
71
  websiteBaseUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ invoiceBaseUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
73
  }, z.core.$strip>;
73
74
  export type CreateForm = z.infer<typeof CreateFormSchema>;
74
75
  export type UpdateFormConfig = z.infer<typeof UpdateFormConfigSchema>;
@@ -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;;;;;;;;;;;;iBAWjC,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;;;;;;;;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"}
package/dist/forms.js CHANGED
@@ -40,7 +40,7 @@ exports.FormConfigSchema = zod_1.z
40
40
  .object({
41
41
  version: zod_1.z.literal("1.0"),
42
42
  meta: exports.FormConfigMetaSchema,
43
- steps: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), label: zod_1.z.string(), title: zod_1.z.string().optional() })),
43
+ steps: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), label: zod_1.z.string(), description: zod_1.z.string().optional() })),
44
44
  fields: zod_1.z.array(FormFieldSchema),
45
45
  rules: zod_1.z.object({
46
46
  phase1: zod_1.z.array(PricingRuleSchema),
@@ -66,8 +66,11 @@ exports.UpdateFormConfigSchema = zod_1.z.object({
66
66
  depositPercent: zod_1.z.number().int().min(1).max(99).nullable().optional(),
67
67
  depositDueDays: zod_1.z.number().int().min(1).max(365).optional(),
68
68
  balanceDueDays: zod_1.z.number().int().min(1).max(365).optional(),
69
- // When set, customer quote/invoice emails link to this domain (client.com/quote/:uuid,
70
- // client.com/invoice/:uuid) instead of Onabl's hosted pages. Pass null to clear back to
69
+ // The tenant's own quote-view page (e.g. https://client.com/get-a-quote) — when set,
70
+ // customer quote emails and dashboard links point at `${websiteBaseUrl}/:uuid` instead of
71
+ // Onabl's hosted /q/:handle/:slug/quote/:uuid page. Pass null to clear back to
71
72
  // Onabl-hosted, matching the depositPercent nullable-clear pattern above.
72
73
  websiteBaseUrl: zod_1.z.string().url().nullable().optional(),
74
+ // Same idea, for the invoice-view page — separate field since it's rarely the same path.
75
+ invoiceBaseUrl: zod_1.z.string().url().nullable().optional(),
73
76
  });
@@ -49,7 +49,7 @@ export declare const PublicFormConfigSchema: z.ZodObject<{
49
49
  steps: z.ZodArray<z.ZodObject<{
50
50
  id: z.ZodString;
51
51
  label: z.ZodString;
52
- title: z.ZodOptional<z.ZodString>;
52
+ description: z.ZodOptional<z.ZodString>;
53
53
  }, z.core.$loose>>;
54
54
  fields: z.ZodArray<z.ZodObject<{
55
55
  id: z.ZodString;
@@ -120,7 +120,7 @@ export declare const PublicFormSchema: z.ZodObject<{
120
120
  steps: z.ZodArray<z.ZodObject<{
121
121
  id: z.ZodString;
122
122
  label: z.ZodString;
123
- title: z.ZodOptional<z.ZodString>;
123
+ description: z.ZodOptional<z.ZodString>;
124
124
  }, z.core.$loose>>;
125
125
  fields: z.ZodArray<z.ZodObject<{
126
126
  id: z.ZodString;
@@ -69,7 +69,7 @@ exports.PublicFormConfigSchema = zod_1.z
69
69
  .optional(),
70
70
  })
71
71
  .passthrough(),
72
- steps: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), label: zod_1.z.string(), title: zod_1.z.string().optional() }).passthrough()),
72
+ steps: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string(), label: zod_1.z.string(), description: zod_1.z.string().optional() }).passthrough()),
73
73
  fields: zod_1.z.array(exports.PublicFormFieldSchema),
74
74
  })
75
75
  .passthrough();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onabl/contracts",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
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": {
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "latest",
26
- "@onabl/eslint-config": "0.0.1",
27
- "@onabl/typescript-config": "0.0.1"
26
+ "@onabl/typescript-config": "0.0.1",
27
+ "@onabl/eslint-config": "0.0.1"
28
28
  },
29
29
  "dependencies": {
30
- "@onabl/types": "0.1.0"
30
+ "@onabl/types": "0.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "zod": "^4"