@jsdev_ninja/core 0.13.27 → 0.13.28

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.
Files changed (142) hide show
  1. package/dist/core.cjs.js +2 -0
  2. package/dist/core.cjs.js.map +1 -0
  3. package/dist/core.es.js +3614 -0
  4. package/dist/core.es.js.map +1 -0
  5. package/dist/core.umd.js +2 -0
  6. package/dist/core.umd.js.map +1 -0
  7. package/dist/lib/entities/Address.d.ts +28 -0
  8. package/dist/lib/entities/Address.d.ts.map +1 -0
  9. package/dist/lib/entities/Address.js +10 -0
  10. package/dist/lib/entities/Atoms.d.ts +16 -0
  11. package/dist/lib/entities/Atoms.d.ts.map +1 -0
  12. package/{lib/entities/Atoms.ts → dist/lib/entities/Atoms.js} +2 -6
  13. package/dist/lib/entities/Cart.d.ts +1278 -0
  14. package/dist/lib/entities/Cart.d.ts.map +1 -0
  15. package/dist/lib/entities/Cart.js +18 -0
  16. package/dist/lib/entities/Category.d.ts +103 -0
  17. package/dist/lib/entities/Category.d.ts.map +1 -0
  18. package/dist/lib/entities/Category.js +20 -0
  19. package/dist/lib/entities/Company.d.ts +16 -0
  20. package/dist/lib/entities/Company.d.ts.map +1 -0
  21. package/dist/lib/entities/Company.js +6 -0
  22. package/dist/lib/entities/DeliveryNote.d.ts +248 -0
  23. package/dist/lib/entities/DeliveryNote.d.ts.map +1 -0
  24. package/dist/lib/entities/DeliveryNote.js +61 -0
  25. package/dist/lib/entities/Discount/__tests__/engine.test.d.ts +2 -0
  26. package/dist/lib/entities/Discount/__tests__/engine.test.d.ts.map +1 -0
  27. package/dist/lib/entities/Discount/__tests__/engine.test.js +298 -0
  28. package/dist/lib/entities/Discount/__tests__/factory.test.d.ts +2 -0
  29. package/dist/lib/entities/Discount/__tests__/factory.test.d.ts.map +1 -0
  30. package/dist/lib/entities/Discount/__tests__/factory.test.js +75 -0
  31. package/dist/lib/entities/Discount/__tests__/integration.test.d.ts +2 -0
  32. package/dist/lib/entities/Discount/__tests__/integration.test.d.ts.map +1 -0
  33. package/dist/lib/entities/Discount/__tests__/integration.test.js +115 -0
  34. package/dist/lib/entities/Discount/__tests__/simple.test.d.ts +2 -0
  35. package/dist/lib/entities/Discount/__tests__/simple.test.d.ts.map +1 -0
  36. package/dist/lib/entities/Discount/__tests__/simple.test.js +186 -0
  37. package/dist/lib/entities/Discount/__tests__/utils.test.d.ts +2 -0
  38. package/dist/lib/entities/Discount/__tests__/utils.test.d.ts.map +1 -0
  39. package/dist/lib/entities/Discount/__tests__/utils.test.js +55 -0
  40. package/dist/lib/entities/Discount/engine.d.ts +29 -0
  41. package/dist/lib/entities/Discount/engine.d.ts.map +1 -0
  42. package/dist/lib/entities/Discount/engine.js +85 -0
  43. package/dist/lib/entities/Discount/factory.d.ts +10 -0
  44. package/dist/lib/entities/Discount/factory.d.ts.map +1 -0
  45. package/dist/lib/entities/Discount/factory.js +18 -0
  46. package/dist/lib/entities/Discount/index.d.ts +9 -0
  47. package/dist/lib/entities/Discount/index.d.ts.map +1 -0
  48. package/{lib/entities/Discount/index.ts → dist/lib/entities/Discount/index.js} +0 -2
  49. package/dist/lib/entities/Discount/strategies/BundleStrategy.d.ts +12 -0
  50. package/dist/lib/entities/Discount/strategies/BundleStrategy.d.ts.map +1 -0
  51. package/dist/lib/entities/Discount/strategies/BundleStrategy.js +78 -0
  52. package/dist/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.d.ts +2 -0
  53. package/dist/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.d.ts.map +1 -0
  54. package/dist/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.js +265 -0
  55. package/dist/lib/entities/Discount/strategy.d.ts +6 -0
  56. package/dist/lib/entities/Discount/strategy.d.ts.map +1 -0
  57. package/dist/lib/entities/Discount/types.d.ts +148 -0
  58. package/dist/lib/entities/Discount/types.d.ts.map +1 -0
  59. package/dist/lib/entities/Discount/types.js +29 -0
  60. package/dist/lib/entities/Discount/utils.d.ts +29 -0
  61. package/dist/lib/entities/Discount/utils.d.ts.map +1 -0
  62. package/{lib/entities/Discount/utils.ts → dist/lib/entities/Discount/utils.js} +12 -15
  63. package/dist/lib/entities/FavoriteProduct.d.ts +25 -0
  64. package/dist/lib/entities/FavoriteProduct.d.ts.map +1 -0
  65. package/dist/lib/entities/FavoriteProduct.js +9 -0
  66. package/dist/lib/entities/Invoice.d.ts +210 -0
  67. package/dist/lib/entities/Invoice.d.ts.map +1 -0
  68. package/dist/lib/entities/Invoice.js +49 -0
  69. package/dist/lib/entities/Locale.d.ts +22 -0
  70. package/dist/lib/entities/Locale.d.ts.map +1 -0
  71. package/{lib/entities/Locale.ts → dist/lib/entities/Locale.js} +2 -4
  72. package/dist/lib/entities/Order.d.ts +1806 -0
  73. package/dist/lib/entities/Order.d.ts.map +1 -0
  74. package/dist/lib/entities/Order.js +62 -0
  75. package/dist/lib/entities/Organization.d.ts +100 -0
  76. package/dist/lib/entities/Organization.d.ts.map +1 -0
  77. package/dist/lib/entities/Organization.js +16 -0
  78. package/dist/lib/entities/Product.d.ts +694 -0
  79. package/dist/lib/entities/Product.d.ts.map +1 -0
  80. package/dist/lib/entities/Product.js +61 -0
  81. package/dist/lib/entities/Profile.d.ts +98 -0
  82. package/dist/lib/entities/Profile.d.ts.map +1 -0
  83. package/dist/lib/entities/Profile.js +50 -0
  84. package/dist/lib/entities/Store.d.ts +93 -0
  85. package/dist/lib/entities/Store.d.ts.map +1 -0
  86. package/dist/lib/entities/Store.js +20 -0
  87. package/dist/lib/entities/index.d.ts +15 -0
  88. package/dist/lib/entities/index.d.ts.map +1 -0
  89. package/dist/lib/firebase-api/app.d.ts +2 -0
  90. package/dist/lib/firebase-api/app.d.ts.map +1 -0
  91. package/dist/lib/firebase-api/app.js +16 -0
  92. package/dist/lib/firebase-api/index.d.ts +75 -0
  93. package/dist/lib/firebase-api/index.d.ts.map +1 -0
  94. package/dist/lib/firebase-api/index.js +33 -0
  95. package/dist/lib/index.d.ts +4 -0
  96. package/dist/lib/index.d.ts.map +1 -0
  97. package/dist/lib/utils/index.d.ts +109 -0
  98. package/dist/lib/utils/index.d.ts.map +1 -0
  99. package/dist/lib/utils/index.js +95 -0
  100. package/dist/tsconfig.app.tsbuildinfo +1 -0
  101. package/dist/tsconfig.node.tsbuildinfo +1 -0
  102. package/dist/vite.config.d.ts +3 -0
  103. package/dist/vite.config.d.ts.map +1 -0
  104. package/dist/vite.config.js +25 -0
  105. package/package.json +8 -1
  106. package/eslint.config.js +0 -28
  107. package/index.html +0 -13
  108. package/lib/entities/Address.ts +0 -13
  109. package/lib/entities/Cart.ts +0 -24
  110. package/lib/entities/Category.ts +0 -35
  111. package/lib/entities/Company.ts +0 -9
  112. package/lib/entities/DeliveryNote.ts +0 -70
  113. package/lib/entities/Discount/__tests__/engine.test.ts +0 -337
  114. package/lib/entities/Discount/__tests__/factory.test.ts +0 -91
  115. package/lib/entities/Discount/__tests__/integration.test.ts +0 -132
  116. package/lib/entities/Discount/__tests__/simple.test.ts +0 -215
  117. package/lib/entities/Discount/__tests__/utils.test.ts +0 -69
  118. package/lib/entities/Discount/engine.ts +0 -138
  119. package/lib/entities/Discount/factory.ts +0 -25
  120. package/lib/entities/Discount/strategies/BundleStrategy.ts +0 -119
  121. package/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.ts +0 -295
  122. package/lib/entities/Discount/strategy.ts +0 -6
  123. package/lib/entities/Discount/types.ts +0 -68
  124. package/lib/entities/FavoriteProduct.ts +0 -12
  125. package/lib/entities/Invoice.ts +0 -57
  126. package/lib/entities/Order.ts +0 -67
  127. package/lib/entities/Organization.ts +0 -23
  128. package/lib/entities/Product.ts +0 -68
  129. package/lib/entities/Profile.ts +0 -56
  130. package/lib/entities/Store.ts +0 -24
  131. package/lib/firebase-api/app.ts +0 -18
  132. package/lib/firebase-api/index.ts +0 -46
  133. package/lib/utils/index.ts +0 -127
  134. package/src/vite-env.d.ts +0 -1
  135. package/tsconfig.app.json +0 -20
  136. package/tsconfig.json +0 -7
  137. package/tsconfig.node.json +0 -26
  138. package/vite.config.ts +0 -27
  139. package/vitest.config.ts +0 -10
  140. /package/{src/main.tsx → dist/lib/entities/Discount/strategy.js} +0 -0
  141. /package/{lib/entities/index.ts → dist/lib/entities/index.js} +0 -0
  142. /package/{lib/index.tsx → dist/lib/index.js} +0 -0
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ import { LocaleSchema } from "./Locale";
3
+ import { CategorySchema } from "./Category";
4
+ const text = z.string().min(1);
5
+ export const ProductSchema = z.object({
6
+ type: z.literal("Product"),
7
+ storeId: text,
8
+ companyId: text,
9
+ id: text,
10
+ objectID: text,
11
+ sku: text,
12
+ name: z.array(LocaleSchema),
13
+ description: z.array(LocaleSchema),
14
+ isPublished: z.boolean(),
15
+ vat: z.boolean(),
16
+ priceType: z.object({
17
+ type: z.enum(["unit", "kg", "gram", "liter", "ml"]),
18
+ value: z.number(),
19
+ }),
20
+ price: z.number().positive(),
21
+ purchasePrice: z.number().optional(),
22
+ profitPercentage: z.number().optional(),
23
+ currency: z.literal("ILS"),
24
+ discount: z.object({
25
+ type: z.enum(["number", "percent", "none"]),
26
+ value: z.number(),
27
+ }),
28
+ isDiscountable: z.boolean({ description: "included in store discounts" }).optional(),
29
+ weight: z.object({
30
+ value: z.number(),
31
+ unit: z.enum(["kg", "gram", "none"]),
32
+ }),
33
+ volume: z.object({
34
+ value: z.number(),
35
+ unit: z.enum(["liter", "ml", "none"]),
36
+ }),
37
+ images: z.array(z.object({ url: z.string().url(), id: z.string() })),
38
+ manufacturer: z.string(),
39
+ brand: z.string(),
40
+ importer: z.string(),
41
+ supplier: z.string(),
42
+ ingredients: z.array(LocaleSchema),
43
+ created_at: z.number(),
44
+ updated_at: z.number(),
45
+ categoryIds: z.array(z.string().nonempty()),
46
+ // @deprecated
47
+ categoryList: z.array(CategorySchema).optional(),
48
+ // @deprecated
49
+ categories: z.object({
50
+ lvl0: z.array(z.string()),
51
+ lvl1: z.array(z.string()),
52
+ lvl2: z.array(z.string()),
53
+ lvl3: z.array(z.string()),
54
+ lvl4: z.array(z.string()),
55
+ }).optional(),
56
+ // @deprecated
57
+ categoryNames: z.array(z.string()).optional(),
58
+ });
59
+ export const NewProductSchema = ProductSchema.extend({
60
+ image: z.instanceof(File).optional(),
61
+ });
@@ -0,0 +1,98 @@
1
+ import { z } from "zod";
2
+ export declare const ProfilePaymentTypeSchema: z.ZodEnum<["default", "delayed"]>;
3
+ export type TProfilePaymentType = z.infer<typeof ProfilePaymentTypeSchema>;
4
+ export declare const ProfileSchema: z.ZodObject<{
5
+ type: z.ZodLiteral<"Profile">;
6
+ id: z.ZodString;
7
+ companyId: z.ZodString;
8
+ storeId: z.ZodString;
9
+ tenantId: z.ZodString;
10
+ clientType: z.ZodEnum<["user", "company"]>;
11
+ companyName: z.ZodOptional<z.ZodString>;
12
+ displayName: z.ZodString;
13
+ email: z.ZodString;
14
+ phoneNumber: z.ZodOptional<z.ZodString>;
15
+ address: z.ZodOptional<z.ZodObject<{
16
+ country: z.ZodOptional<z.ZodString>;
17
+ city: z.ZodOptional<z.ZodString>;
18
+ street: z.ZodOptional<z.ZodString>;
19
+ streetNumber: z.ZodOptional<z.ZodString>;
20
+ floor: z.ZodOptional<z.ZodString>;
21
+ apartmentEnterNumber: z.ZodOptional<z.ZodString>;
22
+ apartmentNumber: z.ZodOptional<z.ZodString>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ country?: string | undefined;
25
+ city?: string | undefined;
26
+ street?: string | undefined;
27
+ streetNumber?: string | undefined;
28
+ floor?: string | undefined;
29
+ apartmentEnterNumber?: string | undefined;
30
+ apartmentNumber?: string | undefined;
31
+ }, {
32
+ country?: string | undefined;
33
+ city?: string | undefined;
34
+ street?: string | undefined;
35
+ streetNumber?: string | undefined;
36
+ floor?: string | undefined;
37
+ apartmentEnterNumber?: string | undefined;
38
+ apartmentNumber?: string | undefined;
39
+ }>>;
40
+ isAnonymous: z.ZodBoolean;
41
+ createdDate: z.ZodNumber;
42
+ lastActivityDate: z.ZodNumber;
43
+ paymentType: z.ZodEnum<["default", "delayed"]>;
44
+ organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
45
+ }, "strip", z.ZodTypeAny, {
46
+ type: "Profile";
47
+ id: string;
48
+ companyId: string;
49
+ storeId: string;
50
+ tenantId: string;
51
+ clientType: "user" | "company";
52
+ displayName: string;
53
+ email: string;
54
+ isAnonymous: boolean;
55
+ createdDate: number;
56
+ lastActivityDate: number;
57
+ paymentType: "default" | "delayed";
58
+ companyName?: string | undefined;
59
+ phoneNumber?: string | undefined;
60
+ address?: {
61
+ country?: string | undefined;
62
+ city?: string | undefined;
63
+ street?: string | undefined;
64
+ streetNumber?: string | undefined;
65
+ floor?: string | undefined;
66
+ apartmentEnterNumber?: string | undefined;
67
+ apartmentNumber?: string | undefined;
68
+ } | undefined;
69
+ organizationId?: string | null | undefined;
70
+ }, {
71
+ type: "Profile";
72
+ id: string;
73
+ companyId: string;
74
+ storeId: string;
75
+ tenantId: string;
76
+ clientType: "user" | "company";
77
+ displayName: string;
78
+ email: string;
79
+ isAnonymous: boolean;
80
+ createdDate: number;
81
+ lastActivityDate: number;
82
+ paymentType: "default" | "delayed";
83
+ companyName?: string | undefined;
84
+ phoneNumber?: string | undefined;
85
+ address?: {
86
+ country?: string | undefined;
87
+ city?: string | undefined;
88
+ street?: string | undefined;
89
+ streetNumber?: string | undefined;
90
+ floor?: string | undefined;
91
+ apartmentEnterNumber?: string | undefined;
92
+ apartmentNumber?: string | undefined;
93
+ } | undefined;
94
+ organizationId?: string | null | undefined;
95
+ }>;
96
+ export type TProfile = z.infer<typeof ProfileSchema>;
97
+ export declare function createEmptyProfile(): TProfile;
98
+ //# sourceMappingURL=Profile.d.ts.map
@@ -0,0 +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,mCAEnC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,wBAAgB,kBAAkB,IAAI,QAAQ,CAyB7C"}
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ import { AddressSchema } from "./Address";
3
+ import { notEmptyTextSchema } from "./Atoms";
4
+ export const ProfilePaymentTypeSchema = z.enum(["default", "delayed"], {
5
+ description: "delayed is J5 transaction",
6
+ });
7
+ export const ProfileSchema = z.object({
8
+ type: z.literal("Profile"),
9
+ id: notEmptyTextSchema,
10
+ companyId: notEmptyTextSchema,
11
+ storeId: notEmptyTextSchema,
12
+ tenantId: notEmptyTextSchema,
13
+ clientType: z.enum(["user", "company"]),
14
+ companyName: z.string().optional(),
15
+ displayName: notEmptyTextSchema,
16
+ email: z.string().email(),
17
+ phoneNumber: z.string().optional(),
18
+ address: AddressSchema.optional(),
19
+ isAnonymous: z.boolean(),
20
+ createdDate: z.number(),
21
+ lastActivityDate: z.number(),
22
+ paymentType: ProfilePaymentTypeSchema,
23
+ organizationId: z.string().optional().nullable(),
24
+ });
25
+ export function createEmptyProfile() {
26
+ return {
27
+ type: "Profile",
28
+ id: "",
29
+ companyId: "",
30
+ storeId: "",
31
+ tenantId: "",
32
+ clientType: "user",
33
+ displayName: "",
34
+ email: "",
35
+ phoneNumber: "",
36
+ address: {
37
+ country: "",
38
+ city: "",
39
+ street: "",
40
+ streetNumber: "",
41
+ floor: "",
42
+ apartmentEnterNumber: "",
43
+ apartmentNumber: "",
44
+ },
45
+ createdDate: 0,
46
+ lastActivityDate: 0,
47
+ isAnonymous: true,
48
+ paymentType: ProfilePaymentTypeSchema.Values.default,
49
+ };
50
+ }
@@ -0,0 +1,93 @@
1
+ import { z } from "zod";
2
+ export declare const clientTypesSchema: z.ZodEnum<["individual", "company"]>;
3
+ export declare const StoreSchema: z.ZodObject<{
4
+ id: z.ZodString;
5
+ companyId: z.ZodString;
6
+ name: z.ZodString;
7
+ urls: z.ZodArray<z.ZodString, "many">;
8
+ logoUrl: z.ZodString;
9
+ tenantId: z.ZodString;
10
+ paymentType: z.ZodEnum<["external", "j5"]>;
11
+ allowAnonymousClients: z.ZodBoolean;
12
+ isVatIncludedInPrice: z.ZodBoolean;
13
+ clientTypes: z.ZodArray<z.ZodEnum<["individual", "company"]>, "many">;
14
+ minimumOrder: z.ZodOptional<z.ZodNumber>;
15
+ freeDeliveryPrice: z.ZodOptional<z.ZodNumber>;
16
+ deliveryPrice: z.ZodOptional<z.ZodNumber>;
17
+ address: z.ZodOptional<z.ZodObject<{
18
+ country: z.ZodOptional<z.ZodString>;
19
+ city: z.ZodOptional<z.ZodString>;
20
+ street: z.ZodOptional<z.ZodString>;
21
+ streetNumber: z.ZodOptional<z.ZodString>;
22
+ floor: z.ZodOptional<z.ZodString>;
23
+ apartmentEnterNumber: z.ZodOptional<z.ZodString>;
24
+ apartmentNumber: z.ZodOptional<z.ZodString>;
25
+ }, "strip", z.ZodTypeAny, {
26
+ country?: string | undefined;
27
+ city?: string | undefined;
28
+ street?: string | undefined;
29
+ streetNumber?: string | undefined;
30
+ floor?: string | undefined;
31
+ apartmentEnterNumber?: string | undefined;
32
+ apartmentNumber?: string | undefined;
33
+ }, {
34
+ country?: string | undefined;
35
+ city?: string | undefined;
36
+ street?: string | undefined;
37
+ streetNumber?: string | undefined;
38
+ floor?: string | undefined;
39
+ apartmentEnterNumber?: string | undefined;
40
+ apartmentNumber?: string | undefined;
41
+ }>>;
42
+ companyNumber: z.ZodOptional<z.ZodString>;
43
+ }, "strip", z.ZodTypeAny, {
44
+ id: string;
45
+ companyId: string;
46
+ name: string;
47
+ tenantId: string;
48
+ paymentType: "external" | "j5";
49
+ isVatIncludedInPrice: boolean;
50
+ urls: string[];
51
+ logoUrl: string;
52
+ allowAnonymousClients: boolean;
53
+ clientTypes: ("company" | "individual")[];
54
+ address?: {
55
+ country?: string | undefined;
56
+ city?: string | undefined;
57
+ street?: string | undefined;
58
+ streetNumber?: string | undefined;
59
+ floor?: string | undefined;
60
+ apartmentEnterNumber?: string | undefined;
61
+ apartmentNumber?: string | undefined;
62
+ } | undefined;
63
+ deliveryPrice?: number | undefined;
64
+ freeDeliveryPrice?: number | undefined;
65
+ minimumOrder?: number | undefined;
66
+ companyNumber?: string | undefined;
67
+ }, {
68
+ id: string;
69
+ companyId: string;
70
+ name: string;
71
+ tenantId: string;
72
+ paymentType: "external" | "j5";
73
+ isVatIncludedInPrice: boolean;
74
+ urls: string[];
75
+ logoUrl: string;
76
+ allowAnonymousClients: boolean;
77
+ clientTypes: ("company" | "individual")[];
78
+ address?: {
79
+ country?: string | undefined;
80
+ city?: string | undefined;
81
+ street?: string | undefined;
82
+ streetNumber?: string | undefined;
83
+ floor?: string | undefined;
84
+ apartmentEnterNumber?: string | undefined;
85
+ apartmentNumber?: string | undefined;
86
+ } | undefined;
87
+ deliveryPrice?: number | undefined;
88
+ freeDeliveryPrice?: number | undefined;
89
+ minimumOrder?: number | undefined;
90
+ companyNumber?: string | undefined;
91
+ }>;
92
+ export type TStore = z.infer<typeof StoreSchema>;
93
+ //# sourceMappingURL=Store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Store.d.ts","sourceRoot":"","sources":["../../../lib/entities/Store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,iBAAiB,sCAAoC,CAAC;AAEnE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBtB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import { AddressSchema } from "./Address";
3
+ export const clientTypesSchema = z.enum(["individual", "company"]);
4
+ export const StoreSchema = z.object({
5
+ id: z.string(),
6
+ companyId: z.string(),
7
+ name: z.string(),
8
+ urls: z.array(z.string()),
9
+ logoUrl: z.string(),
10
+ tenantId: z.string(), // firebase auth tenantId
11
+ paymentType: z.enum(["external", "j5"]),
12
+ allowAnonymousClients: z.boolean(),
13
+ isVatIncludedInPrice: z.boolean(),
14
+ clientTypes: z.array(clientTypesSchema),
15
+ minimumOrder: z.number().optional(),
16
+ freeDeliveryPrice: z.number().optional(),
17
+ deliveryPrice: z.number().optional(),
18
+ address: AddressSchema.optional(),
19
+ companyNumber: z.string().optional(), // חפ של החברה
20
+ });
@@ -0,0 +1,15 @@
1
+ export * from "./Address";
2
+ export * from "./Atoms";
3
+ export * from "./Cart";
4
+ export * from "./Category";
5
+ export * from "./Company";
6
+ export * from "./FavoriteProduct";
7
+ export * from "./Locale";
8
+ export * from "./Order";
9
+ export * from "./Product";
10
+ export * from "./Profile";
11
+ export * from "./Store";
12
+ export * from "./Discount";
13
+ export * from "./Organization";
14
+ export * from "./DeliveryNote";
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const app: import("@firebase/app").FirebaseApp;
2
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../lib/firebase-api/app.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,GAAG,qCAAgC,CAAC"}
@@ -0,0 +1,16 @@
1
+ // Import the functions you need from the SDKs you need
2
+ import { initializeApp } from "firebase/app";
3
+ // Your web app's Firebase configuration
4
+ // For Firebase JS SDK v7.20.0 and later, measurementId is optional
5
+ const firebaseConfig = {
6
+ apiKey: "AIzaSyAXtA4pdBs7GLX45lK3jYZRiUwo7M06-_s",
7
+ authDomain: "jsdev-stores-prod.firebaseapp.com",
8
+ projectId: "jsdev-stores-prod",
9
+ storageBucket: "jsdev-stores-prod.appspot.com",
10
+ messagingSenderId: "333321054844",
11
+ appId: "1:333321054844:web:7d3c15617daa54107537f9",
12
+ measurementId: "G-CJ44QNETK8",
13
+ };
14
+ // Initialize Firebase
15
+ export const app = initializeApp(firebaseConfig);
16
+ // TESTER
@@ -0,0 +1,75 @@
1
+ export declare const systemCollections: {
2
+ readonly stores: "STORES";
3
+ readonly companies: "COMPANIES";
4
+ };
5
+ export declare const storeCollections: {
6
+ readonly products: "products";
7
+ readonly profiles: "profiles";
8
+ readonly cart: "cart";
9
+ readonly clients: "clients";
10
+ readonly orders: "orders";
11
+ readonly categories: "categories";
12
+ readonly favorites: "favorites";
13
+ readonly payments: "payments";
14
+ readonly settings: "settings";
15
+ readonly discounts: "discounts";
16
+ readonly organizations: "organizations";
17
+ readonly invoices: "invoices";
18
+ };
19
+ export declare const FirestoreApi: {
20
+ systemCollections: {
21
+ readonly stores: "STORES";
22
+ readonly companies: "COMPANIES";
23
+ };
24
+ storeCollections: {
25
+ readonly products: "products";
26
+ readonly profiles: "profiles";
27
+ readonly cart: "cart";
28
+ readonly clients: "clients";
29
+ readonly orders: "orders";
30
+ readonly categories: "categories";
31
+ readonly favorites: "favorites";
32
+ readonly payments: "payments";
33
+ readonly settings: "settings";
34
+ readonly discounts: "discounts";
35
+ readonly organizations: "organizations";
36
+ readonly invoices: "invoices";
37
+ };
38
+ getPath: ({ companyId, storeId, collectionName, id, }: {
39
+ companyId: string;
40
+ storeId: string;
41
+ collectionName: keyof typeof storeCollections;
42
+ id?: string;
43
+ }) => string;
44
+ getDocPath: (collectionName: keyof typeof storeCollections) => string;
45
+ };
46
+ export declare const FirebaseAPI: {
47
+ firestore: {
48
+ systemCollections: {
49
+ readonly stores: "STORES";
50
+ readonly companies: "COMPANIES";
51
+ };
52
+ storeCollections: {
53
+ readonly products: "products";
54
+ readonly profiles: "profiles";
55
+ readonly cart: "cart";
56
+ readonly clients: "clients";
57
+ readonly orders: "orders";
58
+ readonly categories: "categories";
59
+ readonly favorites: "favorites";
60
+ readonly payments: "payments";
61
+ readonly settings: "settings";
62
+ readonly discounts: "discounts";
63
+ readonly organizations: "organizations";
64
+ readonly invoices: "invoices";
65
+ };
66
+ getPath: ({ companyId, storeId, collectionName, id, }: {
67
+ companyId: string;
68
+ storeId: string;
69
+ collectionName: keyof typeof storeCollections;
70
+ id?: string;
71
+ }) => string;
72
+ getDocPath: (collectionName: keyof typeof storeCollections) => string;
73
+ };
74
+ };
75
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/firebase-api/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AAEX,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAanB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;2DASrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;QAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;KACZ;iCAI4B,MAAM,OAAO,gBAAgB;CAG1D,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;+DAdpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,gBAAgB,CAAC;YAC9C,EAAE,CAAC,EAAE,MAAM,CAAC;SACZ;qCAI4B,MAAM,OAAO,gBAAgB;;CAO1D,CAAC"}
@@ -0,0 +1,33 @@
1
+ export const systemCollections = {
2
+ stores: "STORES",
3
+ companies: "COMPANIES",
4
+ };
5
+ export const storeCollections = {
6
+ products: "products",
7
+ profiles: "profiles",
8
+ cart: "cart",
9
+ clients: "clients",
10
+ orders: "orders",
11
+ categories: "categories",
12
+ favorites: "favorites",
13
+ payments: "payments",
14
+ settings: "settings",
15
+ discounts: "discounts",
16
+ organizations: "organizations",
17
+ invoices: "invoices",
18
+ };
19
+ export const FirestoreApi = {
20
+ systemCollections,
21
+ storeCollections,
22
+ // for client and server
23
+ getPath: ({ companyId, storeId, collectionName, id, }) => {
24
+ return `${companyId}/${storeId}/${collectionName}${id ? `/${id}` : ""}`;
25
+ },
26
+ // for firestore events
27
+ getDocPath: (collectionName) => {
28
+ return `{companyId}/{storeId}/${collectionName}/{id}`;
29
+ },
30
+ };
31
+ export const FirebaseAPI = {
32
+ firestore: FirestoreApi,
33
+ };
@@ -0,0 +1,4 @@
1
+ export * from "./entities";
2
+ export * from "./utils";
3
+ export { FirebaseAPI } from "./firebase-api";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,109 @@
1
+ import { TCart, TDiscount } from "../entities";
2
+ export declare function getCartCost({ cart, discounts, deliveryPrice, freeDeliveryPrice, isVatIncludedInPrice, }: {
3
+ cart: TCart["items"];
4
+ discounts: TDiscount[];
5
+ deliveryPrice?: number;
6
+ freeDeliveryPrice?: number;
7
+ isVatIncludedInPrice?: boolean;
8
+ }): {
9
+ discount: number;
10
+ cost: number;
11
+ finalCost: number;
12
+ vat: number;
13
+ productsCost: number;
14
+ deliveryPrice: number;
15
+ items: {
16
+ amount: number;
17
+ product: {
18
+ type: "Product";
19
+ id: string;
20
+ companyId: string;
21
+ storeId: string;
22
+ objectID: string;
23
+ sku: string;
24
+ name: {
25
+ value: string;
26
+ lang: "he";
27
+ }[];
28
+ description: {
29
+ value: string;
30
+ lang: "he";
31
+ }[];
32
+ isPublished: boolean;
33
+ vat: boolean;
34
+ priceType: {
35
+ value: number;
36
+ type: "unit" | "kg" | "gram" | "liter" | "ml";
37
+ };
38
+ price: number;
39
+ currency: "ILS";
40
+ discount: {
41
+ value: number;
42
+ type: "number" | "percent" | "none";
43
+ };
44
+ weight: {
45
+ value: number;
46
+ unit: "kg" | "gram" | "none";
47
+ };
48
+ volume: {
49
+ value: number;
50
+ unit: "liter" | "ml" | "none";
51
+ };
52
+ images: {
53
+ url: string;
54
+ id: string;
55
+ }[];
56
+ manufacturer: string;
57
+ brand: string;
58
+ importer: string;
59
+ supplier: string;
60
+ ingredients: {
61
+ value: string;
62
+ lang: "he";
63
+ }[];
64
+ created_at: number;
65
+ updated_at: number;
66
+ categoryIds: string[];
67
+ purchasePrice?: number | undefined;
68
+ profitPercentage?: number | undefined;
69
+ isDiscountable?: boolean | undefined;
70
+ categoryList?: ({
71
+ id: string;
72
+ companyId: string;
73
+ storeId: string;
74
+ locales: {
75
+ value: string;
76
+ lang: "he";
77
+ }[];
78
+ depth: number;
79
+ parentId?: string | null | undefined;
80
+ tag?: string | undefined;
81
+ } & {
82
+ children: ({
83
+ id: string;
84
+ companyId: string;
85
+ storeId: string;
86
+ locales: {
87
+ value: string;
88
+ lang: "he";
89
+ }[];
90
+ depth: number;
91
+ parentId?: string | null | undefined;
92
+ tag?: string | undefined;
93
+ } & /*elided*/ any)[];
94
+ })[] | undefined;
95
+ categories?: {
96
+ lvl0: string[];
97
+ lvl1: string[];
98
+ lvl2: string[];
99
+ lvl3: string[];
100
+ lvl4: string[];
101
+ } | undefined;
102
+ categoryNames?: string[] | undefined;
103
+ };
104
+ originalPrice: number;
105
+ finalPrice: number;
106
+ finalDiscount: number;
107
+ }[];
108
+ };
109
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AA8BjE,wBAAgB,WAAW,CAAC,EAC3B,IAAI,EACJ,SAAS,EACT,aAAiB,EACjB,iBAAqB,EACrB,oBAA4B,GAC5B,EAAE;IACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACrB,SAAS,EAAE,SAAS,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAC/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoFA"}