@jsdev_ninja/core 0.11.0 → 0.11.2
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/core.cjs.js +1 -1
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.es.js +925 -828
- package/dist/core.es.js.map +1 -1
- package/dist/core.umd.js +1 -1
- package/dist/core.umd.js.map +1 -1
- package/dist/entities/Cart.d.ts +549 -0
- package/dist/entities/Cart.d.ts.map +1 -1
- package/dist/entities/Cart.js +8 -4
- package/dist/entities/Order.d.ts +21 -0
- package/dist/entities/Order.d.ts.map +1 -1
- package/dist/entities/Order.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/lib/entities/Cart.ts +11 -6
- package/lib/entities/Order.ts +2 -1
- package/lib/index.tsx +1 -0
- package/package.json +1 -1
package/dist/entities/Order.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ProfileSchema } from "./Profile";
|
|
3
|
-
import { ProductSchema } from "./Product";
|
|
4
3
|
import { notEmptyTextSchema } from "./Atoms";
|
|
4
|
+
import { CartItemProductSchema } from "./Cart";
|
|
5
5
|
// pending - order created / by user
|
|
6
6
|
// processing order accepted by store by admin
|
|
7
7
|
// delivered - order delivered by admin
|
|
@@ -27,7 +27,7 @@ export const OrderSchema = z.object({
|
|
|
27
27
|
paymentStatus: z.enum(["pending", "pending_j5", "completed", "failed", "refunded"]), //todo check if hyp support partial refund
|
|
28
28
|
cart: z.object({
|
|
29
29
|
id: z.string(),
|
|
30
|
-
items: z.array(
|
|
30
|
+
items: z.array(CartItemProductSchema),
|
|
31
31
|
cartDiscount: z.number(),
|
|
32
32
|
cartTotal: z.number(),
|
|
33
33
|
cartVat: z.number(),
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
package/lib/entities/Cart.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ProductSchema } from "./Product";
|
|
3
3
|
|
|
4
|
+
export const CartItemProductSchema = z.object({
|
|
5
|
+
product: ProductSchema,
|
|
6
|
+
originalPrice: z.number().optional(),
|
|
7
|
+
finalPrice: z.number().optional(),
|
|
8
|
+
finalDiscount: z.number().optional(),
|
|
9
|
+
amount: z.number().int().positive({ message: "Quantity must be a positive integer." }),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export type TCartItemProduct = z.infer<typeof CartItemProductSchema>;
|
|
13
|
+
|
|
4
14
|
export const CartSchema = z.object({
|
|
5
15
|
type: z.literal("Cart"),
|
|
6
16
|
id: z.string().uuid(),
|
|
@@ -8,12 +18,7 @@ export const CartSchema = z.object({
|
|
|
8
18
|
storeId: z.string().uuid(),
|
|
9
19
|
userId: z.string().uuid(),
|
|
10
20
|
status: z.enum(["active", "draft", "completed"]),
|
|
11
|
-
items: z.array(
|
|
12
|
-
z.object({
|
|
13
|
-
product: ProductSchema,
|
|
14
|
-
amount: z.number().int().positive({ message: "Quantity must be a positive integer." }),
|
|
15
|
-
})
|
|
16
|
-
),
|
|
21
|
+
items: z.array(CartItemProductSchema),
|
|
17
22
|
});
|
|
18
23
|
|
|
19
24
|
export type TCart = z.infer<typeof CartSchema>;
|
package/lib/entities/Order.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { ProfileSchema } from "./Profile";
|
|
3
3
|
import { ProductSchema } from "./Product";
|
|
4
4
|
import { notEmptyTextSchema } from "./Atoms";
|
|
5
|
+
import { CartItemProductSchema } from "./Cart";
|
|
5
6
|
|
|
6
7
|
// pending - order created / by user
|
|
7
8
|
// processing order accepted by store by admin
|
|
@@ -30,7 +31,7 @@ export const OrderSchema = z.object({
|
|
|
30
31
|
paymentStatus: z.enum(["pending", "pending_j5", "completed", "failed", "refunded"]), //todo check if hyp support partial refund
|
|
31
32
|
cart: z.object({
|
|
32
33
|
id: z.string(),
|
|
33
|
-
items: z.array(
|
|
34
|
+
items: z.array(CartItemProductSchema),
|
|
34
35
|
cartDiscount: z.number(),
|
|
35
36
|
cartTotal: z.number(),
|
|
36
37
|
cartVat: z.number(),
|
package/lib/index.tsx
CHANGED