@jsdev_ninja/core 0.12.5 → 0.12.6
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 +53 -53
- 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/Store.d.ts +2 -2
- package/dist/entities/Store.d.ts.map +1 -1
- package/dist/entities/Store.js +2 -2
- package/lib/entities/Store.ts +4 -2
- package/lib/utils/index.ts +3 -0
- package/package.json +1 -1
package/dist/entities/Store.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
declare const
|
|
2
|
+
export declare const clientTypesSchema: z.ZodEnum<["individual", "company"]>;
|
|
3
|
+
export declare const StoreSchema: z.ZodObject<{
|
|
3
4
|
id: z.ZodString;
|
|
4
5
|
companyId: z.ZodString;
|
|
5
6
|
name: z.ZodString;
|
|
@@ -43,5 +44,4 @@ declare const StoreSchema: z.ZodObject<{
|
|
|
43
44
|
deliveryPrice?: number | undefined;
|
|
44
45
|
}>;
|
|
45
46
|
export type TStore = z.infer<typeof StoreSchema>;
|
|
46
|
-
export {};
|
|
47
47
|
//# sourceMappingURL=Store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Store.d.ts","sourceRoot":"","sources":["../../lib/entities/Store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"Store.d.ts","sourceRoot":"","sources":["../../lib/entities/Store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB,sCAAoC,CAAC;AAEnE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EActB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/dist/entities/Store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const clientTypesSchema = z.enum(["individual", "company"]);
|
|
3
|
-
const StoreSchema = z.object({
|
|
2
|
+
export const clientTypesSchema = z.enum(["individual", "company"]);
|
|
3
|
+
export const StoreSchema = z.object({
|
|
4
4
|
id: z.string(),
|
|
5
5
|
companyId: z.string(),
|
|
6
6
|
name: z.string(),
|
package/lib/entities/Store.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
|
-
const clientTypesSchema = z.enum(["individual", "company"]);
|
|
4
|
-
|
|
3
|
+
export const clientTypesSchema = z.enum(["individual", "company"]);
|
|
4
|
+
|
|
5
|
+
export const StoreSchema = z.object({
|
|
5
6
|
id: z.string(),
|
|
6
7
|
companyId: z.string(),
|
|
7
8
|
name: z.string(),
|
|
@@ -16,4 +17,5 @@ const StoreSchema = z.object({
|
|
|
16
17
|
freeDeliveryPrice: z.number().optional(),
|
|
17
18
|
deliveryPrice: z.number().optional(),
|
|
18
19
|
});
|
|
20
|
+
|
|
19
21
|
export type TStore = z.infer<typeof StoreSchema>;
|
package/lib/utils/index.ts
CHANGED
|
@@ -51,6 +51,9 @@ export function getCartCost({
|
|
|
51
51
|
};
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
+
// calculate delivery price before
|
|
55
|
+
// check if cart cost is greater than free delivery price
|
|
56
|
+
|
|
54
57
|
const activeDiscounts = discounts.filter((discount) => {
|
|
55
58
|
if (discount.variant.variantType === "bundle") {
|
|
56
59
|
const productsTotal =
|