@jsdev_ninja/core 0.12.9 → 0.12.11

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.
@@ -111,7 +111,7 @@ export declare const OrderSchema: z.ZodObject<{
111
111
  created_at: z.ZodNumber;
112
112
  updated_at: z.ZodNumber;
113
113
  categoryIds: z.ZodArray<z.ZodString, "many">;
114
- categoryList: z.ZodArray<z.ZodType<{
114
+ categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
115
115
  id: string;
116
116
  companyId: string;
117
117
  storeId: string;
@@ -159,8 +159,8 @@ export declare const OrderSchema: z.ZodObject<{
159
159
  parentId?: string | null | undefined;
160
160
  tag?: string | undefined;
161
161
  } & /*elided*/ any)[];
162
- }>, "many">;
163
- categories: z.ZodObject<{
162
+ }>, "many">>;
163
+ categories: z.ZodOptional<z.ZodObject<{
164
164
  lvl0: z.ZodArray<z.ZodString, "many">;
165
165
  lvl1: z.ZodArray<z.ZodString, "many">;
166
166
  lvl2: z.ZodArray<z.ZodString, "many">;
@@ -178,8 +178,8 @@ export declare const OrderSchema: z.ZodObject<{
178
178
  lvl2: string[];
179
179
  lvl3: string[];
180
180
  lvl4: string[];
181
- }>;
182
- categoryNames: z.ZodArray<z.ZodString, "many">;
181
+ }>>;
182
+ categoryNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
183
183
  }, "strip", z.ZodTypeAny, {
184
184
  type: "Product";
185
185
  id: string;
@@ -230,7 +230,10 @@ export declare const OrderSchema: z.ZodObject<{
230
230
  created_at: number;
231
231
  updated_at: number;
232
232
  categoryIds: string[];
233
- categoryList: ({
233
+ purchasePrice?: number | undefined;
234
+ profitPercentage?: number | undefined;
235
+ isDiscountable?: boolean | undefined;
236
+ categoryList?: ({
234
237
  id: string;
235
238
  companyId: string;
236
239
  storeId: string;
@@ -254,18 +257,15 @@ export declare const OrderSchema: z.ZodObject<{
254
257
  parentId?: string | null | undefined;
255
258
  tag?: string | undefined;
256
259
  } & /*elided*/ any)[];
257
- })[];
258
- categories: {
260
+ })[] | undefined;
261
+ categories?: {
259
262
  lvl0: string[];
260
263
  lvl1: string[];
261
264
  lvl2: string[];
262
265
  lvl3: string[];
263
266
  lvl4: string[];
264
- };
265
- categoryNames: string[];
266
- purchasePrice?: number | undefined;
267
- profitPercentage?: number | undefined;
268
- isDiscountable?: boolean | undefined;
267
+ } | undefined;
268
+ categoryNames?: string[] | undefined;
269
269
  }, {
270
270
  type: "Product";
271
271
  id: string;
@@ -316,7 +316,10 @@ export declare const OrderSchema: z.ZodObject<{
316
316
  created_at: number;
317
317
  updated_at: number;
318
318
  categoryIds: string[];
319
- categoryList: ({
319
+ purchasePrice?: number | undefined;
320
+ profitPercentage?: number | undefined;
321
+ isDiscountable?: boolean | undefined;
322
+ categoryList?: ({
320
323
  id: string;
321
324
  companyId: string;
322
325
  storeId: string;
@@ -340,18 +343,15 @@ export declare const OrderSchema: z.ZodObject<{
340
343
  parentId?: string | null | undefined;
341
344
  tag?: string | undefined;
342
345
  } & /*elided*/ any)[];
343
- })[];
344
- categories: {
346
+ })[] | undefined;
347
+ categories?: {
345
348
  lvl0: string[];
346
349
  lvl1: string[];
347
350
  lvl2: string[];
348
351
  lvl3: string[];
349
352
  lvl4: string[];
350
- };
351
- categoryNames: string[];
352
- purchasePrice?: number | undefined;
353
- profitPercentage?: number | undefined;
354
- isDiscountable?: boolean | undefined;
353
+ } | undefined;
354
+ categoryNames?: string[] | undefined;
355
355
  }>;
356
356
  originalPrice: z.ZodOptional<z.ZodNumber>;
357
357
  finalPrice: z.ZodOptional<z.ZodNumber>;
@@ -408,7 +408,10 @@ export declare const OrderSchema: z.ZodObject<{
408
408
  created_at: number;
409
409
  updated_at: number;
410
410
  categoryIds: string[];
411
- categoryList: ({
411
+ purchasePrice?: number | undefined;
412
+ profitPercentage?: number | undefined;
413
+ isDiscountable?: boolean | undefined;
414
+ categoryList?: ({
412
415
  id: string;
413
416
  companyId: string;
414
417
  storeId: string;
@@ -432,18 +435,15 @@ export declare const OrderSchema: z.ZodObject<{
432
435
  parentId?: string | null | undefined;
433
436
  tag?: string | undefined;
434
437
  } & /*elided*/ any)[];
435
- })[];
436
- categories: {
438
+ })[] | undefined;
439
+ categories?: {
437
440
  lvl0: string[];
438
441
  lvl1: string[];
439
442
  lvl2: string[];
440
443
  lvl3: string[];
441
444
  lvl4: string[];
442
- };
443
- categoryNames: string[];
444
- purchasePrice?: number | undefined;
445
- profitPercentage?: number | undefined;
446
- isDiscountable?: boolean | undefined;
445
+ } | undefined;
446
+ categoryNames?: string[] | undefined;
447
447
  };
448
448
  amount: number;
449
449
  originalPrice?: number | undefined;
@@ -500,7 +500,10 @@ export declare const OrderSchema: z.ZodObject<{
500
500
  created_at: number;
501
501
  updated_at: number;
502
502
  categoryIds: string[];
503
- categoryList: ({
503
+ purchasePrice?: number | undefined;
504
+ profitPercentage?: number | undefined;
505
+ isDiscountable?: boolean | undefined;
506
+ categoryList?: ({
504
507
  id: string;
505
508
  companyId: string;
506
509
  storeId: string;
@@ -524,18 +527,15 @@ export declare const OrderSchema: z.ZodObject<{
524
527
  parentId?: string | null | undefined;
525
528
  tag?: string | undefined;
526
529
  } & /*elided*/ any)[];
527
- })[];
528
- categories: {
530
+ })[] | undefined;
531
+ categories?: {
529
532
  lvl0: string[];
530
533
  lvl1: string[];
531
534
  lvl2: string[];
532
535
  lvl3: string[];
533
536
  lvl4: string[];
534
- };
535
- categoryNames: string[];
536
- purchasePrice?: number | undefined;
537
- profitPercentage?: number | undefined;
538
- isDiscountable?: boolean | undefined;
537
+ } | undefined;
538
+ categoryNames?: string[] | undefined;
539
539
  };
540
540
  amount: number;
541
541
  originalPrice?: number | undefined;
@@ -598,7 +598,10 @@ export declare const OrderSchema: z.ZodObject<{
598
598
  created_at: number;
599
599
  updated_at: number;
600
600
  categoryIds: string[];
601
- categoryList: ({
601
+ purchasePrice?: number | undefined;
602
+ profitPercentage?: number | undefined;
603
+ isDiscountable?: boolean | undefined;
604
+ categoryList?: ({
602
605
  id: string;
603
606
  companyId: string;
604
607
  storeId: string;
@@ -622,18 +625,15 @@ export declare const OrderSchema: z.ZodObject<{
622
625
  parentId?: string | null | undefined;
623
626
  tag?: string | undefined;
624
627
  } & /*elided*/ any)[];
625
- })[];
626
- categories: {
628
+ })[] | undefined;
629
+ categories?: {
627
630
  lvl0: string[];
628
631
  lvl1: string[];
629
632
  lvl2: string[];
630
633
  lvl3: string[];
631
634
  lvl4: string[];
632
- };
633
- categoryNames: string[];
634
- purchasePrice?: number | undefined;
635
- profitPercentage?: number | undefined;
636
- isDiscountable?: boolean | undefined;
635
+ } | undefined;
636
+ categoryNames?: string[] | undefined;
637
637
  };
638
638
  amount: number;
639
639
  originalPrice?: number | undefined;
@@ -696,7 +696,10 @@ export declare const OrderSchema: z.ZodObject<{
696
696
  created_at: number;
697
697
  updated_at: number;
698
698
  categoryIds: string[];
699
- categoryList: ({
699
+ purchasePrice?: number | undefined;
700
+ profitPercentage?: number | undefined;
701
+ isDiscountable?: boolean | undefined;
702
+ categoryList?: ({
700
703
  id: string;
701
704
  companyId: string;
702
705
  storeId: string;
@@ -720,18 +723,15 @@ export declare const OrderSchema: z.ZodObject<{
720
723
  parentId?: string | null | undefined;
721
724
  tag?: string | undefined;
722
725
  } & /*elided*/ any)[];
723
- })[];
724
- categories: {
726
+ })[] | undefined;
727
+ categories?: {
725
728
  lvl0: string[];
726
729
  lvl1: string[];
727
730
  lvl2: string[];
728
731
  lvl3: string[];
729
732
  lvl4: string[];
730
- };
731
- categoryNames: string[];
732
- purchasePrice?: number | undefined;
733
- profitPercentage?: number | undefined;
734
- isDiscountable?: boolean | undefined;
733
+ } | undefined;
734
+ categoryNames?: string[] | undefined;
735
735
  };
736
736
  amount: number;
737
737
  originalPrice?: number | undefined;
@@ -745,7 +745,7 @@ export declare const OrderSchema: z.ZodObject<{
745
745
  originalAmount: z.ZodOptional<z.ZodNumber>;
746
746
  actualAmount: z.ZodOptional<z.ZodNumber>;
747
747
  date: z.ZodNumber;
748
- deliveryDate: z.ZodOptional<z.ZodNumber>;
748
+ deliveryDate: z.ZodNumber;
749
749
  client: z.ZodObject<{
750
750
  type: z.ZodLiteral<"Profile">;
751
751
  id: z.ZodString;
@@ -899,7 +899,10 @@ export declare const OrderSchema: z.ZodObject<{
899
899
  created_at: number;
900
900
  updated_at: number;
901
901
  categoryIds: string[];
902
- categoryList: ({
902
+ purchasePrice?: number | undefined;
903
+ profitPercentage?: number | undefined;
904
+ isDiscountable?: boolean | undefined;
905
+ categoryList?: ({
903
906
  id: string;
904
907
  companyId: string;
905
908
  storeId: string;
@@ -923,18 +926,15 @@ export declare const OrderSchema: z.ZodObject<{
923
926
  parentId?: string | null | undefined;
924
927
  tag?: string | undefined;
925
928
  } & /*elided*/ any)[];
926
- })[];
927
- categories: {
929
+ })[] | undefined;
930
+ categories?: {
928
931
  lvl0: string[];
929
932
  lvl1: string[];
930
933
  lvl2: string[];
931
934
  lvl3: string[];
932
935
  lvl4: string[];
933
- };
934
- categoryNames: string[];
935
- purchasePrice?: number | undefined;
936
- profitPercentage?: number | undefined;
937
- isDiscountable?: boolean | undefined;
936
+ } | undefined;
937
+ categoryNames?: string[] | undefined;
938
938
  };
939
939
  amount: number;
940
940
  originalPrice?: number | undefined;
@@ -945,6 +945,7 @@ export declare const OrderSchema: z.ZodObject<{
945
945
  cartTotal: number;
946
946
  cartVat: number;
947
947
  };
948
+ deliveryDate: number;
948
949
  client: {
949
950
  type: "Profile";
950
951
  id: string;
@@ -972,7 +973,6 @@ export declare const OrderSchema: z.ZodObject<{
972
973
  };
973
974
  originalAmount?: number | undefined;
974
975
  actualAmount?: number | undefined;
975
- deliveryDate?: number | undefined;
976
976
  nameOnInvoice?: string | undefined;
977
977
  clientComment?: string | undefined;
978
978
  }, {
@@ -1037,7 +1037,10 @@ export declare const OrderSchema: z.ZodObject<{
1037
1037
  created_at: number;
1038
1038
  updated_at: number;
1039
1039
  categoryIds: string[];
1040
- categoryList: ({
1040
+ purchasePrice?: number | undefined;
1041
+ profitPercentage?: number | undefined;
1042
+ isDiscountable?: boolean | undefined;
1043
+ categoryList?: ({
1041
1044
  id: string;
1042
1045
  companyId: string;
1043
1046
  storeId: string;
@@ -1061,18 +1064,15 @@ export declare const OrderSchema: z.ZodObject<{
1061
1064
  parentId?: string | null | undefined;
1062
1065
  tag?: string | undefined;
1063
1066
  } & /*elided*/ any)[];
1064
- })[];
1065
- categories: {
1067
+ })[] | undefined;
1068
+ categories?: {
1066
1069
  lvl0: string[];
1067
1070
  lvl1: string[];
1068
1071
  lvl2: string[];
1069
1072
  lvl3: string[];
1070
1073
  lvl4: string[];
1071
- };
1072
- categoryNames: string[];
1073
- purchasePrice?: number | undefined;
1074
- profitPercentage?: number | undefined;
1075
- isDiscountable?: boolean | undefined;
1074
+ } | undefined;
1075
+ categoryNames?: string[] | undefined;
1076
1076
  };
1077
1077
  amount: number;
1078
1078
  originalPrice?: number | undefined;
@@ -1083,6 +1083,7 @@ export declare const OrderSchema: z.ZodObject<{
1083
1083
  cartTotal: number;
1084
1084
  cartVat: number;
1085
1085
  };
1086
+ deliveryDate: number;
1086
1087
  client: {
1087
1088
  type: "Profile";
1088
1089
  id: string;
@@ -1110,7 +1111,6 @@ export declare const OrderSchema: z.ZodObject<{
1110
1111
  };
1111
1112
  originalAmount?: number | undefined;
1112
1113
  actualAmount?: number | undefined;
1113
- deliveryDate?: number | undefined;
1114
1114
  nameOnInvoice?: string | undefined;
1115
1115
  clientComment?: string | undefined;
1116
1116
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"Order.d.ts","sourceRoot":"","sources":["../../lib/entities/Order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BtB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -35,7 +35,7 @@ export const OrderSchema = z.object({
35
35
  originalAmount: z.number().positive().optional(), // what client pay
36
36
  actualAmount: z.number().positive().optional(), // what store charge
37
37
  date: z.number(),
38
- deliveryDate: z.coerce.number().optional(),
38
+ deliveryDate: z.coerce.number(),
39
39
  client: ProfileSchema.required({}),
40
40
  nameOnInvoice: z.string().optional(),
41
41
  clientComment: z.string().optional(),
@@ -100,7 +100,7 @@ export declare const ProductSchema: z.ZodObject<{
100
100
  created_at: z.ZodNumber;
101
101
  updated_at: z.ZodNumber;
102
102
  categoryIds: z.ZodArray<z.ZodString, "many">;
103
- categoryList: z.ZodArray<z.ZodType<{
103
+ categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
104
104
  id: string;
105
105
  companyId: string;
106
106
  storeId: string;
@@ -148,8 +148,8 @@ export declare const ProductSchema: z.ZodObject<{
148
148
  parentId?: string | null | undefined;
149
149
  tag?: string | undefined;
150
150
  } & /*elided*/ any)[];
151
- }>, "many">;
152
- categories: z.ZodObject<{
151
+ }>, "many">>;
152
+ categories: z.ZodOptional<z.ZodObject<{
153
153
  lvl0: z.ZodArray<z.ZodString, "many">;
154
154
  lvl1: z.ZodArray<z.ZodString, "many">;
155
155
  lvl2: z.ZodArray<z.ZodString, "many">;
@@ -167,8 +167,8 @@ export declare const ProductSchema: z.ZodObject<{
167
167
  lvl2: string[];
168
168
  lvl3: string[];
169
169
  lvl4: string[];
170
- }>;
171
- categoryNames: z.ZodArray<z.ZodString, "many">;
170
+ }>>;
171
+ categoryNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
172
172
  }, "strip", z.ZodTypeAny, {
173
173
  type: "Product";
174
174
  id: string;
@@ -219,7 +219,10 @@ export declare const ProductSchema: z.ZodObject<{
219
219
  created_at: number;
220
220
  updated_at: number;
221
221
  categoryIds: string[];
222
- categoryList: ({
222
+ purchasePrice?: number | undefined;
223
+ profitPercentage?: number | undefined;
224
+ isDiscountable?: boolean | undefined;
225
+ categoryList?: ({
223
226
  id: string;
224
227
  companyId: string;
225
228
  storeId: string;
@@ -243,18 +246,15 @@ export declare const ProductSchema: z.ZodObject<{
243
246
  parentId?: string | null | undefined;
244
247
  tag?: string | undefined;
245
248
  } & /*elided*/ any)[];
246
- })[];
247
- categories: {
249
+ })[] | undefined;
250
+ categories?: {
248
251
  lvl0: string[];
249
252
  lvl1: string[];
250
253
  lvl2: string[];
251
254
  lvl3: string[];
252
255
  lvl4: string[];
253
- };
254
- categoryNames: string[];
255
- purchasePrice?: number | undefined;
256
- profitPercentage?: number | undefined;
257
- isDiscountable?: boolean | undefined;
256
+ } | undefined;
257
+ categoryNames?: string[] | undefined;
258
258
  }, {
259
259
  type: "Product";
260
260
  id: string;
@@ -305,7 +305,10 @@ export declare const ProductSchema: z.ZodObject<{
305
305
  created_at: number;
306
306
  updated_at: number;
307
307
  categoryIds: string[];
308
- categoryList: ({
308
+ purchasePrice?: number | undefined;
309
+ profitPercentage?: number | undefined;
310
+ isDiscountable?: boolean | undefined;
311
+ categoryList?: ({
309
312
  id: string;
310
313
  companyId: string;
311
314
  storeId: string;
@@ -329,18 +332,15 @@ export declare const ProductSchema: z.ZodObject<{
329
332
  parentId?: string | null | undefined;
330
333
  tag?: string | undefined;
331
334
  } & /*elided*/ any)[];
332
- })[];
333
- categories: {
335
+ })[] | undefined;
336
+ categories?: {
334
337
  lvl0: string[];
335
338
  lvl1: string[];
336
339
  lvl2: string[];
337
340
  lvl3: string[];
338
341
  lvl4: string[];
339
- };
340
- categoryNames: string[];
341
- purchasePrice?: number | undefined;
342
- profitPercentage?: number | undefined;
343
- isDiscountable?: boolean | undefined;
342
+ } | undefined;
343
+ categoryNames?: string[] | undefined;
344
344
  }>;
345
345
  export type TProduct = z.infer<typeof ProductSchema>;
346
346
  export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
@@ -444,7 +444,7 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
444
444
  created_at: z.ZodNumber;
445
445
  updated_at: z.ZodNumber;
446
446
  categoryIds: z.ZodArray<z.ZodString, "many">;
447
- categoryList: z.ZodArray<z.ZodType<{
447
+ categoryList: z.ZodOptional<z.ZodArray<z.ZodType<{
448
448
  id: string;
449
449
  companyId: string;
450
450
  storeId: string;
@@ -492,8 +492,8 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
492
492
  parentId?: string | null | undefined;
493
493
  tag?: string | undefined;
494
494
  } & /*elided*/ any)[];
495
- }>, "many">;
496
- categories: z.ZodObject<{
495
+ }>, "many">>;
496
+ categories: z.ZodOptional<z.ZodObject<{
497
497
  lvl0: z.ZodArray<z.ZodString, "many">;
498
498
  lvl1: z.ZodArray<z.ZodString, "many">;
499
499
  lvl2: z.ZodArray<z.ZodString, "many">;
@@ -511,8 +511,8 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
511
511
  lvl2: string[];
512
512
  lvl3: string[];
513
513
  lvl4: string[];
514
- }>;
515
- categoryNames: z.ZodArray<z.ZodString, "many">;
514
+ }>>;
515
+ categoryNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
516
516
  }, {
517
517
  image: z.ZodOptional<z.ZodType<File, z.ZodTypeDef, File>>;
518
518
  }>, "strip", z.ZodTypeAny, {
@@ -565,7 +565,10 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
565
565
  created_at: number;
566
566
  updated_at: number;
567
567
  categoryIds: string[];
568
- categoryList: ({
568
+ purchasePrice?: number | undefined;
569
+ profitPercentage?: number | undefined;
570
+ isDiscountable?: boolean | undefined;
571
+ categoryList?: ({
569
572
  id: string;
570
573
  companyId: string;
571
574
  storeId: string;
@@ -589,18 +592,15 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
589
592
  parentId?: string | null | undefined;
590
593
  tag?: string | undefined;
591
594
  } & /*elided*/ any)[];
592
- })[];
593
- categories: {
595
+ })[] | undefined;
596
+ categories?: {
594
597
  lvl0: string[];
595
598
  lvl1: string[];
596
599
  lvl2: string[];
597
600
  lvl3: string[];
598
601
  lvl4: string[];
599
- };
600
- categoryNames: string[];
601
- purchasePrice?: number | undefined;
602
- profitPercentage?: number | undefined;
603
- isDiscountable?: boolean | undefined;
602
+ } | undefined;
603
+ categoryNames?: string[] | undefined;
604
604
  image?: File | undefined;
605
605
  }, {
606
606
  type: "Product";
@@ -652,7 +652,10 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
652
652
  created_at: number;
653
653
  updated_at: number;
654
654
  categoryIds: string[];
655
- categoryList: ({
655
+ purchasePrice?: number | undefined;
656
+ profitPercentage?: number | undefined;
657
+ isDiscountable?: boolean | undefined;
658
+ categoryList?: ({
656
659
  id: string;
657
660
  companyId: string;
658
661
  storeId: string;
@@ -676,18 +679,15 @@ export declare const NewProductSchema: z.ZodObject<z.objectUtil.extendShape<{
676
679
  parentId?: string | null | undefined;
677
680
  tag?: string | undefined;
678
681
  } & /*elided*/ any)[];
679
- })[];
680
- categories: {
682
+ })[] | undefined;
683
+ categories?: {
681
684
  lvl0: string[];
682
685
  lvl1: string[];
683
686
  lvl2: string[];
684
687
  lvl3: string[];
685
688
  lvl4: string[];
686
- };
687
- categoryNames: string[];
688
- purchasePrice?: number | undefined;
689
- profitPercentage?: number | undefined;
690
- isDiscountable?: boolean | undefined;
689
+ } | undefined;
690
+ categoryNames?: string[] | undefined;
691
691
  image?: File | undefined;
692
692
  }>;
693
693
  export type TNewProduct = z.infer<typeof NewProductSchema>;
@@ -44,7 +44,7 @@ export const ProductSchema = z.object({
44
44
  updated_at: z.number(),
45
45
  categoryIds: z.array(z.string().nonempty()),
46
46
  // @deprecated
47
- categoryList: z.array(CategorySchema),
47
+ categoryList: z.array(CategorySchema).optional(),
48
48
  // @deprecated
49
49
  categories: z.object({
50
50
  lvl0: z.array(z.string()),
@@ -52,9 +52,9 @@ export const ProductSchema = z.object({
52
52
  lvl2: z.array(z.string()),
53
53
  lvl3: z.array(z.string()),
54
54
  lvl4: z.array(z.string()),
55
- }),
55
+ }).optional(),
56
56
  // @deprecated
57
- categoryNames: z.array(z.string()),
57
+ categoryNames: z.array(z.string()).optional(),
58
58
  });
59
59
  export const NewProductSchema = ProductSchema.extend({
60
60
  image: z.instanceof(File).optional(),
@@ -1 +1 @@
1
- {"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../lib/entities/Profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB,mCAAiC,CAAC;AACvE,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,wBAAgB,kBAAkB,IAAI,QAAQ,CAyB7C"}
1
+ {"version":3,"file":"Profile.d.ts","sourceRoot":"","sources":["../../lib/entities/Profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,wBAAwB,mCAEnC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,wBAAgB,kBAAkB,IAAI,QAAQ,CAyB7C"}
@@ -1,7 +1,9 @@
1
1
  import { z } from "zod";
2
2
  import { AddressSchema } from "./Address";
3
3
  import { notEmptyTextSchema } from "./Atoms";
4
- export const ProfilePaymentTypeSchema = z.enum(["default", "delayed"]);
4
+ export const ProfilePaymentTypeSchema = z.enum(["default", "delayed"], {
5
+ description: "delayed is J5 transaction",
6
+ });
5
7
  export const ProfileSchema = z.object({
6
8
  type: z.literal("Profile"),
7
9
  id: notEmptyTextSchema,
@@ -62,7 +62,10 @@ export declare function getCartCost({ cart, discounts, store, }: {
62
62
  created_at: number;
63
63
  updated_at: number;
64
64
  categoryIds: string[];
65
- categoryList: ({
65
+ purchasePrice?: number | undefined;
66
+ profitPercentage?: number | undefined;
67
+ isDiscountable?: boolean | undefined;
68
+ categoryList?: ({
66
69
  id: string;
67
70
  companyId: string;
68
71
  storeId: string;
@@ -86,18 +89,15 @@ export declare function getCartCost({ cart, discounts, store, }: {
86
89
  parentId?: string | null | undefined;
87
90
  tag?: string | undefined;
88
91
  } & /*elided*/ any)[];
89
- })[];
90
- categories: {
92
+ })[] | undefined;
93
+ categories?: {
91
94
  lvl0: string[];
92
95
  lvl1: string[];
93
96
  lvl2: string[];
94
97
  lvl3: string[];
95
98
  lvl4: string[];
96
- };
97
- categoryNames: string[];
98
- purchasePrice?: number | undefined;
99
- profitPercentage?: number | undefined;
100
- isDiscountable?: boolean | undefined;
99
+ } | undefined;
100
+ categoryNames?: string[] | undefined;
101
101
  };
102
102
  originalPrice: number;
103
103
  finalPrice: number;
@@ -26,7 +26,7 @@ function getPriceAfterDiscount(product) {
26
26
  export function getCartCost({ cart, discounts, store, }) {
27
27
  const { isVatIncludedInPrice } = store;
28
28
  // Convert cart items to the format expected by the discount engine
29
- const cartForEngine = cart.map(item => ({
29
+ const cartForEngine = cart.map((item) => ({
30
30
  amount: item.amount,
31
31
  product: {
32
32
  id: item.product.id,
@@ -35,7 +35,6 @@ export function getCartCost({ cart, discounts, store, }) {
35
35
  }));
36
36
  // Apply discounts using the new discount engine
37
37
  const discountResult = DiscountEngine.calculateDiscounts(cartForEngine, discounts);
38
- console.log("discountResult", discountResult);
39
38
  // Map the results back to the original format with additional product info
40
39
  const result = cart.map((item, index) => {
41
40
  const engineItem = discountResult.items[index];
@@ -70,7 +69,8 @@ export function getCartCost({ cart, discounts, store, }) {
70
69
  acc.cost += amount * roundedFinalPrice;
71
70
  acc.discount += finalDiscount ? amount * finalDiscount : finalDiscount;
72
71
  acc.finalCost += amount * roundedFinalPrice + (isVatIncludedInPrice ? 0 : productVatValue);
73
- acc.productsCost += amount * roundedFinalPrice + (isVatIncludedInPrice ? 0 : productVatValue);
72
+ acc.productsCost +=
73
+ amount * roundedFinalPrice + (isVatIncludedInPrice ? 0 : productVatValue);
74
74
  // Round all accumulated values to prevent floating point errors
75
75
  acc.cost = Number(acc.cost.toFixed(2));
76
76
  acc.discount = Number(acc.discount.toFixed(2));