octalens-mentions 0.0.9 → 0.0.10

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.
@@ -26,3 +26,4 @@ const App = () => {
26
26
  ] });
27
27
  };
28
28
  exports.App = App;
29
+ //# sourceMappingURL=App-B-QcAxW7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App-B-QcAxW7.js","sources":["../../admin/src/pages/HomePage.tsx","../../admin/src/pages/App.tsx"],"sourcesContent":["import { Main, Box, Typography } from '@strapi/design-system';\nimport { MentionsTable } from '../components/MentionsTable';\nimport { useMentions } from '../hooks/useMentions';\n\nconst HomePage = () => {\n const { mentions, loading, error } = useMentions();\n\n return (\n <Main>\n <Box padding={8}>\n <Typography variant=\"alpha\">\n Mentions\n </Typography>\n </Box>\n <Box paddingLeft={8} paddingRight={8}> \n {loading && <Typography>Loading mentions...</Typography>}\n {error && <Typography textColor=\"danger600\">Error: {error.message}</Typography>}\n {!loading && !error && <MentionsTable mentions={mentions} />}\n </Box>\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":["useMentions","Main","jsx","Box","Typography","jsxs","MentionsTable","Routes","Route","Page"],"mappings":";;;;;;;AAIA,MAAM,WAAW,MAAM;AACrB,QAAM,EAAE,UAAU,SAAS,MAAA,IAAUA,MAAAA,YAAA;AAErC,yCACGC,mBAAA,EACC,UAAA;AAAA,IAAAC,2BAAAA,IAACC,aAAAA,KAAA,EAAI,SAAS,GACZ,UAAAD,2BAAAA,IAACE,2BAAW,SAAQ,SAAQ,sBAE5B,EAAA,CACF;AAAA,IACAC,2BAAAA,KAACF,aAAAA,KAAA,EAAI,aAAa,GAAG,cAAc,GAChC,UAAA;AAAA,MAAA,WAAWD,2BAAAA,IAACE,aAAAA,cAAW,UAAA,sBAAA,CAAmB;AAAA,MAC1C,SAASC,2BAAAA,KAACD,aAAAA,YAAA,EAAW,WAAU,aAAY,UAAA;AAAA,QAAA;AAAA,QAAQ,MAAM;AAAA,MAAA,GAAQ;AAAA,MACjE,CAAC,WAAW,CAAC,SAASF,2BAAAA,IAACI,MAAAA,iBAAc,SAAA,CAAoB;AAAA,IAAA,EAAA,CAC5D;AAAA,EAAA,GACF;AAEJ;AChBA,MAAM,MAAM,MAAM;AAChB,yCACGC,uBAAA,EACC,UAAA;AAAA,IAAAL,+BAACM,eAAAA,SAAM,OAAK,MAAC,SAASN,+BAAC,YAAS,GAAI;AAAA,IACpCA,+BAACM,eAAAA,SAAM,MAAK,KAAI,SAASN,2BAAAA,IAACO,MAAAA,KAAK,OAAL,CAAA,CAAW,EAAA,CAAI;AAAA,EAAA,GAC3C;AAEJ;;"}
@@ -26,3 +26,4 @@ const App = () => {
26
26
  export {
27
27
  App
28
28
  };
29
+ //# sourceMappingURL=App-DjWYlFjn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App-DjWYlFjn.mjs","sources":["../../admin/src/pages/HomePage.tsx","../../admin/src/pages/App.tsx"],"sourcesContent":["import { Main, Box, Typography } from '@strapi/design-system';\nimport { MentionsTable } from '../components/MentionsTable';\nimport { useMentions } from '../hooks/useMentions';\n\nconst HomePage = () => {\n const { mentions, loading, error } = useMentions();\n\n return (\n <Main>\n <Box padding={8}>\n <Typography variant=\"alpha\">\n Mentions\n </Typography>\n </Box>\n <Box paddingLeft={8} paddingRight={8}> \n {loading && <Typography>Loading mentions...</Typography>}\n {error && <Typography textColor=\"danger600\">Error: {error.message}</Typography>}\n {!loading && !error && <MentionsTable mentions={mentions} />}\n </Box>\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":";;;;;AAIA,MAAM,WAAW,MAAM;AACrB,QAAM,EAAE,UAAU,SAAS,MAAA,IAAU,YAAA;AAErC,8BACG,MAAA,EACC,UAAA;AAAA,IAAA,oBAAC,KAAA,EAAI,SAAS,GACZ,UAAA,oBAAC,cAAW,SAAQ,SAAQ,sBAE5B,EAAA,CACF;AAAA,IACA,qBAAC,KAAA,EAAI,aAAa,GAAG,cAAc,GAChC,UAAA;AAAA,MAAA,WAAW,oBAAC,cAAW,UAAA,sBAAA,CAAmB;AAAA,MAC1C,SAAS,qBAAC,YAAA,EAAW,WAAU,aAAY,UAAA;AAAA,QAAA;AAAA,QAAQ,MAAM;AAAA,MAAA,GAAQ;AAAA,MACjE,CAAC,WAAW,CAAC,SAAS,oBAAC,iBAAc,SAAA,CAAoB;AAAA,IAAA,EAAA,CAC5D;AAAA,EAAA,GACF;AAEJ;AChBA,MAAM,MAAM,MAAM;AAChB,8BACG,QAAA,EACC,UAAA;AAAA,IAAA,oBAAC,SAAM,OAAK,MAAC,SAAS,oBAAC,YAAS,GAAI;AAAA,IACpC,oBAAC,SAAM,MAAK,KAAI,SAAS,oBAAC,KAAK,OAAL,CAAA,CAAW,EAAA,CAAI;AAAA,EAAA,GAC3C;AAEJ;"}
@@ -2,3 +2,4 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const en = {};
4
4
  exports.default = en;
5
+ //# sourceMappingURL=en-B4KWt_jN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-B4KWt_jN.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -2,3 +2,4 @@ const en = {};
2
2
  export {
3
3
  en as default
4
4
  };
5
+ //# sourceMappingURL=en-Byx4XI2L.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"en-Byx4XI2L.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -176,3 +176,4 @@ const index = {
176
176
  exports.MentionsTable = MentionsTable;
177
177
  exports.index = index;
178
178
  exports.useMentions = useMentions;
179
+ //# sourceMappingURL=index-QtHFaCQE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-QtHFaCQE.js","sources":["../../admin/src/pluginId.ts","../../admin/src/components/Initializer.tsx","../../admin/src/components/PluginIcon.tsx","../../admin/src/constants.ts","../../admin/src/hooks/useMentions.ts","../../admin/src/components/MentionsTable/index.tsx","../../admin/src/components/MentionsWidget/index.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'octalens-mentions';\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 { Globe } from '@strapi/icons';\n\nconst PluginIcon = () => <Globe />;\n\nexport { PluginIcon };\n","const BASE_PATH = '/octalens-mentions';\n\nexport const CONSTANTS = {\n routes: {\n MENTIONS_URL: BASE_PATH + '/mentions',\n },\n};\n","import { useEffect, useState } from 'react';\nimport { useFetchClient } from '@strapi/strapi/admin';\nimport type { IMention } from '../types';\nimport { CONSTANTS } from '../constants';\n\nexport function useMentions() {\n const { get } = useFetchClient();\n const [mentions, setMentions] = useState<IMention[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const fetchMentions = async () => {\n try {\n setLoading(true);\n setError(null);\n const { data } = await get(CONSTANTS.routes.MENTIONS_URL);\n const mentions = data?.data;\n setMentions(mentions || []);\n } catch (error) {\n console.error('Error fetching mentions:', error);\n setError(error instanceof Error ? error : new Error('Failed to fetch mentions'));\n } finally {\n setLoading(false);\n }\n };\n\n fetchMentions();\n }, [get]);\n\n return { mentions, loading, error };\n}\n","import {\n Table,\n Thead,\n Tbody,\n Tr,\n Td,\n Th,\n Typography,\n Checkbox,\n VisuallyHidden,\n Flex,\n Box,\n IconButton,\n} from '@strapi/design-system';\nimport { Pencil, Trash, Eye } from '@strapi/icons';\nimport type { IMention } from '../../types';\n\nconst COL_COUNT = 7;\n\ninterface MentionsTableProps {\n readonly mentions: IMention[];\n}\n\nexport function MentionsTable({ mentions }: MentionsTableProps) {\n return (\n <Table colCount={COL_COUNT} rowCount={mentions.length}>\n <Thead>\n <Tr>\n <Th>\n <Checkbox aria-label=\"Select all entries\" />\n </Th>\n <Th>\n <Typography variant=\"sigma\">Title</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Source</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Keyword</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Relevance Score</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Comment</Typography>\n </Th>\n <Th>\n <VisuallyHidden>Actions</VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n {mentions.map((mention) => (\n <Tr key={mention.documentId}>\n <Td>\n <Checkbox aria-label={`Select ${mention.title}`} />\n </Td>\n <Td>\n <Typography textColor=\"neutral800\" fontWeight=\"bold\">\n {mention.title || 'Untitled'}\n </Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{mention.source}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{mention.keyword}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{mention.relevanceScore}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\" ellipsis>\n {mention.relevanceComment?.substring(0, 50)}\n {mention.relevanceComment?.length > 50 ? '...' : ''}\n </Typography>\n </Td>\n <Td>\n <Flex>\n {mention.url && (\n <IconButton\n tag=\"a\"\n href={mention.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n label=\"View source\"\n borderWidth={0}\n >\n <Eye />\n </IconButton>\n )}\n <Box paddingLeft={1}>\n <IconButton\n onClick={() => console.log('edit', mention.documentId)}\n label=\"Edit\"\n borderWidth={0}\n >\n <Pencil />\n </IconButton>\n </Box>\n <Box paddingLeft={1}>\n <IconButton\n onClick={() => console.log('delete', mention.documentId)}\n label=\"Delete\"\n borderWidth={0}\n >\n <Trash />\n </IconButton>\n </Box>\n </Flex>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n}\n","import { Box, Typography } from '@strapi/design-system';\nimport { useMentions } from '../../hooks/useMentions';\nimport { MentionsTable } from '../MentionsTable';\n\nexport function MentionsWidget() {\n const { mentions, loading, error } = useMentions();\n\n if (loading) {\n return (\n <Box padding={4}>\n <Typography>Loading mentions...</Typography>\n </Box>\n );\n }\n\n if (error) {\n return (\n <Box padding={4}>\n <Typography textColor=\"danger600\">Error: {error.message}</Typography>\n </Box>\n );\n }\n\n return (\n <Box padding={4}>\n <MentionsTable mentions={mentions} />\n </Box>\n );\n}\n","import { Globe } from \"@strapi/icons\";\n\nimport { PLUGIN_ID } from './pluginId';\nimport { Initializer } from './components/Initializer';\nimport { PluginIcon } from './components/PluginIcon';\nimport { MentionsWidget } from \"./components/MentionsWidget\";\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.widgets.register({\n icon: Globe,\n title: {\n id: `${PLUGIN_ID}.mentions-widget.title`,\n defaultMessage: \"Social Mentions\"\n },\n component: () => Promise.resolve(MentionsWidget),\n pluginId: PLUGIN_ID,\n id: \"mentions-widget\"\n })\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n\n },\n\n async registerTrads({ locales }: { locales: string[] }) {\n return Promise.all(\n locales.map(async (locale) => {\n try {\n const { default: data } = await import(`./translations/${locale}.json`);\n\n return { data, locale };\n } catch {\n return { data: {}, locale };\n }\n })\n );\n },\n};\n"],"names":["useRef","useEffect","jsx","Globe","useFetchClient","useState","mentions","error","Table","Thead","Tr","Th","Checkbox","Typography","VisuallyHidden","Tbody","Td","jsxs","Flex","IconButton","Eye","Box","Pencil","Trash"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,YAAY;ACQzB,MAAM,cAAc,CAAC,EAAE,gBAAkC;AACvD,QAAM,MAAMA,MAAAA,OAAO,SAAS;AAE5BC,QAAAA,UAAU,MAAM;AACd,QAAI,QAAQ,SAAS;AAAA,EACvB,GAAG,CAAA,CAAE;AAEL,SAAO;AACT;ACdA,MAAM,aAAa,MAAMC,2BAAAA,IAACC,MAAAA,OAAA,EAAM;ACFhC,MAAM,YAAY;AAEX,MAAM,YAAY;AAAA,EACvB,QAAQ;AAAA,IACN,cAAc,YAAY;AAAA,EAAA;AAE9B;ACDO,SAAS,cAAc;AAC5B,QAAM,EAAE,IAAA,IAAQC,qBAAA;AAChB,QAAM,CAAC,UAAU,WAAW,IAAIC,MAAAA,SAAqB,CAAA,CAAE;AACvD,QAAM,CAAC,SAAS,UAAU,IAAIA,MAAAA,SAAS,IAAI;AAC3C,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAuB,IAAI;AAErDJ,QAAAA,UAAU,MAAM;AACd,UAAM,gBAAgB,YAAY;AAChC,UAAI;AACF,mBAAW,IAAI;AACf,iBAAS,IAAI;AACb,cAAM,EAAE,KAAA,IAAS,MAAM,IAAI,UAAU,OAAO,YAAY;AACxD,cAAMK,YAAW,MAAM;AACvB,oBAAYA,aAAY,EAAE;AAAA,MAC5B,SAASC,QAAO;AACd,gBAAQ,MAAM,4BAA4BA,MAAK;AAC/C,iBAASA,kBAAiB,QAAQA,SAAQ,IAAI,MAAM,0BAA0B,CAAC;AAAA,MACjF,UAAA;AACE,mB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;AAAA,MAElB,WAAW,YAAY;AACrB,cAAM,EAAE,IAAA,IAAQ,MAAM,QAAA,QAAA,EAAA,KAAA,MAAA,QAAO,mBAAa,CAAA;AAE1C,eAAO;AAAA,MACT;AAAA,IAAA,CACD;AAED,QAAI,QAAQ,SAAS;AAAA,MACnB,MAAMC,MAAAA;AAAAA,MACN,OAAO;AAAA,QACL,IAAI,GAAG,SAAS;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,MAElB,WAAW,MAAM,QAAQ,QAAQ,cAAc;AAAA,MAC/C,UAAU;AAAA,MACV,IAAI;AAAA,IAAA,CACL;AAED,QAAI,eAAe;AAAA,MACjB,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,IAAA,CACP;AAAA,EAEH;AAAA,EAEA,MAAM,cAAc,EAAE,WAAkC;AACtD,WAAO,QAAQ;AAAA,MACb,QAAQ,IAAI,OAAO,WAAW;AAC5B,YAAI;AACF,gBAAM,EAAE,SAAS,KAAA,IAAS,MAAM,qCAAA,uBAAA,OAAA,EAAA,0BAAA,MAAA,QAAA,QAAA,EAAA,KAAA,MAAA,QAAA,kBAAA,CAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA;AAEhC,iBAAO,EAAE,MAAM,OAAA;AAAA,QACjB,QAAQ;AACN,iBAAO,EAAE,MAAM,CAAA,GAAI,OAAA;AAAA,QACrB;AAAA,MACF,CAAC;AAAA,IAAA;AAAA,EAEL;AACF;;;;"}
@@ -177,3 +177,4 @@ export {
177
177
  index as i,
178
178
  useMentions as u
179
179
  };
180
+ //# sourceMappingURL=index-S3IY0oBe.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-S3IY0oBe.mjs","sources":["../../admin/src/pluginId.ts","../../admin/src/components/Initializer.tsx","../../admin/src/components/PluginIcon.tsx","../../admin/src/constants.ts","../../admin/src/hooks/useMentions.ts","../../admin/src/components/MentionsTable/index.tsx","../../admin/src/components/MentionsWidget/index.tsx","../../admin/src/index.ts"],"sourcesContent":["export const PLUGIN_ID = 'octalens-mentions';\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 { Globe } from '@strapi/icons';\n\nconst PluginIcon = () => <Globe />;\n\nexport { PluginIcon };\n","const BASE_PATH = '/octalens-mentions';\n\nexport const CONSTANTS = {\n routes: {\n MENTIONS_URL: BASE_PATH + '/mentions',\n },\n};\n","import { useEffect, useState } from 'react';\nimport { useFetchClient } from '@strapi/strapi/admin';\nimport type { IMention } from '../types';\nimport { CONSTANTS } from '../constants';\n\nexport function useMentions() {\n const { get } = useFetchClient();\n const [mentions, setMentions] = useState<IMention[]>([]);\n const [loading, setLoading] = useState(true);\n const [error, setError] = useState<Error | null>(null);\n\n useEffect(() => {\n const fetchMentions = async () => {\n try {\n setLoading(true);\n setError(null);\n const { data } = await get(CONSTANTS.routes.MENTIONS_URL);\n const mentions = data?.data;\n setMentions(mentions || []);\n } catch (error) {\n console.error('Error fetching mentions:', error);\n setError(error instanceof Error ? error : new Error('Failed to fetch mentions'));\n } finally {\n setLoading(false);\n }\n };\n\n fetchMentions();\n }, [get]);\n\n return { mentions, loading, error };\n}\n","import {\n Table,\n Thead,\n Tbody,\n Tr,\n Td,\n Th,\n Typography,\n Checkbox,\n VisuallyHidden,\n Flex,\n Box,\n IconButton,\n} from '@strapi/design-system';\nimport { Pencil, Trash, Eye } from '@strapi/icons';\nimport type { IMention } from '../../types';\n\nconst COL_COUNT = 7;\n\ninterface MentionsTableProps {\n readonly mentions: IMention[];\n}\n\nexport function MentionsTable({ mentions }: MentionsTableProps) {\n return (\n <Table colCount={COL_COUNT} rowCount={mentions.length}>\n <Thead>\n <Tr>\n <Th>\n <Checkbox aria-label=\"Select all entries\" />\n </Th>\n <Th>\n <Typography variant=\"sigma\">Title</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Source</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Keyword</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Relevance Score</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">Comment</Typography>\n </Th>\n <Th>\n <VisuallyHidden>Actions</VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n {mentions.map((mention) => (\n <Tr key={mention.documentId}>\n <Td>\n <Checkbox aria-label={`Select ${mention.title}`} />\n </Td>\n <Td>\n <Typography textColor=\"neutral800\" fontWeight=\"bold\">\n {mention.title || 'Untitled'}\n </Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{mention.source}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{mention.keyword}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{mention.relevanceScore}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral600\" ellipsis>\n {mention.relevanceComment?.substring(0, 50)}\n {mention.relevanceComment?.length > 50 ? '...' : ''}\n </Typography>\n </Td>\n <Td>\n <Flex>\n {mention.url && (\n <IconButton\n tag=\"a\"\n href={mention.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n label=\"View source\"\n borderWidth={0}\n >\n <Eye />\n </IconButton>\n )}\n <Box paddingLeft={1}>\n <IconButton\n onClick={() => console.log('edit', mention.documentId)}\n label=\"Edit\"\n borderWidth={0}\n >\n <Pencil />\n </IconButton>\n </Box>\n <Box paddingLeft={1}>\n <IconButton\n onClick={() => console.log('delete', mention.documentId)}\n label=\"Delete\"\n borderWidth={0}\n >\n <Trash />\n </IconButton>\n </Box>\n </Flex>\n </Td>\n </Tr>\n ))}\n </Tbody>\n </Table>\n );\n}\n","import { Box, Typography } from '@strapi/design-system';\nimport { useMentions } from '../../hooks/useMentions';\nimport { MentionsTable } from '../MentionsTable';\n\nexport function MentionsWidget() {\n const { mentions, loading, error } = useMentions();\n\n if (loading) {\n return (\n <Box padding={4}>\n <Typography>Loading mentions...</Typography>\n </Box>\n );\n }\n\n if (error) {\n return (\n <Box padding={4}>\n <Typography textColor=\"danger600\">Error: {error.message}</Typography>\n </Box>\n );\n }\n\n return (\n <Box padding={4}>\n <MentionsTable mentions={mentions} />\n </Box>\n );\n}\n","import { Globe } from \"@strapi/icons\";\n\nimport { PLUGIN_ID } from './pluginId';\nimport { Initializer } from './components/Initializer';\nimport { PluginIcon } from './components/PluginIcon';\nimport { MentionsWidget } from \"./components/MentionsWidget\";\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.widgets.register({\n icon: Globe,\n title: {\n id: `${PLUGIN_ID}.mentions-widget.title`,\n defaultMessage: \"Social Mentions\"\n },\n component: () => Promise.resolve(MentionsWidget),\n pluginId: PLUGIN_ID,\n id: \"mentions-widget\"\n })\n\n app.registerPlugin({\n id: PLUGIN_ID,\n initializer: Initializer,\n isReady: false,\n name: PLUGIN_ID,\n });\n\n },\n\n async registerTrads({ locales }: { locales: string[] }) {\n return Promise.all(\n locales.map(async (locale) => {\n try {\n const { default: data } = await import(`./translations/${locale}.json`);\n\n return { data, locale };\n } catch {\n return { data: {}, locale };\n }\n })\n );\n },\n};\n"],"names":["mentions","error"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAO,MAAM,YAAY;ACQzB,MAAM,cAAc,CAAC,EAAE,gBAAkC;AACvD,QAAM,MAAM,OAAO,SAAS;AAE5B,YAAU,MAAM;AACd,QAAI,QAAQ,SAAS;AAAA,EACvB,GAAG,CAAA,CAAE;AAEL,SAAO;AACT;ACdA,MAAM,aAAa,MAAM,oBA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AAM;AAAA,MACN,WAAW;AAAA,QACT,IAAI,GAAG,SAAS;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,MAElB,WAAW,YAAY;AACrB,cAAM,EAAE,IAAA,IAAQ,MAAM,OAAO,oBAAa;AAE1C,eAAO;AAAA,MACT;AAAA,IAAA,CACD;AAED,QAAI,QAAQ,SAAS;AAAA,MACnB,MAAM;AAAA,MACN,OAAO;AAAA,QACL,IAAI,GAAG,SAAS;AAAA,QAChB,gBAAgB;AAAA,MAAA;AAAA,MAElB,WAAW,MAAM,QAAQ,QAAQ,cAAc;AAAA,MAC/C,UAAU;AAAA,MACV,IAAI;AAAA,IAAA,CACL;AAED,QAAI,eAAe;AAAA,MACjB,IAAI;AAAA,MACJ,aAAa;AAAA,MACb,SAAS;AAAA,MACT,MAAM;AAAA,IAAA,CACP;AAAA,EAEH;AAAA,EAEA,MAAM,cAAc,EAAE,WAAkC;AACtD,WAAO,QAAQ;AAAA,MACb,QAAQ,IAAI,OAAO,WAAW;AAC5B,YAAI;AACF,gBAAM,EAAE,SAAS,KAAA,IAAS,MAAM,qCAAA,uBAAA,OAAA,EAAA,0BAAA,MAAA,OAAA,mBAAA,EAAA,CAAA,GAAA,kBAAA,MAAA,SAAA,CAAA;AAEhC,iBAAO,EAAE,MAAM,OAAA;AAAA,QACjB,QAAQ;AACN,iBAAO,EAAE,MAAM,CAAA,GAAI,OAAA;AAAA,QACrB;AAAA,MACF,CAAC;AAAA,IAAA;AAAA,EAEL;AACF;"}
@@ -2,3 +2,4 @@
2
2
  const index = require("../_chunks/index-QtHFaCQE.js");
3
3
  require("@strapi/icons");
4
4
  module.exports = index.index;
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -3,3 +3,4 @@ import "@strapi/icons";
3
3
  export {
4
4
  i as default
5
5
  };
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -242,3 +242,4 @@ const index = {
242
242
  middlewares
243
243
  };
244
244
  module.exports = index;
245
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../server/src/bootstrap.ts","../../server/src/destroy.ts","../../server/src/register.ts","../../server/src/config/index.ts","../../server/src/content-types/mention/index.ts","../../server/src/content-types/index.ts","../../server/src/controllers/mention/index.ts","../../server/src/controllers/ingest/index.ts","../../server/src/controllers/index.ts","../../server/src/middlewares/index.ts","../../server/src/policies/index.ts","../../server/src/routes/admin-api.ts","../../server/src/routes/content-api.ts","../../server/src/routes/index.ts","../../server/src/services/mention/index.ts","../../server/src/services/index.ts","../../server/src/index.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\n\nconst bootstrap = ({ strapi }: { strapi: Core.Strapi }) => {\n // bootstrap phase\n};\n\nexport default bootstrap;\n","import type { Core } from '@strapi/strapi';\n\nconst destroy = ({ strapi }: { strapi: Core.Strapi }) => {\n // destroy phase\n};\n\nexport default destroy;\n","import type { Core } from '@strapi/strapi';\n\nconst register = ({ strapi }: { strapi: Core.Strapi }) => {\n // register phase\n};\n\nexport default register;\n","export default {\n default: {},\n validator() {},\n};\n","import schema from './schema.json';\n\nexport default {\n schema,\n};","import mention from './mention';\n\nexport default {\n mention,\n};","'use strict';\n\n/**\n * mention controller\n */\n\nconst { createCoreController } = require('@strapi/strapi').factories;\n\nexport default createCoreController('plugin::octalens-mentions.mention');","import type { Core } from '@strapi/strapi';\n\n/**\n * Gets the display title for a mention.\n * If title is empty or \"Untitled\", uses the first 100 characters from body.\n */\nfunction getMentionTitle(title: string, body: string): string {\n if (!title || title.trim() === '' || title.toLowerCase() === 'untitled') {\n if (!body) return 'Untitled';\n\n const excerpt = body.substring(0, 100).trim();\n return excerpt.length === 100 ? `${excerpt}...` : excerpt;\n }\n\n return title;\n}\n\nconst controller = ({ strapi }: { strapi: Core.Strapi }) => ({\n async ingest(ctx) {\n const requestBody = ctx.request.body;\n\n if (!requestBody?.data) return ctx.badRequest('Missing data in request body');\n\n const rawTitle = requestBody.data?.title || '';\n const rawBody = requestBody.data?.body || '';\n const generatedTitle = getMentionTitle(rawTitle, rawBody);\n\n const mentionData = {\n action: requestBody.action,\n title: generatedTitle,\n body: rawBody,\n url: requestBody.data?.url || '',\n timestamp: requestBody.data?.timestamp || '',\n imageUrl: requestBody.data?.imageUrl || '',\n author: requestBody.data?.author || '',\n authorProfileLink: requestBody.data?.authorProfileLink || '',\n source: requestBody.data?.source || '',\n sourceId: requestBody.data?.sourceId || '',\n relevanceScore: requestBody.data?.relevanceScore || '',\n relevanceComment: requestBody.data?.relevanceComment || '',\n keyword: requestBody.data?.keyword || '',\n bookmarked: requestBody.data?.bookmarked || false,\n language: requestBody.data?.language || '',\n sentimentLabel: requestBody.data?.sentimentLabel || '',\n viewId: requestBody.data?.viewId || null,\n viewName: requestBody.data?.viewName || '',\n subreddit: requestBody.data?.subreddit || '',\n };\n\n try {\n const mention = await strapi.service('plugin::octalens-mentions.mention').create({\n data: mentionData,\n });\n\n ctx.body = { data: mention };\n } catch (error) {\n console.error('Error creating mention:', error);\n ctx.throw(500, 'Failed to create mention');\n }\n },\n});\n\nexport default controller;\n","import mention from './mention';\nimport ingest from './ingest';\n\nexport default {\n mention,\n ingest\n};","export default {};\n","export default {};\n","export default [\n {\n method: 'GET',\n path: '/mentions',\n handler: 'mention.find',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n];\n","export default [\n {\n method: 'GET',\n path: '/mentions',\n handler: 'mention.find',\n config: {\n policies: [],\n },\n },\n {\n method: 'GET',\n path: '/mentions/:id',\n handler: 'mention.findOne',\n config: {\n policies: [],\n },\n },\n {\n method: 'DELETE',\n path: '/mentions/:id',\n handler: 'mention.delete',\n config: {\n policies: [],\n },\n },\n {\n method: 'PUT',\n path: '/mentions/:id',\n handler: 'mention.update',\n config: {\n policies: [],\n },\n },\n {\n method: 'POST',\n path: '/mentions',\n handler: 'mention.create',\n config: {\n policies: [],\n },\n },\n {\n method: 'POST',\n path: '/ingest',\n handler: 'ingest.ingest'\n }\n];\n","\"use strict\";\n\nimport adminApiRoutes from \"./admin-api\";\nimport contentApiRoutes from \"./content-api\";\n\n\nexport default {\n \"admin-api\": {\n type: \"admin\",\n routes: [...adminApiRoutes],\n },\n \"content-api\": {\n type: \"content-api\",\n routes: [...contentApiRoutes],\n },\n};","'use strict';\n\n/**\n * mention service\n */\n\nconst { createCoreService } = require('@strapi/strapi').factories;\n\nexport default createCoreService('plugin::octalens-mentions.mention');\n","import mention from './mention';\n\nexport default {\n mention,\n};\n","/**\n * Application methods\n */\nimport bootstrap from './bootstrap';\nimport destroy from './destroy';\nimport register from './register';\n\n/**\n * Plugin server methods\n */\nimport config from './config';\nimport contentTypes from './content-types';\nimport controllers from './controllers';\nimport middlewares from './middlewares';\nimport policies from './policies';\nimport routes from './routes';\nimport services from './services';\n\nexport default {\n register,\n bootstrap,\n destroy,\n config,\n controllers,\n routes,\n services,\n contentTypes,\n policies,\n middlewares,\n};\n"],"names":["mention","ingest"],"mappings":";AAEA,MAAM,YAAY,CAAC,EAAE,aAAsC;AAE3D;ACFA,MAAM,UAAU,CAAC,EAAE,aAAsC;AAEzD;ACFA,MAAM,WAAW,CAAC,EAAE,aAAsC;AAE1D;ACJA,MAAA,SAAe;AAAA,EACb,SAAS,CAAA;AAAA,EACT,YAAY;AAAA,EAAC;AACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACDA,MAAA,YAAe;AAAA,EACb;AACF;ACFA,MAAA,eAAe;AAAA,EAAA,SACbA;AACF;ACEA,MAAM,EAAE,qBAAA,IAAyB,QAAQ,gBAAgB,EAAE;AAE3D,MAAA,YAAe,qBAAqB,mCAAmC;ACFvE,SAAS,gBAAgB,OAAe,M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AAS;AAAA,EAAA;AAEb;ACxCA,MAAA,SAAe;AAAA,EACb,aAAa;AAAA,IACX,MAAM;AAAA,IACN,QAAQ,CAAC,GAAG,cAAc;AAAA,EAAA;AAAA,EAE5B,eAAe;AAAA,IACb,MAAM;AAAA,IACN,QAAQ,CAAC,GAAG,gBAAgB;AAAA,EAAA;AAEhC;ACTA,MAAM,EAAE,kBAAA,IAAsB,QAAQ,gBAAgB,EAAE;AAExD,MAAA,UAAe,kBAAkB,mCAAmC;ACNpE,MAAA,WAAe;AAAA,EACb;AACF;ACcA,MAAA,QAAe;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;"}
@@ -243,3 +243,4 @@ const index = {
243
243
  export {
244
244
  index as default
245
245
  };
246
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sources":["../../server/src/bootstrap.ts","../../server/src/destroy.ts","../../server/src/register.ts","../../server/src/config/index.ts","../../server/src/content-types/mention/index.ts","../../server/src/content-types/index.ts","../../server/src/controllers/mention/index.ts","../../server/src/controllers/ingest/index.ts","../../server/src/controllers/index.ts","../../server/src/middlewares/index.ts","../../server/src/policies/index.ts","../../server/src/routes/admin-api.ts","../../server/src/routes/content-api.ts","../../server/src/routes/index.ts","../../server/src/services/mention/index.ts","../../server/src/services/index.ts","../../server/src/index.ts"],"sourcesContent":["import type { Core } from '@strapi/strapi';\n\nconst bootstrap = ({ strapi }: { strapi: Core.Strapi }) => {\n // bootstrap phase\n};\n\nexport default bootstrap;\n","import type { Core } from '@strapi/strapi';\n\nconst destroy = ({ strapi }: { strapi: Core.Strapi }) => {\n // destroy phase\n};\n\nexport default destroy;\n","import type { Core } from '@strapi/strapi';\n\nconst register = ({ strapi }: { strapi: Core.Strapi }) => {\n // register phase\n};\n\nexport default register;\n","export default {\n default: {},\n validator() {},\n};\n","import schema from './schema.json';\n\nexport default {\n schema,\n};","import mention from './mention';\n\nexport default {\n mention,\n};","'use strict';\n\n/**\n * mention controller\n */\n\nconst { createCoreController } = require('@strapi/strapi').factories;\n\nexport default createCoreController('plugin::octalens-mentions.mention');","import type { Core } from '@strapi/strapi';\n\n/**\n * Gets the display title for a mention.\n * If title is empty or \"Untitled\", uses the first 100 characters from body.\n */\nfunction getMentionTitle(title: string, body: string): string {\n if (!title || title.trim() === '' || title.toLowerCase() === 'untitled') {\n if (!body) return 'Untitled';\n\n const excerpt = body.substring(0, 100).trim();\n return excerpt.length === 100 ? `${excerpt}...` : excerpt;\n }\n\n return title;\n}\n\nconst controller = ({ strapi }: { strapi: Core.Strapi }) => ({\n async ingest(ctx) {\n const requestBody = ctx.request.body;\n\n if (!requestBody?.data) return ctx.badRequest('Missing data in request body');\n\n const rawTitle = requestBody.data?.title || '';\n const rawBody = requestBody.data?.body || '';\n const generatedTitle = getMentionTitle(rawTitle, rawBody);\n\n const mentionData = {\n action: requestBody.action,\n title: generatedTitle,\n body: rawBody,\n url: requestBody.data?.url || '',\n timestamp: requestBody.data?.timestamp || '',\n imageUrl: requestBody.data?.imageUrl || '',\n author: requestBody.data?.author || '',\n authorProfileLink: requestBody.data?.authorProfileLink || '',\n source: requestBody.data?.source || '',\n sourceId: requestBody.data?.sourceId || '',\n relevanceScore: requestBody.data?.relevanceScore || '',\n relevanceComment: requestBody.data?.relevanceComment || '',\n keyword: requestBody.data?.keyword || '',\n bookmarked: requestBody.data?.bookmarked || false,\n language: requestBody.data?.language || '',\n sentimentLabel: requestBody.data?.sentimentLabel || '',\n viewId: requestBody.data?.viewId || null,\n viewName: requestBody.data?.viewName || '',\n subreddit: requestBody.data?.subreddit || '',\n };\n\n try {\n const mention = await strapi.service('plugin::octalens-mentions.mention').create({\n data: mentionData,\n });\n\n ctx.body = { data: mention };\n } catch (error) {\n console.error('Error creating mention:', error);\n ctx.throw(500, 'Failed to create mention');\n }\n },\n});\n\nexport default controller;\n","import mention from './mention';\nimport ingest from './ingest';\n\nexport default {\n mention,\n ingest\n};","export default {};\n","export default {};\n","export default [\n {\n method: 'GET',\n path: '/mentions',\n handler: 'mention.find',\n config: {\n policies: ['admin::isAuthenticatedAdmin'],\n },\n },\n];\n","export default [\n {\n method: 'GET',\n path: '/mentions',\n handler: 'mention.find',\n config: {\n policies: [],\n },\n },\n {\n method: 'GET',\n path: '/mentions/:id',\n handler: 'mention.findOne',\n config: {\n policies: [],\n },\n },\n {\n method: 'DELETE',\n path: '/mentions/:id',\n handler: 'mention.delete',\n config: {\n policies: [],\n },\n },\n {\n method: 'PUT',\n path: '/mentions/:id',\n handler: 'mention.update',\n config: {\n policies: [],\n },\n },\n {\n method: 'POST',\n path: '/mentions',\n handler: 'mention.create',\n config: {\n policies: [],\n },\n },\n {\n method: 'POST',\n path: '/ingest',\n handler: 'ingest.ingest'\n }\n];\n","\"use strict\";\n\nimport adminApiRoutes from \"./admin-api\";\nimport contentApiRoutes from \"./content-api\";\n\n\nexport default {\n \"admin-api\": {\n type: \"admin\",\n routes: [...adminApiRoutes],\n },\n \"content-api\": {\n type: \"content-api\",\n routes: [...contentApiRoutes],\n },\n};","'use strict';\n\n/**\n * mention service\n */\n\nconst { createCoreService } = require('@strapi/strapi').factories;\n\nexport default createCoreService('plugin::octalens-mentions.mention');\n","import mention from './mention';\n\nexport default {\n mention,\n};\n","/**\n * Application methods\n */\nimport bootstrap from './bootstrap';\nimport destroy from './destroy';\nimport register from './register';\n\n/**\n * Plugin server methods\n */\nimport config from './config';\nimport contentTypes from './content-types';\nimport controllers from './controllers';\nimport middlewares from './middlewares';\nimport policies from './policies';\nimport routes from './routes';\nimport services from './services';\n\nexport default {\n register,\n bootstrap,\n destroy,\n config,\n controllers,\n routes,\n services,\n contentTypes,\n policies,\n middlewares,\n};\n"],"names":["mention","ingest"],"mappings":"AAEA,MAAM,YAAY,CAAC,EAAE,aAAsC;AAE3D;ACFA,MAAM,UAAU,CAAC,EAAE,aAAsC;AAEzD;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Q;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,UAAU,CAAA;AAAA,IAAC;AAAA,EACb;AAAA,EAEF;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,UAAU,CAAA;AAAA,IAAC;AAAA,EACb;AAAA,EAEF;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,UAAU,CAAA;AAAA,IAAC;AAAA,EACb;AAAA,EAEF;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,SAAS;AAAA,EAAA;AAEb;ACxCA,MAAA,SAAe;AAAA,EACb,aAAa;AAAA,IACX,MAAM;AAAA,IACN,QAAQ,CAAC,GAAG,cAAc;AAAA,EAAA;AAAA,EAE5B,eAAe;AAAA,IACb,MAAM;AAAA,IACN,QAAQ,CAAC,GAAG,gBAAgB;AAAA,EAAA;AAEhC;ACTA,MAAM,EAAE,kBAAA,IAAsB,QAAQ,gBAAgB,EAAE;AAExD,MAAA,UAAe,kBAAkB,mCAAmC;ACNpE,MAAA,WAAe;AAAA,EACb;AACF;ACcA,MAAA,QAAe;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.9",
2
+ "version": "0.0.10",
3
3
  "keywords": [],
4
4
  "type": "commonjs",
5
5
  "exports": {