@zyacreatives/shared 2.5.31 → 2.5.32
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.
|
@@ -411,6 +411,97 @@ export declare const GetMarketplaceInfoOutputSchema: z.ZodObject<{
|
|
|
411
411
|
deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
412
412
|
}, z.core.$strip>>;
|
|
413
413
|
}, z.core.$strip>;
|
|
414
|
+
export declare const MarketplaceProductEntitySchema: z.ZodObject<{
|
|
415
|
+
description: z.ZodString;
|
|
416
|
+
title: z.ZodString;
|
|
417
|
+
id: z.ZodCUID2;
|
|
418
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
419
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
420
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
421
|
+
readonly ACTIVE: "ACTIVE";
|
|
422
|
+
readonly UNDER_REVIEW: "UNDER_REVIEW";
|
|
423
|
+
readonly DRAFT: "DRAFT";
|
|
424
|
+
readonly ARCHIVED: "ARCHIVED";
|
|
425
|
+
readonly DELETED: "DELETED";
|
|
426
|
+
}>>;
|
|
427
|
+
deletedAt: z.ZodNullable<z.ZodOptional<z.ZodCoercedDate<unknown>>>;
|
|
428
|
+
tags: z.ZodArray<z.ZodString>;
|
|
429
|
+
files: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
430
|
+
id: z.ZodCUID2;
|
|
431
|
+
key: z.ZodString;
|
|
432
|
+
mimeType: z.ZodString;
|
|
433
|
+
url: z.ZodURL;
|
|
434
|
+
parentId: z.ZodNullable<z.ZodCUID2>;
|
|
435
|
+
parentType: z.ZodNullable<z.ZodEnum<{
|
|
436
|
+
readonly PROJECT: "PROJECT";
|
|
437
|
+
readonly USER: "USER";
|
|
438
|
+
readonly JOB: "JOB";
|
|
439
|
+
readonly POST: "POST";
|
|
440
|
+
readonly PRODUCT: "PRODUCT";
|
|
441
|
+
readonly PRODUCT_COVER: "PRODUCT_COVER";
|
|
442
|
+
readonly PRODUCT_DELIVERY: "PRODUCT_DELIVERY";
|
|
443
|
+
readonly COMMENT: "COMMENT";
|
|
444
|
+
readonly JOB_APPLICATION: "JOB_APPLICATION";
|
|
445
|
+
}>>;
|
|
446
|
+
isThumbnail: z.ZodNullable<z.ZodBoolean>;
|
|
447
|
+
order: z.ZodNumber;
|
|
448
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
449
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
450
|
+
deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
|
|
451
|
+
}, z.core.$strip>>>;
|
|
452
|
+
keyFeatures: z.ZodString;
|
|
453
|
+
category: z.ZodString;
|
|
454
|
+
subcategory: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
455
|
+
productLinks: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
456
|
+
title: z.ZodNullable<z.ZodString>;
|
|
457
|
+
url: z.ZodString;
|
|
458
|
+
}, z.core.$strip>>>;
|
|
459
|
+
currency: z.ZodEnum<{
|
|
460
|
+
readonly USD: "USD (United States Dollar)";
|
|
461
|
+
readonly EUR: "EUR (Euro)";
|
|
462
|
+
readonly GBP: "GBP (British Pound Sterling)";
|
|
463
|
+
readonly NGN: "NGN (Nigerian Naira)";
|
|
464
|
+
readonly CAD: "CAD (Canadian Dollar)";
|
|
465
|
+
readonly AUD: "AUD (Australian Dollar)";
|
|
466
|
+
readonly JPY: "JPY (Japanese Yen)";
|
|
467
|
+
readonly CHF: "CHF (Swiss Franc)";
|
|
468
|
+
readonly INR: "INR (Indian Rupee)";
|
|
469
|
+
readonly ZAR: "ZAR (South African Rand)";
|
|
470
|
+
}>;
|
|
471
|
+
pricingModel: z.ZodEnum<{
|
|
472
|
+
readonly FREE: "Free";
|
|
473
|
+
readonly FIXED: "Fixed";
|
|
474
|
+
readonly PWYW: "Pay What You Want";
|
|
475
|
+
}>;
|
|
476
|
+
price: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
477
|
+
suggestedPrice: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
478
|
+
supportEmail: z.ZodNullable<z.ZodOptional<z.ZodEmail>>;
|
|
479
|
+
supportPhone: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
480
|
+
ownsRights: z.ZodBoolean;
|
|
481
|
+
noHarmfulContent: z.ZodBoolean;
|
|
482
|
+
providesSupport: z.ZodBoolean;
|
|
483
|
+
agreesToTerms: z.ZodBoolean;
|
|
484
|
+
sellerId: z.ZodCUID2;
|
|
485
|
+
sellerUsername: z.ZodString;
|
|
486
|
+
sellerName: z.ZodString;
|
|
487
|
+
sellerImageUrl: z.ZodNullable<z.ZodOptional<z.ZodURL>>;
|
|
488
|
+
}, z.core.$strip>;
|
|
489
|
+
export declare const ProductDiscountCheckInputSchema: z.ZodObject<{
|
|
490
|
+
discountCode: z.ZodString;
|
|
491
|
+
productId: z.ZodCUID2;
|
|
492
|
+
}, z.core.$strip>;
|
|
493
|
+
export declare const ProductDiscountCheckOutputSchema: z.ZodObject<{
|
|
494
|
+
exists: z.ZodBoolean;
|
|
495
|
+
discount: z.ZodObject<{
|
|
496
|
+
discountType: z.ZodEnum<{
|
|
497
|
+
readonly FIXED_AMOUNT: "Fixed Amount";
|
|
498
|
+
readonly PERCENTAGE: "Percentage";
|
|
499
|
+
}>;
|
|
500
|
+
amount: z.ZodNumber;
|
|
501
|
+
discountCode: z.ZodOptional<z.ZodString>;
|
|
502
|
+
active: z.ZodDefault<z.ZodBoolean>;
|
|
503
|
+
}, z.core.$strip>;
|
|
504
|
+
}, z.core.$strip>;
|
|
414
505
|
export type ProductLink = z.infer<typeof ProductLinkSchema>;
|
|
415
506
|
export type SearchProductInput = z.infer<typeof SearchProductInputSchema>;
|
|
416
507
|
export type SearchProductOutput = z.infer<typeof SearchProductOutputSchema>;
|
|
@@ -422,3 +513,6 @@ export type ProductServiceAndComplianceInputEntity = z.infer<typeof ProductServi
|
|
|
422
513
|
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
423
514
|
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
424
515
|
export type ProductSearchDocument = z.infer<typeof ProductSearchDocumentSchema>;
|
|
516
|
+
export type MarketplaceProductEntity = z.infer<typeof MarketplaceProductEntitySchema>;
|
|
517
|
+
export type ProductDiscountCheckInput = z.infer<typeof ProductDiscountCheckInputSchema>;
|
|
518
|
+
export type ProductDiscountCheckOutput = z.infer<typeof ProductDiscountCheckOutputSchema>;
|
package/dist/schemas/product.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GetMarketplaceInfoOutputSchema = exports.MarketplaceCategorySchema = exports.SearchProductOutputSchema = exports.SearchProductInputSchema = exports.ProductSearchDocumentSchema = exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.ProductLinkSchema = exports.ProductDiscountEntitySchema = void 0;
|
|
3
|
+
exports.ProductDiscountCheckOutputSchema = exports.ProductDiscountCheckInputSchema = exports.MarketplaceProductEntitySchema = exports.GetMarketplaceInfoOutputSchema = exports.MarketplaceCategorySchema = exports.SearchProductOutputSchema = exports.SearchProductInputSchema = exports.ProductSearchDocumentSchema = exports.ProductEntitySchema = exports.UpdateProductInputSchema = exports.ProductServiceAndComplianceInputSchema = exports.CreateProductInputSchema = exports.ProductLinkSchema = exports.ProductDiscountEntitySchema = void 0;
|
|
4
4
|
const zod_openapi_1 = require("@hono/zod-openapi");
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const file_1 = require("./file");
|
|
@@ -201,3 +201,14 @@ exports.GetMarketplaceInfoOutputSchema = zod_openapi_1.z.object({
|
|
|
201
201
|
whatsHot: zod_openapi_1.z.array(exports.ProductSearchDocumentSchema),
|
|
202
202
|
communityFavourites: zod_openapi_1.z.array(exports.ProductSearchDocumentSchema),
|
|
203
203
|
});
|
|
204
|
+
exports.MarketplaceProductEntitySchema = exports.ProductEntitySchema.omit({
|
|
205
|
+
discounts: true,
|
|
206
|
+
});
|
|
207
|
+
exports.ProductDiscountCheckInputSchema = zod_openapi_1.z.object({
|
|
208
|
+
discountCode: zod_openapi_1.z.string(),
|
|
209
|
+
productId: zod_openapi_1.z.cuid2(),
|
|
210
|
+
});
|
|
211
|
+
exports.ProductDiscountCheckOutputSchema = zod_openapi_1.z.object({
|
|
212
|
+
exists: zod_openapi_1.z.boolean(),
|
|
213
|
+
discount: exports.ProductDiscountEntitySchema,
|
|
214
|
+
});
|
|
@@ -40,6 +40,7 @@ export declare const BaseTransactionSchema: z.ZodObject<{
|
|
|
40
40
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
41
41
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
42
42
|
}, z.core.$strip>>>;
|
|
43
|
+
productNameSnapshot: z.ZodOptional<z.ZodString>;
|
|
43
44
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
44
45
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
45
46
|
}, z.core.$strip>;
|
|
@@ -141,6 +142,7 @@ export declare const TransactionEntitySchema: z.ZodObject<{
|
|
|
141
142
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
142
143
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
143
144
|
}, z.core.$strip>>>;
|
|
145
|
+
productNameSnapshot: z.ZodOptional<z.ZodString>;
|
|
144
146
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
145
147
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
146
148
|
productTitle: z.ZodOptional<z.ZodString>;
|
|
@@ -192,6 +194,7 @@ export declare const InitTransactionOutputSchema: z.ZodObject<{
|
|
|
192
194
|
discountCode: z.ZodOptional<z.ZodString>;
|
|
193
195
|
active: z.ZodDefault<z.ZodBoolean>;
|
|
194
196
|
}, z.core.$strip>>>;
|
|
197
|
+
productNameSnapshot: z.ZodOptional<z.ZodString>;
|
|
195
198
|
createdAt: z.ZodCoercedDate<unknown>;
|
|
196
199
|
updatedAt: z.ZodCoercedDate<unknown>;
|
|
197
200
|
productTitle: z.ZodOptional<z.ZodString>;
|
|
@@ -17,23 +17,18 @@ exports.BaseTransactionSchema = zod_openapi_1.z.object({
|
|
|
17
17
|
paymentProvider: zod_openapi_1.z.enum(constants_1.PAYMENT_PROVIDERS),
|
|
18
18
|
providerTransactionId: zod_openapi_1.z.string().nullable().optional(),
|
|
19
19
|
discountApplied: product_1.ProductDiscountEntitySchema.nullable().optional(),
|
|
20
|
+
productNameSnapshot: zod_openapi_1.z.string().optional(),
|
|
20
21
|
createdAt: zod_openapi_1.z.coerce.date(),
|
|
21
22
|
updatedAt: zod_openapi_1.z.coerce.date(),
|
|
22
23
|
});
|
|
23
|
-
// ==========================================
|
|
24
|
-
// INPUT SCHEMAS
|
|
25
|
-
// ==========================================
|
|
26
24
|
exports.InitTransactionInputSchema = zod_openapi_1.z.object({
|
|
27
25
|
productId: zod_openapi_1.z
|
|
28
26
|
.cuid2()
|
|
29
27
|
.openapi({ description: "ID of the product being purchased" }),
|
|
30
28
|
firstName: zod_openapi_1.z.string().optional(),
|
|
31
29
|
lastName: zod_openapi_1.z.string().optional(),
|
|
32
|
-
email: zod_openapi_1.z
|
|
33
|
-
|
|
34
|
-
discountCode: zod_openapi_1.z
|
|
35
|
-
.string()
|
|
36
|
-
.optional(),
|
|
30
|
+
email: zod_openapi_1.z.email(),
|
|
31
|
+
discountCode: zod_openapi_1.z.string().optional(),
|
|
37
32
|
amount: zod_openapi_1.z.number().int("Amount must be a whole number (cents/kobo)").min(0),
|
|
38
33
|
});
|
|
39
34
|
exports.CreateTransactionInputSchema = exports.BaseTransactionSchema.pick({
|
package/package.json
CHANGED
package/src/schemas/product.ts
CHANGED
|
@@ -44,7 +44,6 @@ const ProductCoreInputSchema = z.object({
|
|
|
44
44
|
|
|
45
45
|
export const CreateProductInputSchema = ProductCoreInputSchema.superRefine(
|
|
46
46
|
(data, ctx) => {
|
|
47
|
-
|
|
48
47
|
if (
|
|
49
48
|
data.pricingModel === PRICING_MODELS.FIXED &&
|
|
50
49
|
(!data.price || data.price <= 0)
|
|
@@ -164,7 +163,6 @@ export const UpdateProductInputSchema = ProductCoreInputSchema.extend(
|
|
|
164
163
|
id: z.cuid2().openapi({ description: "ID of the product being updated" }),
|
|
165
164
|
});
|
|
166
165
|
|
|
167
|
-
|
|
168
166
|
export const ProductEntitySchema = z
|
|
169
167
|
.object({
|
|
170
168
|
id: z.cuid2(),
|
|
@@ -254,6 +252,20 @@ export const GetMarketplaceInfoOutputSchema = z.object({
|
|
|
254
252
|
communityFavourites: z.array(ProductSearchDocumentSchema),
|
|
255
253
|
});
|
|
256
254
|
|
|
255
|
+
export const MarketplaceProductEntitySchema = ProductEntitySchema.omit({
|
|
256
|
+
discounts: true,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
export const ProductDiscountCheckInputSchema = z.object({
|
|
260
|
+
discountCode: z.string(),
|
|
261
|
+
productId: z.cuid2(),
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
export const ProductDiscountCheckOutputSchema = z.object({
|
|
265
|
+
exists: z.boolean(),
|
|
266
|
+
discount: ProductDiscountEntitySchema,
|
|
267
|
+
});
|
|
268
|
+
|
|
257
269
|
export type ProductLink = z.infer<typeof ProductLinkSchema>;
|
|
258
270
|
export type SearchProductInput = z.infer<typeof SearchProductInputSchema>;
|
|
259
271
|
export type SearchProductOutput = z.infer<typeof SearchProductOutputSchema>;
|
|
@@ -272,3 +284,9 @@ export type ProductServiceAndComplianceInputEntity = z.infer<
|
|
|
272
284
|
export type UpdateProductInputEntity = z.infer<typeof UpdateProductInputSchema>;
|
|
273
285
|
export type ProductEntity = z.infer<typeof ProductEntitySchema>;
|
|
274
286
|
export type ProductSearchDocument = z.infer<typeof ProductSearchDocumentSchema>;
|
|
287
|
+
export type MarketplaceProductEntity = z.infer<
|
|
288
|
+
typeof MarketplaceProductEntitySchema
|
|
289
|
+
>;
|
|
290
|
+
|
|
291
|
+
export type ProductDiscountCheckInput = z.infer<typeof ProductDiscountCheckInputSchema>;
|
|
292
|
+
export type ProductDiscountCheckOutput = z.infer<typeof ProductDiscountCheckOutputSchema>;
|
|
@@ -23,26 +23,19 @@ export const BaseTransactionSchema = z.object({
|
|
|
23
23
|
providerTransactionId: z.string().nullable().optional(),
|
|
24
24
|
|
|
25
25
|
discountApplied: ProductDiscountEntitySchema.nullable().optional(),
|
|
26
|
-
|
|
26
|
+
productNameSnapshot: z.string().optional(),
|
|
27
27
|
createdAt: z.coerce.date(),
|
|
28
28
|
updatedAt: z.coerce.date(),
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
// ==========================================
|
|
32
|
-
// INPUT SCHEMAS
|
|
33
|
-
// ==========================================
|
|
34
|
-
|
|
35
31
|
export const InitTransactionInputSchema = z.object({
|
|
36
32
|
productId: z
|
|
37
33
|
.cuid2()
|
|
38
34
|
.openapi({ description: "ID of the product being purchased" }),
|
|
39
35
|
firstName: z.string().optional(),
|
|
40
36
|
lastName: z.string().optional(),
|
|
41
|
-
email: z
|
|
42
|
-
|
|
43
|
-
discountCode: z
|
|
44
|
-
.string()
|
|
45
|
-
.optional(),
|
|
37
|
+
email: z.email(),
|
|
38
|
+
discountCode: z.string().optional(),
|
|
46
39
|
amount: z.number().int("Amount must be a whole number (cents/kobo)").min(0),
|
|
47
40
|
});
|
|
48
41
|
|