@interware/content-generator 0.4.4 → 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-BQr5_g5u.mjs → App-DPVBu7QB.mjs} +37 -726
  3. package/dist/_chunks/{App-CfwvfmvL.js → App-DVTFrZvf.js} +31 -720
  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-DNhP1INv.js → getTranslation-D88uLXGd.js} +1 -1
  11. package/dist/_chunks/{getTranslation-B9ND5RaH.mjs → getTranslation-DfxaP_TC.mjs} +1 -1
  12. package/dist/_chunks/{index-Dyq8dxMX.mjs → index-CqDdi211.mjs} +25 -7
  13. package/dist/_chunks/{index-DGPqyrzz.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 +2408 -1261
  120. package/dist/server/index.mjs +2415 -1267
  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 +0 -5
  127. package/dist/server/src/controllers/image-studio.d.ts +23 -0
  128. package/dist/server/src/controllers/index.d.ts +128 -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 +229 -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 +27 -57
  141. package/dist/server/src/services/service.d.ts +0 -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-BrqTzJp-.js +0 -262
  151. package/dist/_chunks/Settings-CdZnYLLK.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 -12
  160. package/dist/admin/src/pages/GenerateImage.d.ts +0 -2
  161. package/dist/admin/src/pages/GenerateImages.d.ts +0 -2
@@ -0,0 +1,155 @@
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 index = require("./index-Ddp0Qvqo.js");
10
+ const getTranslation = require("./getTranslation-D88uLXGd.js");
11
+ const useSettings = () => {
12
+ const { get, post } = admin.useFetchClient();
13
+ const getSettings = react.useCallback(
14
+ async (config) => {
15
+ return get("/strapi-content-generator-gemini/config", config);
16
+ },
17
+ [get]
18
+ );
19
+ const setSettings = react.useCallback(
20
+ async (data, config) => {
21
+ return post("/strapi-content-generator-gemini/config", data, config);
22
+ },
23
+ [post]
24
+ );
25
+ return {
26
+ getSettings,
27
+ setSettings
28
+ };
29
+ };
30
+ const FIELDS = [
31
+ { name: "googleGenAI", label: "API Key Gemini" },
32
+ { name: "linkedInAccessToken", label: "LinkedIn Access Token" },
33
+ { name: "linkedInOrganizationId", label: "LinkedIn Organization ID" },
34
+ { name: "facebookClientToken", label: "FACEBOOK CLIENT TOKEN" },
35
+ { name: "facebookPageId", label: "FACEBOOK PAGE ID" }
36
+ ];
37
+ const EMPTY = {
38
+ googleGenAI: "",
39
+ linkedInAccessToken: "",
40
+ linkedInOrganizationId: "",
41
+ facebookClientToken: "",
42
+ facebookPageId: ""
43
+ };
44
+ const hint = ({ configured, last4 }) => configured ? `Configurada ···${last4}` : "Sin configurar";
45
+ const filledOnly = (values) => Object.fromEntries(Object.entries(values).filter(([, value]) => value.trim() !== ""));
46
+ const Form = ({ status, handleSubmit }) => {
47
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 6, margin: 6, background: "neutral0", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(
48
+ formik.Formik,
49
+ {
50
+ initialValues: EMPTY,
51
+ onSubmit: async (values, { resetForm }) => {
52
+ await handleSubmit(filledOnly(values));
53
+ resetForm();
54
+ },
55
+ children: ({ values, handleChange, handleBlur, handleSubmit: submit, isSubmitting }) => {
56
+ const hasChanges = Object.keys(filledOnly(values)).length > 0;
57
+ return /* @__PURE__ */ jsxRuntime.jsx("form", { onSubmit: submit, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: 4, children: [
58
+ FIELDS.map(({ name, label }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { id: name, width: "100%", hint: hint(status[name]), children: [
59
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
60
+ /* @__PURE__ */ jsxRuntime.jsx(
61
+ designSystem.Field.Input,
62
+ {
63
+ name,
64
+ value: values[name],
65
+ onChange: handleChange,
66
+ onBlur: handleBlur,
67
+ type: "password",
68
+ autoComplete: "off",
69
+ placeholder: "Escribe un valor nuevo para reemplazarla"
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
73
+ ] }) }, name)),
74
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "end", alignItems: "end", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !hasChanges || isSubmitting, children: "Guardar" }) }) })
75
+ ] }) });
76
+ }
77
+ }
78
+ ) });
79
+ };
80
+ const NOT_CONFIGURED = { configured: false, last4: null };
81
+ const initialStatus = {
82
+ googleGenAI: NOT_CONFIGURED,
83
+ linkedInAccessToken: NOT_CONFIGURED,
84
+ linkedInOrganizationId: NOT_CONFIGURED,
85
+ facebookClientToken: NOT_CONFIGURED,
86
+ facebookPageId: NOT_CONFIGURED
87
+ };
88
+ const SettingsContainer = () => {
89
+ const [status, setStatus] = react.useState(initialStatus);
90
+ const { formatMessage } = reactIntl.useIntl();
91
+ const { getSettings, setSettings } = useSettings();
92
+ const { toggleNotification } = admin.useNotification();
93
+ const fetchSettings = react.useCallback(async () => {
94
+ let isMounted = true;
95
+ try {
96
+ const { data } = await getSettings();
97
+ if (isMounted) {
98
+ setStatus(data);
99
+ }
100
+ } catch (error) {
101
+ toggleNotification({
102
+ type: "danger",
103
+ message: formatMessage({
104
+ id: `${index.PLUGIN_ID}.config.load.error`,
105
+ defaultMessage: "Error cargando configuración"
106
+ })
107
+ });
108
+ }
109
+ return () => {
110
+ isMounted = false;
111
+ };
112
+ }, [getSettings]);
113
+ const handleSubmit = react.useCallback(
114
+ async (values) => {
115
+ try {
116
+ await setSettings(values);
117
+ await fetchSettings();
118
+ toggleNotification({
119
+ type: "success",
120
+ message: formatMessage({
121
+ id: `${index.PLUGIN_ID}.config.load.error`,
122
+ defaultMessage: "Configuración guardada con éxito"
123
+ })
124
+ });
125
+ } catch (error) {
126
+ toggleNotification({
127
+ type: "danger",
128
+ message: formatMessage({
129
+ id: `${index.PLUGIN_ID}.config.load.error`,
130
+ defaultMessage: "Error guardando configuración"
131
+ })
132
+ });
133
+ }
134
+ },
135
+ [setSettings, fetchSettings]
136
+ );
137
+ react.useEffect(() => {
138
+ fetchSettings();
139
+ }, []);
140
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.DesignSystemProvider, { locale: "es-MX", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { padding: 6, gap: 3, children: [
141
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "start", children: [
142
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", children: formatMessage({ id: getTranslation.getTranslation("plugin.name") }) }),
143
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
144
+ ] }) }),
145
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { children: /* @__PURE__ */ jsxRuntime.jsx(Form, { status, handleSubmit }) })
146
+ ] }) });
147
+ };
148
+ const SettingsPage = () => {
149
+ const { formatMessage } = reactIntl.useIntl();
150
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
151
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: `${formatMessage({ id: getTranslation.getTranslation("plugin.name") })} | Settings` }),
152
+ /* @__PURE__ */ jsxRuntime.jsx(SettingsContainer, {})
153
+ ] }) });
154
+ };
155
+ exports.default = SettingsPage;
@@ -0,0 +1,155 @@
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 { P as PLUGIN_ID } from "./index-CqDdi211.mjs";
8
+ import { g as getTranslation } from "./getTranslation-DfxaP_TC.mjs";
9
+ const useSettings = () => {
10
+ const { get, post } = useFetchClient();
11
+ const getSettings = useCallback(
12
+ async (config) => {
13
+ return get("/strapi-content-generator-gemini/config", config);
14
+ },
15
+ [get]
16
+ );
17
+ const setSettings = useCallback(
18
+ async (data, config) => {
19
+ return post("/strapi-content-generator-gemini/config", data, config);
20
+ },
21
+ [post]
22
+ );
23
+ return {
24
+ getSettings,
25
+ setSettings
26
+ };
27
+ };
28
+ const FIELDS = [
29
+ { name: "googleGenAI", label: "API Key Gemini" },
30
+ { name: "linkedInAccessToken", label: "LinkedIn Access Token" },
31
+ { name: "linkedInOrganizationId", label: "LinkedIn Organization ID" },
32
+ { name: "facebookClientToken", label: "FACEBOOK CLIENT TOKEN" },
33
+ { name: "facebookPageId", label: "FACEBOOK PAGE ID" }
34
+ ];
35
+ const EMPTY = {
36
+ googleGenAI: "",
37
+ linkedInAccessToken: "",
38
+ linkedInOrganizationId: "",
39
+ facebookClientToken: "",
40
+ facebookPageId: ""
41
+ };
42
+ const hint = ({ configured, last4 }) => configured ? `Configurada ···${last4}` : "Sin configurar";
43
+ const filledOnly = (values) => Object.fromEntries(Object.entries(values).filter(([, value]) => value.trim() !== ""));
44
+ const Form = ({ status, handleSubmit }) => {
45
+ return /* @__PURE__ */ jsx(Box, { padding: 6, margin: 6, background: "neutral0", width: "100%", children: /* @__PURE__ */ jsx(
46
+ Formik,
47
+ {
48
+ initialValues: EMPTY,
49
+ onSubmit: async (values, { resetForm }) => {
50
+ await handleSubmit(filledOnly(values));
51
+ resetForm();
52
+ },
53
+ children: ({ values, handleChange, handleBlur, handleSubmit: submit, isSubmitting }) => {
54
+ const hasChanges = Object.keys(filledOnly(values)).length > 0;
55
+ return /* @__PURE__ */ jsx("form", { onSubmit: submit, children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
56
+ FIELDS.map(({ name, label }) => /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(Field.Root, { id: name, width: "100%", hint: hint(status[name]), children: [
57
+ /* @__PURE__ */ jsx(Field.Label, { children: label }),
58
+ /* @__PURE__ */ jsx(
59
+ Field.Input,
60
+ {
61
+ name,
62
+ value: values[name],
63
+ onChange: handleChange,
64
+ onBlur: handleBlur,
65
+ type: "password",
66
+ autoComplete: "off",
67
+ placeholder: "Escribe un valor nuevo para reemplazarla"
68
+ }
69
+ ),
70
+ /* @__PURE__ */ jsx(Field.Hint, {})
71
+ ] }) }, name)),
72
+ /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "end", alignItems: "end", width: "100%", children: /* @__PURE__ */ jsx(Button, { type: "submit", disabled: !hasChanges || isSubmitting, children: "Guardar" }) }) })
73
+ ] }) });
74
+ }
75
+ }
76
+ ) });
77
+ };
78
+ const NOT_CONFIGURED = { configured: false, last4: null };
79
+ const initialStatus = {
80
+ googleGenAI: NOT_CONFIGURED,
81
+ linkedInAccessToken: NOT_CONFIGURED,
82
+ linkedInOrganizationId: NOT_CONFIGURED,
83
+ facebookClientToken: NOT_CONFIGURED,
84
+ facebookPageId: NOT_CONFIGURED
85
+ };
86
+ const SettingsContainer = () => {
87
+ const [status, setStatus] = useState(initialStatus);
88
+ const { formatMessage } = useIntl();
89
+ const { getSettings, setSettings } = useSettings();
90
+ const { toggleNotification } = useNotification();
91
+ const fetchSettings = useCallback(async () => {
92
+ let isMounted = true;
93
+ try {
94
+ const { data } = await getSettings();
95
+ if (isMounted) {
96
+ setStatus(data);
97
+ }
98
+ } catch (error) {
99
+ toggleNotification({
100
+ type: "danger",
101
+ message: formatMessage({
102
+ id: `${PLUGIN_ID}.config.load.error`,
103
+ defaultMessage: "Error cargando configuración"
104
+ })
105
+ });
106
+ }
107
+ return () => {
108
+ isMounted = false;
109
+ };
110
+ }, [getSettings]);
111
+ const handleSubmit = useCallback(
112
+ async (values) => {
113
+ try {
114
+ await setSettings(values);
115
+ await fetchSettings();
116
+ toggleNotification({
117
+ type: "success",
118
+ message: formatMessage({
119
+ id: `${PLUGIN_ID}.config.load.error`,
120
+ defaultMessage: "Configuración guardada con éxito"
121
+ })
122
+ });
123
+ } catch (error) {
124
+ toggleNotification({
125
+ type: "danger",
126
+ message: formatMessage({
127
+ id: `${PLUGIN_ID}.config.load.error`,
128
+ defaultMessage: "Error guardando configuración"
129
+ })
130
+ });
131
+ }
132
+ },
133
+ [setSettings, fetchSettings]
134
+ );
135
+ useEffect(() => {
136
+ fetchSettings();
137
+ }, []);
138
+ return /* @__PURE__ */ jsx(DesignSystemProvider, { locale: "es-MX", children: /* @__PURE__ */ jsxs(Grid.Root, { padding: 6, gap: 3, children: [
139
+ /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "start", children: [
140
+ /* @__PURE__ */ jsx(Typography, { variant: "alpha", children: formatMessage({ id: getTranslation("plugin.name") }) }),
141
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", children: "Para uso exclusivo de InterWare de México" })
142
+ ] }) }),
143
+ /* @__PURE__ */ jsx(Grid.Item, { children: /* @__PURE__ */ jsx(Form, { status, handleSubmit }) })
144
+ ] }) });
145
+ };
146
+ const SettingsPage = () => {
147
+ const { formatMessage } = useIntl();
148
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Page.Main, { children: [
149
+ /* @__PURE__ */ jsx(Page.Title, { children: `${formatMessage({ id: getTranslation("plugin.name") })} | Settings` }),
150
+ /* @__PURE__ */ jsx(SettingsContainer, {})
151
+ ] }) });
152
+ };
153
+ export {
154
+ SettingsPage as default
155
+ };
@@ -0,0 +1,17 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { Page } from "@strapi/strapi/admin";
3
+ import { Routes, Route } from "react-router-dom";
4
+ import { I as ImageStudioTabs, P as PluginProviders } from "./ImageStudioTabs-mlNL6aQ2.mjs";
5
+ import { p as pluginPermissions } from "./index-CqDdi211.mjs";
6
+ import { Box } from "@strapi/design-system";
7
+ const ImageStudio = () => /* @__PURE__ */ jsxs(Page.Main, { children: [
8
+ /* @__PURE__ */ jsx(Page.Title, { children: "Estudio de imágenes" }),
9
+ /* @__PURE__ */ jsx(Box, { style: { height: "100vh" }, children: /* @__PURE__ */ jsx(ImageStudioTabs, {}) })
10
+ ] });
11
+ const StudioApp = () => /* @__PURE__ */ jsx(Page.Protect, { permissions: [...pluginPermissions.access], children: /* @__PURE__ */ jsx(PluginProviders, { children: /* @__PURE__ */ jsxs(Routes, { children: [
12
+ /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(ImageStudio, {}) }),
13
+ /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
14
+ ] }) }) });
15
+ export {
16
+ StudioApp
17
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const admin = require("@strapi/strapi/admin");
5
+ const reactRouterDom = require("react-router-dom");
6
+ const ImageStudioTabs = require("./ImageStudioTabs-B2UbKYq7.js");
7
+ const index = require("./index-Ddp0Qvqo.js");
8
+ const designSystem = require("@strapi/design-system");
9
+ const ImageStudio = () => /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
10
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: "Estudio de imágenes" }),
11
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { height: "100vh" }, children: /* @__PURE__ */ jsxRuntime.jsx(ImageStudioTabs.ImageStudioTabs, {}) })
12
+ ] });
13
+ const StudioApp = () => /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: [...index.pluginPermissions.access], children: /* @__PURE__ */ jsxRuntime.jsx(ImageStudioTabs.PluginProviders, { children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
14
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(ImageStudio, {}) }),
15
+ /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
16
+ ] }) }) });
17
+ exports.StudioApp = StudioApp;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
- const index = require("./index-DGPqyrzz.js");
2
+ const index = require("./index-Ddp0Qvqo.js");
3
3
  const getTranslation = (id) => `${index.PLUGIN_ID}.${id}`;
4
4
  exports.getTranslation = getTranslation;
@@ -1,4 +1,4 @@
1
- import { P as PLUGIN_ID } from "./index-Dyq8dxMX.mjs";
1
+ import { P as PLUGIN_ID } from "./index-CqDdi211.mjs";
2
2
  const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
3
3
  export {
4
4
  getTranslation as g
@@ -1,6 +1,6 @@
1
1
  import { useRef, useEffect } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { Sparkle } from "@strapi/icons";
3
+ import { Quotes, Lightning } from "@strapi/icons";
4
4
  import { createSlice } from "@reduxjs/toolkit";
5
5
  const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
6
6
  const v = glob[path];
@@ -19,6 +19,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
19
19
  });
20
20
  };
21
21
  const PLUGIN_ID = "strapi-content-generator-gemini";
22
+ const STUDIO_PATH = `plugins/${PLUGIN_ID}-studio`;
22
23
  const loadFontAwesome = () => {
23
24
  if (document.getElementById("font-awesome-kit")) return;
24
25
  const script = document.createElement("script");
@@ -36,7 +37,8 @@ const Initializer = ({ setPlugin }) => {
36
37
  }, []);
37
38
  return null;
38
39
  };
39
- const PluginIcon = () => /* @__PURE__ */ jsx(Sparkle, {});
40
+ const ContentIcon = () => /* @__PURE__ */ jsx(Quotes, {});
41
+ const StudioIcon = () => /* @__PURE__ */ jsx(Lightning, {});
40
42
  const pluginPermissions = {
41
43
  access: [
42
44
  {
@@ -70,19 +72,34 @@ const index = {
70
72
  register(app) {
71
73
  app.addMenuLink({
72
74
  to: `plugins/${PLUGIN_ID}`,
73
- icon: PluginIcon,
75
+ icon: ContentIcon,
74
76
  intlLabel: {
75
- id: `${PLUGIN_ID}.plugin.name`,
76
- defaultMessage: PLUGIN_ID
77
+ id: `${PLUGIN_ID}.menu.content`,
78
+ defaultMessage: "Generador de contenido"
77
79
  },
78
80
  Component: async () => {
79
- const { App } = await import("./App-BQr5_g5u.mjs");
81
+ const { App } = await import("./App-DPVBu7QB.mjs");
80
82
  return App;
81
83
  },
82
84
  permissions: [
83
85
  pluginPermissions.access[0]
84
86
  ]
85
87
  });
88
+ app.addMenuLink({
89
+ to: STUDIO_PATH,
90
+ icon: StudioIcon,
91
+ intlLabel: {
92
+ id: `${PLUGIN_ID}.menu.studio`,
93
+ defaultMessage: "Estudio de imágenes"
94
+ },
95
+ Component: async () => {
96
+ const { StudioApp } = await import("./StudioApp-AUyPNhh2.mjs");
97
+ return StudioApp;
98
+ },
99
+ permissions: [
100
+ pluginPermissions.access[0]
101
+ ]
102
+ });
86
103
  app.registerPlugin({
87
104
  id: PLUGIN_ID,
88
105
  initializer: Initializer,
@@ -97,7 +114,7 @@ const index = {
97
114
  defaultMessage: PLUGIN_ID
98
115
  },
99
116
  Component: async () => {
100
- const component = await import("./Settings-CdZnYLLK.mjs");
117
+ const component = await import("./Settings-RrBQdijj.mjs");
101
118
  return component.default;
102
119
  },
103
120
  to: `plugins/${PLUGIN_ID}/settings`,
@@ -119,6 +136,7 @@ const index = {
119
136
  };
120
137
  export {
121
138
  PLUGIN_ID as P,
139
+ STUDIO_PATH as S,
122
140
  closeDialog as c,
123
141
  index as i,
124
142
  openDialog as o,
@@ -20,6 +20,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
20
20
  });
21
21
  };
22
22
  const PLUGIN_ID = "strapi-content-generator-gemini";
23
+ const STUDIO_PATH = `plugins/${PLUGIN_ID}-studio`;
23
24
  const loadFontAwesome = () => {
24
25
  if (document.getElementById("font-awesome-kit")) return;
25
26
  const script = document.createElement("script");
@@ -37,7 +38,8 @@ const Initializer = ({ setPlugin }) => {
37
38
  }, []);
38
39
  return null;
39
40
  };
40
- const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Sparkle, {});
41
+ const ContentIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Quotes, {});
42
+ const StudioIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Lightning, {});
41
43
  const pluginPermissions = {
42
44
  access: [
43
45
  {
@@ -71,19 +73,34 @@ const index = {
71
73
  register(app) {
72
74
  app.addMenuLink({
73
75
  to: `plugins/${PLUGIN_ID}`,
74
- icon: PluginIcon,
76
+ icon: ContentIcon,
75
77
  intlLabel: {
76
- id: `${PLUGIN_ID}.plugin.name`,
77
- defaultMessage: PLUGIN_ID
78
+ id: `${PLUGIN_ID}.menu.content`,
79
+ defaultMessage: "Generador de contenido"
78
80
  },
79
81
  Component: async () => {
80
- const { App } = await Promise.resolve().then(() => require("./App-CfwvfmvL.js"));
82
+ const { App } = await Promise.resolve().then(() => require("./App-DVTFrZvf.js"));
81
83
  return App;
82
84
  },
83
85
  permissions: [
84
86
  pluginPermissions.access[0]
85
87
  ]
86
88
  });
89
+ app.addMenuLink({
90
+ to: STUDIO_PATH,
91
+ icon: StudioIcon,
92
+ intlLabel: {
93
+ id: `${PLUGIN_ID}.menu.studio`,
94
+ defaultMessage: "Estudio de imágenes"
95
+ },
96
+ Component: async () => {
97
+ const { StudioApp } = await Promise.resolve().then(() => require("./StudioApp-Cswkzh7F.js"));
98
+ return StudioApp;
99
+ },
100
+ permissions: [
101
+ pluginPermissions.access[0]
102
+ ]
103
+ });
87
104
  app.registerPlugin({
88
105
  id: PLUGIN_ID,
89
106
  initializer: Initializer,
@@ -98,7 +115,7 @@ const index = {
98
115
  defaultMessage: PLUGIN_ID
99
116
  },
100
117
  Component: async () => {
101
- const component = await Promise.resolve().then(() => require("./Settings-BrqTzJp-.js"));
118
+ const component = await Promise.resolve().then(() => require("./Settings-DziRY70a.js"));
102
119
  return component.default;
103
120
  },
104
121
  to: `plugins/${PLUGIN_ID}/settings`,
@@ -119,6 +136,7 @@ const index = {
119
136
  }
120
137
  };
121
138
  exports.PLUGIN_ID = PLUGIN_ID;
139
+ exports.STUDIO_PATH = STUDIO_PATH;
122
140
  exports.closeDialog = closeDialog;
123
141
  exports.index = index;
124
142
  exports.openDialog = openDialog;
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-DGPqyrzz.js");
2
+ const index = require("../_chunks/index-Ddp0Qvqo.js");
3
3
  module.exports = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "../_chunks/index-Dyq8dxMX.mjs";
1
+ import { i } from "../_chunks/index-CqDdi211.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
@@ -1,2 +1,4 @@
1
- declare const PluginIcon: () => import("react/jsx-runtime").JSX.Element;
2
- export { PluginIcon };
1
+ /** Íconos de las entradas del menú principal (S4.10; Quotes y Lightning a pedido de Israel). */
2
+ declare const ContentIcon: () => import("react/jsx-runtime").JSX.Element;
3
+ declare const StudioIcon: () => import("react/jsx-runtime").JSX.Element;
4
+ export { ContentIcon, StudioIcon };
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ /**
3
+ * Proveedores del plugin. El plugin tiene su propia copia del Design System, así que necesita su
4
+ * propio `DesignSystemProvider` (el del panel no le llega) con el tema del panel (S4.10).
5
+ */
6
+ export declare const PluginProviders: ({ children }: {
7
+ children: ReactNode;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -16,7 +16,7 @@ export type ReferenceImage = {
16
16
  previewUrl?: string;
17
17
  };
18
18
  export declare const validationSchema: Yup.ObjectSchema<{
19
- aspectRatio: NonNullable<"1:1" | "9:16" | "16:9" | undefined>;
19
+ aspectRatio: NonNullable<"1:1" | "16:9" | "9:16" | undefined>;
20
20
  scenes: {
21
21
  referenceImages?: {
22
22
  file?: {} | undefined;
@@ -1,8 +1,7 @@
1
- import { type FormikHelpers } from 'formik';
2
- import type { FormValues } from "../../containers/settings";
1
+ import type { FormValues, SettingsStatus } from '../../containers/settings';
3
2
  interface FormProps {
4
- settings: FormValues;
5
- handleSubmit: (values: FormValues, formikHelpers: FormikHelpers<FormValues>) => void;
3
+ status: SettingsStatus;
4
+ handleSubmit: (values: Partial<FormValues>) => void | Promise<void>;
6
5
  }
7
- declare const Form: ({ settings, handleSubmit }: FormProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const Form: ({ status, handleSubmit }: FormProps) => import("react/jsx-runtime").JSX.Element;
8
7
  export { Form };
@@ -1,9 +1,9 @@
1
- export type FormValues = {
2
- googleGenAI: string;
3
- linkedInAccessToken: string;
4
- linkedInOrganizationId: string;
5
- facebookClientToken: string;
6
- facebookPageId: string;
7
- };
1
+ export type CredentialField = 'googleGenAI' | 'linkedInAccessToken' | 'linkedInOrganizationId' | 'facebookClientToken' | 'facebookPageId';
2
+ export type FormValues = Record<CredentialField, string>;
3
+ /** Estado enmascarado que devuelve `GET /config`: nunca incluye el valor completo. */
4
+ export type SettingsStatus = Record<CredentialField, {
5
+ configured: boolean;
6
+ last4: string | null;
7
+ }>;
8
8
  declare const SettingsContainer: () => import("react/jsx-runtime").JSX.Element;
9
9
  export { SettingsContainer };
@@ -0,0 +1,7 @@
1
+ interface RemoveBackgroundButtonProps {
2
+ src: string;
3
+ onDone: (dataUrl: string) => void;
4
+ }
5
+ /** «Quitar fondo»: abre el diálogo con los modos Automático y Por color (S4.18); los errores se ven ahí. */
6
+ export declare const RemoveBackgroundButton: ({ src, onDone }: RemoveBackgroundButtonProps) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,15 @@
1
+ /** Tolerancia inicial (%): quita el fondo liso y sus variaciones leves (compresión, sombras suaves). */
2
+ export declare const DEFAULT_TOLERANCE = 15;
3
+ interface RemoveBackgroundDialogProps {
4
+ open: boolean;
5
+ src: string;
6
+ onClose: () => void;
7
+ /** PNG sin fondo en data URL. Puede ser asíncrono (la biblioteca guarda la copia). */
8
+ onApply: (dataUrl: string) => void | Promise<void>;
9
+ }
10
+ /**
11
+ * «Quitar fondo» con dos modos (S4.18): *Automático* corre ISNet (S4.17) al abrir; *Por color* quita
12
+ * el fondo conectado a cada punto marcado, con tolerancia y vista previa en vivo.
13
+ */
14
+ export declare const RemoveBackgroundDialog: ({ open, src, onClose, onApply }: RemoveBackgroundDialogProps) => import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * «Quitar fondo» por color (S4.18). Desde cada punto marcado se rellenan los píxeles conectados
3
+ * (vecinos arriba, abajo, izquierda y derecha) cuyo color se parece al del punto. Solo se quita lo
4
+ * conectado: otro fondo, aunque sea del mismo color, se queda si un objeto lo separa. Funciones puras
5
+ * sobre arreglos RGBA; el canvas queda en el diálogo.
6
+ */
7
+ export interface Point {
8
+ x: number;
9
+ y: number;
10
+ }
11
+ type Rgb = readonly [number, number, number];
12
+ /** Franja después de la tolerancia con alfa parcial, para que el contorno no quede dentado. */
13
+ export declare const SOFTNESS = 0.06;
14
+ /** Distancia euclidiana RGB normalizada: 0 es el mismo color, 1 es blanco contra negro. */
15
+ export declare const colorDistance: (a: Rgb, b: Rgb) => number;
16
+ /**
17
+ * Alfa por píxel (0 quitado, 255 intacto). Cada píxel se compara con el color de su punto, no con su
18
+ * vecino, así un degradado no se va en cadena. Hasta `tolerance` (0–1) el píxel se quita y el relleno
19
+ * sigue; en la franja siguiente (`SOFTNESS`) queda con alfa parcial y el relleno se detiene ahí.
20
+ *
21
+ * Con `contiguous: false` se quita ese color en toda la imagen, conectado o no: los huecos de letras y
22
+ * figuras (la «o», la «a») que el relleno no alcanza porque el trazo los encierra.
23
+ */
24
+ export declare const colorKeyAlpha: (rgba: Uint8ClampedArray, width: number, height: number, points: Point[], tolerance: number, { contiguous }?: {
25
+ contiguous?: boolean;
26
+ }) => Uint8ClampedArray;
27
+ /** Copia de la imagen con el alfa aplicado; conserva la transparencia que ya tenía. */
28
+ export declare const applyKeyAlpha: (rgba: Uint8ClampedArray, alpha: Uint8ClampedArray) => Uint8ClampedArray;
29
+ export {};