@interware/content-generator 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/_chunks/App-6ntGE8c-.js +702 -0
- package/dist/_chunks/App-CUBxywy1.mjs +684 -0
- package/dist/_chunks/Settings-CwPVYHgw.js +218 -0
- package/dist/_chunks/Settings-DTPXHARn.mjs +200 -0
- package/dist/_chunks/en-B4KWt_jN.js +4 -0
- package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
- package/dist/_chunks/es-Cb6O-nM6.js +4 -0
- package/dist/_chunks/es-DlGQb34u.mjs +4 -0
- package/dist/_chunks/getTranslation-AfxwBFKN.js +4 -0
- package/dist/_chunks/getTranslation-Di36t3DD.mjs +5 -0
- package/dist/_chunks/index-CkkBgYlg.mjs +126 -0
- package/dist/_chunks/index-Dcpjhvs5.js +125 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/PluginIcon.d.ts +2 -0
- package/dist/admin/src/components/commons/dialog/index.d.ts +12 -0
- package/dist/admin/src/components/commons/generate-image-dialog/index.d.ts +5 -0
- package/dist/admin/src/components/generate-content/Form.d.ts +15 -0
- package/dist/admin/src/components/home/table.d.ts +12 -0
- package/dist/admin/src/components/index.d.ts +12 -0
- package/dist/admin/src/components/settings/Form.d.ts +8 -0
- package/dist/admin/src/containers/generate-content/index.d.ts +2 -0
- package/dist/admin/src/containers/home/index.d.ts +2 -0
- package/dist/admin/src/containers/settings/index.d.ts +7 -0
- package/dist/admin/src/hooks/useDialog.d.ts +11 -0
- package/dist/admin/src/index.d.ts +10 -0
- package/dist/admin/src/lib/use-cases/articles/index.d.ts +5 -0
- package/dist/admin/src/lib/use-cases/categories/index.d.ts +5 -0
- package/dist/admin/src/lib/use-cases/generate-content/index.d.ts +6 -0
- package/dist/admin/src/lib/use-cases/linkedin/index.d.ts +5 -0
- package/dist/admin/src/lib/use-cases/settings/index.d.ts +6 -0
- package/dist/admin/src/lib/use-cases/users/index.d.ts +5 -0
- package/dist/admin/src/pages/App.d.ts +2 -0
- package/dist/admin/src/pages/GenerateContent.d.ts +2 -0
- package/dist/admin/src/pages/HomePage.d.ts +2 -0
- package/dist/admin/src/pages/Settings.d.ts +2 -0
- package/dist/admin/src/permissions.d.ts +7 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/reducers/dialog/index.d.ts +6 -0
- package/dist/admin/src/types/reducers.d.ts +4 -0
- package/dist/admin/src/utils/getTranslation.d.ts +2 -0
- package/dist/server/index.js +3149 -0
- package/dist/server/index.mjs +3130 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/index.d.ts +5 -0
- package/dist/server/src/content-types/index.d.ts +2 -0
- package/dist/server/src/controllers/config.d.ts +8 -0
- package/dist/server/src/controllers/controller.d.ts +15 -0
- package/dist/server/src/controllers/index.d.ts +22 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/index.d.ts +148 -0
- package/dist/server/src/middlewares/index.d.ts +2 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/admin.d.ts +10 -0
- package/dist/server/src/routes/content-api.d.ts +10 -0
- package/dist/server/src/routes/index.d.ts +27 -0
- package/dist/server/src/services/index.d.ts +83 -0
- package/dist/server/src/services/service.d.ts +86 -0
- package/package.json +98 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const react = require("react");
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const icons = require("@strapi/icons");
|
|
5
|
+
const toolkit = require("@reduxjs/toolkit");
|
|
6
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
7
|
+
const v = glob[path];
|
|
8
|
+
if (v) {
|
|
9
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
10
|
+
}
|
|
11
|
+
return new Promise((_, reject) => {
|
|
12
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
13
|
+
reject.bind(
|
|
14
|
+
null,
|
|
15
|
+
new Error(
|
|
16
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const PLUGIN_ID = "strapi-content-generator-gemini";
|
|
23
|
+
const loadFontAwesome = () => {
|
|
24
|
+
if (document.getElementById("font-awesome-kit")) return;
|
|
25
|
+
const script = document.createElement("script");
|
|
26
|
+
script.id = "font-awesome-kit";
|
|
27
|
+
script.src = "https://kit.fontawesome.com/ccaa22cd11.js";
|
|
28
|
+
script.crossOrigin = "anonymous";
|
|
29
|
+
script.defer = true;
|
|
30
|
+
document.head.appendChild(script);
|
|
31
|
+
};
|
|
32
|
+
const Initializer = ({ setPlugin }) => {
|
|
33
|
+
const ref = react.useRef(setPlugin);
|
|
34
|
+
react.useEffect(() => {
|
|
35
|
+
ref.current(PLUGIN_ID);
|
|
36
|
+
loadFontAwesome();
|
|
37
|
+
}, []);
|
|
38
|
+
return null;
|
|
39
|
+
};
|
|
40
|
+
const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.Sparkle, {});
|
|
41
|
+
const pluginPermissions = {
|
|
42
|
+
access: [
|
|
43
|
+
{
|
|
44
|
+
action: `plugin::${PLUGIN_ID}.access`,
|
|
45
|
+
subject: null
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
const initialState = {
|
|
50
|
+
open: {}
|
|
51
|
+
};
|
|
52
|
+
const dialogSlice = toolkit.createSlice({
|
|
53
|
+
name: "sci_commonDialog",
|
|
54
|
+
initialState,
|
|
55
|
+
reducers: {
|
|
56
|
+
openDialog: (state, action) => {
|
|
57
|
+
state.open[action.payload] = true;
|
|
58
|
+
},
|
|
59
|
+
closeDialog: (state, action) => {
|
|
60
|
+
state.open[action.payload] = false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const { openDialog, closeDialog } = dialogSlice.actions;
|
|
65
|
+
const dialogReducer = dialogSlice.reducer;
|
|
66
|
+
const reducers = {
|
|
67
|
+
// Reducer Syntax
|
|
68
|
+
["content_generator_commonDialog"]: dialogReducer
|
|
69
|
+
};
|
|
70
|
+
const index = {
|
|
71
|
+
register(app) {
|
|
72
|
+
app.addMenuLink({
|
|
73
|
+
to: `plugins/${PLUGIN_ID}`,
|
|
74
|
+
icon: PluginIcon,
|
|
75
|
+
intlLabel: {
|
|
76
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
77
|
+
defaultMessage: PLUGIN_ID
|
|
78
|
+
},
|
|
79
|
+
Component: async () => {
|
|
80
|
+
const { App } = await Promise.resolve().then(() => require("./App-6ntGE8c-.js"));
|
|
81
|
+
return App;
|
|
82
|
+
},
|
|
83
|
+
permissions: [
|
|
84
|
+
pluginPermissions.access[0]
|
|
85
|
+
]
|
|
86
|
+
});
|
|
87
|
+
app.registerPlugin({
|
|
88
|
+
id: PLUGIN_ID,
|
|
89
|
+
initializer: Initializer,
|
|
90
|
+
isReady: false,
|
|
91
|
+
name: PLUGIN_ID
|
|
92
|
+
});
|
|
93
|
+
app.addReducers(reducers);
|
|
94
|
+
app.addSettingsLink("global", {
|
|
95
|
+
id: PLUGIN_ID,
|
|
96
|
+
intlLabel: {
|
|
97
|
+
id: `${PLUGIN_ID}.plugin.name`,
|
|
98
|
+
defaultMessage: PLUGIN_ID
|
|
99
|
+
},
|
|
100
|
+
Component: async () => {
|
|
101
|
+
const component = await Promise.resolve().then(() => require("./Settings-CwPVYHgw.js"));
|
|
102
|
+
return component.default;
|
|
103
|
+
},
|
|
104
|
+
to: `plugins/${PLUGIN_ID}/settings`,
|
|
105
|
+
permissions: [pluginPermissions.access[0]]
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
async registerTrads({ locales }) {
|
|
109
|
+
return Promise.all(
|
|
110
|
+
locales.map(async (locale) => {
|
|
111
|
+
try {
|
|
112
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-B4KWt_jN.js")), "./translations/es.json": () => Promise.resolve().then(() => require("./es-Cb6O-nM6.js")) }), `./translations/${locale}.json`, 3);
|
|
113
|
+
return { data, locale };
|
|
114
|
+
} catch {
|
|
115
|
+
return { data: {}, locale };
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.PLUGIN_ID = PLUGIN_ID;
|
|
122
|
+
exports.closeDialog = closeDialog;
|
|
123
|
+
exports.index = index;
|
|
124
|
+
exports.openDialog = openDialog;
|
|
125
|
+
exports.pluginPermissions = pluginPermissions;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DialogCommonProps {
|
|
3
|
+
id: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
cancelText?: string;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
onCancelAction: () => void;
|
|
9
|
+
onConfirmAction: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const DialogCommon: ({ id, title, children, cancelText, confirmText, onCancelAction, onConfirmAction, }: DialogCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { DialogCommon };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FormikHelpers } from "formik";
|
|
2
|
+
import type { Data } from '@strapi/strapi';
|
|
3
|
+
export interface FormValues {
|
|
4
|
+
titulo: string;
|
|
5
|
+
autor: string;
|
|
6
|
+
categoria: string;
|
|
7
|
+
keywords: string;
|
|
8
|
+
instrucciones: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Form: ({ onSubmit, categorias, users }: {
|
|
11
|
+
categorias: Data.ContentType<"api::categoria.categoria">[];
|
|
12
|
+
users: Data.ContentType<"plugin::users-permissions.user">[];
|
|
13
|
+
onSubmit: (values: FormValues, { setSubmitting }: FormikHelpers<FormValues>) => Promise<void>;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Form };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Data } from '@strapi/strapi';
|
|
2
|
+
import type { MutableRefObject } from "react";
|
|
3
|
+
type Article = Data.ContentType<"api::articulo.articulo">;
|
|
4
|
+
interface PublishingTableProps {
|
|
5
|
+
posts: Article[];
|
|
6
|
+
loadingImage: boolean;
|
|
7
|
+
loadingPublishLinkedIn: boolean;
|
|
8
|
+
currentPost: MutableRefObject<string>;
|
|
9
|
+
onClickAction: (postId: string, modalId: string) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const PublishingTable: import("react").MemoExoticComponent<({ posts, currentPost, loadingImage, loadingPublishLinkedIn, onClickAction, }: PublishingTableProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DialogCommonProps {
|
|
3
|
+
id: string;
|
|
4
|
+
title?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
cancelText?: string;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
onCancelAction: () => void;
|
|
9
|
+
onConfirmAction: () => void;
|
|
10
|
+
}
|
|
11
|
+
declare const DialogCommon: ({ id, title, children, cancelText, confirmText, onCancelAction, onConfirmAction, }: DialogCommonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { DialogCommon };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FormikHelpers } from 'formik';
|
|
2
|
+
import type { FormValues } from "../../containers/settings";
|
|
3
|
+
interface FormProps {
|
|
4
|
+
settings: FormValues;
|
|
5
|
+
handleSubmit: (values: FormValues, formikHelpers: FormikHelpers<FormValues>) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const Form: ({ settings, handleSubmit }: FormProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export { Form };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FetchOptions } from '@strapi/strapi/admin';
|
|
2
|
+
declare const useArticles: () => {
|
|
3
|
+
getArticles: (config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData = any>(url: string, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData>>)>>;
|
|
4
|
+
};
|
|
5
|
+
export { useArticles };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FetchOptions } from '@strapi/strapi/admin';
|
|
2
|
+
declare const useCategories: () => {
|
|
3
|
+
getCategories: (config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData = any>(url: string, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData>>)>>;
|
|
4
|
+
};
|
|
5
|
+
export { useCategories };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FetchOptions } from '@strapi/strapi/admin';
|
|
2
|
+
declare const useGenerateContent: () => {
|
|
3
|
+
generateContent: (data: any, config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData = any, TSend = any>(url: string, data?: TSend | undefined, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData>>)>>;
|
|
4
|
+
generateImage: (data: any, config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData = any, TSend = any>(url: string, data?: TSend | undefined, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData>>)>>;
|
|
5
|
+
};
|
|
6
|
+
export { useGenerateContent };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FetchOptions } from '@strapi/strapi/admin';
|
|
2
|
+
declare const usePublishLinkedIn: () => {
|
|
3
|
+
publishToLinkedIn: (data: any, config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData = any, TSend = any>(url: string, data?: TSend | undefined, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData>>)>>;
|
|
4
|
+
};
|
|
5
|
+
export { usePublishLinkedIn };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FetchOptions } from '@strapi/strapi/admin';
|
|
2
|
+
declare const useSettings: () => {
|
|
3
|
+
getSettings: (config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData = any>(url: string, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData>>)>>;
|
|
4
|
+
setSettings: (data: any, config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData_1 = any, TSend = any>(url: string, data?: TSend | undefined, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData_1>>)>>;
|
|
5
|
+
};
|
|
6
|
+
export { useSettings };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FetchOptions } from '@strapi/strapi/admin';
|
|
2
|
+
declare const useUsers: () => {
|
|
3
|
+
getUsers: (config?: FetchOptions) => Promise<import("@strapi/strapi/admin").FetchResponse<(<TData = any>(url: string, config?: FetchOptions | undefined) => Promise<import("@strapi/strapi/admin").FetchResponse<TData>>)>>;
|
|
4
|
+
};
|
|
5
|
+
export { useUsers };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PLUGIN_ID = "strapi-content-generator-gemini";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface DialogState {
|
|
2
|
+
open: Record<string, boolean>;
|
|
3
|
+
}
|
|
4
|
+
export declare const openDialog: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "sci_commonDialog/openDialog">, closeDialog: import("@reduxjs/toolkit").ActionCreatorWithPayload<string, "sci_commonDialog/closeDialog">;
|
|
5
|
+
declare const _default: import("redux").Reducer<DialogState>;
|
|
6
|
+
export default _default;
|