yt-transcript-strapi-plugin 0.0.13 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,35 @@
1
- # yt-transcript
1
+ # YT TRANSCRIPT STRAPI PLUGIN
2
2
 
3
- Get YT Video Transcript
4
- # yt-transcript
3
+ Here is a basic strapi plugin that allows you to get the transcript of a youtube video and save it to the database.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install yt-transcript-strapi-plugin
9
+ ```
10
+
11
+ ## Update Configuration
12
+
13
+ In your Strapi project directory, go to the `config/plugins.ts` file and add the following:
14
+
15
+ ```ts
16
+ export default () => ({
17
+ "yt-transcript-strapi-plugin": {
18
+ enabled: true,
19
+ resolve: "./src/plugins/yt-transcript-strapi-plugin",
20
+ config: {
21
+ openAIApiKey: process.env.OPENAI_API_KEY,
22
+ model: "gpt-4o-mini",
23
+ temp: 0.7,
24
+ maxTokens: 1000,
25
+ },
26
+ },
27
+ });
28
+
29
+ ```
30
+
31
+ You will need to add the `OPENAI_API_KEY` to your `.env` file and provide the other parameters as needed.
32
+
33
+ - model: can be any model that is supported by OpenAI
34
+ - temp: temperature of the model
35
+ - maxTokens: max tokens for the model
@@ -1,4 +1,58 @@
1
1
  "use strict";
2
- const index = require("../_chunks/index-CpWYZFmv.js");
3
- module.exports = index.index;
2
+ const react = require("react");
3
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
4
+ const v = glob[path];
5
+ if (v) {
6
+ return typeof v === "function" ? v() : Promise.resolve(v);
7
+ }
8
+ return new Promise((_, reject) => {
9
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
10
+ reject.bind(
11
+ null,
12
+ new Error(
13
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
14
+ )
15
+ )
16
+ );
17
+ });
18
+ };
19
+ const PLUGIN_ID = "yt-transcript-strapi-plugin";
20
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
21
+ const Initializer = ({ setPlugin }) => {
22
+ const ref = react.useRef(setPlugin);
23
+ react.useEffect(() => {
24
+ ref.current(PLUGIN_ID);
25
+ }, []);
26
+ return null;
27
+ };
28
+ const index = {
29
+ register(app) {
30
+ app.registerPlugin({
31
+ id: PLUGIN_ID,
32
+ initializer: Initializer,
33
+ isReady: false,
34
+ name: PLUGIN_ID
35
+ });
36
+ },
37
+ async registerTrads(app) {
38
+ const { locales } = app;
39
+ const importedTranslations = await Promise.all(
40
+ locales.map((locale) => {
41
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("../_chunks/en-B4KWt_jN.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
42
+ return {
43
+ data: getTranslation(data),
44
+ locale
45
+ };
46
+ }).catch(() => {
47
+ return {
48
+ data: {},
49
+ locale
50
+ };
51
+ });
52
+ })
53
+ );
54
+ return importedTranslations;
55
+ }
56
+ };
57
+ module.exports = index;
4
58
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.js","sources":["../../admin/src/pluginId.ts","../../admin/src/utils/getTranslation.ts","../../admin/src/components/Initializer.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'yt-transcript-strapi-plugin';\n","import { PLUGIN_ID } from '../pluginId';\n\nconst getTranslation = (id: string) => `${PLUGIN_ID}.${id}`;\n\nexport { getTranslation };\n","import { useEffect, useRef } from 'react';\n\nimport { PLUGIN_ID } from '../pluginId';\n\ntype InitializerProps = {\n setPlugin: (id: string) => void;\n};\n\nconst Initializer = ({ setPlugin }: InitializerProps) => {\n const ref = useRef(setPlugin);\n\n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n\n return null;\n};\n\nexport { Initializer };\n","import { getTranslation } from './utils/getTranslation';\nimport { PLUGIN_ID } from './pluginId';\nimport { Initializer } from './components/Initializer';\n// import { PluginIcon } from './components/PluginIcon';\n\nexport default {\n register(app: any) {\n // app.addMenuLink({\n // to: `plugins/${PLUGIN_ID}`,\n // icon: PluginIcon,\n // intlLabel: {\n // id: `${PLUGIN_ID}.plugin.name`,\n // defaultMessage: PLUGIN_ID,\n // },\n // Component: async () => {\n // const { App } = await import('./pages/App');\n\n // return App;\n // },\n // });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n\n async registerTrads(app: any) {\n const { locales } = app;\n\n const importedTranslations = await Promise.all(\n (locales as string[]).map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: getTranslation(data),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return importedTranslations;\n },\n};\n"],"names":["useRef","useEffect"],"mappings":";;;;;;;;;;;;;;;;;;AAAO,MAAM,YAAY;ACEzB,MAAM,iBAAiB,CAAC,OAAe,GAAG,SAAS,IAAI,EAAE;ACMzD,MAAM,cAAc,CAAC,EAAE,gBAAkC;AACjD,QAAA,MAAMA,aAAO,SAAS;AAE5BC,QAAAA,UAAU,MAAM;AACd,QAAI,QAAQ,SAAS;AAAA,EACvB,GAAG,EAAE;AAEE,SAAA;AACT;ACXA,MAAe,QAAA;AAAA,EACb,SAAS,KAAU;AAejB,QAAI,eAAe;AAAA,MACjB,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,IAAA,CACP;AAAA,EACH;AAAA,EAEA,MAAM,cAAc,KAAU;AACtB,UAAA,EAAE,YAAY;AAEd,UAAA,uBAAuB,MAAM,QAAQ;AAAA,MACxC,QAAqB,IAAI,CAAC,WAAW;AAC7B,eAAA,qCAA+B,uBAAA,OAAA,EAAA,0BAAA,MAAA,QAAA,QAAA,EAAA,KAAA,MAAA,QAAA,2BAAA,CAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,eAAe,IAAI;AAAA,YACzB;AAAA,UACF;AAAA,QAAA,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UACF;AAAA,QAAA,CACD;AAAA,MACJ,CAAA;AAAA,IACH;AAEO,WAAA;AAAA,EAAA;AAEX;;"}
@@ -1,5 +1,59 @@
1
- import { i } from "../_chunks/index-Cf76FLRe.mjs";
1
+ import { useRef, useEffect } from "react";
2
+ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
3
+ const v = glob[path];
4
+ if (v) {
5
+ return typeof v === "function" ? v() : Promise.resolve(v);
6
+ }
7
+ return new Promise((_, reject) => {
8
+ (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
9
+ reject.bind(
10
+ null,
11
+ new Error(
12
+ "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
13
+ )
14
+ )
15
+ );
16
+ });
17
+ };
18
+ const PLUGIN_ID = "yt-transcript-strapi-plugin";
19
+ const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
20
+ const Initializer = ({ setPlugin }) => {
21
+ const ref = useRef(setPlugin);
22
+ useEffect(() => {
23
+ ref.current(PLUGIN_ID);
24
+ }, []);
25
+ return null;
26
+ };
27
+ const index = {
28
+ register(app) {
29
+ app.registerPlugin({
30
+ id: PLUGIN_ID,
31
+ initializer: Initializer,
32
+ isReady: false,
33
+ name: PLUGIN_ID
34
+ });
35
+ },
36
+ async registerTrads(app) {
37
+ const { locales } = app;
38
+ const importedTranslations = await Promise.all(
39
+ locales.map((locale) => {
40
+ return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("../_chunks/en-Byx4XI2L.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
41
+ return {
42
+ data: getTranslation(data),
43
+ locale
44
+ };
45
+ }).catch(() => {
46
+ return {
47
+ data: {},
48
+ locale
49
+ };
50
+ });
51
+ })
52
+ );
53
+ return importedTranslations;
54
+ }
55
+ };
2
56
  export {
3
- i as default
57
+ index as default
4
58
  };
5
59
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/utils/getTranslation.ts","../../admin/src/components/Initializer.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'yt-transcript-strapi-plugin';\n","import { PLUGIN_ID } from '../pluginId';\n\nconst getTranslation = (id: string) => `${PLUGIN_ID}.${id}`;\n\nexport { getTranslation };\n","import { useEffect, useRef } from 'react';\n\nimport { PLUGIN_ID } from '../pluginId';\n\ntype InitializerProps = {\n setPlugin: (id: string) => void;\n};\n\nconst Initializer = ({ setPlugin }: InitializerProps) => {\n const ref = useRef(setPlugin);\n\n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n\n return null;\n};\n\nexport { Initializer };\n","import { getTranslation } from './utils/getTranslation';\nimport { PLUGIN_ID } from './pluginId';\nimport { Initializer } from './components/Initializer';\n// import { PluginIcon } from './components/PluginIcon';\n\nexport default {\n register(app: any) {\n // app.addMenuLink({\n // to: `plugins/${PLUGIN_ID}`,\n // icon: PluginIcon,\n // intlLabel: {\n // id: `${PLUGIN_ID}.plugin.name`,\n // defaultMessage: PLUGIN_ID,\n // },\n // Component: async () => {\n // const { App } = await import('./pages/App');\n\n // return App;\n // },\n // });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n\n async registerTrads(app: any) {\n const { locales } = app;\n\n const importedTranslations = await Promise.all(\n (locales as string[]).map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: getTranslation(data),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return importedTranslations;\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAO,MAAM,YAAY;ACEzB,MAAM,iBAAiB,CAAC,OAAe,GAAG,SAAS,IAAI,EAAE;ACMzD,MAAM,cAAc,CAAC,EAAE,gBAAkC;AACjD,QAAA,MAAM,OAAO,SAAS;AAE5B,YAAU,MAAM;AACd,QAAI,QAAQ,SAAS;AAAA,EACvB,GAAG,EAAE;AAEE,SAAA;AACT;ACXA,MAAe,QAAA;AAAA,EACb,SAAS,KAAU;AAejB,QAAI,eAAe;AAAA,MACjB,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,IAAA,CACP;AAAA,EACH;AAAA,EAEA,MAAM,cAAc,KAAU;AACtB,UAAA,EAAE,YAAY;AAEd,UAAA,uBAAuB,MAAM,QAAQ;AAAA,MACxC,QAAqB,IAAI,CAAC,WAAW;AAC7B,eAAA,qCAA+B,uBAAA,OAAA,EAAA,0BAAA,MAAA,OAAA,4BAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,eAAe,IAAI;AAAA,YACzB;AAAA,UACF;AAAA,QAAA,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UACF;AAAA,QAAA,CACD;AAAA,MACJ,CAAA;AAAA,IACH;AAEO,WAAA;AAAA,EAAA;AAEX;"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.13",
2
+ "version": "0.0.14",
3
3
  "keywords": [
4
4
  "yt-transcript-strapi-plugin",
5
5
  "youtube",
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const admin = require("@strapi/strapi/admin");
5
- const reactRouterDom = require("react-router-dom");
6
- const designSystem = require("@strapi/design-system");
7
- const reactIntl = require("react-intl");
8
- const index = require("./index-CpWYZFmv.js");
9
- const HomePage = () => {
10
- const { formatMessage } = reactIntl.useIntl();
11
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs("h1", { children: [
12
- "Welcome to ",
13
- formatMessage({ id: index.getTranslation("plugin.name") })
14
- ] }) });
15
- };
16
- const App = () => {
17
- return /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
18
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
19
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
20
- ] });
21
- };
22
- exports.App = App;
23
- //# sourceMappingURL=App-DKY3upWd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"App-DKY3upWd.js","sources":["../../admin/src/pages/HomePage.tsx","../../admin/src/pages/App.tsx"],"sourcesContent":["import { Main } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nconst HomePage = () => {\n const { formatMessage } = useIntl();\n\n return (\n <Main>\n <h1>Welcome to {formatMessage({ id: getTranslation('plugin.name') })}</h1>\n </Main>\n );\n};\n\nexport { HomePage };\n","import { Page } from '@strapi/strapi/admin';\nimport { Routes, Route } from 'react-router-dom';\n\nimport { HomePage } from './HomePage';\n\nconst App = () => {\n return (\n <Routes>\n <Route index element={<HomePage />} />\n <Route path=\"*\" element={<Page.Error />} />\n </Routes>\n );\n};\n\nexport { App };\n"],"names":["useIntl","jsx","Main","jsxs","getTranslation","Routes","Route","Page"],"mappings":";;;;;;;;AAKA,MAAM,WAAW,MAAM;AACf,QAAA,EAAE,cAAc,IAAIA,kBAAQ;AAGhC,SAAAC,2BAAAA,IAACC,aAAAA,MACC,EAAA,UAAAC,2BAAAA,KAAC,MAAG,EAAA,UAAA;AAAA,IAAA;AAAA,IAAY,cAAc,EAAE,IAAIC,MAAe,eAAA,aAAa,EAAG,CAAA;AAAA,EAAA,EAAA,CAAE,EACvE,CAAA;AAEJ;ACRA,MAAM,MAAM,MAAM;AAChB,yCACGC,uBACC,EAAA,UAAA;AAAA,IAAAJ,+BAACK,eAAAA,SAAM,OAAK,MAAC,SAASL,+BAAC,WAAS,CAAA,GAAI;AAAA,IACpCA,+BAACK,eAAAA,SAAM,MAAK,KAAI,SAAUL,2BAAAA,IAAAM,MAAA,KAAK,OAAL,CAAA,CAAW,EAAI,CAAA;AAAA,EAAA,GAC3C;AAEJ;;"}
@@ -1,23 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Page } from "@strapi/strapi/admin";
3
- import { Routes, Route } from "react-router-dom";
4
- import { Main } from "@strapi/design-system";
5
- import { useIntl } from "react-intl";
6
- import { g as getTranslation } from "./index-Cf76FLRe.mjs";
7
- const HomePage = () => {
8
- const { formatMessage } = useIntl();
9
- return /* @__PURE__ */ jsx(Main, { children: /* @__PURE__ */ jsxs("h1", { children: [
10
- "Welcome to ",
11
- formatMessage({ id: getTranslation("plugin.name") })
12
- ] }) });
13
- };
14
- const App = () => {
15
- return /* @__PURE__ */ jsxs(Routes, { children: [
16
- /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
17
- /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(Page.Error, {}) })
18
- ] });
19
- };
20
- export {
21
- App
22
- };
23
- //# sourceMappingURL=App-DXPFDMBH.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"App-DXPFDMBH.mjs","sources":["../../admin/src/pages/HomePage.tsx","../../admin/src/pages/App.tsx"],"sourcesContent":["import { Main } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nconst HomePage = () => {\n const { formatMessage } = useIntl();\n\n return (\n <Main>\n <h1>Welcome to {formatMessage({ id: getTranslation('plugin.name') })}</h1>\n </Main>\n );\n};\n\nexport { HomePage };\n","import { Page } from '@strapi/strapi/admin';\nimport { Routes, Route } from 'react-router-dom';\n\nimport { HomePage } from './HomePage';\n\nconst App = () => {\n return (\n <Routes>\n <Route index element={<HomePage />} />\n <Route path=\"*\" element={<Page.Error />} />\n </Routes>\n );\n};\n\nexport { App };\n"],"names":[],"mappings":";;;;;;AAKA,MAAM,WAAW,MAAM;AACf,QAAA,EAAE,cAAc,IAAI,QAAQ;AAGhC,SAAA,oBAAC,MACC,EAAA,UAAA,qBAAC,MAAG,EAAA,UAAA;AAAA,IAAA;AAAA,IAAY,cAAc,EAAE,IAAI,eAAe,aAAa,EAAG,CAAA;AAAA,EAAA,EAAA,CAAE,EACvE,CAAA;AAEJ;ACRA,MAAM,MAAM,MAAM;AAChB,8BACG,QACC,EAAA,UAAA;AAAA,IAAA,oBAAC,SAAM,OAAK,MAAC,SAAS,oBAAC,WAAS,CAAA,GAAI;AAAA,IACpC,oBAAC,SAAM,MAAK,KAAI,SAAU,oBAAA,KAAK,OAAL,CAAA,CAAW,EAAI,CAAA;AAAA,EAAA,GAC3C;AAEJ;"}
@@ -1,75 +0,0 @@
1
- import { useRef, useEffect } from "react";
2
- import { jsx } from "react/jsx-runtime";
3
- import { PuzzlePiece } from "@strapi/icons";
4
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
5
- const v = glob[path];
6
- if (v) {
7
- return typeof v === "function" ? v() : Promise.resolve(v);
8
- }
9
- return new Promise((_, reject) => {
10
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
11
- reject.bind(
12
- null,
13
- new Error(
14
- "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
15
- )
16
- )
17
- );
18
- });
19
- };
20
- const PLUGIN_ID = "yt-transcript-strapi-plugin";
21
- const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
22
- const Initializer = ({ setPlugin }) => {
23
- const ref = useRef(setPlugin);
24
- useEffect(() => {
25
- ref.current(PLUGIN_ID);
26
- }, []);
27
- return null;
28
- };
29
- const PluginIcon = () => /* @__PURE__ */ jsx(PuzzlePiece, {});
30
- const index = {
31
- register(app) {
32
- app.addMenuLink({
33
- to: `plugins/${PLUGIN_ID}`,
34
- icon: PluginIcon,
35
- intlLabel: {
36
- id: `${PLUGIN_ID}.plugin.name`,
37
- defaultMessage: PLUGIN_ID
38
- },
39
- Component: async () => {
40
- const { App } = await import("./App-DXPFDMBH.mjs");
41
- return App;
42
- }
43
- });
44
- app.registerPlugin({
45
- id: PLUGIN_ID,
46
- initializer: Initializer,
47
- isReady: false,
48
- name: PLUGIN_ID
49
- });
50
- },
51
- async registerTrads(app) {
52
- const { locales } = app;
53
- const importedTranslations = await Promise.all(
54
- locales.map((locale) => {
55
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Byx4XI2L.mjs") }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
56
- return {
57
- data: getTranslation(data),
58
- locale
59
- };
60
- }).catch(() => {
61
- return {
62
- data: {},
63
- locale
64
- };
65
- });
66
- })
67
- );
68
- return importedTranslations;
69
- }
70
- };
71
- export {
72
- getTranslation as g,
73
- index as i
74
- };
75
- //# sourceMappingURL=index-Cf76FLRe.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-Cf76FLRe.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/utils/getTranslation.ts","../../admin/src/components/Initializer.tsx","../../admin/src/components/PluginIcon.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'yt-transcript-strapi-plugin';\n","import { PLUGIN_ID } from '../pluginId';\n\nconst getTranslation = (id: string) => `${PLUGIN_ID}.${id}`;\n\nexport { getTranslation };\n","import { useEffect, useRef } from 'react';\n\nimport { PLUGIN_ID } from '../pluginId';\n\ntype InitializerProps = {\n setPlugin: (id: string) => void;\n};\n\nconst Initializer = ({ setPlugin }: InitializerProps) => {\n const ref = useRef(setPlugin);\n\n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n\n return null;\n};\n\nexport { Initializer };\n","import { PuzzlePiece } from '@strapi/icons';\n\nconst PluginIcon = () => <PuzzlePiece />;\n\nexport { PluginIcon };\n","import { getTranslation } from './utils/getTranslation';\nimport { PLUGIN_ID } from './pluginId';\nimport { Initializer } from './components/Initializer';\nimport { PluginIcon } from './components/PluginIcon';\n\nexport default {\n register(app: any) {\n app.addMenuLink({\n to: `plugins/${PLUGIN_ID}`,\n icon: PluginIcon,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import('./pages/App');\n\n return App;\n },\n });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n\n async registerTrads(app: any) {\n const { locales } = app;\n\n const importedTranslations = await Promise.all(\n (locales as string[]).map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: getTranslation(data),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return importedTranslations;\n },\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAO,MAAM,YAAY;ACEzB,MAAM,iBAAiB,CAAC,OAAe,GAAG,SAAS,IAAI,EAAE;ACMzD,MAAM,cAAc,CAAC,EAAE,gBAAkC;AACjD,QAAA,MAAM,OAAO,SAAS;AAE5B,YAAU,MAAM;AACd,QAAI,QAAQ,SAAS;AAAA,EACvB,GAAG,EAAE;AAEE,SAAA;AACT;ACdA,MAAM,aAAa,MAAM,oBAAC,aAAY,EAAA;ACGtC,MAAe,QAAA;AAAA,EACb,SAAS,KAAU;AACjB,QAAI,YAAY;AAAA,MACd,IAAI,WAAW,SAAS;AAAA,MACxB,MAAM;AAAA,MACN,WAAW;AAAA,QACT,IAAI,GAAG,SAAS;AAAA,QAChB,gBAAgB;AAAA,MAClB;AAAA,MACA,WAAW,YAAY;AACrB,cAAM,EAAE,IAAA,IAAQ,MAAM,OAAO,oBAAa;AAEnC,eAAA;AAAA,MAAA;AAAA,IACT,CACD;AAED,QAAI,eAAe;AAAA,MACjB,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,IAAA,CACP;AAAA,EACH;AAAA,EAEA,MAAM,cAAc,KAAU;AACtB,UAAA,EAAE,YAAY;AAEd,UAAA,uBAAuB,MAAM,QAAQ;AAAA,MACxC,QAAqB,IAAI,CAAC,WAAW;AAC7B,eAAA,qCAA+B,uBAAA,OAAA,EAAA,0BAAA,MAAA,OAAA,mBAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,eAAe,IAAI;AAAA,YACzB;AAAA,UACF;AAAA,QAAA,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UACF;AAAA,QAAA,CACD;AAAA,MACJ,CAAA;AAAA,IACH;AAEO,WAAA;AAAA,EAAA;AAEX;"}
@@ -1,74 +0,0 @@
1
- "use strict";
2
- const react = require("react");
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const icons = require("@strapi/icons");
5
- const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
6
- const v = glob[path];
7
- if (v) {
8
- return typeof v === "function" ? v() : Promise.resolve(v);
9
- }
10
- return new Promise((_, reject) => {
11
- (typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
12
- reject.bind(
13
- null,
14
- new Error(
15
- "Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
16
- )
17
- )
18
- );
19
- });
20
- };
21
- const PLUGIN_ID = "yt-transcript-strapi-plugin";
22
- const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
23
- const Initializer = ({ setPlugin }) => {
24
- const ref = react.useRef(setPlugin);
25
- react.useEffect(() => {
26
- ref.current(PLUGIN_ID);
27
- }, []);
28
- return null;
29
- };
30
- const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx(icons.PuzzlePiece, {});
31
- const index = {
32
- register(app) {
33
- app.addMenuLink({
34
- to: `plugins/${PLUGIN_ID}`,
35
- icon: PluginIcon,
36
- intlLabel: {
37
- id: `${PLUGIN_ID}.plugin.name`,
38
- defaultMessage: PLUGIN_ID
39
- },
40
- Component: async () => {
41
- const { App } = await Promise.resolve().then(() => require("./App-DKY3upWd.js"));
42
- return App;
43
- }
44
- });
45
- app.registerPlugin({
46
- id: PLUGIN_ID,
47
- initializer: Initializer,
48
- isReady: false,
49
- name: PLUGIN_ID
50
- });
51
- },
52
- async registerTrads(app) {
53
- const { locales } = app;
54
- const importedTranslations = await Promise.all(
55
- locales.map((locale) => {
56
- return __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => Promise.resolve().then(() => require("./en-B4KWt_jN.js")) }), `./translations/${locale}.json`, 3).then(({ default: data }) => {
57
- return {
58
- data: getTranslation(data),
59
- locale
60
- };
61
- }).catch(() => {
62
- return {
63
- data: {},
64
- locale
65
- };
66
- });
67
- })
68
- );
69
- return importedTranslations;
70
- }
71
- };
72
- exports.getTranslation = getTranslation;
73
- exports.index = index;
74
- //# sourceMappingURL=index-CpWYZFmv.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-CpWYZFmv.js","sources":["../../admin/src/pluginId.ts","../../admin/src/utils/getTranslation.ts","../../admin/src/components/Initializer.tsx","../../admin/src/components/PluginIcon.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'yt-transcript-strapi-plugin';\n","import { PLUGIN_ID } from '../pluginId';\n\nconst getTranslation = (id: string) => `${PLUGIN_ID}.${id}`;\n\nexport { getTranslation };\n","import { useEffect, useRef } from 'react';\n\nimport { PLUGIN_ID } from '../pluginId';\n\ntype InitializerProps = {\n setPlugin: (id: string) => void;\n};\n\nconst Initializer = ({ setPlugin }: InitializerProps) => {\n const ref = useRef(setPlugin);\n\n useEffect(() => {\n ref.current(PLUGIN_ID);\n }, []);\n\n return null;\n};\n\nexport { Initializer };\n","import { PuzzlePiece } from '@strapi/icons';\n\nconst PluginIcon = () => <PuzzlePiece />;\n\nexport { PluginIcon };\n","import { getTranslation } from './utils/getTranslation';\nimport { PLUGIN_ID } from './pluginId';\nimport { Initializer } from './components/Initializer';\nimport { PluginIcon } from './components/PluginIcon';\n\nexport default {\n register(app: any) {\n app.addMenuLink({\n to: `plugins/${PLUGIN_ID}`,\n icon: PluginIcon,\n intlLabel: {\n id: `${PLUGIN_ID}.plugin.name`,\n defaultMessage: PLUGIN_ID,\n },\n Component: async () => {\n const { App } = await import('./pages/App');\n\n return App;\n },\n });\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n },\n\n async registerTrads(app: any) {\n const { locales } = app;\n\n const importedTranslations = await Promise.all(\n (locales as string[]).map((locale) => {\n return import(`./translations/${locale}.json`)\n .then(({ default: data }) => {\n return {\n data: getTranslation(data),\n locale,\n };\n })\n .catch(() => {\n return {\n data: {},\n locale,\n };\n });\n })\n );\n\n return importedTranslations;\n },\n};\n"],"names":["useRef","useEffect","jsx","PuzzlePiece"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAO,MAAM,YAAY;ACEzB,MAAM,iBAAiB,CAAC,OAAe,GAAG,SAAS,IAAI,EAAE;ACMzD,MAAM,cAAc,CAAC,EAAE,gBAAkC;AACjD,QAAA,MAAMA,aAAO,SAAS;AAE5BC,QAAAA,UAAU,MAAM;AACd,QAAI,QAAQ,SAAS;AAAA,EACvB,GAAG,EAAE;AAEE,SAAA;AACT;ACdA,MAAM,aAAa,MAAMC,2BAAAA,IAACC,MAAY,aAAA,EAAA;ACGtC,MAAe,QAAA;AAAA,EACb,SAAS,KAAU;AACjB,QAAI,YAAY;AAAA,MACd,IAAI,WAAW,SAAS;AAAA,MACxB,MAAM;AAAA,MACN,WAAW;AAAA,QACT,IAAI,GAAG,SAAS;AAAA,QAChB,gBAAgB;AAAA,MAClB;AAAA,MACA,WAAW,YAAY;AACrB,cAAM,EAAE,IAAA,IAAQ,MAAM,QAAA,QAAA,EAAA,KAAA,MAAA,QAAO,mBAAa,CAAA;AAEnC,eAAA;AAAA,MAAA;AAAA,IACT,CACD;AAED,QAAI,eAAe;AAAA,MACjB,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,IAAA,CACP;AAAA,EACH;AAAA,EAEA,MAAM,cAAc,KAAU;AACtB,UAAA,EAAE,YAAY;AAEd,UAAA,uBAAuB,MAAM,QAAQ;AAAA,MACxC,QAAqB,IAAI,CAAC,WAAW;AAC7B,eAAA,qCAA+B,uBAAA,OAAA,EAAA,0BAAA,MAAA,QAAA,QAAA,EAAA,KAAA,MAAA,QAAA,kBAAA,CAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA,EACnC,KAAK,CAAC,EAAE,SAAS,WAAW;AACpB,iBAAA;AAAA,YACL,MAAM,eAAe,IAAI;AAAA,YACzB;AAAA,UACF;AAAA,QAAA,CACD,EACA,MAAM,MAAM;AACJ,iBAAA;AAAA,YACL,MAAM,CAAC;AAAA,YACP;AAAA,UACF;AAAA,QAAA,CACD;AAAA,MACJ,CAAA;AAAA,IACH;AAEO,WAAA;AAAA,EAAA;AAEX;;;"}