@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.
Files changed (166) hide show
  1. package/README.md +21 -1
  2. package/dist/_chunks/{App-CfwvfmvL.js → App-CJxSC8yt.js} +32 -720
  3. package/dist/_chunks/{App-BQr5_g5u.mjs → App-qbgUXlOZ.mjs} +38 -726
  4. package/dist/_chunks/ImageStudioTabs-BLAH3KYv.mjs +5270 -0
  5. package/dist/_chunks/ImageStudioTabs-DtusqpQO.js +5271 -0
  6. package/dist/_chunks/PluginProviders-D79TeGSE.js +34 -0
  7. package/dist/_chunks/PluginProviders-DWMpcAIh.mjs +35 -0
  8. package/dist/_chunks/Settings-BQXxV3LO.js +242 -0
  9. package/dist/_chunks/Settings-o2GngLaW.mjs +242 -0
  10. package/dist/_chunks/StudioApp-BaySMwrk.js +18 -0
  11. package/dist/_chunks/StudioApp-C_znlQRo.mjs +18 -0
  12. package/dist/_chunks/{getTranslation-B9ND5RaH.mjs → getTranslation-B6Bsu-uq.mjs} +1 -1
  13. package/dist/_chunks/{getTranslation-DNhP1INv.js → getTranslation-BRVMWSf8.js} +1 -1
  14. package/dist/_chunks/{index-DGPqyrzz.js → index-BKhe-Jyx.js} +24 -6
  15. package/dist/_chunks/{index-Dyq8dxMX.mjs → index-BKigRXm3.mjs} +25 -7
  16. package/dist/admin/index.js +1 -1
  17. package/dist/admin/index.mjs +1 -1
  18. package/dist/admin/src/components/PluginIcon.d.ts +4 -2
  19. package/dist/admin/src/components/PluginProviders.d.ts +12 -0
  20. package/dist/admin/src/components/generate-video/Form.d.ts +1 -1
  21. package/dist/admin/src/components/settings/Form.d.ts +4 -5
  22. package/dist/admin/src/components/settings/VertexSettings.d.ts +18 -0
  23. package/dist/admin/src/containers/settings/index.d.ts +7 -7
  24. package/dist/admin/src/features/background-removal/RemoveBackgroundButton.d.ts +7 -0
  25. package/dist/admin/src/features/background-removal/RemoveBackgroundDialog.d.ts +15 -0
  26. package/dist/admin/src/features/background-removal/colorKey.d.ts +29 -0
  27. package/dist/admin/src/features/background-removal/imageCanvas.d.ts +20 -0
  28. package/dist/admin/src/features/background-removal/mask.d.ts +10 -0
  29. package/dist/admin/src/features/background-removal/runtime.d.ts +31 -0
  30. package/dist/admin/src/features/generator/EditEmpty.d.ts +13 -0
  31. package/dist/admin/src/features/generator/GeneratorTab.d.ts +7 -0
  32. package/dist/admin/src/features/generator/GroundingSources.d.ts +9 -0
  33. package/dist/admin/src/features/generator/ModeSwitch.d.ts +6 -0
  34. package/dist/admin/src/features/generator/PromptComposer.d.ts +25 -0
  35. package/dist/admin/src/features/generator/ReferencePicker.d.ts +26 -0
  36. package/dist/admin/src/features/generator/VersionHistory.d.ts +13 -0
  37. package/dist/admin/src/features/generator/generatorApi.d.ts +71 -0
  38. package/dist/admin/src/features/generator/model.d.ts +60 -0
  39. package/dist/admin/src/features/generator/useGeneratorApi.d.ts +21 -0
  40. package/dist/admin/src/features/image-studio/ImageStudioTabs.d.ts +26 -0
  41. package/dist/admin/src/features/image-studio/SegmentedSwitch.d.ts +18 -0
  42. package/dist/admin/src/features/image-studio/checkerboard.d.ts +5 -0
  43. package/dist/admin/src/features/library/FileCard.d.ts +17 -0
  44. package/dist/admin/src/features/library/FolderTree.d.ts +14 -0
  45. package/dist/admin/src/features/library/LibraryDialogs.d.ts +46 -0
  46. package/dist/admin/src/features/library/LibraryImagePicker.d.ts +15 -0
  47. package/dist/admin/src/features/library/LibraryTab.d.ts +2 -0
  48. package/dist/admin/src/features/library/SaveToLibraryDialog.d.ts +15 -0
  49. package/dist/admin/src/features/library/model.d.ts +40 -0
  50. package/dist/admin/src/features/library/studioRoot.d.ts +11 -0
  51. package/dist/admin/src/features/library/uploadApi.d.ts +77 -0
  52. package/dist/admin/src/features/library/useLibraryApi.d.ts +34 -0
  53. package/dist/admin/src/features/templates/editor/ColorField.d.ts +11 -0
  54. package/dist/admin/src/features/templates/editor/Editor.d.ts +19 -0
  55. package/dist/admin/src/features/templates/editor/EditorBar.d.ts +9 -0
  56. package/dist/admin/src/features/templates/editor/EditorMenuBar.d.ts +58 -0
  57. package/dist/admin/src/features/templates/editor/EditorToolbar.d.ts +20 -0
  58. package/dist/admin/src/features/templates/editor/ElementPalette.d.ts +10 -0
  59. package/dist/admin/src/features/templates/editor/FloatingPanel.d.ts +17 -0
  60. package/dist/admin/src/features/templates/editor/FullscreenView.d.ts +11 -0
  61. package/dist/admin/src/features/templates/editor/IconPicker.d.ts +9 -0
  62. package/dist/admin/src/features/templates/editor/Inspector.d.ts +17 -0
  63. package/dist/admin/src/features/templates/editor/LayersPanel.d.ts +12 -0
  64. package/dist/admin/src/features/templates/editor/Precision.d.ts +23 -0
  65. package/dist/admin/src/features/templates/editor/RangeField.d.ts +12 -0
  66. package/dist/admin/src/features/templates/editor/SaveTemplateDialog.d.ts +14 -0
  67. package/dist/admin/src/features/templates/editor/Stage.d.ts +29 -0
  68. package/dist/admin/src/features/templates/editor/TemplateFolderSelect.d.ts +9 -0
  69. package/dist/admin/src/features/templates/editor/TemplatePicker.d.ts +23 -0
  70. package/dist/admin/src/features/templates/editor/TemplatesTab.d.ts +5 -0
  71. package/dist/admin/src/features/templates/editor/TypographyControls.d.ts +24 -0
  72. package/dist/admin/src/features/templates/editor/icons.d.ts +7 -0
  73. package/dist/admin/src/features/templates/editor/overlays.d.ts +20 -0
  74. package/dist/admin/src/features/templates/editor/useCanvasNav.d.ts +25 -0
  75. package/dist/admin/src/features/templates/editor/useFitScale.d.ts +3 -0
  76. package/dist/admin/src/features/templates/export/fontEmbed.d.ts +22 -0
  77. package/dist/admin/src/features/templates/export/imageSource.d.ts +21 -0
  78. package/dist/admin/src/features/templates/export/pdf.d.ts +6 -0
  79. package/dist/admin/src/features/templates/export/render.d.ts +22 -0
  80. package/dist/admin/src/features/templates/export/useEditorIO.d.ts +18 -0
  81. package/dist/admin/src/features/templates/fonts/catalog.d.ts +47 -0
  82. package/dist/admin/src/features/templates/fonts/customFonts.d.ts +19 -0
  83. package/dist/admin/src/features/templates/fonts/useCustomFonts.d.ts +9 -0
  84. package/dist/admin/src/features/templates/fonts/useFonts.d.ts +2 -0
  85. package/dist/admin/src/features/templates/model/drag.d.ts +10 -0
  86. package/dist/admin/src/features/templates/model/editorReducer.d.ts +58 -0
  87. package/dist/admin/src/features/templates/model/layers.d.ts +42 -0
  88. package/dist/admin/src/features/templates/model/palette.d.ts +38 -0
  89. package/dist/admin/src/features/templates/model/presets.d.ts +17 -0
  90. package/dist/admin/src/features/templates/model/shortcuts.d.ts +19 -0
  91. package/dist/admin/src/features/templates/model/snap.d.ts +24 -0
  92. package/dist/admin/src/features/templates/model/templates.d.ts +8 -0
  93. package/dist/admin/src/features/templates/model/types.d.ts +154 -0
  94. package/dist/admin/src/features/templates/model/viewport.d.ts +36 -0
  95. package/dist/admin/src/features/templates/render/IWLogo.d.ts +7 -0
  96. package/dist/admin/src/features/templates/render/LayerCanvas.d.ts +13 -0
  97. package/dist/admin/src/features/templates/render/fonts.d.ts +5 -0
  98. package/dist/admin/src/features/templates/render/icons.d.ts +10 -0
  99. package/dist/admin/src/features/templates/render/renderLayer.d.ts +9 -0
  100. package/dist/admin/src/features/templates/store/persist.d.ts +41 -0
  101. package/dist/admin/src/features/templates/store/templatesApi.d.ts +49 -0
  102. package/dist/admin/src/features/templates/store/useMyTemplates.d.ts +19 -0
  103. package/dist/admin/src/features/templates/store/useTemplateSaving.d.ts +14 -0
  104. package/dist/admin/src/features/templates/store/useTemplatesApi.d.ts +23 -0
  105. package/dist/admin/src/hooks/useAdminTheme.d.ts +8 -0
  106. package/dist/admin/src/hooks/useThemeColors.d.ts +9 -0
  107. package/dist/admin/src/lib/dataUrl.d.ts +6 -0
  108. package/dist/admin/src/lib/promptRules.d.ts +23 -0
  109. package/dist/admin/src/lib/use-cases/articles/index.d.ts +12 -1
  110. package/dist/admin/src/lib/use-cases/categories/index.d.ts +12 -1
  111. package/dist/admin/src/lib/use-cases/facebook/index.d.ts +1 -1
  112. package/dist/admin/src/lib/use-cases/generate-content/index.d.ts +2 -2
  113. package/dist/admin/src/lib/use-cases/images/index.d.ts +1 -4
  114. package/dist/admin/src/lib/use-cases/linkedin/index.d.ts +1 -1
  115. package/dist/admin/src/lib/use-cases/settings/index.d.ts +14 -2
  116. package/dist/admin/src/lib/use-cases/users/index.d.ts +12 -1
  117. package/dist/admin/src/pages/ImageStudio.d.ts +3 -0
  118. package/dist/admin/src/pages/StudioApp.d.ts +3 -0
  119. package/dist/admin/src/pluginId.d.ts +6 -0
  120. package/dist/admin/src/test-setup.d.ts +1 -0
  121. package/dist/admin/src/test-utils.d.ts +5 -0
  122. package/dist/server/index.js +2494 -1279
  123. package/dist/server/index.mjs +2501 -1285
  124. package/dist/server/src/bootstrap.d.ts +1 -1
  125. package/dist/server/src/content-types/index.d.ts +66 -1
  126. package/dist/server/src/content-types/template/index.d.ts +65 -0
  127. package/dist/server/src/content-types/template/schema.d.ts +69 -0
  128. package/dist/server/src/controllers/config.d.ts +10 -0
  129. package/dist/server/src/controllers/controller.d.ts +0 -5
  130. package/dist/server/src/controllers/image-studio.d.ts +23 -0
  131. package/dist/server/src/controllers/index.d.ts +129 -5
  132. package/dist/server/src/controllers/templates.d.ts +26 -0
  133. package/dist/server/src/image-studio/geminiConfig.d.ts +40 -0
  134. package/dist/server/src/image-studio/models.d.ts +39 -0
  135. package/dist/server/src/image-studio/prompt.d.ts +7 -0
  136. package/dist/server/src/image-studio/validate.d.ts +41 -0
  137. package/dist/server/src/index.d.ts +233 -75
  138. package/dist/server/src/routes/admin.d.ts +6 -2
  139. package/dist/server/src/routes/content-api.d.ts +4 -9
  140. package/dist/server/src/routes/index.d.ts +7 -11
  141. package/dist/server/src/routes/policies.d.ts +14 -0
  142. package/dist/server/src/services/image-studio.d.ts +66 -0
  143. package/dist/server/src/services/index.d.ts +30 -57
  144. package/dist/server/src/services/service.d.ts +10 -57
  145. package/dist/server/src/services/templates.d.ts +81 -0
  146. package/dist/server/src/templates/folders.d.ts +14 -0
  147. package/dist/server/src/templates/validate.d.ts +23 -0
  148. package/dist/server/src/utils/folders.d.ts +15 -0
  149. package/dist/server/src/utils/geminiClient.d.ts +24 -0
  150. package/dist/server/src/utils/secrets.d.ts +9 -0
  151. package/dist/server/src/utils/serviceAccount.d.ts +29 -0
  152. package/package.json +23 -10
  153. package/static/background-worker.d.mts +15 -0
  154. package/static/background-worker.mjs +87 -0
  155. package/dist/_chunks/Settings-BrqTzJp-.js +0 -262
  156. package/dist/_chunks/Settings-CdZnYLLK.mjs +0 -244
  157. package/dist/admin/src/components/Navigation.d.ts +0 -2
  158. package/dist/admin/src/components/generate-image/Form.d.ts +0 -15
  159. package/dist/admin/src/components/generate-images/Image.d.ts +0 -5
  160. package/dist/admin/src/components/generate-images/Images.d.ts +0 -2
  161. package/dist/admin/src/components/generate-images/Modal.d.ts +0 -9
  162. package/dist/admin/src/containers/generate-image/index.d.ts +0 -2
  163. package/dist/admin/src/containers/generate-images/index.d.ts +0 -2
  164. package/dist/admin/src/hooks/generate-images/useImages.d.ts +0 -12
  165. package/dist/admin/src/pages/GenerateImage.d.ts +0 -2
  166. package/dist/admin/src/pages/GenerateImages.d.ts +0 -2
@@ -1,60 +1,17 @@
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, Loader, 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-Dyq8dxMX.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 } from "./PluginProviders-DWMpcAIh.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-B9ND5RaH.mjs";
9
+ import { c as closeDialog, o as openDialog, P as PLUGIN_ID, p as pluginPermissions } from "./index-BKigRXm3.mjs";
10
+ import { Play, ExternalLink, Image, Trash, PlusCircle } from "@strapi/icons";
11
+ import { g as getTranslation } from "./getTranslation-B6Bsu-uq.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
- };
14
+ import { L as LEGACY_ROUTES, S as StudioRedirect, l as legacyRedirect } from "./ImageStudioTabs-BLAH3KYv.mjs";
58
15
  const useDialog = (id) => {
59
16
  const dispatch = useDispatch();
60
17
  const state = useSelector((state2) => state2.content_generator_commonDialog.open[id] ?? false);
@@ -242,7 +199,7 @@ const PublishingTableComponent = ({
242
199
  disabled: row.hasImage,
243
200
  onClick: () => onClickAction(row.id, "generate-image-dialog"),
244
201
  loading: buttonLoadingImage,
245
- startIcon: /* @__PURE__ */ jsx(Image$1, {}),
202
+ startIcon: /* @__PURE__ */ jsx(Image, {}),
246
203
  children: /* @__PURE__ */ jsx(Typography, { variant: "pi", children: buttonLoadingImage ? "generando" : "generar" })
247
204
  }
248
205
  ) }),
@@ -568,7 +525,7 @@ const useUsers = () => {
568
525
  getUsers
569
526
  };
570
527
  };
571
- const validationSchema$2 = Yup.object().shape({
528
+ const validationSchema$1 = Yup.object().shape({
572
529
  titulo: Yup.string().notRequired(),
573
530
  autor: Yup.string().required("Este campo es obligatorio"),
574
531
  categoria: Yup.string().required("Este campo es obligatorio"),
@@ -582,10 +539,10 @@ const initialValues$1 = {
582
539
  temperatura: "0.5",
583
540
  instrucciones: ""
584
541
  };
585
- const Form$2 = ({ onSubmit, categorias, users }) => {
542
+ const Form$1 = ({ onSubmit, categorias, users }) => {
586
543
  const formik = useFormik({
587
544
  initialValues: initialValues$1,
588
- validationSchema: validationSchema$2,
545
+ validationSchema: validationSchema$1,
589
546
  onSubmit
590
547
  });
591
548
  const { values, errors, touched, isValid, dirty, isSubmitting, handleChange, setFieldValue, handleSubmit } = formik;
@@ -843,7 +800,7 @@ const GenerateContentContainer = () => {
843
800
  /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
844
801
  ] }) }),
845
802
  /* @__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 }) })
803
+ /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Form$1, { categorias, users, onSubmit }) })
847
804
  ] })
848
805
  ] });
849
806
  };
@@ -853,649 +810,6 @@ const GenerateContent = () => {
853
810
  /* @__PURE__ */ jsx(GenerateContentContainer, {})
854
811
  ] });
855
812
  };
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 { post } = useFetchClient();
1004
- const [images, setImages] = useState([]);
1005
- const [downloadingId, setDownloadingId] = useState(null);
1006
- const [open, setOpen] = useState(false);
1007
- const currentImageRef = useRef();
1008
- const fetchImages = useCallback(async () => {
1009
- let isMounted = true;
1010
- try {
1011
- const { data } = await getImages();
1012
- if (isMounted) {
1013
- setImages(data);
1014
- }
1015
- } catch (error) {
1016
- console.error("Error fetching images:", error);
1017
- }
1018
- return () => {
1019
- isMounted = false;
1020
- };
1021
- }, [getImages]);
1022
- const handleDeleteImage = async () => {
1023
- closeDialog2();
1024
- try {
1025
- await deleteImage({ params: { documentId: currentImageRef.current?.documentId } });
1026
- toggleNotification({
1027
- type: "success",
1028
- message: formatMessage({
1029
- id: `${PLUGIN_ID}.config.load.error`,
1030
- defaultMessage: "Imagen eliminada con éxito"
1031
- })
1032
- });
1033
- fetchImages();
1034
- } catch (err) {
1035
- toggleNotification({
1036
- type: "danger",
1037
- message: formatMessage({
1038
- id: `${PLUGIN_ID}.config.load.error`,
1039
- defaultMessage: "Ocurrió un error al eliminar la imagen"
1040
- })
1041
- });
1042
- }
1043
- };
1044
- const onCancelAction = useCallback((action) => {
1045
- switch (action) {
1046
- case "delete":
1047
- closeDialog2();
1048
- break;
1049
- case "download":
1050
- setOpen(false);
1051
- break;
1052
- default:
1053
- return;
1054
- }
1055
- currentImageRef.current = void 0;
1056
- closeDialog2();
1057
- }, [openDialog2]);
1058
- const onClickAction = useCallback((image, action) => {
1059
- currentImageRef.current = image;
1060
- switch (action) {
1061
- case "delete":
1062
- openDialog2();
1063
- break;
1064
- case "download":
1065
- setOpen(true);
1066
- break;
1067
- default:
1068
- return;
1069
- }
1070
- }, [openDialog2, setOpen]);
1071
- const downloadImage = async (url, filename) => {
1072
- if (!url) return;
1073
- const absoluteUrl = url.startsWith("/uploads") ? `${window.location.origin}${url}` : url;
1074
- try {
1075
- const { data } = await post(
1076
- "/strapi-content-generator-gemini/download-file",
1077
- { url: absoluteUrl }
1078
- );
1079
- const { base64, contentType } = data;
1080
- const binary = atob(base64);
1081
- const bytes = new Uint8Array(binary.length);
1082
- for (let i = 0; i < binary.length; i++) {
1083
- bytes[i] = binary.charCodeAt(i);
1084
- }
1085
- const blob = new Blob([bytes], { type: contentType });
1086
- const blobUrl = window.URL.createObjectURL(blob);
1087
- const link = document.createElement("a");
1088
- link.href = blobUrl;
1089
- link.download = filename;
1090
- document.body.appendChild(link);
1091
- link.click();
1092
- document.body.removeChild(link);
1093
- window.URL.revokeObjectURL(blobUrl);
1094
- } catch (error) {
1095
- console.error("Download error:", error);
1096
- const link = document.createElement("a");
1097
- link.href = absoluteUrl;
1098
- link.target = "_blank";
1099
- link.rel = "noopener noreferrer";
1100
- document.body.appendChild(link);
1101
- link.click();
1102
- document.body.removeChild(link);
1103
- }
1104
- };
1105
- const handleDownload = async (selectedKeys) => {
1106
- const image = currentImageRef.current;
1107
- if (!image) return;
1108
- setOpen(false);
1109
- setDownloadingId(image.documentId);
1110
- try {
1111
- const keys = Array.isArray(selectedKeys) ? selectedKeys : Array.from(selectedKeys);
1112
- const extension = image.ext?.replace(".", "") ?? "jpg";
1113
- const formats = image.formats;
1114
- const items = keys.map((key) => {
1115
- if (key === "principal") {
1116
- return {
1117
- url: image.url,
1118
- filename: `image-principal-${image.documentId}.${extension}`
1119
- };
1120
- }
1121
- const formatImage = formats?.[key];
1122
- if (!formatImage) return null;
1123
- return {
1124
- url: formatImage.url,
1125
- filename: `image-${key}-${image.documentId}.${extension}`
1126
- };
1127
- }).filter(Boolean);
1128
- for (const item of items) {
1129
- await downloadImage(item.url, item.filename);
1130
- }
1131
- } finally {
1132
- setDownloadingId(null);
1133
- }
1134
- };
1135
- useEffect(() => {
1136
- fetchImages();
1137
- }, [fetchImages]);
1138
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1139
- currentImageRef.current && /* @__PURE__ */ jsx(
1140
- ModalImagesSizes,
1141
- {
1142
- open,
1143
- setOpen,
1144
- image: currentImageRef.current,
1145
- handleDownload
1146
- }
1147
- ),
1148
- /* @__PURE__ */ jsx(
1149
- DialogCommon,
1150
- {
1151
- title: "Eliminar imagen",
1152
- id: "dialog-delete-image",
1153
- onConfirmAction: handleDeleteImage,
1154
- onCancelAction: () => onCancelAction("delete"),
1155
- children: /* @__PURE__ */ jsxs(Flex, { direction: "column", justifyContent: "center", children: [
1156
- /* @__PURE__ */ jsx(Typography, { children: "¿Seguro que deseas eliminar esta imagen?" }),
1157
- /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Esta acción es irreversible" })
1158
- ] })
1159
- }
1160
- ),
1161
- /* @__PURE__ */ jsx(ImagesContext.Provider, { value: { images, downloadingId, onClickAction }, children })
1162
- ] });
1163
- };
1164
- const useImages = () => {
1165
- const context = useContext(ImagesContext);
1166
- if (!context) {
1167
- throw new Error("useImages must be used within an ImagesProvider");
1168
- }
1169
- return context;
1170
- };
1171
- const Image = ({ image }) => {
1172
- const { onClickAction, downloadingId } = useImages();
1173
- const isDownloading = downloadingId === image.documentId;
1174
- return /* @__PURE__ */ jsxs(Card, { id: image.id, children: [
1175
- /* @__PURE__ */ jsxs(CardHeader, { children: [
1176
- /* @__PURE__ */ jsxs(CardAction, { position: "end", children: [
1177
- /* @__PURE__ */ jsx(
1178
- IconButton,
1179
- {
1180
- label: "Descargar",
1181
- disabled: isDownloading,
1182
- onClick: () => {
1183
- onClickAction(image, "download");
1184
- },
1185
- children: isDownloading ? /* @__PURE__ */ jsx(Loader, { small: true }) : /* @__PURE__ */ jsx(Download, {})
1186
- }
1187
- ),
1188
- /* @__PURE__ */ jsx(
1189
- IconButton,
1190
- {
1191
- label: "Eliminar",
1192
- onClick: () => {
1193
- onClickAction(image, "delete");
1194
- },
1195
- children: /* @__PURE__ */ jsx(Trash, {})
1196
- }
1197
- )
1198
- ] }),
1199
- /* @__PURE__ */ jsx(CardAsset, { src: image.url, style: { borderTopLeftRadius: "4px", borderTopRightRadius: "4px" } })
1200
- ] }),
1201
- /* @__PURE__ */ jsxs(CardBody, { children: [
1202
- /* @__PURE__ */ jsxs(CardContent, { children: [
1203
- /* @__PURE__ */ jsx(CardTitle, { children: `${image.caption?.replace("generada por IA", "").slice(0, 80)}...` }),
1204
- /* @__PURE__ */ jsx(CardSubtitle, { children: `${image.width}X${image.height}` })
1205
- ] }),
1206
- /* @__PURE__ */ jsx(CardBadge, { children: image.mime })
1207
- ] })
1208
- ] });
1209
- };
1210
- const Images = () => {
1211
- const { images } = useImages();
1212
- return /* @__PURE__ */ jsx(Box, { background: "neutral0", padding: 6, margin: 6, width: "100%", children: /* @__PURE__ */ jsx(Grid.Root, { gap: 3, children: images.map((image) => {
1213
- return /* @__PURE__ */ jsx(Grid.Item, { m: 3, children: /* @__PURE__ */ jsx(Image, { image }) }, image.id);
1214
- }) }) });
1215
- };
1216
- const GenerateImagesContainer = () => {
1217
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ImagesProvider, { children: /* @__PURE__ */ jsxs(Grid.Root, { padding: 6, children: [
1218
- /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", children: [
1219
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "Generar imagenes y videos con IA" }),
1220
- /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
1221
- ] }) }),
1222
- /* @__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" }) }) }),
1223
- /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Images, {}) })
1224
- ] }) }) });
1225
- };
1226
- const GenerateImages = () => {
1227
- return /* @__PURE__ */ jsxs(Page.Main, { children: [
1228
- /* @__PURE__ */ jsx(Page.Title, { children: "Generar imagenes con IA" }),
1229
- /* @__PURE__ */ jsx(GenerateImagesContainer, {})
1230
- ] });
1231
- };
1232
- const aspectRatioOptions = [
1233
- { value: "1:1", label: "1:1 (Cuadrado)" },
1234
- { value: "2:3", label: "2:3 Rectangular (vertical)" },
1235
- { value: "3:2", label: "3:2 Rectangular (horizontal)" },
1236
- { value: "3:4", label: "3:4 Rectangular (vertical)" },
1237
- { value: "4:3", label: "4:3 Rectangular (horizontal)" },
1238
- { value: "9:16", label: "9:16 Rectangular (vertical)" },
1239
- { value: "16:9", label: "16:9 Rectangular (horizontal)" },
1240
- { value: "21:9", label: "21:9 Rectangular (horizontal)" }
1241
- ];
1242
- const validationSchema$1 = Yup.object({
1243
- prompt: Yup.string().required("El prompt es requerido"),
1244
- aspectRatio: Yup.string().required("La relación de aspecto es requerida"),
1245
- imageSize: Yup.string().required("El tamaño de la imagen es requerido")
1246
- });
1247
- const Form$1 = ({ onSubmit }) => {
1248
- const [referenceImages, setReferenceImages] = useState([]);
1249
- const individualFileInputRefs = useRef({});
1250
- const newImageFileInputRef = useRef(null);
1251
- const formik = useFormik({
1252
- initialValues: {
1253
- prompt: "",
1254
- aspectRatio: "16:9",
1255
- imageSize: "1K"
1256
- },
1257
- validationSchema: validationSchema$1,
1258
- onSubmit: (values, formikHelpers) => onSubmit({ ...values }, formikHelpers, referenceImages)
1259
- });
1260
- const handleAddImage = () => {
1261
- newImageFileInputRef.current?.click();
1262
- };
1263
- const handleRemoveImage = (id) => {
1264
- const imageToRemove = referenceImages.find((img) => img.id === id);
1265
- if (imageToRemove?.previewUrl) {
1266
- URL.revokeObjectURL(imageToRemove.previewUrl);
1267
- }
1268
- setReferenceImages(referenceImages.filter((image) => image.id !== id));
1269
- };
1270
- const handleNewImageFileChange = (e) => {
1271
- const selectedFile = e.target.files?.[0];
1272
- if (selectedFile) {
1273
- setReferenceImages((prevImages) => [
1274
- ...prevImages,
1275
- { id: Date.now(), file: selectedFile, previewUrl: URL.createObjectURL(selectedFile) }
1276
- ]);
1277
- }
1278
- e.target.value = "";
1279
- };
1280
- const handleIndividualFileChange = (id, selectedFile) => {
1281
- setReferenceImages((prevImages) => prevImages.map((image) => {
1282
- if (image.id === id) {
1283
- if (image.previewUrl) {
1284
- URL.revokeObjectURL(image.previewUrl);
1285
- }
1286
- if (selectedFile) {
1287
- return { ...image, file: selectedFile, previewUrl: URL.createObjectURL(selectedFile) };
1288
- } else {
1289
- const { file, previewUrl, ...rest } = image;
1290
- return rest;
1291
- }
1292
- }
1293
- return image;
1294
- }));
1295
- };
1296
- 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: [
1297
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1298
- Field.Root,
1299
- {
1300
- id: "prompt",
1301
- width: "100%",
1302
- required: true,
1303
- error: formik.touched.prompt && formik.errors.prompt ? formik.errors.prompt : void 0,
1304
- children: [
1305
- /* @__PURE__ */ jsx(Field.Label, { children: "Descripción de la imagen" }),
1306
- /* @__PURE__ */ jsx(
1307
- Textarea,
1308
- {
1309
- name: "prompt",
1310
- 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.",
1311
- onChange: formik.handleChange,
1312
- onBlur: formik.handleBlur,
1313
- value: formik.values.prompt,
1314
- rows: 5
1315
- }
1316
- ),
1317
- /* @__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." }),
1318
- /* @__PURE__ */ jsx(Field.Error, {})
1319
- ]
1320
- }
1321
- ) }),
1322
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1323
- Field.Root,
1324
- {
1325
- id: "imagen-referencia",
1326
- width: "100%",
1327
- children: [
1328
- /* @__PURE__ */ jsx(Field.Label, { children: "Imagen(es) de referencia" }),
1329
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 3, width: "100%", children: [
1330
- 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: [
1331
- /* @__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" } }) }),
1332
- /* @__PURE__ */ jsxs("div", { style: { flexGrow: 2 }, children: [
1333
- /* @__PURE__ */ jsx(
1334
- "input",
1335
- {
1336
- type: "file",
1337
- accept: "image/*",
1338
- "aria-label": `Reemplazar imagen de referencia ${image.id}`,
1339
- ref: (el) => individualFileInputRefs.current[image.id] = el,
1340
- style: { display: "none" },
1341
- onChange: (e) => handleIndividualFileChange(image.id, e.target.files?.[0])
1342
- }
1343
- ),
1344
- /* @__PURE__ */ jsx(
1345
- Button,
1346
- {
1347
- onClick: () => individualFileInputRefs.current[image.id]?.click(),
1348
- startIcon: image.file ? void 0 : /* @__PURE__ */ jsx(PlusCircle, {}),
1349
- variant: "secondary",
1350
- fullWidth: true,
1351
- children: image.file ? image.file.name : "Seleccionar archivo"
1352
- }
1353
- )
1354
- ] }),
1355
- /* @__PURE__ */ jsx(IconButton, { onClick: () => handleRemoveImage(image.id), label: "Eliminar imagen", children: /* @__PURE__ */ jsx(Trash, {}) })
1356
- ] }) }, image.id)),
1357
- /* @__PURE__ */ jsx(
1358
- "input",
1359
- {
1360
- type: "file",
1361
- accept: "image/*",
1362
- "aria-label": "Añadir imagen de referencia",
1363
- ref: newImageFileInputRef,
1364
- style: { display: "none" },
1365
- onChange: handleNewImageFileChange
1366
- }
1367
- ),
1368
- /* @__PURE__ */ jsx(
1369
- Button,
1370
- {
1371
- startIcon: /* @__PURE__ */ jsx(PlusCircle, {}),
1372
- variant: "secondary",
1373
- fullWidth: true,
1374
- onClick: handleAddImage,
1375
- disabled: referenceImages.length >= 5,
1376
- children: "Añadir imagen de referencia"
1377
- }
1378
- )
1379
- ] }),
1380
- /* @__PURE__ */ jsx(Field.Error, {}),
1381
- /* @__PURE__ */ jsx(Field.Hint, {})
1382
- ]
1383
- }
1384
- ) }),
1385
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1386
- Field.Root,
1387
- {
1388
- id: "aspectRatio",
1389
- width: "100%",
1390
- required: true,
1391
- children: [
1392
- /* @__PURE__ */ jsx(Field.Label, { children: "Relación de aspecto" }),
1393
- /* @__PURE__ */ jsx(
1394
- Combobox,
1395
- {
1396
- name: "aspectRatio",
1397
- onChange: (value) => formik.setFieldValue("aspectRatio", value),
1398
- onBlur: () => formik.setFieldTouched("aspectRatio", true),
1399
- value: formik.values.aspectRatio,
1400
- onClear: () => formik.setFieldValue("aspectRatio", ""),
1401
- children: aspectRatioOptions.map((option) => /* @__PURE__ */ jsx(ComboboxOption, { value: option.value, children: option.label }, option.value))
1402
- }
1403
- )
1404
- ]
1405
- }
1406
- ) }),
1407
- /* @__PURE__ */ jsx(Grid.Item, { m: 12, children: /* @__PURE__ */ jsxs(
1408
- Field.Root,
1409
- {
1410
- id: "imageSize",
1411
- error: formik.touched.imageSize && formik.errors.imageSize ? formik.errors.imageSize : void 0,
1412
- width: "100%",
1413
- required: true,
1414
- children: [
1415
- /* @__PURE__ */ jsx(Field.Label, { children: "Tamaño de la imagen" }),
1416
- /* @__PURE__ */ jsxs(
1417
- Combobox,
1418
- {
1419
- name: "imageSize",
1420
- onChange: (value) => formik.setFieldValue("imageSize", value),
1421
- onBlur: () => formik.setFieldTouched("imageSize", true),
1422
- value: formik.values.imageSize,
1423
- onClear: () => formik.setFieldValue("imageSize", ""),
1424
- children: [
1425
- /* @__PURE__ */ jsx(ComboboxOption, { value: "1K", children: "1K" }),
1426
- /* @__PURE__ */ jsx(ComboboxOption, { value: "2K", children: "2K" }),
1427
- /* @__PURE__ */ jsx(ComboboxOption, { value: "4K", children: "4K" })
1428
- ]
1429
- }
1430
- ),
1431
- /* @__PURE__ */ jsx(Field.Error, { children: formik.errors.imageSize })
1432
- ]
1433
- }
1434
- ) }),
1435
- /* @__PURE__ */ jsx(Grid.Item, { col: 12, children: /* @__PURE__ */ jsx(Flex, { width: "100%", justifyContent: "end", alignItems: "end", children: /* @__PURE__ */ jsx(
1436
- Button,
1437
- {
1438
- type: "submit",
1439
- fullWidth: true,
1440
- disabled: !(formik.isValid && formik.dirty) || formik.isSubmitting,
1441
- loading: formik.isSubmitting,
1442
- children: "Generar imagen"
1443
- }
1444
- ) }) })
1445
- ] }) }) });
1446
- };
1447
- const GenerateImageContainer = () => {
1448
- const { toggleNotification } = useNotification();
1449
- const { generateImageWithConfig } = useImages$1();
1450
- const { formatMessage } = useIntl();
1451
- const handleSubmit = async (values, { setSubmitting }, referenceImages) => {
1452
- try {
1453
- const formData = new FormData();
1454
- formData.append("prompt", values.prompt);
1455
- formData.append("aspectRatio", values.aspectRatio);
1456
- formData.append("imageSize", values.imageSize);
1457
- referenceImages.forEach((img, index) => {
1458
- if (img.file) {
1459
- formData.append(`referenceImages[${index}]`, img.file);
1460
- }
1461
- });
1462
- const response = await generateImageWithConfig(formData);
1463
- toggleNotification({
1464
- type: "success",
1465
- message: formatMessage({
1466
- id: `${PLUGIN_ID}.config.load.success`,
1467
- defaultMessage: "Imagen generada con éxito"
1468
- })
1469
- });
1470
- } catch (error) {
1471
- toggleNotification({
1472
- type: "danger",
1473
- message: formatMessage({
1474
- id: `${PLUGIN_ID}.config.load.error`,
1475
- defaultMessage: "Ocurrió un error al generar la imagen"
1476
- })
1477
- });
1478
- } finally {
1479
- setSubmitting(false);
1480
- }
1481
- };
1482
- return /* @__PURE__ */ jsxs(Fragment, { children: [
1483
- /* @__PURE__ */ jsx(Grid.Root, { padding: 6, children: /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", children: [
1484
- /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: "Generar imagen con IA" }),
1485
- /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
1486
- ] }) }) }),
1487
- /* @__PURE__ */ jsxs(Grid.Root, { padding: 6, children: [
1488
- /* @__PURE__ */ jsx(Grid.Item, { m: 2 }),
1489
- /* @__PURE__ */ jsx(Grid.Item, { m: 8, children: /* @__PURE__ */ jsx(Form$1, { onSubmit: handleSubmit }) })
1490
- ] })
1491
- ] });
1492
- };
1493
- const GenerateImage = () => {
1494
- return /* @__PURE__ */ jsxs(Page.Main, { children: [
1495
- /* @__PURE__ */ jsx(Page.Title, { children: "Generar imagen con IA" }),
1496
- /* @__PURE__ */ jsx(GenerateImageContainer, {})
1497
- ] });
1498
- };
1499
813
  const sceneSchema = Yup.object().shape({
1500
814
  prompt: Yup.string().trim().required("El prompt es obligatorio para esta escena"),
1501
815
  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"),
@@ -1684,9 +998,21 @@ const Form = ({ onSubmit }) => {
1684
998
  ) }) })
1685
999
  ] }) }) });
1686
1000
  };
1001
+ const useImages = () => {
1002
+ const { post } = useFetchClient();
1003
+ const generateVideoWithScenes = useCallback(
1004
+ async (data, config) => {
1005
+ return await post("/strapi-content-generator-gemini/generate-video-with-scenes", data, config);
1006
+ },
1007
+ [post]
1008
+ );
1009
+ return {
1010
+ generateVideoWithScenes
1011
+ };
1012
+ };
1687
1013
  const GenerateVideoContainer = () => {
1688
1014
  const { toggleNotification } = useNotification();
1689
- const { generateVideoWithScenes } = useImages$1();
1015
+ const { generateVideoWithScenes } = useImages();
1690
1016
  const { formatMessage } = useIntl();
1691
1017
  const handleSubmit = async (values, { setSubmitting }) => {
1692
1018
  try {
@@ -1745,30 +1071,16 @@ const App = () => {
1745
1071
  if (isLoading) {
1746
1072
  return /* @__PURE__ */ jsx(Page.Loading, {});
1747
1073
  }
1748
- return /* @__PURE__ */ jsx(Page.Protect, { permissions: [...pluginPermissions.access], children: /* @__PURE__ */ jsx(DesignSystemProvider, { locale: "es-MX", children: /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
1749
- "div",
1750
- {
1751
- style: {
1752
- display: "grid",
1753
- gridTemplateColumns: "auto 1fr",
1754
- width: "100%",
1755
- height: "100vh"
1756
- },
1757
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
1758
- /* @__PURE__ */ jsx(Navigation, {}),
1759
- /* @__PURE__ */ jsxs(Routes, { children: [
1760
- allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
1761
- allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { path: "/generate-content", element: /* @__PURE__ */ jsx(GenerateContent, {}) }),
1762
- allowedActions.canAccess && /* @__PURE__ */ jsxs(Fragment, { children: [
1763
- /* @__PURE__ */ jsx(Route, { path: "/generate-images", element: /* @__PURE__ */ jsx(GenerateImages, {}) }),
1764
- /* @__PURE__ */ jsx(Route, { path: "/generate-image", element: /* @__PURE__ */ jsx(GenerateImage, {}) }),
1765
- /* @__PURE__ */ jsx(Route, { path: "/generate-video", element: /* @__PURE__ */ jsx(GenerateVideo, {}) })
1766
- ] }),
1767
- /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
1768
- ] })
1769
- ] })
1770
- }
1771
- ) }) }) });
1074
+ return /* @__PURE__ */ jsx(Page.Protect, { permissions: [...pluginPermissions.access], children: /* @__PURE__ */ jsx(PluginProviders, { children: /* @__PURE__ */ jsxs(Routes, { children: [
1075
+ allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
1076
+ allowedActions.canAccess && /* @__PURE__ */ jsx(Route, { path: "/generate-content", element: /* @__PURE__ */ jsx(GenerateContent, {}) }),
1077
+ allowedActions.canAccess && /* @__PURE__ */ jsxs(Fragment, { children: [
1078
+ /* @__PURE__ */ jsx(Route, { path: "/image-studio", element: /* @__PURE__ */ jsx(StudioRedirect, {}) }),
1079
+ LEGACY_ROUTES.map((r) => /* @__PURE__ */ jsx(Route, { path: r.path, element: legacyRedirect(r.tab) }, r.path)),
1080
+ /* @__PURE__ */ jsx(Route, { path: "/generate-video", element: /* @__PURE__ */ jsx(GenerateVideo, {}) })
1081
+ ] }),
1082
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
1083
+ ] }) }) });
1772
1084
  };
1773
1085
  export {
1774
1086
  App