@zyacreatives/shared 2.5.8 → 2.5.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.
@@ -1,4 +1,4 @@
1
- import z from "zod";
1
+ import { z } from "@hono/zod-openapi";
2
2
  export declare const SellerEntitySchema: z.ZodObject<{
3
3
  id: z.ZodCUID2;
4
4
  businessName: z.ZodString;
@@ -81,3 +81,10 @@ export declare const SellerProfileSchema: z.ZodObject<{
81
81
  }, z.core.$strip>>;
82
82
  }, z.core.$strip>;
83
83
  export type SellerProfile = z.infer<typeof SellerProfileSchema>;
84
+ export declare const GetStripeOnboardingUrlInputSchema: z.ZodObject<{
85
+ refreshUrl: z.ZodString;
86
+ returnUrl: z.ZodString;
87
+ }, z.core.$strip>;
88
+ export declare const GetStripeOnboardingUrlOutputSchema: z.ZodObject<{
89
+ url: z.ZodString;
90
+ }, z.core.$strip>;
@@ -1,37 +1,40 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SellerProfileSchema = exports.UpdateSellerEntitySchema = exports.CreateSellerEntityInputSchema = exports.SellerEntitySchema = void 0;
7
- const zod_1 = __importDefault(require("zod"));
3
+ exports.GetStripeOnboardingUrlOutputSchema = exports.GetStripeOnboardingUrlInputSchema = exports.SellerProfileSchema = exports.UpdateSellerEntitySchema = exports.CreateSellerEntityInputSchema = exports.SellerEntitySchema = void 0;
4
+ const zod_openapi_1 = require("@hono/zod-openapi");
8
5
  const constants_1 = require("../constants");
9
6
  const payout_method_1 = require("./payout-method");
10
- exports.SellerEntitySchema = zod_1.default.object({
11
- id: zod_1.default.cuid2(),
12
- businessName: zod_1.default.string(), // Kept here for the app to consume!
13
- countryOfOperation: zod_1.default.enum(constants_1.COUNTRY_OF_OPERATION),
14
- stripeConnectId: zod_1.default.string().nullable(),
15
- paystackSubaccountCode: zod_1.default.string().nullable(),
16
- status: zod_1.default.enum(constants_1.SELLER_STATUS).default(constants_1.SELLER_STATUS.PENDING),
17
- createdAt: zod_1.default.coerce.date(),
18
- updatedAt: zod_1.default.coerce.date(),
7
+ exports.SellerEntitySchema = zod_openapi_1.z.object({
8
+ id: zod_openapi_1.z.cuid2(),
9
+ businessName: zod_openapi_1.z.string(),
10
+ countryOfOperation: zod_openapi_1.z.enum(constants_1.COUNTRY_OF_OPERATION),
11
+ stripeConnectId: zod_openapi_1.z.string().nullable(),
12
+ paystackSubaccountCode: zod_openapi_1.z.string().nullable(),
13
+ status: zod_openapi_1.z.enum(constants_1.SELLER_STATUS).default(constants_1.SELLER_STATUS.PENDING),
14
+ createdAt: zod_openapi_1.z.coerce.date(),
15
+ updatedAt: zod_openapi_1.z.coerce.date(),
19
16
  });
20
- // No businessName here, because the API doesn't accept it (it relies on the User table)
21
- exports.CreateSellerEntityInputSchema = zod_1.default.object({
22
- countryOfOperation: zod_1.default.enum(constants_1.COUNTRY_OF_OPERATION),
23
- bankCode: zod_1.default.string().nullable(),
24
- accountNumber: zod_1.default.string(),
25
- accountName: zod_1.default.string(),
17
+ exports.CreateSellerEntityInputSchema = zod_openapi_1.z.object({
18
+ countryOfOperation: zod_openapi_1.z.enum(constants_1.COUNTRY_OF_OPERATION),
19
+ bankCode: zod_openapi_1.z.string().nullable(),
20
+ accountNumber: zod_openapi_1.z.string(),
21
+ accountName: zod_openapi_1.z.string(),
26
22
  });
27
- exports.UpdateSellerEntitySchema = zod_1.default
23
+ exports.UpdateSellerEntitySchema = zod_openapi_1.z
28
24
  .object({
29
- countryOfOperation: zod_1.default.enum(constants_1.COUNTRY_OF_OPERATION),
30
- stripeConnectId: zod_1.default.string().nullable(),
31
- paystackSubaccountCode: zod_1.default.string().nullable(),
32
- status: zod_1.default.enum(constants_1.SELLER_STATUS),
25
+ countryOfOperation: zod_openapi_1.z.enum(constants_1.COUNTRY_OF_OPERATION),
26
+ stripeConnectId: zod_openapi_1.z.string().nullable(),
27
+ paystackSubaccountCode: zod_openapi_1.z.string().nullable(),
28
+ status: zod_openapi_1.z.enum(constants_1.SELLER_STATUS),
33
29
  })
34
30
  .partial();
35
31
  exports.SellerProfileSchema = exports.SellerEntitySchema.extend({
36
- payoutMethods: zod_1.default.array(payout_method_1.PayoutMethodEntitySchema),
32
+ payoutMethods: zod_openapi_1.z.array(payout_method_1.PayoutMethodEntitySchema),
33
+ });
34
+ exports.GetStripeOnboardingUrlInputSchema = zod_openapi_1.z.object({
35
+ refreshUrl: zod_openapi_1.z.string().url(),
36
+ returnUrl: zod_openapi_1.z.string().url(),
37
+ });
38
+ exports.GetStripeOnboardingUrlOutputSchema = zod_openapi_1.z.object({
39
+ url: zod_openapi_1.z.string().url(),
37
40
  });
@@ -54,7 +54,7 @@ exports.CreateTransactionInputSchema = exports.BaseTransactionSchema.pick({
54
54
  status: true,
55
55
  }).extend({
56
56
  discountApplied: exports.TransactionDiscountSnapshotSchema.optional(),
57
- providerTransactionId: zod_openapi_1.z.string().optional(), // Might not exist until after init
57
+ providerTransactionId: zod_openapi_1.z.string().optional(),
58
58
  });
59
59
  exports.UpdateTransactionWebhookInputSchema = zod_openapi_1.z.object({
60
60
  status: zod_openapi_1.z.enum(constants_1.TRANSACTION_STATUSES),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyacreatives/shared",
3
- "version": "2.5.8",
3
+ "version": "2.5.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,10 +1,10 @@
1
- import z from "zod";
1
+ import { z } from "@hono/zod-openapi";
2
2
  import { COUNTRY_OF_OPERATION, SELLER_STATUS } from "../constants";
3
3
  import { PayoutMethodEntitySchema } from "./payout-method";
4
4
 
5
5
  export const SellerEntitySchema = z.object({
6
6
  id: z.cuid2(),
7
- businessName: z.string(), // Kept here for the app to consume!
7
+ businessName: z.string(),
8
8
  countryOfOperation: z.enum(COUNTRY_OF_OPERATION),
9
9
  stripeConnectId: z.string().nullable(),
10
10
  paystackSubaccountCode: z.string().nullable(),
@@ -12,15 +12,16 @@ export const SellerEntitySchema = z.object({
12
12
  createdAt: z.coerce.date(),
13
13
  updatedAt: z.coerce.date(),
14
14
  });
15
+
15
16
  export type SellerEntity = z.infer<typeof SellerEntitySchema>;
16
17
 
17
- // No businessName here, because the API doesn't accept it (it relies on the User table)
18
18
  export const CreateSellerEntityInputSchema = z.object({
19
19
  countryOfOperation: z.enum(COUNTRY_OF_OPERATION),
20
20
  bankCode: z.string().nullable(),
21
21
  accountNumber: z.string(),
22
22
  accountName: z.string(),
23
23
  });
24
+
24
25
  export type CreateSellerInput = z.infer<typeof CreateSellerEntityInputSchema>;
25
26
 
26
27
  export const UpdateSellerEntitySchema = z
@@ -31,6 +32,7 @@ export const UpdateSellerEntitySchema = z
31
32
  status: z.enum(SELLER_STATUS),
32
33
  })
33
34
  .partial();
35
+
34
36
  export type UpdateSellerInput = z.infer<typeof UpdateSellerEntitySchema>;
35
37
 
36
38
  export const SellerProfileSchema = SellerEntitySchema.extend({
@@ -38,3 +40,12 @@ export const SellerProfileSchema = SellerEntitySchema.extend({
38
40
  });
39
41
 
40
42
  export type SellerProfile = z.infer<typeof SellerProfileSchema>;
43
+
44
+ export const GetStripeOnboardingUrlInputSchema = z.object({
45
+ refreshUrl: z.string().url(),
46
+ returnUrl: z.string().url(),
47
+ });
48
+
49
+ export const GetStripeOnboardingUrlOutputSchema = z.object({
50
+ url: z.string().url(),
51
+ });
@@ -65,7 +65,7 @@ export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
65
65
  status: true,
66
66
  }).extend({
67
67
  discountApplied: TransactionDiscountSnapshotSchema.optional(),
68
- providerTransactionId: z.string().optional(), // Might not exist until after init
68
+ providerTransactionId: z.string().optional(),
69
69
  });
70
70
 
71
71
  export const UpdateTransactionWebhookInputSchema = z.object({
@@ -83,6 +83,7 @@ export const TransactionEntitySchema = BaseTransactionSchema.extend({
83
83
  export type TransactionDiscountSnapshot = z.infer<
84
84
  typeof TransactionDiscountSnapshotSchema
85
85
  >;
86
+
86
87
  export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
87
88
 
88
89
  export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;