@deenruv/merchant-plugin 1.0.0
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/LICENSE +23 -0
- package/README.md +55 -0
- package/dist/plugin-server/api/platform-integration-admin-resolver.d.ts +26 -0
- package/dist/plugin-server/api/platform-integration-admin-resolver.js +103 -0
- package/dist/plugin-server/constants.d.ts +1 -0
- package/dist/plugin-server/constants.js +4 -0
- package/dist/plugin-server/e2e/plugin.e2e.test.d.ts +1 -0
- package/dist/plugin-server/e2e/plugin.e2e.test.js +36 -0
- package/dist/plugin-server/entities/platform-integration-setting.entity.d.ts +10 -0
- package/dist/plugin-server/entities/platform-integration-setting.entity.js +37 -0
- package/dist/plugin-server/entities/platform-integration-settings.entity.d.ts +9 -0
- package/dist/plugin-server/entities/platform-integration-settings.entity.js +33 -0
- package/dist/plugin-server/extensions/api-extensions.d.ts +2 -0
- package/dist/plugin-server/extensions/api-extensions.js +49 -0
- package/dist/plugin-server/index.d.ts +14 -0
- package/dist/plugin-server/index.js +100 -0
- package/dist/plugin-server/services/facebook-platform-integration.service.d.ts +51 -0
- package/dist/plugin-server/services/facebook-platform-integration.service.js +219 -0
- package/dist/plugin-server/services/google-platform-integration.service.d.ts +63 -0
- package/dist/plugin-server/services/google-platform-integration.service.js +352 -0
- package/dist/plugin-server/services/merchant-strategy.service.d.ts +10 -0
- package/dist/plugin-server/services/merchant-strategy.service.js +39 -0
- package/dist/plugin-server/services/platform-integration.service.d.ts +43 -0
- package/dist/plugin-server/services/platform-integration.service.js +282 -0
- package/dist/plugin-server/services/subscriber.service.d.ts +30 -0
- package/dist/plugin-server/services/subscriber.service.js +90 -0
- package/dist/plugin-server/strategies/default-merchant-export-strategy.d.ts +21 -0
- package/dist/plugin-server/strategies/default-merchant-export-strategy.js +34 -0
- package/dist/plugin-server/types.d.ts +29 -0
- package/dist/plugin-server/types.js +2 -0
- package/dist/plugin-server/ui/graphql/mutations.ts +23 -0
- package/dist/plugin-server/ui/graphql/queries.ts +18 -0
- package/dist/plugin-server/ui/graphql/scalars.ts +12 -0
- package/dist/plugin-server/ui/pages/FacebookPage.tsx +259 -0
- package/dist/plugin-server/ui/pages/GooglePage.tsx +281 -0
- package/dist/plugin-server/ui/providers.ts +42 -0
- package/dist/plugin-server/ui/routes.ts +18 -0
- package/dist/plugin-server/ui/styles/styles.css +3 -0
- package/dist/plugin-server/ui/styles/tailwind.css +1297 -0
- package/dist/plugin-server/ui/zeus/const.ts +3981 -0
- package/dist/plugin-server/ui/zeus/index.ts +18354 -0
- package/dist/plugin-server/ui/zeus/typedDocumentNode.ts +30 -0
- package/dist/plugin-server/ui.d.ts +2 -0
- package/dist/plugin-server/ui.js +15 -0
- package/dist/plugin-server/zeus/const.d.ts +6 -0
- package/dist/plugin-server/zeus/const.js +3687 -0
- package/dist/plugin-server/zeus/index.d.ts +18769 -0
- package/dist/plugin-server/zeus/index.js +466 -0
- package/dist/plugin-server/zeus/selectors.d.ts +52 -0
- package/dist/plugin-server/zeus/selectors.js +51 -0
- package/dist/plugin-ui/graphql/mutations.d.ts +29 -0
- package/dist/plugin-ui/graphql/mutations.js +17 -0
- package/dist/plugin-ui/graphql/queries.d.ts +19 -0
- package/dist/plugin-ui/graphql/queries.js +17 -0
- package/dist/plugin-ui/graphql/scalars.d.ts +10 -0
- package/dist/plugin-ui/graphql/scalars.js +11 -0
- package/dist/plugin-ui/index.d.ts +1 -0
- package/dist/plugin-ui/index.js +40 -0
- package/dist/plugin-ui/locales/en/index.d.ts +8 -0
- package/dist/plugin-ui/locales/en/index.js +2 -0
- package/dist/plugin-ui/locales/en/merchant.json +7 -0
- package/dist/plugin-ui/locales/pl/index.d.ts +8 -0
- package/dist/plugin-ui/locales/pl/index.js +2 -0
- package/dist/plugin-ui/locales/pl/merchant.json +7 -0
- package/dist/plugin-ui/pages/FacebookPage.d.ts +1 -0
- package/dist/plugin-ui/pages/FacebookPage.js +130 -0
- package/dist/plugin-ui/pages/GooglePage.d.ts +1 -0
- package/dist/plugin-ui/pages/GooglePage.js +155 -0
- package/dist/plugin-ui/translation-ns.d.ts +1 -0
- package/dist/plugin-ui/translation-ns.js +1 -0
- package/dist/plugin-ui/tsconfig.json +18 -0
- package/dist/plugin-ui/zeus/const.d.ts +6 -0
- package/dist/plugin-ui/zeus/const.js +3684 -0
- package/dist/plugin-ui/zeus/index.d.ts +18769 -0
- package/dist/plugin-ui/zeus/index.js +459 -0
- package/dist/plugin-ui/zeus/typedDocumentNode.d.ts +3 -0
- package/dist/plugin-ui/zeus/typedDocumentNode.js +9 -0
- package/package.json +63 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createDeenruvUIPlugin } from "@deenruv/react-ui-devkit";
|
|
3
|
+
import { GooglePage } from "./pages/GooglePage.js";
|
|
4
|
+
import { FacebookPage } from "./pages/FacebookPage.js";
|
|
5
|
+
import { GlobeIcon } from "lucide-react";
|
|
6
|
+
import pl from "./locales/pl";
|
|
7
|
+
import en from "./locales/en";
|
|
8
|
+
import { translationNS } from "./translation-ns.js";
|
|
9
|
+
export const MerchantPluginUI = createDeenruvUIPlugin({
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
name: "MerchantPluginUI",
|
|
12
|
+
translations: { ns: translationNS, data: { en, pl } },
|
|
13
|
+
pages: [
|
|
14
|
+
{ path: "google-merchant", element: _jsx(GooglePage, {}) },
|
|
15
|
+
{ path: "facebook-commerce", element: _jsx(FacebookPage, {}) },
|
|
16
|
+
],
|
|
17
|
+
navMenuGroups: [
|
|
18
|
+
{
|
|
19
|
+
id: "merchant-platforms",
|
|
20
|
+
labelId: "nav.merchantPlatforms",
|
|
21
|
+
placement: { groupId: "settings" },
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
navMenuLinks: [
|
|
25
|
+
{
|
|
26
|
+
groupId: "merchant-platforms",
|
|
27
|
+
id: "google-merchant",
|
|
28
|
+
labelId: "nav.googleMerchant",
|
|
29
|
+
href: "google-merchant",
|
|
30
|
+
icon: GlobeIcon,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
groupId: "merchant-platforms",
|
|
34
|
+
id: "facebook-commerce",
|
|
35
|
+
labelId: "nav.facebookCommerce",
|
|
36
|
+
href: "facebook-commerce",
|
|
37
|
+
icon: GlobeIcon,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FacebookPage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Label, Input, PageBlock, useLazyQuery, useMutation, Checkbox, Button, } from "@deenruv/react-ui-devkit";
|
|
4
|
+
import { getMerchantPlatformInfo, getMerchantPlatformSettings, } from "../graphql/queries";
|
|
5
|
+
import { saveMerchantPlatformSettings, removeOrphanItems, } from "../graphql/mutations";
|
|
6
|
+
import { toast } from "sonner";
|
|
7
|
+
export const FacebookPage = () => {
|
|
8
|
+
const [fetchMerchantPlatformSettings] = useLazyQuery(getMerchantPlatformSettings);
|
|
9
|
+
const [fetchMerchantPlatformInfo] = useLazyQuery(getMerchantPlatformInfo);
|
|
10
|
+
const [mutate] = useMutation(saveMerchantPlatformSettings);
|
|
11
|
+
const [removeOldItems] = useMutation(removeOrphanItems);
|
|
12
|
+
const [serviceInfo, setServiceInfo] = useState({
|
|
13
|
+
productsCount: 0,
|
|
14
|
+
connectionStatus: false,
|
|
15
|
+
});
|
|
16
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
17
|
+
const [settingsForm, setSettingsForm] = useState({
|
|
18
|
+
brand: "",
|
|
19
|
+
merchantId: "",
|
|
20
|
+
credentials: "",
|
|
21
|
+
autoUpdate: true,
|
|
22
|
+
firstSync: true,
|
|
23
|
+
});
|
|
24
|
+
const refetch = async () => {
|
|
25
|
+
try {
|
|
26
|
+
setIsLoading(true);
|
|
27
|
+
const [settingsData, infoData] = await Promise.all([
|
|
28
|
+
fetchMerchantPlatformSettings({ platform: "facebook" }),
|
|
29
|
+
fetchMerchantPlatformInfo({ platform: "facebook" }),
|
|
30
|
+
]);
|
|
31
|
+
const settings = settingsData?.getMerchantPlatformSettings?.entries?.reduce((acc, { key, value }) => {
|
|
32
|
+
if (key === "brand") {
|
|
33
|
+
acc.brand = value;
|
|
34
|
+
}
|
|
35
|
+
if (key === "merchantId") {
|
|
36
|
+
acc.merchantId = value;
|
|
37
|
+
}
|
|
38
|
+
if (key === "credentials") {
|
|
39
|
+
acc.credentials = value;
|
|
40
|
+
}
|
|
41
|
+
if (key === "autoUpdate") {
|
|
42
|
+
acc.autoUpdate = value === "true";
|
|
43
|
+
}
|
|
44
|
+
if (key === "firstSync") {
|
|
45
|
+
acc.firstSync = value === "true";
|
|
46
|
+
}
|
|
47
|
+
return acc;
|
|
48
|
+
}, {});
|
|
49
|
+
setSettingsForm((prev) => ({ ...prev, ...settings }));
|
|
50
|
+
setServiceInfo({
|
|
51
|
+
productsCount: infoData?.getMerchantPlatformInfo?.[0]?.productsCount || 0,
|
|
52
|
+
connectionStatus: infoData?.getMerchantPlatformInfo?.[0]?.isValidConnection || false,
|
|
53
|
+
});
|
|
54
|
+
setIsLoading(false);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.error(error);
|
|
58
|
+
setIsLoading(false);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
refetch();
|
|
63
|
+
}, []);
|
|
64
|
+
const onSubmit = async (e) => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
try {
|
|
67
|
+
const { saveMerchantPlatformSettings } = await mutate({
|
|
68
|
+
input: {
|
|
69
|
+
platform: "facebook",
|
|
70
|
+
entries: Object.entries(settingsForm).map(([key, value]) => ({
|
|
71
|
+
key,
|
|
72
|
+
value: value.toString(),
|
|
73
|
+
})),
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
if (saveMerchantPlatformSettings) {
|
|
77
|
+
toast.success("Settings saved successfully");
|
|
78
|
+
refetch();
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
toast.error("Failed to save settings");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.error(error);
|
|
86
|
+
toast.error("Failed to save settings");
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return (_jsx(PageBlock, { children: _jsxs("div", { style: { position: "relative" }, className: "flex flex-col p-4 relative max-w-[800px] mx-auto", children: [isLoading && (_jsx("div", { style: {
|
|
90
|
+
position: "absolute",
|
|
91
|
+
top: 0,
|
|
92
|
+
left: 0,
|
|
93
|
+
width: "100%",
|
|
94
|
+
height: "100%",
|
|
95
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
96
|
+
zIndex: 10,
|
|
97
|
+
display: "flex",
|
|
98
|
+
justifyContent: "center",
|
|
99
|
+
alignItems: "center",
|
|
100
|
+
borderBottomRightRadius: "10px",
|
|
101
|
+
}, children: _jsx("div", { style: {
|
|
102
|
+
display: "flex",
|
|
103
|
+
justifyContent: "center",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
width: "42px",
|
|
106
|
+
height: "42px",
|
|
107
|
+
}, className: "spinner" }) })), " ", _jsxs("form", { className: "flex flex-col gap-4", onSubmit: onSubmit, children: [_jsxs("div", { className: "flex justify-between gap-4", children: [_jsxs("div", { className: "w-full flex flex-col gap-2", children: [_jsx(Label, { children: "Brand" }), _jsx(Input, { className: "w-full", value: settingsForm.brand, onChange: (e) => setSettingsForm({ ...settingsForm, brand: e.target.value }) })] }), _jsxs("div", { className: "w-full flex flex-col gap-2", children: [_jsx(Label, { children: "Catalog ID" }), _jsx(Input, { className: "w-full", value: settingsForm.merchantId, onChange: (e) => setSettingsForm({
|
|
108
|
+
...settingsForm,
|
|
109
|
+
merchantId: e.target.value,
|
|
110
|
+
}) })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx(Label, { children: "Facebook Access Token" }), _jsx(Input, { className: "w-full", value: settingsForm.credentials, onChange: (e) => setSettingsForm({
|
|
111
|
+
...settingsForm,
|
|
112
|
+
credentials: e.target.value,
|
|
113
|
+
}) })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Checkbox, { id: "facebook-account-credentials", checked: settingsForm.autoUpdate, onCheckedChange: (checked) => setSettingsForm({
|
|
114
|
+
...settingsForm,
|
|
115
|
+
autoUpdate: typeof checked === "boolean" ? checked : false,
|
|
116
|
+
}) }), _jsx(Label, { htmlFor: "facebook-account-credentials", children: "Auto update on Product's change" })] })] }), _jsx("div", { className: "flex justify-end", children: _jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Label, { htmlFor: "auto-update-on-products-change", children: "Update ALL products with saving" }), _jsx(Checkbox, { id: "auto-update-on-products-change", checked: settingsForm.firstSync, onCheckedChange: (checked) => setSettingsForm({
|
|
117
|
+
...settingsForm,
|
|
118
|
+
firstSync: typeof checked === "boolean" ? checked : false,
|
|
119
|
+
}) })] }), _jsx(Button, { children: "Save" })] }) })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx("span", { children: "Connection status" }), serviceInfo.connectionStatus ? _jsx("div", { children: "\uD83D\uDC9A" }) : _jsx("div", { children: "\uD83D\uDC94" })] }), serviceInfo.connectionStatus ? (_jsx("div", { className: "mt-8", children: _jsx(Button, { onClick: async () => {
|
|
120
|
+
try {
|
|
121
|
+
await removeOldItems({ platform: "facebook" });
|
|
122
|
+
toast.success("Old items removed successfully");
|
|
123
|
+
refetch();
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error(error);
|
|
127
|
+
toast.error("Failed to remove old items");
|
|
128
|
+
}
|
|
129
|
+
}, children: "Remove old items" }) })) : null] }) }));
|
|
130
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GooglePage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Label, Input, PageBlock, useLazyQuery, useMutation, Checkbox, Button, } from "@deenruv/react-ui-devkit";
|
|
4
|
+
import { getMerchantPlatformInfo, getMerchantPlatformSettings, } from "../graphql/queries";
|
|
5
|
+
import { removeOrphanItems, saveMerchantPlatformSettings, } from "../graphql/mutations";
|
|
6
|
+
import { toast } from "sonner";
|
|
7
|
+
export const GooglePage = () => {
|
|
8
|
+
const [fetchMerchantPlatformSettings] = useLazyQuery(getMerchantPlatformSettings);
|
|
9
|
+
const [fetchMerchantPlatformInfo] = useLazyQuery(getMerchantPlatformInfo);
|
|
10
|
+
const [mutate] = useMutation(saveMerchantPlatformSettings);
|
|
11
|
+
const [removeOldItems] = useMutation(removeOrphanItems);
|
|
12
|
+
const [serviceInfo, setServiceInfo] = useState({
|
|
13
|
+
productsCount: 0,
|
|
14
|
+
connectionStatus: false,
|
|
15
|
+
});
|
|
16
|
+
const handleSelectedFile = (e) => {
|
|
17
|
+
const file = e.target.files?.[0];
|
|
18
|
+
if (file) {
|
|
19
|
+
const reader = new FileReader();
|
|
20
|
+
reader.onload = () => {
|
|
21
|
+
const result = reader.result;
|
|
22
|
+
try {
|
|
23
|
+
const jsonObject = JSON.parse(result);
|
|
24
|
+
setSettingsForm({
|
|
25
|
+
...settingsForm,
|
|
26
|
+
credentials: JSON.stringify(jsonObject),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error("Invalid JSON file:", error);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
reader.onerror = (e) => {
|
|
34
|
+
console.error("Error reading file", e);
|
|
35
|
+
};
|
|
36
|
+
if (file)
|
|
37
|
+
reader.readAsText(file);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
41
|
+
const [settingsForm, setSettingsForm] = useState({
|
|
42
|
+
brand: "",
|
|
43
|
+
merchantId: "",
|
|
44
|
+
credentials: "",
|
|
45
|
+
autoUpdate: true,
|
|
46
|
+
firstSync: true,
|
|
47
|
+
});
|
|
48
|
+
const refetch = async () => {
|
|
49
|
+
try {
|
|
50
|
+
setIsLoading(true);
|
|
51
|
+
const [settingsData, infoData] = await Promise.all([
|
|
52
|
+
fetchMerchantPlatformSettings({ platform: "google" }),
|
|
53
|
+
fetchMerchantPlatformInfo({ platform: "google" }),
|
|
54
|
+
]);
|
|
55
|
+
const settings = settingsData?.getMerchantPlatformSettings?.entries?.reduce((acc, { key, value }) => {
|
|
56
|
+
if (key === "brand") {
|
|
57
|
+
acc.brand = value;
|
|
58
|
+
}
|
|
59
|
+
if (key === "merchantId") {
|
|
60
|
+
acc.merchantId = value;
|
|
61
|
+
}
|
|
62
|
+
if (key === "credentials") {
|
|
63
|
+
acc.credentials = value;
|
|
64
|
+
}
|
|
65
|
+
if (key === "autoUpdate") {
|
|
66
|
+
acc.autoUpdate = value === "true";
|
|
67
|
+
}
|
|
68
|
+
if (key === "firstSync") {
|
|
69
|
+
acc.firstSync = value === "true";
|
|
70
|
+
}
|
|
71
|
+
return acc;
|
|
72
|
+
}, {});
|
|
73
|
+
setSettingsForm((prev) => ({ ...prev, ...settings }));
|
|
74
|
+
setServiceInfo({
|
|
75
|
+
productsCount: infoData?.getMerchantPlatformInfo?.[0]?.productsCount || 0,
|
|
76
|
+
connectionStatus: infoData?.getMerchantPlatformInfo?.[0]?.isValidConnection || false,
|
|
77
|
+
});
|
|
78
|
+
setIsLoading(false);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
console.error(error);
|
|
82
|
+
setIsLoading(false);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
refetch();
|
|
87
|
+
}, []);
|
|
88
|
+
const onSubmit = async (e) => {
|
|
89
|
+
e.preventDefault();
|
|
90
|
+
try {
|
|
91
|
+
const { saveMerchantPlatformSettings } = await mutate({
|
|
92
|
+
input: {
|
|
93
|
+
platform: "google",
|
|
94
|
+
entries: Object.entries(settingsForm).map(([key, value]) => ({
|
|
95
|
+
key,
|
|
96
|
+
value: value.toString(),
|
|
97
|
+
})),
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
if (saveMerchantPlatformSettings) {
|
|
101
|
+
toast.success("Settings saved successfully");
|
|
102
|
+
refetch();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
toast.error("Failed to save settings");
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error(error);
|
|
110
|
+
toast.error("Failed to save settings");
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
return (_jsx(PageBlock, { children: _jsxs("div", { style: { position: "relative" }, className: "flex flex-col p-4 relative max-w-[800px] mx-auto", children: [isLoading && (_jsx("div", { style: {
|
|
114
|
+
position: "absolute",
|
|
115
|
+
top: 0,
|
|
116
|
+
left: 0,
|
|
117
|
+
width: "100%",
|
|
118
|
+
height: "100%",
|
|
119
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
120
|
+
zIndex: 10,
|
|
121
|
+
display: "flex",
|
|
122
|
+
justifyContent: "center",
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
borderBottomRightRadius: "10px",
|
|
125
|
+
}, children: _jsx("div", { style: {
|
|
126
|
+
display: "flex",
|
|
127
|
+
justifyContent: "center",
|
|
128
|
+
alignItems: "center",
|
|
129
|
+
width: "42px",
|
|
130
|
+
height: "42px",
|
|
131
|
+
}, className: "spinner" }) })), _jsxs("form", { className: "flex flex-col gap-4", onSubmit: onSubmit, children: [_jsxs("div", { className: "flex justify-between gap-4", children: [_jsxs("div", { className: "w-full flex flex-col gap-2", children: [_jsx(Label, { children: "Brand" }), _jsx(Input, { className: "w-full", value: settingsForm.brand, onChange: (e) => setSettingsForm({ ...settingsForm, brand: e.target.value }) })] }), _jsxs("div", { className: "w-full flex flex-col gap-2", children: [_jsx(Label, { children: "Merchant ID" }), _jsx(Input, { className: "w-full", value: settingsForm.merchantId, onChange: (e) => setSettingsForm({
|
|
132
|
+
...settingsForm,
|
|
133
|
+
merchantId: e.target.value,
|
|
134
|
+
}) })] })] }), _jsxs("div", { className: "flex flex-col gap-4", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx(Label, { children: "Google Account Credentials" }), _jsx(Input, { style: {
|
|
135
|
+
border: "none",
|
|
136
|
+
backgroundColor: "transparent",
|
|
137
|
+
background: "none",
|
|
138
|
+
}, type: "file", accept: ".json", onChange: handleSelectedFile })] }), _jsxs("div", { className: "flex gap-2 items-center", children: [_jsx(Checkbox, { id: "google-account-credentials", checked: settingsForm.autoUpdate, onCheckedChange: (checked) => setSettingsForm({
|
|
139
|
+
...settingsForm,
|
|
140
|
+
autoUpdate: typeof checked === "boolean" ? checked : false,
|
|
141
|
+
}) }), _jsx(Label, { htmlFor: "google-account-credentials", children: "Auto update on Product's change" })] })] }), _jsx("div", { className: "flex justify-end", children: _jsxs("div", { className: "flex items-center gap-4", children: [_jsxs("div", { className: "flex gap-2", children: [_jsx(Label, { htmlFor: "auto-update-on-products-change", children: "Update ALL products with saving" }), _jsx(Checkbox, { id: "auto-update-on-products-change", checked: settingsForm.firstSync, onCheckedChange: (checked) => setSettingsForm({
|
|
142
|
+
...settingsForm,
|
|
143
|
+
firstSync: typeof checked === "boolean" ? checked : false,
|
|
144
|
+
}) })] }), _jsx(Button, { children: "Save" })] }) })] }), _jsxs("div", { className: "flex gap-2", children: [_jsx("span", { children: "Connection status" }), serviceInfo.connectionStatus ? _jsx("div", { children: "\uD83D\uDC9A" }) : _jsx("div", { children: "\uD83D\uDC94" })] }), serviceInfo.connectionStatus ? (_jsx("div", { className: "mt-8", children: _jsx(Button, { onClick: async () => {
|
|
145
|
+
try {
|
|
146
|
+
await removeOldItems({ platform: "facebook" });
|
|
147
|
+
toast.success("Old items removed successfully");
|
|
148
|
+
refetch();
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.error(error);
|
|
152
|
+
toast.error("Failed to remove old items");
|
|
153
|
+
}
|
|
154
|
+
}, children: "Remove old items" }) })) : null] }) }));
|
|
155
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const translationNS: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const translationNS = Symbol("merchant-plugin").toString();
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"jsx": "react-jsx",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"target": "ES2020",
|
|
7
|
+
"outDir": "../../dist/plugin-ui",
|
|
8
|
+
"importHelpers": true,
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"resolveJsonModule": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"strict": true,
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"allowSyntheticDefaultImports": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["./**/*.tsx", "./**/*.json", "./**/*.ts"]
|
|
18
|
+
}
|