yt-transcript-strapi-plugin 0.0.13 → 0.0.15

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 (48) hide show
  1. package/README.md +34 -3
  2. package/package.json +21 -8
  3. package/dist/_chunks/App-DKY3upWd.js +0 -23
  4. package/dist/_chunks/App-DKY3upWd.js.map +0 -1
  5. package/dist/_chunks/App-DXPFDMBH.mjs +0 -23
  6. package/dist/_chunks/App-DXPFDMBH.mjs.map +0 -1
  7. package/dist/_chunks/en-B4KWt_jN.js +0 -5
  8. package/dist/_chunks/en-B4KWt_jN.js.map +0 -1
  9. package/dist/_chunks/en-Byx4XI2L.mjs +0 -5
  10. package/dist/_chunks/en-Byx4XI2L.mjs.map +0 -1
  11. package/dist/_chunks/index-Cf76FLRe.mjs +0 -75
  12. package/dist/_chunks/index-Cf76FLRe.mjs.map +0 -1
  13. package/dist/_chunks/index-CpWYZFmv.js +0 -74
  14. package/dist/_chunks/index-CpWYZFmv.js.map +0 -1
  15. package/dist/admin/index.js +0 -4
  16. package/dist/admin/index.js.map +0 -1
  17. package/dist/admin/index.mjs +0 -5
  18. package/dist/admin/index.mjs.map +0 -1
  19. package/dist/admin/src/components/Initializer.d.ts +0 -5
  20. package/dist/admin/src/components/PluginIcon.d.ts +0 -2
  21. package/dist/admin/src/index.d.ts +0 -11
  22. package/dist/admin/src/pages/App.d.ts +0 -2
  23. package/dist/admin/src/pages/HomePage.d.ts +0 -2
  24. package/dist/admin/src/pluginId.d.ts +0 -1
  25. package/dist/admin/src/utils/getTranslation.d.ts +0 -2
  26. package/dist/server/index.js +0 -294
  27. package/dist/server/index.js.map +0 -1
  28. package/dist/server/index.mjs +0 -273
  29. package/dist/server/index.mjs.map +0 -1
  30. package/dist/server/src/bootstrap.d.ts +0 -5
  31. package/dist/server/src/config/index.d.ts +0 -5
  32. package/dist/server/src/content-types/index.d.ts +0 -42
  33. package/dist/server/src/content-types/transcript/index.d.ts +0 -40
  34. package/dist/server/src/controllers/controller.d.ts +0 -13
  35. package/dist/server/src/controllers/index.d.ts +0 -14
  36. package/dist/server/src/destroy.d.ts +0 -5
  37. package/dist/server/src/index.d.ts +0 -109
  38. package/dist/server/src/middlewares/index.d.ts +0 -2
  39. package/dist/server/src/policies/index.d.ts +0 -2
  40. package/dist/server/src/register.d.ts +0 -5
  41. package/dist/server/src/routes/admin.d.ts +0 -9
  42. package/dist/server/src/routes/content-api.d.ts +0 -9
  43. package/dist/server/src/routes/index.d.ts +0 -25
  44. package/dist/server/src/services/index.d.ts +0 -14
  45. package/dist/server/src/services/service.d.ts +0 -14
  46. package/dist/server/src/utils/extract-youtube-id.d.ts +0 -1
  47. package/dist/server/src/utils/fetch-transcript.d.ts +0 -13
  48. package/dist/server/src/utils/openai.d.ts +0 -9
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
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.13",
2
+ "version": "0.0.15",
3
3
  "keywords": [
4
4
  "yt-transcript-strapi-plugin",
5
5
  "youtube",
@@ -45,16 +45,21 @@
45
45
  "@langchain/core": "^0.3.18",
46
46
  "@langchain/openai": "^0.3.14",
47
47
  "@langchain/textsplitters": "^0.1.0",
48
+ "@modelcontextprotocol/sdk": "^1.12.0",
48
49
  "@strapi/design-system": "^2.0.0-rc.12",
49
50
  "@strapi/icons": "^2.0.0-rc.12",
50
51
  "langchain": "^0.3.5",
51
52
  "react-intl": "^6.8.7",
52
- "youtubei.js": "^11.0.1"
53
+ "zod": "^3.23.0"
53
54
  },
55
+ "bundledDependencies": [
56
+ "@modelcontextprotocol/sdk",
57
+ "zod"
58
+ ],
54
59
  "devDependencies": {
55
- "@strapi/sdk-plugin": "^5.2.7",
56
- "@strapi/strapi": "^5.0.0-rc.30",
57
- "@strapi/typescript-utils": "^5.0.0-rc.30",
60
+ "@strapi/sdk-plugin": "^5.3.2",
61
+ "@strapi/strapi": "^5.33.0",
62
+ "@strapi/typescript-utils": "^5.33.0",
58
63
  "@types/react": "^18.3.12",
59
64
  "@types/react-dom": "^18.3.1",
60
65
  "prettier": "^3.3.3",
@@ -65,13 +70,17 @@
65
70
  "typescript": "^5.6.3"
66
71
  },
67
72
  "peerDependencies": {
68
- "@strapi/sdk-plugin": "^5.2.7",
69
- "@strapi/strapi": "^5.0.0-rc.30",
73
+ "@strapi/sdk-plugin": "^5.3.2",
74
+ "@strapi/strapi": "^5.33.0",
70
75
  "react": "^18.3.1",
71
76
  "react-dom": "^18.3.1",
72
77
  "react-router-dom": "^6.28.0",
73
78
  "styled-components": "^6.1.13"
74
79
  },
80
+ "engines": {
81
+ "node": ">=18.0.0 <=24.x.x",
82
+ "npm": ">=6.0.0"
83
+ },
75
84
  "strapi": {
76
85
  "kind": "plugin",
77
86
  "name": "yt-transcript-strapi-plugin",
@@ -84,5 +93,9 @@
84
93
  "author": "Paul Brats <codingafterthirty@gmail.com>",
85
94
  "publishConfig": {
86
95
  "access": "public"
87
- }
96
+ },
97
+ "bundleDependencies": [
98
+ "@modelcontextprotocol/sdk",
99
+ "zod"
100
+ ]
88
101
  }
@@ -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,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const en = {};
4
- exports.default = en;
5
- //# sourceMappingURL=en-B4KWt_jN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"en-B4KWt_jN.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,5 +0,0 @@
1
- const en = {};
2
- export {
3
- en as default
4
- };
5
- //# sourceMappingURL=en-Byx4XI2L.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"en-Byx4XI2L.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -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;;;"}
@@ -1,4 +0,0 @@
1
- "use strict";
2
- const index = require("../_chunks/index-CpWYZFmv.js");
3
- module.exports = index.index;
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,5 +0,0 @@
1
- import { i } from "../_chunks/index-Cf76FLRe.mjs";
2
- export {
3
- i as default
4
- };
5
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +0,0 @@
1
- type InitializerProps = {
2
- setPlugin: (id: string) => void;
3
- };
4
- declare const Initializer: ({ setPlugin }: InitializerProps) => null;
5
- export { Initializer };
@@ -1,2 +0,0 @@
1
- declare const PluginIcon: () => import("react/jsx-runtime").JSX.Element;
2
- export { PluginIcon };
@@ -1,11 +0,0 @@
1
- declare const _default: {
2
- register(app: any): void;
3
- registerTrads(app: any): Promise<({
4
- data: string;
5
- locale: string;
6
- } | {
7
- data: {};
8
- locale: string;
9
- })[]>;
10
- };
11
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const App: () => import("react/jsx-runtime").JSX.Element;
2
- export { App };
@@ -1,2 +0,0 @@
1
- declare const HomePage: () => import("react/jsx-runtime").JSX.Element;
2
- export { HomePage };
@@ -1 +0,0 @@
1
- export declare const PLUGIN_ID = "yt-transcript-strapi-plugin";
@@ -1,2 +0,0 @@
1
- declare const getTranslation: (id: string) => string;
2
- export { getTranslation };