@cloudimage-strapi/content-plugin 1.0.2 → 1.0.5
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/README.md +7 -7
- package/dist/_chunks/App-BmZyLUWk.mjs +138 -0
- package/dist/_chunks/App-CRbNvJDt.js +138 -0
- package/dist/_chunks/en-DUVjg0jJ.js +16 -0
- package/dist/_chunks/en-r7lu9xMg.mjs +16 -0
- package/dist/_chunks/fr-DTrzyr9o.js +16 -0
- package/dist/_chunks/fr-Ge-jvwxL.mjs +16 -0
- package/dist/_chunks/index-4zkw0zS1.mjs +72 -0
- package/dist/_chunks/index-DfCnchyr.js +71 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/server/index.js +237 -0
- package/dist/server/index.mjs +238 -0
- package/package.json +69 -32
- package/LICENSE +0 -21
- package/admin/src/components/Initializer/index.js +0 -26
- package/admin/src/components/PluginIcon/index.js +0 -12
- package/admin/src/index.js +0 -63
- package/admin/src/pages/App/index.js +0 -25
- package/admin/src/pages/HomePage/index.js +0 -199
- package/admin/src/pluginId.js +0 -5
- package/admin/src/translations/en.json +0 -1
- package/admin/src/translations/fr.json +0 -1
- package/admin/src/utils/axiosInstance.js +0 -40
- package/admin/src/utils/getTrad.js +0 -5
- package/server/bootstrap.js +0 -25
- package/server/config/index.js +0 -6
- package/server/content-types/index.js +0 -3
- package/server/controllers/index.js +0 -7
- package/server/controllers/scaleflex-cloudimage.js +0 -40
- package/server/destroy.js +0 -5
- package/server/index.js +0 -25
- package/server/middlewares/index.js +0 -3
- package/server/policies/index.js +0 -3
- package/server/register.js +0 -65
- package/server/routes/index.js +0 -56
- package/server/services/index.js +0 -7
- package/server/services/scaleflex-cloudimage.js +0 -172
- package/strapi-admin.js +0 -3
- package/strapi-server.js +0 -3
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Cloudimage plugin from Scaleflex for Strapi
|
|
1
|
+
# Cloudimage plugin from Scaleflex for Strapi
|
|
2
2
|
|
|
3
3
|
## Install
|
|
4
4
|
|
|
@@ -38,14 +38,14 @@ If you enter nothing or an invalid token, you will get this error.
|
|
|
38
38
|
|
|
39
39
|
In the rare case that we can’t auto-detect whether token is v7 or not, you will get the option to manually set it.
|
|
40
40
|
|
|
41
|
-

|
|
42
42
|
|
|
43
43
|
## What the plugin brings
|
|
44
44
|
|
|
45
|
-
1. This plugin
|
|
46
|
-
2. It also allows clients to
|
|
45
|
+
1. This plugin simply gives client an interface to save the configuration settings.
|
|
46
|
+
2. It also allows clients to Optimize (resize and accelerate) all previous images:
|
|
47
47
|
|
|
48
|
-

|
|
49
49
|
|
|
50
|
-
- It will NOT
|
|
51
|
-
- It will only sync images, no
|
|
50
|
+
- It will NOT Optimize (resize and accelerate) images that are already hosted on [Scaleflex DAM](https://www.scaleflex.com/digital-asset-management-filerobot)
|
|
51
|
+
- It will only sync images, no other media like video or audio.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useFetchClient, Page } from "@strapi/strapi/admin";
|
|
3
|
+
import { Routes, Route } from "react-router-dom";
|
|
4
|
+
import { useState, useEffect } from "react";
|
|
5
|
+
import { Typography, Main, Box, Alert, Field, Radio, Button } from "@strapi/design-system";
|
|
6
|
+
import { P as PLUGIN_ID } from "./index-4zkw0zS1.mjs";
|
|
7
|
+
const HomePage = () => {
|
|
8
|
+
const { get, put } = useFetchClient();
|
|
9
|
+
const [config, setConfig] = useState(null);
|
|
10
|
+
const [loading, setLoading] = useState(true);
|
|
11
|
+
const [domain, setDomain] = useState("");
|
|
12
|
+
const [isV7, setIsV7] = useState(false);
|
|
13
|
+
const [isV7CheckSuccessful, setIsV7CheckSuccessful] = useState(true);
|
|
14
|
+
const [manualV7, setManualV7] = useState(false);
|
|
15
|
+
const [disabledAllButtons, setDisabledAllButtons] = useState(false);
|
|
16
|
+
const [success, setSuccess] = useState(false);
|
|
17
|
+
const [error, setError] = useState(false);
|
|
18
|
+
const [disableUpdateButtons, setDisableUpdateButtons] = useState(false);
|
|
19
|
+
const [updateCount, setUpdateCount] = useState(-1);
|
|
20
|
+
const [displayUpdateResult, setDisplayUpdateResult] = useState(false);
|
|
21
|
+
const [updateMessage, setUpdateMessage] = useState("");
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
get(`/${PLUGIN_ID}/config`, { method: "GET" }).then((data) => {
|
|
24
|
+
let config2 = data.data;
|
|
25
|
+
setConfig(config2);
|
|
26
|
+
setDomain(config2.domain);
|
|
27
|
+
setLoading(false);
|
|
28
|
+
if (!config2.domain || !config2.hasOwnProperty("isV7")) {
|
|
29
|
+
setDisableUpdateButtons(true);
|
|
30
|
+
} else {
|
|
31
|
+
setDisableUpdateButtons(false);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}, []);
|
|
35
|
+
if (loading) {
|
|
36
|
+
return /* @__PURE__ */ jsx(Typography, { children: "fetching configuration..." });
|
|
37
|
+
}
|
|
38
|
+
const saveConfiguration = async () => {
|
|
39
|
+
if (!domain) {
|
|
40
|
+
setError(true);
|
|
41
|
+
setSuccess(false);
|
|
42
|
+
setDisabledAllButtons(false);
|
|
43
|
+
return;
|
|
44
|
+
} else {
|
|
45
|
+
setError(false);
|
|
46
|
+
}
|
|
47
|
+
setDisabledAllButtons(true);
|
|
48
|
+
let tokenOrDomain = "";
|
|
49
|
+
if (domain && domain.indexOf(".") === -1) {
|
|
50
|
+
tokenOrDomain = `${domain}.cloudimg.io`.trim();
|
|
51
|
+
} else {
|
|
52
|
+
tokenOrDomain = domain.trim();
|
|
53
|
+
}
|
|
54
|
+
let v7Check = await get(`/${PLUGIN_ID}/is-v7?domain=${tokenOrDomain}`);
|
|
55
|
+
v7Check = v7Check.data;
|
|
56
|
+
if (!v7Check.domainExists) {
|
|
57
|
+
setError(true);
|
|
58
|
+
setSuccess(false);
|
|
59
|
+
setDisabledAllButtons(false);
|
|
60
|
+
return;
|
|
61
|
+
} else {
|
|
62
|
+
setError(false);
|
|
63
|
+
}
|
|
64
|
+
setIsV7CheckSuccessful(v7Check.isSuccess);
|
|
65
|
+
let isV7Overall = v7Check.isSuccess ? v7Check.isV7 : manualV7;
|
|
66
|
+
setIsV7(isV7Overall);
|
|
67
|
+
let config2 = {
|
|
68
|
+
domain: tokenOrDomain,
|
|
69
|
+
isV7: isV7Overall
|
|
70
|
+
};
|
|
71
|
+
let updatedConfigs = await put(`/${PLUGIN_ID}/update-config`, config2);
|
|
72
|
+
setDomain(updatedConfigs.data.domain);
|
|
73
|
+
setSuccess(true);
|
|
74
|
+
setDisabledAllButtons(false);
|
|
75
|
+
};
|
|
76
|
+
const countUpdate = async () => {
|
|
77
|
+
setUpdateCount(-1);
|
|
78
|
+
setDisabledAllButtons(true);
|
|
79
|
+
let count = await get(`/${PLUGIN_ID}/count-update`);
|
|
80
|
+
setUpdateCount(count.data);
|
|
81
|
+
setDisabledAllButtons(false);
|
|
82
|
+
};
|
|
83
|
+
const updateMedia = async () => {
|
|
84
|
+
setDisplayUpdateResult(false);
|
|
85
|
+
setDisabledAllButtons(true);
|
|
86
|
+
let result = await put(`/${PLUGIN_ID}/update-media`);
|
|
87
|
+
if (result.data.response === false) {
|
|
88
|
+
setUpdateMessage("Image optimization was not successful. Please try again later.");
|
|
89
|
+
} else {
|
|
90
|
+
setUpdateMessage(`${result.data.response} image optimizations were successful.`);
|
|
91
|
+
}
|
|
92
|
+
setDisplayUpdateResult(true);
|
|
93
|
+
setDisabledAllButtons(false);
|
|
94
|
+
};
|
|
95
|
+
return /* @__PURE__ */ jsx(Main, { children: /* @__PURE__ */ jsxs(Box, { background: "#FFF", paddingLeft: 8, paddingTop: 5, paddingRight: 8, margin: 8, borderRadius: 2, children: [
|
|
96
|
+
success && isV7CheckSuccessful && /* @__PURE__ */ jsxs(Alert, { title: "Successful", onClose: () => setSuccess(false), closeLabel: "Close alert", variant: "success", children: [
|
|
97
|
+
"Configuration updated. Your domain is ",
|
|
98
|
+
isV7 ? "" : "not",
|
|
99
|
+
" of Cloudimage version 7."
|
|
100
|
+
] }),
|
|
101
|
+
success && !isV7CheckSuccessful && /* @__PURE__ */ jsx(Alert, { title: "Failed", onClose: () => setError(false), closeLabel: "Close alert", variant: "danger", children: "Cannot auto-determine whether it's Cloudimage version 7 or not. Please mannually set Cloudimage version." }),
|
|
102
|
+
error && /* @__PURE__ */ jsx(Alert, { title: "Failed", onClose: () => setError(false), closeLabel: "Close alert", variant: "danger", children: "Please check your configuration inputs. Ensure you entered valid inputs for all required fields." }),
|
|
103
|
+
updateCount > -1 && /* @__PURE__ */ jsxs(Alert, { onClose: () => setUpdateCount(-1), closeLabel: "Close alert", variant: "success", children: [
|
|
104
|
+
"There are ",
|
|
105
|
+
updateCount,
|
|
106
|
+
" image URLs to be optimized."
|
|
107
|
+
] }),
|
|
108
|
+
displayUpdateResult && /* @__PURE__ */ jsx(Alert, { onClose: () => setDisplayUpdateResult(false), closeLabel: "Close alert", variant: "success", children: updateCount <= 0 ? "None are to be optimized." : updateMessage }),
|
|
109
|
+
/* @__PURE__ */ jsx(Box, { paddingTop: 5, paddingRight: 8, children: /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "Cloudimage by Scaleflex" }) }),
|
|
110
|
+
/* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Field.Label, { children: "Token or Domain *" }),
|
|
112
|
+
/* @__PURE__ */ jsx(Field.Input, { type: "text", placeholder: "Token/Domain", value: domain, onChange: (e) => {
|
|
113
|
+
setDomain(e.target.value);
|
|
114
|
+
} })
|
|
115
|
+
] }) }),
|
|
116
|
+
!isV7CheckSuccessful && /* @__PURE__ */ jsx(Box, { spacing: 1, children: /* @__PURE__ */ jsxs(Box, { padding: 2, children: [
|
|
117
|
+
/* @__PURE__ */ jsx(Field.Root, { children: /* @__PURE__ */ jsx(Field.Label, { children: "Is Cloudimage version 7?" }) }),
|
|
118
|
+
/* @__PURE__ */ jsxs(Radio.Group, { onChange: (e) => setManualV7(e.target.value), value: manualV7, name: "manualV7", children: [
|
|
119
|
+
/* @__PURE__ */ jsx(Radio.Item, { value: "true", children: "Version 7" }),
|
|
120
|
+
/* @__PURE__ */ jsx(Radio.Item, { value: "false", children: "Not version 7" })
|
|
121
|
+
] })
|
|
122
|
+
] }) }),
|
|
123
|
+
/* @__PURE__ */ jsx(Box, { width: 200, paddingTop: 3, textAlign: "center", children: /* @__PURE__ */ jsx(Button, { disabled: disabledAllButtons, onClick: () => saveConfiguration(), children: "Save configuration" }) }),
|
|
124
|
+
/* @__PURE__ */ jsxs(Box, { spacing: 4, paddingTop: 3, textAlign: "center", children: [
|
|
125
|
+
/* @__PURE__ */ jsx(Button, { margin: 2, disabled: disabledAllButtons || disableUpdateButtons, onClick: () => countUpdate(), children: "Count optimizable images" }),
|
|
126
|
+
/* @__PURE__ */ jsx(Button, { margin: 2, disabled: disabledAllButtons || disableUpdateButtons, onClick: () => updateMedia(), children: "Optimize old images" })
|
|
127
|
+
] })
|
|
128
|
+
] }) });
|
|
129
|
+
};
|
|
130
|
+
const App = () => {
|
|
131
|
+
return /* @__PURE__ */ jsxs(Routes, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
|
|
133
|
+
/* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
|
|
134
|
+
] });
|
|
135
|
+
};
|
|
136
|
+
export {
|
|
137
|
+
App
|
|
138
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const admin = require("@strapi/strapi/admin");
|
|
5
|
+
const reactRouterDom = require("react-router-dom");
|
|
6
|
+
const react = require("react");
|
|
7
|
+
const designSystem = require("@strapi/design-system");
|
|
8
|
+
const index = require("./index-DfCnchyr.js");
|
|
9
|
+
const HomePage = () => {
|
|
10
|
+
const { get, put } = admin.useFetchClient();
|
|
11
|
+
const [config, setConfig] = react.useState(null);
|
|
12
|
+
const [loading, setLoading] = react.useState(true);
|
|
13
|
+
const [domain, setDomain] = react.useState("");
|
|
14
|
+
const [isV7, setIsV7] = react.useState(false);
|
|
15
|
+
const [isV7CheckSuccessful, setIsV7CheckSuccessful] = react.useState(true);
|
|
16
|
+
const [manualV7, setManualV7] = react.useState(false);
|
|
17
|
+
const [disabledAllButtons, setDisabledAllButtons] = react.useState(false);
|
|
18
|
+
const [success, setSuccess] = react.useState(false);
|
|
19
|
+
const [error, setError] = react.useState(false);
|
|
20
|
+
const [disableUpdateButtons, setDisableUpdateButtons] = react.useState(false);
|
|
21
|
+
const [updateCount, setUpdateCount] = react.useState(-1);
|
|
22
|
+
const [displayUpdateResult, setDisplayUpdateResult] = react.useState(false);
|
|
23
|
+
const [updateMessage, setUpdateMessage] = react.useState("");
|
|
24
|
+
react.useEffect(() => {
|
|
25
|
+
get(`/${index.PLUGIN_ID}/config`, { method: "GET" }).then((data) => {
|
|
26
|
+
let config2 = data.data;
|
|
27
|
+
setConfig(config2);
|
|
28
|
+
setDomain(config2.domain);
|
|
29
|
+
setLoading(false);
|
|
30
|
+
if (!config2.domain || !config2.hasOwnProperty("isV7")) {
|
|
31
|
+
setDisableUpdateButtons(true);
|
|
32
|
+
} else {
|
|
33
|
+
setDisableUpdateButtons(false);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}, []);
|
|
37
|
+
if (loading) {
|
|
38
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: "fetching configuration..." });
|
|
39
|
+
}
|
|
40
|
+
const saveConfiguration = async () => {
|
|
41
|
+
if (!domain) {
|
|
42
|
+
setError(true);
|
|
43
|
+
setSuccess(false);
|
|
44
|
+
setDisabledAllButtons(false);
|
|
45
|
+
return;
|
|
46
|
+
} else {
|
|
47
|
+
setError(false);
|
|
48
|
+
}
|
|
49
|
+
setDisabledAllButtons(true);
|
|
50
|
+
let tokenOrDomain = "";
|
|
51
|
+
if (domain && domain.indexOf(".") === -1) {
|
|
52
|
+
tokenOrDomain = `${domain}.cloudimg.io`.trim();
|
|
53
|
+
} else {
|
|
54
|
+
tokenOrDomain = domain.trim();
|
|
55
|
+
}
|
|
56
|
+
let v7Check = await get(`/${index.PLUGIN_ID}/is-v7?domain=${tokenOrDomain}`);
|
|
57
|
+
v7Check = v7Check.data;
|
|
58
|
+
if (!v7Check.domainExists) {
|
|
59
|
+
setError(true);
|
|
60
|
+
setSuccess(false);
|
|
61
|
+
setDisabledAllButtons(false);
|
|
62
|
+
return;
|
|
63
|
+
} else {
|
|
64
|
+
setError(false);
|
|
65
|
+
}
|
|
66
|
+
setIsV7CheckSuccessful(v7Check.isSuccess);
|
|
67
|
+
let isV7Overall = v7Check.isSuccess ? v7Check.isV7 : manualV7;
|
|
68
|
+
setIsV7(isV7Overall);
|
|
69
|
+
let config2 = {
|
|
70
|
+
domain: tokenOrDomain,
|
|
71
|
+
isV7: isV7Overall
|
|
72
|
+
};
|
|
73
|
+
let updatedConfigs = await put(`/${index.PLUGIN_ID}/update-config`, config2);
|
|
74
|
+
setDomain(updatedConfigs.data.domain);
|
|
75
|
+
setSuccess(true);
|
|
76
|
+
setDisabledAllButtons(false);
|
|
77
|
+
};
|
|
78
|
+
const countUpdate = async () => {
|
|
79
|
+
setUpdateCount(-1);
|
|
80
|
+
setDisabledAllButtons(true);
|
|
81
|
+
let count = await get(`/${index.PLUGIN_ID}/count-update`);
|
|
82
|
+
setUpdateCount(count.data);
|
|
83
|
+
setDisabledAllButtons(false);
|
|
84
|
+
};
|
|
85
|
+
const updateMedia = async () => {
|
|
86
|
+
setDisplayUpdateResult(false);
|
|
87
|
+
setDisabledAllButtons(true);
|
|
88
|
+
let result = await put(`/${index.PLUGIN_ID}/update-media`);
|
|
89
|
+
if (result.data.response === false) {
|
|
90
|
+
setUpdateMessage("Image optimization was not successful. Please try again later.");
|
|
91
|
+
} else {
|
|
92
|
+
setUpdateMessage(`${result.data.response} image optimizations were successful.`);
|
|
93
|
+
}
|
|
94
|
+
setDisplayUpdateResult(true);
|
|
95
|
+
setDisabledAllButtons(false);
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { background: "#FFF", paddingLeft: 8, paddingTop: 5, paddingRight: 8, margin: 8, borderRadius: 2, children: [
|
|
98
|
+
success && isV7CheckSuccessful && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Alert, { title: "Successful", onClose: () => setSuccess(false), closeLabel: "Close alert", variant: "success", children: [
|
|
99
|
+
"Configuration updated. Your domain is ",
|
|
100
|
+
isV7 ? "" : "not",
|
|
101
|
+
" of Cloudimage version 7."
|
|
102
|
+
] }),
|
|
103
|
+
success && !isV7CheckSuccessful && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { title: "Failed", onClose: () => setError(false), closeLabel: "Close alert", variant: "danger", children: "Cannot auto-determine whether it's Cloudimage version 7 or not. Please mannually set Cloudimage version." }),
|
|
104
|
+
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { title: "Failed", onClose: () => setError(false), closeLabel: "Close alert", variant: "danger", children: "Please check your configuration inputs. Ensure you entered valid inputs for all required fields." }),
|
|
105
|
+
updateCount > -1 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Alert, { onClose: () => setUpdateCount(-1), closeLabel: "Close alert", variant: "success", children: [
|
|
106
|
+
"There are ",
|
|
107
|
+
updateCount,
|
|
108
|
+
" image URLs to be optimized."
|
|
109
|
+
] }),
|
|
110
|
+
displayUpdateResult && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Alert, { onClose: () => setDisplayUpdateResult(false), closeLabel: "Close alert", variant: "success", children: updateCount <= 0 ? "None are to be optimized." : updateMessage }),
|
|
111
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 5, paddingRight: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", children: "Cloudimage by Scaleflex" }) }),
|
|
112
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { children: [
|
|
113
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Token or Domain *" }),
|
|
114
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { type: "text", placeholder: "Token/Domain", value: domain, onChange: (e) => {
|
|
115
|
+
setDomain(e.target.value);
|
|
116
|
+
} })
|
|
117
|
+
] }) }),
|
|
118
|
+
!isV7CheckSuccessful && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { spacing: 1, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 2, children: [
|
|
119
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "Is Cloudimage version 7?" }) }),
|
|
120
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Radio.Group, { onChange: (e) => setManualV7(e.target.value), value: manualV7, name: "manualV7", children: [
|
|
121
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { value: "true", children: "Version 7" }),
|
|
122
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Radio.Item, { value: "false", children: "Not version 7" })
|
|
123
|
+
] })
|
|
124
|
+
] }) }),
|
|
125
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: 200, paddingTop: 3, textAlign: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { disabled: disabledAllButtons, onClick: () => saveConfiguration(), children: "Save configuration" }) }),
|
|
126
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { spacing: 4, paddingTop: 3, textAlign: "center", children: [
|
|
127
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { margin: 2, disabled: disabledAllButtons || disableUpdateButtons, onClick: () => countUpdate(), children: "Count optimizable images" }),
|
|
128
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { margin: 2, disabled: disabledAllButtons || disableUpdateButtons, onClick: () => updateMedia(), children: "Optimize old images" })
|
|
129
|
+
] })
|
|
130
|
+
] }) });
|
|
131
|
+
};
|
|
132
|
+
const App = () => {
|
|
133
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
|
|
134
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
|
|
135
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
|
|
136
|
+
] });
|
|
137
|
+
};
|
|
138
|
+
exports.App = App;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const en = {
|
|
4
|
+
"notification.error.fill_required": "Please fill the required fields *.",
|
|
5
|
+
"notification.error.check_token_issue": "An issue occured while checking token. Please try again.",
|
|
6
|
+
"notification.error.wrong_token": "Wrong token. Please use a valid token.",
|
|
7
|
+
"notification.error.check_sectmp_issue": "An issue occured while checking Security Template ID. Please try again.",
|
|
8
|
+
"notification.error.wrong_sectmp": "Wrong Security Template ID. Please use a valid one.",
|
|
9
|
+
"notification.success.sync_connection": "Connection established successfully.",
|
|
10
|
+
"notification.error.sync_status": "An error has occured while checking your status. Maybe you entered the wrong Scaleflex DAM Directory.",
|
|
11
|
+
"notification.success.sync_status": "There are %1$d to sync up. There are %2$d to sync down",
|
|
12
|
+
"label.button.fmaw.export": "Add to Strapi",
|
|
13
|
+
"notification.success.sync_results": "%1$s files are successfully downloaded from Scaleflex DAM. %2$s files are successfully uploaded to Scaleflex DAM",
|
|
14
|
+
"notification.success.update_config": "Scaleflex DAM configurations has been saved"
|
|
15
|
+
};
|
|
16
|
+
exports.default = en;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const en = {
|
|
2
|
+
"notification.error.fill_required": "Please fill the required fields *.",
|
|
3
|
+
"notification.error.check_token_issue": "An issue occured while checking token. Please try again.",
|
|
4
|
+
"notification.error.wrong_token": "Wrong token. Please use a valid token.",
|
|
5
|
+
"notification.error.check_sectmp_issue": "An issue occured while checking Security Template ID. Please try again.",
|
|
6
|
+
"notification.error.wrong_sectmp": "Wrong Security Template ID. Please use a valid one.",
|
|
7
|
+
"notification.success.sync_connection": "Connection established successfully.",
|
|
8
|
+
"notification.error.sync_status": "An error has occured while checking your status. Maybe you entered the wrong Scaleflex DAM Directory.",
|
|
9
|
+
"notification.success.sync_status": "There are %1$d to sync up. There are %2$d to sync down",
|
|
10
|
+
"label.button.fmaw.export": "Add to Strapi",
|
|
11
|
+
"notification.success.sync_results": "%1$s files are successfully downloaded from Scaleflex DAM. %2$s files are successfully uploaded to Scaleflex DAM",
|
|
12
|
+
"notification.success.update_config": "Scaleflex DAM configurations has been saved"
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
en as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fr = {
|
|
4
|
+
"notification.error.fill_required": "Please fill the required fields *.",
|
|
5
|
+
"notification.error.check_token_issue": "An issue occured while checking token. Please try again.",
|
|
6
|
+
"notification.error.wrong_token": "Wrong token. Please use a valid token.",
|
|
7
|
+
"notification.error.check_sectmp_issue": "An issue occured while checking Security Template ID. Please try again.",
|
|
8
|
+
"notification.error.wrong_sectmp": "Wrong Security Template ID. Please use a valid one.",
|
|
9
|
+
"notification.success.sync_connection": "Connection established successfully.",
|
|
10
|
+
"notification.error.sync_status": "An error has occured while checking your status. Maybe you entered the wrong Filerobot Directory.",
|
|
11
|
+
"notification.success.sync_status": "There are %1$d to sync up. There are %2$d to sync down",
|
|
12
|
+
"label.button.fmaw.export": "Add to Strapi",
|
|
13
|
+
"notification.success.sync_results": "%1$s files are successfully downloaded from Filerobot. %2$s files are successfully uploaded to Filerobot",
|
|
14
|
+
"notification.success.update_config": "Filerobot configurations has been saved"
|
|
15
|
+
};
|
|
16
|
+
exports.default = fr;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const fr = {
|
|
2
|
+
"notification.error.fill_required": "Please fill the required fields *.",
|
|
3
|
+
"notification.error.check_token_issue": "An issue occured while checking token. Please try again.",
|
|
4
|
+
"notification.error.wrong_token": "Wrong token. Please use a valid token.",
|
|
5
|
+
"notification.error.check_sectmp_issue": "An issue occured while checking Security Template ID. Please try again.",
|
|
6
|
+
"notification.error.wrong_sectmp": "Wrong Security Template ID. Please use a valid one.",
|
|
7
|
+
"notification.success.sync_connection": "Connection established successfully.",
|
|
8
|
+
"notification.error.sync_status": "An error has occured while checking your status. Maybe you entered the wrong Filerobot Directory.",
|
|
9
|
+
"notification.success.sync_status": "There are %1$d to sync up. There are %2$d to sync down",
|
|
10
|
+
"label.button.fmaw.export": "Add to Strapi",
|
|
11
|
+
"notification.success.sync_results": "%1$s files are successfully downloaded from Filerobot. %2$s files are successfully uploaded to Filerobot",
|
|
12
|
+
"notification.success.update_config": "Filerobot configurations has been saved"
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
fr as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
4
|
+
const v = glob[path];
|
|
5
|
+
if (v) {
|
|
6
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
7
|
+
}
|
|
8
|
+
return new Promise((_, reject) => {
|
|
9
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
10
|
+
reject.bind(
|
|
11
|
+
null,
|
|
12
|
+
new Error(
|
|
13
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
const PLUGIN_ID = "cloudimage-by-scaleflex";
|
|
20
|
+
const Initializer = ({ setPlugin }) => {
|
|
21
|
+
const ref = useRef(setPlugin);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
ref.current(PLUGIN_ID);
|
|
24
|
+
}, []);
|
|
25
|
+
return null;
|
|
26
|
+
};
|
|
27
|
+
const PluginIcon = () => /* @__PURE__ */ jsx("img", { src: "https://assets.scaleflex.com/Marketing/Logos/Cloudimage%20Logos/Logo%20icon/icon.svg?vh=b6218f", width: "20", height: "20" });
|
|
28
|
+
const getTranslation = (data) => {
|
|
29
|
+
return Object.keys(data).reduce((acc, key) => {
|
|
30
|
+
acc[`${PLUGIN_ID}.${key}`] = data[key];
|
|
31
|
+
return acc;
|
|
32
|
+
}, {});
|
|
33
|
+
};
|
|
34
|
+
const index = {
|
|
35
|
+
register(app) {
|
|
36
|
+
app.addMenuLink({
|
|
37
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
38
|
+
icon: PluginIcon,
|
|
39
|
+
intlLabel: {
|
|
40
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
41
|
+
defaultMessage: "Cloudimage"
|
|
42
|
+
},
|
|
43
|
+
Component: async () => {
|
|
44
|
+
const { App } = await import("./App-BmZyLUWk.mjs");
|
|
45
|
+
return App;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
app.registerPlugin({
|
|
49
|
+
id: PLUGIN_ID,
|
|
50
|
+
initializer: Initializer,
|
|
51
|
+
isReady: false,
|
|
52
|
+
name: PLUGIN_ID
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
async registerTrads({ locales }) {
|
|
56
|
+
const importedTranslations = await Promise.all(
|
|
57
|
+
locales.map(async (locale) => {
|
|
58
|
+
try {
|
|
59
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-r7lu9xMg.mjs"), "./translations/fr.json": () => import("./fr-Ge-jvwxL.mjs") }), `./translations/${locale}.json`, 3);
|
|
60
|
+
return { data: getTranslation(data), locale };
|
|
61
|
+
} catch {
|
|
62
|
+
return { data: {}, locale };
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
return importedTranslations;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
PLUGIN_ID as P,
|
|
71
|
+
index as i
|
|
72
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("react");
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
5
|
+
const v = glob[path];
|
|
6
|
+
if (v) {
|
|
7
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
8
|
+
}
|
|
9
|
+
return new Promise((_, reject) => {
|
|
10
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
11
|
+
reject.bind(
|
|
12
|
+
null,
|
|
13
|
+
new Error(
|
|
14
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
15
|
+
)
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const PLUGIN_ID = "cloudimage-by-scaleflex";
|
|
21
|
+
const Initializer = ({ setPlugin }) => {
|
|
22
|
+
const ref = react.useRef(setPlugin);
|
|
23
|
+
react.useEffect(() => {
|
|
24
|
+
ref.current(PLUGIN_ID);
|
|
25
|
+
}, []);
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx("img", { src: "https://assets.scaleflex.com/Marketing/Logos/Cloudimage%20Logos/Logo%20icon/icon.svg?vh=b6218f", width: "20", height: "20" });
|
|
29
|
+
const getTranslation = (data) => {
|
|
30
|
+
return Object.keys(data).reduce((acc, key) => {
|
|
31
|
+
acc[`${PLUGIN_ID}.${key}`] = data[key];
|
|
32
|
+
return acc;
|
|
33
|
+
}, {});
|
|
34
|
+
};
|
|
35
|
+
const index = {
|
|
36
|
+
register(app) {
|
|
37
|
+
app.addMenuLink({
|
|
38
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
39
|
+
icon: PluginIcon,
|
|
40
|
+
intlLabel: {
|
|
41
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
42
|
+
defaultMessage: "Cloudimage"
|
|
43
|
+
},
|
|
44
|
+
Component: async () => {
|
|
45
|
+
const { App } = await Promise.resolve().then(() => require("./App-CRbNvJDt.js"));
|
|
46
|
+
return App;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
app.registerPlugin({
|
|
50
|
+
id: PLUGIN_ID,
|
|
51
|
+
initializer: Initializer,
|
|
52
|
+
isReady: false,
|
|
53
|
+
name: PLUGIN_ID
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
async registerTrads({ locales }) {
|
|
57
|
+
const importedTranslations = await Promise.all(
|
|
58
|
+
locales.map(async (locale) => {
|
|
59
|
+
try {
|
|
60
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-DUVjg0jJ.js")), "./translations/fr.json": () => Promise.resolve().then(() => require("./fr-DTrzyr9o.js")) }), `./translations/${locale}.json`, 3);
|
|
61
|
+
return { data: getTranslation(data), locale };
|
|
62
|
+
} catch {
|
|
63
|
+
return { data: {}, locale };
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
return importedTranslations;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
exports.PLUGIN_ID = PLUGIN_ID;
|
|
71
|
+
exports.index = index;
|