@jsdev_ninja/core 0.12.1 → 0.12.4

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 +1 @@
1
- {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../lib/entities/Address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAQxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"Address.d.ts","sourceRoot":"","sources":["../../lib/entities/Address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;EAQxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
@@ -1,11 +1,10 @@
1
1
  import { z } from "zod";
2
- import { notEmptyTextSchema } from "./Atoms";
3
2
  export const AddressSchema = z.object({
4
- country: notEmptyTextSchema,
5
- city: notEmptyTextSchema,
6
- street: notEmptyTextSchema,
7
- streetNumber: notEmptyTextSchema,
8
- floor: notEmptyTextSchema,
9
- apartmentEnterNumber: notEmptyTextSchema,
10
- apartmentNumber: notEmptyTextSchema,
3
+ country: z.string(),
4
+ city: z.string(),
5
+ street: z.string(),
6
+ streetNumber: z.string(),
7
+ floor: z.string(),
8
+ apartmentEnterNumber: z.string(),
9
+ apartmentNumber: z.string(),
11
10
  });
@@ -1,4 +1,16 @@
1
1
  import { z } from "zod";
2
2
  export declare const notEmptyTextSchema: z.ZodString;
3
3
  export declare const numericTextSchema: z.ZodString;
4
+ export declare const FileSchema: z.ZodObject<{
5
+ url: z.ZodString;
6
+ id: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ url: string;
9
+ id: string;
10
+ }, {
11
+ url: string;
12
+ id: string;
13
+ }>;
14
+ export type TFile = z.infer<typeof FileSchema>;
15
+ export declare function isFile(file: any): file is TFile;
4
16
  //# sourceMappingURL=Atoms.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Atoms.d.ts","sourceRoot":"","sources":["../../lib/entities/Atoms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB,aAA6C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,aAAwD,CAAC"}
1
+ {"version":3,"file":"Atoms.d.ts","sourceRoot":"","sources":["../../lib/entities/Atoms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,kBAAkB,aAA6C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,aAAwD,CAAC;AAEvF,eAAO,MAAM,UAAU;;;;;;;;;EAAsD,CAAC;AAC9E,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/C,wBAAgB,MAAM,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,KAAK,CAE/C"}
@@ -1,3 +1,7 @@
1
1
  import { z } from "zod";
2
2
  export const notEmptyTextSchema = z.string().min(1, { message: "שדה חובה" });
3
3
  export const numericTextSchema = z.string().regex(/^\d+$/, "Must be a numeric string");
4
+ export const FileSchema = z.object({ url: z.string().url(), id: z.string() });
5
+ export function isFile(file) {
6
+ return !!file?.url;
7
+ }
@@ -78,11 +78,11 @@ export declare const CartItemProductSchema: z.ZodObject<{
78
78
  url: z.ZodString;
79
79
  id: z.ZodString;
80
80
  }, "strip", z.ZodTypeAny, {
81
- id: string;
82
81
  url: string;
83
- }, {
84
82
  id: string;
83
+ }, {
85
84
  url: string;
85
+ id: string;
86
86
  }>, "many">;
87
87
  manufacturer: z.ZodString;
88
88
  brand: z.ZodString;
@@ -206,8 +206,8 @@ export declare const CartItemProductSchema: z.ZodObject<{
206
206
  unit: "liter" | "ml" | "none";
207
207
  };
208
208
  images: {
209
- id: string;
210
209
  url: string;
210
+ id: string;
211
211
  }[];
212
212
  manufacturer: string;
213
213
  brand: string;
@@ -292,8 +292,8 @@ export declare const CartItemProductSchema: z.ZodObject<{
292
292
  unit: "liter" | "ml" | "none";
293
293
  };
294
294
  images: {
295
- id: string;
296
295
  url: string;
296
+ id: string;
297
297
  }[];
298
298
  manufacturer: string;
299
299
  brand: string;
@@ -384,8 +384,8 @@ export declare const CartItemProductSchema: z.ZodObject<{
384
384
  unit: "liter" | "ml" | "none";
385
385
  };
386
386
  images: {
387
- id: string;
388
387
  url: string;
388
+ id: string;
389
389
  }[];
390
390
  manufacturer: string;
391
391
  brand: string;
@@ -476,8 +476,8 @@ export declare const CartItemProductSchema: z.ZodObject<{
476
476
  unit: "liter" | "ml" | "none";
477
477
  };
478
478
  images: {
479
- id: string;
480
479
  url: string;
480
+ id: string;
481
481
  }[];
482
482
  manufacturer: string;
483
483
  brand: string;
@@ -619,11 +619,11 @@ export declare const CartSchema: z.ZodObject<{
619
619
  url: z.ZodString;
620
620
  id: z.ZodString;
621
621
  }, "strip", z.ZodTypeAny, {
622
- id: string;
623
622
  url: string;
624
- }, {
625
623
  id: string;
624
+ }, {
626
625
  url: string;
626
+ id: string;
627
627
  }>, "many">;
628
628
  manufacturer: z.ZodString;
629
629
  brand: z.ZodString;
@@ -747,8 +747,8 @@ export declare const CartSchema: z.ZodObject<{
747
747
  unit: "liter" | "ml" | "none";
748
748
  };
749
749
  images: {
750
- id: string;
751
750
  url: string;
751
+ id: string;
752
752
  }[];
753
753
  manufacturer: string;
754
754
  brand: string;
@@ -833,8 +833,8 @@ export declare const CartSchema: z.ZodObject<{
833
833
  unit: "liter" | "ml" | "none";
834
834
  };
835
835
  images: {
836
- id: string;
837
836
  url: string;
837
+ id: string;
838
838
  }[];
839
839
  manufacturer: string;
840
840
  brand: string;
@@ -925,8 +925,8 @@ export declare const CartSchema: z.ZodObject<{
925
925
  unit: "liter" | "ml" | "none";
926
926
  };
927
927
  images: {
928
- id: string;
929
928
  url: string;
929
+ id: string;
930
930
  }[];
931
931
  manufacturer: string;
932
932
  brand: string;
@@ -1017,8 +1017,8 @@ export declare const CartSchema: z.ZodObject<{
1017
1017
  unit: "liter" | "ml" | "none";
1018
1018
  };
1019
1019
  images: {
1020
- id: string;
1021
1020
  url: string;
1021
+ id: string;
1022
1022
  }[];
1023
1023
  manufacturer: string;
1024
1024
  brand: string;
@@ -1117,8 +1117,8 @@ export declare const CartSchema: z.ZodObject<{
1117
1117
  unit: "liter" | "ml" | "none";
1118
1118
  };
1119
1119
  images: {
1120
- id: string;
1121
1120
  url: string;
1121
+ id: string;
1122
1122
  }[];
1123
1123
  manufacturer: string;
1124
1124
  brand: string;
@@ -1217,8 +1217,8 @@ export declare const CartSchema: z.ZodObject<{
1217
1217
  unit: "liter" | "ml" | "none";
1218
1218
  };
1219
1219
  images: {
1220
- id: string;
1221
1220
  url: string;
1221
+ id: string;
1222
1222
  }[];
1223
1223
  manufacturer: string;
1224
1224
  brand: string;
@@ -88,11 +88,11 @@ export declare const OrderSchema: z.ZodObject<{
88
88
  url: z.ZodString;
89
89
  id: z.ZodString;
90
90
  }, "strip", z.ZodTypeAny, {
91
- id: string;
92
91
  url: string;
93
- }, {
94
92
  id: string;
93
+ }, {
95
94
  url: string;
95
+ id: string;
96
96
  }>, "many">;
97
97
  manufacturer: z.ZodString;
98
98
  brand: z.ZodString;
@@ -216,8 +216,8 @@ export declare const OrderSchema: z.ZodObject<{
216
216
  unit: "liter" | "ml" | "none";
217
217
  };
218
218
  images: {
219
- id: string;
220
219
  url: string;
220
+ id: string;
221
221
  }[];
222
222
  manufacturer: string;
223
223
  brand: string;
@@ -302,8 +302,8 @@ export declare const OrderSchema: z.ZodObject<{
302
302
  unit: "liter" | "ml" | "none";
303
303
  };
304
304
  images: {
305
- id: string;
306
305
  url: string;
306
+ id: string;
307
307
  }[];
308
308
  manufacturer: string;
309
309
  brand: string;
@@ -394,8 +394,8 @@ export declare const OrderSchema: z.ZodObject<{
394
394
  unit: "liter" | "ml" | "none";
395
395
  };
396
396
  images: {
397
- id: string;
398
397
  url: string;
398
+ id: string;
399
399
  }[];
400
400
  manufacturer: string;
401
401
  brand: string;
@@ -486,8 +486,8 @@ export declare const OrderSchema: z.ZodObject<{
486
486
  unit: "liter" | "ml" | "none";
487
487
  };
488
488
  images: {
489
- id: string;
490
489
  url: string;
490
+ id: string;
491
491
  }[];
492
492
  manufacturer: string;
493
493
  brand: string;
@@ -584,8 +584,8 @@ export declare const OrderSchema: z.ZodObject<{
584
584
  unit: "liter" | "ml" | "none";
585
585
  };
586
586
  images: {
587
- id: string;
588
587
  url: string;
588
+ id: string;
589
589
  }[];
590
590
  manufacturer: string;
591
591
  brand: string;
@@ -682,8 +682,8 @@ export declare const OrderSchema: z.ZodObject<{
682
682
  unit: "liter" | "ml" | "none";
683
683
  };
684
684
  images: {
685
- id: string;
686
685
  url: string;
686
+ id: string;
687
687
  }[];
688
688
  manufacturer: string;
689
689
  brand: string;
@@ -841,8 +841,8 @@ export declare const OrderSchema: z.ZodObject<{
841
841
  }, "strip", z.ZodTypeAny, {
842
842
  type: "Order";
843
843
  status: "draft" | "completed" | "pending" | "processing" | "in_delivery" | "delivered" | "cancelled" | "refunded";
844
- date: number;
845
844
  id: string;
845
+ date: number;
846
846
  companyId: string;
847
847
  storeId: string;
848
848
  userId: string;
@@ -886,8 +886,8 @@ export declare const OrderSchema: z.ZodObject<{
886
886
  unit: "liter" | "ml" | "none";
887
887
  };
888
888
  images: {
889
- id: string;
890
889
  url: string;
890
+ id: string;
891
891
  }[];
892
892
  manufacturer: string;
893
893
  brand: string;
@@ -980,8 +980,8 @@ export declare const OrderSchema: z.ZodObject<{
980
980
  }, {
981
981
  type: "Order";
982
982
  status: "draft" | "completed" | "pending" | "processing" | "in_delivery" | "delivered" | "cancelled" | "refunded";
983
- date: number;
984
983
  id: string;
984
+ date: number;
985
985
  companyId: string;
986
986
  storeId: string;
987
987
  userId: string;
@@ -1025,8 +1025,8 @@ export declare const OrderSchema: z.ZodObject<{
1025
1025
  unit: "liter" | "ml" | "none";
1026
1026
  };
1027
1027
  images: {
1028
- id: string;
1029
1028
  url: string;
1029
+ id: string;
1030
1030
  }[];
1031
1031
  manufacturer: string;
1032
1032
  brand: string;
@@ -77,11 +77,11 @@ export declare const ProductSchema: z.ZodObject<{
77
77
  url: z.ZodString;
78
78
  id: z.ZodString;
79
79
  }, "strip", z.ZodTypeAny, {
80
- id: string;
81
80
  url: string;
82
- }, {
83
81
  id: string;
82
+ }, {
84
83
  url: string;
84
+ id: string;
85
85
  }>, "many">;
86
86
  manufacturer: z.ZodString;
87
87
  brand: z.ZodString;
@@ -205,8 +205,8 @@ export declare const ProductSchema: z.ZodObject<{
205
205
  unit: "liter" | "ml" | "none";
206
206
  };
207
207
  images: {
208
- id: string;
209
208
  url: string;
209
+ id: string;
210
210
  }[];
211
211
  manufacturer: string;
212
212
  brand: string;
@@ -291,8 +291,8 @@ export declare const ProductSchema: z.ZodObject<{
291
291
  unit: "liter" | "ml" | "none";
292
292
  };
293
293
  images: {
294
- id: string;
295
294
  url: string;
295
+ id: string;
296
296
  }[];
297
297
  manufacturer: string;
298
298
  brand: string;
@@ -421,11 +421,11 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
421
421
  url: z.ZodString;
422
422
  id: z.ZodString;
423
423
  }, "strip", z.ZodTypeAny, {
424
- id: string;
425
424
  url: string;
426
- }, {
427
425
  id: string;
426
+ }, {
428
427
  url: string;
428
+ id: string;
429
429
  }>, "many">;
430
430
  manufacturer: z.ZodString;
431
431
  brand: z.ZodString;
@@ -551,8 +551,8 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
551
551
  unit: "liter" | "ml" | "none";
552
552
  };
553
553
  images: {
554
- id: string;
555
554
  url: string;
555
+ id: string;
556
556
  }[];
557
557
  manufacturer: string;
558
558
  brand: string;
@@ -638,8 +638,8 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
638
638
  unit: "liter" | "ml" | "none";
639
639
  };
640
640
  images: {
641
- id: string;
642
641
  url: string;
642
+ id: string;
643
643
  }[];
644
644
  manufacturer: string;
645
645
  brand: string;
@@ -12,7 +12,7 @@ export const ProfileSchema = z.object({
12
12
  companyName: z.string().optional(),
13
13
  displayName: notEmptyTextSchema,
14
14
  email: z.string().email(),
15
- phoneNumber: notEmptyTextSchema.optional(),
15
+ phoneNumber: z.string().optional(),
16
16
  address: AddressSchema.optional(),
17
17
  isAnonymous: z.boolean(),
18
18
  createdDate: z.number(),
@@ -48,8 +48,8 @@ export declare function getCartCost({ cart, discounts, store, }: {
48
48
  unit: "liter" | "ml" | "none";
49
49
  };
50
50
  images: {
51
- id: string;
52
51
  url: string;
52
+ id: string;
53
53
  }[];
54
54
  manufacturer: string;
55
55
  brand: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAY,MAAM,EAAE,MAAM,aAAa,CAAC;AA6BjE,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,KAAK,GACL,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmIA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAY,MAAM,EAAE,MAAM,aAAa,CAAC;AAiCjE,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,KAAK,GACL,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmIA"}
@@ -21,6 +21,9 @@ function getPriceAfterDiscount(product) {
21
21
  }
22
22
  return product.price;
23
23
  }
24
+ // mark product that used in discount
25
+ // get final price for product and discount id
26
+ // filter better discount
24
27
  // main
25
28
  export function getCartCost({ cart, discounts, store, }) {
26
29
  const { isVatIncludedInPrice } = store;
@@ -1,14 +1,13 @@
1
1
  import { z } from "zod";
2
- import { notEmptyTextSchema } from "./Atoms";
3
2
 
4
3
  export const AddressSchema = z.object({
5
- country: notEmptyTextSchema,
6
- city: notEmptyTextSchema,
7
- street: notEmptyTextSchema,
8
- streetNumber: notEmptyTextSchema,
9
- floor: notEmptyTextSchema,
10
- apartmentEnterNumber: notEmptyTextSchema,
11
- apartmentNumber: notEmptyTextSchema,
4
+ country: z.string(),
5
+ city: z.string(),
6
+ street: z.string(),
7
+ streetNumber: z.string(),
8
+ floor: z.string(),
9
+ apartmentEnterNumber: z.string(),
10
+ apartmentNumber: z.string(),
12
11
  });
13
12
 
14
13
  export type TAddress = z.infer<typeof AddressSchema>;
@@ -2,3 +2,10 @@ import { z } from "zod";
2
2
 
3
3
  export const notEmptyTextSchema = z.string().min(1, { message: "שדה חובה" });
4
4
  export const numericTextSchema = z.string().regex(/^\d+$/, "Must be a numeric string");
5
+
6
+ export const FileSchema = z.object({ url: z.string().url(), id: z.string() });
7
+ export type TFile = z.infer<typeof FileSchema>;
8
+
9
+ export function isFile(file: any): file is TFile {
10
+ return !!file?.url;
11
+ }
@@ -40,7 +40,6 @@ export const OrderSchema = z.object({
40
40
  actualAmount: z.number().positive().optional(), // what store charge
41
41
  date: z.number(),
42
42
  deliveryDate: z.coerce.number().optional(),
43
- createdAt: z.number().optional(),
44
43
  client: ProfileSchema.required({}),
45
44
  nameOnInvoice: z.string().optional(),
46
45
  clientComment: z.string().optional(),
@@ -15,7 +15,7 @@ export const ProfileSchema = z.object({
15
15
  companyName: z.string().optional(),
16
16
  displayName: notEmptyTextSchema,
17
17
  email: z.string().email(),
18
- phoneNumber: notEmptyTextSchema.optional(),
18
+ phoneNumber: z.string().optional(),
19
19
  address: AddressSchema.optional(),
20
20
  isAnonymous: z.boolean(),
21
21
  createdDate: z.number(),
@@ -26,6 +26,10 @@ function getPriceAfterDiscount(product: TProduct) {
26
26
  return product.price;
27
27
  }
28
28
 
29
+ // mark product that used in discount
30
+ // get final price for product and discount id
31
+ // filter better discount
32
+
29
33
  // main
30
34
  export function getCartCost({
31
35
  cart,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.12.1",
3
+ "version": "0.12.4",
4
4
  "main": "dist/core.cjs.js",
5
5
  "module": "dist/core.es.js",
6
6
  "types": "dist/index.d.ts",