diff --git a/src/frontend/packages/activitypub-components/dist/index.cjs.js b/src/frontend/packages/activitypub-components/dist/index.cjs.js index 94b9caa00..e4a32444f 100644 --- a/src/frontend/packages/activitypub-components/dist/index.cjs.js +++ b/src/frontend/packages/activitypub-components/dist/index.cjs.js @@ -156,24 +156,33 @@ const $5ca5f7e9fc1c3544$var$useItemsFromPages = (pages, dereferenceItems)=>{ itemUri ], queryFn: async ()=>(await dataProvider.fetch(itemUri)).json, - staleTime: Infinity + staleTime: Infinity // Activities are immutable, so no need to refetch.. }))); - if (!shouldDereference) return { - loadedItems: items, - isLoading: false, - isFetching: false - }; // Put all loaded items together (might be dereferenced already, so concatenate). - const loadedItems = items.filter((item)=>typeof item !== "string").concat(itemQueries.flatMap((itemQuery)=>{ - return itemQuery.isSuccess && itemQuery.data || []; - })); - const errors = itemQueries.filter((q)=>q.error); - return { - loadedItems: loadedItems, - isLoading: itemQueries.some((q)=>q.isLoading), - isFetching: itemQueries.some((q)=>q.isFetching), - errors: errors.length > 0 ? errors : undefined - }; + const loadedItems = (0, $583VT$react.useMemo)(()=>items.filter((item)=>typeof item !== "string").concat(itemQueries.flatMap((itemQuery)=>{ + return itemQuery.isSuccess && itemQuery.data || []; + })), [ + items, + itemQueries + ]); + const errors = (0, $583VT$react.useMemo)(()=>itemQueries.filter((q)=>q.error), [ + itemQueries + ]); + const isLoading = itemQueries.some((q)=>q.isLoading); + const isFetching = itemQueries.some((q)=>q.isFetching); + const errorsFormatted = (0, $583VT$react.useMemo)(()=>errors.length > 0 ? errors : undefined, [ + errors + ]); + return (0, $583VT$react.useMemo)(()=>({ + loadedItems: loadedItems, + isLoading: isLoading, + isFetching: isFetching, + errors: errorsFormatted + }), [ + loadedItems, + itemQueries, + errorsFormatted + ]); }; /** * Subscribe a collection. Supports pagination. @@ -236,7 +245,10 @@ const $5ca5f7e9fc1c3544$var$useItemsFromPages = (pages, dereferenceItems)=>{ }); // Put all items together in a list (and dereference, if required). const { loadedItems: items, isLoading: isLoadingItems, isFetching: isFetchingItems, errors: itemErrors } = $5ca5f7e9fc1c3544$var$useItemsFromPages(pageData?.pages ?? $5ca5f7e9fc1c3544$var$emptyArray, dereferenceItems); - const allErrors = (0, $03510abb28fd3d8a$export$e57ff0f701c44363)(collectionError).concat((0, $03510abb28fd3d8a$export$e57ff0f701c44363)(itemErrors)); + const allErrors = (0, $583VT$react.useMemo)(()=>(0, $03510abb28fd3d8a$export$e57ff0f701c44363)(collectionError).concat((0, $03510abb28fd3d8a$export$e57ff0f701c44363)(itemErrors)), [ + collectionError, + itemErrors + ]); const addItem = (0, $583VT$react.useCallback)((item, shouldRefetch = true)=>{ queryClient.setQueryData([ "collection", @@ -368,23 +380,39 @@ const $5ca5f7e9fc1c3544$var$useItemsFromPages = (pages, dereferenceItems)=>{ webSocketRef, liveUpdates ]); - return { - items: items, - totalItems: totalItems, - error: allErrors.length > 0 && allErrors, - refetch: refetch, - fetchNextPage: fetchNextPage, - addItem: addItem, - removeItem: removeItem, - hasNextPage: hasNextPage, - isLoading: isLoadingPage || isLoadingItems, - isFetching: isFetchingPage || isFetchingItems, - isFetchingNextPage: isFetchingNextPage, - url: collectionUrl, - hasLiveUpdates: hasLiveUpdates, - awaitWebSocketConnection: awaitWebSocketConnection, - webSocketRef: webSocketRef - }; + return (0, $583VT$react.useMemo)(()=>({ + items: items, + totalItems: totalItems, + error: allErrors.length > 0 && allErrors, + refetch: refetch, + fetchNextPage: fetchNextPage, + addItem: addItem, + removeItem: removeItem, + hasNextPage: hasNextPage, + isLoading: isLoadingPage || isLoadingItems, + isFetching: isFetchingPage || isFetchingItems, + isFetchingNextPage: isFetchingNextPage, + url: collectionUrl, + hasLiveUpdates: hasLiveUpdates, + awaitWebSocketConnection: awaitWebSocketConnection, + webSocketRef: webSocketRef + }), [ + items, + totalItems, + allErrors.length > 0 && allErrors, + refetch, + fetchNextPage, + addItem, + removeItem, + hasNextPage, + isLoadingPage || isLoadingItems, + isFetchingPage || isFetchingItems, + isFetchingNextPage, + collectionUrl, + hasLiveUpdates, + awaitWebSocketConnection, + webSocketRef + ]); }; var $5ca5f7e9fc1c3544$export$2e2bcd8739ae039 = $5ca5f7e9fc1c3544$var$useCollection; diff --git a/src/frontend/packages/activitypub-components/dist/index.cjs.js.map b/src/frontend/packages/activitypub-components/dist/index.cjs.js.map index 56957a5ea..de187e8cf 100644 --- a/src/frontend/packages/activitypub-components/dist/index.cjs.js.map +++ b/src/frontend/packages/activitypub-components/dist/index.cjs.js.map @@ -1 +1 @@ -{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;;;;;;;;;;;;;;AGAN,MAAM,4CAAiB;IAC5B,QAAQ;IACR,KAAK;IACL,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,kBAAkB;IAClB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;AACR;AAEO,MAAM,4CAAc;IACzB,aAAa;IACb,OAAO;IACP,cAAc;IACd,QAAQ;IACR,SAAS;AACX;AAEO,MAAM,4CAAe;IAC1B,SAAS;IACT,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,SAAS;IACT,cAAc;IACd,WAAW;IACX,OAAO;AACT;AAEO,MAAM,4CAAa;;;;;;;;;AGtDnB,MAAM,4CAAU,CAAI;IACzB,4DAA4D;IAC5D,IAAI,UAAU,QAAQ,UAAU,WAC9B,OAAO,EAAE;IAEX,gBAAgB;IAChB,IAAI,MAAM,OAAO,CAAC,QAChB,OAAO;IAET,iCAAiC;IACjC,OAAO;QAAC;KAAM;AAChB;IAEA,2CAAe;aACb;AACF;AAEO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KAAK,CAAC,GAAG,KAAK,UAAU;gBAChC,KAAK,CAAC,EAAE,CAAC,IAAI;gBAEb,OAAO;YACT;YAEA,OAAO,UAAU,GAAG,EAAE,UAAU;QAClC;QAEA;YACE,KAAK,CAAC,EAAE,CAAC,OAAO;YAChB,UAAU,OAAO;QACnB;IACF;AACF;IAEA,2CAAe;;;AD9Cf,MAAM,oCAAc,CAAA;IAClB,MAAM,gBAAgB,CAAA,GAAA,+CAAW,EAAE;IAEnC,MAAM,QAAE,IAAI,EAAE,GAAG,CAAA,GAAA,4BAAS,EACxB,cACA;QACE,QAAQ;YACN,aAAa;gBAAC,eAAe,eAAe;aAAM;YAClD,YAAY,EAAE;QAChB;IACF,GACA;QACE,SAAS,CAAC,CAAC,eAAe,eAAe;IAC3C;IAGF,MAAM,oBAAoB,CAAA,GAAA,oBAAM,EAAE;QAChC,IAAI,MACF,OAAO,KAAK,GAAG,CAAC,CAAA,OAAS,CAAA;gBAAE,IAAI,KAAK,EAAE;gBAAE,OAAO,IAAI,CAAC,eAAe,eAAe,MAAM;YAAC,CAAA;IAE7F,GAAG;QAAC;KAAK;IAET,MAAM,QAAQ,CAAA,GAAA,oBAAM,EAAE;QACpB,IAAI,mBACF,OAAO,CAAC,SAAE,KAAK,EAAE;YACf,OAAO,kBAAkB,MAAM,CAAC,CAAC,SAAE,KAAK,EAAE,GAAK,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,WAAW,KAAK,KAAK,CAAC,GAAG;QAC/G;IAEJ,GAAG;QAAC;KAAkB;IAEtB,OAAO;eACL;QACA,QAAQ,CAAA,GAAA,wCAAa;IACvB;AACF;IAEA,2CAAe;","sources":["packages/activitypub-components/src/index.ts","packages/activitypub-components/src/components/CommentsField/CommentsField.js","packages/activitypub-components/src/components/CommentsField/PostCommentForm.js","packages/activitypub-components/src/constants.js","packages/activitypub-components/src/hooks/useOutbox.ts","packages/activitypub-components/src/hooks/useCollection.ts","packages/activitypub-components/src/utils.ts","packages/activitypub-components/src/hooks/useAwaitActivity.ts","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.ts","packages/activitypub-components/src/hooks/useNodeinfo.ts","packages/activitypub-components/src/hooks/useWebfinger.js","packages/activitypub-components/src/hooks/useMentions/useMentions.js","packages/activitypub-components/src/hooks/useMentions/renderMentions.js","packages/activitypub-components/src/hooks/useMentions/MentionsList.js"],"sourcesContent":["// Components\nexport { default as CommentsField } from './components/CommentsField/CommentsField';\nexport { default as CollectionList } from './components/CollectionList';\nexport { default as ReferenceCollectionField } from './components/ReferenceCollectionField';\n\n// Hooks\nexport { default as useCollection } from './hooks/useCollection';\nexport { default as useInbox } from './hooks/useInbox';\nexport { default as useNodeinfo } from './hooks/useNodeinfo';\nexport { default as useOutbox } from './hooks/useOutbox';\nexport { default as useWebfinger } from './hooks/useWebfinger';\nexport { default as useMentions } from './hooks/useMentions/useMentions';\n\n// Constants\nexport { ACTIVITY_TYPES, ACTOR_TYPES, OBJECT_TYPES, PUBLIC_URI } from './constants';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport PostCommentForm from './PostCommentForm';\nimport CommentsList from './CommentsList';\nimport useCollection from '../../hooks/useCollection';\n\nconst CommentsField = ({ source, context, helperText, placeholder, userResource, mentions }) => {\n const record = useRecordContext();\n const { items: comments, loading, addItem, removeItem } = useCollection(record.replies);\n if (!userResource) throw new Error('No userResource defined for CommentsField');\n return (\n <>\n \n \n \n );\n};\n\nCommentsField.defaultProps = {\n label: 'Commentaires',\n placeholder: 'Commencez à taper votre commentaire...',\n source: 'id', // Ensure the field is always displayed\n context: 'id'\n};\n\nexport default CommentsField;\n","import React, { useState, useCallback } from 'react';\nimport { Form, useGetIdentity, useNotify, useRecordContext } from 'react-admin';\nimport { RichTextInput, DefaultEditorOptions } from 'ra-input-rich-text';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { Button, Box, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport SendIcon from '@mui/icons-material/Send';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AuthDialog } from '@semapps/auth-provider';\nimport { OBJECT_TYPES, PUBLIC_URI } from '../../constants';\nimport useOutbox from '../../hooks/useOutbox';\nimport CustomMention from './CustomMention';\n\nconst useStyles = makeStyles(theme => ({\n form: {\n marginTop: -12 // Negative margin to keep the form close to the label\n },\n container: {\n paddingLeft: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 16,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n editorContent: {\n '& > div': {\n backgroundColor: 'rgba(0, 0, 0, 0.09)',\n padding: '2px 12px',\n borderWidth: '0px !important',\n borderRadius: 0,\n borderBottom: '1px solid #FFF',\n minHeight: 60,\n outline: 'unset !important'\n },\n '& > div > p': {\n marginTop: 12,\n marginBottom: 12,\n fontFamily: theme.typography.body1.fontFamily,\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n },\n '& > div > p.is-editor-empty:first-child::before': {\n color: 'grey',\n content: 'attr(data-placeholder)',\n float: 'left',\n height: 0,\n pointerEvents: 'none'\n }\n },\n button: {\n marginTop: -10, // To go over helper text block\n marginBottom: 15\n }\n}));\n\nconst EmptyToolbar = () => null;\n\nconst PostCommentForm = ({ context, placeholder, helperText, mentions, userResource, addItem, removeItem }) => {\n const record = useRecordContext();\n const { data: identity, isLoading } = useGetIdentity();\n const userDataModel = useDataModel(userResource);\n const classes = useStyles();\n const notify = useNotify();\n const outbox = useOutbox();\n const [expanded, setExpanded] = useState(false);\n const [openAuth, setOpenAuth] = useState(false);\n\n const onSubmit = useCallback(\n async values => {\n const document = new DOMParser().parseFromString(values.comment, 'text/html');\n const mentions = Array.from(document.body.getElementsByClassName('mention'));\n const mentionedUsersUris = [];\n\n mentions.forEach(node => {\n const userUri = node.attributes['data-mention-id'].value;\n const userLabel = node.attributes['data-mention-label'].value;\n const link = document.createElement('a');\n link.setAttribute(\n 'href',\n `${new URL(window.location.href).origin}/${userResource}/${encodeURIComponent(userUri)}/show`\n );\n link.textContent = `@${userLabel}`;\n node.parentNode.replaceChild(link, node);\n mentionedUsersUris.push(userUri);\n });\n\n if (document.body.innerHTML === 'undefined') {\n notify('Votre commentaire est vide', { type: 'error' });\n } else {\n const tempId = Date.now();\n\n const note = {\n type: OBJECT_TYPES.NOTE,\n attributedTo: outbox.owner,\n content: document.body.innerHTML,\n inReplyTo: record[context],\n published: new Date().toISOString()\n };\n\n try {\n addItem({ id: tempId, ...note });\n // TODO reset the form\n setExpanded(false);\n await outbox.post({ ...note, to: [...mentionedUsersUris, PUBLIC_URI] });\n notify('Commentaire posté avec succès', { type: 'success' });\n } catch (e) {\n console.error(e);\n removeItem(tempId);\n notify(e.message, { type: 'error' });\n }\n }\n },\n [outbox, notify, setExpanded, addItem, removeItem]\n );\n\n const openAuthIfDisconnected = useCallback(() => {\n if (!identity?.id) {\n setOpenAuth(true);\n }\n }, [identity, setOpenAuth]);\n\n // Don't init the editor options until mentions and identity are loaded, as they can only be initialized once\n if ((mentions && !mentions.items) || isLoading) return null;\n\n return (\n <>\n
\n \n \n }\n fullWidth\n classes={{ editorContent: classes.editorContent }}\n editorOptions={{\n ...DefaultEditorOptions,\n onFocus() {\n setExpanded(true);\n },\n extensions: [\n ...DefaultEditorOptions.extensions,\n placeholder ? Placeholder.configure({ placeholder }) : null,\n mentions\n ? CustomMention.configure({\n HTMLAttributes: {\n class: 'mention'\n },\n suggestion: mentions\n })\n : null\n ],\n // Disable editor if user is not connected\n editable: !!identity?.id\n }}\n helperText={helperText}\n />\n {expanded && (\n }\n className={classes.button}\n >\n Envoyer\n \n )}\n \n
\n setOpenAuth(false)}\n message=\"Pour poster un commentaire, vous devez être connecté.\"\n />\n \n );\n};\n\nexport default PostCommentForm;\n","export const ACTIVITY_TYPES = {\n ACCEPT: 'Accept',\n ADD: 'Add',\n ANNOUNCE: 'Announce',\n ARRIVE: 'Arrive',\n BLOCK: 'Block',\n CREATE: 'Create',\n DELETE: 'Delete',\n DISLIKE: 'Dislike',\n FLAG: 'Flag',\n FOLLOW: 'Follow',\n IGNORE: 'Ignore',\n INVITE: 'Invite',\n JOIN: 'Join',\n LEAVE: 'Leave',\n LIKE: 'Like',\n LISTEN: 'Listen',\n MOVE: 'Move',\n OFFER: 'Offer',\n QUESTION: 'Question',\n REJECT: 'Reject',\n READ: 'Read',\n REMOVE: 'Remove',\n TENTATIVE_REJECT: 'TentativeReject',\n TENTATIVE_ACCEPT: 'TentativeAccept',\n TRAVEL: 'Travel',\n UNDO: 'Undo',\n UPDATE: 'Update',\n VIEW: 'View'\n};\n\nexport const ACTOR_TYPES = {\n APPLICATION: 'Application',\n GROUP: 'Group',\n ORGANIZATION: 'Organization',\n PERSON: 'Person',\n SERVICE: 'Service'\n};\n\nexport const OBJECT_TYPES = {\n ARTICLE: 'Article',\n AUDIO: 'Audio',\n DOCUMENT: 'Document',\n EVENT: 'Event',\n IMAGE: 'Image',\n NOTE: 'Note',\n PAGE: 'Page',\n PLACE: 'Place',\n PROFILE: 'Profile',\n RELATIONSHIP: 'Relationship',\n TOMBSTONE: 'Tombstone',\n VIDEO: 'Video'\n};\n\nexport const PUBLIC_URI = 'https://www.w3.org/ns/activitystreams#Public';\n","import { useCallback } from 'react';\nimport { useDataProvider, useGetIdentity } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch and post to the outbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `post`: a function to post a new activity in the user's outbox\n * - `awaitActivity`: a function to wait for a certain activity to be posted\n * - `owner`: the WebID of the outbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useoutbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useOutbox = (options: UseCollectionOptions = {}) => {\n const dataProvider = useDataProvider();\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('outbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async (activity: object) => {\n if (!url) {\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the isLoading argument of useOutbox'\n );\n }\n const { headers } = await dataProvider.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n })\n });\n return headers.get('Location');\n },\n [url, dataProvider]\n );\n\n return { url, items, awaitWebSocketConnection, post, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useOutbox;\n","import { useCallback, useMemo, useState, useEffect, useRef, RefObject } from 'react';\nimport { useGetIdentity, useDataProvider } from 'react-admin';\nimport { QueryFunction, useInfiniteQuery, useQueries, useQueryClient } from 'react-query';\nimport { getOrCreateWsChannel, SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { arrayOf } from '../utils';\nimport type { UseCollectionOptions, SolidNotification, AwaitActivityOptions } from '../types';\n\n// Used to avoid re-renders\nconst emptyArray: never[] = [];\n\nconst useItemsFromPages = (pages: any[], dereferenceItems: boolean) => {\n const dataProvider = useDataProvider();\n const items = useMemo(() => pages.flatMap(p => arrayOf(p.orderedItems || p.items)), [pages]);\n\n // We will force dereference, if some items are not URI string references.\n const shouldDereference = useMemo(() => {\n return dereferenceItems || items.some(item => typeof item !== 'string');\n }, [dereferenceItems, items]);\n\n // Dereference all items, if necessary (even if shouldDereference is false, the hook needs to be called).\n const itemQueries = useQueries(\n !shouldDereference\n ? emptyArray\n : items\n .filter(item => typeof item === 'string')\n .map(itemUri => ({\n queryKey: ['resource', itemUri],\n queryFn: async () => (await dataProvider.fetch(itemUri)).json,\n staleTime: Infinity\n }))\n );\n\n if (!shouldDereference) {\n return { loadedItems: items, isLoading: false, isFetching: false };\n }\n\n // Put all loaded items together (might be dereferenced already, so concatenate).\n const loadedItems = items\n .filter(item => typeof item !== 'string')\n .concat(\n itemQueries.flatMap(itemQuery => {\n return (itemQuery.isSuccess && itemQuery.data) || [];\n })\n );\n\n const errors = itemQueries.filter(q => q.error);\n return {\n loadedItems,\n isLoading: itemQueries.some(q => q.isLoading),\n isFetching: itemQueries.some(q => q.isFetching),\n errors: errors.length > 0 ? errors : undefined\n };\n};\n\n/**\n * Subscribe a collection. Supports pagination.\n * @param predicateOrUrl The collection URI or the predicate to get the collection URI from the identity (webId).\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useCollection = (predicateOrUrl: string, options: UseCollectionOptions = {}) => {\n const { dereferenceItems = false, liveUpdates = false } = options;\n const { data: identity } = useGetIdentity();\n const [totalItems, setTotalItems] = useState(0);\n const queryClient = useQueryClient();\n const [hasLiveUpdates, setHasLiveUpdates] = useState<{ status: string; error?: any }>({\n status: 'connecting'\n });\n const dataProvider = useDataProvider();\n const webSocketRef = useRef(null);\n\n // Get collectionUrl from webId predicate or URL.\n const collectionUrl = useMemo(() => {\n if (predicateOrUrl) {\n if (predicateOrUrl.startsWith('http')) {\n return predicateOrUrl;\n }\n if (identity?.webIdData) {\n return identity?.webIdData?.[predicateOrUrl];\n }\n }\n return undefined;\n // throw new Error(`No URL available for useCollection: ${predicateOrUrl}.`);\n }, [identity, predicateOrUrl]);\n\n // Fetch page of collection item references (if pageParam provided)\n // or default to `collectionUrl` (which should give you the first page).\n const fetchCollection: QueryFunction = useCallback(\n async ({ pageParam: nextPageUrl }) => {\n // Fetch page or first page (collectionUrl)\n let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);\n if (json.totalItems) setTotalItems(json.totalItems);\n\n // If first page, handle this here.\n if ((json.type === 'OrderedCollection' || json.type === 'Collection') && json.first) {\n if (json.first?.items) {\n if (json.first?.items.length === 0 && json.first?.next) {\n // Special case where the first property is an object without items\n ({ json } = await dataProvider.fetch(json.first?.next));\n } else {\n json = json.first;\n }\n } else {\n // Fetch the first page\n ({ json } = await dataProvider.fetch(json.first));\n }\n }\n\n return json;\n },\n [dataProvider, collectionUrl, identity, setTotalItems]\n );\n\n // Use infiniteQuery to handle pagination, fetching, etc.\n const {\n data: pageData,\n error: collectionError,\n fetchNextPage,\n refetch,\n hasNextPage,\n isLoading: isLoadingPage,\n isFetching: isFetchingPage,\n isFetchingNextPage\n } = useInfiniteQuery(['collection', { collectionUrl }], fetchCollection, {\n enabled: !!(collectionUrl && identity?.id),\n getNextPageParam: (lastPage: any) => lastPage.next,\n getPreviousPageParam: (firstPage: any) => firstPage.prev\n });\n\n // Put all items together in a list (and dereference, if required).\n const {\n loadedItems: items,\n isLoading: isLoadingItems,\n isFetching: isFetchingItems,\n errors: itemErrors\n } = useItemsFromPages(pageData?.pages ?? emptyArray, dereferenceItems);\n\n const allErrors = arrayOf(collectionError).concat(arrayOf(itemErrors));\n\n const addItem = useCallback(\n (item: string | any, shouldRefetch: boolean | number = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems + 1);\n\n // Destructure, so react knows, it needs to re-render the pages.\n const pages = [...oldData.pages];\n\n if (pages?.[0]?.orderedItems) {\n pages[0].orderedItems = [item, ...arrayOf(pages[0].orderedItems)];\n } else if (pages?.[0]?.items) {\n pages[0].items = [item, ...arrayOf(pages[0].items)];\n }\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n const removeItem = useCallback(\n (item: string | any, shouldRefetch: boolean = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems - 1);\n\n // Destructure, so react knows, it needs to re-render the pages array.\n const pages = [...oldData.pages];\n // Find the item in all pages and remove the item to be removed (either item.id or just item)\n pages.forEach(page => {\n if (page.orderedItems) {\n page.orderedItems = arrayOf(page.orderedItems).filter((i: any) => (i.id || i) !== (item.id || item));\n } else if (page.items) {\n page.items = arrayOf(page.items).filter((i: any) => (i.id || i) !== (item?.id || item));\n }\n });\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n // Live Updates\n useEffect(() => {\n if (liveUpdates && collectionUrl) {\n // Create ws that listens to collectionUri changes\n getOrCreateWsChannel(dataProvider.fetch, collectionUrl)\n .then(ws => {\n webSocketRef.current = ws; // Keep a ref to the webSocket so that it can be used elsewhere\n webSocketRef.current.addEventListener('message', e => {\n const data: SolidNotification = JSON.parse(e.data);\n if (data.type === 'Add') {\n addItem(data.object, true);\n } else if (data.type === 'Remove') {\n removeItem(data.object, true);\n }\n });\n webSocketRef.current.addEventListener('error', e => {\n setHasLiveUpdates({ status: 'error', error: e });\n // TODO: Retry after a while\n });\n webSocketRef.current.addEventListener('close', e => {\n if (!hasLiveUpdates.error) {\n setHasLiveUpdates({ ...hasLiveUpdates, status: 'closed' });\n }\n });\n setHasLiveUpdates({ status: 'connected' });\n })\n .catch(() => {}); // If it fails, we won't receive live updates. But that's okay.\n }\n }, [collectionUrl, liveUpdates, dataProvider, webSocketRef, addItem, removeItem, setHasLiveUpdates]);\n\n const awaitWebSocketConnection = useCallback(\n (options: AwaitActivityOptions = {}): Promise> => {\n const { timeout = 30000 } = options;\n if (!liveUpdates)\n throw new Error(`Cannot call awaitWebSocketConnection because the liveUpdates option is set to false`);\n return new Promise((resolve, reject) => {\n if (webSocketRef?.current) {\n resolve(webSocketRef);\n } else {\n const timeoutId = setTimeout(() => {\n reject(`No WebSocket connection found within ${Math.round(timeout / 1000)}s`);\n }, timeout);\n const intervalId = setInterval(() => {\n if (webSocketRef?.current) {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n resolve(webSocketRef);\n } else {\n console.log('WebSocket is not initialized yet, waiting...');\n }\n }, 100);\n }\n });\n },\n [webSocketRef, liveUpdates]\n );\n\n return {\n items,\n totalItems,\n error: allErrors.length > 0 && allErrors,\n refetch,\n fetchNextPage,\n addItem,\n removeItem,\n hasNextPage,\n isLoading: isLoadingPage || isLoadingItems,\n isFetching: isFetchingPage || isFetchingItems,\n isFetchingNextPage,\n url: collectionUrl,\n hasLiveUpdates,\n awaitWebSocketConnection,\n webSocketRef\n };\n};\n\nexport default useCollection;\n","export const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (value === null || value === undefined) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default {\n arrayOf\n};\n\nexport const filterDuplicates = (iterable: T[], predicate: (item: T) => string) => {\n const seen = new Set();\n return iterable.filter(item => {\n const key = predicate(item);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n};\n","import { RefObject, useCallback } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { SolidNotification, AwaitActivityOptions, AwaitWebSocketConnectionOptions } from '../types';\n\n/**\n * Hook used internally by useInbox and useOutbox. This is not exported.\n * @param awaitWebSocketConnection Promise returning the WebSocket which allow to listen to the inbox or outbox\n * @param existingActivities Partial list of activities already received in the inbox and outbox\n */\nconst useAwaitActivity = (\n awaitWebSocketConnection: (options?: AwaitWebSocketConnectionOptions) => Promise>,\n existingActivities?: Array\n) => {\n const dataProvider = useDataProvider();\n\n // TODO Allow to pass an object, and automatically dereference it if required, like on the @semapps/activitypub matchActivity util\n return useCallback(\n (matchActivity: (activity: object) => boolean, options: AwaitActivityOptions = {}) => {\n const { timeout = 30000, checkExistingActivities = false } = options;\n return new Promise((resolve, reject) => {\n awaitWebSocketConnection()\n .then(webSocketRef => {\n const onMessage = (event: MessageEvent) => {\n const data: SolidNotification = JSON.parse(event.data);\n if (data.type === 'Add') {\n dataProvider.fetch(data.object).then(({ json }) => {\n if (matchActivity(json)) {\n removeListeners();\n return resolve(json);\n }\n });\n }\n };\n const onError = (e: Event) => {\n // TODO reconnect if connection closed\n removeListeners();\n reject(e);\n };\n const onClose = (e: CloseEvent) => {\n removeListeners();\n reject(new Error(`${e.reason} (Code: ${e.code})`));\n };\n\n const removeListeners = () => {\n webSocketRef.current?.removeEventListener('message', onMessage);\n webSocketRef.current?.removeEventListener('error', onError);\n webSocketRef.current?.removeEventListener('close', onClose);\n };\n\n webSocketRef.current?.addEventListener('message', onMessage);\n webSocketRef.current?.addEventListener('error', onError);\n webSocketRef.current?.addEventListener('close', onClose);\n\n // If a list of activities is already loaded, verify if there is a match\n if (existingActivities && checkExistingActivities) {\n for (const a of existingActivities) {\n if (typeof a !== 'string') {\n if (matchActivity(a)) {\n removeListeners();\n return resolve(a);\n }\n }\n }\n }\n\n setTimeout(() => {\n removeListeners();\n reject(new Error('Timeout'));\n }, timeout);\n })\n .catch(e => {\n reject(e);\n });\n });\n },\n [awaitWebSocketConnection, existingActivities, dataProvider]\n );\n};\n\nexport default useAwaitActivity;\n","import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\n\n// Fix a bug in the current version of the mention extension\n// (The { id, label } object is located inside the id property)\n// See https://github.com/ueberdosis/tiptap/pull/1322\nconst CustomMention = Mention.extend({\n renderHTML({ node, HTMLAttributes }) {\n return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), `@${node.attrs.id.label}`];\n },\n addAttributes() {\n return {\n label: {\n default: null,\n parseHTML: element => {\n return {\n label: element.getAttribute('data-mention-label')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.label) {\n return {};\n }\n return {\n 'data-mention-label': attributes.id.label\n };\n }\n },\n id: {\n default: null,\n parseHTML: element => {\n return {\n id: element.getAttribute('data-mention-id')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.id) {\n return {};\n }\n return {\n 'data-mention-id': attributes.id.id\n };\n }\n }\n };\n }\n});\n\nexport default CustomMention;\n","import React from 'react';\nimport { TextField, RichTextField, DateField } from 'react-admin';\nimport { Box, Typography, CircularProgress } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AvatarWithLabelField, ReferenceField } from '@semapps/field-components';\n\nconst useStyles = makeStyles(() => ({\n container: {\n paddingLeft: 80,\n marginTop: 8,\n minHeight: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n text: {\n paddingTop: 2,\n paddingBottom: 8\n },\n label: {\n fontWeight: 'bold'\n },\n content: {\n '& p': {\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n }\n },\n loading: {\n zIndex: 1000,\n backgroundColor: 'white',\n opacity: 0.5,\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 200,\n marginTop: 5\n }\n}));\n\nconst CommentsList = ({ comments, userResource, loading }) => {\n const classes = useStyles();\n const userDataModel = useDataModel(userResource);\n return (\n \n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n \n \n \n \n \n \n \n \n \n \n \n  • \n \n \n \n \n \n ))}\n {loading && (\n \n \n \n \n \n )}\n \n );\n};\n\nexport default CommentsList;\n","import React from 'react';\nimport { useList, ListContextProvider, useGetMany } from 'react-admin';\nimport useCollection from '../hooks/useCollection';\n\nconst CollectionList = ({ collectionUrl, resource, children }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n const { items: actorsUris } = useCollection(collectionUrl);\n\n const { data, isLoading, isFetching } = useGetMany(\n resource,\n { ids: Array.isArray(actorsUris) ? actorsUris : [actorsUris] },\n { enabled: !!actorsUris }\n );\n\n const listContext = useList({ data, isLoading, isFetching });\n\n return {children};\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, reference, children, ...rest }) => {\n const record = useRecordContext();\n\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n \n {children}\n \n );\n};\n\nexport default ReferenceCollectionField;\n","import { useGetIdentity } from 'react-admin';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch the inbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `awaitActivity`: a function to wait for a certain activity to be received\n * - `owner`: the WebID of the inbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useinbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useInbox = (options: UseCollectionOptions = {}) => {\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('inbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n return { url, items, awaitWebSocketConnection, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\nimport type { NodeInfo, NodeInfoLinks } from '../types';\n\nconst useNodeinfo = (host?: string, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\n if (host && rel) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are likely on HTTP\n const nodeinfoUrl = `${protocol}://${host}/.well-known/nodeinfo`;\n\n try {\n const { json: links }: { json: NodeInfoLinks } = await fetchUtils.fetchJson(nodeinfoUrl);\n\n // Accept any version of the nodeinfo protocol\n const link = links?.links?.find(l => l.rel === rel);\n\n if (link) {\n const { json }: { json: NodeInfo } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n }\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\n }\n }\n })();\n }, [host, setSchema, rel]);\n\n return schema;\n};\n\nexport default useNodeinfo;\n","import { useCallback } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useWebfinger = () => {\n // Post an activity to the logged user's outbox and return its URI\n const fetch = useCallback(async id => {\n // eslint-disable-next-line\n const [_, username, host] = id.split('@');\n if (host) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are most likely on localhost\n const webfingerUrl = `${protocol}://${host}/.well-known/webfinger?resource=acct:${username}@${host}`;\n\n try {\n const { json } = await fetchUtils.fetchJson(webfingerUrl);\n\n const link = json.links.find(l => l.type === 'application/activity+json');\n\n return link ? link.href : null;\n } catch (e) {\n return null;\n }\n } else {\n return null;\n }\n }, []);\n\n return { fetch };\n};\n\nexport default useWebfinger;\n","import { useMemo } from 'react';\nimport { useGetList } from 'react-admin';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport renderMentions from './renderMentions';\n\nconst useMentions = userResource => {\n const userDataModel = useDataModel(userResource);\n\n const { data } = useGetList(\n userResource,\n {\n filter: {\n _predicates: [userDataModel?.fieldsMapping?.title],\n blankNodes: []\n }\n },\n {\n enabled: !!userDataModel?.fieldsMapping?.title\n }\n );\n\n const availableMentions = useMemo(() => {\n if (data) {\n return data.map(item => ({ id: item.id, label: item[userDataModel?.fieldsMapping?.title] }));\n }\n }, [data]);\n\n const items = useMemo(() => {\n if (availableMentions) {\n return ({ query }) => {\n return availableMentions.filter(({ label }) => label.toLowerCase().startsWith(query.toLowerCase())).slice(0, 5);\n };\n }\n }, [availableMentions]);\n\n return {\n items,\n render: renderMentions\n };\n};\n\nexport default useMentions;\n","import { ReactRenderer } from '@tiptap/react';\nimport tippy from 'tippy.js';\nimport MentionsList from './MentionsList';\n\nconst renderMentions = () => {\n let component;\n let popup;\n\n return {\n onStart: props => {\n component = new ReactRenderer(MentionsList, {\n props,\n editor: props.editor\n });\n\n popup = tippy('body', {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: 'manual',\n placement: 'bottom-start'\n });\n },\n\n onUpdate(props) {\n component.updateProps(props);\n\n popup[0].setProps({\n getReferenceClientRect: props.clientRect\n });\n },\n\n onKeyDown(props) {\n if (props.event.key === 'Escape') {\n popup[0].hide();\n\n return true;\n }\n\n return component.ref?.onKeyDown(props);\n },\n\n onExit() {\n popup[0].destroy();\n component.destroy();\n }\n };\n};\n\nexport default renderMentions;\n","import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useStyles = makeStyles(theme => ({\n items: {\n background: '#fff',\n borderRadius: '0.5rem',\n boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1)',\n color: 'rgba(0, 0, 0, 0.8)',\n fontSize: '0.9rem',\n overflow: 'hidden',\n padding: '0.2rem',\n position: 'relative'\n },\n item: {\n background: 'transparent',\n border: '1px solid transparent',\n borderRadius: '0.4rem',\n display: 'block',\n margin: 0,\n padding: '0.2rem 0.4rem',\n textAlign: 'left',\n width: '100%',\n '&.selected': {\n borderColor: '#000'\n }\n }\n}));\n\nexport default forwardRef((props, ref) => {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const classes = useStyles();\n\n const selectItem = index => {\n const item = props.items[index];\n\n if (item) {\n props.command({ id: item });\n }\n };\n\n const upHandler = () => {\n setSelectedIndex((selectedIndex + props.items.length - 1) % props.items.length);\n };\n\n const downHandler = () => {\n setSelectedIndex((selectedIndex + 1) % props.items.length);\n };\n\n const enterHandler = () => {\n selectItem(selectedIndex);\n };\n\n useEffect(() => setSelectedIndex(0), [props.items]);\n\n useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }) => {\n if (event.key === 'ArrowUp') {\n upHandler();\n return true;\n }\n\n if (event.key === 'ArrowDown') {\n downHandler();\n return true;\n }\n\n if (event.key === 'Enter') {\n enterHandler();\n return true;\n }\n\n return false;\n }\n }));\n\n return (\n
\n {props.items.length ? (\n props.items.map((item, index) => (\n selectItem(index)}\n >\n {item.label}\n \n ))\n ) : (\n
Aucun résultat
\n )}\n
\n );\n});\n"],"names":[],"version":3,"file":"index.cjs.js.map"} \ No newline at end of file +{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;;;;;;;;;;;;;;AGAN,MAAM,4CAAiB;IAC5B,QAAQ;IACR,KAAK;IACL,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,kBAAkB;IAClB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;AACR;AAEO,MAAM,4CAAc;IACzB,aAAa;IACb,OAAO;IACP,cAAc;IACd,QAAQ;IACR,SAAS;AACX;AAEO,MAAM,4CAAe;IAC1B,SAAS;IACT,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,SAAS;IACT,cAAc;IACd,WAAW;IACX,OAAO;AACT;AAEO,MAAM,4CAAa;;;;;;;;;AGtDnB,MAAM,4CAAU,CAAI;IACzB,4DAA4D;IAC5D,IAAI,UAAU,QAAQ,UAAU,WAC9B,OAAO,EAAE;IAEX,gBAAgB;IAChB,IAAI,MAAM,OAAO,CAAC,QAChB,O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GAAA,oBAAM,EAAE;QACpB,IAAI,mBACF,OAAO,CAAC,SAAE,KAAK,EAAE;YACf,OAAO,kBAAkB,MAAM,CAAC,CAAC,SAAE,KAAK,EAAE,GAAK,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,WAAW,KAAK,KAAK,CAAC,GAAG;QAC/G;IAEJ,GAAG;QAAC;KAAkB;IAEtB,OAAO;eACL;QACA,QAAQ,CAAA,GAAA,wCAAa;IACvB;AACF;IAEA,2CAAe;","sources":["packages/activitypub-components/src/index.ts","packages/activitypub-components/src/components/CommentsField/CommentsField.js","packages/activitypub-components/src/components/CommentsField/PostCommentForm.js","packages/activitypub-components/src/constants.js","packages/activitypub-components/src/hooks/useOutbox.ts","packages/activitypub-components/src/hooks/useCollection.ts","packages/activitypub-components/src/utils.ts","packages/activitypub-components/src/hooks/useAwaitActivity.ts","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.ts","packages/activitypub-components/src/hooks/useNodeinfo.ts","packages/activitypub-components/src/hooks/useWebfinger.js","packages/activitypub-components/src/hooks/useMentions/useMentions.js","packages/activitypub-components/src/hooks/useMentions/renderMentions.js","packages/activitypub-components/src/hooks/useMentions/MentionsList.js"],"sourcesContent":["// Components\nexport { default as CommentsField } from './components/CommentsField/CommentsField';\nexport { default as CollectionList } from './components/CollectionList';\nexport { default as ReferenceCollectionField } from './components/ReferenceCollectionField';\n\n// Hooks\nexport { default as useCollection } from './hooks/useCollection';\nexport { default as useInbox } from './hooks/useInbox';\nexport { default as useNodeinfo } from './hooks/useNodeinfo';\nexport { default as useOutbox } from './hooks/useOutbox';\nexport { default as useWebfinger } from './hooks/useWebfinger';\nexport { default as useMentions } from './hooks/useMentions/useMentions';\n\n// Constants\nexport { ACTIVITY_TYPES, ACTOR_TYPES, OBJECT_TYPES, PUBLIC_URI } from './constants';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport PostCommentForm from './PostCommentForm';\nimport CommentsList from './CommentsList';\nimport useCollection from '../../hooks/useCollection';\n\nconst CommentsField = ({ source, context, helperText, placeholder, userResource, mentions }) => {\n const record = useRecordContext();\n const { items: comments, loading, addItem, removeItem } = useCollection(record.replies);\n if (!userResource) throw new Error('No userResource defined for CommentsField');\n return (\n <>\n \n \n \n );\n};\n\nCommentsField.defaultProps = {\n label: 'Commentaires',\n placeholder: 'Commencez à taper votre commentaire...',\n source: 'id', // Ensure the field is always displayed\n context: 'id'\n};\n\nexport default CommentsField;\n","import React, { useState, useCallback } from 'react';\nimport { Form, useGetIdentity, useNotify, useRecordContext } from 'react-admin';\nimport { RichTextInput, DefaultEditorOptions } from 'ra-input-rich-text';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { Button, Box, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport SendIcon from '@mui/icons-material/Send';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AuthDialog } from '@semapps/auth-provider';\nimport { OBJECT_TYPES, PUBLIC_URI } from '../../constants';\nimport useOutbox from '../../hooks/useOutbox';\nimport CustomMention from './CustomMention';\n\nconst useStyles = makeStyles(theme => ({\n form: {\n marginTop: -12 // Negative margin to keep the form close to the label\n },\n container: {\n paddingLeft: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 16,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n editorContent: {\n '& > div': {\n backgroundColor: 'rgba(0, 0, 0, 0.09)',\n padding: '2px 12px',\n borderWidth: '0px !important',\n borderRadius: 0,\n borderBottom: '1px solid #FFF',\n minHeight: 60,\n outline: 'unset !important'\n },\n '& > div > p': {\n marginTop: 12,\n marginBottom: 12,\n fontFamily: theme.typography.body1.fontFamily,\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n },\n '& > div > p.is-editor-empty:first-child::before': {\n color: 'grey',\n content: 'attr(data-placeholder)',\n float: 'left',\n height: 0,\n pointerEvents: 'none'\n }\n },\n button: {\n marginTop: -10, // To go over helper text block\n marginBottom: 15\n }\n}));\n\nconst EmptyToolbar = () => null;\n\nconst PostCommentForm = ({ context, placeholder, helperText, mentions, userResource, addItem, removeItem }) => {\n const record = useRecordContext();\n const { data: identity, isLoading } = useGetIdentity();\n const userDataModel = useDataModel(userResource);\n const classes = useStyles();\n const notify = useNotify();\n const outbox = useOutbox();\n const [expanded, setExpanded] = useState(false);\n const [openAuth, setOpenAuth] = useState(false);\n\n const onSubmit = useCallback(\n async values => {\n const document = new DOMParser().parseFromString(values.comment, 'text/html');\n const mentions = Array.from(document.body.getElementsByClassName('mention'));\n const mentionedUsersUris = [];\n\n mentions.forEach(node => {\n const userUri = node.attributes['data-mention-id'].value;\n const userLabel = node.attributes['data-mention-label'].value;\n const link = document.createElement('a');\n link.setAttribute(\n 'href',\n `${new URL(window.location.href).origin}/${userResource}/${encodeURIComponent(userUri)}/show`\n );\n link.textContent = `@${userLabel}`;\n node.parentNode.replaceChild(link, node);\n mentionedUsersUris.push(userUri);\n });\n\n if (document.body.innerHTML === 'undefined') {\n notify('Votre commentaire est vide', { type: 'error' });\n } else {\n const tempId = Date.now();\n\n const note = {\n type: OBJECT_TYPES.NOTE,\n attributedTo: outbox.owner,\n content: document.body.innerHTML,\n inReplyTo: record[context],\n published: new Date().toISOString()\n };\n\n try {\n addItem({ id: tempId, ...note });\n // TODO reset the form\n setExpanded(false);\n await outbox.post({ ...note, to: [...mentionedUsersUris, PUBLIC_URI] });\n notify('Commentaire posté avec succès', { type: 'success' });\n } catch (e) {\n console.error(e);\n removeItem(tempId);\n notify(e.message, { type: 'error' });\n }\n }\n },\n [outbox, notify, setExpanded, addItem, removeItem]\n );\n\n const openAuthIfDisconnected = useCallback(() => {\n if (!identity?.id) {\n setOpenAuth(true);\n }\n }, [identity, setOpenAuth]);\n\n // Don't init the editor options until mentions and identity are loaded, as they can only be initialized once\n if ((mentions && !mentions.items) || isLoading) return null;\n\n return (\n <>\n
\n \n \n }\n fullWidth\n classes={{ editorContent: classes.editorContent }}\n editorOptions={{\n ...DefaultEditorOptions,\n onFocus() {\n setExpanded(true);\n },\n extensions: [\n ...DefaultEditorOptions.extensions,\n placeholder ? Placeholder.configure({ placeholder }) : null,\n mentions\n ? CustomMention.configure({\n HTMLAttributes: {\n class: 'mention'\n },\n suggestion: mentions\n })\n : null\n ],\n // Disable editor if user is not connected\n editable: !!identity?.id\n }}\n helperText={helperText}\n />\n {expanded && (\n }\n className={classes.button}\n >\n Envoyer\n \n )}\n \n
\n setOpenAuth(false)}\n message=\"Pour poster un commentaire, vous devez être connecté.\"\n />\n \n );\n};\n\nexport default PostCommentForm;\n","export const ACTIVITY_TYPES = {\n ACCEPT: 'Accept',\n ADD: 'Add',\n ANNOUNCE: 'Announce',\n ARRIVE: 'Arrive',\n BLOCK: 'Block',\n CREATE: 'Create',\n DELETE: 'Delete',\n DISLIKE: 'Dislike',\n FLAG: 'Flag',\n FOLLOW: 'Follow',\n IGNORE: 'Ignore',\n INVITE: 'Invite',\n JOIN: 'Join',\n LEAVE: 'Leave',\n LIKE: 'Like',\n LISTEN: 'Listen',\n MOVE: 'Move',\n OFFER: 'Offer',\n QUESTION: 'Question',\n REJECT: 'Reject',\n READ: 'Read',\n REMOVE: 'Remove',\n TENTATIVE_REJECT: 'TentativeReject',\n TENTATIVE_ACCEPT: 'TentativeAccept',\n TRAVEL: 'Travel',\n UNDO: 'Undo',\n UPDATE: 'Update',\n VIEW: 'View'\n};\n\nexport const ACTOR_TYPES = {\n APPLICATION: 'Application',\n GROUP: 'Group',\n ORGANIZATION: 'Organization',\n PERSON: 'Person',\n SERVICE: 'Service'\n};\n\nexport const OBJECT_TYPES = {\n ARTICLE: 'Article',\n AUDIO: 'Audio',\n DOCUMENT: 'Document',\n EVENT: 'Event',\n IMAGE: 'Image',\n NOTE: 'Note',\n PAGE: 'Page',\n PLACE: 'Place',\n PROFILE: 'Profile',\n RELATIONSHIP: 'Relationship',\n TOMBSTONE: 'Tombstone',\n VIDEO: 'Video'\n};\n\nexport const PUBLIC_URI = 'https://www.w3.org/ns/activitystreams#Public';\n","import { useCallback } from 'react';\nimport { useDataProvider, useGetIdentity } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch and post to the outbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `post`: a function to post a new activity in the user's outbox\n * - `awaitActivity`: a function to wait for a certain activity to be posted\n * - `owner`: the WebID of the outbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useoutbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useOutbox = (options: UseCollectionOptions = {}) => {\n const dataProvider = useDataProvider();\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('outbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async (activity: object) => {\n if (!url) {\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the isLoading argument of useOutbox'\n );\n }\n const { headers } = await dataProvider.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n })\n });\n return headers.get('Location');\n },\n [url, dataProvider]\n );\n\n return { url, items, awaitWebSocketConnection, post, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useOutbox;\n","import { useCallback, useMemo, useState, useEffect, useRef, RefObject } from 'react';\nimport { useGetIdentity, useDataProvider } from 'react-admin';\nimport { QueryFunction, useInfiniteQuery, useQueries, useQueryClient } from 'react-query';\nimport { getOrCreateWsChannel, SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { arrayOf } from '../utils';\nimport type { UseCollectionOptions, SolidNotification, AwaitActivityOptions } from '../types';\n\n// Used to avoid re-renders\nconst emptyArray: never[] = [];\n\nconst useItemsFromPages = (pages: any[], dereferenceItems: boolean) => {\n const dataProvider = useDataProvider();\n const items = useMemo(() => pages.flatMap(p => arrayOf(p.orderedItems || p.items)), [pages]);\n\n // We will force dereference, if some items are not URI string references.\n const shouldDereference = useMemo(() => {\n return dereferenceItems || items.some(item => typeof item !== 'string');\n }, [dereferenceItems, items]);\n\n // Dereference all items, if necessary (even if shouldDereference is false, the hook needs to be called).\n const itemQueries = useQueries(\n !shouldDereference\n ? emptyArray\n : items\n .filter(item => typeof item === 'string')\n .map(itemUri => ({\n queryKey: ['resource', itemUri],\n queryFn: async () => (await dataProvider.fetch(itemUri)).json,\n staleTime: Infinity // Activities are immutable, so no need to refetch..\n }))\n );\n\n // Put all loaded items together (might be dereferenced already, so concatenate).\n const loadedItems = useMemo(\n () =>\n items\n .filter(item => typeof item !== 'string')\n .concat(\n itemQueries.flatMap(itemQuery => {\n return (itemQuery.isSuccess && itemQuery.data) || [];\n })\n ),\n [items, itemQueries]\n );\n\n const errors = useMemo(() => itemQueries.filter(q => q.error), [itemQueries]);\n\n const isLoading = itemQueries.some(q => q.isLoading);\n const isFetching = itemQueries.some(q => q.isFetching);\n const errorsFormatted = useMemo(() => (errors.length > 0 ? errors : undefined), [errors]);\n\n return useMemo(\n () => ({\n loadedItems,\n isLoading,\n isFetching,\n errors: errorsFormatted\n }),\n [loadedItems, itemQueries, errorsFormatted]\n );\n};\n\n/**\n * Subscribe a collection. Supports pagination.\n * @param predicateOrUrl The collection URI or the predicate to get the collection URI from the identity (webId).\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useCollection = (predicateOrUrl: string, options: UseCollectionOptions = {}) => {\n const { dereferenceItems = false, liveUpdates = false } = options;\n const { data: identity } = useGetIdentity();\n const [totalItems, setTotalItems] = useState(0);\n const queryClient = useQueryClient();\n const [hasLiveUpdates, setHasLiveUpdates] = useState<{ status: string; error?: any }>({\n status: 'connecting'\n });\n const dataProvider = useDataProvider();\n const webSocketRef = useRef(null);\n\n // Get collectionUrl from webId predicate or URL.\n const collectionUrl = useMemo(() => {\n if (predicateOrUrl) {\n if (predicateOrUrl.startsWith('http')) {\n return predicateOrUrl;\n }\n if (identity?.webIdData) {\n return identity?.webIdData?.[predicateOrUrl];\n }\n }\n return undefined;\n // throw new Error(`No URL available for useCollection: ${predicateOrUrl}.`);\n }, [identity, predicateOrUrl]);\n\n // Fetch page of collection item references (if pageParam provided)\n // or default to `collectionUrl` (which should give you the first page).\n const fetchCollection: QueryFunction = useCallback(\n async ({ pageParam: nextPageUrl }) => {\n // Fetch page or first page (collectionUrl)\n let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);\n if (json.totalItems) setTotalItems(json.totalItems);\n\n // If first page, handle this here.\n if ((json.type === 'OrderedCollection' || json.type === 'Collection') && json.first) {\n if (json.first?.items) {\n if (json.first?.items.length === 0 && json.first?.next) {\n // Special case where the first property is an object without items\n ({ json } = await dataProvider.fetch(json.first?.next));\n } else {\n json = json.first;\n }\n } else {\n // Fetch the first page\n ({ json } = await dataProvider.fetch(json.first));\n }\n }\n\n return json;\n },\n [dataProvider, collectionUrl, identity, setTotalItems]\n );\n\n // Use infiniteQuery to handle pagination, fetching, etc.\n const {\n data: pageData,\n error: collectionError,\n fetchNextPage,\n refetch,\n hasNextPage,\n isLoading: isLoadingPage,\n isFetching: isFetchingPage,\n isFetchingNextPage\n } = useInfiniteQuery(['collection', { collectionUrl }], fetchCollection, {\n enabled: !!(collectionUrl && identity?.id),\n getNextPageParam: (lastPage: any) => lastPage.next,\n getPreviousPageParam: (firstPage: any) => firstPage.prev\n });\n\n // Put all items together in a list (and dereference, if required).\n const {\n loadedItems: items,\n isLoading: isLoadingItems,\n isFetching: isFetchingItems,\n errors: itemErrors\n } = useItemsFromPages(pageData?.pages ?? emptyArray, dereferenceItems);\n\n const allErrors = useMemo(() => arrayOf(collectionError).concat(arrayOf(itemErrors)), [collectionError, itemErrors]);\n\n const addItem = useCallback(\n (item: string | any, shouldRefetch: boolean | number = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems + 1);\n\n // Destructure, so react knows, it needs to re-render the pages.\n const pages = [...oldData.pages];\n\n if (pages?.[0]?.orderedItems) {\n pages[0].orderedItems = [item, ...arrayOf(pages[0].orderedItems)];\n } else if (pages?.[0]?.items) {\n pages[0].items = [item, ...arrayOf(pages[0].items)];\n }\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n const removeItem = useCallback(\n (item: string | any, shouldRefetch: boolean = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems - 1);\n\n // Destructure, so react knows, it needs to re-render the pages array.\n const pages = [...oldData.pages];\n // Find the item in all pages and remove the item to be removed (either item.id or just item)\n pages.forEach(page => {\n if (page.orderedItems) {\n page.orderedItems = arrayOf(page.orderedItems).filter((i: any) => (i.id || i) !== (item.id || item));\n } else if (page.items) {\n page.items = arrayOf(page.items).filter((i: any) => (i.id || i) !== (item?.id || item));\n }\n });\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n // Live Updates\n useEffect(() => {\n if (liveUpdates && collectionUrl) {\n // Create ws that listens to collectionUri changes\n getOrCreateWsChannel(dataProvider.fetch, collectionUrl)\n .then(ws => {\n webSocketRef.current = ws; // Keep a ref to the webSocket so that it can be used elsewhere\n webSocketRef.current.addEventListener('message', e => {\n const data: SolidNotification = JSON.parse(e.data);\n if (data.type === 'Add') {\n addItem(data.object, true);\n } else if (data.type === 'Remove') {\n removeItem(data.object, true);\n }\n });\n webSocketRef.current.addEventListener('error', e => {\n setHasLiveUpdates({ status: 'error', error: e });\n // TODO: Retry after a while\n });\n webSocketRef.current.addEventListener('close', e => {\n if (!hasLiveUpdates.error) {\n setHasLiveUpdates({ ...hasLiveUpdates, status: 'closed' });\n }\n });\n setHasLiveUpdates({ status: 'connected' });\n })\n .catch(() => {}); // If it fails, we won't receive live updates. But that's okay.\n }\n }, [collectionUrl, liveUpdates, dataProvider, webSocketRef, addItem, removeItem, setHasLiveUpdates]);\n\n const awaitWebSocketConnection = useCallback(\n (options: AwaitActivityOptions = {}): Promise> => {\n const { timeout = 30000 } = options;\n if (!liveUpdates)\n throw new Error(`Cannot call awaitWebSocketConnection because the liveUpdates option is set to false`);\n return new Promise((resolve, reject) => {\n if (webSocketRef?.current) {\n resolve(webSocketRef);\n } else {\n const timeoutId = setTimeout(() => {\n reject(`No WebSocket connection found within ${Math.round(timeout / 1000)}s`);\n }, timeout);\n const intervalId = setInterval(() => {\n if (webSocketRef?.current) {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n resolve(webSocketRef);\n } else {\n console.log('WebSocket is not initialized yet, waiting...');\n }\n }, 100);\n }\n });\n },\n [webSocketRef, liveUpdates]\n );\n\n return useMemo(\n () => ({\n items,\n totalItems,\n error: allErrors.length > 0 && allErrors,\n refetch,\n fetchNextPage,\n addItem,\n removeItem,\n hasNextPage,\n isLoading: isLoadingPage || isLoadingItems,\n isFetching: isFetchingPage || isFetchingItems,\n isFetchingNextPage,\n url: collectionUrl,\n hasLiveUpdates,\n awaitWebSocketConnection,\n webSocketRef\n }),\n [\n items,\n totalItems,\n allErrors.length > 0 && allErrors,\n refetch,\n fetchNextPage,\n addItem,\n removeItem,\n hasNextPage,\n isLoadingPage || isLoadingItems,\n isFetchingPage || isFetchingItems,\n isFetchingNextPage,\n collectionUrl,\n hasLiveUpdates,\n awaitWebSocketConnection,\n webSocketRef\n ]\n );\n};\n\nexport default useCollection;\n","export const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (value === null || value === undefined) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default {\n arrayOf\n};\n\nexport const filterDuplicates = (iterable: T[], predicate: (item: T) => string) => {\n const seen = new Set();\n return iterable.filter(item => {\n const key = predicate(item);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n};\n","import { RefObject, useCallback } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { SolidNotification, AwaitActivityOptions, AwaitWebSocketConnectionOptions } from '../types';\n\n/**\n * Hook used internally by useInbox and useOutbox. This is not exported.\n * @param awaitWebSocketConnection Promise returning the WebSocket which allow to listen to the inbox or outbox\n * @param existingActivities Partial list of activities already received in the inbox and outbox\n */\nconst useAwaitActivity = (\n awaitWebSocketConnection: (options?: AwaitWebSocketConnectionOptions) => Promise>,\n existingActivities?: Array\n) => {\n const dataProvider = useDataProvider();\n\n // TODO Allow to pass an object, and automatically dereference it if required, like on the @semapps/activitypub matchActivity util\n return useCallback(\n (matchActivity: (activity: object) => boolean, options: AwaitActivityOptions = {}) => {\n const { timeout = 30000, checkExistingActivities = false } = options;\n return new Promise((resolve, reject) => {\n awaitWebSocketConnection()\n .then(webSocketRef => {\n const onMessage = (event: MessageEvent) => {\n const data: SolidNotification = JSON.parse(event.data);\n if (data.type === 'Add') {\n dataProvider.fetch(data.object).then(({ json }) => {\n if (matchActivity(json)) {\n removeListeners();\n return resolve(json);\n }\n });\n }\n };\n const onError = (e: Event) => {\n // TODO reconnect if connection closed\n removeListeners();\n reject(e);\n };\n const onClose = (e: CloseEvent) => {\n removeListeners();\n reject(new Error(`${e.reason} (Code: ${e.code})`));\n };\n\n const removeListeners = () => {\n webSocketRef.current?.removeEventListener('message', onMessage);\n webSocketRef.current?.removeEventListener('error', onError);\n webSocketRef.current?.removeEventListener('close', onClose);\n };\n\n webSocketRef.current?.addEventListener('message', onMessage);\n webSocketRef.current?.addEventListener('error', onError);\n webSocketRef.current?.addEventListener('close', onClose);\n\n // If a list of activities is already loaded, verify if there is a match\n if (existingActivities && checkExistingActivities) {\n for (const a of existingActivities) {\n if (typeof a !== 'string') {\n if (matchActivity(a)) {\n removeListeners();\n return resolve(a);\n }\n }\n }\n }\n\n setTimeout(() => {\n removeListeners();\n reject(new Error('Timeout'));\n }, timeout);\n })\n .catch(e => {\n reject(e);\n });\n });\n },\n [awaitWebSocketConnection, existingActivities, dataProvider]\n );\n};\n\nexport default useAwaitActivity;\n","import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\n\n// Fix a bug in the current version of the mention extension\n// (The { id, label } object is located inside the id property)\n// See https://github.com/ueberdosis/tiptap/pull/1322\nconst CustomMention = Mention.extend({\n renderHTML({ node, HTMLAttributes }) {\n return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), `@${node.attrs.id.label}`];\n },\n addAttributes() {\n return {\n label: {\n default: null,\n parseHTML: element => {\n return {\n label: element.getAttribute('data-mention-label')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.label) {\n return {};\n }\n return {\n 'data-mention-label': attributes.id.label\n };\n }\n },\n id: {\n default: null,\n parseHTML: element => {\n return {\n id: element.getAttribute('data-mention-id')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.id) {\n return {};\n }\n return {\n 'data-mention-id': attributes.id.id\n };\n }\n }\n };\n }\n});\n\nexport default CustomMention;\n","import React from 'react';\nimport { TextField, RichTextField, DateField } from 'react-admin';\nimport { Box, Typography, CircularProgress } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AvatarWithLabelField, ReferenceField } from '@semapps/field-components';\n\nconst useStyles = makeStyles(() => ({\n container: {\n paddingLeft: 80,\n marginTop: 8,\n minHeight: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n text: {\n paddingTop: 2,\n paddingBottom: 8\n },\n label: {\n fontWeight: 'bold'\n },\n content: {\n '& p': {\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n }\n },\n loading: {\n zIndex: 1000,\n backgroundColor: 'white',\n opacity: 0.5,\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 200,\n marginTop: 5\n }\n}));\n\nconst CommentsList = ({ comments, userResource, loading }) => {\n const classes = useStyles();\n const userDataModel = useDataModel(userResource);\n return (\n \n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n \n \n \n \n \n \n \n \n \n \n \n  • \n \n \n \n \n \n ))}\n {loading && (\n \n \n \n \n \n )}\n \n );\n};\n\nexport default CommentsList;\n","import React from 'react';\nimport { useList, ListContextProvider, useGetMany } from 'react-admin';\nimport useCollection from '../hooks/useCollection';\n\nconst CollectionList = ({ collectionUrl, resource, children }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n const { items: actorsUris } = useCollection(collectionUrl);\n\n const { data, isLoading, isFetching } = useGetMany(\n resource,\n { ids: Array.isArray(actorsUris) ? actorsUris : [actorsUris] },\n { enabled: !!actorsUris }\n );\n\n const listContext = useList({ data, isLoading, isFetching });\n\n return {children};\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, reference, children, ...rest }) => {\n const record = useRecordContext();\n\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n \n {children}\n \n );\n};\n\nexport default ReferenceCollectionField;\n","import { useGetIdentity } from 'react-admin';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch the inbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `awaitActivity`: a function to wait for a certain activity to be received\n * - `owner`: the WebID of the inbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useinbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useInbox = (options: UseCollectionOptions = {}) => {\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('inbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n return { url, items, awaitWebSocketConnection, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\nimport type { NodeInfo, NodeInfoLinks } from '../types';\n\nconst useNodeinfo = (host?: string, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\n if (host && rel) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are likely on HTTP\n const nodeinfoUrl = `${protocol}://${host}/.well-known/nodeinfo`;\n\n try {\n const { json: links }: { json: NodeInfoLinks } = await fetchUtils.fetchJson(nodeinfoUrl);\n\n // Accept any version of the nodeinfo protocol\n const link = links?.links?.find(l => l.rel === rel);\n\n if (link) {\n const { json }: { json: NodeInfo } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n }\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\n }\n }\n })();\n }, [host, setSchema, rel]);\n\n return schema;\n};\n\nexport default useNodeinfo;\n","import { useCallback } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useWebfinger = () => {\n // Post an activity to the logged user's outbox and return its URI\n const fetch = useCallback(async id => {\n // eslint-disable-next-line\n const [_, username, host] = id.split('@');\n if (host) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are most likely on localhost\n const webfingerUrl = `${protocol}://${host}/.well-known/webfinger?resource=acct:${username}@${host}`;\n\n try {\n const { json } = await fetchUtils.fetchJson(webfingerUrl);\n\n const link = json.links.find(l => l.type === 'application/activity+json');\n\n return link ? link.href : null;\n } catch (e) {\n return null;\n }\n } else {\n return null;\n }\n }, []);\n\n return { fetch };\n};\n\nexport default useWebfinger;\n","import { useMemo } from 'react';\nimport { useGetList } from 'react-admin';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport renderMentions from './renderMentions';\n\nconst useMentions = userResource => {\n const userDataModel = useDataModel(userResource);\n\n const { data } = useGetList(\n userResource,\n {\n filter: {\n _predicates: [userDataModel?.fieldsMapping?.title],\n blankNodes: []\n }\n },\n {\n enabled: !!userDataModel?.fieldsMapping?.title\n }\n );\n\n const availableMentions = useMemo(() => {\n if (data) {\n return data.map(item => ({ id: item.id, label: item[userDataModel?.fieldsMapping?.title] }));\n }\n }, [data]);\n\n const items = useMemo(() => {\n if (availableMentions) {\n return ({ query }) => {\n return availableMentions.filter(({ label }) => label.toLowerCase().startsWith(query.toLowerCase())).slice(0, 5);\n };\n }\n }, [availableMentions]);\n\n return {\n items,\n render: renderMentions\n };\n};\n\nexport default useMentions;\n","import { ReactRenderer } from '@tiptap/react';\nimport tippy from 'tippy.js';\nimport MentionsList from './MentionsList';\n\nconst renderMentions = () => {\n let component;\n let popup;\n\n return {\n onStart: props => {\n component = new ReactRenderer(MentionsList, {\n props,\n editor: props.editor\n });\n\n popup = tippy('body', {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: 'manual',\n placement: 'bottom-start'\n });\n },\n\n onUpdate(props) {\n component.updateProps(props);\n\n popup[0].setProps({\n getReferenceClientRect: props.clientRect\n });\n },\n\n onKeyDown(props) {\n if (props.event.key === 'Escape') {\n popup[0].hide();\n\n return true;\n }\n\n return component.ref?.onKeyDown(props);\n },\n\n onExit() {\n popup[0].destroy();\n component.destroy();\n }\n };\n};\n\nexport default renderMentions;\n","import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useStyles = makeStyles(theme => ({\n items: {\n background: '#fff',\n borderRadius: '0.5rem',\n boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1)',\n color: 'rgba(0, 0, 0, 0.8)',\n fontSize: '0.9rem',\n overflow: 'hidden',\n padding: '0.2rem',\n position: 'relative'\n },\n item: {\n background: 'transparent',\n border: '1px solid transparent',\n borderRadius: '0.4rem',\n display: 'block',\n margin: 0,\n padding: '0.2rem 0.4rem',\n textAlign: 'left',\n width: '100%',\n '&.selected': {\n borderColor: '#000'\n }\n }\n}));\n\nexport default forwardRef((props, ref) => {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const classes = useStyles();\n\n const selectItem = index => {\n const item = props.items[index];\n\n if (item) {\n props.command({ id: item });\n }\n };\n\n const upHandler = () => {\n setSelectedIndex((selectedIndex + props.items.length - 1) % props.items.length);\n };\n\n const downHandler = () => {\n setSelectedIndex((selectedIndex + 1) % props.items.length);\n };\n\n const enterHandler = () => {\n selectItem(selectedIndex);\n };\n\n useEffect(() => setSelectedIndex(0), [props.items]);\n\n useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }) => {\n if (event.key === 'ArrowUp') {\n upHandler();\n return true;\n }\n\n if (event.key === 'ArrowDown') {\n downHandler();\n return true;\n }\n\n if (event.key === 'Enter') {\n enterHandler();\n return true;\n }\n\n return false;\n }\n }));\n\n return (\n
\n {props.items.length ? (\n props.items.map((item, index) => (\n selectItem(index)}\n >\n {item.label}\n \n ))\n ) : (\n
Aucun résultat
\n )}\n
\n );\n});\n"],"names":[],"version":3,"file":"index.cjs.js.map"} \ No newline at end of file diff --git a/src/frontend/packages/activitypub-components/dist/index.d.ts.map b/src/frontend/packages/activitypub-components/dist/index.d.ts.map index 76eea1363..09e2caad9 100644 --- a/src/frontend/packages/activitypub-components/dist/index.d.ts.map +++ b/src/frontend/packages/activitypub-components/dist/index.d.ts.map @@ -1 +1 @@ -{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,wEAAyE;AEtDzE;IACE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAoBD;;GAEG;AACH;IACE;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE;QACR;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;OAEG;IACH,SAAS,EAAE;QACT,aAAa,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK;QACjH,GAAG,CACC,aAAa,GACb,YAAY,GACZ,MAAM,GACN,UAAU,GACV,WAAW,GACX,SAAS,GACT,QAAQ,GACR,MAAM,GACN,MAAM,GACN,KAAK,CACR,EAAE;KACJ,CAAC;IACF;;OAEG;IACH,QAAQ,EAAE;QACR;;WAEG;QACH,OAAO,EAAE,CAAC,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC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kBC;;;;;;;;;ACpBD;;;;4CAgBC;AChBD;;;;;mDAcC;ACbD;;;;;;;GAOG;AACH,OAAA,MAAM,qBAAqB,oBAAoB;;;;;;;;;;;;;;;;;;;;;CAK9C,CAAC;ACdF,OAAA,MAAM,qBAAsB,MAAM,uCA4BjC,CAAC;AC7BF;;EAwBC;AGtBD;;;;;;;;;;;;;EAkCC","sources":["packages/activitypub-components/src/src/constants.js","packages/activitypub-components/src/src/utils.ts","packages/activitypub-components/src/src/types.ts","packages/activitypub-components/src/src/hooks/useCollection.ts","packages/activitypub-components/src/src/hooks/useAwaitActivity.ts","packages/activitypub-components/src/src/hooks/useOutbox.ts","packages/activitypub-components/src/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/src/components/CommentsField/PostCommentForm.js","packages/activitypub-components/src/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/src/components/CommentsField/CommentsField.js","packages/activitypub-components/src/src/components/CollectionList.js","packages/activitypub-components/src/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/src/hooks/useInbox.ts","packages/activitypub-components/src/src/hooks/useNodeinfo.ts","packages/activitypub-components/src/src/hooks/useWebfinger.js","packages/activitypub-components/src/src/hooks/useMentions/MentionsList.js","packages/activitypub-components/src/src/hooks/useMentions/renderMentions.js","packages/activitypub-components/src/src/hooks/useMentions/useMentions.js","packages/activitypub-components/src/src/index.ts","packages/activitypub-components/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"// Components\nexport { default as CommentsField } from './components/CommentsField/CommentsField';\nexport { default as CollectionList } from './components/CollectionList';\nexport { default as ReferenceCollectionField } from './components/ReferenceCollectionField';\n\n// Hooks\nexport { default as useCollection } from './hooks/useCollection';\nexport { default as useInbox } from './hooks/useInbox';\nexport { default as useNodeinfo } from './hooks/useNodeinfo';\nexport { default as useOutbox } from './hooks/useOutbox';\nexport { default as useWebfinger } from './hooks/useWebfinger';\nexport { default as useMentions } from './hooks/useMentions/useMentions';\n\n// Constants\nexport { ACTIVITY_TYPES, ACTOR_TYPES, OBJECT_TYPES, PUBLIC_URI } from './constants';\n"],"names":[],"version":3,"file":"index.d.ts.map"} \ No newline at end of file +{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,wEAAyE;AEtDzE;IACE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAMD;IACE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC;AAoBD;;GAEG;AACH;IACE;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE;QACR;;WAEG;QACH,IAAI,EAAE,MAAM,CAAC;QACb;;WAEG;QACH,OAAO,EAAE,MAAM,CAAC;QAChB;;WAEG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB;;WAEG;QACH,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF;;OAEG;IACH,SAAS,EAAE;QACT,aAAa,GAAG,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK;QACjH,GAAG,CACC,aAAa,GACb,YAAY,GACZ,MAAM,GACN,UAAU,GACV,WAAW,GACX,SAAS,GACT,QAAQ,GACR,MAAM,GACN,MAAM,GACN,KAAK,CACR,EAAE;KACJ,CAAC;IACF;;OAEG;IACH,QAAQ,EAAE;QACR;;WAEG;QACH,OAAO,EAAE,CAAC,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC,EAAE,CAAC;QAClG;;WAEG;QACH,QAAQ,EAAE,CACN,SAAS,GACT,SAAS,GACT,YAAY,GACZ,UAAU,GACV,YAAY,GACZ,QAA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BAAoB;;;;;;;;;;;;;;;;;;;;;CAK9C,CAAC;ACdF,OAAA,MAAM,qBAAsB,MAAM,uCA4BjC,CAAC;AC7BF;;EAwBC;AGtBD;;;;;;;;;;;;;EAkCC","sources":["packages/activitypub-components/src/src/constants.js","packages/activitypub-components/src/src/utils.ts","packages/activitypub-components/src/src/types.ts","packages/activitypub-components/src/src/hooks/useCollection.ts","packages/activitypub-components/src/src/hooks/useAwaitActivity.ts","packages/activitypub-components/src/src/hooks/useOutbox.ts","packages/activitypub-components/src/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/src/components/CommentsField/PostCommentForm.js","packages/activitypub-components/src/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/src/components/CommentsField/CommentsField.js","packages/activitypub-components/src/src/components/CollectionList.js","packages/activitypub-components/src/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/src/hooks/useInbox.ts","packages/activitypub-components/src/src/hooks/useNodeinfo.ts","packages/activitypub-components/src/src/hooks/useWebfinger.js","packages/activitypub-components/src/src/hooks/useMentions/MentionsList.js","packages/activitypub-components/src/src/hooks/useMentions/renderMentions.js","packages/activitypub-components/src/src/hooks/useMentions/useMentions.js","packages/activitypub-components/src/src/index.ts","packages/activitypub-components/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"// Components\nexport { default as CommentsField } from './components/CommentsField/CommentsField';\nexport { default as CollectionList } from './components/CollectionList';\nexport { default as ReferenceCollectionField } from './components/ReferenceCollectionField';\n\n// Hooks\nexport { default as useCollection } from './hooks/useCollection';\nexport { default as useInbox } from './hooks/useInbox';\nexport { default as useNodeinfo } from './hooks/useNodeinfo';\nexport { default as useOutbox } from './hooks/useOutbox';\nexport { default as useWebfinger } from './hooks/useWebfinger';\nexport { default as useMentions } from './hooks/useMentions/useMentions';\n\n// Constants\nexport { ACTIVITY_TYPES, ACTOR_TYPES, OBJECT_TYPES, PUBLIC_URI } from './constants';\n"],"names":[],"version":3,"file":"index.d.ts.map"} \ No newline at end of file diff --git a/src/frontend/packages/activitypub-components/dist/index.es.js b/src/frontend/packages/activitypub-components/dist/index.es.js index 2f111d35c..3fced2643 100644 --- a/src/frontend/packages/activitypub-components/dist/index.es.js +++ b/src/frontend/packages/activitypub-components/dist/index.es.js @@ -134,24 +134,33 @@ const $8281f3ce3b9d6123$var$useItemsFromPages = (pages, dereferenceItems)=>{ itemUri ], queryFn: async ()=>(await dataProvider.fetch(itemUri)).json, - staleTime: Infinity + staleTime: Infinity // Activities are immutable, so no need to refetch.. }))); - if (!shouldDereference) return { - loadedItems: items, - isLoading: false, - isFetching: false - }; // Put all loaded items together (might be dereferenced already, so concatenate). - const loadedItems = items.filter((item)=>typeof item !== "string").concat(itemQueries.flatMap((itemQuery)=>{ - return itemQuery.isSuccess && itemQuery.data || []; - })); - const errors = itemQueries.filter((q)=>q.error); - return { - loadedItems: loadedItems, - isLoading: itemQueries.some((q)=>q.isLoading), - isFetching: itemQueries.some((q)=>q.isFetching), - errors: errors.length > 0 ? errors : undefined - }; + const loadedItems = (0, $85cNH$useMemo)(()=>items.filter((item)=>typeof item !== "string").concat(itemQueries.flatMap((itemQuery)=>{ + return itemQuery.isSuccess && itemQuery.data || []; + })), [ + items, + itemQueries + ]); + const errors = (0, $85cNH$useMemo)(()=>itemQueries.filter((q)=>q.error), [ + itemQueries + ]); + const isLoading = itemQueries.some((q)=>q.isLoading); + const isFetching = itemQueries.some((q)=>q.isFetching); + const errorsFormatted = (0, $85cNH$useMemo)(()=>errors.length > 0 ? errors : undefined, [ + errors + ]); + return (0, $85cNH$useMemo)(()=>({ + loadedItems: loadedItems, + isLoading: isLoading, + isFetching: isFetching, + errors: errorsFormatted + }), [ + loadedItems, + itemQueries, + errorsFormatted + ]); }; /** * Subscribe a collection. Supports pagination. @@ -214,7 +223,10 @@ const $8281f3ce3b9d6123$var$useItemsFromPages = (pages, dereferenceItems)=>{ }); // Put all items together in a list (and dereference, if required). const { loadedItems: items, isLoading: isLoadingItems, isFetching: isFetchingItems, errors: itemErrors } = $8281f3ce3b9d6123$var$useItemsFromPages(pageData?.pages ?? $8281f3ce3b9d6123$var$emptyArray, dereferenceItems); - const allErrors = (0, $577f4953dfa5de4f$export$e57ff0f701c44363)(collectionError).concat((0, $577f4953dfa5de4f$export$e57ff0f701c44363)(itemErrors)); + const allErrors = (0, $85cNH$useMemo)(()=>(0, $577f4953dfa5de4f$export$e57ff0f701c44363)(collectionError).concat((0, $577f4953dfa5de4f$export$e57ff0f701c44363)(itemErrors)), [ + collectionError, + itemErrors + ]); const addItem = (0, $85cNH$useCallback)((item, shouldRefetch = true)=>{ queryClient.setQueryData([ "collection", @@ -346,23 +358,39 @@ const $8281f3ce3b9d6123$var$useItemsFromPages = (pages, dereferenceItems)=>{ webSocketRef, liveUpdates ]); - return { - items: items, - totalItems: totalItems, - error: allErrors.length > 0 && allErrors, - refetch: refetch, - fetchNextPage: fetchNextPage, - addItem: addItem, - removeItem: removeItem, - hasNextPage: hasNextPage, - isLoading: isLoadingPage || isLoadingItems, - isFetching: isFetchingPage || isFetchingItems, - isFetchingNextPage: isFetchingNextPage, - url: collectionUrl, - hasLiveUpdates: hasLiveUpdates, - awaitWebSocketConnection: awaitWebSocketConnection, - webSocketRef: webSocketRef - }; + return (0, $85cNH$useMemo)(()=>({ + items: items, + totalItems: totalItems, + error: allErrors.length > 0 && allErrors, + refetch: refetch, + fetchNextPage: fetchNextPage, + addItem: addItem, + removeItem: removeItem, + hasNextPage: hasNextPage, + isLoading: isLoadingPage || isLoadingItems, + isFetching: isFetchingPage || isFetchingItems, + isFetchingNextPage: isFetchingNextPage, + url: collectionUrl, + hasLiveUpdates: hasLiveUpdates, + awaitWebSocketConnection: awaitWebSocketConnection, + webSocketRef: webSocketRef + }), [ + items, + totalItems, + allErrors.length > 0 && allErrors, + refetch, + fetchNextPage, + addItem, + removeItem, + hasNextPage, + isLoadingPage || isLoadingItems, + isFetchingPage || isFetchingItems, + isFetchingNextPage, + collectionUrl, + hasLiveUpdates, + awaitWebSocketConnection, + webSocketRef + ]); }; var $8281f3ce3b9d6123$export$2e2bcd8739ae039 = $8281f3ce3b9d6123$var$useCollection; diff --git a/src/frontend/packages/activitypub-components/dist/index.es.js.map b/src/frontend/packages/activitypub-components/dist/index.es.js.map index bbec200f5..807f14447 100644 --- a/src/frontend/packages/activitypub-components/dist/index.es.js.map +++ b/src/frontend/packages/activitypub-components/dist/index.es.js.map @@ -1 +1 @@ -{"mappings":";;;;;;;;;;;;;;;;;AAAA,aAAa;;;;;;;;;;;;;;AGAN,MAAM,4CAAiB;IAC5B,QAAQ;IACR,KAAK;IACL,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,kBAAkB;IAClB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;AACR;AAEO,MAAM,4CAAc;IACzB,aAAa;IACb,OAAO;IACP,cAAc;IACd,QAAQ;IACR,SAAS;AACX;AAEO,MAAM,4CAAe;IAC1B,SAAS;IACT,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,SAAS;IACT,cAAc;IACd,WAAW;IACX,OAAO;AACT;AAEO,MAAM,4CAAa;;;;;;;;;AGtDnB,MAAM,4CAAU,CAAI;IACzB,4DAA4D;IAC5D,IAAI,UAAU,QAAQ,UAAU,WAC9B,OAAO,EAAE;IAEX,gBAAgB;IAChB,IAAI,MAAM,OAAO,CAAC,QAChB,OAAO;IAET,iCAAiC;IACjC,OAAO;QAAC;KAAM;AAChB;IAEA,2CAAe;aACb;AACF;AAEO,MAAM,4CAAmB,CAAI,UAAe;IACjD,MAAM,OAAO,IAAI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;YACT;YAEA,OAAO,UAAU,GAAG,EAAE,UAAU;QAClC;QAEA;YACE,KAAK,CAAC,EAAE,CAAC,OAAO;YAChB,UAAU,OAAO;QACnB;IACF;AACF;IAEA,2CAAe;;;AD9Cf,MAAM,oCAAc,CAAA;IAClB,MAAM,gBAAgB,CAAA,GAAA,mBAAW,EAAE;IAEnC,MAAM,QAAE,IAAI,EAAE,GAAG,CAAA,GAAA,iBAAS,EACxB,cACA;QACE,QAAQ;YACN,aAAa;gBAAC,eAAe,eAAe;aAAM;YAClD,YAAY,EAAE;QAChB;IACF,GACA;QACE,SAAS,CAAC,CAAC,eAAe,eAAe;IAC3C;IAGF,MAAM,oBAAoB,CAAA,GAAA,cAAM,EAAE;QAChC,IAAI,MACF,OAAO,KAAK,GAAG,CAAC,CAAA,OAAS,CAAA;gBAAE,IAAI,KAAK,EAAE;gBAAE,OAAO,IAAI,CAAC,eAAe,eAAe,MAAM;YAAC,CAAA;IAE7F,GAAG;QAAC;KAAK;IAET,MAAM,QAAQ,CAAA,GAAA,cAAM,EAAE;QACpB,IAAI,mBACF,OAAO,CAAC,SAAE,KAAK,EAAE;YACf,OAAO,kBAAkB,MAAM,CAAC,CAAC,SAAE,KAAK,EAAE,GAAK,MAAM,WAAW,GAAG,UAAU,CAAC,MAAM,WAAW,KAAK,KAAK,CAAC,GAAG;QAC/G;IAEJ,GAAG;QAAC;KAAkB;IAEtB,OAAO;eACL;QACA,QAAQ,CAAA,GAAA,wCAAa;IACvB;AACF;IAEA,2CAAe;","sources":["packages/activitypub-components/src/index.ts","packages/activitypub-components/src/components/CommentsField/CommentsField.js","packages/activitypub-components/src/components/CommentsField/PostCommentForm.js","packages/activitypub-components/src/constants.js","packages/activitypub-components/src/hooks/useOutbox.ts","packages/activitypub-components/src/hooks/useCollection.ts","packages/activitypub-components/src/utils.ts","packages/activitypub-components/src/hooks/useAwaitActivity.ts","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.ts","packages/activitypub-components/src/hooks/useNodeinfo.ts","packages/activitypub-components/src/hooks/useWebfinger.js","packages/activitypub-components/src/hooks/useMentions/useMentions.js","packages/activitypub-components/src/hooks/useMentions/renderMentions.js","packages/activitypub-components/src/hooks/useMentions/MentionsList.js"],"sourcesContent":["// Components\nexport { default as CommentsField } from './components/CommentsField/CommentsField';\nexport { default as CollectionList } from './components/CollectionList';\nexport { default as ReferenceCollectionField } from './components/ReferenceCollectionField';\n\n// Hooks\nexport { default as useCollection } from './hooks/useCollection';\nexport { default as useInbox } from './hooks/useInbox';\nexport { default as useNodeinfo } from './hooks/useNodeinfo';\nexport { default as useOutbox } from './hooks/useOutbox';\nexport { default as useWebfinger } from './hooks/useWebfinger';\nexport { default as useMentions } from './hooks/useMentions/useMentions';\n\n// Constants\nexport { ACTIVITY_TYPES, ACTOR_TYPES, OBJECT_TYPES, PUBLIC_URI } from './constants';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport PostCommentForm from './PostCommentForm';\nimport CommentsList from './CommentsList';\nimport useCollection from '../../hooks/useCollection';\n\nconst CommentsField = ({ source, context, helperText, placeholder, userResource, mentions }) => {\n const record = useRecordContext();\n const { items: comments, loading, addItem, removeItem } = useCollection(record.replies);\n if (!userResource) throw new Error('No userResource defined for CommentsField');\n return (\n <>\n \n \n \n );\n};\n\nCommentsField.defaultProps = {\n label: 'Commentaires',\n placeholder: 'Commencez à taper votre commentaire...',\n source: 'id', // Ensure the field is always displayed\n context: 'id'\n};\n\nexport default CommentsField;\n","import React, { useState, useCallback } from 'react';\nimport { Form, useGetIdentity, useNotify, useRecordContext } from 'react-admin';\nimport { RichTextInput, DefaultEditorOptions } from 'ra-input-rich-text';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { Button, Box, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport SendIcon from '@mui/icons-material/Send';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AuthDialog } from '@semapps/auth-provider';\nimport { OBJECT_TYPES, PUBLIC_URI } from '../../constants';\nimport useOutbox from '../../hooks/useOutbox';\nimport CustomMention from './CustomMention';\n\nconst useStyles = makeStyles(theme => ({\n form: {\n marginTop: -12 // Negative margin to keep the form close to the label\n },\n container: {\n paddingLeft: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 16,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n editorContent: {\n '& > div': {\n backgroundColor: 'rgba(0, 0, 0, 0.09)',\n padding: '2px 12px',\n borderWidth: '0px !important',\n borderRadius: 0,\n borderBottom: '1px solid #FFF',\n minHeight: 60,\n outline: 'unset !important'\n },\n '& > div > p': {\n marginTop: 12,\n marginBottom: 12,\n fontFamily: theme.typography.body1.fontFamily,\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n },\n '& > div > p.is-editor-empty:first-child::before': {\n color: 'grey',\n content: 'attr(data-placeholder)',\n float: 'left',\n height: 0,\n pointerEvents: 'none'\n }\n },\n button: {\n marginTop: -10, // To go over helper text block\n marginBottom: 15\n }\n}));\n\nconst EmptyToolbar = () => null;\n\nconst PostCommentForm = ({ context, placeholder, helperText, mentions, userResource, addItem, removeItem }) => {\n const record = useRecordContext();\n const { data: identity, isLoading } = useGetIdentity();\n const userDataModel = useDataModel(userResource);\n const classes = useStyles();\n const notify = useNotify();\n const outbox = useOutbox();\n const [expanded, setExpanded] = useState(false);\n const [openAuth, setOpenAuth] = useState(false);\n\n const onSubmit = useCallback(\n async values => {\n const document = new DOMParser().parseFromString(values.comment, 'text/html');\n const mentions = Array.from(document.body.getElementsByClassName('mention'));\n const mentionedUsersUris = [];\n\n mentions.forEach(node => {\n const userUri = node.attributes['data-mention-id'].value;\n const userLabel = node.attributes['data-mention-label'].value;\n const link = document.createElement('a');\n link.setAttribute(\n 'href',\n `${new URL(window.location.href).origin}/${userResource}/${encodeURIComponent(userUri)}/show`\n );\n link.textContent = `@${userLabel}`;\n node.parentNode.replaceChild(link, node);\n mentionedUsersUris.push(userUri);\n });\n\n if (document.body.innerHTML === 'undefined') {\n notify('Votre commentaire est vide', { type: 'error' });\n } else {\n const tempId = Date.now();\n\n const note = {\n type: OBJECT_TYPES.NOTE,\n attributedTo: outbox.owner,\n content: document.body.innerHTML,\n inReplyTo: record[context],\n published: new Date().toISOString()\n };\n\n try {\n addItem({ id: tempId, ...note });\n // TODO reset the form\n setExpanded(false);\n await outbox.post({ ...note, to: [...mentionedUsersUris, PUBLIC_URI] });\n notify('Commentaire posté avec succès', { type: 'success' });\n } catch (e) {\n console.error(e);\n removeItem(tempId);\n notify(e.message, { type: 'error' });\n }\n }\n },\n [outbox, notify, setExpanded, addItem, removeItem]\n );\n\n const openAuthIfDisconnected = useCallback(() => {\n if (!identity?.id) {\n setOpenAuth(true);\n }\n }, [identity, setOpenAuth]);\n\n // Don't init the editor options until mentions and identity are loaded, as they can only be initialized once\n if ((mentions && !mentions.items) || isLoading) return null;\n\n return (\n <>\n
\n \n \n }\n fullWidth\n classes={{ editorContent: classes.editorContent }}\n editorOptions={{\n ...DefaultEditorOptions,\n onFocus() {\n setExpanded(true);\n },\n extensions: [\n ...DefaultEditorOptions.extensions,\n placeholder ? Placeholder.configure({ placeholder }) : null,\n mentions\n ? CustomMention.configure({\n HTMLAttributes: {\n class: 'mention'\n },\n suggestion: mentions\n })\n : null\n ],\n // Disable editor if user is not connected\n editable: !!identity?.id\n }}\n helperText={helperText}\n />\n {expanded && (\n }\n className={classes.button}\n >\n Envoyer\n \n )}\n \n
\n setOpenAuth(false)}\n message=\"Pour poster un commentaire, vous devez être connecté.\"\n />\n \n );\n};\n\nexport default PostCommentForm;\n","export const ACTIVITY_TYPES = {\n ACCEPT: 'Accept',\n ADD: 'Add',\n ANNOUNCE: 'Announce',\n ARRIVE: 'Arrive',\n BLOCK: 'Block',\n CREATE: 'Create',\n DELETE: 'Delete',\n DISLIKE: 'Dislike',\n FLAG: 'Flag',\n FOLLOW: 'Follow',\n IGNORE: 'Ignore',\n INVITE: 'Invite',\n JOIN: 'Join',\n LEAVE: 'Leave',\n LIKE: 'Like',\n LISTEN: 'Listen',\n MOVE: 'Move',\n OFFER: 'Offer',\n QUESTION: 'Question',\n REJECT: 'Reject',\n READ: 'Read',\n REMOVE: 'Remove',\n TENTATIVE_REJECT: 'TentativeReject',\n TENTATIVE_ACCEPT: 'TentativeAccept',\n TRAVEL: 'Travel',\n UNDO: 'Undo',\n UPDATE: 'Update',\n VIEW: 'View'\n};\n\nexport const ACTOR_TYPES = {\n APPLICATION: 'Application',\n GROUP: 'Group',\n ORGANIZATION: 'Organization',\n PERSON: 'Person',\n SERVICE: 'Service'\n};\n\nexport const OBJECT_TYPES = {\n ARTICLE: 'Article',\n AUDIO: 'Audio',\n DOCUMENT: 'Document',\n EVENT: 'Event',\n IMAGE: 'Image',\n NOTE: 'Note',\n PAGE: 'Page',\n PLACE: 'Place',\n PROFILE: 'Profile',\n RELATIONSHIP: 'Relationship',\n TOMBSTONE: 'Tombstone',\n VIDEO: 'Video'\n};\n\nexport const PUBLIC_URI = 'https://www.w3.org/ns/activitystreams#Public';\n","import { useCallback } from 'react';\nimport { useDataProvider, useGetIdentity } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch and post to the outbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `post`: a function to post a new activity in the user's outbox\n * - `awaitActivity`: a function to wait for a certain activity to be posted\n * - `owner`: the WebID of the outbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useoutbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useOutbox = (options: UseCollectionOptions = {}) => {\n const dataProvider = useDataProvider();\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('outbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async (activity: object) => {\n if (!url) {\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the isLoading argument of useOutbox'\n );\n }\n const { headers } = await dataProvider.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n })\n });\n return headers.get('Location');\n },\n [url, dataProvider]\n );\n\n return { url, items, awaitWebSocketConnection, post, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useOutbox;\n","import { useCallback, useMemo, useState, useEffect, useRef, RefObject } from 'react';\nimport { useGetIdentity, useDataProvider } from 'react-admin';\nimport { QueryFunction, useInfiniteQuery, useQueries, useQueryClient } from 'react-query';\nimport { getOrCreateWsChannel, SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { arrayOf } from '../utils';\nimport type { UseCollectionOptions, SolidNotification, AwaitActivityOptions } from '../types';\n\n// Used to avoid re-renders\nconst emptyArray: never[] = [];\n\nconst useItemsFromPages = (pages: any[], dereferenceItems: boolean) => {\n const dataProvider = useDataProvider();\n const items = useMemo(() => pages.flatMap(p => arrayOf(p.orderedItems || p.items)), [pages]);\n\n // We will force dereference, if some items are not URI string references.\n const shouldDereference = useMemo(() => {\n return dereferenceItems || items.some(item => typeof item !== 'string');\n }, [dereferenceItems, items]);\n\n // Dereference all items, if necessary (even if shouldDereference is false, the hook needs to be called).\n const itemQueries = useQueries(\n !shouldDereference\n ? emptyArray\n : items\n .filter(item => typeof item === 'string')\n .map(itemUri => ({\n queryKey: ['resource', itemUri],\n queryFn: async () => (await dataProvider.fetch(itemUri)).json,\n staleTime: Infinity\n }))\n );\n\n if (!shouldDereference) {\n return { loadedItems: items, isLoading: false, isFetching: false };\n }\n\n // Put all loaded items together (might be dereferenced already, so concatenate).\n const loadedItems = items\n .filter(item => typeof item !== 'string')\n .concat(\n itemQueries.flatMap(itemQuery => {\n return (itemQuery.isSuccess && itemQuery.data) || [];\n })\n );\n\n const errors = itemQueries.filter(q => q.error);\n return {\n loadedItems,\n isLoading: itemQueries.some(q => q.isLoading),\n isFetching: itemQueries.some(q => q.isFetching),\n errors: errors.length > 0 ? errors : undefined\n };\n};\n\n/**\n * Subscribe a collection. Supports pagination.\n * @param predicateOrUrl The collection URI or the predicate to get the collection URI from the identity (webId).\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useCollection = (predicateOrUrl: string, options: UseCollectionOptions = {}) => {\n const { dereferenceItems = false, liveUpdates = false } = options;\n const { data: identity } = useGetIdentity();\n const [totalItems, setTotalItems] = useState(0);\n const queryClient = useQueryClient();\n const [hasLiveUpdates, setHasLiveUpdates] = useState<{ status: string; error?: any }>({\n status: 'connecting'\n });\n const dataProvider = useDataProvider();\n const webSocketRef = useRef(null);\n\n // Get collectionUrl from webId predicate or URL.\n const collectionUrl = useMemo(() => {\n if (predicateOrUrl) {\n if (predicateOrUrl.startsWith('http')) {\n return predicateOrUrl;\n }\n if (identity?.webIdData) {\n return identity?.webIdData?.[predicateOrUrl];\n }\n }\n return undefined;\n // throw new Error(`No URL available for useCollection: ${predicateOrUrl}.`);\n }, [identity, predicateOrUrl]);\n\n // Fetch page of collection item references (if pageParam provided)\n // or default to `collectionUrl` (which should give you the first page).\n const fetchCollection: QueryFunction = useCallback(\n async ({ pageParam: nextPageUrl }) => {\n // Fetch page or first page (collectionUrl)\n let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);\n if (json.totalItems) setTotalItems(json.totalItems);\n\n // If first page, handle this here.\n if ((json.type === 'OrderedCollection' || json.type === 'Collection') && json.first) {\n if (json.first?.items) {\n if (json.first?.items.length === 0 && json.first?.next) {\n // Special case where the first property is an object without items\n ({ json } = await dataProvider.fetch(json.first?.next));\n } else {\n json = json.first;\n }\n } else {\n // Fetch the first page\n ({ json } = await dataProvider.fetch(json.first));\n }\n }\n\n return json;\n },\n [dataProvider, collectionUrl, identity, setTotalItems]\n );\n\n // Use infiniteQuery to handle pagination, fetching, etc.\n const {\n data: pageData,\n error: collectionError,\n fetchNextPage,\n refetch,\n hasNextPage,\n isLoading: isLoadingPage,\n isFetching: isFetchingPage,\n isFetchingNextPage\n } = useInfiniteQuery(['collection', { collectionUrl }], fetchCollection, {\n enabled: !!(collectionUrl && identity?.id),\n getNextPageParam: (lastPage: any) => lastPage.next,\n getPreviousPageParam: (firstPage: any) => firstPage.prev\n });\n\n // Put all items together in a list (and dereference, if required).\n const {\n loadedItems: items,\n isLoading: isLoadingItems,\n isFetching: isFetchingItems,\n errors: itemErrors\n } = useItemsFromPages(pageData?.pages ?? emptyArray, dereferenceItems);\n\n const allErrors = arrayOf(collectionError).concat(arrayOf(itemErrors));\n\n const addItem = useCallback(\n (item: string | any, shouldRefetch: boolean | number = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems + 1);\n\n // Destructure, so react knows, it needs to re-render the pages.\n const pages = [...oldData.pages];\n\n if (pages?.[0]?.orderedItems) {\n pages[0].orderedItems = [item, ...arrayOf(pages[0].orderedItems)];\n } else if (pages?.[0]?.items) {\n pages[0].items = [item, ...arrayOf(pages[0].items)];\n }\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n const removeItem = useCallback(\n (item: string | any, shouldRefetch: boolean = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems - 1);\n\n // Destructure, so react knows, it needs to re-render the pages array.\n const pages = [...oldData.pages];\n // Find the item in all pages and remove the item to be removed (either item.id or just item)\n pages.forEach(page => {\n if (page.orderedItems) {\n page.orderedItems = arrayOf(page.orderedItems).filter((i: any) => (i.id || i) !== (item.id || item));\n } else if (page.items) {\n page.items = arrayOf(page.items).filter((i: any) => (i.id || i) !== (item?.id || item));\n }\n });\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n // Live Updates\n useEffect(() => {\n if (liveUpdates && collectionUrl) {\n // Create ws that listens to collectionUri changes\n getOrCreateWsChannel(dataProvider.fetch, collectionUrl)\n .then(ws => {\n webSocketRef.current = ws; // Keep a ref to the webSocket so that it can be used elsewhere\n webSocketRef.current.addEventListener('message', e => {\n const data: SolidNotification = JSON.parse(e.data);\n if (data.type === 'Add') {\n addItem(data.object, true);\n } else if (data.type === 'Remove') {\n removeItem(data.object, true);\n }\n });\n webSocketRef.current.addEventListener('error', e => {\n setHasLiveUpdates({ status: 'error', error: e });\n // TODO: Retry after a while\n });\n webSocketRef.current.addEventListener('close', e => {\n if (!hasLiveUpdates.error) {\n setHasLiveUpdates({ ...hasLiveUpdates, status: 'closed' });\n }\n });\n setHasLiveUpdates({ status: 'connected' });\n })\n .catch(() => {}); // If it fails, we won't receive live updates. But that's okay.\n }\n }, [collectionUrl, liveUpdates, dataProvider, webSocketRef, addItem, removeItem, setHasLiveUpdates]);\n\n const awaitWebSocketConnection = useCallback(\n (options: AwaitActivityOptions = {}): Promise> => {\n const { timeout = 30000 } = options;\n if (!liveUpdates)\n throw new Error(`Cannot call awaitWebSocketConnection because the liveUpdates option is set to false`);\n return new Promise((resolve, reject) => {\n if (webSocketRef?.current) {\n resolve(webSocketRef);\n } else {\n const timeoutId = setTimeout(() => {\n reject(`No WebSocket connection found within ${Math.round(timeout / 1000)}s`);\n }, timeout);\n const intervalId = setInterval(() => {\n if (webSocketRef?.current) {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n resolve(webSocketRef);\n } else {\n console.log('WebSocket is not initialized yet, waiting...');\n }\n }, 100);\n }\n });\n },\n [webSocketRef, liveUpdates]\n );\n\n return {\n items,\n totalItems,\n error: allErrors.length > 0 && allErrors,\n refetch,\n fetchNextPage,\n addItem,\n removeItem,\n hasNextPage,\n isLoading: isLoadingPage || isLoadingItems,\n isFetching: isFetchingPage || isFetchingItems,\n isFetchingNextPage,\n url: collectionUrl,\n hasLiveUpdates,\n awaitWebSocketConnection,\n webSocketRef\n };\n};\n\nexport default useCollection;\n","export const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (value === null || value === undefined) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default {\n arrayOf\n};\n\nexport const filterDuplicates = (iterable: T[], predicate: (item: T) => string) => {\n const seen = new Set();\n return iterable.filter(item => {\n const key = predicate(item);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n};\n","import { RefObject, useCallback } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { SolidNotification, AwaitActivityOptions, AwaitWebSocketConnectionOptions } from '../types';\n\n/**\n * Hook used internally by useInbox and useOutbox. This is not exported.\n * @param awaitWebSocketConnection Promise returning the WebSocket which allow to listen to the inbox or outbox\n * @param existingActivities Partial list of activities already received in the inbox and outbox\n */\nconst useAwaitActivity = (\n awaitWebSocketConnection: (options?: AwaitWebSocketConnectionOptions) => Promise>,\n existingActivities?: Array\n) => {\n const dataProvider = useDataProvider();\n\n // TODO Allow to pass an object, and automatically dereference it if required, like on the @semapps/activitypub matchActivity util\n return useCallback(\n (matchActivity: (activity: object) => boolean, options: AwaitActivityOptions = {}) => {\n const { timeout = 30000, checkExistingActivities = false } = options;\n return new Promise((resolve, reject) => {\n awaitWebSocketConnection()\n .then(webSocketRef => {\n const onMessage = (event: MessageEvent) => {\n const data: SolidNotification = JSON.parse(event.data);\n if (data.type === 'Add') {\n dataProvider.fetch(data.object).then(({ json }) => {\n if (matchActivity(json)) {\n removeListeners();\n return resolve(json);\n }\n });\n }\n };\n const onError = (e: Event) => {\n // TODO reconnect if connection closed\n removeListeners();\n reject(e);\n };\n const onClose = (e: CloseEvent) => {\n removeListeners();\n reject(new Error(`${e.reason} (Code: ${e.code})`));\n };\n\n const removeListeners = () => {\n webSocketRef.current?.removeEventListener('message', onMessage);\n webSocketRef.current?.removeEventListener('error', onError);\n webSocketRef.current?.removeEventListener('close', onClose);\n };\n\n webSocketRef.current?.addEventListener('message', onMessage);\n webSocketRef.current?.addEventListener('error', onError);\n webSocketRef.current?.addEventListener('close', onClose);\n\n // If a list of activities is already loaded, verify if there is a match\n if (existingActivities && checkExistingActivities) {\n for (const a of existingActivities) {\n if (typeof a !== 'string') {\n if (matchActivity(a)) {\n removeListeners();\n return resolve(a);\n }\n }\n }\n }\n\n setTimeout(() => {\n removeListeners();\n reject(new Error('Timeout'));\n }, timeout);\n })\n .catch(e => {\n reject(e);\n });\n });\n },\n [awaitWebSocketConnection, existingActivities, dataProvider]\n );\n};\n\nexport default useAwaitActivity;\n","import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\n\n// Fix a bug in the current version of the mention extension\n// (The { id, label } object is located inside the id property)\n// See https://github.com/ueberdosis/tiptap/pull/1322\nconst CustomMention = Mention.extend({\n renderHTML({ node, HTMLAttributes }) {\n return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), `@${node.attrs.id.label}`];\n },\n addAttributes() {\n return {\n label: {\n default: null,\n parseHTML: element => {\n return {\n label: element.getAttribute('data-mention-label')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.label) {\n return {};\n }\n return {\n 'data-mention-label': attributes.id.label\n };\n }\n },\n id: {\n default: null,\n parseHTML: element => {\n return {\n id: element.getAttribute('data-mention-id')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.id) {\n return {};\n }\n return {\n 'data-mention-id': attributes.id.id\n };\n }\n }\n };\n }\n});\n\nexport default CustomMention;\n","import React from 'react';\nimport { TextField, RichTextField, DateField } from 'react-admin';\nimport { Box, Typography, CircularProgress } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AvatarWithLabelField, ReferenceField } from '@semapps/field-components';\n\nconst useStyles = makeStyles(() => ({\n container: {\n paddingLeft: 80,\n marginTop: 8,\n minHeight: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n text: {\n paddingTop: 2,\n paddingBottom: 8\n },\n label: {\n fontWeight: 'bold'\n },\n content: {\n '& p': {\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n }\n },\n loading: {\n zIndex: 1000,\n backgroundColor: 'white',\n opacity: 0.5,\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 200,\n marginTop: 5\n }\n}));\n\nconst CommentsList = ({ comments, userResource, loading }) => {\n const classes = useStyles();\n const userDataModel = useDataModel(userResource);\n return (\n \n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n \n \n \n \n \n \n \n \n \n \n \n  • \n \n \n \n \n \n ))}\n {loading && (\n \n \n \n \n \n )}\n \n );\n};\n\nexport default CommentsList;\n","import React from 'react';\nimport { useList, ListContextProvider, useGetMany } from 'react-admin';\nimport useCollection from '../hooks/useCollection';\n\nconst CollectionList = ({ collectionUrl, resource, children }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n const { items: actorsUris } = useCollection(collectionUrl);\n\n const { data, isLoading, isFetching } = useGetMany(\n resource,\n { ids: Array.isArray(actorsUris) ? actorsUris : [actorsUris] },\n { enabled: !!actorsUris }\n );\n\n const listContext = useList({ data, isLoading, isFetching });\n\n return {children};\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, reference, children, ...rest }) => {\n const record = useRecordContext();\n\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n \n {children}\n \n );\n};\n\nexport default ReferenceCollectionField;\n","import { useGetIdentity } from 'react-admin';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch the inbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `awaitActivity`: a function to wait for a certain activity to be received\n * - `owner`: the WebID of the inbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useinbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useInbox = (options: UseCollectionOptions = {}) => {\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('inbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n return { url, items, awaitWebSocketConnection, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\nimport type { NodeInfo, NodeInfoLinks } from '../types';\n\nconst useNodeinfo = (host?: string, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\n if (host && rel) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are likely on HTTP\n const nodeinfoUrl = `${protocol}://${host}/.well-known/nodeinfo`;\n\n try {\n const { json: links }: { json: NodeInfoLinks } = await fetchUtils.fetchJson(nodeinfoUrl);\n\n // Accept any version of the nodeinfo protocol\n const link = links?.links?.find(l => l.rel === rel);\n\n if (link) {\n const { json }: { json: NodeInfo } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n }\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\n }\n }\n })();\n }, [host, setSchema, rel]);\n\n return schema;\n};\n\nexport default useNodeinfo;\n","import { useCallback } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useWebfinger = () => {\n // Post an activity to the logged user's outbox and return its URI\n const fetch = useCallback(async id => {\n // eslint-disable-next-line\n const [_, username, host] = id.split('@');\n if (host) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are most likely on localhost\n const webfingerUrl = `${protocol}://${host}/.well-known/webfinger?resource=acct:${username}@${host}`;\n\n try {\n const { json } = await fetchUtils.fetchJson(webfingerUrl);\n\n const link = json.links.find(l => l.type === 'application/activity+json');\n\n return link ? link.href : null;\n } catch (e) {\n return null;\n }\n } else {\n return null;\n }\n }, []);\n\n return { fetch };\n};\n\nexport default useWebfinger;\n","import { useMemo } from 'react';\nimport { useGetList } from 'react-admin';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport renderMentions from './renderMentions';\n\nconst useMentions = userResource => {\n const userDataModel = useDataModel(userResource);\n\n const { data } = useGetList(\n userResource,\n {\n filter: {\n _predicates: [userDataModel?.fieldsMapping?.title],\n blankNodes: []\n }\n },\n {\n enabled: !!userDataModel?.fieldsMapping?.title\n }\n );\n\n const availableMentions = useMemo(() => {\n if (data) {\n return data.map(item => ({ id: item.id, label: item[userDataModel?.fieldsMapping?.title] }));\n }\n }, [data]);\n\n const items = useMemo(() => {\n if (availableMentions) {\n return ({ query }) => {\n return availableMentions.filter(({ label }) => label.toLowerCase().startsWith(query.toLowerCase())).slice(0, 5);\n };\n }\n }, [availableMentions]);\n\n return {\n items,\n render: renderMentions\n };\n};\n\nexport default useMentions;\n","import { ReactRenderer } from '@tiptap/react';\nimport tippy from 'tippy.js';\nimport MentionsList from './MentionsList';\n\nconst renderMentions = () => {\n let component;\n let popup;\n\n return {\n onStart: props => {\n component = new ReactRenderer(MentionsList, {\n props,\n editor: props.editor\n });\n\n popup = tippy('body', {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: 'manual',\n placement: 'bottom-start'\n });\n },\n\n onUpdate(props) {\n component.updateProps(props);\n\n popup[0].setProps({\n getReferenceClientRect: props.clientRect\n });\n },\n\n onKeyDown(props) {\n if (props.event.key === 'Escape') {\n popup[0].hide();\n\n return true;\n }\n\n return component.ref?.onKeyDown(props);\n },\n\n onExit() {\n popup[0].destroy();\n component.destroy();\n }\n };\n};\n\nexport default renderMentions;\n","import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useStyles = makeStyles(theme => ({\n items: {\n background: '#fff',\n borderRadius: '0.5rem',\n boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1)',\n color: 'rgba(0, 0, 0, 0.8)',\n fontSize: '0.9rem',\n overflow: 'hidden',\n padding: '0.2rem',\n position: 'relative'\n },\n item: {\n background: 'transparent',\n border: '1px solid transparent',\n borderRadius: '0.4rem',\n display: 'block',\n margin: 0,\n padding: '0.2rem 0.4rem',\n textAlign: 'left',\n width: '100%',\n '&.selected': {\n borderColor: '#000'\n }\n }\n}));\n\nexport default forwardRef((props, ref) => {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const classes = useStyles();\n\n const selectItem = index => {\n const item = props.items[index];\n\n if (item) {\n props.command({ id: item });\n }\n };\n\n const upHandler = () => {\n setSelectedIndex((selectedIndex + props.items.length - 1) % props.items.length);\n };\n\n const downHandler = () => {\n setSelectedIndex((selectedIndex + 1) % props.items.length);\n };\n\n const enterHandler = () => {\n selectItem(selectedIndex);\n };\n\n useEffect(() => setSelectedIndex(0), [props.items]);\n\n useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }) => {\n if (event.key === 'ArrowUp') {\n upHandler();\n return true;\n }\n\n if (event.key === 'ArrowDown') {\n downHandler();\n return true;\n }\n\n if (event.key === 'Enter') {\n enterHandler();\n return true;\n }\n\n return false;\n }\n }));\n\n return (\n
\n {props.items.length ? (\n props.items.map((item, index) => (\n selectItem(index)}\n >\n {item.label}\n \n ))\n ) : (\n
Aucun résultat
\n )}\n
\n );\n});\n"],"names":[],"version":3,"file":"index.es.js.map"} \ No newline at end of file +{"mappings":";;;;;;;;;;;;;;;;;AAAA,aAAa;;;;;;;;;;;;;;AGAN,MAAM,4CAAiB;IAC5B,QAAQ;IACR,KAAK;IACL,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,MAAM;IACN,OAAO;IACP,UAAU;IACV,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,kBAAkB;IAClB,kBAAkB;IAClB,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,MAAM;AACR;AAEO,MAAM,4CAAc;IACzB,aAAa;IACb,OAAO;IACP,cAAc;IACd,QAAQ;IACR,SAAS;AACX;AAEO,MAAM,4CAAe;IAC1B,SAAS;IACT,OAAO;IACP,UAAU;IACV,OAAO;IACP,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,SAAS;IACT,cAAc;IACd,WAAW;IACX,OAAO;AACT;AAEO,MAAM,4CAAa;;;;;;;;;AGtDnB,MAAM,4CAAU,CAAI;IACzB,4DAA4D;IAC5D,IAAI,UAAU,QAAQ,UAAU,WAC9B,OAAO,EAAE;IAEX,gBAAgB;IAChB,IAAI,MAAM,OAAO,CAAC,QAChB,OAAO;IAET,iCAAiC;IACjC,OAAO;QAAC;KAAM;AAChB;IAEA,2CAAe;aACb;AACF;AAEO,MAAM,4CAAmB,CAAI,UAAe;IACjD,M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AU,CAAC,MAAM,WAAW,KAAK,KAAK,CAAC,GAAG;QAC/G;IAEJ,GAAG;QAAC;KAAkB;IAEtB,OAAO;eACL;QACA,QAAQ,CAAA,GAAA,wCAAa;IACvB;AACF;IAEA,2CAAe;","sources":["packages/activitypub-components/src/index.ts","packages/activitypub-components/src/components/CommentsField/CommentsField.js","packages/activitypub-components/src/components/CommentsField/PostCommentForm.js","packages/activitypub-components/src/constants.js","packages/activitypub-components/src/hooks/useOutbox.ts","packages/activitypub-components/src/hooks/useCollection.ts","packages/activitypub-components/src/utils.ts","packages/activitypub-components/src/hooks/useAwaitActivity.ts","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.ts","packages/activitypub-components/src/hooks/useNodeinfo.ts","packages/activitypub-components/src/hooks/useWebfinger.js","packages/activitypub-components/src/hooks/useMentions/useMentions.js","packages/activitypub-components/src/hooks/useMentions/renderMentions.js","packages/activitypub-components/src/hooks/useMentions/MentionsList.js"],"sourcesContent":["// Components\nexport { default as CommentsField } from './components/CommentsField/CommentsField';\nexport { default as CollectionList } from './components/CollectionList';\nexport { default as ReferenceCollectionField } from './components/ReferenceCollectionField';\n\n// Hooks\nexport { default as useCollection } from './hooks/useCollection';\nexport { default as useInbox } from './hooks/useInbox';\nexport { default as useNodeinfo } from './hooks/useNodeinfo';\nexport { default as useOutbox } from './hooks/useOutbox';\nexport { default as useWebfinger } from './hooks/useWebfinger';\nexport { default as useMentions } from './hooks/useMentions/useMentions';\n\n// Constants\nexport { ACTIVITY_TYPES, ACTOR_TYPES, OBJECT_TYPES, PUBLIC_URI } from './constants';\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport PostCommentForm from './PostCommentForm';\nimport CommentsList from './CommentsList';\nimport useCollection from '../../hooks/useCollection';\n\nconst CommentsField = ({ source, context, helperText, placeholder, userResource, mentions }) => {\n const record = useRecordContext();\n const { items: comments, loading, addItem, removeItem } = useCollection(record.replies);\n if (!userResource) throw new Error('No userResource defined for CommentsField');\n return (\n <>\n \n \n \n );\n};\n\nCommentsField.defaultProps = {\n label: 'Commentaires',\n placeholder: 'Commencez à taper votre commentaire...',\n source: 'id', // Ensure the field is always displayed\n context: 'id'\n};\n\nexport default CommentsField;\n","import React, { useState, useCallback } from 'react';\nimport { Form, useGetIdentity, useNotify, useRecordContext } from 'react-admin';\nimport { RichTextInput, DefaultEditorOptions } from 'ra-input-rich-text';\nimport Placeholder from '@tiptap/extension-placeholder';\nimport { Button, Box, Avatar } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport SendIcon from '@mui/icons-material/Send';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AuthDialog } from '@semapps/auth-provider';\nimport { OBJECT_TYPES, PUBLIC_URI } from '../../constants';\nimport useOutbox from '../../hooks/useOutbox';\nimport CustomMention from './CustomMention';\n\nconst useStyles = makeStyles(theme => ({\n form: {\n marginTop: -12 // Negative margin to keep the form close to the label\n },\n container: {\n paddingLeft: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 16,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n editorContent: {\n '& > div': {\n backgroundColor: 'rgba(0, 0, 0, 0.09)',\n padding: '2px 12px',\n borderWidth: '0px !important',\n borderRadius: 0,\n borderBottom: '1px solid #FFF',\n minHeight: 60,\n outline: 'unset !important'\n },\n '& > div > p': {\n marginTop: 12,\n marginBottom: 12,\n fontFamily: theme.typography.body1.fontFamily,\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n },\n '& > div > p.is-editor-empty:first-child::before': {\n color: 'grey',\n content: 'attr(data-placeholder)',\n float: 'left',\n height: 0,\n pointerEvents: 'none'\n }\n },\n button: {\n marginTop: -10, // To go over helper text block\n marginBottom: 15\n }\n}));\n\nconst EmptyToolbar = () => null;\n\nconst PostCommentForm = ({ context, placeholder, helperText, mentions, userResource, addItem, removeItem }) => {\n const record = useRecordContext();\n const { data: identity, isLoading } = useGetIdentity();\n const userDataModel = useDataModel(userResource);\n const classes = useStyles();\n const notify = useNotify();\n const outbox = useOutbox();\n const [expanded, setExpanded] = useState(false);\n const [openAuth, setOpenAuth] = useState(false);\n\n const onSubmit = useCallback(\n async values => {\n const document = new DOMParser().parseFromString(values.comment, 'text/html');\n const mentions = Array.from(document.body.getElementsByClassName('mention'));\n const mentionedUsersUris = [];\n\n mentions.forEach(node => {\n const userUri = node.attributes['data-mention-id'].value;\n const userLabel = node.attributes['data-mention-label'].value;\n const link = document.createElement('a');\n link.setAttribute(\n 'href',\n `${new URL(window.location.href).origin}/${userResource}/${encodeURIComponent(userUri)}/show`\n );\n link.textContent = `@${userLabel}`;\n node.parentNode.replaceChild(link, node);\n mentionedUsersUris.push(userUri);\n });\n\n if (document.body.innerHTML === 'undefined') {\n notify('Votre commentaire est vide', { type: 'error' });\n } else {\n const tempId = Date.now();\n\n const note = {\n type: OBJECT_TYPES.NOTE,\n attributedTo: outbox.owner,\n content: document.body.innerHTML,\n inReplyTo: record[context],\n published: new Date().toISOString()\n };\n\n try {\n addItem({ id: tempId, ...note });\n // TODO reset the form\n setExpanded(false);\n await outbox.post({ ...note, to: [...mentionedUsersUris, PUBLIC_URI] });\n notify('Commentaire posté avec succès', { type: 'success' });\n } catch (e) {\n console.error(e);\n removeItem(tempId);\n notify(e.message, { type: 'error' });\n }\n }\n },\n [outbox, notify, setExpanded, addItem, removeItem]\n );\n\n const openAuthIfDisconnected = useCallback(() => {\n if (!identity?.id) {\n setOpenAuth(true);\n }\n }, [identity, setOpenAuth]);\n\n // Don't init the editor options until mentions and identity are loaded, as they can only be initialized once\n if ((mentions && !mentions.items) || isLoading) return null;\n\n return (\n <>\n
\n \n \n }\n fullWidth\n classes={{ editorContent: classes.editorContent }}\n editorOptions={{\n ...DefaultEditorOptions,\n onFocus() {\n setExpanded(true);\n },\n extensions: [\n ...DefaultEditorOptions.extensions,\n placeholder ? Placeholder.configure({ placeholder }) : null,\n mentions\n ? CustomMention.configure({\n HTMLAttributes: {\n class: 'mention'\n },\n suggestion: mentions\n })\n : null\n ],\n // Disable editor if user is not connected\n editable: !!identity?.id\n }}\n helperText={helperText}\n />\n {expanded && (\n }\n className={classes.button}\n >\n Envoyer\n \n )}\n \n
\n setOpenAuth(false)}\n message=\"Pour poster un commentaire, vous devez être connecté.\"\n />\n \n );\n};\n\nexport default PostCommentForm;\n","export const ACTIVITY_TYPES = {\n ACCEPT: 'Accept',\n ADD: 'Add',\n ANNOUNCE: 'Announce',\n ARRIVE: 'Arrive',\n BLOCK: 'Block',\n CREATE: 'Create',\n DELETE: 'Delete',\n DISLIKE: 'Dislike',\n FLAG: 'Flag',\n FOLLOW: 'Follow',\n IGNORE: 'Ignore',\n INVITE: 'Invite',\n JOIN: 'Join',\n LEAVE: 'Leave',\n LIKE: 'Like',\n LISTEN: 'Listen',\n MOVE: 'Move',\n OFFER: 'Offer',\n QUESTION: 'Question',\n REJECT: 'Reject',\n READ: 'Read',\n REMOVE: 'Remove',\n TENTATIVE_REJECT: 'TentativeReject',\n TENTATIVE_ACCEPT: 'TentativeAccept',\n TRAVEL: 'Travel',\n UNDO: 'Undo',\n UPDATE: 'Update',\n VIEW: 'View'\n};\n\nexport const ACTOR_TYPES = {\n APPLICATION: 'Application',\n GROUP: 'Group',\n ORGANIZATION: 'Organization',\n PERSON: 'Person',\n SERVICE: 'Service'\n};\n\nexport const OBJECT_TYPES = {\n ARTICLE: 'Article',\n AUDIO: 'Audio',\n DOCUMENT: 'Document',\n EVENT: 'Event',\n IMAGE: 'Image',\n NOTE: 'Note',\n PAGE: 'Page',\n PLACE: 'Place',\n PROFILE: 'Profile',\n RELATIONSHIP: 'Relationship',\n TOMBSTONE: 'Tombstone',\n VIDEO: 'Video'\n};\n\nexport const PUBLIC_URI = 'https://www.w3.org/ns/activitystreams#Public';\n","import { useCallback } from 'react';\nimport { useDataProvider, useGetIdentity } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch and post to the outbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `post`: a function to post a new activity in the user's outbox\n * - `awaitActivity`: a function to wait for a certain activity to be posted\n * - `owner`: the WebID of the outbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useoutbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useOutbox = (options: UseCollectionOptions = {}) => {\n const dataProvider = useDataProvider();\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('outbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async (activity: object) => {\n if (!url) {\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the isLoading argument of useOutbox'\n );\n }\n const { headers } = await dataProvider.fetch(url, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n })\n });\n return headers.get('Location');\n },\n [url, dataProvider]\n );\n\n return { url, items, awaitWebSocketConnection, post, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useOutbox;\n","import { useCallback, useMemo, useState, useEffect, useRef, RefObject } from 'react';\nimport { useGetIdentity, useDataProvider } from 'react-admin';\nimport { QueryFunction, useInfiniteQuery, useQueries, useQueryClient } from 'react-query';\nimport { getOrCreateWsChannel, SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { arrayOf } from '../utils';\nimport type { UseCollectionOptions, SolidNotification, AwaitActivityOptions } from '../types';\n\n// Used to avoid re-renders\nconst emptyArray: never[] = [];\n\nconst useItemsFromPages = (pages: any[], dereferenceItems: boolean) => {\n const dataProvider = useDataProvider();\n const items = useMemo(() => pages.flatMap(p => arrayOf(p.orderedItems || p.items)), [pages]);\n\n // We will force dereference, if some items are not URI string references.\n const shouldDereference = useMemo(() => {\n return dereferenceItems || items.some(item => typeof item !== 'string');\n }, [dereferenceItems, items]);\n\n // Dereference all items, if necessary (even if shouldDereference is false, the hook needs to be called).\n const itemQueries = useQueries(\n !shouldDereference\n ? emptyArray\n : items\n .filter(item => typeof item === 'string')\n .map(itemUri => ({\n queryKey: ['resource', itemUri],\n queryFn: async () => (await dataProvider.fetch(itemUri)).json,\n staleTime: Infinity // Activities are immutable, so no need to refetch..\n }))\n );\n\n // Put all loaded items together (might be dereferenced already, so concatenate).\n const loadedItems = useMemo(\n () =>\n items\n .filter(item => typeof item !== 'string')\n .concat(\n itemQueries.flatMap(itemQuery => {\n return (itemQuery.isSuccess && itemQuery.data) || [];\n })\n ),\n [items, itemQueries]\n );\n\n const errors = useMemo(() => itemQueries.filter(q => q.error), [itemQueries]);\n\n const isLoading = itemQueries.some(q => q.isLoading);\n const isFetching = itemQueries.some(q => q.isFetching);\n const errorsFormatted = useMemo(() => (errors.length > 0 ? errors : undefined), [errors]);\n\n return useMemo(\n () => ({\n loadedItems,\n isLoading,\n isFetching,\n errors: errorsFormatted\n }),\n [loadedItems, itemQueries, errorsFormatted]\n );\n};\n\n/**\n * Subscribe a collection. Supports pagination.\n * @param predicateOrUrl The collection URI or the predicate to get the collection URI from the identity (webId).\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useCollection = (predicateOrUrl: string, options: UseCollectionOptions = {}) => {\n const { dereferenceItems = false, liveUpdates = false } = options;\n const { data: identity } = useGetIdentity();\n const [totalItems, setTotalItems] = useState(0);\n const queryClient = useQueryClient();\n const [hasLiveUpdates, setHasLiveUpdates] = useState<{ status: string; error?: any }>({\n status: 'connecting'\n });\n const dataProvider = useDataProvider();\n const webSocketRef = useRef(null);\n\n // Get collectionUrl from webId predicate or URL.\n const collectionUrl = useMemo(() => {\n if (predicateOrUrl) {\n if (predicateOrUrl.startsWith('http')) {\n return predicateOrUrl;\n }\n if (identity?.webIdData) {\n return identity?.webIdData?.[predicateOrUrl];\n }\n }\n return undefined;\n // throw new Error(`No URL available for useCollection: ${predicateOrUrl}.`);\n }, [identity, predicateOrUrl]);\n\n // Fetch page of collection item references (if pageParam provided)\n // or default to `collectionUrl` (which should give you the first page).\n const fetchCollection: QueryFunction = useCallback(\n async ({ pageParam: nextPageUrl }) => {\n // Fetch page or first page (collectionUrl)\n let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);\n if (json.totalItems) setTotalItems(json.totalItems);\n\n // If first page, handle this here.\n if ((json.type === 'OrderedCollection' || json.type === 'Collection') && json.first) {\n if (json.first?.items) {\n if (json.first?.items.length === 0 && json.first?.next) {\n // Special case where the first property is an object without items\n ({ json } = await dataProvider.fetch(json.first?.next));\n } else {\n json = json.first;\n }\n } else {\n // Fetch the first page\n ({ json } = await dataProvider.fetch(json.first));\n }\n }\n\n return json;\n },\n [dataProvider, collectionUrl, identity, setTotalItems]\n );\n\n // Use infiniteQuery to handle pagination, fetching, etc.\n const {\n data: pageData,\n error: collectionError,\n fetchNextPage,\n refetch,\n hasNextPage,\n isLoading: isLoadingPage,\n isFetching: isFetchingPage,\n isFetchingNextPage\n } = useInfiniteQuery(['collection', { collectionUrl }], fetchCollection, {\n enabled: !!(collectionUrl && identity?.id),\n getNextPageParam: (lastPage: any) => lastPage.next,\n getPreviousPageParam: (firstPage: any) => firstPage.prev\n });\n\n // Put all items together in a list (and dereference, if required).\n const {\n loadedItems: items,\n isLoading: isLoadingItems,\n isFetching: isFetchingItems,\n errors: itemErrors\n } = useItemsFromPages(pageData?.pages ?? emptyArray, dereferenceItems);\n\n const allErrors = useMemo(() => arrayOf(collectionError).concat(arrayOf(itemErrors)), [collectionError, itemErrors]);\n\n const addItem = useCallback(\n (item: string | any, shouldRefetch: boolean | number = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems + 1);\n\n // Destructure, so react knows, it needs to re-render the pages.\n const pages = [...oldData.pages];\n\n if (pages?.[0]?.orderedItems) {\n pages[0].orderedItems = [item, ...arrayOf(pages[0].orderedItems)];\n } else if (pages?.[0]?.items) {\n pages[0].items = [item, ...arrayOf(pages[0].items)];\n }\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n const removeItem = useCallback(\n (item: string | any, shouldRefetch: boolean = true) => {\n queryClient.setQueryData(['collection', { collectionUrl }], (oldData: any) => {\n if (!oldData) return oldData;\n setTotalItems(totalItems => totalItems - 1);\n\n // Destructure, so react knows, it needs to re-render the pages array.\n const pages = [...oldData.pages];\n // Find the item in all pages and remove the item to be removed (either item.id or just item)\n pages.forEach(page => {\n if (page.orderedItems) {\n page.orderedItems = arrayOf(page.orderedItems).filter((i: any) => (i.id || i) !== (item.id || item));\n } else if (page.items) {\n page.items = arrayOf(page.items).filter((i: any) => (i.id || i) !== (item?.id || item));\n }\n });\n\n oldData.pages = pages;\n return oldData;\n });\n if (shouldRefetch) {\n setTimeout(\n () =>\n queryClient.refetchQueries(['collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n typeof shouldRefetch === 'number' ? shouldRefetch : 2000\n );\n }\n },\n [queryClient, collectionUrl, setTotalItems]\n );\n\n // Live Updates\n useEffect(() => {\n if (liveUpdates && collectionUrl) {\n // Create ws that listens to collectionUri changes\n getOrCreateWsChannel(dataProvider.fetch, collectionUrl)\n .then(ws => {\n webSocketRef.current = ws; // Keep a ref to the webSocket so that it can be used elsewhere\n webSocketRef.current.addEventListener('message', e => {\n const data: SolidNotification = JSON.parse(e.data);\n if (data.type === 'Add') {\n addItem(data.object, true);\n } else if (data.type === 'Remove') {\n removeItem(data.object, true);\n }\n });\n webSocketRef.current.addEventListener('error', e => {\n setHasLiveUpdates({ status: 'error', error: e });\n // TODO: Retry after a while\n });\n webSocketRef.current.addEventListener('close', e => {\n if (!hasLiveUpdates.error) {\n setHasLiveUpdates({ ...hasLiveUpdates, status: 'closed' });\n }\n });\n setHasLiveUpdates({ status: 'connected' });\n })\n .catch(() => {}); // If it fails, we won't receive live updates. But that's okay.\n }\n }, [collectionUrl, liveUpdates, dataProvider, webSocketRef, addItem, removeItem, setHasLiveUpdates]);\n\n const awaitWebSocketConnection = useCallback(\n (options: AwaitActivityOptions = {}): Promise> => {\n const { timeout = 30000 } = options;\n if (!liveUpdates)\n throw new Error(`Cannot call awaitWebSocketConnection because the liveUpdates option is set to false`);\n return new Promise((resolve, reject) => {\n if (webSocketRef?.current) {\n resolve(webSocketRef);\n } else {\n const timeoutId = setTimeout(() => {\n reject(`No WebSocket connection found within ${Math.round(timeout / 1000)}s`);\n }, timeout);\n const intervalId = setInterval(() => {\n if (webSocketRef?.current) {\n clearInterval(intervalId);\n clearTimeout(timeoutId);\n resolve(webSocketRef);\n } else {\n console.log('WebSocket is not initialized yet, waiting...');\n }\n }, 100);\n }\n });\n },\n [webSocketRef, liveUpdates]\n );\n\n return useMemo(\n () => ({\n items,\n totalItems,\n error: allErrors.length > 0 && allErrors,\n refetch,\n fetchNextPage,\n addItem,\n removeItem,\n hasNextPage,\n isLoading: isLoadingPage || isLoadingItems,\n isFetching: isFetchingPage || isFetchingItems,\n isFetchingNextPage,\n url: collectionUrl,\n hasLiveUpdates,\n awaitWebSocketConnection,\n webSocketRef\n }),\n [\n items,\n totalItems,\n allErrors.length > 0 && allErrors,\n refetch,\n fetchNextPage,\n addItem,\n removeItem,\n hasNextPage,\n isLoadingPage || isLoadingItems,\n isFetchingPage || isFetchingItems,\n isFetchingNextPage,\n collectionUrl,\n hasLiveUpdates,\n awaitWebSocketConnection,\n webSocketRef\n ]\n );\n};\n\nexport default useCollection;\n","export const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (value === null || value === undefined) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default {\n arrayOf\n};\n\nexport const filterDuplicates = (iterable: T[], predicate: (item: T) => string) => {\n const seen = new Set();\n return iterable.filter(item => {\n const key = predicate(item);\n if (seen.has(key)) {\n return false;\n }\n seen.add(key);\n return true;\n });\n};\n","import { RefObject, useCallback } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { SemanticDataProvider } from '@semapps/semantic-data-provider';\nimport { SolidNotification, AwaitActivityOptions, AwaitWebSocketConnectionOptions } from '../types';\n\n/**\n * Hook used internally by useInbox and useOutbox. This is not exported.\n * @param awaitWebSocketConnection Promise returning the WebSocket which allow to listen to the inbox or outbox\n * @param existingActivities Partial list of activities already received in the inbox and outbox\n */\nconst useAwaitActivity = (\n awaitWebSocketConnection: (options?: AwaitWebSocketConnectionOptions) => Promise>,\n existingActivities?: Array\n) => {\n const dataProvider = useDataProvider();\n\n // TODO Allow to pass an object, and automatically dereference it if required, like on the @semapps/activitypub matchActivity util\n return useCallback(\n (matchActivity: (activity: object) => boolean, options: AwaitActivityOptions = {}) => {\n const { timeout = 30000, checkExistingActivities = false } = options;\n return new Promise((resolve, reject) => {\n awaitWebSocketConnection()\n .then(webSocketRef => {\n const onMessage = (event: MessageEvent) => {\n const data: SolidNotification = JSON.parse(event.data);\n if (data.type === 'Add') {\n dataProvider.fetch(data.object).then(({ json }) => {\n if (matchActivity(json)) {\n removeListeners();\n return resolve(json);\n }\n });\n }\n };\n const onError = (e: Event) => {\n // TODO reconnect if connection closed\n removeListeners();\n reject(e);\n };\n const onClose = (e: CloseEvent) => {\n removeListeners();\n reject(new Error(`${e.reason} (Code: ${e.code})`));\n };\n\n const removeListeners = () => {\n webSocketRef.current?.removeEventListener('message', onMessage);\n webSocketRef.current?.removeEventListener('error', onError);\n webSocketRef.current?.removeEventListener('close', onClose);\n };\n\n webSocketRef.current?.addEventListener('message', onMessage);\n webSocketRef.current?.addEventListener('error', onError);\n webSocketRef.current?.addEventListener('close', onClose);\n\n // If a list of activities is already loaded, verify if there is a match\n if (existingActivities && checkExistingActivities) {\n for (const a of existingActivities) {\n if (typeof a !== 'string') {\n if (matchActivity(a)) {\n removeListeners();\n return resolve(a);\n }\n }\n }\n }\n\n setTimeout(() => {\n removeListeners();\n reject(new Error('Timeout'));\n }, timeout);\n })\n .catch(e => {\n reject(e);\n });\n });\n },\n [awaitWebSocketConnection, existingActivities, dataProvider]\n );\n};\n\nexport default useAwaitActivity;\n","import { mergeAttributes } from '@tiptap/core';\nimport Mention from '@tiptap/extension-mention';\n\n// Fix a bug in the current version of the mention extension\n// (The { id, label } object is located inside the id property)\n// See https://github.com/ueberdosis/tiptap/pull/1322\nconst CustomMention = Mention.extend({\n renderHTML({ node, HTMLAttributes }) {\n return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), `@${node.attrs.id.label}`];\n },\n addAttributes() {\n return {\n label: {\n default: null,\n parseHTML: element => {\n return {\n label: element.getAttribute('data-mention-label')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.label) {\n return {};\n }\n return {\n 'data-mention-label': attributes.id.label\n };\n }\n },\n id: {\n default: null,\n parseHTML: element => {\n return {\n id: element.getAttribute('data-mention-id')\n };\n },\n renderHTML: attributes => {\n if (!attributes.id.id) {\n return {};\n }\n return {\n 'data-mention-id': attributes.id.id\n };\n }\n }\n };\n }\n});\n\nexport default CustomMention;\n","import React from 'react';\nimport { TextField, RichTextField, DateField } from 'react-admin';\nimport { Box, Typography, CircularProgress } from '@mui/material';\nimport makeStyles from '@mui/styles/makeStyles';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport { AvatarWithLabelField, ReferenceField } from '@semapps/field-components';\n\nconst useStyles = makeStyles(() => ({\n container: {\n paddingLeft: 80,\n marginTop: 8,\n minHeight: 80,\n position: 'relative'\n },\n avatar: {\n position: 'absolute',\n top: 0,\n left: 0,\n bottom: 0,\n width: 64,\n height: 64\n },\n text: {\n paddingTop: 2,\n paddingBottom: 8\n },\n label: {\n fontWeight: 'bold'\n },\n content: {\n '& p': {\n marginBlockStart: '0.5em',\n marginBlockEnd: '0.5em'\n }\n },\n loading: {\n zIndex: 1000,\n backgroundColor: 'white',\n opacity: 0.5,\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n minHeight: 200,\n marginTop: 5\n }\n}));\n\nconst CommentsList = ({ comments, userResource, loading }) => {\n const classes = useStyles();\n const userDataModel = useDataModel(userResource);\n return (\n \n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n \n \n \n \n \n \n \n \n \n \n \n  • \n \n \n \n \n \n ))}\n {loading && (\n \n \n \n \n \n )}\n \n );\n};\n\nexport default CommentsList;\n","import React from 'react';\nimport { useList, ListContextProvider, useGetMany } from 'react-admin';\nimport useCollection from '../hooks/useCollection';\n\nconst CollectionList = ({ collectionUrl, resource, children }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n const { items: actorsUris } = useCollection(collectionUrl);\n\n const { data, isLoading, isFetching } = useGetMany(\n resource,\n { ids: Array.isArray(actorsUris) ? actorsUris : [actorsUris] },\n { enabled: !!actorsUris }\n );\n\n const listContext = useList({ data, isLoading, isFetching });\n\n return {children};\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport { useRecordContext } from 'react-admin';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, reference, children, ...rest }) => {\n const record = useRecordContext();\n\n if (React.Children.count(children) !== 1) {\n throw new Error(' only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n \n {children}\n \n );\n};\n\nexport default ReferenceCollectionField;\n","import { useGetIdentity } from 'react-admin';\nimport useCollection from './useCollection';\nimport useAwaitActivity from './useAwaitActivity';\nimport type { UseCollectionOptions } from '../types';\n\n/**\n * Hook to fetch the inbox of the logged user.\n * Returns the same data as the useCollection hooks, plus:\n * - `awaitActivity`: a function to wait for a certain activity to be received\n * - `owner`: the WebID of the inbox's owner\n * See https://semapps.org/docs/frontend/activitypub-components#useinbox for usage\n * @param {UseCollectionOptions} options Defaults to `{ dereferenceItems: false, liveUpdates: false }`\n */\nconst useInbox = (options: UseCollectionOptions = {}) => {\n const { data: identity } = useGetIdentity();\n const { url, items, awaitWebSocketConnection, ...rest } = useCollection('inbox', options);\n const awaitActivity = useAwaitActivity(awaitWebSocketConnection, items);\n return { url, items, awaitWebSocketConnection, awaitActivity, owner: identity?.id, ...rest };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\nimport type { NodeInfo, NodeInfoLinks } from '../types';\n\nconst useNodeinfo = (host?: string, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\n if (host && rel) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are likely on HTTP\n const nodeinfoUrl = `${protocol}://${host}/.well-known/nodeinfo`;\n\n try {\n const { json: links }: { json: NodeInfoLinks } = await fetchUtils.fetchJson(nodeinfoUrl);\n\n // Accept any version of the nodeinfo protocol\n const link = links?.links?.find(l => l.rel === rel);\n\n if (link) {\n const { json }: { json: NodeInfo } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n }\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\n }\n }\n })();\n }, [host, setSchema, rel]);\n\n return schema;\n};\n\nexport default useNodeinfo;\n","import { useCallback } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useWebfinger = () => {\n // Post an activity to the logged user's outbox and return its URI\n const fetch = useCallback(async id => {\n // eslint-disable-next-line\n const [_, username, host] = id.split('@');\n if (host) {\n const protocol = host.includes(':') ? 'http' : 'https'; // If the host has a port, we are most likely on localhost\n const webfingerUrl = `${protocol}://${host}/.well-known/webfinger?resource=acct:${username}@${host}`;\n\n try {\n const { json } = await fetchUtils.fetchJson(webfingerUrl);\n\n const link = json.links.find(l => l.type === 'application/activity+json');\n\n return link ? link.href : null;\n } catch (e) {\n return null;\n }\n } else {\n return null;\n }\n }, []);\n\n return { fetch };\n};\n\nexport default useWebfinger;\n","import { useMemo } from 'react';\nimport { useGetList } from 'react-admin';\nimport { useDataModel } from '@semapps/semantic-data-provider';\nimport renderMentions from './renderMentions';\n\nconst useMentions = userResource => {\n const userDataModel = useDataModel(userResource);\n\n const { data } = useGetList(\n userResource,\n {\n filter: {\n _predicates: [userDataModel?.fieldsMapping?.title],\n blankNodes: []\n }\n },\n {\n enabled: !!userDataModel?.fieldsMapping?.title\n }\n );\n\n const availableMentions = useMemo(() => {\n if (data) {\n return data.map(item => ({ id: item.id, label: item[userDataModel?.fieldsMapping?.title] }));\n }\n }, [data]);\n\n const items = useMemo(() => {\n if (availableMentions) {\n return ({ query }) => {\n return availableMentions.filter(({ label }) => label.toLowerCase().startsWith(query.toLowerCase())).slice(0, 5);\n };\n }\n }, [availableMentions]);\n\n return {\n items,\n render: renderMentions\n };\n};\n\nexport default useMentions;\n","import { ReactRenderer } from '@tiptap/react';\nimport tippy from 'tippy.js';\nimport MentionsList from './MentionsList';\n\nconst renderMentions = () => {\n let component;\n let popup;\n\n return {\n onStart: props => {\n component = new ReactRenderer(MentionsList, {\n props,\n editor: props.editor\n });\n\n popup = tippy('body', {\n getReferenceClientRect: props.clientRect,\n appendTo: () => document.body,\n content: component.element,\n showOnCreate: true,\n interactive: true,\n trigger: 'manual',\n placement: 'bottom-start'\n });\n },\n\n onUpdate(props) {\n component.updateProps(props);\n\n popup[0].setProps({\n getReferenceClientRect: props.clientRect\n });\n },\n\n onKeyDown(props) {\n if (props.event.key === 'Escape') {\n popup[0].hide();\n\n return true;\n }\n\n return component.ref?.onKeyDown(props);\n },\n\n onExit() {\n popup[0].destroy();\n component.destroy();\n }\n };\n};\n\nexport default renderMentions;\n","import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';\nimport makeStyles from '@mui/styles/makeStyles';\n\nconst useStyles = makeStyles(theme => ({\n items: {\n background: '#fff',\n borderRadius: '0.5rem',\n boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.05), 0px 10px 20px rgba(0, 0, 0, 0.1)',\n color: 'rgba(0, 0, 0, 0.8)',\n fontSize: '0.9rem',\n overflow: 'hidden',\n padding: '0.2rem',\n position: 'relative'\n },\n item: {\n background: 'transparent',\n border: '1px solid transparent',\n borderRadius: '0.4rem',\n display: 'block',\n margin: 0,\n padding: '0.2rem 0.4rem',\n textAlign: 'left',\n width: '100%',\n '&.selected': {\n borderColor: '#000'\n }\n }\n}));\n\nexport default forwardRef((props, ref) => {\n const [selectedIndex, setSelectedIndex] = useState(0);\n const classes = useStyles();\n\n const selectItem = index => {\n const item = props.items[index];\n\n if (item) {\n props.command({ id: item });\n }\n };\n\n const upHandler = () => {\n setSelectedIndex((selectedIndex + props.items.length - 1) % props.items.length);\n };\n\n const downHandler = () => {\n setSelectedIndex((selectedIndex + 1) % props.items.length);\n };\n\n const enterHandler = () => {\n selectItem(selectedIndex);\n };\n\n useEffect(() => setSelectedIndex(0), [props.items]);\n\n useImperativeHandle(ref, () => ({\n onKeyDown: ({ event }) => {\n if (event.key === 'ArrowUp') {\n upHandler();\n return true;\n }\n\n if (event.key === 'ArrowDown') {\n downHandler();\n return true;\n }\n\n if (event.key === 'Enter') {\n enterHandler();\n return true;\n }\n\n return false;\n }\n }));\n\n return (\n
\n {props.items.length ? (\n props.items.map((item, index) => (\n selectItem(index)}\n >\n {item.label}\n \n ))\n ) : (\n
Aucun résultat
\n )}\n
\n );\n});\n"],"names":[],"version":3,"file":"index.es.js.map"} \ No newline at end of file diff --git a/src/frontend/packages/activitypub-components/src/hooks/useCollection.ts b/src/frontend/packages/activitypub-components/src/hooks/useCollection.ts index ca02e1bf3..67bf64b68 100644 --- a/src/frontend/packages/activitypub-components/src/hooks/useCollection.ts +++ b/src/frontend/packages/activitypub-components/src/hooks/useCollection.ts @@ -26,30 +26,38 @@ const useItemsFromPages = (pages: any[], dereferenceItems: boolean) => { .map(itemUri => ({ queryKey: ['resource', itemUri], queryFn: async () => (await dataProvider.fetch(itemUri)).json, - staleTime: Infinity + staleTime: Infinity // Activities are immutable, so no need to refetch.. })) ); - if (!shouldDereference) { - return { loadedItems: items, isLoading: false, isFetching: false }; - } - // Put all loaded items together (might be dereferenced already, so concatenate). - const loadedItems = items - .filter(item => typeof item !== 'string') - .concat( - itemQueries.flatMap(itemQuery => { - return (itemQuery.isSuccess && itemQuery.data) || []; - }) - ); + const loadedItems = useMemo( + () => + items + .filter(item => typeof item !== 'string') + .concat( + itemQueries.flatMap(itemQuery => { + return (itemQuery.isSuccess && itemQuery.data) || []; + }) + ), + [items, itemQueries] + ); + + const errors = useMemo(() => itemQueries.filter(q => q.error), [itemQueries]); - const errors = itemQueries.filter(q => q.error); - return { - loadedItems, - isLoading: itemQueries.some(q => q.isLoading), - isFetching: itemQueries.some(q => q.isFetching), - errors: errors.length > 0 ? errors : undefined - }; + const isLoading = itemQueries.some(q => q.isLoading); + const isFetching = itemQueries.some(q => q.isFetching); + const errorsFormatted = useMemo(() => (errors.length > 0 ? errors : undefined), [errors]); + + return useMemo( + () => ({ + loadedItems, + isLoading, + isFetching, + errors: errorsFormatted + }), + [loadedItems, itemQueries, errorsFormatted] + ); }; /** @@ -134,7 +142,7 @@ const useCollection = (predicateOrUrl: string, options: UseCollectionOptions = { errors: itemErrors } = useItemsFromPages(pageData?.pages ?? emptyArray, dereferenceItems); - const allErrors = arrayOf(collectionError).concat(arrayOf(itemErrors)); + const allErrors = useMemo(() => arrayOf(collectionError).concat(arrayOf(itemErrors)), [collectionError, itemErrors]); const addItem = useCallback( (item: string | any, shouldRefetch: boolean | number = true) => { @@ -259,23 +267,42 @@ const useCollection = (predicateOrUrl: string, options: UseCollectionOptions = { [webSocketRef, liveUpdates] ); - return { - items, - totalItems, - error: allErrors.length > 0 && allErrors, - refetch, - fetchNextPage, - addItem, - removeItem, - hasNextPage, - isLoading: isLoadingPage || isLoadingItems, - isFetching: isFetchingPage || isFetchingItems, - isFetchingNextPage, - url: collectionUrl, - hasLiveUpdates, - awaitWebSocketConnection, - webSocketRef - }; + return useMemo( + () => ({ + items, + totalItems, + error: allErrors.length > 0 && allErrors, + refetch, + fetchNextPage, + addItem, + removeItem, + hasNextPage, + isLoading: isLoadingPage || isLoadingItems, + isFetching: isFetchingPage || isFetchingItems, + isFetchingNextPage, + url: collectionUrl, + hasLiveUpdates, + awaitWebSocketConnection, + webSocketRef + }), + [ + items, + totalItems, + allErrors.length > 0 && allErrors, + refetch, + fetchNextPage, + addItem, + removeItem, + hasNextPage, + isLoadingPage || isLoadingItems, + isFetchingPage || isFetchingItems, + isFetchingNextPage, + collectionUrl, + hasLiveUpdates, + awaitWebSocketConnection, + webSocketRef + ] + ); }; export default useCollection; diff --git a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js index 0783087e7..549a30f32 100644 --- a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js +++ b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js @@ -51,6 +51,9 @@ $parcel$export(module.exports, "ReificationArrayInput", () => $030f1232f6810456$ $parcel$export(module.exports, "createWsChannel", () => $84ab912646919f8c$export$28772ab4c256e709); $parcel$export(module.exports, "getOrCreateWsChannel", () => $84ab912646919f8c$export$8d60734939c59ced); $parcel$export(module.exports, "createSolidNotificationChannel", () => $84ab912646919f8c$export$3edfe18db119b920); +var $1bc09db736a9cb94$exports = {}; +/* eslint-disable @typescript-eslint/no-redundant-type-constituents */ + const $3db7a4510a668a04$var$fetchResource = async (resourceUri, config)=>{ @@ -1183,7 +1186,7 @@ var $59a07b932dae8600$export$2e2bcd8739ae039 = $59a07b932dae8600$var$getServerKe var $341dff85fe619d85$export$2e2bcd8739ae039 = $341dff85fe619d85$var$httpClient; -const $7f6a16d0025dc83a$var$dataProvider = (config)=>{ +/** @type {(config: Configuration) => SemanticDataProvider} */ const $7f6a16d0025dc83a$var$dataProvider = (config)=>{ // TODO verify all data provider config + data models if (!(0, $8f44b7c15b8b8e1d$export$2e2bcd8739ae039)("default", config.dataServers)) throw new Error("You must define a default server in your dataServers config"); if (!config.jsonContext) config.jsonContext = Object.fromEntries(config.ontologies.map((o)=>[ @@ -1724,8 +1727,6 @@ const $84ab912646919f8c$var$registeredWebSockets = new Map(); }; -var $1bc09db736a9cb94$exports = {}; -/* eslint-disable @typescript-eslint/no-redundant-type-constituents */ $parcel$exportWildcard(module.exports, $1bc09db736a9cb94$exports); diff --git a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map index 78da61398..8f2046b15 100644 --- a/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map +++ b/src/frontend/packages/semantic-data-provider/dist/index.cjs.js.map @@ -1 +1 @@ -{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AIEA,MAAM,sCAAgB,OAAO,aAAa;IACxC,MAAM,cAAE,UAAU,eAAE,WAAW,EAAE,GAAG;IAEpC,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,MAAM,WAAW;IAEtC,IAAI,CAAC,MAAM,MAAM,IAAI,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC;IAE7D,KAAK,EAAE,GAAG,KAAK,EAAE,IAAI,IAAI,CAAC,MAAM;IAEhC,sFAAsF;IACtF,gDAAgD;IAChD,IAAI,IAAI,CAAC,WAAW,KAAK,aACvB,OAAO,MAAM,CAAA,GAAA,uCAAK,EAAE,OAAO,CAAC,MAAM;IAGpC,OAAO;AACT;IAEA,2CAAe;;;ADlBf,MAAM,qCAAe,CAAA,SAAU,OAAO,YAAY;QAChD,MAAM,aAAE,SAAS,EAAE,GAAG;QACtB,MAA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Ae,CAAC;IAEjG,MAAM,SAAS,2CAAqB,GAAG,CAAC;IACxC,IAAI,QACF,uCAAuC;IACvC,OAAO;IAGT,qEAAqE;IACrE,iEAAiE;IACjE,MAAM,YAAY,0CAAgB,oBAAoB,aAAa;QAAE,GAAG,OAAO;QAAE,MAAM;IAAuB,GAAG,IAAI,CACnH,CAAA;QACE,mDAAmD;QACnD,GAAG,gBAAgB,CAAC,SAAS,CAAA;YAC3B,2CAAqB,MAAM,CAAC;QAC9B;QACA,+DAA+D;QAC/D,MAAM,UAAU,QAAQ,UAAU,IAAK,CAAA,QAAQ,KAAK,IAAI,IAAI,KAAK,QAAQ,KAAK,EAAE,OAAO,KAAK,KAAK,GAAG,EAAC;QACrG,IAAI,SACF,WAAW;YACT,GAAG,KAAK;QACV,GAAG;QAEL,OAAO;IACT;IAGF,2CAAqB,GAAG,CAAC,aAAa;IACtC,OAAO;AACT;;;;ACnJA,oEAAoE,GACpE;","sources":["packages/semantic-data-provider/src/index.ts","packages/semantic-data-provider/src/dataProvider/dataProvider.js","packages/semantic-data-provider/src/dataProvider/methods/create.js","packages/semantic-data-provider/src/dataProvider/methods/getOne.js","packages/semantic-data-provider/src/dataProvider/utils/fetchResource.js","packages/semantic-data-provider/src/dataProvider/utils/handleFiles.ts","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithTypes.ts","packages/semantic-data-provider/src/dataProvider/utils/parseServerKeys.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromType.js","packages/semantic-data-provider/src/dataProvider/methods/delete.ts","packages/semantic-data-provider/src/dataProvider/methods/deleteMany.js","packages/semantic-data-provider/src/dataProvider/methods/getDataServers.js","packages/semantic-data-provider/src/dataProvider/methods/getDataModels.js","packages/semantic-data-provider/src/dataProvider/methods/getList.js","packages/semantic-data-provider/src/dataProvider/utils/fetchContainers.ts","packages/semantic-data-provider/src/dataProvider/utils/arrayOf.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchSparqlEndpoints.js","packages/semantic-data-provider/src/dataProvider/utils/getEmbedFrame.js","packages/semantic-data-provider/src/dataProvider/utils/buildSparqlQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildBaseQuery.js","packages/semantic-data-provider/src/dataProvider/utils/resolvePrefix.js","packages/semantic-data-provider/src/dataProvider/utils/buildBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/buildAutoDetectBlankNodesQuery.js","packages/semantic-data-provider/src/dataProvider/utils/findContainersWithPath.js","packages/semantic-data-provider/src/dataProvider/methods/getMany.js","packages/semantic-data-provider/src/dataProvider/methods/getManyReference.js","packages/semantic-data-provider/src/dataProvider/methods/patch.ts","packages/semantic-data-provider/src/dataProvider/methods/update.ts","packages/semantic-data-provider/src/dataProvider/utils/fetchUserConfig.js","packages/semantic-data-provider/src/dataProvider/utils/fetchVoidEndpoints.js","packages/semantic-data-provider/src/dataProvider/httpClient.js","packages/semantic-data-provider/src/dataProvider/utils/getServerKeyFromUri.js","packages/semantic-data-provider/src/hooks/useGetExternalLink.js","packages/semantic-data-provider/src/hooks/useContainers.ts","packages/semantic-data-provider/src/hooks/useDataModel.ts","packages/semantic-data-provider/src/hooks/useDataServers.ts","packages/semantic-data-provider/src/hooks/useCreateContainer.js","packages/semantic-data-provider/src/dataProvider/utils/findCreateContainerWithTypes.ts","packages/semantic-data-provider/src/hooks/useCreateContainerUri.ts","packages/semantic-data-provider/src/hooks/useDataModels.ts","packages/semantic-data-provider/src/reification/FilterHandler.js","packages/semantic-data-provider/src/reification/GroupedReferenceHandler.js","packages/semantic-data-provider/src/reification/ReificationArrayInput.js","packages/semantic-data-provider/src/notificationChannels/subscribeToUpdates.ts","packages/semantic-data-provider/src/dataProvider/types.ts"],"sourcesContent":["export { default as dataProvider } from './dataProvider/dataProvider';\n\nexport { default as buildSparqlQuery } from './dataProvider/utils/buildSparqlQuery';\nexport { default as buildBlankNodesQuery } from './dataProvider/utils/buildBlankNodesQuery';\n\nexport { default as useGetExternalLink } from './hooks/useGetExternalLink';\nexport { default as useContainers } from './hooks/useContainers';\nexport { default as useCreateContainer } from './hooks/useCreateContainer';\nexport { default as useCreateContainerUri } from './hooks/useCreateContainerUri';\nexport { default as useDataModel } from './hooks/useDataModel';\nexport { default as useDataModels } from './hooks/useDataModels';\nexport { default as useDataServers } from './hooks/useDataServers';\n\nexport { default as FilterHandler } from './reification/FilterHandler';\nexport { default as GroupedReferenceHandler } from './reification/GroupedReferenceHandler';\nexport { default as ReificationArrayInput } from './reification/ReificationArrayInput';\n\nexport {\n createWsChannel,\n getOrCreateWsChannel,\n createSolidNotificationChannel\n} from './notificationChannels/subscribeToUpdates';\n\nexport * from './dataProvider/types';\n","import createMethod from './methods/create';\nimport deleteMethod from './methods/delete';\nimport deleteManyMethod from './methods/deleteMany';\nimport getDataServersMethod from './methods/getDataServers';\nimport getDataModelsMethod from './methods/getDataModels';\nimport getListMethod from './methods/getList';\nimport getManyMethod from './methods/getMany';\nimport getManyReferenceMethod from './methods/getManyReference';\nimport getOneMethod from './methods/getOne';\nimport patchMethod from './methods/patch';\nimport updateMethod from './methods/update';\nimport fetchUserConfig from './utils/fetchUserConfig';\nimport fetchVoidEndpoints from './utils/fetchVoidEndpoints';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\nimport httpClient from './httpClient';\n\nconst dataProvider = config => {\n // TODO verify all data provider config + data models\n if (!getServerKeyFromType('default', config.dataServers))\n throw new Error('You must define a default server in your dataServers config');\n\n if (!config.jsonContext) config.jsonContext = Object.fromEntries(config.ontologies.map(o => [o.prefix, o.url]));\n if (!config.returnFailedResources) config.returnFailedResources = false;\n\n // Configure httpClient with data servers (this is needed for proxy calls)\n config.httpClient = httpClient(config.dataServers);\n\n // Keep in memory for refresh\n const originalConfig = { ...config };\n\n let fetchUserConfigPromise = fetchUserConfig(config);\n let fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n\n const waitForConfig =\n method =>\n async (...arg) => {\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise; // Return immediately if promise is fulfilled\n return await method(...arg);\n };\n\n return {\n getList: waitForConfig(getListMethod(config)),\n getMany: waitForConfig(getManyMethod(config)),\n getManyReference: waitForConfig(getManyReferenceMethod(config)),\n getOne: waitForConfig(getOneMethod(config)),\n create: waitForConfig(createMethod(config)),\n update: waitForConfig(updateMethod(config)),\n updateMany: () => {\n throw new Error('updateMany is not implemented yet');\n },\n delete: waitForConfig(deleteMethod(config)),\n deleteMany: waitForConfig(deleteManyMethod(config)),\n // Custom methods\n patch: waitForConfig(patchMethod(config)),\n getDataModels: waitForConfig(getDataModelsMethod(config)),\n getDataServers: waitForConfig(getDataServersMethod(config)),\n getLocalDataServers: getDataServersMethod(config),\n fetch: waitForConfig(config.httpClient),\n refreshConfig: async () => {\n config = { ...originalConfig };\n fetchUserConfigPromise = fetchUserConfig(config);\n fetchVoidEndpointsPromise = fetchVoidEndpoints(config);\n await fetchUserConfigPromise;\n await fetchVoidEndpointsPromise;\n return config;\n }\n };\n};\n\nexport default dataProvider;\n","import urlJoin from 'url-join';\nimport getOne from './getOne';\nimport handleFiles from '../utils/handleFiles';\nimport findContainersWithTypes from '../utils/findContainersWithTypes';\n\nconst createMethod = config => async (resourceId, params) => {\n const { dataServers, resources, httpClient, jsonContext } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const headers = new Headers();\n\n let containerUri;\n let serverKey;\n if (dataModel.create?.container) {\n serverKey = Object.keys(dataModel.create.container)[0];\n containerUri = urlJoin(dataServers[serverKey].baseUrl, Object.values(dataModel.create.container)[0]);\n } else {\n serverKey = dataModel.create?.server || Object.keys(dataServers).find(key => dataServers[key].default === true);\n if (!serverKey) throw new Error('You must define a server for the creation, or a container, or a default server');\n\n const containers = findContainersWithTypes(dataModel.types, [serverKey], dataServers);\n // Extract the containerUri from the results (and ensure there is only one)\n const serverKeys = Object.keys(containers);\n\n if (!serverKeys || serverKeys.length === 0)\n throw new Error(`No container with types ${JSON.stringify(dataModel.types)} found on server ${serverKey}`);\n if (serverKeys.length > 1 || containers[serverKeys[0]].length > 1)\n throw new Error(\n `More than one container detected with types ${JSON.stringify(dataModel.types)} on server ${serverKey}`\n );\n containerUri = containers[serverKeys[0]][0];\n }\n\n if (params.data) {\n if (dataModel.fieldsMapping?.title) {\n if (Array.isArray(dataModel.fieldsMapping.title)) {\n headers.set('Slug', dataModel.fieldsMapping.title.map(f => params.data[f]).join(' '));\n } else {\n headers.set('Slug', params.data[dataModel.fieldsMapping.title]);\n }\n }\n\n // Upload files, if there are any\n const { updatedRecord } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n const { headers: responseHeaders } = await httpClient(containerUri, {\n method: 'POST',\n headers,\n body: JSON.stringify({\n '@context': jsonContext,\n '@type': dataModel.types,\n ...params.data\n })\n });\n\n // Retrieve newly-created resource\n const resourceUri = responseHeaders.get('Location');\n return await getOne(config)(resourceId, { id: resourceUri });\n }\n if (params.id) {\n headers.set('Content-Type', 'application/sparql-update');\n\n await httpClient(containerUri, {\n method: 'PATCH',\n headers,\n body: `\n PREFIX ldp: \n INSERT DATA { <${containerUri}> ldp:contains <${params.id}>. };\n `\n });\n\n // Create must return the new data, so get them from the remote URI\n return await getOne(config)(resourceId, { id: params.id });\n }\n};\n\nexport default createMethod;\n","import fetchResource from '../utils/fetchResource';\n\nconst getOneMethod = config => async (resourceId, params) => {\n const { resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n const data = await fetchResource(params.id, config);\n\n // Transform single value into array if forceArray is set\n if (dataModel.list?.forceArray) {\n for (const forceArrayItem of dataModel.list?.forceArray || []) {\n if (data[forceArrayItem] && !Array.isArray(data[forceArrayItem])) {\n data[forceArrayItem] = [data[forceArrayItem]];\n }\n }\n }\n\n // TODO activate defaultFetchPlan option\n // if (dataModel.list?.defaultFetchPlan) {\n // for (const node of dataModel.list?.defaultFetchPlan) {\n // if (\n // data[node] &&\n // typeof data[node] === 'string' &&\n // data[node].startsWith('http')\n // ) {\n // try {\n // const dataToEmbed = await fetchResource(data[node], config);\n // delete dataToEmbed['@context'];\n // data[node] = dataToEmbed;\n // } catch (e) {\n // // Ignore errors (this may happen if user does not have rights to see the resource)\n // }\n // }\n // }\n // }\n\n return { data };\n};\n\nexport default getOneMethod;\n","import jsonld from 'jsonld';\n\nconst fetchResource = async (resourceUri, config) => {\n const { httpClient, jsonContext } = config;\n\n let { json: data } = await httpClient(resourceUri);\n\n if (!data) throw new Error(`Not a valid JSON: ${resourceUri}`);\n\n data.id = data.id || data['@id'];\n\n // We compact only if the context is different between the frontend and the middleware\n // TODO deep compare if the context is an object\n if (data['@context'] !== jsonContext) {\n data = await jsonld.compact(data, jsonContext);\n }\n\n return data;\n};\n\nexport default fetchResource;\n","import urlJoin from 'url-join';\nimport { RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\n\nconst isFile = (o: any): o is { rawFile: File } => o?.rawFile && o.rawFile instanceof File;\nconst isFileToDelete = (o: any): o is { fileToDelete: string } =>\n o?.fileToDelete !== undefined && o?.fileToDelete !== null;\n\nconst getUploadsContainerUri = (config: Configuration) => {\n const serverKey = Object.keys(config.dataServers).find(key => config.dataServers[key].uploadsContainer);\n if (serverKey && config.dataServers[serverKey].uploadsContainer) {\n return urlJoin(config.dataServers[serverKey].baseUrl, config.dataServers[serverKey].uploadsContainer!);\n }\n return null;\n};\n\nconst uploadFile = async (rawFile: File, config: Configuration) => {\n const uploadsContainerUri = getUploadsContainerUri(config);\n if (!uploadsContainerUri) throw new Error(\"You must define an uploadsContainer in one of the server's configuration\");\n\n const response = await config.httpClient(uploadsContainerUri, {\n method: 'POST',\n body: rawFile,\n headers: new Headers({\n 'Content-Type': rawFile.type\n })\n });\n\n if (response.status === 201) {\n return response.headers.get('Location');\n }\n return null;\n};\n\nconst deleteFiles = async (filesToDelete: string[], config: Configuration) => {\n return Promise.all(\n filesToDelete.map(file =>\n config.httpClient(file, {\n method: 'DELETE'\n })\n )\n );\n};\n\n/*\n * Look for raw files in the record data.\n * If there are any, upload them and replace the file by its URL.\n */\nconst uploadAllFiles = async (record: Partial, config: Configuration) => {\n const filesToDelete: string[] = [];\n const updatedRecord = { ...record };\n\n for (const property of Object.keys(record)) {\n const value = record[property];\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const itemValue = value[i];\n if (isFile(itemValue)) {\n if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n }\n updatedRecord[property][i] = await uploadFile(itemValue.rawFile, config);\n } else if (isFileToDelete(itemValue)) {\n filesToDelete.push(itemValue.fileToDelete);\n updatedRecord[property][i] = null;\n }\n }\n } else if (isFile(value)) {\n if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n }\n updatedRecord[property] = await uploadFile(value.rawFile, config);\n } else if (isFileToDelete(value)) {\n filesToDelete.push(value.fileToDelete);\n updatedRecord[property] = null;\n }\n }\n\n return {\n updatedRecord,\n filesToDelete\n };\n};\n\nexport default {\n upload: uploadAllFiles,\n delete: deleteFiles\n};\n","import urlJoin from 'url-join';\nimport { Configuration, DataServerKey } from '../types';\nimport parseServerKeys from './parseServerKeys';\n\nconst findContainersWithTypes = (\n types: string[],\n serverKeys: string | string[] | undefined,\n dataServers: Configuration['dataServers']\n) => {\n const containers = {} as Record;\n const existingContainers: string[] = [];\n\n const parsedServerKeys = parseServerKeys(serverKeys, dataServers);\n\n Object.keys(dataServers)\n .filter(dataServerKey => dataServers[dataServerKey].containers)\n .forEach(dataServerKey => {\n Object.keys(dataServers[dataServerKey].containers || {}).forEach(containerKey => {\n if (!parsedServerKeys || parsedServerKeys.includes(containerKey)) {\n Object.keys(dataServers[dataServerKey].containers![containerKey]).forEach(type => {\n if (types.includes(type)) {\n dataServers[dataServerKey].containers![containerKey][type].map(path => {\n const containerUri = urlJoin(dataServers[containerKey].baseUrl, path);\n\n // Avoid returning the same container several times\n if (!existingContainers.includes(containerUri)) {\n existingContainers.push(containerUri);\n\n if (!containers[dataServerKey]) containers[dataServerKey] = [];\n containers[dataServerKey].push(containerUri);\n }\n });\n }\n });\n }\n });\n });\n return containers;\n};\n\nexport default findContainersWithTypes;\n","import getServerKeyFromType from './getServerKeyFromType';\n\nconst parseServerKey = (serverKey, dataServers) => {\n switch (serverKey) {\n case '@default':\n return getServerKeyFromType('default', dataServers);\n case '@pod':\n return getServerKeyFromType('pod', dataServers);\n case '@authServer':\n return getServerKeyFromType('authServer', dataServers);\n default:\n return serverKey;\n }\n};\n\n// Return the list of servers keys in an array\n// parsing keywords like @all, @default, @pod and @authServer\nconst parseServerKeys = (serverKeys, dataServers) => {\n if (Array.isArray(serverKeys)) {\n if (serverKeys.includes('@all')) {\n return Object.keys(dataServers);\n }\n return serverKeys.map(serverKey => parseServerKey(serverKey, dataServers));\n }\n if (typeof serverKeys === 'string') {\n if (serverKeys === '@all') {\n return Object.keys(dataServers);\n }\n if (serverKeys === '@remote') {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n return Object.keys(dataServers).filter(serverKey => serverKey !== defaultServerKey);\n }\n return [parseServerKey(serverKeys, dataServers)];\n }\n // If server key is empty\n return false;\n};\n\nexport default parseServerKeys;\n","const getServerKeyFromType = (type, dataServers) => {\n return Object.keys(dataServers).find(key => {\n return dataServers[key][type];\n });\n};\n\nexport default getServerKeyFromType;\n","import { DeleteParams, RaRecord } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst deleteMethod = (config: Configuration) => async (resourceId: string, params: DeleteParams) => {\n const { httpClient } = config;\n\n await httpClient(`${params.id}`, {\n method: 'DELETE'\n });\n\n if (params.meta?.filesToDelete) {\n await handleFiles.delete(params.meta.filesToDelete, config);\n }\n\n return { data: { id: params.id } };\n};\n\nexport default deleteMethod;\n","const deleteManyMethod = config => async (resourceId, params) => {\n const { httpClient } = config;\n const ids = [];\n\n for (const id of params.ids) {\n try {\n await httpClient(id, {\n method: 'DELETE'\n });\n ids.push(id);\n } catch (e) {\n // Do nothing if we fail to delete a resource\n }\n }\n\n return { data: ids };\n};\n\nexport default deleteManyMethod;\n","const getDataServers = config => () => {\n return config.dataServers;\n};\n\nexport default getDataServers;\n","const getDataModels = config => () => {\n return config.resources;\n};\n\nexport default getDataModels;\n","import findContainersWithTypes from '../utils/findContainersWithTypes';\nimport fetchContainers from '../utils/fetchContainers';\nimport fetchSparqlEndpoints from '../utils/fetchSparqlEndpoints';\nimport findContainersWithPaths from '../utils/findContainersWithPath';\n\nconst getListMethod =\n config =>\n async (resourceId, params = {}) => {\n const { dataServers, resources } = config;\n const dataModel = resources[resourceId];\n\n if (!dataModel) throw new Error(`Resource ${resourceId} is not mapped in resources file`);\n\n let containers;\n if (!params.filter?._servers && dataModel.list?.containers) {\n if (Array.isArray(dataModel.list?.containers))\n throw new Error(\n `The list.containers property of ${resourceId} dataModel must be of type object ({ serverKey: [containerUri] })`\n );\n // If containers are set explicitly, use them\n containers = findContainersWithPaths(dataModel.list.containers, dataServers);\n } else {\n // Otherwise find the container URIs on the given servers (either in the filter or the data model)\n containers = findContainersWithTypes(\n dataModel.types,\n params.filter?._servers || dataModel.list?.servers,\n dataServers\n );\n }\n\n if (dataModel.list?.fetchContainer) {\n return fetchContainers(containers, params, config);\n }\n return fetchSparqlEndpoints(containers, resourceId, params, config);\n };\n\nexport default getListMethod;\n","import jsonld, { ContextDefinition } from 'jsonld';\nimport { GetListParams } from 'react-admin';\nimport arrayOf from './arrayOf';\nimport { Configuration, ContainerURI, DataServerKey } from '../types';\n\ntype LDPContainerType = 'ldp:Container' | 'ldp:BasicContainer';\n\ninterface LDPContainerBase {\n '@context': Configuration['jsonContext'];\n id: string;\n 'ldp:contains': Record[];\n}\n\ninterface LDPContainerWithType extends LDPContainerBase {\n type: LDPContainerType | LDPContainerType[];\n}\n\ninterface LDPContainerWithAtType extends LDPContainerBase {\n '@type': LDPContainerType | LDPContainerType[];\n}\n\ntype LDPContainer = LDPContainerWithType | LDPContainerWithAtType;\n\ntype LDPResource = {\n '@context': Configuration['jsonContext'];\n [key: string]: any;\n};\n\ntype ListFilters = Partial<{\n q: string;\n type: string;\n _predicates: string[];\n _servers: DataServerKey[];\n [attribute: string]: any;\n}>;\n\nconst isValidLDPContainer = (container: LDPContainer) => {\n const resourceType = (container as LDPContainerWithType).type || (container as LDPContainerWithAtType)['@type'];\n return Array.isArray(resourceType) ? resourceType.includes('ldp:Container') : resourceType === 'ldp:Container';\n};\n\nconst isObject = (val: any) => {\n return val != null && typeof val === 'object' && !Array.isArray(val);\n};\n\nconst fetchContainers = async (\n containers: Record,\n params: GetListParams,\n { httpClient, jsonContext }: Configuration\n) => {\n const containersUri = Object.values(containers).flat();\n\n const fetchPromises = containersUri.map(containerUri =>\n httpClient(containerUri)\n .then(async ({ json }) => {\n const jsonResponse: LDPContainer = json;\n\n // If container's context is different, compact it to have an uniform result\n // TODO deep compare if the context is an object\n if (jsonResponse['@context'] !== jsonContext) {\n return jsonld.compact(jsonResponse, jsonContext as ContextDefinition) as unknown as Promise;\n }\n\n return jsonResponse;\n })\n .then((json: LDPContainer) => {\n if (!isValidLDPContainer(json)) {\n throw new Error(`${containerUri} is not a LDP container`);\n }\n\n return arrayOf(json['ldp:contains']).map(resource => ({\n '@context': json['@context'],\n ...resource\n }));\n })\n );\n\n // Fetch simultaneously all containers\n const results = await Promise.all(fetchPromises);\n let resources = results.flat();\n\n resources = resources.map(resource => {\n resource.id = resource.id || resource['@id'];\n return resource;\n });\n\n // Apply filter to results\n const filters: ListFilters = params.filter;\n\n // For SPARQL queries, we use \"a\" to filter types, but in containers it must be \"type\"\n if (filters.a) {\n filters.type = filters.a;\n delete filters.a;\n }\n\n // Filter resources attributes according to _predicates list\n if (filters._predicates && Array.isArray(filters._predicates)) {\n const predicates = filters._predicates;\n const mandatoryAttributes = ['id'];\n\n resources = resources.map(resource => {\n return Object.keys(resource)\n .filter(key => predicates.includes(key) || mandatoryAttributes.includes(key))\n .reduce(\n (filteredResource, key) => {\n filteredResource[key] = resource[key];\n return filteredResource;\n },\n { '@context': [] }\n );\n });\n }\n\n if (Object.keys(filters).filter(f => !['_predicates', '_servers'].includes(f)).length > 0) {\n resources = resources.filter(resource => {\n // Full text filtering\n if (filters.q) {\n return Object.values(resource).some(attributeValue => {\n if (!isObject(attributeValue)) {\n const arrayValues = Array.isArray(attributeValue) ? attributeValue : [attributeValue];\n return arrayValues.some(value => {\n if (typeof value === 'string') {\n return value.toLowerCase().normalize('NFD').includes(filters.q!.toLowerCase().normalize('NFD'));\n }\n return false;\n });\n }\n return false;\n });\n }\n\n // Attribute filtering\n const attributesFilters = Object.keys(filters).filter(f => !['_predicates', '_servers', 'q'].includes(f));\n\n return attributesFilters.every(attribute => {\n if (resource[attribute]) {\n const arrayValues: any[] = Array.isArray(resource[attribute]) ? resource[attribute] : [resource[attribute]];\n return arrayValues.some(\n (value: any) => typeof value === 'string' && value.includes(filters[attribute] as string)\n );\n }\n\n return false;\n });\n });\n }\n\n // Sorting\n if (params.sort) {\n resources = resources.sort((a, b) => {\n if (a[params.sort.field] && b[params.sort.field]) {\n if (params.sort.order === 'ASC') {\n return a[params.sort.field].localeCompare(b[params.sort.field]);\n }\n return b[params.sort.field].localeCompare(a[params.sort.field]);\n }\n return true;\n });\n }\n\n // Pagination\n const total = resources.length;\n\n if (params.pagination) {\n resources = resources.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: resources, total };\n};\n\nexport default fetchContainers;\n","const arrayOf = (value: T | T[]) => {\n // If the field is null-ish, we suppose there are no values.\n if (!value) {\n return [];\n }\n // Return as is.\n if (Array.isArray(value)) {\n return value;\n }\n // Single value is made an array.\n return [value];\n};\n\nexport default arrayOf;\n","import jsonld from 'jsonld';\nimport getEmbedFrame from './getEmbedFrame';\nimport buildSparqlQuery from './buildSparqlQuery';\n\nconst compare = (a, b) => {\n switch (typeof a) {\n case 'string':\n return a.localeCompare(b);\n case 'number':\n case 'bigint':\n return a - b;\n default:\n return 0;\n }\n};\n\nconst fetchSparqlEndpoints = async (containers, resourceId, params, config) => {\n const { dataServers, resources, httpClient, jsonContext, ontologies } = config;\n const dataModel = resources[resourceId];\n\n const sparqlQueryPromises = Object.keys(containers).map(\n serverKey =>\n new Promise((resolve, reject) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n\n // When the SPARQL request comes from the browser's URL, it comes as JSON string which must must be parsed\n if (\n params.filter?.sparqlWhere &&\n (typeof params.filter.sparqlWhere === 'string' || params.filter.sparqlWhere instanceof String)\n ) {\n params.filter.sparqlWhere = JSON.parse(decodeURIComponent(params.filter.sparqlWhere));\n }\n const sparqlQuery = buildSparqlQuery({\n containers: containers[serverKey],\n params,\n dataModel,\n ontologies\n });\n\n httpClient(dataServers[serverKey].sparqlEndpoint, {\n method: 'POST',\n body: sparqlQuery\n })\n .then(({ json }) => {\n // If we declared the blank nodes to dereference, embed only those blank nodes\n // This solve problems which can occur when same-type resources are embedded in other resources\n // To increase performances, you can set explicitEmbedOnFraming to false (make sure the result is still OK)\n const frame =\n blankNodes && dataModel.list?.explicitEmbedOnFraming !== false\n ? {\n '@context': jsonContext,\n '@type': dataModel.types,\n '@embed': '@never',\n ...getEmbedFrame(blankNodes)\n }\n : {\n '@context': jsonContext,\n '@type': dataModel.types\n };\n\n // omitGraph option force results to be in a @graph, even if we have a single result\n return jsonld.frame(json, frame, { omitGraph: false });\n })\n .then(compactJson => {\n if (compactJson['@id']) {\n const { '@context': context, ...rest } = compactJson;\n compactJson = {\n '@context': context,\n '@graph': [rest]\n };\n }\n resolve(\n compactJson['@graph'].map(resource => ({ '@context': compactJson['@context'], ...resource })) || []\n );\n })\n .catch(e => reject(e));\n })\n );\n\n // Run simultaneous SPARQL queries\n let results = await Promise.all(sparqlQueryPromises);\n\n if (results.length === 0) {\n return { data: [], total: 0 };\n }\n // Merge all results in one array\n results = [].concat(...results);\n\n // Add id in addition to @id, as this is what React-Admin expects\n let returnData = results.map(item => {\n item.id = item.id || item['@id'];\n return item;\n });\n\n // TODO sort and paginate the results in the SPARQL query to improve performances\n if (params.sort) {\n returnData = returnData.sort((a, b) => {\n if (a[params.sort.field] !== undefined && b[params.sort.field] !== undefined) {\n if (params.sort.order === 'ASC') {\n return compare(a[params.sort.field], b[params.sort.field]);\n }\n return compare(b[params.sort.field], a[params.sort.field]);\n }\n return 0;\n });\n }\n if (params.pagination) {\n returnData = returnData.slice(\n (params.pagination.page - 1) * params.pagination.perPage,\n params.pagination.page * params.pagination.perPage\n );\n }\n\n return { data: returnData, total: results.length };\n};\n\nexport default fetchSparqlEndpoints;\n","const getEmbedFrame = blankNodes => {\n let embedFrame = {};\n let predicates;\n if (blankNodes) {\n for (const blankNode of blankNodes) {\n if (blankNode.includes('/')) {\n predicates = blankNode.split('/').reverse();\n } else {\n predicates = [blankNode];\n }\n embedFrame = {\n ...embedFrame,\n ...predicates.reduce(\n (accumulator, predicate) => ({\n [predicate]: {\n '@embed': '@last',\n ...accumulator\n }\n }),\n {}\n )\n };\n }\n return embedFrame;\n }\n};\n\nexport default getEmbedFrame;\n","import DataFactory from '@rdfjs/data-model';\nimport buildBaseQuery from './buildBaseQuery';\nimport buildBlankNodesQuery from './buildBlankNodesQuery';\nimport buildAutoDetectBlankNodesQuery from './buildAutoDetectBlankNodesQuery';\nimport resolvePrefix from './resolvePrefix';\n\nconst SparqlGenerator = require('sparqljs').Generator;\n\nconst { literal, namedNode, triple, variable } = DataFactory;\n\nconst generator = new SparqlGenerator({\n /* prefixes, baseIRI, factory, sparqlStar */\n});\n\nconst reservedFilterKeys = ['q', 'sparqlWhere', 'blankNodes', 'blankNodesDepth', '_servers', '_predicates'];\n\nconst buildSparqlQuery = ({ containers, params, dataModel, ontologies }) => {\n const blankNodes = params.filter?.blankNodes || dataModel.list?.blankNodes;\n const predicates = params.filter?._predicates || dataModel.list?.predicates;\n const blankNodesDepth = params.filter?.blankNodesDepth ?? dataModel.list?.blankNodesDepth ?? 2;\n const filter = { ...dataModel.list?.filter, ...params.filter };\n const baseQuery = buildBaseQuery(predicates, ontologies);\n\n const sparqlJsParams = {\n queryType: 'CONSTRUCT',\n template: baseQuery.construct,\n where: [],\n type: 'query',\n prefixes: Object.fromEntries(ontologies.map(ontology => [ontology.prefix, ontology.url]))\n };\n\n const containerWhere = [\n {\n type: 'values',\n values: containers.map(containerUri => ({ '?containerUri': namedNode(containerUri) }))\n },\n triple(variable('containerUri'), namedNode('http://www.w3.org/ns/ldp#contains'), variable('s1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isiri',\n args: [variable('s1')]\n }\n }\n ];\n\n let resourceWhere = [];\n\n if (filter && Object.keys(filter).length > 0) {\n const hasSPARQLFilter = filter.sparqlWhere && Object.keys(filter.sparqlWhere).length > 0;\n const hasFullTextSearch = filter.q && filter.q.length > 0;\n\n if (hasSPARQLFilter) {\n /*\n Example of usage :\n {\n \"sparqlWhere\": {\n \"type\": \"bgp\",\n \"triples\": [{\n \"subject\": {\"termType\": \"Variable\", \"value\": \"s1\"},\n \"predicate\": {\"termType\": \"NameNode\", \"value\": \"http://virtual-assembly.org/ontologies/pair#label\"},\n \"object\": {\"termType\": \"Literal\", \"value\": \"My Organization\"}\n }]\n }\n }\n */\n // initialize array in case of single value :\n [].concat(filter.sparqlWhere).forEach(sw => {\n resourceWhere.push(sw);\n });\n }\n\n if (hasFullTextSearch) {\n resourceWhere.push({\n type: 'group',\n patterns: [\n {\n queryType: 'SELECT',\n variables: [variable('s1')],\n where: [\n triple(variable('s1'), variable('p1'), variable('o1')),\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isliteral',\n args: [variable('o1')]\n }\n },\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'regex',\n args: [\n {\n type: 'operation',\n operator: 'lcase',\n args: [\n {\n type: 'operation',\n operator: 'str',\n args: [variable('o1')]\n }\n ]\n },\n literal(filter.q.toLowerCase(), '', namedNode('http://www.w3.org/2001/XMLSchema#string'))\n ]\n }\n }\n ],\n type: 'query'\n }\n ]\n });\n }\n\n // Other filters\n // SPARQL keyword a = filter based on the class of a resource (example => 'a': 'pair:OrganizationType')\n // Other filters are based on a value (example => 'petr:hasAudience': 'http://localhost:3000/audiences/tout-public')\n Object.entries(filter).forEach(([predicate, object]) => {\n if (!reservedFilterKeys.includes(predicate)) {\n resourceWhere.unshift(\n triple(\n variable('s1'),\n namedNode(resolvePrefix(predicate, ontologies)),\n namedNode(resolvePrefix(object, ontologies))\n )\n );\n }\n });\n }\n\n // Blank nodes\n const blankNodesQuery = blankNodes\n ? buildBlankNodesQuery(blankNodes, baseQuery, ontologies)\n : buildAutoDetectBlankNodesQuery(blankNodesDepth, baseQuery);\n\n if (blankNodesQuery && blankNodesQuery.construct) {\n resourceWhere = resourceWhere.concat(blankNodesQuery.where);\n sparqlJsParams.template = sparqlJsParams.template.concat(blankNodesQuery.construct);\n } else {\n resourceWhere.push(baseQuery.where);\n }\n\n sparqlJsParams.where.push(\n {\n type: 'union',\n patterns: [\n containerWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: containerWhere\n }\n ]\n },\n {\n type: 'union',\n patterns: [\n resourceWhere,\n {\n type: 'graph',\n name: namedNode('http://semapps.org/mirror'),\n patterns: resourceWhere\n }\n ]\n }\n );\n\n return generator.stringify(sparqlJsParams);\n};\n\nexport default buildSparqlQuery;\n","import { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\nconst defaultToArray = value => (!value ? [] : Array.isArray(value) ? value : [value]);\n\n// We need to always include the type or React-Admin will not work properly\nconst typeQuery = triple(\n variable('s1'),\n namedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'),\n variable('type')\n);\n\nconst buildBaseQuery = (predicates, ontologies) => {\n let baseTriples;\n if (predicates) {\n baseTriples = defaultToArray(predicates).map((predicate, i) =>\n triple(variable('s1'), namedNode(resolvePrefix(predicate, ontologies)), variable(`o${i + 1}`))\n );\n return {\n construct: [typeQuery, ...baseTriples],\n where: [typeQuery, ...baseTriples.map(triple => ({ type: 'optional', patterns: [triple] }))]\n };\n }\n baseTriples = [triple(variable('s1'), variable('p1'), variable('o1'))];\n return {\n construct: baseTriples,\n where: baseTriples\n };\n};\n\nexport default buildBaseQuery;\n","const resolvePrefix = (item, ontologies) => {\n if (item.startsWith('http://') || item.startsWith('https://')) {\n // Already resolved, return the URI\n return item;\n }\n if (item === 'a') {\n // Special case\n return 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type';\n }\n const [prefix, value] = item.split(':');\n if (value) {\n const ontology = ontologies.find(ontology => ontology.prefix === prefix);\n if (ontology) {\n return ontology.url + value;\n }\n throw new Error(`No ontology found with prefix ${prefix}`);\n } else {\n throw new Error(`The value \"${item}\" is not correct. It must include a prefix or be a full URI.`);\n }\n};\n\nexport default resolvePrefix;\n","import md5 from 'crypto-js/md5';\nimport { namedNode, triple, variable } from '@rdfjs/data-model';\nimport resolvePrefix from './resolvePrefix';\n\n// Transform ['ont:predicate1/ont:predicate2'] to ['ont:predicate1', 'ont:predicate1/ont:predicate2']\nconst extractNodes = blankNodes => {\n const nodes = [];\n if (blankNodes) {\n for (const predicate of blankNodes) {\n if (predicate.includes('/')) {\n const nodeNames = predicate.split('/');\n for (let i = 1; i <= nodeNames.length; i++) {\n nodes.push(nodeNames.slice(0, i).join('/'));\n }\n } else {\n nodes.push(predicate);\n }\n }\n }\n return nodes;\n};\n\nconst generateSparqlVarName = node => md5(node);\n\nconst getParentNode = node => node.includes('/') && node.split('/')[0];\n\nconst getPredicate = node => (node.includes('/') ? node.split('/')[1] : node);\n\nconst buildUnionQuery = queries =>\n queries.map(q => {\n let triples = q.query;\n const firstTriple = queries.find(q2 => q.parentNode === q2.node);\n if (firstTriple !== undefined) {\n triples = triples.concat(firstTriple.query[0]);\n }\n return {\n type: 'bgp',\n triples\n };\n });\n\nconst buildBlankNodesQuery = (blankNodes, baseQuery, ontologies) => {\n const queries = [];\n const nodes = extractNodes(blankNodes);\n\n if (nodes && ontologies && ontologies.length > 0) {\n for (const node of nodes) {\n const parentNode = getParentNode(node);\n const predicate = getPredicate(node);\n const varName = generateSparqlVarName(node);\n const parentVarName = parentNode ? generateSparqlVarName(parentNode) : '1';\n\n const query = [\n triple(variable(`s${parentVarName}`), namedNode(resolvePrefix(predicate, ontologies)), variable(`s${varName}`)),\n triple(variable(`s${varName}`), variable(`p${varName}`), variable(`o${varName}`))\n ];\n\n queries.push({\n node,\n parentNode,\n query,\n filter: '' // `FILTER(isBLANK(?s${varName})) .`\n });\n }\n\n return {\n construct: queries.length > 0 ? queries.map(q => q.query).reduce((pre, cur) => pre.concat(cur)) : null,\n where: {\n type: 'union',\n patterns: [baseQuery.where, ...buildUnionQuery(queries)]\n }\n };\n }\n return {\n construct: '',\n where: ''\n };\n};\n\nexport default buildBlankNodesQuery;\n","import { triple, variable } from '@rdfjs/data-model';\n\nconst buildAutoDetectBlankNodesQuery = (depth, baseQuery) => {\n const construct = [...baseQuery.construct];\n let where = {};\n if (depth > 0) {\n const whereQueries = [];\n whereQueries.push([baseQuery.where]);\n for (let i = 1; i <= depth; i++) {\n construct.push(triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`)));\n whereQueries.push([\n ...whereQueries[whereQueries.length - 1],\n {\n type: 'filter',\n expression: {\n type: 'operation',\n operator: 'isblank',\n args: [variable(`o${i}`)]\n }\n },\n triple(variable(`o${i}`), variable(`p${i + 1}`), variable(`o${i + 1}`))\n ]);\n }\n where = {\n type: 'union',\n patterns: whereQueries\n };\n } else if (depth === 0) {\n where = baseQuery.where;\n } else {\n throw new Error('The depth of buildAutoDetectBlankNodesQuery should be 0 or more');\n }\n\n return { construct, where };\n};\n\nexport default buildAutoDetectBlankNodesQuery;\n","import urlJoin from 'url-join';\n\nconst findContainersWithPaths = (paths, dataServers) => {\n const containers = {};\n Object.keys(paths).forEach(serverKey => {\n if (dataServers[serverKey]) {\n containers[serverKey] = [];\n paths[serverKey].forEach(path => {\n containers[serverKey].push(urlJoin(dataServers[serverKey].baseUrl, path));\n });\n } else {\n throw new Error(`No server found with key ${serverKey}`);\n }\n });\n return containers;\n};\n\nexport default findContainersWithPaths;\n","import getOne from './getOne';\n\nconst getManyMethod = config => async (resourceId, params) => {\n const { returnFailedResources } = config;\n\n let returnData = await Promise.all(\n params.ids.map(id =>\n getOne(config)(resourceId, { id: typeof id === 'object' ? id['@id'] : id })\n .then(({ data }) => data)\n .catch(() => {\n // Catch if one resource fails to load\n // Otherwise no references will be show if only one is missing\n // See https://github.com/marmelab/react-admin/issues/5190\n if (returnFailedResources) {\n return { id, _error: true };\n }\n // Returning nothing\n })\n )\n );\n\n // We don't want undefined results to appear in the results as it will break with react-admin\n returnData = returnData.filter(e => e);\n\n return { data: returnData };\n};\n\nexport default getManyMethod;\n","import getList from './getList';\n\nconst getManyReferenceMethod = config => async (resourceId, params) => {\n params.filter = { ...params.filter, [params.target]: params.id };\n delete params.target;\n return await getList(config)(resourceId, params);\n};\n\nexport default getManyReferenceMethod;\n","import { RaRecord } from 'react-admin';\nimport { Generator as SparqlGenerator, Update } from 'sparqljs';\nimport { Configuration, PatchParams } from '../types';\n\nconst generator = new SparqlGenerator();\n\nconst patchMethod = (config: Configuration) => async (resourceId: string, params: PatchParams) => {\n const { httpClient } = config;\n\n const sparqlUpdate = {\n type: 'update',\n prefixes: {},\n updates: []\n } as Update;\n\n if (params.triplesToAdd) {\n sparqlUpdate.updates.push({\n updateType: 'insert',\n insert: [{ type: 'bgp', triples: params.triplesToAdd }]\n });\n }\n\n if (params.triplesToRemove) {\n sparqlUpdate.updates.push({\n updateType: 'delete',\n delete: [{ type: 'bgp', triples: params.triplesToRemove }]\n });\n }\n\n await httpClient(`${params.id}`, {\n method: 'PATCH',\n headers: new Headers({\n 'Content-Type': 'application/sparql-update'\n }),\n body: generator.stringify(sparqlUpdate)\n });\n};\n\nexport default patchMethod;\n","import { RaRecord, UpdateParams } from 'react-admin';\nimport { Configuration } from '../types';\nimport handleFiles from '../utils/handleFiles';\n\nconst updateMethod = (config: Configuration) => async (resourceId: string, params: UpdateParams) => {\n const { httpClient, jsonContext } = config;\n\n // Upload files, if there are any\n const { updatedRecord, filesToDelete } = await handleFiles.upload(params.data, config);\n params.data = updatedRecord;\n\n await httpClient(`${params.id}`, {\n method: 'PUT',\n body: JSON.stringify({\n '@context': jsonContext,\n ...params.data\n })\n });\n\n // Delete files only if update is successful\n await handleFiles.delete(filesToDelete, config);\n\n return { data: params.data };\n};\n\nexport default updateMethod;\n","import jwtDecode from 'jwt-decode';\nimport urlJoin from 'url-join';\nimport getServerKeyFromType from './getServerKeyFromType';\n\nconst fetchUserConfig = async config => {\n const { dataServers, httpClient } = config;\n const token = localStorage.getItem('token');\n const podKey = getServerKeyFromType('pod', dataServers);\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n\n // If the user is logged in\n if (token) {\n const payload = jwtDecode(token);\n const webId = payload.webId || payload.webid; // Currently we must deal with both formats\n let userData;\n\n try {\n const { json } = await httpClient(webId);\n userData = json;\n } catch (e) {\n console.error(e);\n // If the webId cannot be fetched, assume an invalid token and disconnect the user\n localStorage.clear();\n window.location.reload();\n return;\n }\n\n // If we have a POD server\n if (podKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[podKey].name = 'My Pod';\n config.dataServers[podKey].baseUrl = userData['pim:storage'] || urlJoin(webId, 'data');\n config.dataServers[podKey].sparqlEndpoint =\n userData.endpoints?.['void:sparqlEndpoint'] || urlJoin(webId, 'sparql');\n }\n\n if (authServerKey) {\n // Fill the config provided to the data provider\n // We must modify the config object directly\n config.dataServers[authServerKey].proxyUrl = userData.endpoints?.proxyUrl;\n }\n } else if (podKey) {\n // If the user is not logged in, ignore the POD server\n delete config.dataServers[podKey];\n }\n};\n\nexport default fetchUserConfig;\n","const defaultToArray = value => (!value ? undefined : Array.isArray(value) ? value : [value]);\n\nconst fetchVoidEndpoints = async config => {\n const fetchPromises = Object.entries(config.dataServers)\n .filter(([key, server]) => server.pod !== true && server.void !== false)\n .map(([key, server]) =>\n config\n .httpClient(new URL('/.well-known/void', server.baseUrl).toString())\n .then(result => ({ key, datasets: result.json['@graph'] }))\n .catch(e => {\n if (e.status === 404 || e.status === 401 || e.status === 500) {\n return { key, error: e };\n }\n throw e;\n })\n );\n\n let results = [];\n\n try {\n results = await Promise.all(fetchPromises);\n } catch (e) {\n // Do not throw error if no endpoint found\n }\n\n for (const result of results) {\n config.dataServers[result.key].containers = config.dataServers[result.key].containers || {};\n config.dataServers[result.key].blankNodes = config.dataServers[result.key].blankNodes || {};\n\n // Ignore unfetchable endpoints\n if (result.datasets) {\n for (const dataset of result.datasets) {\n const datasetServerKey = Object.keys(config.dataServers).find(\n key => dataset['void:uriSpace'] === config.dataServers[key].baseUrl\n );\n\n // If the dataset is not part of a server mapped in the dataServers, ignore it\n if (datasetServerKey) {\n // If this is the local dataset, add the base information\n if (datasetServerKey === result.key) {\n config.dataServers[result.key].name = config.dataServers[result.key].name || dataset['dc:title'];\n config.dataServers[result.key].description =\n config.dataServers[result.key].description || dataset['dc:description'];\n config.dataServers[result.key].sparqlEndpoint =\n config.dataServers[result.key].sparqlEndpoint || dataset['void:sparqlEndpoint'];\n }\n\n config.dataServers[result.key].containers[datasetServerKey] =\n config.dataServers[result.key].containers[datasetServerKey] || {};\n\n for (const partition of defaultToArray(dataset['void:classPartition'])) {\n for (const type of defaultToArray(partition['void:class'])) {\n // Set containers by type\n const path = partition['void:uriSpace'].replace(dataset['void:uriSpace'], '/');\n if (config.dataServers[result.key].containers[datasetServerKey][type]) {\n config.dataServers[result.key].containers[datasetServerKey][type].push(path);\n } else {\n config.dataServers[result.key].containers[datasetServerKey][type] = [path];\n }\n }\n }\n }\n }\n }\n }\n};\n\nexport default fetchVoidEndpoints;\n","import { fetchUtils } from 'react-admin';\nimport getServerKeyFromUri from './utils/getServerKeyFromUri';\nimport getServerKeyFromType from './utils/getServerKeyFromType';\n\n/*\n * HTTP client used by all calls in data provider and auth provider\n * Do proxy calls if a proxy endpoint is available and the server is different from the auth server\n */\nconst httpClient =\n dataServers =>\n (url, options = {}) => {\n const authServerKey = getServerKeyFromType('authServer', dataServers);\n const serverKey = getServerKeyFromUri(url, dataServers);\n const useProxy =\n serverKey !== authServerKey && dataServers[authServerKey]?.proxyUrl && dataServers[serverKey]?.noProxy !== true;\n\n if (!options.headers) options.headers = new Headers();\n\n switch (options.method) {\n case 'POST':\n case 'PATCH':\n case 'PUT':\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n if (!options.headers.has('Content-Type')) options.headers.set('Content-Type', 'application/ld+json');\n break;\n\n case 'DELETE':\n break;\n\n case 'GET':\n default:\n if (!options.headers.has('Accept')) options.headers.set('Accept', 'application/ld+json');\n break;\n }\n\n if (useProxy) {\n const formData = new FormData();\n\n formData.append('id', url);\n formData.append('method', options.method || 'GET');\n formData.append('headers', JSON.stringify(Object.fromEntries(options.headers.entries())));\n\n if (options.body) {\n if (options.body instanceof File) {\n formData.append('body', options.body, options.body.name);\n } else {\n formData.append('body', options.body);\n }\n }\n\n // Post to proxy endpoint with multipart/form-data format\n return fetchUtils.fetchJson(dataServers[authServerKey].proxyUrl, {\n method: 'POST',\n headers: new Headers({\n Authorization: `Bearer ${localStorage.getItem('token')}`\n }),\n body: formData\n });\n }\n // Add token if the server is the same as the auth server\n if (serverKey === authServerKey) {\n const token = localStorage.getItem('token');\n if (token) options.headers.set('Authorization', `Bearer ${token}`);\n }\n return fetchUtils.fetchJson(url, options);\n };\n\nexport default httpClient;\n","// Return the first server matching with the baseUrl\nconst getServerKeyFromUri = (uri, dataServers) => {\n if (!uri) throw Error(`No URI provided to getServerKeyFromUri`);\n return Object.keys(dataServers).find(key => {\n if (dataServers[key].pod) {\n // The baseUrl ends with /data so remove this part to match with the webId and webId-related URLs (/inbox, /outbox...)\n return dataServers[key].baseUrl && uri.startsWith(dataServers[key].baseUrl.replace('/data', ''));\n }\n return uri.startsWith(dataServers[key].baseUrl);\n });\n};\n\nexport default getServerKeyFromUri;\n","import { useCallback, useMemo, useContext } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst compute = (externalLinks, record) =>\n typeof externalLinks === 'function' ? externalLinks(record) : externalLinks;\nconst isURL = url => typeof url === 'string' && url.startsWith('http');\n\nconst useGetExternalLink = componentExternalLinks => {\n // Since the externalLinks config is defined only locally, we don't need to wait for VOID endpoints fetching\n const dataProvider = useContext(DataProviderContext);\n const dataServers = dataProvider.getLocalDataServers();\n\n const serversExternalLinks = useMemo(() => {\n if (dataServers) {\n return Object.fromEntries(\n Object.values(dataServers).map(server => {\n // If externalLinks is not defined in the data server, use external links for non-default servers\n const externalLinks = server.externalLinks !== undefined ? server.externalLinks : !server.default;\n return [server.baseUrl, externalLinks];\n })\n );\n }\n }, [dataServers]);\n\n return useCallback(\n record => {\n const computedComponentExternalLinks = compute(componentExternalLinks, record);\n // If the component explicitly asks not to display as external links, use an internal link\n if (computedComponentExternalLinks === false) return false;\n\n if (!record?.id) return false;\n\n const serverBaseUrl = Object.keys(serversExternalLinks).find(baseUrl => record?.id.startsWith(baseUrl));\n // If no matching data servers could be found, assume we have an internal link\n if (!serverBaseUrl) return false;\n\n const computedServerExternalLinks = compute(serversExternalLinks[serverBaseUrl], record);\n // If the data server explicitly asks not to display as external links, use an internal link\n if (computedServerExternalLinks === false) return false;\n\n if (isURL(computedComponentExternalLinks)) {\n return computedComponentExternalLinks;\n }\n if (isURL(computedServerExternalLinks)) {\n return computedServerExternalLinks;\n }\n return record.id;\n },\n [serversExternalLinks, componentExternalLinks]\n );\n};\n\nexport default useGetExternalLink;\n","import { useState, useEffect } from 'react';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findContainersWithTypes from '../dataProvider/utils/findContainersWithTypes';\nimport { DataServerKey } from '../dataProvider/types';\n\nconst useContainers = (resourceId: string, serverKeys = '@all') => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [containers, setContainers] = useState>();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n setContainers(findContainersWithTypes(dataModel.types, serverKeys, dataServers));\n }\n }, [dataModel, dataServers, serverKeys]);\n\n return containers;\n};\n\nexport default useContainers;\n","import { useContext, useState, useEffect } from 'react';\nimport { DataProviderContext } from 'react-admin';\n\nconst useDataModel = (resourceId: string) => {\n // Get the raw data provider, since useDataProvider returns a wrapper\n const dataProvider = useContext(DataProviderContext);\n const [dataModel, setDataModel] = useState(undefined); // TODO: Type this object\n\n useEffect(() => {\n dataProvider.getDataModels().then((results: any) => setDataModel(results[resourceId]));\n }, [dataProvider, resourceId, setDataModel]);\n\n return dataModel;\n};\n\nexport default useDataModel;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { SemanticDataProvider, DataServersConfig } from '../dataProvider/types';\n\nconst useDataServers = () => {\n const dataProvider = useDataProvider();\n const [dataServers, setDataServers] = useState();\n\n useEffect(() => {\n dataProvider.getDataServers().then(results => {\n setDataServers(results);\n });\n }, [dataProvider, setDataServers]);\n\n return dataServers;\n};\n\nexport default useDataServers;\n","import { useState, useEffect } from 'react';\nimport urlJoin from 'url-join';\nimport useDataModel from './useDataModel';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\n\n/** @deprecated Use \"useCreateContainerUri\" instead */\nconst useCreateContainer = resourceId => {\n const dataModel = useDataModel(resourceId);\n const dataServers = useDataServers();\n const [createContainer, setCreateContainer] = useState();\n\n useEffect(() => {\n if (dataModel && dataServers) {\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n setCreateContainer(urlJoin(dataServers[serverKey].baseUrl, path));\n } else if (dataModel.create?.server) {\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers));\n } else {\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n setCreateContainer(findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers));\n }\n }\n }, [dataModel, dataServers, setCreateContainer]);\n\n return createContainer;\n};\n\nexport default useCreateContainer;\n","import urlJoin from 'url-join';\nimport { DataModel, DataServerKey, DataServersConfig } from '../types';\n\nconst findCreateContainerWithTypes = (\n types: DataModel['types'],\n createServerKey: DataServerKey,\n dataServers: DataServersConfig\n) => {\n const containers: string[] = [];\n\n Object.keys(dataServers[createServerKey].containers?.[createServerKey] || {}).forEach(type => {\n if (types.includes(type)) {\n dataServers[createServerKey].containers![createServerKey][type].forEach(path => {\n const containerUri = urlJoin(dataServers[createServerKey].baseUrl, path);\n if (!containers.includes(containerUri)) {\n containers.push(containerUri);\n }\n });\n }\n });\n\n if (containers.length === 0) {\n throw new Error(\n `No container found matching with types ${JSON.stringify(\n types\n )}. You can set explicitely the create.container property of the resource.`\n );\n } else if (containers.length > 1) {\n throw new Error(\n `More than one container found matching with types ${JSON.stringify(\n types\n )}. You must set the create.server or create.container property for the resource.`\n );\n }\n\n return containers[0];\n};\n\nexport default findCreateContainerWithTypes;\n","import { useCallback } from 'react';\nimport urlJoin from 'url-join';\nimport useDataServers from './useDataServers';\nimport findCreateContainerWithTypes from '../dataProvider/utils/findCreateContainerWithTypes';\nimport getServerKeyFromType from '../dataProvider/utils/getServerKeyFromType';\nimport useDataModels from './useDataModels';\n\nconst useCreateContainerUri = () => {\n const dataModels = useDataModels();\n const dataServers = useDataServers();\n\n const getContainerUri = useCallback(\n (resourceId: string) => {\n if (!dataModels || !dataServers || !dataModels[resourceId]) {\n return undefined;\n }\n\n const dataModel = dataModels[resourceId];\n\n if (dataModel.create?.container) {\n const [serverKey, path] = Object.entries(dataModel.create.container)[0];\n if (!serverKey || !dataServers[serverKey]) {\n throw new Error(`Wrong key for the dataModel.create.container config of resource ${resourceId}`);\n }\n return urlJoin(dataServers[serverKey].baseUrl, path);\n }\n\n if (dataModel.create?.server) {\n return findCreateContainerWithTypes(dataModel.types, dataModel.create?.server, dataServers);\n }\n\n const defaultServerKey = getServerKeyFromType('default', dataServers);\n\n if (!defaultServerKey) {\n throw new Error(\n `No default dataServer found. You can set explicitly one setting the \"default\" attribute to true`\n );\n }\n\n return findCreateContainerWithTypes(dataModel.types, defaultServerKey, dataServers);\n },\n [dataModels, dataServers]\n );\n\n return getContainerUri;\n};\n\nexport default useCreateContainerUri;\n","import { useState, useEffect } from 'react';\nimport { useDataProvider } from 'react-admin';\nimport { DataModel, SemanticDataProvider } from '../dataProvider/types';\n\nconst useDataModels = () => {\n const dataProvider = useDataProvider();\n const [dataModels, setDataModels] = useState>();\n\n useEffect(() => {\n dataProvider.getDataModels().then(results => {\n setDataModels(results);\n });\n }, [dataProvider, setDataModels]);\n\n return dataModels;\n};\n\nexport default useDataModels;\n","import React, { useState, useEffect } from 'react';\n\n/**\n * @example\n * \n * \n * \n * \n * \n * \n */\n\nconst FilterHandler = ({ children, record, filter, source, ...otherProps }) => {\n const [filtered, setFiltered] = useState();\n useEffect(() => {\n if (record && source && Array.isArray(record?.[source])) {\n const filteredData = record?.[source].filter(r => {\n let eq = true;\n for (const key in filter) {\n const value = r[key];\n if (Array.isArray(value)) {\n if (!value.includes(filter[key])) {\n eq = false;\n }\n } else if (value !== filter[key]) {\n eq = false;\n }\n }\n return eq;\n });\n const newRecord = {\n ...record\n };\n // undefined setted if no data to obtain no render in RightLabel or equivalent\n newRecord[source] = filteredData.length > 0 ? filteredData : undefined;\n setFiltered(newRecord);\n }\n }, [record, source, filter]);\n\n return (\n <>\n {React.Children.map(children, (child, i) => {\n return React.cloneElement(child, {\n ...otherProps,\n record: filtered,\n source\n });\n })}\n \n );\n};\nexport default FilterHandler;\n","import React from 'react';\nimport { useGetList, useRecordContext } from 'react-admin';\nimport { default as FilterHandler } from './FilterHandler';\n\n/*\n * @example Label used in examples\n * const Label = ({label, ...otherProps})=>{\n * return

{label}

\n * }\n *\n * @example show header for each group with group property thanks to groupHeader\n * }\n * filterProperty=\"property of source filtered by groupReference\"\n * >\n * // same props as GroupedArrayField source\n * \n * \n * \n * \n *\n * @example call chhildren with label thanks to groupLabel\n * \n *