@jsdev_ninja/core 0.11.1 → 0.11.3

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,5 +1,5 @@
1
1
  import { z } from "zod";
2
- declare const CartItemProductSchema: z.ZodObject<{
2
+ export declare const CartItemProductSchema: z.ZodObject<{
3
3
  product: z.ZodObject<{
4
4
  type: z.ZodLiteral<"Product">;
5
5
  storeId: z.ZodString;
@@ -1275,5 +1275,4 @@ export declare const CartSchema: z.ZodObject<{
1275
1275
  }[];
1276
1276
  }>;
1277
1277
  export type TCart = z.infer<typeof CartSchema>;
1278
- export {};
1279
1278
  //# sourceMappingURL=Cart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Cart.d.ts","sourceRoot":"","sources":["../../lib/entities/Cart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrB,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { ProductSchema } from "./Product";
3
- const CartItemProductSchema = z.object({
3
+ export const CartItemProductSchema = z.object({
4
4
  product: ProductSchema,
5
5
  originalPrice: z.number().optional(),
6
6
  finalPrice: z.number().optional(),
@@ -353,6 +353,9 @@ export declare const OrderSchema: z.ZodObject<{
353
353
  profitPercentage?: number | undefined;
354
354
  isDiscountable?: boolean | undefined;
355
355
  }>;
356
+ originalPrice: z.ZodOptional<z.ZodNumber>;
357
+ finalPrice: z.ZodOptional<z.ZodNumber>;
358
+ finalDiscount: z.ZodOptional<z.ZodNumber>;
356
359
  amount: z.ZodNumber;
357
360
  }, "strip", z.ZodTypeAny, {
358
361
  product: {
@@ -443,6 +446,9 @@ export declare const OrderSchema: z.ZodObject<{
443
446
  isDiscountable?: boolean | undefined;
444
447
  };
445
448
  amount: number;
449
+ originalPrice?: number | undefined;
450
+ finalPrice?: number | undefined;
451
+ finalDiscount?: number | undefined;
446
452
  }, {
447
453
  product: {
448
454
  type: "Product";
@@ -532,6 +538,9 @@ export declare const OrderSchema: z.ZodObject<{
532
538
  isDiscountable?: boolean | undefined;
533
539
  };
534
540
  amount: number;
541
+ originalPrice?: number | undefined;
542
+ finalPrice?: number | undefined;
543
+ finalDiscount?: number | undefined;
535
544
  }>, "many">;
536
545
  cartDiscount: z.ZodNumber;
537
546
  cartTotal: z.ZodNumber;
@@ -627,6 +636,9 @@ export declare const OrderSchema: z.ZodObject<{
627
636
  isDiscountable?: boolean | undefined;
628
637
  };
629
638
  amount: number;
639
+ originalPrice?: number | undefined;
640
+ finalPrice?: number | undefined;
641
+ finalDiscount?: number | undefined;
630
642
  }[];
631
643
  cartDiscount: number;
632
644
  cartTotal: number;
@@ -722,6 +734,9 @@ export declare const OrderSchema: z.ZodObject<{
722
734
  isDiscountable?: boolean | undefined;
723
735
  };
724
736
  amount: number;
737
+ originalPrice?: number | undefined;
738
+ finalPrice?: number | undefined;
739
+ finalDiscount?: number | undefined;
725
740
  }[];
726
741
  cartDiscount: number;
727
742
  cartTotal: number;
@@ -918,6 +933,9 @@ export declare const OrderSchema: z.ZodObject<{
918
933
  isDiscountable?: boolean | undefined;
919
934
  };
920
935
  amount: number;
936
+ originalPrice?: number | undefined;
937
+ finalPrice?: number | undefined;
938
+ finalDiscount?: number | undefined;
921
939
  }[];
922
940
  cartDiscount: number;
923
941
  cartTotal: number;
@@ -1051,6 +1069,9 @@ export declare const OrderSchema: z.ZodObject<{
1051
1069
  isDiscountable?: boolean | undefined;
1052
1070
  };
1053
1071
  amount: number;
1072
+ originalPrice?: number | undefined;
1073
+ finalPrice?: number | undefined;
1074
+ finalDiscount?: number | undefined;
1054
1075
  }[];
1055
1076
  cartDiscount: number;
1056
1077
  cartTotal: number;
@@ -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;AAaxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BtB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -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(z.object({ product: ProductSchema, amount: z.number() })),
30
+ items: z.array(CartItemProductSchema),
31
31
  cartDiscount: z.number(),
32
32
  cartTotal: z.number(),
33
33
  cartVat: z.number(),
@@ -9,6 +9,7 @@ declare const StoreSchema: z.ZodObject<{
9
9
  paymentType: z.ZodEnum<["external", "j5"]>;
10
10
  allowAnonymousClients: z.ZodBoolean;
11
11
  isVatIncludedInPrice: z.ZodBoolean;
12
+ clientTypes: z.ZodArray<z.ZodEnum<["individual", "company"]>, "many">;
12
13
  }, "strip", z.ZodTypeAny, {
13
14
  id: string;
14
15
  companyId: string;
@@ -19,6 +20,7 @@ declare const StoreSchema: z.ZodObject<{
19
20
  logoUrl: string;
20
21
  allowAnonymousClients: boolean;
21
22
  isVatIncludedInPrice: boolean;
23
+ clientTypes: ("company" | "individual")[];
22
24
  }, {
23
25
  id: string;
24
26
  companyId: string;
@@ -29,6 +31,7 @@ declare const StoreSchema: z.ZodObject<{
29
31
  logoUrl: string;
30
32
  allowAnonymousClients: boolean;
31
33
  isVatIncludedInPrice: boolean;
34
+ clientTypes: ("company" | "individual")[];
32
35
  }>;
33
36
  export type TStore = z.infer<typeof StoreSchema>;
34
37
  export {};
@@ -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;AAExB,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUf,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"Store.d.ts","sourceRoot":"","sources":["../../lib/entities/Store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWf,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod";
2
+ const clientTypesSchema = z.enum(["individual", "company"]);
2
3
  const StoreSchema = z.object({
3
4
  id: z.string(),
4
5
  companyId: z.string(),
@@ -9,4 +10,5 @@ const StoreSchema = z.object({
9
10
  paymentType: z.enum(["external", "j5"]),
10
11
  allowAnonymousClients: z.boolean(),
11
12
  isVatIncludedInPrice: z.boolean(),
13
+ clientTypes: z.array(clientTypesSchema),
12
14
  });
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./entities";
2
+ export * from "./utils";
2
3
  export { FirebaseAPI } from "./firebase-api";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -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
@@ -1,2 +1,3 @@
1
1
  export * from "./entities";
2
+ export * from "./utils";
2
3
  export { FirebaseAPI } from "./firebase-api";
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
 
3
+ const clientTypesSchema = z.enum(["individual", "company"]);
3
4
  const StoreSchema = z.object({
4
5
  id: z.string(),
5
6
  companyId: z.string(),
@@ -10,5 +11,6 @@ const StoreSchema = z.object({
10
11
  paymentType: z.enum(["external", "j5"]),
11
12
  allowAnonymousClients: z.boolean(),
12
13
  isVatIncludedInPrice: z.boolean(),
14
+ clientTypes: z.array(clientTypesSchema),
13
15
  });
14
16
  export type TStore = z.infer<typeof StoreSchema>;
package/lib/index.tsx CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./entities";
2
+ export * from "./utils";
2
3
  export { FirebaseAPI } from "./firebase-api";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsdev_ninja/core",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "main": "dist/core.cjs.js",
5
5
  "module": "dist/core.es.js",
6
6
  "types": "dist/index.d.ts",