@jsdev_ninja/core 0.13.27 → 0.13.29
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 +2 -0
- package/dist/core.cjs.js.map +1 -0
- package/dist/core.es.js +3584 -0
- package/dist/core.es.js.map +1 -0
- package/dist/core.umd.js +2 -0
- package/dist/core.umd.js.map +1 -0
- package/dist/lib/entities/Address.d.ts +28 -0
- package/dist/lib/entities/Address.d.ts.map +1 -0
- package/dist/lib/entities/Address.js +10 -0
- package/dist/lib/entities/Atoms.d.ts +16 -0
- package/dist/lib/entities/Atoms.d.ts.map +1 -0
- package/{lib/entities/Atoms.ts → dist/lib/entities/Atoms.js} +2 -6
- package/dist/lib/entities/Cart.d.ts +1278 -0
- package/dist/lib/entities/Cart.d.ts.map +1 -0
- package/dist/lib/entities/Cart.js +18 -0
- package/dist/lib/entities/Category.d.ts +103 -0
- package/dist/lib/entities/Category.d.ts.map +1 -0
- package/dist/lib/entities/Category.js +20 -0
- package/dist/lib/entities/Company.d.ts +16 -0
- package/dist/lib/entities/Company.d.ts.map +1 -0
- package/dist/lib/entities/Company.js +6 -0
- package/dist/lib/entities/DeliveryNote.d.ts +248 -0
- package/dist/lib/entities/DeliveryNote.d.ts.map +1 -0
- package/dist/lib/entities/DeliveryNote.js +61 -0
- package/dist/lib/entities/Discount/__tests__/engine.test.d.ts +2 -0
- package/dist/lib/entities/Discount/__tests__/engine.test.d.ts.map +1 -0
- package/dist/lib/entities/Discount/__tests__/engine.test.js +298 -0
- package/dist/lib/entities/Discount/__tests__/factory.test.d.ts +2 -0
- package/dist/lib/entities/Discount/__tests__/factory.test.d.ts.map +1 -0
- package/dist/lib/entities/Discount/__tests__/factory.test.js +75 -0
- package/dist/lib/entities/Discount/__tests__/integration.test.d.ts +2 -0
- package/dist/lib/entities/Discount/__tests__/integration.test.d.ts.map +1 -0
- package/dist/lib/entities/Discount/__tests__/integration.test.js +115 -0
- package/dist/lib/entities/Discount/__tests__/simple.test.d.ts +2 -0
- package/dist/lib/entities/Discount/__tests__/simple.test.d.ts.map +1 -0
- package/dist/lib/entities/Discount/__tests__/simple.test.js +186 -0
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts +2 -0
- package/dist/lib/entities/Discount/__tests__/utils.test.d.ts.map +1 -0
- package/dist/lib/entities/Discount/__tests__/utils.test.js +55 -0
- package/dist/lib/entities/Discount/engine.d.ts +29 -0
- package/dist/lib/entities/Discount/engine.d.ts.map +1 -0
- package/dist/lib/entities/Discount/engine.js +85 -0
- package/dist/lib/entities/Discount/factory.d.ts +10 -0
- package/dist/lib/entities/Discount/factory.d.ts.map +1 -0
- package/dist/lib/entities/Discount/factory.js +18 -0
- package/dist/lib/entities/Discount/index.d.ts +9 -0
- package/dist/lib/entities/Discount/index.d.ts.map +1 -0
- package/{lib/entities/Discount/index.ts → dist/lib/entities/Discount/index.js} +0 -2
- package/dist/lib/entities/Discount/strategies/BundleStrategy.d.ts +12 -0
- package/dist/lib/entities/Discount/strategies/BundleStrategy.d.ts.map +1 -0
- package/dist/lib/entities/Discount/strategies/BundleStrategy.js +78 -0
- package/dist/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.d.ts +2 -0
- package/dist/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.d.ts.map +1 -0
- package/dist/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.js +265 -0
- package/dist/lib/entities/Discount/strategy.d.ts +6 -0
- package/dist/lib/entities/Discount/strategy.d.ts.map +1 -0
- package/dist/lib/entities/Discount/types.d.ts +148 -0
- package/dist/lib/entities/Discount/types.d.ts.map +1 -0
- package/dist/lib/entities/Discount/types.js +29 -0
- package/dist/lib/entities/Discount/utils.d.ts +29 -0
- package/dist/lib/entities/Discount/utils.d.ts.map +1 -0
- package/{lib/entities/Discount/utils.ts → dist/lib/entities/Discount/utils.js} +12 -15
- package/dist/lib/entities/FavoriteProduct.d.ts +25 -0
- package/dist/lib/entities/FavoriteProduct.d.ts.map +1 -0
- package/dist/lib/entities/FavoriteProduct.js +9 -0
- package/dist/lib/entities/Invoice.d.ts +210 -0
- package/dist/lib/entities/Invoice.d.ts.map +1 -0
- package/dist/lib/entities/Invoice.js +49 -0
- package/dist/lib/entities/Locale.d.ts +22 -0
- package/dist/lib/entities/Locale.d.ts.map +1 -0
- package/{lib/entities/Locale.ts → dist/lib/entities/Locale.js} +2 -4
- package/dist/lib/entities/Order.d.ts +1806 -0
- package/dist/lib/entities/Order.d.ts.map +1 -0
- package/dist/lib/entities/Order.js +63 -0
- package/dist/lib/entities/Organization.d.ts +100 -0
- package/dist/lib/entities/Organization.d.ts.map +1 -0
- package/dist/lib/entities/Organization.js +17 -0
- package/dist/lib/entities/Payment/index.d.ts +4 -0
- package/dist/lib/entities/Payment/index.d.ts.map +1 -0
- package/dist/lib/entities/Payment/index.js +4 -0
- package/dist/lib/entities/Product.d.ts +694 -0
- package/dist/lib/entities/Product.d.ts.map +1 -0
- package/dist/lib/entities/Product.js +61 -0
- package/dist/lib/entities/Profile.d.ts +95 -0
- package/dist/lib/entities/Profile.d.ts.map +1 -0
- package/dist/lib/entities/Profile.js +22 -0
- package/dist/lib/entities/Store.d.ts +93 -0
- package/dist/lib/entities/Store.d.ts.map +1 -0
- package/dist/lib/entities/Store.js +21 -0
- package/dist/lib/entities/index.d.ts +16 -0
- package/dist/lib/entities/index.d.ts.map +1 -0
- package/{lib/entities/index.ts → dist/lib/entities/index.js} +1 -0
- package/dist/lib/firebase-api/app.d.ts +2 -0
- package/dist/lib/firebase-api/app.d.ts.map +1 -0
- package/dist/lib/firebase-api/app.js +16 -0
- package/dist/lib/firebase-api/index.d.ts +75 -0
- package/dist/lib/firebase-api/index.d.ts.map +1 -0
- package/dist/lib/firebase-api/index.js +33 -0
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/utils/index.d.ts +109 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/index.js +95 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -0
- package/dist/tsconfig.node.tsbuildinfo +1 -0
- package/dist/vite.config.d.ts +3 -0
- package/dist/vite.config.d.ts.map +1 -0
- package/dist/vite.config.js +25 -0
- package/package.json +8 -1
- package/eslint.config.js +0 -28
- package/index.html +0 -13
- package/lib/entities/Address.ts +0 -13
- package/lib/entities/Cart.ts +0 -24
- package/lib/entities/Category.ts +0 -35
- package/lib/entities/Company.ts +0 -9
- package/lib/entities/DeliveryNote.ts +0 -70
- package/lib/entities/Discount/__tests__/engine.test.ts +0 -337
- package/lib/entities/Discount/__tests__/factory.test.ts +0 -91
- package/lib/entities/Discount/__tests__/integration.test.ts +0 -132
- package/lib/entities/Discount/__tests__/simple.test.ts +0 -215
- package/lib/entities/Discount/__tests__/utils.test.ts +0 -69
- package/lib/entities/Discount/engine.ts +0 -138
- package/lib/entities/Discount/factory.ts +0 -25
- package/lib/entities/Discount/strategies/BundleStrategy.ts +0 -119
- package/lib/entities/Discount/strategies/__tests__/BundleStrategy.test.ts +0 -295
- package/lib/entities/Discount/strategy.ts +0 -6
- package/lib/entities/Discount/types.ts +0 -68
- package/lib/entities/FavoriteProduct.ts +0 -12
- package/lib/entities/Invoice.ts +0 -57
- package/lib/entities/Order.ts +0 -67
- package/lib/entities/Organization.ts +0 -23
- package/lib/entities/Product.ts +0 -68
- package/lib/entities/Profile.ts +0 -56
- package/lib/entities/Store.ts +0 -24
- package/lib/firebase-api/app.ts +0 -18
- package/lib/firebase-api/index.ts +0 -46
- package/lib/utils/index.ts +0 -127
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.app.json +0 -20
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -26
- package/vite.config.ts +0 -27
- package/vitest.config.ts +0 -10
- /package/{src/main.tsx → dist/lib/entities/Discount/strategy.js} +0 -0
- /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,95 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ProfileSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"Profile">;
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
companyId: z.ZodString;
|
|
6
|
+
storeId: z.ZodString;
|
|
7
|
+
tenantId: z.ZodString;
|
|
8
|
+
clientType: z.ZodEnum<["user", "company"]>;
|
|
9
|
+
companyName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
displayName: z.ZodString;
|
|
11
|
+
email: z.ZodString;
|
|
12
|
+
phoneNumber: z.ZodOptional<z.ZodString>;
|
|
13
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
country: z.ZodOptional<z.ZodString>;
|
|
15
|
+
city: z.ZodOptional<z.ZodString>;
|
|
16
|
+
street: z.ZodOptional<z.ZodString>;
|
|
17
|
+
streetNumber: z.ZodOptional<z.ZodString>;
|
|
18
|
+
floor: z.ZodOptional<z.ZodString>;
|
|
19
|
+
apartmentEnterNumber: z.ZodOptional<z.ZodString>;
|
|
20
|
+
apartmentNumber: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
country?: string | undefined;
|
|
23
|
+
city?: string | undefined;
|
|
24
|
+
street?: string | undefined;
|
|
25
|
+
streetNumber?: string | undefined;
|
|
26
|
+
floor?: string | undefined;
|
|
27
|
+
apartmentEnterNumber?: string | undefined;
|
|
28
|
+
apartmentNumber?: string | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
country?: string | undefined;
|
|
31
|
+
city?: string | undefined;
|
|
32
|
+
street?: string | undefined;
|
|
33
|
+
streetNumber?: string | undefined;
|
|
34
|
+
floor?: string | undefined;
|
|
35
|
+
apartmentEnterNumber?: string | undefined;
|
|
36
|
+
apartmentNumber?: string | undefined;
|
|
37
|
+
}>>;
|
|
38
|
+
isAnonymous: z.ZodBoolean;
|
|
39
|
+
createdDate: z.ZodNumber;
|
|
40
|
+
lastActivityDate: z.ZodNumber;
|
|
41
|
+
paymentType: z.ZodEnum<["external", "j5"]>;
|
|
42
|
+
organizationId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
type: "Profile";
|
|
45
|
+
id: string;
|
|
46
|
+
companyId: string;
|
|
47
|
+
storeId: string;
|
|
48
|
+
tenantId: string;
|
|
49
|
+
clientType: "user" | "company";
|
|
50
|
+
displayName: string;
|
|
51
|
+
email: string;
|
|
52
|
+
isAnonymous: boolean;
|
|
53
|
+
createdDate: number;
|
|
54
|
+
lastActivityDate: number;
|
|
55
|
+
paymentType: "external" | "j5";
|
|
56
|
+
companyName?: string | undefined;
|
|
57
|
+
phoneNumber?: string | undefined;
|
|
58
|
+
address?: {
|
|
59
|
+
country?: string | undefined;
|
|
60
|
+
city?: string | undefined;
|
|
61
|
+
street?: string | undefined;
|
|
62
|
+
streetNumber?: string | undefined;
|
|
63
|
+
floor?: string | undefined;
|
|
64
|
+
apartmentEnterNumber?: string | undefined;
|
|
65
|
+
apartmentNumber?: string | undefined;
|
|
66
|
+
} | undefined;
|
|
67
|
+
organizationId?: string | null | undefined;
|
|
68
|
+
}, {
|
|
69
|
+
type: "Profile";
|
|
70
|
+
id: string;
|
|
71
|
+
companyId: string;
|
|
72
|
+
storeId: string;
|
|
73
|
+
tenantId: string;
|
|
74
|
+
clientType: "user" | "company";
|
|
75
|
+
displayName: string;
|
|
76
|
+
email: string;
|
|
77
|
+
isAnonymous: boolean;
|
|
78
|
+
createdDate: number;
|
|
79
|
+
lastActivityDate: number;
|
|
80
|
+
paymentType: "external" | "j5";
|
|
81
|
+
companyName?: string | undefined;
|
|
82
|
+
phoneNumber?: string | undefined;
|
|
83
|
+
address?: {
|
|
84
|
+
country?: string | undefined;
|
|
85
|
+
city?: string | undefined;
|
|
86
|
+
street?: string | undefined;
|
|
87
|
+
streetNumber?: string | undefined;
|
|
88
|
+
floor?: string | undefined;
|
|
89
|
+
apartmentEnterNumber?: string | undefined;
|
|
90
|
+
apartmentNumber?: string | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
organizationId?: string | null | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
export type TProfile = z.infer<typeof ProfileSchema>;
|
|
95
|
+
//# 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;AAKxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AddressSchema } from "./Address";
|
|
3
|
+
import { notEmptyTextSchema } from "./Atoms";
|
|
4
|
+
import { PaymentTypeSchema } from "./Payment";
|
|
5
|
+
export const ProfileSchema = z.object({
|
|
6
|
+
type: z.literal("Profile"),
|
|
7
|
+
id: notEmptyTextSchema,
|
|
8
|
+
companyId: notEmptyTextSchema,
|
|
9
|
+
storeId: notEmptyTextSchema,
|
|
10
|
+
tenantId: notEmptyTextSchema,
|
|
11
|
+
clientType: z.enum(["user", "company"]),
|
|
12
|
+
companyName: z.string().optional(),
|
|
13
|
+
displayName: notEmptyTextSchema,
|
|
14
|
+
email: z.string().email(),
|
|
15
|
+
phoneNumber: z.string().optional(),
|
|
16
|
+
address: AddressSchema.optional(),
|
|
17
|
+
isAnonymous: z.boolean(),
|
|
18
|
+
createdDate: z.number(),
|
|
19
|
+
lastActivityDate: z.number(),
|
|
20
|
+
paymentType: PaymentTypeSchema,
|
|
21
|
+
organizationId: z.string().optional().nullable(),
|
|
22
|
+
});
|
|
@@ -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;AAIxB,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,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AddressSchema } from "./Address";
|
|
3
|
+
import { PaymentTypeSchema } from "./Payment";
|
|
4
|
+
export const clientTypesSchema = z.enum(["individual", "company"]);
|
|
5
|
+
export const StoreSchema = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
companyId: z.string(),
|
|
8
|
+
name: z.string(),
|
|
9
|
+
urls: z.array(z.string()),
|
|
10
|
+
logoUrl: z.string(),
|
|
11
|
+
tenantId: z.string(), // firebase auth tenantId
|
|
12
|
+
paymentType: PaymentTypeSchema,
|
|
13
|
+
allowAnonymousClients: z.boolean(),
|
|
14
|
+
isVatIncludedInPrice: z.boolean(),
|
|
15
|
+
clientTypes: z.array(clientTypesSchema),
|
|
16
|
+
minimumOrder: z.number().optional(),
|
|
17
|
+
freeDeliveryPrice: z.number().optional(),
|
|
18
|
+
deliveryPrice: z.number().optional(),
|
|
19
|
+
address: AddressSchema.optional(),
|
|
20
|
+
companyNumber: z.string().optional(), // חפ של החברה
|
|
21
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
export * from "./Payment";
|
|
16
|
+
//# 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;AAC/B,cAAc,WAAW,CAAC"}
|
|
@@ -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 @@
|
|
|
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"}
|