@interware/content-generator 0.4.3 → 0.5.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.
Files changed (161) hide show
  1. package/README.md +21 -1
  2. package/dist/_chunks/{App-oubMDdAZ.mjs → App-DPVBu7QB.mjs} +37 -712
  3. package/dist/_chunks/{App-DmCOiKrV.js → App-DVTFrZvf.js} +31 -706
  4. package/dist/_chunks/ImageStudioTabs-B2UbKYq7.js +5299 -0
  5. package/dist/_chunks/ImageStudioTabs-mlNL6aQ2.mjs +5298 -0
  6. package/dist/_chunks/Settings-DziRY70a.js +155 -0
  7. package/dist/_chunks/Settings-RrBQdijj.mjs +155 -0
  8. package/dist/_chunks/StudioApp-AUyPNhh2.mjs +17 -0
  9. package/dist/_chunks/StudioApp-Cswkzh7F.js +17 -0
  10. package/dist/_chunks/{getTranslation-DwDV99gW.js → getTranslation-D88uLXGd.js} +1 -1
  11. package/dist/_chunks/{getTranslation-B0tfTODk.mjs → getTranslation-DfxaP_TC.mjs} +1 -1
  12. package/dist/_chunks/{index-PnmqwUfI.mjs → index-CqDdi211.mjs} +25 -7
  13. package/dist/_chunks/{index-CTnsB_jp.js → index-Ddp0Qvqo.js} +24 -6
  14. package/dist/admin/index.js +1 -1
  15. package/dist/admin/index.mjs +1 -1
  16. package/dist/admin/src/components/PluginIcon.d.ts +4 -2
  17. package/dist/admin/src/components/PluginProviders.d.ts +8 -0
  18. package/dist/admin/src/components/generate-video/Form.d.ts +1 -1
  19. package/dist/admin/src/components/settings/Form.d.ts +4 -5
  20. package/dist/admin/src/containers/settings/index.d.ts +7 -7
  21. package/dist/admin/src/features/background-removal/RemoveBackgroundButton.d.ts +7 -0
  22. package/dist/admin/src/features/background-removal/RemoveBackgroundDialog.d.ts +15 -0
  23. package/dist/admin/src/features/background-removal/colorKey.d.ts +29 -0
  24. package/dist/admin/src/features/background-removal/imageCanvas.d.ts +20 -0
  25. package/dist/admin/src/features/background-removal/mask.d.ts +10 -0
  26. package/dist/admin/src/features/background-removal/runtime.d.ts +31 -0
  27. package/dist/admin/src/features/generator/EditEmpty.d.ts +13 -0
  28. package/dist/admin/src/features/generator/GeneratorTab.d.ts +7 -0
  29. package/dist/admin/src/features/generator/GroundingSources.d.ts +9 -0
  30. package/dist/admin/src/features/generator/ModeSwitch.d.ts +6 -0
  31. package/dist/admin/src/features/generator/PromptComposer.d.ts +25 -0
  32. package/dist/admin/src/features/generator/ReferencePicker.d.ts +26 -0
  33. package/dist/admin/src/features/generator/VersionHistory.d.ts +13 -0
  34. package/dist/admin/src/features/generator/generatorApi.d.ts +71 -0
  35. package/dist/admin/src/features/generator/model.d.ts +60 -0
  36. package/dist/admin/src/features/generator/useGeneratorApi.d.ts +21 -0
  37. package/dist/admin/src/features/image-studio/ImageStudioTabs.d.ts +26 -0
  38. package/dist/admin/src/features/image-studio/SegmentedSwitch.d.ts +18 -0
  39. package/dist/admin/src/features/image-studio/checkerboard.d.ts +5 -0
  40. package/dist/admin/src/features/library/FileCard.d.ts +17 -0
  41. package/dist/admin/src/features/library/FolderTree.d.ts +14 -0
  42. package/dist/admin/src/features/library/LibraryDialogs.d.ts +46 -0
  43. package/dist/admin/src/features/library/LibraryImagePicker.d.ts +15 -0
  44. package/dist/admin/src/features/library/LibraryTab.d.ts +2 -0
  45. package/dist/admin/src/features/library/SaveToLibraryDialog.d.ts +15 -0
  46. package/dist/admin/src/features/library/model.d.ts +40 -0
  47. package/dist/admin/src/features/library/studioRoot.d.ts +11 -0
  48. package/dist/admin/src/features/library/uploadApi.d.ts +77 -0
  49. package/dist/admin/src/features/library/useLibraryApi.d.ts +34 -0
  50. package/dist/admin/src/features/templates/editor/ColorField.d.ts +11 -0
  51. package/dist/admin/src/features/templates/editor/Editor.d.ts +19 -0
  52. package/dist/admin/src/features/templates/editor/EditorBar.d.ts +9 -0
  53. package/dist/admin/src/features/templates/editor/EditorMenuBar.d.ts +58 -0
  54. package/dist/admin/src/features/templates/editor/EditorToolbar.d.ts +20 -0
  55. package/dist/admin/src/features/templates/editor/ElementPalette.d.ts +10 -0
  56. package/dist/admin/src/features/templates/editor/FloatingPanel.d.ts +17 -0
  57. package/dist/admin/src/features/templates/editor/FullscreenView.d.ts +11 -0
  58. package/dist/admin/src/features/templates/editor/IconPicker.d.ts +9 -0
  59. package/dist/admin/src/features/templates/editor/Inspector.d.ts +17 -0
  60. package/dist/admin/src/features/templates/editor/LayersPanel.d.ts +12 -0
  61. package/dist/admin/src/features/templates/editor/Precision.d.ts +23 -0
  62. package/dist/admin/src/features/templates/editor/RangeField.d.ts +12 -0
  63. package/dist/admin/src/features/templates/editor/SaveTemplateDialog.d.ts +14 -0
  64. package/dist/admin/src/features/templates/editor/Stage.d.ts +29 -0
  65. package/dist/admin/src/features/templates/editor/TemplateFolderSelect.d.ts +9 -0
  66. package/dist/admin/src/features/templates/editor/TemplatePicker.d.ts +23 -0
  67. package/dist/admin/src/features/templates/editor/TemplatesTab.d.ts +5 -0
  68. package/dist/admin/src/features/templates/editor/TypographyControls.d.ts +24 -0
  69. package/dist/admin/src/features/templates/editor/icons.d.ts +7 -0
  70. package/dist/admin/src/features/templates/editor/overlays.d.ts +20 -0
  71. package/dist/admin/src/features/templates/editor/useCanvasNav.d.ts +25 -0
  72. package/dist/admin/src/features/templates/editor/useFitScale.d.ts +3 -0
  73. package/dist/admin/src/features/templates/export/fontEmbed.d.ts +22 -0
  74. package/dist/admin/src/features/templates/export/imageSource.d.ts +21 -0
  75. package/dist/admin/src/features/templates/export/pdf.d.ts +6 -0
  76. package/dist/admin/src/features/templates/export/render.d.ts +22 -0
  77. package/dist/admin/src/features/templates/export/useEditorIO.d.ts +18 -0
  78. package/dist/admin/src/features/templates/fonts/catalog.d.ts +47 -0
  79. package/dist/admin/src/features/templates/fonts/customFonts.d.ts +19 -0
  80. package/dist/admin/src/features/templates/fonts/useCustomFonts.d.ts +9 -0
  81. package/dist/admin/src/features/templates/fonts/useFonts.d.ts +2 -0
  82. package/dist/admin/src/features/templates/model/drag.d.ts +10 -0
  83. package/dist/admin/src/features/templates/model/editorReducer.d.ts +58 -0
  84. package/dist/admin/src/features/templates/model/layers.d.ts +42 -0
  85. package/dist/admin/src/features/templates/model/palette.d.ts +38 -0
  86. package/dist/admin/src/features/templates/model/presets.d.ts +17 -0
  87. package/dist/admin/src/features/templates/model/shortcuts.d.ts +19 -0
  88. package/dist/admin/src/features/templates/model/snap.d.ts +24 -0
  89. package/dist/admin/src/features/templates/model/templates.d.ts +8 -0
  90. package/dist/admin/src/features/templates/model/types.d.ts +154 -0
  91. package/dist/admin/src/features/templates/model/viewport.d.ts +36 -0
  92. package/dist/admin/src/features/templates/render/IWLogo.d.ts +7 -0
  93. package/dist/admin/src/features/templates/render/LayerCanvas.d.ts +13 -0
  94. package/dist/admin/src/features/templates/render/fonts.d.ts +5 -0
  95. package/dist/admin/src/features/templates/render/icons.d.ts +10 -0
  96. package/dist/admin/src/features/templates/render/renderLayer.d.ts +9 -0
  97. package/dist/admin/src/features/templates/store/persist.d.ts +41 -0
  98. package/dist/admin/src/features/templates/store/templatesApi.d.ts +49 -0
  99. package/dist/admin/src/features/templates/store/useMyTemplates.d.ts +19 -0
  100. package/dist/admin/src/features/templates/store/useTemplateSaving.d.ts +14 -0
  101. package/dist/admin/src/features/templates/store/useTemplatesApi.d.ts +23 -0
  102. package/dist/admin/src/hooks/useAdminTheme.d.ts +8 -0
  103. package/dist/admin/src/hooks/useThemeColors.d.ts +9 -0
  104. package/dist/admin/src/lib/dataUrl.d.ts +6 -0
  105. package/dist/admin/src/lib/promptRules.d.ts +23 -0
  106. package/dist/admin/src/lib/use-cases/articles/index.d.ts +12 -1
  107. package/dist/admin/src/lib/use-cases/categories/index.d.ts +12 -1
  108. package/dist/admin/src/lib/use-cases/facebook/index.d.ts +1 -1
  109. package/dist/admin/src/lib/use-cases/generate-content/index.d.ts +2 -2
  110. package/dist/admin/src/lib/use-cases/images/index.d.ts +1 -4
  111. package/dist/admin/src/lib/use-cases/linkedin/index.d.ts +1 -1
  112. package/dist/admin/src/lib/use-cases/settings/index.d.ts +13 -2
  113. package/dist/admin/src/lib/use-cases/users/index.d.ts +12 -1
  114. package/dist/admin/src/pages/ImageStudio.d.ts +3 -0
  115. package/dist/admin/src/pages/StudioApp.d.ts +3 -0
  116. package/dist/admin/src/pluginId.d.ts +6 -0
  117. package/dist/admin/src/test-setup.d.ts +1 -0
  118. package/dist/admin/src/test-utils.d.ts +5 -0
  119. package/dist/server/index.js +2439 -1247
  120. package/dist/server/index.mjs +2446 -1253
  121. package/dist/server/src/bootstrap.d.ts +1 -1
  122. package/dist/server/src/content-types/index.d.ts +66 -1
  123. package/dist/server/src/content-types/template/index.d.ts +65 -0
  124. package/dist/server/src/content-types/template/schema.d.ts +69 -0
  125. package/dist/server/src/controllers/config.d.ts +2 -0
  126. package/dist/server/src/controllers/controller.d.ts +1 -5
  127. package/dist/server/src/controllers/image-studio.d.ts +23 -0
  128. package/dist/server/src/controllers/index.d.ts +129 -5
  129. package/dist/server/src/controllers/templates.d.ts +26 -0
  130. package/dist/server/src/image-studio/geminiConfig.d.ts +40 -0
  131. package/dist/server/src/image-studio/models.d.ts +38 -0
  132. package/dist/server/src/image-studio/prompt.d.ts +7 -0
  133. package/dist/server/src/image-studio/validate.d.ts +41 -0
  134. package/dist/server/src/index.d.ts +231 -75
  135. package/dist/server/src/routes/admin.d.ts +6 -2
  136. package/dist/server/src/routes/content-api.d.ts +4 -9
  137. package/dist/server/src/routes/index.d.ts +7 -11
  138. package/dist/server/src/routes/policies.d.ts +14 -0
  139. package/dist/server/src/services/image-studio.d.ts +62 -0
  140. package/dist/server/src/services/index.d.ts +28 -57
  141. package/dist/server/src/services/service.d.ts +1 -57
  142. package/dist/server/src/services/templates.d.ts +81 -0
  143. package/dist/server/src/templates/folders.d.ts +14 -0
  144. package/dist/server/src/templates/validate.d.ts +23 -0
  145. package/dist/server/src/utils/folders.d.ts +15 -0
  146. package/dist/server/src/utils/secrets.d.ts +9 -0
  147. package/package.json +22 -10
  148. package/static/background-worker.d.mts +15 -0
  149. package/static/background-worker.mjs +87 -0
  150. package/dist/_chunks/Settings-APrsjya3.js +0 -262
  151. package/dist/_chunks/Settings-BevnW4cE.mjs +0 -244
  152. package/dist/admin/src/components/Navigation.d.ts +0 -2
  153. package/dist/admin/src/components/generate-image/Form.d.ts +0 -15
  154. package/dist/admin/src/components/generate-images/Image.d.ts +0 -5
  155. package/dist/admin/src/components/generate-images/Images.d.ts +0 -2
  156. package/dist/admin/src/components/generate-images/Modal.d.ts +0 -9
  157. package/dist/admin/src/containers/generate-image/index.d.ts +0 -2
  158. package/dist/admin/src/containers/generate-images/index.d.ts +0 -2
  159. package/dist/admin/src/hooks/generate-images/useImages.d.ts +0 -11
  160. package/dist/admin/src/pages/GenerateImage.d.ts +0 -2
  161. package/dist/admin/src/pages/GenerateImages.d.ts +0 -2
@@ -1,60 +1,16 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { useRBAC, useFetchClient, useNotification, Page } from "@strapi/strapi/admin";
3
- import { SubNav, SubNavHeader, SubNavSections, SubNavSection, SubNavLink, Box, Table, Thead, Tr, Th, Typography, Flex, Tbody, Td, Button, LinkButton, Dialog, Grid, Field, Textarea, TextInput, Combobox, ComboboxOption, Modal, Card, CardHeader, CardCheckbox, CardAsset, CardBody, CardContent, CardTitle, CardSubtitle, CardBadge, CardAction, IconButton, DesignSystemProvider } from "@strapi/design-system";
4
- import { useLocation, useNavigate, Routes, Route } from "react-router-dom";
5
- import { p as pluginPermissions, c as closeDialog, o as openDialog, P as PLUGIN_ID } from "./index-PnmqwUfI.mjs";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useFetchClient, useNotification, Page, useRBAC } from "@strapi/strapi/admin";
3
+ import { useNavigate, Routes, Route } from "react-router-dom";
4
+ import { P as PluginProviders, L as LEGACY_ROUTES, S as StudioRedirect, l as legacyRedirect } from "./ImageStudioTabs-mlNL6aQ2.mjs";
6
5
  import { useIntl } from "react-intl";
7
- import { useCallback, memo, useMemo, useState, useRef, useEffect, createContext, useContext } from "react";
6
+ import { useCallback, memo, useMemo, useState, useRef, useEffect } from "react";
7
+ import { Box, Table, Thead, Tr, Th, Typography, Flex, Tbody, Td, Button, LinkButton, Dialog, Grid, Field, Textarea, TextInput, Combobox, ComboboxOption, IconButton } from "@strapi/design-system";
8
8
  import { useDispatch, useSelector } from "react-redux";
9
- import { Play, ExternalLink, Image as Image$1, Download, Trash, PlusCircle } from "@strapi/icons";
10
- import { g as getTranslation } from "./getTranslation-B0tfTODk.mjs";
9
+ import { c as closeDialog, o as openDialog, P as PLUGIN_ID, p as pluginPermissions } from "./index-CqDdi211.mjs";
10
+ import { Play, ExternalLink, Image, Trash, PlusCircle } from "@strapi/icons";
11
+ import { g as getTranslation } from "./getTranslation-DfxaP_TC.mjs";
11
12
  import { useFormik } from "formik";
12
13
  import * as Yup from "yup";
13
- const links = [
14
- {
15
- label: "Generador de contenido con IA",
16
- required: "access",
17
- subLinks: [
18
- {
19
- id: 1,
20
- label: "Generador de contenido",
21
- to: "/admin/plugins/strapi-content-generator-gemini",
22
- required: "access"
23
- },
24
- {
25
- id: 2,
26
- label: "Generador de imágenes",
27
- to: "/admin/plugins/strapi-content-generator-gemini/generate-images",
28
- required: "access"
29
- }
30
- ]
31
- }
32
- ];
33
- const Navigation = () => {
34
- const location = useLocation();
35
- const { allowedActions, isLoading } = useRBAC(pluginPermissions);
36
- if (isLoading) return null;
37
- const canAccess = (required) => {
38
- if (!required) return true;
39
- if (required === "access") return allowedActions.canAccess;
40
- return false;
41
- };
42
- return /* @__PURE__ */ jsxs(SubNav, { "aria-label": "Generador de contenido SubNav", children: [
43
- /* @__PURE__ */ jsx(SubNavHeader, { label: "MKT" }),
44
- /* @__PURE__ */ jsx(SubNavSections, { children: links.filter((section) => canAccess(section.required)).map(({ label, subLinks }) => /* @__PURE__ */ jsx(SubNavSection, { label, children: subLinks.filter((subLink) => canAccess(subLink.required)).map((subLink) => {
45
- const active = location.pathname === subLink.to.replace(/^\/admin/, "");
46
- return /* @__PURE__ */ jsx(
47
- SubNavLink,
48
- {
49
- href: subLink.to,
50
- active,
51
- children: subLink.label
52
- },
53
- subLink.id
54
- );
55
- }) }, label)) })
56
- ] });
57
- };
58
14
  const useDialog = (id) => {
59
15
  const dispatch = useDispatch();
60
16
  const state = useSelector((state2) => state2.content_generator_commonDialog.open[id] ?? false);
@@ -242,7 +198,7 @@ const PublishingTableComponent = ({
242
198
  disabled: row.hasImage,
243
199
  onClick: () => onClickAction(row.id, "generate-image-dialog"),
244
200
  loading: buttonLoadingImage,
245
- startIcon: /* @__PURE__ */ jsx(Image$1, {}),
201
+ startIcon: /* @__PURE__ */ jsx(Image, {}),
246
202
  children: /* @__PURE__ */ jsx(Typography, { variant: "pi", children: buttonLoadingImage ? "generando" : "generar" })
247
203
  }
248
204
  ) }),
@@ -568,7 +524,7 @@ const useUsers = () => {
568
524
  getUsers
569
525
  };
570
526
  };
571
- const validationSchema$2 = Yup.object().shape({
527
+ const validationSchema$1 = Yup.object().shape({
572
528
  titulo: Yup.string().notRequired(),
573
529
  autor: Yup.string().required("Este campo es obligatorio"),
574
530
  categoria: Yup.string().required("Este campo es obligatorio"),
@@ -582,10 +538,10 @@ const initialValues$1 = {
582
538
  temperatura: "0.5",
583
539
  instrucciones: ""
584
540
  };
585
- const Form$2 = ({ onSubmit, categorias, users }) => {
541
+ const Form$1 = ({ onSubmit, categorias, users }) => {
586
542
  const formik = useFormik({
587
543
  initialValues: initialValues$1,
588
- validationSchema: validationSchema$2,
544
+ validationSchema: validationSchema$1,
589
545
  onSubmit
590
546
  });
591
547
  const { values, errors, touched, isValid, dirty, isSubmitting, handleChange, setFieldValue, handleSubmit } = formik;
@@ -843,7 +799,7 @@ const GenerateContentContainer = () => {
843
799
  /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
844
800
  ] }) }),
845
801
  /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsx(Flex, { alignItems: "end", width: "100%", justifyContent: "end", children: /* @__PURE__ */ jsx(LinkButton, { href: "/admin/plugins/strapi-content-generator-gemini", children: "Regresar" }) }) }),
846
- /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Form$2, { categorias, users, onSubmit }) })
802
+ /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Form$1, { categorias, users, onSubmit }) })
847
803
  ] })
848
804
  ] });
849
805
  };
@@ -853,635 +809,6 @@ const GenerateContent = () => {
853
809
  /* @__PURE__ */ jsx(GenerateContentContainer, {})
854
810
  ] });
855
811
  };
856
- const useImages$1 = () => {
857
- const { get, del, post } = useFetchClient();
858
- const getImages = useCallback(
859
- async () => {
860
- return await get("/strapi-content-generator-gemini/images");
861
- },
862
- [get]
863
- );
864
- const deleteImage = useCallback(
865
- async (config) => {
866
- return await del("/strapi-content-generator-gemini/delete-image", config);
867
- },
868
- [del]
869
- );
870
- const generateImageWithConfig = useCallback(
871
- async (data, config) => {
872
- return await post("/strapi-content-generator-gemini/generate-image-with-config", data, config);
873
- },
874
- [post]
875
- );
876
- const generateVideoWithScenes = useCallback(
877
- async (data, config) => {
878
- return await post("/strapi-content-generator-gemini/generate-video-with-scenes", data, config);
879
- },
880
- [post]
881
- );
882
- return {
883
- getImages,
884
- deleteImage,
885
- generateImageWithConfig,
886
- generateVideoWithScenes
887
- };
888
- };
889
- const PRINCIPAL_KEY = "principal";
890
- const ModalImagesSizes = ({
891
- open,
892
- setOpen,
893
- image,
894
- handleDownload
895
- }) => {
896
- const [selectedImages, setSelectedImages] = useState(
897
- () => /* @__PURE__ */ new Set()
898
- );
899
- const formats = useMemo(
900
- () => Object.entries(image?.formats ?? {}),
901
- [image?.formats]
902
- );
903
- const toggleImageSelection = useCallback((key) => {
904
- setSelectedImages((prev) => {
905
- const next = new Set(prev);
906
- next.has(key) ? next.delete(key) : next.add(key);
907
- return next;
908
- });
909
- }, []);
910
- const isPrincipalSelected = useMemo(
911
- () => selectedImages.has(PRINCIPAL_KEY),
912
- [selectedImages]
913
- );
914
- const isDownloadDisabled = useMemo(
915
- () => selectedImages.size === 0,
916
- [selectedImages]
917
- );
918
- const handleClose = useCallback(() => {
919
- setOpen(false);
920
- }, [setOpen]);
921
- useEffect(() => {
922
- if (!open) {
923
- setSelectedImages(/* @__PURE__ */ new Set());
924
- }
925
- }, [open]);
926
- if (!image) return null;
927
- return /* @__PURE__ */ jsx(
928
- Modal.Root,
929
- {
930
- id: "modal-image-formats",
931
- open,
932
- onOpenChange: handleClose,
933
- children: /* @__PURE__ */ jsxs(Modal.Content, { children: [
934
- /* @__PURE__ */ jsx(Modal.Header, { children: /* @__PURE__ */ jsx(Modal.Title, { children: "Descargar imágenes" }) }),
935
- /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 3, children: [
936
- /* @__PURE__ */ jsx(Grid.Item, { m: 3, children: /* @__PURE__ */ jsxs(
937
- Card,
938
- {
939
- id: "modal-principal",
940
- onClick: () => toggleImageSelection(PRINCIPAL_KEY),
941
- children: [
942
- /* @__PURE__ */ jsxs(CardHeader, { children: [
943
- /* @__PURE__ */ jsx(CardCheckbox, { checked: isPrincipalSelected }),
944
- /* @__PURE__ */ jsx(CardAsset, { src: image.url })
945
- ] }),
946
- /* @__PURE__ */ jsxs(CardBody, { children: [
947
- /* @__PURE__ */ jsxs(CardContent, { children: [
948
- /* @__PURE__ */ jsx(CardTitle, { children: "Principal" }),
949
- /* @__PURE__ */ jsx(CardSubtitle, { children: `${image.width}x${image.height}` })
950
- ] }),
951
- /* @__PURE__ */ jsx(CardBadge, { children: image.mime })
952
- ] })
953
- ]
954
- }
955
- ) }),
956
- formats.map(([format, img]) => {
957
- const isSelected = selectedImages.has(format);
958
- return /* @__PURE__ */ jsx(Grid.Item, { m: 3, children: /* @__PURE__ */ jsxs(
959
- Card,
960
- {
961
- id: `modal-${format}`,
962
- onClick: () => toggleImageSelection(format),
963
- children: [
964
- /* @__PURE__ */ jsxs(CardHeader, { children: [
965
- /* @__PURE__ */ jsx(CardCheckbox, { checked: isSelected }),
966
- /* @__PURE__ */ jsx(CardAsset, { src: img.url })
967
- ] }),
968
- /* @__PURE__ */ jsxs(CardBody, { children: [
969
- /* @__PURE__ */ jsxs(CardContent, { children: [
970
- /* @__PURE__ */ jsx(CardTitle, { children: format }),
971
- /* @__PURE__ */ jsx(CardSubtitle, { children: `${img.width}x${img.height}` })
972
- ] }),
973
- /* @__PURE__ */ jsx(CardBadge, { children: image.mime })
974
- ] })
975
- ]
976
- }
977
- ) }, format);
978
- })
979
- ] }) }),
980
- /* @__PURE__ */ jsxs(Modal.Footer, { children: [
981
- /* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: "Cancelar" }) }),
982
- /* @__PURE__ */ jsx(
983
- Button,
984
- {
985
- disabled: isDownloadDisabled,
986
- onClick: () => {
987
- handleDownload(selectedImages);
988
- },
989
- children: "Descargar"
990
- }
991
- )
992
- ] })
993
- ] })
994
- }
995
- );
996
- };
997
- const ImagesContext = createContext(void 0);
998
- const ImagesProvider = ({ children }) => {
999
- const { getImages, deleteImage } = useImages$1();
1000
- const { openDialog: openDialog2, closeDialog: closeDialog2 } = useDialog("dialog-delete-image");
1001
- const { formatMessage } = useIntl();
1002
- const { toggleNotification } = useNotification();
1003
- const [images, setImages] = useState([]);
1004
- const [loading, setLoading] = useState(false);
1005
- const [open, setOpen] = useState(false);
1006
- const currentImageRef = useRef();
1007
- const fetchImages = useCallback(async () => {
1008
- let isMounted = true;
1009
- try {
1010
- const { data } = await getImages();
1011
- if (isMounted) {
1012
- setImages(data);
1013
- }
1014
- } catch (error) {
1015
- console.error("Error fetching images:", error);
1016
- }
1017
- return () => {
1018
- isMounted = false;
1019
- };
1020
- }, [getImages]);
1021
- const handleDeleteImage = async () => {
1022
- closeDialog2();
1023
- try {
1024
- await deleteImage({ params: { documentId: currentImageRef.current?.documentId } });
1025
- toggleNotification({
1026
- type: "success",
1027
- message: formatMessage({
1028
- id: `${PLUGIN_ID}.config.load.error`,
1029
- defaultMessage: "Imagen eliminada con éxito"
1030
- })
1031
- });
1032
- fetchImages();
1033
- } catch (err) {
1034
- toggleNotification({
1035
- type: "danger",
1036
- message: formatMessage({
1037
- id: `${PLUGIN_ID}.config.load.error`,
1038
- defaultMessage: "Ocurrió un error al eliminar la imagen"
1039
- })
1040
- });
1041
- }
1042
- };
1043
- const onCancelAction = useCallback((action) => {
1044
- switch (action) {
1045
- case "delete":
1046
- closeDialog2();
1047
- break;
1048
- case "download":
1049
- setOpen(false);
1050
- break;
1051
- default:
1052
- return;
1053
- }
1054
- currentImageRef.current = void 0;
1055
- closeDialog2();
1056
- }, [openDialog2]);
1057
- const onClickAction = useCallback((image, action) => {
1058
- currentImageRef.current = image;
1059
- switch (action) {
1060
- case "delete":
1061
- openDialog2();
1062
- break;
1063
- case "download":
1064
- setOpen(true);
1065
- break;
1066
- default:
1067
- return;
1068
- }
1069
- }, [openDialog2, setOpen]);
1070
- const downloadImage = async (url, filename) => {
1071
- try {
1072
- const response = await fetch(url, {
1073
- method: "GET",
1074
- mode: "cors"
1075
- });
1076
- if (!response.ok) throw new Error("Network response was not ok");
1077
- const blob = await response.blob();
1078
- const blobUrl = window.URL.createObjectURL(blob);
1079
- const link = document.createElement("a");
1080
- link.href = blobUrl;
1081
- link.download = filename;
1082
- document.body.appendChild(link);
1083
- link.click();
1084
- document.body.removeChild(link);
1085
- window.URL.revokeObjectURL(blobUrl);
1086
- } catch (error) {
1087
- console.error("Error downloading image:", error);
1088
- const link = document.createElement("a");
1089
- link.href = url;
1090
- link.target = "_blank";
1091
- link.rel = "noopener noreferrer";
1092
- link.download = filename;
1093
- document.body.appendChild(link);
1094
- link.click();
1095
- document.body.removeChild(link);
1096
- }
1097
- };
1098
- const handleDownload = async (selectedKeys) => {
1099
- const image = currentImageRef.current;
1100
- if (!image) return;
1101
- setOpen(false);
1102
- const keys = Array.isArray(selectedKeys) ? selectedKeys : Array.from(selectedKeys);
1103
- const extension = image.ext?.replace(".", "") ?? "jpg";
1104
- const formats = image.formats;
1105
- const items = keys.map((key) => {
1106
- if (key === "principal") {
1107
- return {
1108
- url: image.url,
1109
- filename: `image-principal-${image.documentId}.${extension}`
1110
- };
1111
- }
1112
- const formatImage = formats?.[key];
1113
- if (!formatImage) return null;
1114
- return {
1115
- url: formatImage.url,
1116
- filename: `image-${key}-${image.documentId}.${extension}`
1117
- };
1118
- }).filter(Boolean);
1119
- for (const item of items) {
1120
- await downloadImage(item.url, item.filename);
1121
- }
1122
- };
1123
- useEffect(() => {
1124
- fetchImages();
1125
- }, [fetchImages]);
1126
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1127
- currentImageRef.current && /* @__PURE__ */ jsx(
1128
- ModalImagesSizes,
1129
- {
1130
- open,
1131
- setOpen,
1132
- image: currentImageRef.current,
1133
- handleDownload
1134
- }
1135
- ),
1136
- /* @__PURE__ */ jsx(
1137
- DialogCommon,
1138
- {
1139
- title: "Eliminar imagen",
1140
- id: "dialog-delete-image",
1141
- onConfirmAction: handleDeleteImage,
1142
- onCancelAction: () => onCancelAction("delete"),
1143
- children: /* @__PURE__ */ jsxs(Flex, { direction: "column", justifyContent: "center", children: [
1144
- /* @__PURE__ */ jsx(Typography, { children: "¿Seguro que deseas eliminar esta imagen?" }),
1145
- /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Esta acción es irreversible" })
1146
- ] })
1147
- }
1148
- ),
1149
- /* @__PURE__ */ jsx(ImagesContext.Provider, { value: { images, onClickAction }, children })
1150
- ] });
1151
- };
1152
- const useImages = () => {
1153
- const context = useContext(ImagesContext);
1154
- if (!context) {
1155
- throw new Error("useImages must be used within an ImagesProvider");
1156
- }
1157
- return context;
1158
- };
1159
- const Image = ({ image }) => {
1160
- const { onClickAction } = useImages();
1161
- return /* @__PURE__ */ jsxs(Card, { id: image.id, children: [
1162
- /* @__PURE__ */ jsxs(CardHeader, { children: [
1163
- /* @__PURE__ */ jsxs(CardAction, { position: "end", children: [
1164
- /* @__PURE__ */ jsx(
1165
- IconButton,
1166
- {
1167
- label: "Descargar",
1168
- onClick: () => {
1169
- onClickAction(image, "download");
1170
- },
1171
- children: /* @__PURE__ */ jsx(Download, {})
1172
- }
1173
- ),
1174
- /* @__PURE__ */ jsx(
1175
- IconButton,
1176
- {
1177
- label: "Eliminar",
1178
- onClick: () => {
1179
- onClickAction(image, "delete");
1180
- },
1181
- children: /* @__PURE__ */ jsx(Trash, {})
1182
- }
1183
- )
1184
- ] }),
1185
- /* @__PURE__ */ jsx(CardAsset, { src: image.url, style: { borderTopLeftRadius: "4px", borderTopRightRadius: "4px" } })
1186
- ] }),
1187
- /* @__PURE__ */ jsxs(CardBody, { children: [
1188
- /* @__PURE__ */ jsxs(CardContent, { children: [
1189
- /* @__PURE__ */ jsx(CardTitle, { children: `${image.caption?.replace("generada por IA", "").slice(0, 80)}...` }),
1190
- /* @__PURE__ */ jsx(CardSubtitle, { children: `${image.width}X${image.height}` })
1191
- ] }),
1192
- /* @__PURE__ */ jsx(CardBadge, { children: image.mime })
1193
- ] })
1194
- ] });
1195
- };
1196
- const Images = () => {
1197
- const { images } = useImages();
1198
- return /* @__PURE__ */ jsx(Box, { background: "neutral0", padding: 6, margin: 6, width: "100%", children: /* @__PURE__ */ jsx(Grid.Root, { gap: 3, children: images.map((image) => {
1199
- return /* @__PURE__ */ jsx(Grid.Item, { m: 3, children: /* @__PURE__ */ jsx(Image, { image }) }, image.id);
1200
- }) }) });
1201
- };
1202
- const GenerateImagesContainer = () => {
1203
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ImagesProvider, { children: /* @__PURE__ */ jsxs(Grid.Root, { padding: 6, children: [
1204
- /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", children: [
1205
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "Generar imagenes y videos con IA" }),
1206
- /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
1207
- ] }) }),
1208
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsx(Flex, { justifyContent: "end", alignItems: "end", gap: 3, width: "100%", children: /* @__PURE__ */ jsx(LinkButton, { href: "/admin/plugins/strapi-content-generator-gemini/generate-image", children: "Generar nueva imagen" }) }) }),
1209
- /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Images, {}) })
1210
- ] }) }) });
1211
- };
1212
- const GenerateImages = () => {
1213
- return /* @__PURE__ */ jsxs(Page.Main, { children: [
1214
- /* @__PURE__ */ jsx(Page.Title, { children: "Generar imagenes con IA" }),
1215
- /* @__PURE__ */ jsx(GenerateImagesContainer, {})
1216
- ] });
1217
- };
1218
- const aspectRatioOptions = [
1219
- { value: "1:1", label: "1:1 (Cuadrado)" },
1220
- { value: "2:3", label: "2:3 Rectangular (vertical)" },
1221
- { value: "3:2", label: "3:2 Rectangular (horizontal)" },
1222
- { value: "3:4", label: "3:4 Rectangular (vertical)" },
1223
- { value: "4:3", label: "4:3 Rectangular (horizontal)" },
1224
- { value: "9:16", label: "9:16 Rectangular (vertical)" },
1225
- { value: "16:9", label: "16:9 Rectangular (horizontal)" },
1226
- { value: "21:9", label: "21:9 Rectangular (horizontal)" }
1227
- ];
1228
- const validationSchema$1 = Yup.object({
1229
- prompt: Yup.string().required("El prompt es requerido"),
1230
- aspectRatio: Yup.string().required("La relación de aspecto es requerida"),
1231
- imageSize: Yup.string().required("El tamaño de la imagen es requerido")
1232
- });
1233
- const Form$1 = ({ onSubmit }) => {
1234
- const [referenceImages, setReferenceImages] = useState([]);
1235
- const individualFileInputRefs = useRef({});
1236
- const newImageFileInputRef = useRef(null);
1237
- const formik = useFormik({
1238
- initialValues: {
1239
- prompt: "",
1240
- aspectRatio: "16:9",
1241
- imageSize: "1K"
1242
- },
1243
- validationSchema: validationSchema$1,
1244
- onSubmit: (values, formikHelpers) => onSubmit({ ...values }, formikHelpers, referenceImages)
1245
- });
1246
- const handleAddImage = () => {
1247
- newImageFileInputRef.current?.click();
1248
- };
1249
- const handleRemoveImage = (id) => {
1250
- const imageToRemove = referenceImages.find((img) => img.id === id);
1251
- if (imageToRemove?.previewUrl) {
1252
- URL.revokeObjectURL(imageToRemove.previewUrl);
1253
- }
1254
- setReferenceImages(referenceImages.filter((image) => image.id !== id));
1255
- };
1256
- const handleNewImageFileChange = (e) => {
1257
- const selectedFile = e.target.files?.[0];
1258
- if (selectedFile) {
1259
- setReferenceImages((prevImages) => [
1260
- ...prevImages,
1261
- { id: Date.now(), file: selectedFile, previewUrl: URL.createObjectURL(selectedFile) }
1262
- ]);
1263
- }
1264
- e.target.value = "";
1265
- };
1266
- const handleIndividualFileChange = (id, selectedFile) => {
1267
- setReferenceImages((prevImages) => prevImages.map((image) => {
1268
- if (image.id === id) {
1269
- if (image.previewUrl) {
1270
- URL.revokeObjectURL(image.previewUrl);
1271
- }
1272
- if (selectedFile) {
1273
- return { ...image, file: selectedFile, previewUrl: URL.createObjectURL(selectedFile) };
1274
- } else {
1275
- const { file, previewUrl, ...rest } = image;
1276
- return rest;
1277
- }
1278
- }
1279
- return image;
1280
- }));
1281
- };
1282
- return /* @__PURE__ */ jsx(Box, { background: "neutral0", padding: 6, hasRadius: true, width: "100%", children: /* @__PURE__ */ jsx("form", { onSubmit: formik.handleSubmit, children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
1283
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1284
- Field.Root,
1285
- {
1286
- id: "prompt",
1287
- width: "100%",
1288
- required: true,
1289
- error: formik.touched.prompt && formik.errors.prompt ? formik.errors.prompt : void 0,
1290
- children: [
1291
- /* @__PURE__ */ jsx(Field.Label, { children: "Descripción de la imagen" }),
1292
- /* @__PURE__ */ jsx(
1293
- Textarea,
1294
- {
1295
- name: "prompt",
1296
- placeholder: "Ej: Una superficie paramétrica 3D con forma de cinta que se tuerce sobre sí misma, flotando sobre un fondo gradiente oscuro. Evoca integración y continuidad de sistemas.",
1297
- onChange: formik.handleChange,
1298
- onBlur: formik.handleBlur,
1299
- value: formik.values.prompt,
1300
- rows: 5
1301
- }
1302
- ),
1303
- /* @__PURE__ */ jsx(Field.Hint, { children: "Describe qué quieres ver — forma, movimiento, atmósfera. El estilo de marca (colores, materiales, iluminación) se aplica automáticamente." }),
1304
- /* @__PURE__ */ jsx(Field.Error, {})
1305
- ]
1306
- }
1307
- ) }),
1308
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1309
- Field.Root,
1310
- {
1311
- id: "imagen-referencia",
1312
- width: "100%",
1313
- children: [
1314
- /* @__PURE__ */ jsx(Field.Label, { children: "Imagen(es) de referencia" }),
1315
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 3, width: "100%", children: [
1316
- referenceImages.map((image) => /* @__PURE__ */ jsx(Box, { background: "neutral100", padding: 3, hasRadius: true, width: "100%", children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", gap: 3, width: "100%", children: [
1317
- /* @__PURE__ */ jsx(Box, { background: "primary100", padding: 1, children: image.previewUrl ? /* @__PURE__ */ jsx("img", { src: image.previewUrl, alt: "preview", style: { width: "50px", height: "50px", objectFit: "cover" } }) : /* @__PURE__ */ jsx("div", { style: { width: "50px", height: "50px", backgroundColor: "#ccc" } }) }),
1318
- /* @__PURE__ */ jsxs("div", { style: { flexGrow: 2 }, children: [
1319
- /* @__PURE__ */ jsx(
1320
- "input",
1321
- {
1322
- type: "file",
1323
- accept: "image/*",
1324
- "aria-label": `Reemplazar imagen de referencia ${image.id}`,
1325
- ref: (el) => individualFileInputRefs.current[image.id] = el,
1326
- style: { display: "none" },
1327
- onChange: (e) => handleIndividualFileChange(image.id, e.target.files?.[0])
1328
- }
1329
- ),
1330
- /* @__PURE__ */ jsx(
1331
- Button,
1332
- {
1333
- onClick: () => individualFileInputRefs.current[image.id]?.click(),
1334
- startIcon: image.file ? void 0 : /* @__PURE__ */ jsx(PlusCircle, {}),
1335
- variant: "secondary",
1336
- fullWidth: true,
1337
- children: image.file ? image.file.name : "Seleccionar archivo"
1338
- }
1339
- )
1340
- ] }),
1341
- /* @__PURE__ */ jsx(IconButton, { onClick: () => handleRemoveImage(image.id), label: "Eliminar imagen", children: /* @__PURE__ */ jsx(Trash, {}) })
1342
- ] }) }, image.id)),
1343
- /* @__PURE__ */ jsx(
1344
- "input",
1345
- {
1346
- type: "file",
1347
- accept: "image/*",
1348
- "aria-label": "Añadir imagen de referencia",
1349
- ref: newImageFileInputRef,
1350
- style: { display: "none" },
1351
- onChange: handleNewImageFileChange
1352
- }
1353
- ),
1354
- /* @__PURE__ */ jsx(
1355
- Button,
1356
- {
1357
- startIcon: /* @__PURE__ */ jsx(PlusCircle, {}),
1358
- variant: "secondary",
1359
- fullWidth: true,
1360
- onClick: handleAddImage,
1361
- disabled: referenceImages.length >= 5,
1362
- children: "Añadir imagen de referencia"
1363
- }
1364
- )
1365
- ] }),
1366
- /* @__PURE__ */ jsx(Field.Error, {}),
1367
- /* @__PURE__ */ jsx(Field.Hint, {})
1368
- ]
1369
- }
1370
- ) }),
1371
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1372
- Field.Root,
1373
- {
1374
- id: "aspectRatio",
1375
- width: "100%",
1376
- required: true,
1377
- children: [
1378
- /* @__PURE__ */ jsx(Field.Label, { children: "Relación de aspecto" }),
1379
- /* @__PURE__ */ jsx(
1380
- Combobox,
1381
- {
1382
- name: "aspectRatio",
1383
- onChange: (value) => formik.setFieldValue("aspectRatio", value),
1384
- onBlur: () => formik.setFieldTouched("aspectRatio", true),
1385
- value: formik.values.aspectRatio,
1386
- onClear: () => formik.setFieldValue("aspectRatio", ""),
1387
- children: aspectRatioOptions.map((option) => /* @__PURE__ */ jsx(ComboboxOption, { value: option.value, children: option.label }, option.value))
1388
- }
1389
- )
1390
- ]
1391
- }
1392
- ) }),
1393
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1394
- Field.Root,
1395
- {
1396
- id: "imageSize",
1397
- error: formik.touched.imageSize && formik.errors.imageSize ? formik.errors.imageSize : void 0,
1398
- width: "100%",
1399
- required: true,
1400
- children: [
1401
- /* @__PURE__ */ jsx(Field.Label, { children: "Tamaño de la imagen" }),
1402
- /* @__PURE__ */ jsxs(
1403
- Combobox,
1404
- {
1405
- name: "imageSize",
1406
- onChange: (value) => formik.setFieldValue("imageSize", value),
1407
- onBlur: () => formik.setFieldTouched("imageSize", true),
1408
- value: formik.values.imageSize,
1409
- onClear: () => formik.setFieldValue("imageSize", ""),
1410
- children: [
1411
- /* @__PURE__ */ jsx(ComboboxOption, { value: "1K", children: "1K" }),
1412
- /* @__PURE__ */ jsx(ComboboxOption, { value: "2K", children: "2K" }),
1413
- /* @__PURE__ */ jsx(ComboboxOption, { value: "4K", children: "4K" })
1414
- ]
1415
- }
1416
- ),
1417
- /* @__PURE__ */ jsx(Field.Error, { children: formik.errors.imageSize })
1418
- ]
1419
- }
1420
- ) }),
1421
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(Flex, { width: "100%", justifyContent: "end", alignItems: "end", children: /* @__PURE__ */ jsx(
1422
- Button,
1423
- {
1424
- type: "submit",
1425
- fullWidth: true,
1426
- disabled: !(formik.isValid && formik.dirty) || formik.isSubmitting,
1427
- loading: formik.isSubmitting,
1428
- children: "Generar imagen"
1429
- }
1430
- ) }) })
1431
- ] }) }) });
1432
- };
1433
- const GenerateImageContainer = () => {
1434
- const { toggleNotification } = useNotification();
1435
- const { generateImageWithConfig } = useImages$1();
1436
- const { formatMessage } = useIntl();
1437
- const handleSubmit = async (values, { setSubmitting }, referenceImages) => {
1438
- try {
1439
- const formData = new FormData();
1440
- formData.append("prompt", values.prompt);
1441
- formData.append("aspectRatio", values.aspectRatio);
1442
- formData.append("imageSize", values.imageSize);
1443
- referenceImages.forEach((img, index) => {
1444
- if (img.file) {
1445
- formData.append(`referenceImages[${index}]`, img.file);
1446
- }
1447
- });
1448
- const response = await generateImageWithConfig(formData);
1449
- toggleNotification({
1450
- type: "success",
1451
- message: formatMessage({
1452
- id: `${PLUGIN_ID}.config.load.success`,
1453
- defaultMessage: "Imagen generada con éxito"
1454
- })
1455
- });
1456
- } catch (error) {
1457
- toggleNotification({
1458
- type: "danger",
1459
- message: formatMessage({
1460
- id: `${PLUGIN_ID}.config.load.error`,
1461
- defaultMessage: "Ocurrió un error al generar la imagen"
1462
- })
1463
- });
1464
- } finally {
1465
- setSubmitting(false);
1466
- }
1467
- };
1468
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1469
- /* @__PURE__ */ jsx(Grid.Root, { padding: 6, children: /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", children: [
1470
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "Generar imagen con IA" }),
1471
- /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
1472
- ] }) }) }),
1473
- /* @__PURE__ */ jsxs(Grid.Root, { padding: 6, children: [
1474
- /* @__PURE__ */ jsx(Grid.Item, { m: 2 }),
1475
- /* @__PURE__ */ jsx(Grid.Item, { m: 8, children: /* @__PURE__ */ jsx(Form$1, { onSubmit: handleSubmit }) })
1476
- ] })
1477
- ] });
1478
- };
1479
- const GenerateImage = () => {
1480
- return /* @__PURE__ */ jsxs(Page.Main, { children: [
1481
- /* @__PURE__ */ jsx(Page.Title, { children: "Generar imagen con IA" }),
1482
- /* @__PURE__ */ jsx(GenerateImageContainer, {})
1483
- ] });
1484
- };
1485
812
  const sceneSchema = Yup.object().shape({
1486
813
  prompt: Yup.string().trim().required("El prompt es obligatorio para esta escena"),
1487
814
  durationSeconds: Yup.number().min(1, "La duración mínima es 1 segundo").max(90, "La duración máxima es 90 segundos").required("La duración es obligatoria"),
@@ -1670,9 +997,21 @@ const Form = ({ onSubmit }) => {
1670
997
  ) }) })
1671
998
  ] }) }) });
1672
999
  };
1000
+ const useImages = () => {
1001
+ const { post } = useFetchClient();
1002
+ const generateVideoWithScenes = useCallback(
1003
+ async (data, config) => {
1004
+ return await post("/strapi-content-generator-gemini/generate-video-with-scenes", data, config);
1005
+ },
1006
+ [post]
1007
+ );
1008
+ return {
1009
+ generateVideoWithScenes
1010
+ };
1011
+ };
1673
1012
  const GenerateVideoContainer = () => {
1674
1013
  const { toggleNotification } = useNotification();
1675
- const { generateVideoWithScenes } = useImages$1();
1014
+ const { generateVideoWithScenes } = useImages();
1676
1015
  const { formatMessage } = useIntl();
1677
1016
  const handleSubmit = async (values, { setSubmitting }) => {
1678
1017
  try {
@@ -1731,30 +1070,16 @@ const App = () => {
1731
1070
  if (isLoading) {
1732
1071
  return /* @__PURE__ */ jsx(Page.Loading, {});
1733
1072
  }
1734
- return /* @__PURE__ */ jsx(Page.Protect, { permissions: [...pluginPermissions.access], children: /* @__PURE__ */ jsx(DesignSystemProvider, { locale: "es-MX", children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
1735
- "div",
1736
- {
1737
- style: {
1738
- display: "grid",
1739
- gridTemplateColumns: "auto 1fr",
1740
- width: "100%",
1741
- height: "100vh"
1742
- },
1743
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
1744
- /* @__PURE__ */ jsx(Navigation, {}),
1745
- /* @__PURE__ */ jsxs(Routes, { children: [
1746
- allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
1747
- allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { path: "/generate-content", element: /* @__PURE__ */ jsx(GenerateContent, {}) }),
1748
- allowedActions.canAccess && /* @__PURE__ */ jsxs(Fragment, { children: [
1749
- /* @__PURE__ */ jsx(Route, { path: "/generate-images", element: /* @__PURE__ */ jsx(GenerateImages, {}) }),
1750
- /* @__PURE__ */ jsx(Route, { path: "/generate-image", element: /* @__PURE__ */ jsx(GenerateImage, {}) }),
1751
- /* @__PURE__ */ jsx(Route, { path: "/generate-video", element: /* @__PURE__ */ jsx(GenerateVideo, {}) })
1752
- ] }),
1753
- /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
1754
- ] })
1755
- ] })
1756
- }
1757
- ) }) }) });
1073
+ return /* @__PURE__ */ jsx(Page.Protect, { permissions: [...pluginPermissions.access], children: /* @__PURE__ */ jsx(PluginProviders, { children: /* @__PURE__ */ jsxs(Routes, { children: [
1074
+ allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
1075
+ allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { path: "/generate-content", element: /* @__PURE__ */ jsx(GenerateContent, {}) }),
1076
+ allowedActions.canAccess && /* @__PURE__ */ jsxs(Fragment, { children: [
1077
+ /* @__PURE__ */ jsx(Route, { path: "/image-studio", element: /* @__PURE__ */ jsx(StudioRedirect, {}) }),
1078
+ LEGACY_ROUTES.map((r) => /* @__PURE__ */ jsx(Route, { path: r.path, element: legacyRedirect(r.tab) }, r.path)),
1079
+ /* @__PURE__ */ jsx(Route, { path: "/generate-video", element: /* @__PURE__ */ jsx(GenerateVideo, {}) })
1080
+ ] }),
1081
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
1082
+ ] }) }) });
1758
1083
  };
1759
1084
  export {
1760
1085
  App