@interware/content-generator 0.4.4 → 0.6.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/README.md +21 -1
- package/dist/_chunks/{App-CfwvfmvL.js → App-CJxSC8yt.js} +32 -720
- package/dist/_chunks/{App-BQr5_g5u.mjs → App-qbgUXlOZ.mjs} +38 -726
- package/dist/_chunks/ImageStudioTabs-BLAH3KYv.mjs +5270 -0
- package/dist/_chunks/ImageStudioTabs-DtusqpQO.js +5271 -0
- package/dist/_chunks/PluginProviders-D79TeGSE.js +34 -0
- package/dist/_chunks/PluginProviders-DWMpcAIh.mjs +35 -0
- package/dist/_chunks/Settings-BQXxV3LO.js +242 -0
- package/dist/_chunks/Settings-o2GngLaW.mjs +242 -0
- package/dist/_chunks/StudioApp-BaySMwrk.js +18 -0
- package/dist/_chunks/StudioApp-C_znlQRo.mjs +18 -0
- package/dist/_chunks/{getTranslation-B9ND5RaH.mjs → getTranslation-B6Bsu-uq.mjs} +1 -1
- package/dist/_chunks/{getTranslation-DNhP1INv.js → getTranslation-BRVMWSf8.js} +1 -1
- package/dist/_chunks/{index-DGPqyrzz.js → index-BKhe-Jyx.js} +24 -6
- package/dist/_chunks/{index-Dyq8dxMX.mjs → index-BKigRXm3.mjs} +25 -7
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/PluginIcon.d.ts +4 -2
- package/dist/admin/src/components/PluginProviders.d.ts +12 -0
- package/dist/admin/src/components/generate-video/Form.d.ts +1 -1
- package/dist/admin/src/components/settings/Form.d.ts +4 -5
- package/dist/admin/src/components/settings/VertexSettings.d.ts +18 -0
- package/dist/admin/src/containers/settings/index.d.ts +7 -7
- package/dist/admin/src/features/background-removal/RemoveBackgroundButton.d.ts +7 -0
- package/dist/admin/src/features/background-removal/RemoveBackgroundDialog.d.ts +15 -0
- package/dist/admin/src/features/background-removal/colorKey.d.ts +29 -0
- package/dist/admin/src/features/background-removal/imageCanvas.d.ts +20 -0
- package/dist/admin/src/features/background-removal/mask.d.ts +10 -0
- package/dist/admin/src/features/background-removal/runtime.d.ts +31 -0
- package/dist/admin/src/features/generator/EditEmpty.d.ts +13 -0
- package/dist/admin/src/features/generator/GeneratorTab.d.ts +7 -0
- package/dist/admin/src/features/generator/GroundingSources.d.ts +9 -0
- package/dist/admin/src/features/generator/ModeSwitch.d.ts +6 -0
- package/dist/admin/src/features/generator/PromptComposer.d.ts +25 -0
- package/dist/admin/src/features/generator/ReferencePicker.d.ts +26 -0
- package/dist/admin/src/features/generator/VersionHistory.d.ts +13 -0
- package/dist/admin/src/features/generator/generatorApi.d.ts +71 -0
- package/dist/admin/src/features/generator/model.d.ts +60 -0
- package/dist/admin/src/features/generator/useGeneratorApi.d.ts +21 -0
- package/dist/admin/src/features/image-studio/ImageStudioTabs.d.ts +26 -0
- package/dist/admin/src/features/image-studio/SegmentedSwitch.d.ts +18 -0
- package/dist/admin/src/features/image-studio/checkerboard.d.ts +5 -0
- package/dist/admin/src/features/library/FileCard.d.ts +17 -0
- package/dist/admin/src/features/library/FolderTree.d.ts +14 -0
- package/dist/admin/src/features/library/LibraryDialogs.d.ts +46 -0
- package/dist/admin/src/features/library/LibraryImagePicker.d.ts +15 -0
- package/dist/admin/src/features/library/LibraryTab.d.ts +2 -0
- package/dist/admin/src/features/library/SaveToLibraryDialog.d.ts +15 -0
- package/dist/admin/src/features/library/model.d.ts +40 -0
- package/dist/admin/src/features/library/studioRoot.d.ts +11 -0
- package/dist/admin/src/features/library/uploadApi.d.ts +77 -0
- package/dist/admin/src/features/library/useLibraryApi.d.ts +34 -0
- package/dist/admin/src/features/templates/editor/ColorField.d.ts +11 -0
- package/dist/admin/src/features/templates/editor/Editor.d.ts +19 -0
- package/dist/admin/src/features/templates/editor/EditorBar.d.ts +9 -0
- package/dist/admin/src/features/templates/editor/EditorMenuBar.d.ts +58 -0
- package/dist/admin/src/features/templates/editor/EditorToolbar.d.ts +20 -0
- package/dist/admin/src/features/templates/editor/ElementPalette.d.ts +10 -0
- package/dist/admin/src/features/templates/editor/FloatingPanel.d.ts +17 -0
- package/dist/admin/src/features/templates/editor/FullscreenView.d.ts +11 -0
- package/dist/admin/src/features/templates/editor/IconPicker.d.ts +9 -0
- package/dist/admin/src/features/templates/editor/Inspector.d.ts +17 -0
- package/dist/admin/src/features/templates/editor/LayersPanel.d.ts +12 -0
- package/dist/admin/src/features/templates/editor/Precision.d.ts +23 -0
- package/dist/admin/src/features/templates/editor/RangeField.d.ts +12 -0
- package/dist/admin/src/features/templates/editor/SaveTemplateDialog.d.ts +14 -0
- package/dist/admin/src/features/templates/editor/Stage.d.ts +29 -0
- package/dist/admin/src/features/templates/editor/TemplateFolderSelect.d.ts +9 -0
- package/dist/admin/src/features/templates/editor/TemplatePicker.d.ts +23 -0
- package/dist/admin/src/features/templates/editor/TemplatesTab.d.ts +5 -0
- package/dist/admin/src/features/templates/editor/TypographyControls.d.ts +24 -0
- package/dist/admin/src/features/templates/editor/icons.d.ts +7 -0
- package/dist/admin/src/features/templates/editor/overlays.d.ts +20 -0
- package/dist/admin/src/features/templates/editor/useCanvasNav.d.ts +25 -0
- package/dist/admin/src/features/templates/editor/useFitScale.d.ts +3 -0
- package/dist/admin/src/features/templates/export/fontEmbed.d.ts +22 -0
- package/dist/admin/src/features/templates/export/imageSource.d.ts +21 -0
- package/dist/admin/src/features/templates/export/pdf.d.ts +6 -0
- package/dist/admin/src/features/templates/export/render.d.ts +22 -0
- package/dist/admin/src/features/templates/export/useEditorIO.d.ts +18 -0
- package/dist/admin/src/features/templates/fonts/catalog.d.ts +47 -0
- package/dist/admin/src/features/templates/fonts/customFonts.d.ts +19 -0
- package/dist/admin/src/features/templates/fonts/useCustomFonts.d.ts +9 -0
- package/dist/admin/src/features/templates/fonts/useFonts.d.ts +2 -0
- package/dist/admin/src/features/templates/model/drag.d.ts +10 -0
- package/dist/admin/src/features/templates/model/editorReducer.d.ts +58 -0
- package/dist/admin/src/features/templates/model/layers.d.ts +42 -0
- package/dist/admin/src/features/templates/model/palette.d.ts +38 -0
- package/dist/admin/src/features/templates/model/presets.d.ts +17 -0
- package/dist/admin/src/features/templates/model/shortcuts.d.ts +19 -0
- package/dist/admin/src/features/templates/model/snap.d.ts +24 -0
- package/dist/admin/src/features/templates/model/templates.d.ts +8 -0
- package/dist/admin/src/features/templates/model/types.d.ts +154 -0
- package/dist/admin/src/features/templates/model/viewport.d.ts +36 -0
- package/dist/admin/src/features/templates/render/IWLogo.d.ts +7 -0
- package/dist/admin/src/features/templates/render/LayerCanvas.d.ts +13 -0
- package/dist/admin/src/features/templates/render/fonts.d.ts +5 -0
- package/dist/admin/src/features/templates/render/icons.d.ts +10 -0
- package/dist/admin/src/features/templates/render/renderLayer.d.ts +9 -0
- package/dist/admin/src/features/templates/store/persist.d.ts +41 -0
- package/dist/admin/src/features/templates/store/templatesApi.d.ts +49 -0
- package/dist/admin/src/features/templates/store/useMyTemplates.d.ts +19 -0
- package/dist/admin/src/features/templates/store/useTemplateSaving.d.ts +14 -0
- package/dist/admin/src/features/templates/store/useTemplatesApi.d.ts +23 -0
- package/dist/admin/src/hooks/useAdminTheme.d.ts +8 -0
- package/dist/admin/src/hooks/useThemeColors.d.ts +9 -0
- package/dist/admin/src/lib/dataUrl.d.ts +6 -0
- package/dist/admin/src/lib/promptRules.d.ts +23 -0
- package/dist/admin/src/lib/use-cases/articles/index.d.ts +12 -1
- package/dist/admin/src/lib/use-cases/categories/index.d.ts +12 -1
- package/dist/admin/src/lib/use-cases/facebook/index.d.ts +1 -1
- package/dist/admin/src/lib/use-cases/generate-content/index.d.ts +2 -2
- package/dist/admin/src/lib/use-cases/images/index.d.ts +1 -4
- package/dist/admin/src/lib/use-cases/linkedin/index.d.ts +1 -1
- package/dist/admin/src/lib/use-cases/settings/index.d.ts +14 -2
- package/dist/admin/src/lib/use-cases/users/index.d.ts +12 -1
- package/dist/admin/src/pages/ImageStudio.d.ts +3 -0
- package/dist/admin/src/pages/StudioApp.d.ts +3 -0
- package/dist/admin/src/pluginId.d.ts +6 -0
- package/dist/admin/src/test-setup.d.ts +1 -0
- package/dist/admin/src/test-utils.d.ts +5 -0
- package/dist/server/index.js +2494 -1279
- package/dist/server/index.mjs +2501 -1285
- package/dist/server/src/bootstrap.d.ts +1 -1
- package/dist/server/src/content-types/index.d.ts +66 -1
- package/dist/server/src/content-types/template/index.d.ts +65 -0
- package/dist/server/src/content-types/template/schema.d.ts +69 -0
- package/dist/server/src/controllers/config.d.ts +10 -0
- package/dist/server/src/controllers/controller.d.ts +0 -5
- package/dist/server/src/controllers/image-studio.d.ts +23 -0
- package/dist/server/src/controllers/index.d.ts +129 -5
- package/dist/server/src/controllers/templates.d.ts +26 -0
- package/dist/server/src/image-studio/geminiConfig.d.ts +40 -0
- package/dist/server/src/image-studio/models.d.ts +39 -0
- package/dist/server/src/image-studio/prompt.d.ts +7 -0
- package/dist/server/src/image-studio/validate.d.ts +41 -0
- package/dist/server/src/index.d.ts +233 -75
- package/dist/server/src/routes/admin.d.ts +6 -2
- package/dist/server/src/routes/content-api.d.ts +4 -9
- package/dist/server/src/routes/index.d.ts +7 -11
- package/dist/server/src/routes/policies.d.ts +14 -0
- package/dist/server/src/services/image-studio.d.ts +66 -0
- package/dist/server/src/services/index.d.ts +30 -57
- package/dist/server/src/services/service.d.ts +10 -57
- package/dist/server/src/services/templates.d.ts +81 -0
- package/dist/server/src/templates/folders.d.ts +14 -0
- package/dist/server/src/templates/validate.d.ts +23 -0
- package/dist/server/src/utils/folders.d.ts +15 -0
- package/dist/server/src/utils/geminiClient.d.ts +24 -0
- package/dist/server/src/utils/secrets.d.ts +9 -0
- package/dist/server/src/utils/serviceAccount.d.ts +29 -0
- package/package.json +23 -10
- package/static/background-worker.d.mts +15 -0
- package/static/background-worker.mjs +87 -0
- package/dist/_chunks/Settings-BrqTzJp-.js +0 -262
- package/dist/_chunks/Settings-CdZnYLLK.mjs +0 -244
- package/dist/admin/src/components/Navigation.d.ts +0 -2
- package/dist/admin/src/components/generate-image/Form.d.ts +0 -15
- package/dist/admin/src/components/generate-images/Image.d.ts +0 -5
- package/dist/admin/src/components/generate-images/Images.d.ts +0 -2
- package/dist/admin/src/components/generate-images/Modal.d.ts +0 -9
- package/dist/admin/src/containers/generate-image/index.d.ts +0 -2
- package/dist/admin/src/containers/generate-images/index.d.ts +0 -2
- package/dist/admin/src/hooks/generate-images/useImages.d.ts +0 -12
- package/dist/admin/src/pages/GenerateImage.d.ts +0 -2
- package/dist/admin/src/pages/GenerateImages.d.ts +0 -2
|
@@ -1,262 +0,0 @@
|
|
|
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 reactIntl = require("react-intl");
|
|
6
|
-
const react = require("react");
|
|
7
|
-
const designSystem = require("@strapi/design-system");
|
|
8
|
-
const formik = require("formik");
|
|
9
|
-
const Yup = require("yup");
|
|
10
|
-
const index = require("./index-DGPqyrzz.js");
|
|
11
|
-
const getTranslation = require("./getTranslation-DNhP1INv.js");
|
|
12
|
-
function _interopNamespace(e) {
|
|
13
|
-
if (e && e.__esModule) return e;
|
|
14
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
15
|
-
if (e) {
|
|
16
|
-
for (const k in e) {
|
|
17
|
-
if (k !== "default") {
|
|
18
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: () => e[k]
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
n.default = e;
|
|
27
|
-
return Object.freeze(n);
|
|
28
|
-
}
|
|
29
|
-
const Yup__namespace = /* @__PURE__ */ _interopNamespace(Yup);
|
|
30
|
-
const useSettings = () => {
|
|
31
|
-
const { get, post } = admin.useFetchClient();
|
|
32
|
-
const getSettings = react.useCallback(
|
|
33
|
-
async (config) => {
|
|
34
|
-
return get("/api/strapi-content-generator-gemini/config", config);
|
|
35
|
-
},
|
|
36
|
-
[get]
|
|
37
|
-
);
|
|
38
|
-
const setSettings = react.useCallback(
|
|
39
|
-
async (data, config) => {
|
|
40
|
-
return post("/api/strapi-content-generator-gemini/config", data, config);
|
|
41
|
-
},
|
|
42
|
-
[post]
|
|
43
|
-
);
|
|
44
|
-
return {
|
|
45
|
-
getSettings,
|
|
46
|
-
setSettings
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
const schema = Yup__namespace.object({
|
|
50
|
-
googleGenAI: Yup__namespace.string().required("Este campo es requerido"),
|
|
51
|
-
linkedInAccessToken: Yup__namespace.string().required("Este campo es requerido"),
|
|
52
|
-
linkedInOrganizationId: Yup__namespace.string().required("Este campo es requerido"),
|
|
53
|
-
facebookClientToken: Yup__namespace.string().required("Este campo es requerido"),
|
|
54
|
-
facebookPageId: Yup__namespace.string().required("Este campo es requerido")
|
|
55
|
-
});
|
|
56
|
-
const Form = ({ settings, handleSubmit }) => {
|
|
57
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, margin: 6, background: "neutral0", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
58
|
-
formik.Formik,
|
|
59
|
-
{
|
|
60
|
-
enableReinitialize: true,
|
|
61
|
-
initialValues: settings,
|
|
62
|
-
validationSchema: schema,
|
|
63
|
-
onSubmit: handleSubmit,
|
|
64
|
-
children: ({
|
|
65
|
-
values,
|
|
66
|
-
handleChange,
|
|
67
|
-
handleBlur,
|
|
68
|
-
handleSubmit: handleSubmit2,
|
|
69
|
-
isValid,
|
|
70
|
-
dirty,
|
|
71
|
-
isSubmitting
|
|
72
|
-
}) => {
|
|
73
|
-
return /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: handleSubmit2, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
|
|
74
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
75
|
-
designSystem.Field.Root,
|
|
76
|
-
{
|
|
77
|
-
id: "googleGenAI",
|
|
78
|
-
required: true,
|
|
79
|
-
width: "100%",
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "API Key Gemini" }),
|
|
82
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
83
|
-
designSystem.Field.Input,
|
|
84
|
-
{
|
|
85
|
-
name: "googleGenAI",
|
|
86
|
-
value: values.googleGenAI,
|
|
87
|
-
onChange: handleChange,
|
|
88
|
-
type: "password"
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
) }),
|
|
94
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
95
|
-
designSystem.Field.Root,
|
|
96
|
-
{
|
|
97
|
-
id: "linkedInAccessToken",
|
|
98
|
-
required: true,
|
|
99
|
-
width: "100%",
|
|
100
|
-
children: [
|
|
101
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "LinkedIn Access Token" }),
|
|
102
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
103
|
-
designSystem.Field.Input,
|
|
104
|
-
{
|
|
105
|
-
name: "linkedInAccessToken",
|
|
106
|
-
value: values.linkedInAccessToken,
|
|
107
|
-
onChange: handleChange,
|
|
108
|
-
type: "password",
|
|
109
|
-
onBlur: handleBlur
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
) }),
|
|
115
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
116
|
-
designSystem.Field.Root,
|
|
117
|
-
{
|
|
118
|
-
id: "linkedInOrganizationId",
|
|
119
|
-
required: true,
|
|
120
|
-
width: "100%",
|
|
121
|
-
children: [
|
|
122
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "LinkedIn Organization ID" }),
|
|
123
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
124
|
-
designSystem.Field.Input,
|
|
125
|
-
{
|
|
126
|
-
name: "linkedInOrganizationId",
|
|
127
|
-
value: values.linkedInOrganizationId,
|
|
128
|
-
type: "password",
|
|
129
|
-
onChange: handleChange
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
) }),
|
|
135
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
136
|
-
designSystem.Field.Root,
|
|
137
|
-
{
|
|
138
|
-
id: "facebookClientToken",
|
|
139
|
-
required: true,
|
|
140
|
-
width: "100%",
|
|
141
|
-
children: [
|
|
142
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "FACEBOOK CLIENT TOKEN" }),
|
|
143
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
144
|
-
designSystem.Field.Input,
|
|
145
|
-
{
|
|
146
|
-
name: "facebookClientToken",
|
|
147
|
-
value: values.facebookClientToken,
|
|
148
|
-
type: "password",
|
|
149
|
-
onChange: handleChange
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
) }),
|
|
155
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
156
|
-
designSystem.Field.Root,
|
|
157
|
-
{
|
|
158
|
-
id: "facebookPageId",
|
|
159
|
-
required: true,
|
|
160
|
-
width: "100%",
|
|
161
|
-
children: [
|
|
162
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: "FACEBOOK PAGE ID" }),
|
|
163
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
164
|
-
designSystem.Field.Input,
|
|
165
|
-
{
|
|
166
|
-
name: "facebookPageId",
|
|
167
|
-
value: values.facebookPageId,
|
|
168
|
-
type: "password",
|
|
169
|
-
onChange: handleChange
|
|
170
|
-
}
|
|
171
|
-
)
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
) }),
|
|
175
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "end", alignItems: "end", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
-
designSystem.Button,
|
|
177
|
-
{
|
|
178
|
-
type: "submit",
|
|
179
|
-
disabled: !isValid || !dirty || isSubmitting,
|
|
180
|
-
children: "Guardar"
|
|
181
|
-
}
|
|
182
|
-
) }) })
|
|
183
|
-
] }) });
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
) });
|
|
187
|
-
};
|
|
188
|
-
const initialValues = {
|
|
189
|
-
googleGenAI: "",
|
|
190
|
-
linkedInAccessToken: "",
|
|
191
|
-
linkedInOrganizationId: "",
|
|
192
|
-
facebookClientToken: "",
|
|
193
|
-
facebookPageId: ""
|
|
194
|
-
};
|
|
195
|
-
const SettingsContainer = () => {
|
|
196
|
-
const [settings, setSettingsConfig] = react.useState(initialValues);
|
|
197
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
198
|
-
const { getSettings, setSettings } = useSettings();
|
|
199
|
-
const { toggleNotification } = admin.useNotification();
|
|
200
|
-
const fetchSettings = react.useCallback(async () => {
|
|
201
|
-
let isMounted = true;
|
|
202
|
-
try {
|
|
203
|
-
const { data } = await getSettings();
|
|
204
|
-
if (isMounted) {
|
|
205
|
-
setSettingsConfig(data);
|
|
206
|
-
}
|
|
207
|
-
} catch (error) {
|
|
208
|
-
toggleNotification({
|
|
209
|
-
type: "danger",
|
|
210
|
-
message: formatMessage({
|
|
211
|
-
id: `${index.PLUGIN_ID}.config.load.error`,
|
|
212
|
-
defaultMessage: "Error cargando configuración"
|
|
213
|
-
})
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
return () => {
|
|
217
|
-
isMounted = false;
|
|
218
|
-
};
|
|
219
|
-
}, [getSettings]);
|
|
220
|
-
const handleSubmit = react.useCallback(
|
|
221
|
-
async (values) => {
|
|
222
|
-
try {
|
|
223
|
-
await setSettings(values);
|
|
224
|
-
setSettingsConfig(values);
|
|
225
|
-
toggleNotification({
|
|
226
|
-
type: "success",
|
|
227
|
-
message: formatMessage({
|
|
228
|
-
id: `${index.PLUGIN_ID}.config.load.error`,
|
|
229
|
-
defaultMessage: "Configuración guardada con éxito"
|
|
230
|
-
})
|
|
231
|
-
});
|
|
232
|
-
} catch (error) {
|
|
233
|
-
toggleNotification({
|
|
234
|
-
type: "danger",
|
|
235
|
-
message: formatMessage({
|
|
236
|
-
id: `${index.PLUGIN_ID}.config.load.error`,
|
|
237
|
-
defaultMessage: "Error guardando configuración"
|
|
238
|
-
})
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
[]
|
|
243
|
-
);
|
|
244
|
-
react.useEffect(() => {
|
|
245
|
-
fetchSettings();
|
|
246
|
-
}, []);
|
|
247
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.DesignSystemProvider, { locale: "es-MX", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { padding: 6, gap: 3, children: [
|
|
248
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", children: [
|
|
249
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", children: formatMessage({ id: getTranslation.getTranslation("plugin.name") }) }),
|
|
250
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
|
|
251
|
-
] }) }),
|
|
252
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form, { settings, handleSubmit }) })
|
|
253
|
-
] }) });
|
|
254
|
-
};
|
|
255
|
-
const SettingsPage = () => {
|
|
256
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
257
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
|
|
258
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: `${formatMessage({ id: getTranslation.getTranslation("plugin.name") })} | Settings` }),
|
|
259
|
-
/* @__PURE__ */ jsxRuntime.jsx(SettingsContainer, {})
|
|
260
|
-
] }) });
|
|
261
|
-
};
|
|
262
|
-
exports.default = SettingsPage;
|
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useFetchClient, useNotification, Page } from "@strapi/strapi/admin";
|
|
3
|
-
import { useIntl } from "react-intl";
|
|
4
|
-
import { useCallback, useState, useEffect } from "react";
|
|
5
|
-
import { Box, Grid, Field, Flex, Button, DesignSystemProvider, Typography } from "@strapi/design-system";
|
|
6
|
-
import { Formik } from "formik";
|
|
7
|
-
import * as Yup from "yup";
|
|
8
|
-
import { P as PLUGIN_ID } from "./index-Dyq8dxMX.mjs";
|
|
9
|
-
import { g as getTranslation } from "./getTranslation-B9ND5RaH.mjs";
|
|
10
|
-
const useSettings = () => {
|
|
11
|
-
const { get, post } = useFetchClient();
|
|
12
|
-
const getSettings = useCallback(
|
|
13
|
-
async (config) => {
|
|
14
|
-
return get("/api/strapi-content-generator-gemini/config", config);
|
|
15
|
-
},
|
|
16
|
-
[get]
|
|
17
|
-
);
|
|
18
|
-
const setSettings = useCallback(
|
|
19
|
-
async (data, config) => {
|
|
20
|
-
return post("/api/strapi-content-generator-gemini/config", data, config);
|
|
21
|
-
},
|
|
22
|
-
[post]
|
|
23
|
-
);
|
|
24
|
-
return {
|
|
25
|
-
getSettings,
|
|
26
|
-
setSettings
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
const schema = Yup.object({
|
|
30
|
-
googleGenAI: Yup.string().required("Este campo es requerido"),
|
|
31
|
-
linkedInAccessToken: Yup.string().required("Este campo es requerido"),
|
|
32
|
-
linkedInOrganizationId: Yup.string().required("Este campo es requerido"),
|
|
33
|
-
facebookClientToken: Yup.string().required("Este campo es requerido"),
|
|
34
|
-
facebookPageId: Yup.string().required("Este campo es requerido")
|
|
35
|
-
});
|
|
36
|
-
const Form = ({ settings, handleSubmit }) => {
|
|
37
|
-
return /* @__PURE__ */ jsx(Box, { padding: 6, margin: 6, background: "neutral0", width: "100%", children: /* @__PURE__ */ jsx(
|
|
38
|
-
Formik,
|
|
39
|
-
{
|
|
40
|
-
enableReinitialize: true,
|
|
41
|
-
initialValues: settings,
|
|
42
|
-
validationSchema: schema,
|
|
43
|
-
onSubmit: handleSubmit,
|
|
44
|
-
children: ({
|
|
45
|
-
values,
|
|
46
|
-
handleChange,
|
|
47
|
-
handleBlur,
|
|
48
|
-
handleSubmit: handleSubmit2,
|
|
49
|
-
isValid,
|
|
50
|
-
dirty,
|
|
51
|
-
isSubmitting
|
|
52
|
-
}) => {
|
|
53
|
-
return /* @__PURE__ */ jsx("form", { onSubmit: handleSubmit2, children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
54
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(
|
|
55
|
-
Field.Root,
|
|
56
|
-
{
|
|
57
|
-
id: "googleGenAI",
|
|
58
|
-
required: true,
|
|
59
|
-
width: "100%",
|
|
60
|
-
children: [
|
|
61
|
-
/* @__PURE__ */ jsx(Field.Label, { children: "API Key Gemini" }),
|
|
62
|
-
/* @__PURE__ */ jsx(
|
|
63
|
-
Field.Input,
|
|
64
|
-
{
|
|
65
|
-
name: "googleGenAI",
|
|
66
|
-
value: values.googleGenAI,
|
|
67
|
-
onChange: handleChange,
|
|
68
|
-
type: "password"
|
|
69
|
-
}
|
|
70
|
-
)
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
) }),
|
|
74
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(
|
|
75
|
-
Field.Root,
|
|
76
|
-
{
|
|
77
|
-
id: "linkedInAccessToken",
|
|
78
|
-
required: true,
|
|
79
|
-
width: "100%",
|
|
80
|
-
children: [
|
|
81
|
-
/* @__PURE__ */ jsx(Field.Label, { children: "LinkedIn Access Token" }),
|
|
82
|
-
/* @__PURE__ */ jsx(
|
|
83
|
-
Field.Input,
|
|
84
|
-
{
|
|
85
|
-
name: "linkedInAccessToken",
|
|
86
|
-
value: values.linkedInAccessToken,
|
|
87
|
-
onChange: handleChange,
|
|
88
|
-
type: "password",
|
|
89
|
-
onBlur: handleBlur
|
|
90
|
-
}
|
|
91
|
-
)
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
) }),
|
|
95
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(
|
|
96
|
-
Field.Root,
|
|
97
|
-
{
|
|
98
|
-
id: "linkedInOrganizationId",
|
|
99
|
-
required: true,
|
|
100
|
-
width: "100%",
|
|
101
|
-
children: [
|
|
102
|
-
/* @__PURE__ */ jsx(Field.Label, { children: "LinkedIn Organization ID" }),
|
|
103
|
-
/* @__PURE__ */ jsx(
|
|
104
|
-
Field.Input,
|
|
105
|
-
{
|
|
106
|
-
name: "linkedInOrganizationId",
|
|
107
|
-
value: values.linkedInOrganizationId,
|
|
108
|
-
type: "password",
|
|
109
|
-
onChange: handleChange
|
|
110
|
-
}
|
|
111
|
-
)
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
) }),
|
|
115
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(
|
|
116
|
-
Field.Root,
|
|
117
|
-
{
|
|
118
|
-
id: "facebookClientToken",
|
|
119
|
-
required: true,
|
|
120
|
-
width: "100%",
|
|
121
|
-
children: [
|
|
122
|
-
/* @__PURE__ */ jsx(Field.Label, { children: "FACEBOOK CLIENT TOKEN" }),
|
|
123
|
-
/* @__PURE__ */ jsx(
|
|
124
|
-
Field.Input,
|
|
125
|
-
{
|
|
126
|
-
name: "facebookClientToken",
|
|
127
|
-
value: values.facebookClientToken,
|
|
128
|
-
type: "password",
|
|
129
|
-
onChange: handleChange
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
]
|
|
133
|
-
}
|
|
134
|
-
) }),
|
|
135
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(
|
|
136
|
-
Field.Root,
|
|
137
|
-
{
|
|
138
|
-
id: "facebookPageId",
|
|
139
|
-
required: true,
|
|
140
|
-
width: "100%",
|
|
141
|
-
children: [
|
|
142
|
-
/* @__PURE__ */ jsx(Field.Label, { children: "FACEBOOK PAGE ID" }),
|
|
143
|
-
/* @__PURE__ */ jsx(
|
|
144
|
-
Field.Input,
|
|
145
|
-
{
|
|
146
|
-
name: "facebookPageId",
|
|
147
|
-
value: values.facebookPageId,
|
|
148
|
-
type: "password",
|
|
149
|
-
onChange: handleChange
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
]
|
|
153
|
-
}
|
|
154
|
-
) }),
|
|
155
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "end", alignItems: "end", width: "100%", children: /* @__PURE__ */ jsx(
|
|
156
|
-
Button,
|
|
157
|
-
{
|
|
158
|
-
type: "submit",
|
|
159
|
-
disabled: !isValid || !dirty || isSubmitting,
|
|
160
|
-
children: "Guardar"
|
|
161
|
-
}
|
|
162
|
-
) }) })
|
|
163
|
-
] }) });
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
) });
|
|
167
|
-
};
|
|
168
|
-
const initialValues = {
|
|
169
|
-
googleGenAI: "",
|
|
170
|
-
linkedInAccessToken: "",
|
|
171
|
-
linkedInOrganizationId: "",
|
|
172
|
-
facebookClientToken: "",
|
|
173
|
-
facebookPageId: ""
|
|
174
|
-
};
|
|
175
|
-
const SettingsContainer = () => {
|
|
176
|
-
const [settings, setSettingsConfig] = useState(initialValues);
|
|
177
|
-
const { formatMessage } = useIntl();
|
|
178
|
-
const { getSettings, setSettings } = useSettings();
|
|
179
|
-
const { toggleNotification } = useNotification();
|
|
180
|
-
const fetchSettings = useCallback(async () => {
|
|
181
|
-
let isMounted = true;
|
|
182
|
-
try {
|
|
183
|
-
const { data } = await getSettings();
|
|
184
|
-
if (isMounted) {
|
|
185
|
-
setSettingsConfig(data);
|
|
186
|
-
}
|
|
187
|
-
} catch (error) {
|
|
188
|
-
toggleNotification({
|
|
189
|
-
type: "danger",
|
|
190
|
-
message: formatMessage({
|
|
191
|
-
id: `${PLUGIN_ID}.config.load.error`,
|
|
192
|
-
defaultMessage: "Error cargando configuración"
|
|
193
|
-
})
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
return () => {
|
|
197
|
-
isMounted = false;
|
|
198
|
-
};
|
|
199
|
-
}, [getSettings]);
|
|
200
|
-
const handleSubmit = useCallback(
|
|
201
|
-
async (values) => {
|
|
202
|
-
try {
|
|
203
|
-
await setSettings(values);
|
|
204
|
-
setSettingsConfig(values);
|
|
205
|
-
toggleNotification({
|
|
206
|
-
type: "success",
|
|
207
|
-
message: formatMessage({
|
|
208
|
-
id: `${PLUGIN_ID}.config.load.error`,
|
|
209
|
-
defaultMessage: "Configuración guardada con éxito"
|
|
210
|
-
})
|
|
211
|
-
});
|
|
212
|
-
} catch (error) {
|
|
213
|
-
toggleNotification({
|
|
214
|
-
type: "danger",
|
|
215
|
-
message: formatMessage({
|
|
216
|
-
id: `${PLUGIN_ID}.config.load.error`,
|
|
217
|
-
defaultMessage: "Error guardando configuración"
|
|
218
|
-
})
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
[]
|
|
223
|
-
);
|
|
224
|
-
useEffect(() => {
|
|
225
|
-
fetchSettings();
|
|
226
|
-
}, []);
|
|
227
|
-
return /* @__PURE__ */ jsx(DesignSystemProvider, { locale: "es-MX", children: /* @__PURE__ */ jsxs(Grid.Root, { padding: 6, gap: 3, children: [
|
|
228
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", children: [
|
|
229
|
-
/* @__PURE__ */ jsx(Typography, { variant: "alpha", children: formatMessage({ id: getTranslation("plugin.name") }) }),
|
|
230
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
|
|
231
|
-
] }) }),
|
|
232
|
-
/* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Form, { settings, handleSubmit }) })
|
|
233
|
-
] }) });
|
|
234
|
-
};
|
|
235
|
-
const SettingsPage = () => {
|
|
236
|
-
const { formatMessage } = useIntl();
|
|
237
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Page.Main, { children: [
|
|
238
|
-
/* @__PURE__ */ jsx(Page.Title, { children: `${formatMessage({ id: getTranslation("plugin.name") })} | Settings` }),
|
|
239
|
-
/* @__PURE__ */ jsx(SettingsContainer, {})
|
|
240
|
-
] }) });
|
|
241
|
-
};
|
|
242
|
-
export {
|
|
243
|
-
SettingsPage as default
|
|
244
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FormikHelpers } from 'formik';
|
|
2
|
-
export interface FormValues {
|
|
3
|
-
prompt: string;
|
|
4
|
-
aspectRatio: string;
|
|
5
|
-
imageSize: string;
|
|
6
|
-
}
|
|
7
|
-
export type ReferenceImage = {
|
|
8
|
-
id: number;
|
|
9
|
-
file?: File;
|
|
10
|
-
previewUrl?: string;
|
|
11
|
-
};
|
|
12
|
-
declare const Form: ({ onSubmit }: {
|
|
13
|
-
onSubmit: (values: FormValues, formikHelpers: FormikHelpers<FormValues>, referenceImages: ReferenceImage[]) => Promise<void>;
|
|
14
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export { Form };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Dispatch, SetStateAction } from "react";
|
|
2
|
-
import type { Data } from "@strapi/strapi";
|
|
3
|
-
declare const ModalImagesSizes: ({ open, setOpen, image, handleDownload }: {
|
|
4
|
-
open: boolean;
|
|
5
|
-
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
6
|
-
image: Data.ContentType<"plugin::upload.file">;
|
|
7
|
-
handleDownload: (selectedKeys: Set<string>) => Promise<void>;
|
|
8
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
-
export { ModalImagesSizes };
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import type { Data } from '@strapi/strapi';
|
|
3
|
-
interface ImagesContextType {
|
|
4
|
-
images: Data.ContentType<"plugin::upload.file">[];
|
|
5
|
-
downloadingId: string | null;
|
|
6
|
-
onClickAction: (image: Data.ContentType<"plugin::upload.file">, action: "delete" | "download") => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const ImagesProvider: ({ children }: {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare const useImages: () => ImagesContextType;
|
|
12
|
-
export {};
|