@jsdev_ninja/core 0.8.50 → 0.8.52
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 +1 -1
- package/dist/core.cjs.js.map +1 -0
- package/dist/core.es.js +3419 -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/entities/Address.d.ts +28 -0
- package/dist/entities/Address.d.ts.map +1 -0
- package/dist/entities/Address.js +10 -0
- package/dist/entities/Atoms.d.ts +5 -0
- package/dist/entities/Atoms.d.ts.map +1 -0
- package/dist/entities/Atoms.js +5 -0
- package/dist/entities/Cart.d.ts +715 -0
- package/dist/entities/Cart.d.ts.map +1 -0
- package/dist/entities/Cart.js +14 -0
- package/dist/entities/Category.d.ts +103 -0
- package/dist/entities/Category.d.ts.map +1 -0
- package/dist/entities/Category.js +20 -0
- package/dist/entities/Company.d.ts +48 -0
- package/dist/entities/Company.d.ts.map +1 -0
- package/dist/entities/Company.js +12 -0
- package/dist/entities/FavoriteProduct.d.ts +25 -0
- package/dist/entities/FavoriteProduct.d.ts.map +1 -0
- package/dist/entities/FavoriteProduct.js +9 -0
- package/dist/entities/Locale.d.ts +22 -0
- package/dist/entities/Locale.d.ts.map +1 -0
- package/dist/entities/Locale.js +6 -0
- package/dist/entities/Order.d.ts +1084 -0
- package/dist/entities/Order.d.ts.map +1 -0
- package/dist/entities/Order.js +38 -0
- package/dist/entities/Payment.d.ts +368 -0
- package/dist/entities/Payment.d.ts.map +1 -0
- package/dist/entities/Payment.js +108 -0
- package/dist/entities/Product.d.ts +1000 -0
- package/dist/entities/Product.d.ts.map +1 -0
- package/dist/entities/Product.js +64 -0
- package/dist/entities/Profile.d.ts +102 -0
- package/dist/entities/Profile.d.ts.map +1 -0
- package/dist/entities/Profile.js +45 -0
- package/dist/entities/Store.d.ts +62 -0
- package/dist/entities/Store.d.ts.map +1 -0
- package/dist/entities/Store.js +20 -0
- package/dist/entities/index.d.ts +13 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +12 -0
- package/dist/firebase-api/index.d.ts +29 -0
- package/dist/firebase-api/index.d.ts.map +1 -0
- package/dist/firebase-api/index.js +20 -0
- package/dist/hypPaymentService/index.d.ts +33 -0
- package/dist/hypPaymentService/index.d.ts.map +1 -0
- package/dist/hypPaymentService/index.js +100 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -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/lib/entities/Order.ts +3 -1
- package/lib/firebase-api/index.ts +1 -4
- package/lib/index.tsx +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Product.d.ts","sourceRoot":"","sources":["../../lib/entities/Product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDxB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAE5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE3D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { LocaleSchema } from "./Locale";
|
|
3
|
+
import { CategorySchema } from "./Category";
|
|
4
|
+
const text = z.string();
|
|
5
|
+
export const ProductSchema = z.object({
|
|
6
|
+
type: z.literal("Product"),
|
|
7
|
+
storeId: text,
|
|
8
|
+
companyId: text,
|
|
9
|
+
id: z.string(),
|
|
10
|
+
objectID: z.string(),
|
|
11
|
+
sku: z.string().min(1),
|
|
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
|
+
weight: z.object({
|
|
29
|
+
value: z.number(),
|
|
30
|
+
unit: z.enum(["kg", "gram", "none"]),
|
|
31
|
+
}),
|
|
32
|
+
volume: z.object({
|
|
33
|
+
value: z.number(),
|
|
34
|
+
unit: z.enum(["liter", "ml", "none"]),
|
|
35
|
+
}),
|
|
36
|
+
images: z.array(z.object({ url: z.string().url(), id: z.string() })),
|
|
37
|
+
manufacturer: text,
|
|
38
|
+
brand: z.string(),
|
|
39
|
+
importer: z.string(),
|
|
40
|
+
supplier: z.string(),
|
|
41
|
+
ingredients: z.array(LocaleSchema),
|
|
42
|
+
created_at: z.number(),
|
|
43
|
+
updated_at: z.number(),
|
|
44
|
+
categoryList: z.array(CategorySchema),
|
|
45
|
+
// generated
|
|
46
|
+
categories: z.object({
|
|
47
|
+
lvl0: z.array(z.string()),
|
|
48
|
+
lvl1: z.array(z.string()),
|
|
49
|
+
lvl2: z.array(z.string()),
|
|
50
|
+
lvl3: z.array(z.string()),
|
|
51
|
+
lvl4: z.array(z.string()),
|
|
52
|
+
}),
|
|
53
|
+
categoryNames: z.array(z.string()),
|
|
54
|
+
});
|
|
55
|
+
export const NewProductSchema = ProductSchema.omit({
|
|
56
|
+
id: true,
|
|
57
|
+
categories: true,
|
|
58
|
+
images: true,
|
|
59
|
+
}).extend({
|
|
60
|
+
image: z.instanceof(File).optional(),
|
|
61
|
+
});
|
|
62
|
+
export const EditProductSchema = ProductSchema.extend({
|
|
63
|
+
image: z.instanceof(File).optional(),
|
|
64
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
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
|
+
displayName: z.ZodString;
|
|
10
|
+
email: z.ZodString;
|
|
11
|
+
phoneNumber: z.ZodObject<{
|
|
12
|
+
code: z.ZodString;
|
|
13
|
+
number: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
number: string;
|
|
16
|
+
code: string;
|
|
17
|
+
}, {
|
|
18
|
+
number: string;
|
|
19
|
+
code: string;
|
|
20
|
+
}>;
|
|
21
|
+
address: z.ZodObject<{
|
|
22
|
+
country: z.ZodString;
|
|
23
|
+
city: z.ZodString;
|
|
24
|
+
street: z.ZodString;
|
|
25
|
+
streetNumber: z.ZodString;
|
|
26
|
+
floor: z.ZodString;
|
|
27
|
+
apartmentEnterNumber: z.ZodString;
|
|
28
|
+
apartmentNumber: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
country: string;
|
|
31
|
+
city: string;
|
|
32
|
+
street: string;
|
|
33
|
+
streetNumber: string;
|
|
34
|
+
floor: string;
|
|
35
|
+
apartmentEnterNumber: string;
|
|
36
|
+
apartmentNumber: string;
|
|
37
|
+
}, {
|
|
38
|
+
country: string;
|
|
39
|
+
city: string;
|
|
40
|
+
street: string;
|
|
41
|
+
streetNumber: string;
|
|
42
|
+
floor: string;
|
|
43
|
+
apartmentEnterNumber: string;
|
|
44
|
+
apartmentNumber: string;
|
|
45
|
+
}>;
|
|
46
|
+
isAnonymous: z.ZodBoolean;
|
|
47
|
+
createdDate: z.ZodNumber;
|
|
48
|
+
lastActivityDate: z.ZodNumber;
|
|
49
|
+
}, "strip", z.ZodTypeAny, {
|
|
50
|
+
type: "Profile";
|
|
51
|
+
id: string;
|
|
52
|
+
companyId: string;
|
|
53
|
+
storeId: string;
|
|
54
|
+
tenantId: string;
|
|
55
|
+
clientType: "user" | "company";
|
|
56
|
+
displayName: string;
|
|
57
|
+
email: string;
|
|
58
|
+
phoneNumber: {
|
|
59
|
+
number: string;
|
|
60
|
+
code: string;
|
|
61
|
+
};
|
|
62
|
+
address: {
|
|
63
|
+
country: string;
|
|
64
|
+
city: string;
|
|
65
|
+
street: string;
|
|
66
|
+
streetNumber: string;
|
|
67
|
+
floor: string;
|
|
68
|
+
apartmentEnterNumber: string;
|
|
69
|
+
apartmentNumber: string;
|
|
70
|
+
};
|
|
71
|
+
isAnonymous: boolean;
|
|
72
|
+
createdDate: number;
|
|
73
|
+
lastActivityDate: number;
|
|
74
|
+
}, {
|
|
75
|
+
type: "Profile";
|
|
76
|
+
id: string;
|
|
77
|
+
companyId: string;
|
|
78
|
+
storeId: string;
|
|
79
|
+
tenantId: string;
|
|
80
|
+
clientType: "user" | "company";
|
|
81
|
+
displayName: string;
|
|
82
|
+
email: string;
|
|
83
|
+
phoneNumber: {
|
|
84
|
+
number: string;
|
|
85
|
+
code: string;
|
|
86
|
+
};
|
|
87
|
+
address: {
|
|
88
|
+
country: string;
|
|
89
|
+
city: string;
|
|
90
|
+
street: string;
|
|
91
|
+
streetNumber: string;
|
|
92
|
+
floor: string;
|
|
93
|
+
apartmentEnterNumber: string;
|
|
94
|
+
apartmentNumber: string;
|
|
95
|
+
};
|
|
96
|
+
isAnonymous: boolean;
|
|
97
|
+
createdDate: number;
|
|
98
|
+
lastActivityDate: number;
|
|
99
|
+
}>;
|
|
100
|
+
export type TProfile = z.infer<typeof ProfileSchema>;
|
|
101
|
+
export declare function createEmptyProfile(): TProfile;
|
|
102
|
+
//# 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;AAGxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBxB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAErD,wBAAgB,kBAAkB,IAAI,QAAQ,CAwB7C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AddressSchema } from "./Address";
|
|
3
|
+
export const ProfileSchema = z.object({
|
|
4
|
+
type: z.literal("Profile"),
|
|
5
|
+
id: z.string(),
|
|
6
|
+
companyId: z.string(),
|
|
7
|
+
storeId: z.string(),
|
|
8
|
+
tenantId: z.string(),
|
|
9
|
+
clientType: z.enum(["user", "company"]),
|
|
10
|
+
displayName: z.string().min(1),
|
|
11
|
+
email: z.string().email(),
|
|
12
|
+
phoneNumber: z.object({
|
|
13
|
+
code: z.string(),
|
|
14
|
+
number: z.string(),
|
|
15
|
+
}),
|
|
16
|
+
address: AddressSchema,
|
|
17
|
+
isAnonymous: z.boolean(),
|
|
18
|
+
createdDate: z.number(),
|
|
19
|
+
lastActivityDate: z.number(),
|
|
20
|
+
});
|
|
21
|
+
export function createEmptyProfile() {
|
|
22
|
+
return {
|
|
23
|
+
type: "Profile",
|
|
24
|
+
id: "",
|
|
25
|
+
companyId: "",
|
|
26
|
+
storeId: "",
|
|
27
|
+
tenantId: "",
|
|
28
|
+
clientType: "user",
|
|
29
|
+
displayName: "",
|
|
30
|
+
email: "",
|
|
31
|
+
phoneNumber: { code: "+972", number: "" },
|
|
32
|
+
address: {
|
|
33
|
+
country: "",
|
|
34
|
+
city: "",
|
|
35
|
+
street: "",
|
|
36
|
+
streetNumber: "",
|
|
37
|
+
floor: "",
|
|
38
|
+
apartmentEnterNumber: "",
|
|
39
|
+
apartmentNumber: "",
|
|
40
|
+
},
|
|
41
|
+
createdDate: 0,
|
|
42
|
+
lastActivityDate: 0,
|
|
43
|
+
isAnonymous: true,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const StoreSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
companyId: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
urls: z.ZodArray<z.ZodString, "many">;
|
|
7
|
+
logoUrl: z.ZodString;
|
|
8
|
+
tenantId: z.ZodString;
|
|
9
|
+
hypData: z.ZodObject<{
|
|
10
|
+
masof: z.ZodString;
|
|
11
|
+
password: z.ZodString;
|
|
12
|
+
isJ5: z.ZodEnum<["True", "False"]>;
|
|
13
|
+
KEY: z.ZodString;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
KEY: string;
|
|
16
|
+
masof: string;
|
|
17
|
+
password: string;
|
|
18
|
+
isJ5: "True" | "False";
|
|
19
|
+
}, {
|
|
20
|
+
KEY: string;
|
|
21
|
+
masof: string;
|
|
22
|
+
password: string;
|
|
23
|
+
isJ5: "True" | "False";
|
|
24
|
+
}>;
|
|
25
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
|
+
id: string;
|
|
27
|
+
companyId: string;
|
|
28
|
+
name: string;
|
|
29
|
+
tenantId: string;
|
|
30
|
+
urls: string[];
|
|
31
|
+
logoUrl: string;
|
|
32
|
+
hypData: {
|
|
33
|
+
KEY: string;
|
|
34
|
+
masof: string;
|
|
35
|
+
password: string;
|
|
36
|
+
isJ5: "True" | "False";
|
|
37
|
+
};
|
|
38
|
+
}, {
|
|
39
|
+
id: string;
|
|
40
|
+
companyId: string;
|
|
41
|
+
name: string;
|
|
42
|
+
tenantId: string;
|
|
43
|
+
urls: string[];
|
|
44
|
+
logoUrl: string;
|
|
45
|
+
hypData: {
|
|
46
|
+
KEY: string;
|
|
47
|
+
masof: string;
|
|
48
|
+
password: string;
|
|
49
|
+
isJ5: "True" | "False";
|
|
50
|
+
};
|
|
51
|
+
}>;
|
|
52
|
+
export declare const StorePrivateSchema: z.ZodObject<{
|
|
53
|
+
storeEmail: z.ZodString;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
storeEmail: string;
|
|
56
|
+
}, {
|
|
57
|
+
storeEmail: string;
|
|
58
|
+
}>;
|
|
59
|
+
export type TStore = z.infer<typeof StoreSchema>;
|
|
60
|
+
export type TStorePrivate = z.infer<typeof StorePrivateSchema>;
|
|
61
|
+
export {};
|
|
62
|
+
//# 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,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaf,CAAC;AAGH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AACjD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { hypBooleanSchema } from "./Atoms";
|
|
3
|
+
const StoreSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
companyId: z.string(),
|
|
6
|
+
name: z.string(),
|
|
7
|
+
urls: z.array(z.string()),
|
|
8
|
+
logoUrl: z.string(),
|
|
9
|
+
tenantId: z.string(), // firebase auth tenantId
|
|
10
|
+
hypData: z.object({
|
|
11
|
+
masof: z.string().min(1),
|
|
12
|
+
password: z.string().min(1),
|
|
13
|
+
isJ5: hypBooleanSchema,
|
|
14
|
+
KEY: z.string().min(1), // api key
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
// private sub collection
|
|
18
|
+
export const StorePrivateSchema = z.object({
|
|
19
|
+
storeEmail: z.string().email(),
|
|
20
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
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 "./Payment";
|
|
10
|
+
export * from "./Product";
|
|
11
|
+
export * from "./Profile";
|
|
12
|
+
export * from "./Store";
|
|
13
|
+
//# 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,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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 "./Payment";
|
|
10
|
+
export * from "./Product";
|
|
11
|
+
export * from "./Profile";
|
|
12
|
+
export * from "./Store";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const collections: {
|
|
2
|
+
readonly products: "products";
|
|
3
|
+
readonly profiles: "profiles";
|
|
4
|
+
readonly cart: "cart";
|
|
5
|
+
readonly clients: "clients";
|
|
6
|
+
readonly orders: "orders";
|
|
7
|
+
readonly categories: "categories";
|
|
8
|
+
readonly favorites: "favorites";
|
|
9
|
+
readonly stores: "stores";
|
|
10
|
+
readonly companies: "companies";
|
|
11
|
+
readonly payments: "payments";
|
|
12
|
+
};
|
|
13
|
+
export declare const FirestoreApi: {
|
|
14
|
+
getPath: ({ companyId, storeId, collectionName, }: {
|
|
15
|
+
companyId: string;
|
|
16
|
+
storeId: string;
|
|
17
|
+
collectionName: keyof typeof collections;
|
|
18
|
+
}) => string;
|
|
19
|
+
};
|
|
20
|
+
export declare const FirebaseAPI: {
|
|
21
|
+
firestore: {
|
|
22
|
+
getPath: ({ companyId, storeId, collectionName, }: {
|
|
23
|
+
companyId: string;
|
|
24
|
+
storeId: string;
|
|
25
|
+
collectionName: keyof typeof collections;
|
|
26
|
+
}) => string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//# 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,WAAW;;;;;;;;;;;CAWd,CAAC;AAEX,eAAO,MAAM,YAAY;uDAKrB;QACF,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,MAAM,OAAO,WAAW,CAAC;KACzC;CAGD,CAAC;AAEF,eAAO,MAAM,WAAW;;2DATpB;YACF,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,OAAO,WAAW,CAAC;SACzC;;CAOD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const collections = {
|
|
2
|
+
products: "products",
|
|
3
|
+
profiles: "profiles",
|
|
4
|
+
cart: "cart",
|
|
5
|
+
clients: "clients",
|
|
6
|
+
orders: "orders",
|
|
7
|
+
categories: "categories",
|
|
8
|
+
favorites: "favorites",
|
|
9
|
+
stores: "stores",
|
|
10
|
+
companies: "companies",
|
|
11
|
+
payments: "payments",
|
|
12
|
+
};
|
|
13
|
+
export const FirestoreApi = {
|
|
14
|
+
getPath: ({ companyId, storeId, collectionName, }) => {
|
|
15
|
+
return `${companyId}/${storeId}/${collectionName}`;
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const FirebaseAPI = {
|
|
19
|
+
firestore: FirestoreApi,
|
|
20
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { TPaymentLinkRequest } from "../entities/Payment";
|
|
2
|
+
type chargeJ5TransactionParams = {
|
|
3
|
+
transactionId: string;
|
|
4
|
+
masof: string;
|
|
5
|
+
masofPassword: string;
|
|
6
|
+
originalAmount: number;
|
|
7
|
+
actualAmount: number;
|
|
8
|
+
orderId: string;
|
|
9
|
+
creditCardConfirmNumber: string;
|
|
10
|
+
transactionUID: string;
|
|
11
|
+
clientName: string;
|
|
12
|
+
clientLastName: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const hypPaymentService: {
|
|
15
|
+
readonly chargeJ5Transaction: (params: chargeJ5TransactionParams) => Promise<{
|
|
16
|
+
success: boolean;
|
|
17
|
+
errMessage?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
success: boolean;
|
|
20
|
+
errMessage: any;
|
|
21
|
+
}>;
|
|
22
|
+
readonly createPaymentLink: (params: TPaymentLinkRequest) => Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
paymentLink: string;
|
|
25
|
+
errMessage?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
success: boolean;
|
|
28
|
+
errMessage: any;
|
|
29
|
+
paymentLink?: undefined;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/hypPaymentService/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,mBAAmB,EACnB,MAAM,qBAAqB,CAAC;AA6B7B,KAAK,yBAAyB,GAAG;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,iBAAiB;2CACK,yBAAyB;;;;;;;yCA2D3B,mBAAmB;;;;;;;;;CAoB1C,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const baseUrl = "https://pay.hyp.co.il/p/";
|
|
2
|
+
function objectToQueryParams(obj) {
|
|
3
|
+
return Object.keys(obj)
|
|
4
|
+
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`)
|
|
5
|
+
.join("&");
|
|
6
|
+
}
|
|
7
|
+
function splitYYMM(yyMM) {
|
|
8
|
+
if (!/^\d{4}$/.test(yyMM)) {
|
|
9
|
+
throw new Error("Invalid YYMM format. Expected 4-digit string (YYMM).");
|
|
10
|
+
}
|
|
11
|
+
const yy = yyMM.slice(0, 2); // First 2 digits → Year
|
|
12
|
+
const mm = yyMM.slice(2, 4); // Last 2 digits → Month
|
|
13
|
+
const currentYear = new Date().getFullYear(); // Get current full year (e.g., 2024)
|
|
14
|
+
const century = Math.floor(currentYear / 100) * 100; // Get century (e.g., 2000)
|
|
15
|
+
const fullYear = century + parseInt(yy, 10);
|
|
16
|
+
// Handle future dates: Assume YY < current YY is from the current century, else from the past century
|
|
17
|
+
const currentYY = currentYear % 100;
|
|
18
|
+
const correctedYear = parseInt(yy, 10) > currentYY ? fullYear - 100 : fullYear;
|
|
19
|
+
return { month: mm, year: correctedYear.toString() };
|
|
20
|
+
}
|
|
21
|
+
// parse hyp text response
|
|
22
|
+
function parseQueryString(query) {
|
|
23
|
+
return query.split("&").reduce((acc, param) => {
|
|
24
|
+
const [key, value] = param.split("=");
|
|
25
|
+
if (key && value) {
|
|
26
|
+
acc[key] = decodeURIComponent(value);
|
|
27
|
+
}
|
|
28
|
+
return acc;
|
|
29
|
+
}, {});
|
|
30
|
+
}
|
|
31
|
+
export const hypPaymentService = {
|
|
32
|
+
async chargeJ5Transaction(params) {
|
|
33
|
+
try {
|
|
34
|
+
const tokenParams = objectToQueryParams({
|
|
35
|
+
action: "getToken",
|
|
36
|
+
allowFalse: "True",
|
|
37
|
+
Masof: params.masof,
|
|
38
|
+
PassP: params.masofPassword,
|
|
39
|
+
TransId: params.transactionId,
|
|
40
|
+
});
|
|
41
|
+
const tokenResponse = await fetch(`${baseUrl}?${tokenParams}`);
|
|
42
|
+
const body = await tokenResponse.text();
|
|
43
|
+
const tokenData = parseQueryString(body);
|
|
44
|
+
const cardValidityDate = splitYYMM(tokenData.Tokef);
|
|
45
|
+
// todo Tmonth=mm&Tyear=yyyy
|
|
46
|
+
let originalAmount = Number(params.originalAmount) * 100;
|
|
47
|
+
const transParams = objectToQueryParams({
|
|
48
|
+
action: "soft",
|
|
49
|
+
MoreData: "True",
|
|
50
|
+
UTF8: "True",
|
|
51
|
+
UTF8out: "True",
|
|
52
|
+
"inputObj.originalUid": params.transactionUID,
|
|
53
|
+
"inputObj.originalAmount": originalAmount.toString(),
|
|
54
|
+
"inputObj.authorizationCodeManpik": "7",
|
|
55
|
+
Amount: params.actualAmount.toString(),
|
|
56
|
+
AuthNum: params.creditCardConfirmNumber,
|
|
57
|
+
Info: "soft Info",
|
|
58
|
+
Masof: params.masof,
|
|
59
|
+
PassP: params.masofPassword,
|
|
60
|
+
Tash: "1",
|
|
61
|
+
Tmonth: cardValidityDate.month,
|
|
62
|
+
Tyear: cardValidityDate.year,
|
|
63
|
+
Order: params.orderId,
|
|
64
|
+
CC: tokenData.Token,
|
|
65
|
+
UserId: "203269535",
|
|
66
|
+
ClientName: params.clientName,
|
|
67
|
+
ClientLName: params.clientLastName,
|
|
68
|
+
Token: "True",
|
|
69
|
+
FixTash: "True",
|
|
70
|
+
});
|
|
71
|
+
const transactionCommit = await fetch(`${baseUrl}?${transParams}`);
|
|
72
|
+
const transactionData = await transactionCommit.text();
|
|
73
|
+
console.log("Amount", params.actualAmount.toString());
|
|
74
|
+
console.log("token", tokenData.Token);
|
|
75
|
+
console.log("AuthNum", params.creditCardConfirmNumber);
|
|
76
|
+
console.log("originalUid", params.transactionUID);
|
|
77
|
+
console.log("transactionData", transactionData);
|
|
78
|
+
return { success: true };
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.log(error);
|
|
82
|
+
return { success: false, errMessage: error.message };
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
async createPaymentLink(params) {
|
|
86
|
+
try {
|
|
87
|
+
const queryString = objectToQueryParams(params);
|
|
88
|
+
const url = `${baseUrl}?${queryString}`;
|
|
89
|
+
console.log("createPaymentLink url", url);
|
|
90
|
+
const signResponse = await fetch(url);
|
|
91
|
+
const linkData = await signResponse.text();
|
|
92
|
+
const paymentLink = `${baseUrl}?${linkData}`;
|
|
93
|
+
return { success: true, paymentLink };
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
console.log(error);
|
|
97
|
+
return { success: false, errMessage: error.message };
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../lib/index.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../lib/index.tsx","../lib/entities/address.ts","../lib/entities/atoms.ts","../lib/entities/cart.ts","../lib/entities/category.ts","../lib/entities/company.ts","../lib/entities/favoriteproduct.ts","../lib/entities/locale.ts","../lib/entities/order.ts","../lib/entities/payment.ts","../lib/entities/product.ts","../lib/entities/profile.ts","../lib/entities/store.ts","../lib/entities/index.ts","../lib/firebase-api/index.ts","../lib/hyppaymentservice/index.ts"],"version":"5.7.3"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../vite.config.ts"],"version":"5.7.3"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.config.d.ts","sourceRoot":"","sources":["../vite.config.ts"],"names":[],"mappings":";AAIA,wBAsBG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import react from "@vitejs/plugin-react-swc";
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
plugins: [react()],
|
|
6
|
+
build: {
|
|
7
|
+
lib: {
|
|
8
|
+
entry: resolve(__dirname, "lib/index.tsx"),
|
|
9
|
+
name: "core",
|
|
10
|
+
formats: ["es", "cjs", "umd"],
|
|
11
|
+
fileName: (format) => `core.${format}.js`,
|
|
12
|
+
},
|
|
13
|
+
rollupOptions: {
|
|
14
|
+
external: ["react", "react-dom"], // Exclude dependencies from the bundle
|
|
15
|
+
output: {
|
|
16
|
+
globals: {
|
|
17
|
+
react: "React",
|
|
18
|
+
"react-dom": "ReactDOM",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
sourcemap: true,
|
|
23
|
+
minify: "esbuild",
|
|
24
|
+
},
|
|
25
|
+
});
|
package/lib/entities/Order.ts
CHANGED
|
@@ -29,10 +29,12 @@ export const OrderSchema = z.object({
|
|
|
29
29
|
cart: z.object({
|
|
30
30
|
id: z.string(),
|
|
31
31
|
items: z.array(z.object({ product: ProductSchema, amount: z.number() })),
|
|
32
|
-
cartTotal: z.number(),
|
|
33
32
|
cartDiscount: z.number(),
|
|
33
|
+
cartTotal: z.number(),
|
|
34
34
|
cartVat: z.number(),
|
|
35
35
|
}),
|
|
36
|
+
originalAmount: z.number().positive().optional(), // what client pay
|
|
37
|
+
actualAmount: z.number().positive().optional(), // what store charge
|
|
36
38
|
date: z.number(),
|
|
37
39
|
deliveryDate: z.number().optional(),
|
|
38
40
|
client: ProfileSchema,
|
|
@@ -19,13 +19,10 @@ export const FirestoreApi = {
|
|
|
19
19
|
}: {
|
|
20
20
|
companyId: string;
|
|
21
21
|
storeId: string;
|
|
22
|
-
collectionName:
|
|
22
|
+
collectionName: keyof typeof collections;
|
|
23
23
|
}) => {
|
|
24
24
|
return `${companyId}/${storeId}/${collectionName}`;
|
|
25
25
|
},
|
|
26
|
-
getProductsPath: ({ companyId, storeId }: { companyId: string; storeId: string }) => {
|
|
27
|
-
return FirestoreApi.getPath({ companyId, storeId, collectionName: collections.products });
|
|
28
|
-
},
|
|
29
26
|
};
|
|
30
27
|
|
|
31
28
|
export const FirebaseAPI = {
|
package/lib/index.tsx
CHANGED