@zyacreatives/shared 2.5.7 → 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.
@@ -289,6 +289,7 @@ export declare const COUNTRY_OF_OPERATION: {
289
289
  export declare const GATEWAY_PROVIDER: {
290
290
  readonly PAYSTACK: "PAYSTACK";
291
291
  readonly STRIPE: "STRIPE";
292
+ readonly NONE: "NONE";
292
293
  };
293
294
  export declare const PRICING_MODELS: {
294
295
  readonly FREE: "Free";
@@ -308,6 +309,7 @@ export declare const TRANSACTION_STATUSES: {
308
309
  export declare const PAYMENT_PROVIDERS: {
309
310
  readonly STRIPE: "STRIPE";
310
311
  readonly PAYSTACK: "PAYSTACK";
312
+ readonly NONE: "NONE";
311
313
  };
312
314
  export type PaymentProvider = (typeof PAYMENT_PROVIDERS)[keyof typeof PAYMENT_PROVIDERS];
313
315
  export type TransactionStatus = (typeof TRANSACTION_STATUSES)[keyof typeof TRANSACTION_STATUSES];
package/dist/constants.js CHANGED
@@ -287,6 +287,7 @@ exports.COUNTRY_OF_OPERATION = {
287
287
  exports.GATEWAY_PROVIDER = {
288
288
  PAYSTACK: "PAYSTACK",
289
289
  STRIPE: "STRIPE",
290
+ NONE: "NONE",
290
291
  };
291
292
  exports.PRICING_MODELS = {
292
293
  FREE: "Free",
@@ -306,6 +307,7 @@ exports.TRANSACTION_STATUSES = {
306
307
  exports.PAYMENT_PROVIDERS = {
307
308
  STRIPE: "STRIPE",
308
309
  PAYSTACK: "PAYSTACK",
310
+ NONE: "NONE",
309
311
  };
310
312
  exports.API_ROUTES = {
311
313
  healthCheck: "/health",
@@ -5,6 +5,7 @@ export declare const PayoutMethodEntitySchema: z.ZodObject<{
5
5
  provider: z.ZodEnum<{
6
6
  readonly PAYSTACK: "PAYSTACK";
7
7
  readonly STRIPE: "STRIPE";
8
+ readonly NONE: "NONE";
8
9
  }>;
9
10
  currency: z.ZodString;
10
11
  bankName: z.ZodString;
@@ -25,6 +26,7 @@ export declare const CreatePayoutMethodEntitySchema: z.ZodObject<{
25
26
  provider: z.ZodEnum<{
26
27
  readonly PAYSTACK: "PAYSTACK";
27
28
  readonly STRIPE: "STRIPE";
29
+ readonly NONE: "NONE";
28
30
  }>;
29
31
  bankName: z.ZodString;
30
32
  accountLast4: z.ZodString;
@@ -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;
@@ -63,6 +63,7 @@ export declare const SellerProfileSchema: z.ZodObject<{
63
63
  provider: z.ZodEnum<{
64
64
  readonly PAYSTACK: "PAYSTACK";
65
65
  readonly STRIPE: "STRIPE";
66
+ readonly NONE: "NONE";
66
67
  }>;
67
68
  currency: z.ZodString;
68
69
  bankName: z.ZodString;
@@ -80,3 +81,10 @@ export declare const SellerProfileSchema: z.ZodObject<{
80
81
  }, z.core.$strip>>;
81
82
  }, z.core.$strip>;
82
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
  });
@@ -36,6 +36,7 @@ export declare const BaseTransactionSchema: z.ZodObject<{
36
36
  paymentProvider: z.ZodEnum<{
37
37
  readonly STRIPE: "STRIPE";
38
38
  readonly PAYSTACK: "PAYSTACK";
39
+ readonly NONE: "NONE";
39
40
  }>;
40
41
  providerTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
42
  discountApplied: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -54,8 +55,10 @@ export declare const InitTransactionInputSchema: z.ZodObject<{
54
55
  paymentProvider: z.ZodEnum<{
55
56
  readonly STRIPE: "STRIPE";
56
57
  readonly PAYSTACK: "PAYSTACK";
58
+ readonly NONE: "NONE";
57
59
  }>;
58
60
  discountCode: z.ZodOptional<z.ZodString>;
61
+ amount: z.ZodOptional<z.ZodNumber>;
59
62
  }, z.core.$strip>;
60
63
  export declare const CreateTransactionInputSchema: z.ZodObject<{
61
64
  status: z.ZodDefault<z.ZodEnum<{
@@ -85,6 +88,7 @@ export declare const CreateTransactionInputSchema: z.ZodObject<{
85
88
  paymentProvider: z.ZodEnum<{
86
89
  readonly STRIPE: "STRIPE";
87
90
  readonly PAYSTACK: "PAYSTACK";
91
+ readonly NONE: "NONE";
88
92
  }>;
89
93
  discountApplied: z.ZodOptional<z.ZodObject<{
90
94
  code: z.ZodOptional<z.ZodString>;
@@ -133,6 +137,7 @@ export declare const TransactionEntitySchema: z.ZodObject<{
133
137
  paymentProvider: z.ZodEnum<{
134
138
  readonly STRIPE: "STRIPE";
135
139
  readonly PAYSTACK: "PAYSTACK";
140
+ readonly NONE: "NONE";
136
141
  }>;
137
142
  providerTransactionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
138
143
  discountApplied: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -33,6 +33,14 @@ exports.InitTransactionInputSchema = zod_openapi_1.z.object({
33
33
  .string()
34
34
  .optional()
35
35
  .openapi({ description: "Optional discount code applied at checkout" }),
36
+ amount: zod_openapi_1.z
37
+ .number()
38
+ .int("Amount must be a whole number (cents/kobo)")
39
+ .min(0)
40
+ .optional()
41
+ .openapi({
42
+ description: "Required for PWYW pricing. The amount the buyer chooses to pay in cents/kobo.",
43
+ }),
36
44
  });
37
45
  exports.CreateTransactionInputSchema = exports.BaseTransactionSchema.pick({
38
46
  productId: true,
@@ -46,7 +54,7 @@ exports.CreateTransactionInputSchema = exports.BaseTransactionSchema.pick({
46
54
  status: true,
47
55
  }).extend({
48
56
  discountApplied: exports.TransactionDiscountSnapshotSchema.optional(),
49
- providerTransactionId: zod_openapi_1.z.string().optional(), // Might not exist until after init
57
+ providerTransactionId: zod_openapi_1.z.string().optional(),
50
58
  });
51
59
  exports.UpdateTransactionWebhookInputSchema = zod_openapi_1.z.object({
52
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.7",
3
+ "version": "2.5.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/constants.ts CHANGED
@@ -327,6 +327,7 @@ export const COUNTRY_OF_OPERATION = {
327
327
  export const GATEWAY_PROVIDER = {
328
328
  PAYSTACK: "PAYSTACK",
329
329
  STRIPE: "STRIPE",
330
+ NONE: "NONE",
330
331
  } as const;
331
332
 
332
333
  export const PRICING_MODELS = {
@@ -350,6 +351,7 @@ export const TRANSACTION_STATUSES = {
350
351
  export const PAYMENT_PROVIDERS = {
351
352
  STRIPE: "STRIPE",
352
353
  PAYSTACK: "PAYSTACK",
354
+ NONE: "NONE",
353
355
  } as const;
354
356
 
355
357
  export type PaymentProvider =
@@ -4,7 +4,6 @@ import {
4
4
  PRICING_MODELS,
5
5
  PRODUCT_STATUS,
6
6
  WAGES_CURRENCY,
7
- ACTIVITY_PARENT_TYPES, // Assumes this includes 'PRODUCT_COVER' and 'PRODUCT_DELIVERY'
8
7
  } from "../constants";
9
8
  import { CreateFileInputSchema, FileEntitySchema } from "./file";
10
9
 
@@ -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
+ });
@@ -42,9 +42,17 @@ export const InitTransactionInputSchema = z.object({
42
42
  .string()
43
43
  .optional()
44
44
  .openapi({ description: "Optional discount code applied at checkout" }),
45
+ amount: z
46
+ .number()
47
+ .int("Amount must be a whole number (cents/kobo)")
48
+ .min(0)
49
+ .optional()
50
+ .openapi({
51
+ description:
52
+ "Required for PWYW pricing. The amount the buyer chooses to pay in cents/kobo.",
53
+ }),
45
54
  });
46
55
 
47
-
48
56
  export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
49
57
  productId: true,
50
58
  buyerId: true,
@@ -57,7 +65,7 @@ export const CreateTransactionInputSchema = BaseTransactionSchema.pick({
57
65
  status: true,
58
66
  }).extend({
59
67
  discountApplied: TransactionDiscountSnapshotSchema.optional(),
60
- providerTransactionId: z.string().optional(), // Might not exist until after init
68
+ providerTransactionId: z.string().optional(),
61
69
  });
62
70
 
63
71
  export const UpdateTransactionWebhookInputSchema = z.object({
@@ -75,6 +83,7 @@ export const TransactionEntitySchema = BaseTransactionSchema.extend({
75
83
  export type TransactionDiscountSnapshot = z.infer<
76
84
  typeof TransactionDiscountSnapshotSchema
77
85
  >;
86
+
78
87
  export type BaseTransactionEntity = z.infer<typeof BaseTransactionSchema>;
79
88
 
80
89
  export type InitTransactionInput = z.infer<typeof InitTransactionInputSchema>;