@semapps/activitypub-components 0.6.0-alpha.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +96 -62
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +20 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +98 -64
- package/dist/index.es.js.map +1 -1
- package/package.json +7 -6
package/dist/index.cjs.js
CHANGED
|
@@ -11,6 +11,7 @@ var $583VT$semappsauthprovider = require("@semapps/auth-provider");
|
|
|
11
11
|
var $583VT$tiptapcore = require("@tiptap/core");
|
|
12
12
|
var $583VT$tiptapextensionmention = require("@tiptap/extension-mention");
|
|
13
13
|
var $583VT$semappsfieldcomponents = require("@semapps/field-components");
|
|
14
|
+
var $583VT$reactquery = require("react-query");
|
|
14
15
|
var $583VT$tiptapreact = require("@tiptap/react");
|
|
15
16
|
var $583VT$tippyjs = require("tippy.js");
|
|
16
17
|
|
|
@@ -544,6 +545,7 @@ var $d68cd57b2d06b6d5$export$2e2bcd8739ae039 = $d68cd57b2d06b6d5$var$CommentsLis
|
|
|
544
545
|
|
|
545
546
|
|
|
546
547
|
|
|
548
|
+
|
|
547
549
|
const $3ff23aa25753c478$export$e57ff0f701c44363 = (value)=>{
|
|
548
550
|
// If the field is null-ish, we suppose there are no values.
|
|
549
551
|
if (!value) return [];
|
|
@@ -559,12 +561,13 @@ var $3ff23aa25753c478$export$2e2bcd8739ae039 = {
|
|
|
559
561
|
};
|
|
560
562
|
|
|
561
563
|
|
|
562
|
-
const $2b75a2f49c9ef165$var$useCollection = (predicateOrUrl)=>{
|
|
563
|
-
const {
|
|
564
|
-
const
|
|
565
|
-
const [
|
|
566
|
-
const [
|
|
567
|
-
const
|
|
564
|
+
const $2b75a2f49c9ef165$var$useCollection = (predicateOrUrl, options = {})=>{
|
|
565
|
+
const { dereferenceItems: dereferenceItems = false } = options;
|
|
566
|
+
const { data: identity } = (0, $583VT$reactadmin.useGetIdentity)();
|
|
567
|
+
const [items, setItems] = (0, $583VT$react.useState)();
|
|
568
|
+
const [totalItems, setTotalItems] = (0, $583VT$react.useState)();
|
|
569
|
+
const dataProvider = (0, $583VT$reactadmin.useDataProvider)();
|
|
570
|
+
const queryClient = (0, $583VT$reactquery.useQueryClient)();
|
|
568
571
|
const collectionUrl = (0, $583VT$react.useMemo)(()=>{
|
|
569
572
|
if (predicateOrUrl) {
|
|
570
573
|
if (predicateOrUrl.startsWith("http")) return predicateOrUrl;
|
|
@@ -574,67 +577,99 @@ const $2b75a2f49c9ef165$var$useCollection = (predicateOrUrl)=>{
|
|
|
574
577
|
identity,
|
|
575
578
|
predicateOrUrl
|
|
576
579
|
]);
|
|
577
|
-
const
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
setLoading(false);
|
|
601
|
-
});
|
|
580
|
+
const fetchCollection = (0, $583VT$react.useCallback)(async ({ pageParam: nextPageUrl })=>{
|
|
581
|
+
let { json: json } = await dataProvider.fetch(nextPageUrl || collectionUrl);
|
|
582
|
+
if (json.totalItems) setTotalItems(json.totalItems);
|
|
583
|
+
if ((json.type === "OrderedCollection" || json.type === "Collection") && json.first) {
|
|
584
|
+
if (json.first?.items) {
|
|
585
|
+
if (json.first?.items.length === 0 && json.first?.next) // Special case where the first property is an object without items
|
|
586
|
+
({ json: json } = await dataProvider.fetch(json.first?.next));
|
|
587
|
+
else json = json.first;
|
|
588
|
+
} else // Fetch the first page
|
|
589
|
+
({ json: json } = await dataProvider.fetch(json.first));
|
|
590
|
+
}
|
|
591
|
+
// Force dereference of items
|
|
592
|
+
if (dereferenceItems) {
|
|
593
|
+
const itemPredicate = json.items ? "items" : "orderedItems";
|
|
594
|
+
json[itemPredicate] = json[itemPredicate] && await Promise.all((0, $3ff23aa25753c478$export$e57ff0f701c44363)(json[itemPredicate]).map(async (item)=>{
|
|
595
|
+
if (typeof item === "string") {
|
|
596
|
+
const { json: json } = await dataProvider.fetch(item);
|
|
597
|
+
return json;
|
|
598
|
+
}
|
|
599
|
+
return item;
|
|
600
|
+
}));
|
|
601
|
+
}
|
|
602
|
+
return json;
|
|
602
603
|
}, [
|
|
603
|
-
|
|
604
|
-
setLoaded,
|
|
605
|
-
setLoading,
|
|
606
|
-
setError,
|
|
604
|
+
dataProvider,
|
|
607
605
|
collectionUrl,
|
|
608
|
-
identity
|
|
606
|
+
identity,
|
|
607
|
+
setTotalItems
|
|
609
608
|
]);
|
|
609
|
+
const { data: data, error: error, fetchNextPage: fetchNextPage, refetch: refetch, hasNextPage: hasNextPage, isLoading: isLoading, isFetching: isFetching, isFetchingNextPage: isFetchingNextPage, status: status } = (0, $583VT$reactquery.useInfiniteQuery)([
|
|
610
|
+
"Collection",
|
|
611
|
+
{
|
|
612
|
+
collectionUrl: collectionUrl
|
|
613
|
+
}
|
|
614
|
+
], fetchCollection, {
|
|
615
|
+
enabled: !!(collectionUrl && identity?.id),
|
|
616
|
+
getNextPageParam: (lastPage)=>lastPage.next,
|
|
617
|
+
getPreviousPageParam: (firstPage)=>firstPage.prev
|
|
618
|
+
});
|
|
610
619
|
(0, $583VT$react.useEffect)(()=>{
|
|
611
|
-
if (
|
|
620
|
+
if (data?.pages) setItems([].concat(...data.pages.map((p)=>(0, $3ff23aa25753c478$export$e57ff0f701c44363)(p.orderedItems || p.items))));
|
|
612
621
|
}, [
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
loading,
|
|
616
|
-
loaded,
|
|
617
|
-
error
|
|
622
|
+
data,
|
|
623
|
+
setItems
|
|
618
624
|
]);
|
|
619
625
|
const addItem = (0, $583VT$react.useCallback)((item)=>{
|
|
620
626
|
setItems((oldItems)=>[
|
|
621
627
|
...oldItems,
|
|
622
628
|
item
|
|
623
629
|
]);
|
|
630
|
+
// TODO use queryClient.setQueryData to update items directly in react-query cache
|
|
631
|
+
setTimeout(()=>queryClient.refetchQueries([
|
|
632
|
+
"Collection",
|
|
633
|
+
{
|
|
634
|
+
collectionUrl: collectionUrl
|
|
635
|
+
}
|
|
636
|
+
], {
|
|
637
|
+
active: true,
|
|
638
|
+
exact: true
|
|
639
|
+
}), 2000);
|
|
624
640
|
}, [
|
|
625
|
-
setItems
|
|
641
|
+
setItems,
|
|
642
|
+
queryClient,
|
|
643
|
+
collectionUrl
|
|
626
644
|
]);
|
|
627
645
|
const removeItem = (0, $583VT$react.useCallback)((itemId)=>{
|
|
628
646
|
setItems((oldItems)=>oldItems.filter((item)=>typeof item === "string" ? item !== itemId : item.id !== itemId));
|
|
647
|
+
// TODO use queryClient.setQueryData to update items directly in react-query cache
|
|
648
|
+
setTimeout(()=>queryClient.refetchQueries([
|
|
649
|
+
"Collection",
|
|
650
|
+
{
|
|
651
|
+
collectionUrl: collectionUrl
|
|
652
|
+
}
|
|
653
|
+
], {
|
|
654
|
+
active: true,
|
|
655
|
+
exact: true
|
|
656
|
+
}), 2000);
|
|
629
657
|
}, [
|
|
630
|
-
setItems
|
|
658
|
+
setItems,
|
|
659
|
+
queryClient,
|
|
660
|
+
collectionUrl
|
|
631
661
|
]);
|
|
632
662
|
return {
|
|
633
663
|
items: items,
|
|
634
|
-
|
|
635
|
-
loaded: loaded,
|
|
664
|
+
totalItems: totalItems,
|
|
636
665
|
error: error,
|
|
637
|
-
refetch:
|
|
666
|
+
refetch: refetch,
|
|
667
|
+
fetchNextPage: fetchNextPage,
|
|
668
|
+
hasNextPage: hasNextPage,
|
|
669
|
+
isLoading: isLoading,
|
|
670
|
+
isFetching: isFetching,
|
|
671
|
+
isFetchingNextPage: isFetchingNextPage,
|
|
672
|
+
status: status,
|
|
638
673
|
addItem: addItem,
|
|
639
674
|
removeItem: removeItem,
|
|
640
675
|
url: collectionUrl
|
|
@@ -679,24 +714,23 @@ var $2e5504cc4159ca8d$export$2e2bcd8739ae039 = $2e5504cc4159ca8d$var$CommentsFie
|
|
|
679
714
|
|
|
680
715
|
|
|
681
716
|
|
|
682
|
-
const $505d598a33288aad$var$CollectionList = ({ collectionUrl: collectionUrl, resource: resource, children: children
|
|
717
|
+
const $505d598a33288aad$var$CollectionList = ({ collectionUrl: collectionUrl, resource: resource, children: children })=>{
|
|
683
718
|
if ((0, ($parcel$interopDefault($583VT$react))).Children.count(children) !== 1) throw new Error("<CollectionList> only accepts a single child");
|
|
684
|
-
|
|
685
|
-
const { data:
|
|
686
|
-
|
|
719
|
+
const { items: actorsUris } = (0, $2b75a2f49c9ef165$export$2e2bcd8739ae039)(collectionUrl);
|
|
720
|
+
const { data: data, isLoading: isLoading, isFetching: isFetching } = (0, $583VT$reactadmin.useGetMany)(resource, {
|
|
721
|
+
ids: Array.isArray(actorsUris) ? actorsUris : [
|
|
722
|
+
actorsUris
|
|
723
|
+
]
|
|
724
|
+
}, {
|
|
725
|
+
enabled: !!actorsUris
|
|
687
726
|
});
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
children: /*#__PURE__*/ (0, $583VT$reactjsxruntime.jsx)((0, $583VT$reactadmin.LinearProgress), {})
|
|
727
|
+
const listContext = (0, $583VT$reactadmin.useList)({
|
|
728
|
+
data: data,
|
|
729
|
+
isLoading: isLoading,
|
|
730
|
+
isFetching: isFetching
|
|
693
731
|
});
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
reference: resource,
|
|
697
|
-
record: collection,
|
|
698
|
-
source: "items",
|
|
699
|
-
...rest,
|
|
732
|
+
return /*#__PURE__*/ (0, $583VT$reactjsxruntime.jsx)((0, $583VT$reactadmin.ListContextProvider), {
|
|
733
|
+
value: listContext,
|
|
700
734
|
children: children
|
|
701
735
|
});
|
|
702
736
|
};
|
package/dist/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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.js","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/hooks/useCollection.js","packages/activitypub-components/src/utils.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.js","packages/activitypub-components/src/hooks/useNodeinfo.js","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 <PostCommentForm\n context={context}\n helperText={helperText}\n userResource={userResource}\n placeholder={placeholder}\n mentions={mentions}\n addItem={addItem}\n removeItem={removeItem}\n />\n <CommentsList comments={comments} loading={loading} userResource={userResource} />\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 { 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 <Form onSubmit={onSubmit} className={classes.form}>\n <Box className={classes.container} onClick={openAuthIfDisconnected}>\n <Avatar\n src={\n identity?.webIdData?.[userDataModel?.fieldsMapping?.image] ||\n identity?.profileData?.[userDataModel?.fieldsMapping?.image]\n }\n className={classes.avatar}\n />\n <RichTextInput\n source=\"comment\"\n label=\" \"\n toolbar={<EmptyToolbar />}\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 <Button\n type=\"submit\"\n size=\"small\"\n variant=\"contained\"\n color=\"primary\"\n endIcon={<SendIcon />}\n className={classes.button}\n >\n Envoyer\n </Button>\n )}\n </Box>\n </Form>\n <AuthDialog\n open={openAuth}\n onClose={() => 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 TRAVAL: '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, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useOutbox = () => {\n const { identity } = useGetIdentity();\n\n const outboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.outbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async activity => {\n if (!outboxUrl)\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the loaded argument of useOutbox'\n );\n const token = localStorage.getItem('token');\n const { headers } = await fetchUtils.fetchJson(outboxUrl, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n }),\n headers: new Headers({\n 'Content-Type': 'application/ld+json',\n Authorization: `Bearer ${token}`\n })\n });\n return headers.get('Location');\n },\n [outboxUrl]\n );\n\n const fetch = useCallback(async () => {\n if (!sparqlEndpoint || !outboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${outboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n }, [sparqlEndpoint, outboxUrl]);\n\n return { post, fetch, url: outboxUrl, loaded: !!outboxUrl, owner: identity?.id };\n};\n\nexport default useOutbox;\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 <Box position=\"relative\">\n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n <Box className={classes.container} key={comment.id}>\n <Box className={classes.avatar}>\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <AvatarWithLabelField image={userDataModel?.fieldsMapping?.image} />\n </ReferenceField>\n </Box>\n <Box className={classes.text}>\n <Typography variant=\"body2\">\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <TextField variant=\"body2\" source={userDataModel?.fieldsMapping?.title} className={classes.label} />\n </ReferenceField>\n • \n <DateField record={comment} variant=\"body2\" source=\"published\" showTime />\n </Typography>\n <RichTextField record={comment} variant=\"body1\" source=\"content\" className={classes.content} />\n </Box>\n </Box>\n ))}\n {loading && (\n <Box minHeight={200}>\n <Box alignItems=\"center\" className={classes.loading}>\n <CircularProgress size={60} thickness={6} />\n </Box>\n </Box>\n )}\n </Box>\n );\n};\n\nexport default CommentsList;\n","import { useCallback, useMemo, useState, useEffect } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { arrayOf } from '../utils';\n\nconst useCollection = predicateOrUrl => {\n const { data: identity, isLoading: identityLoading } = useGetIdentity();\n const [items, setItems] = useState([]);\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [error, setError] = useState(false);\n\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 }, [identity, predicateOrUrl]);\n\n const fetch = useCallback(async () => {\n if (!collectionUrl) return;\n\n setLoading(true);\n\n const headers = new Headers({ Accept: 'application/ld+json' });\n\n // Add authorization token if it is set and if the user is on the same server as the collection\n const identityOrigin = identity.id && new URL(identity.id).origin;\n const collectionOrigin = new URL(collectionUrl).origin;\n const token = localStorage.getItem('token');\n if (identityOrigin === collectionOrigin && token) {\n headers.set('Authorization', `Bearer ${token}`);\n }\n\n fetchUtils\n .fetchJson(collectionUrl, { headers })\n .then(({ json }) => {\n if (json && json.items) {\n setItems(arrayOf(json.items));\n } else if (json && json.orderedItems) {\n setItems(arrayOf(json.orderedItems));\n } else {\n setItems([]);\n }\n setError(false);\n setLoaded(true);\n setLoading(false);\n })\n .catch(() => {\n setError(true);\n setLoaded(true);\n setLoading(false);\n });\n }, [setItems, setLoaded, setLoading, setError, collectionUrl, identity]);\n\n useEffect(() => {\n if (!identityLoading && !loading && !loaded && !error) {\n fetch();\n }\n }, [fetch, identityLoading, loading, loaded, error]);\n\n const addItem = useCallback(\n item => {\n setItems(oldItems => [...oldItems, item]);\n },\n [setItems]\n );\n\n const removeItem = useCallback(\n itemId => {\n setItems(oldItems => oldItems.filter(item => (typeof item === 'string' ? item !== itemId : item.id !== itemId)));\n },\n [setItems]\n );\n\n return { items, loading, loaded, error, refetch: fetch, addItem, removeItem, url: collectionUrl };\n};\n\nexport default useCollection;\n","export const arrayOf = value => {\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 {\n arrayOf\n};\n","import React from 'react';\nimport { useGetOne, LinearProgress } from 'react-admin';\nimport { ReferenceArrayField } from '@semapps/field-components';\n\nconst CollectionList = ({ collectionUrl, resource, children, ...rest }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error('<CollectionList> only accepts a single child');\n }\n\n // TODO use a simple fetch call, as the resource is not good and it is useless\n const { data: collection, isLoading } = useGetOne(resource, collectionUrl, { enabled: !!collectionUrl });\n\n if (isLoading) {\n return (\n <div style={{ marginTop: 8 }}>\n <LinearProgress />\n </div>\n );\n }\n if (!collection) {\n return null;\n }\n\n return (\n <ReferenceArrayField reference={resource} record={collection} source=\"items\" {...rest}>\n {children}\n </ReferenceArrayField>\n );\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, record, reference, children, ...rest }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error('<ReferenceCollectionField> only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n <CollectionList resource={reference} collectionUrl={record[source]} {...rest}>\n {children}\n </CollectionList>\n );\n};\n\nexport default ReferenceCollectionField;\n","import { useCallback, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useInbox = () => {\n const { identity } = useGetIdentity();\n\n const inboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.inbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n const fetch = useCallback(\n async ({ filters }) => {\n if (!sparqlEndpoint || !inboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n let filtersWhereQuery = '';\n if (filters) {\n Object.keys(filters).forEach(predicate => {\n if (filters[predicate]) {\n const object = filters[predicate].startsWith('http') ? `<${filters[predicate]}>` : filters[predicate];\n filtersWhereQuery += `?s1 ${predicate} ${object} .`;\n }\n });\n }\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${inboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n FILTER( (isIRI(?s1)) ) .\n ${filtersWhereQuery}\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n },\n [sparqlEndpoint, inboxUrl]\n );\n\n return { fetch, url: inboxUrl, owner: identity?.id };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useNodeinfo = (host, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\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 } = 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 const { json } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\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 <div className={classes.items}>\n {props.items.length ? (\n props.items.map((item, index) => (\n <button\n className={classes.item + (index === selectedIndex ? ' selected' : '')}\n key={index}\n onClick={() => selectItem(index)}\n >\n {item.label}\n </button>\n ))\n ) : (\n <div className={classes.item}>Aucun résultat</div>\n )}\n </div>\n );\n});\n"],"names":[],"version":3,"file":"index.cjs.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;;;;;;;;;;;;;;AGAN,MAAM,4CAAiB;IAC5B,QAAQ;IACR,KAAK;IACL,UA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A;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.js","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/hooks/useCollection.js","packages/activitypub-components/src/utils.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.js","packages/activitypub-components/src/hooks/useNodeinfo.js","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 <PostCommentForm\n context={context}\n helperText={helperText}\n userResource={userResource}\n placeholder={placeholder}\n mentions={mentions}\n addItem={addItem}\n removeItem={removeItem}\n />\n <CommentsList comments={comments} loading={loading} userResource={userResource} />\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 { 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 <Form onSubmit={onSubmit} className={classes.form}>\n <Box className={classes.container} onClick={openAuthIfDisconnected}>\n <Avatar\n src={\n identity?.webIdData?.[userDataModel?.fieldsMapping?.image] ||\n identity?.profileData?.[userDataModel?.fieldsMapping?.image]\n }\n className={classes.avatar}\n />\n <RichTextInput\n source=\"comment\"\n label=\" \"\n toolbar={<EmptyToolbar />}\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 <Button\n type=\"submit\"\n size=\"small\"\n variant=\"contained\"\n color=\"primary\"\n endIcon={<SendIcon />}\n className={classes.button}\n >\n Envoyer\n </Button>\n )}\n </Box>\n </Form>\n <AuthDialog\n open={openAuth}\n onClose={() => 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 TRAVAL: '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, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useOutbox = () => {\n const { identity } = useGetIdentity();\n\n const outboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.outbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async activity => {\n if (!outboxUrl)\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the loaded argument of useOutbox'\n );\n const token = localStorage.getItem('token');\n const { headers } = await fetchUtils.fetchJson(outboxUrl, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n }),\n headers: new Headers({\n 'Content-Type': 'application/ld+json',\n Authorization: `Bearer ${token}`\n })\n });\n return headers.get('Location');\n },\n [outboxUrl]\n );\n\n const fetch = useCallback(async () => {\n if (!sparqlEndpoint || !outboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${outboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n }, [sparqlEndpoint, outboxUrl]);\n\n return { post, fetch, url: outboxUrl, loaded: !!outboxUrl, owner: identity?.id };\n};\n\nexport default useOutbox;\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 <Box position=\"relative\">\n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n <Box className={classes.container} key={comment.id}>\n <Box className={classes.avatar}>\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <AvatarWithLabelField image={userDataModel?.fieldsMapping?.image} />\n </ReferenceField>\n </Box>\n <Box className={classes.text}>\n <Typography variant=\"body2\">\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <TextField variant=\"body2\" source={userDataModel?.fieldsMapping?.title} className={classes.label} />\n </ReferenceField>\n • \n <DateField record={comment} variant=\"body2\" source=\"published\" showTime />\n </Typography>\n <RichTextField record={comment} variant=\"body1\" source=\"content\" className={classes.content} />\n </Box>\n </Box>\n ))}\n {loading && (\n <Box minHeight={200}>\n <Box alignItems=\"center\" className={classes.loading}>\n <CircularProgress size={60} thickness={6} />\n </Box>\n </Box>\n )}\n </Box>\n );\n};\n\nexport default CommentsList;\n","import { useCallback, useMemo, useState, useEffect } from 'react';\nimport { useGetIdentity, useDataProvider } from 'react-admin';\nimport { useInfiniteQuery, useQueryClient } from 'react-query';\nimport { arrayOf } from '../utils';\n\nconst useCollection = (predicateOrUrl, options = {}) => {\n const { dereferenceItems = false } = options;\n const { data: identity } = useGetIdentity();\n const [items, setItems] = useState();\n const [totalItems, setTotalItems] = useState();\n const dataProvider = useDataProvider();\n const queryClient = useQueryClient();\n\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 }, [identity, predicateOrUrl]);\n\n const fetchCollection = useCallback(\n async ({ pageParam: nextPageUrl }) => {\n let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);\n if (json.totalItems) setTotalItems(json.totalItems);\n\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 // Force dereference of items\n if (dereferenceItems) {\n const itemPredicate = json.items ? 'items' : 'orderedItems';\n json[itemPredicate] =\n json[itemPredicate] &&\n (await Promise.all(\n arrayOf(json[itemPredicate]).map(async item => {\n if (typeof item === 'string') {\n const { json } = await dataProvider.fetch(item);\n return json;\n }\n return item;\n })\n ));\n }\n\n return json;\n },\n [dataProvider, collectionUrl, identity, setTotalItems]\n );\n\n const { data, error, fetchNextPage, refetch, hasNextPage, isLoading, isFetching, isFetchingNextPage, status } =\n useInfiniteQuery(['Collection', { collectionUrl }], fetchCollection, {\n enabled: !!(collectionUrl && identity?.id),\n getNextPageParam: lastPage => lastPage.next,\n getPreviousPageParam: firstPage => firstPage.prev\n });\n\n useEffect(() => {\n if (data?.pages) {\n setItems([].concat(...data.pages.map(p => arrayOf(p.orderedItems || p.items))));\n }\n }, [data, setItems]);\n\n const addItem = useCallback(\n item => {\n setItems(oldItems => [...oldItems, item]);\n // TODO use queryClient.setQueryData to update items directly in react-query cache\n setTimeout(\n () =>\n queryClient.refetchQueries(['Collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n 2000\n );\n },\n [setItems, queryClient, collectionUrl]\n );\n\n const removeItem = useCallback(\n itemId => {\n setItems(oldItems => oldItems.filter(item => (typeof item === 'string' ? item !== itemId : item.id !== itemId)));\n // TODO use queryClient.setQueryData to update items directly in react-query cache\n setTimeout(\n () =>\n queryClient.refetchQueries(['Collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n 2000\n );\n },\n [setItems, queryClient, collectionUrl]\n );\n\n return {\n items,\n totalItems,\n error,\n refetch,\n fetchNextPage,\n hasNextPage,\n isLoading,\n isFetching,\n isFetchingNextPage,\n status,\n addItem,\n removeItem,\n url: collectionUrl\n };\n};\n\nexport default useCollection;\n","export const arrayOf = value => {\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 {\n arrayOf\n};\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('<CollectionList> 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 <ListContextProvider value={listContext}>{children}</ListContextProvider>;\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, record, reference, children, ...rest }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error('<ReferenceCollectionField> only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n <CollectionList resource={reference} collectionUrl={record[source]} {...rest}>\n {children}\n </CollectionList>\n );\n};\n\nexport default ReferenceCollectionField;\n","import { useCallback, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useInbox = () => {\n const { identity } = useGetIdentity();\n\n const inboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.inbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n const fetch = useCallback(\n async ({ filters }) => {\n if (!sparqlEndpoint || !inboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n let filtersWhereQuery = '';\n if (filters) {\n Object.keys(filters).forEach(predicate => {\n if (filters[predicate]) {\n const object = filters[predicate].startsWith('http') ? `<${filters[predicate]}>` : filters[predicate];\n filtersWhereQuery += `?s1 ${predicate} ${object} .`;\n }\n });\n }\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${inboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n FILTER( (isIRI(?s1)) ) .\n ${filtersWhereQuery}\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n },\n [sparqlEndpoint, inboxUrl]\n );\n\n return { fetch, url: inboxUrl, owner: identity?.id };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useNodeinfo = (host, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\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 } = 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 const { json } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\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 <div className={classes.items}>\n {props.items.length ? (\n props.items.map((item, index) => (\n <button\n className={classes.item + (index === selectedIndex ? ' selected' : '')}\n key={index}\n onClick={() => selectItem(index)}\n >\n {item.label}\n </button>\n ))\n ) : (\n <div className={classes.item}>Aucun résultat</div>\n )}\n </div>\n );\n});\n"],"names":[],"version":3,"file":"index.cjs.js.map"}
|
package/dist/index.d.ts
CHANGED
|
@@ -60,12 +60,24 @@ export function useOutbox(): {
|
|
|
60
60
|
declare namespace _default {
|
|
61
61
|
export { arrayOf };
|
|
62
62
|
}
|
|
63
|
-
export function useCollection(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
export function useCollection(
|
|
64
|
+
predicateOrUrl: any,
|
|
65
|
+
options?: {}
|
|
66
|
+
): {
|
|
67
|
+
items: undefined;
|
|
68
|
+
totalItems: undefined;
|
|
69
|
+
error: unknown;
|
|
70
|
+
refetch: <TPageData>(
|
|
71
|
+
options?: (import('react-query').RefetchOptions & import('react-query').RefetchQueryFilters<TPageData>) | undefined
|
|
72
|
+
) => Promise<import('react-query').QueryObserverResult<import('react-query').InfiniteData<any>, unknown>>;
|
|
73
|
+
fetchNextPage: (
|
|
74
|
+
options?: import('react-query').FetchNextPageOptions | undefined
|
|
75
|
+
) => Promise<import('react-query').InfiniteQueryObserverResult<any, unknown>>;
|
|
76
|
+
hasNextPage: boolean | undefined;
|
|
77
|
+
isLoading: boolean;
|
|
78
|
+
isFetching: boolean;
|
|
79
|
+
isFetchingNextPage: boolean;
|
|
80
|
+
status: 'success' | 'error' | 'loading' | 'idle';
|
|
69
81
|
addItem: (item: any) => void;
|
|
70
82
|
removeItem: (itemId: any) => void;
|
|
71
83
|
url: any;
|
|
@@ -96,14 +108,12 @@ declare namespace CommentsField {
|
|
|
96
108
|
export function CollectionList({
|
|
97
109
|
collectionUrl,
|
|
98
110
|
resource,
|
|
99
|
-
children
|
|
100
|
-
...rest
|
|
111
|
+
children
|
|
101
112
|
}: {
|
|
102
|
-
[x: string]: any;
|
|
103
113
|
collectionUrl: any;
|
|
104
114
|
resource: any;
|
|
105
115
|
children: any;
|
|
106
|
-
}): import('react/jsx-runtime').JSX.Element
|
|
116
|
+
}): import('react/jsx-runtime').JSX.Element;
|
|
107
117
|
export function ReferenceCollectionField({
|
|
108
118
|
source,
|
|
109
119
|
record,
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,wEAAyE;AClDzE;;;;;;EA0EC;;;;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,wEAAyE;AClDzE;;;;;;EA0EC;;;;AKzED;;;;;;;;;;;;;;EAuHC;ACtHD;;;;;;;4CAkBC;;;;;;;;;ACpBD;;;;4CAgBC;ACjBD;;;;;;mDAYC;ACXD;;;;;;EAiEC;AClED,gEAwBC;ACxBD;;EAwBC;AGtBD;;;;;;;;;;;;;EAkCC","sources":["packages/activitypub-components/src/src/constants.js","packages/activitypub-components/src/src/hooks/useOutbox.js","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/utils.js","packages/activitypub-components/src/src/hooks/useCollection.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.js","packages/activitypub-components/src/src/hooks/useNodeinfo.js","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,"// 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"}
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {jsxs as $85cNH$jsxs, Fragment as $85cNH$Fragment, jsx as $85cNH$jsx} from "react/jsx-runtime";
|
|
2
2
|
import $85cNH$react, {useState as $85cNH$useState, useCallback as $85cNH$useCallback, useMemo as $85cNH$useMemo, useEffect as $85cNH$useEffect, forwardRef as $85cNH$forwardRef, useImperativeHandle as $85cNH$useImperativeHandle} from "react";
|
|
3
|
-
import {useRecordContext as $85cNH$useRecordContext, useGetIdentity as $85cNH$useGetIdentity, useNotify as $85cNH$useNotify, Form as $85cNH$Form, fetchUtils as $85cNH$fetchUtils, TextField as $85cNH$TextField, DateField as $85cNH$DateField, RichTextField as $85cNH$RichTextField,
|
|
3
|
+
import {useRecordContext as $85cNH$useRecordContext, useGetIdentity as $85cNH$useGetIdentity, useNotify as $85cNH$useNotify, Form as $85cNH$Form, fetchUtils as $85cNH$fetchUtils, TextField as $85cNH$TextField, DateField as $85cNH$DateField, RichTextField as $85cNH$RichTextField, useDataProvider as $85cNH$useDataProvider, useGetMany as $85cNH$useGetMany, useList as $85cNH$useList, ListContextProvider as $85cNH$ListContextProvider, useGetList as $85cNH$useGetList} from "react-admin";
|
|
4
4
|
import {RichTextInput as $85cNH$RichTextInput, DefaultEditorOptions as $85cNH$DefaultEditorOptions} from "ra-input-rich-text";
|
|
5
5
|
import $85cNH$tiptapextensionplaceholder from "@tiptap/extension-placeholder";
|
|
6
6
|
import {Box as $85cNH$Box, Avatar as $85cNH$Avatar, Button as $85cNH$Button, Typography as $85cNH$Typography, CircularProgress as $85cNH$CircularProgress} from "@mui/material";
|
|
@@ -10,7 +10,8 @@ import {useDataModel as $85cNH$useDataModel, buildBlankNodesQuery as $85cNH$buil
|
|
|
10
10
|
import {AuthDialog as $85cNH$AuthDialog} from "@semapps/auth-provider";
|
|
11
11
|
import {mergeAttributes as $85cNH$mergeAttributes} from "@tiptap/core";
|
|
12
12
|
import $85cNH$tiptapextensionmention from "@tiptap/extension-mention";
|
|
13
|
-
import {ReferenceField as $85cNH$ReferenceField, AvatarWithLabelField as $85cNH$AvatarWithLabelField
|
|
13
|
+
import {ReferenceField as $85cNH$ReferenceField, AvatarWithLabelField as $85cNH$AvatarWithLabelField} from "@semapps/field-components";
|
|
14
|
+
import {useQueryClient as $85cNH$useQueryClient, useInfiniteQuery as $85cNH$useInfiniteQuery} from "react-query";
|
|
14
15
|
import {ReactRenderer as $85cNH$ReactRenderer} from "@tiptap/react";
|
|
15
16
|
import $85cNH$tippyjs from "tippy.js";
|
|
16
17
|
|
|
@@ -522,6 +523,7 @@ var $be88b298220210d1$export$2e2bcd8739ae039 = $be88b298220210d1$var$CommentsLis
|
|
|
522
523
|
|
|
523
524
|
|
|
524
525
|
|
|
526
|
+
|
|
525
527
|
const $e4e1b14e0441184d$export$e57ff0f701c44363 = (value)=>{
|
|
526
528
|
// If the field is null-ish, we suppose there are no values.
|
|
527
529
|
if (!value) return [];
|
|
@@ -537,12 +539,13 @@ var $e4e1b14e0441184d$export$2e2bcd8739ae039 = {
|
|
|
537
539
|
};
|
|
538
540
|
|
|
539
541
|
|
|
540
|
-
const $c1e897431d8c5742$var$useCollection = (predicateOrUrl)=>{
|
|
541
|
-
const {
|
|
542
|
-
const
|
|
543
|
-
const [
|
|
544
|
-
const [
|
|
545
|
-
const
|
|
542
|
+
const $c1e897431d8c5742$var$useCollection = (predicateOrUrl, options = {})=>{
|
|
543
|
+
const { dereferenceItems: dereferenceItems = false } = options;
|
|
544
|
+
const { data: identity } = (0, $85cNH$useGetIdentity)();
|
|
545
|
+
const [items, setItems] = (0, $85cNH$useState)();
|
|
546
|
+
const [totalItems, setTotalItems] = (0, $85cNH$useState)();
|
|
547
|
+
const dataProvider = (0, $85cNH$useDataProvider)();
|
|
548
|
+
const queryClient = (0, $85cNH$useQueryClient)();
|
|
546
549
|
const collectionUrl = (0, $85cNH$useMemo)(()=>{
|
|
547
550
|
if (predicateOrUrl) {
|
|
548
551
|
if (predicateOrUrl.startsWith("http")) return predicateOrUrl;
|
|
@@ -552,67 +555,99 @@ const $c1e897431d8c5742$var$useCollection = (predicateOrUrl)=>{
|
|
|
552
555
|
identity,
|
|
553
556
|
predicateOrUrl
|
|
554
557
|
]);
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
setLoading(false);
|
|
579
|
-
});
|
|
558
|
+
const fetchCollection = (0, $85cNH$useCallback)(async ({ pageParam: nextPageUrl })=>{
|
|
559
|
+
let { json: json } = await dataProvider.fetch(nextPageUrl || collectionUrl);
|
|
560
|
+
if (json.totalItems) setTotalItems(json.totalItems);
|
|
561
|
+
if ((json.type === "OrderedCollection" || json.type === "Collection") && json.first) {
|
|
562
|
+
if (json.first?.items) {
|
|
563
|
+
if (json.first?.items.length === 0 && json.first?.next) // Special case where the first property is an object without items
|
|
564
|
+
({ json: json } = await dataProvider.fetch(json.first?.next));
|
|
565
|
+
else json = json.first;
|
|
566
|
+
} else // Fetch the first page
|
|
567
|
+
({ json: json } = await dataProvider.fetch(json.first));
|
|
568
|
+
}
|
|
569
|
+
// Force dereference of items
|
|
570
|
+
if (dereferenceItems) {
|
|
571
|
+
const itemPredicate = json.items ? "items" : "orderedItems";
|
|
572
|
+
json[itemPredicate] = json[itemPredicate] && await Promise.all((0, $e4e1b14e0441184d$export$e57ff0f701c44363)(json[itemPredicate]).map(async (item)=>{
|
|
573
|
+
if (typeof item === "string") {
|
|
574
|
+
const { json: json } = await dataProvider.fetch(item);
|
|
575
|
+
return json;
|
|
576
|
+
}
|
|
577
|
+
return item;
|
|
578
|
+
}));
|
|
579
|
+
}
|
|
580
|
+
return json;
|
|
580
581
|
}, [
|
|
581
|
-
|
|
582
|
-
setLoaded,
|
|
583
|
-
setLoading,
|
|
584
|
-
setError,
|
|
582
|
+
dataProvider,
|
|
585
583
|
collectionUrl,
|
|
586
|
-
identity
|
|
584
|
+
identity,
|
|
585
|
+
setTotalItems
|
|
587
586
|
]);
|
|
587
|
+
const { data: data, error: error, fetchNextPage: fetchNextPage, refetch: refetch, hasNextPage: hasNextPage, isLoading: isLoading, isFetching: isFetching, isFetchingNextPage: isFetchingNextPage, status: status } = (0, $85cNH$useInfiniteQuery)([
|
|
588
|
+
"Collection",
|
|
589
|
+
{
|
|
590
|
+
collectionUrl: collectionUrl
|
|
591
|
+
}
|
|
592
|
+
], fetchCollection, {
|
|
593
|
+
enabled: !!(collectionUrl && identity?.id),
|
|
594
|
+
getNextPageParam: (lastPage)=>lastPage.next,
|
|
595
|
+
getPreviousPageParam: (firstPage)=>firstPage.prev
|
|
596
|
+
});
|
|
588
597
|
(0, $85cNH$useEffect)(()=>{
|
|
589
|
-
if (
|
|
598
|
+
if (data?.pages) setItems([].concat(...data.pages.map((p)=>(0, $e4e1b14e0441184d$export$e57ff0f701c44363)(p.orderedItems || p.items))));
|
|
590
599
|
}, [
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
loading,
|
|
594
|
-
loaded,
|
|
595
|
-
error
|
|
600
|
+
data,
|
|
601
|
+
setItems
|
|
596
602
|
]);
|
|
597
603
|
const addItem = (0, $85cNH$useCallback)((item)=>{
|
|
598
604
|
setItems((oldItems)=>[
|
|
599
605
|
...oldItems,
|
|
600
606
|
item
|
|
601
607
|
]);
|
|
608
|
+
// TODO use queryClient.setQueryData to update items directly in react-query cache
|
|
609
|
+
setTimeout(()=>queryClient.refetchQueries([
|
|
610
|
+
"Collection",
|
|
611
|
+
{
|
|
612
|
+
collectionUrl: collectionUrl
|
|
613
|
+
}
|
|
614
|
+
], {
|
|
615
|
+
active: true,
|
|
616
|
+
exact: true
|
|
617
|
+
}), 2000);
|
|
602
618
|
}, [
|
|
603
|
-
setItems
|
|
619
|
+
setItems,
|
|
620
|
+
queryClient,
|
|
621
|
+
collectionUrl
|
|
604
622
|
]);
|
|
605
623
|
const removeItem = (0, $85cNH$useCallback)((itemId)=>{
|
|
606
624
|
setItems((oldItems)=>oldItems.filter((item)=>typeof item === "string" ? item !== itemId : item.id !== itemId));
|
|
625
|
+
// TODO use queryClient.setQueryData to update items directly in react-query cache
|
|
626
|
+
setTimeout(()=>queryClient.refetchQueries([
|
|
627
|
+
"Collection",
|
|
628
|
+
{
|
|
629
|
+
collectionUrl: collectionUrl
|
|
630
|
+
}
|
|
631
|
+
], {
|
|
632
|
+
active: true,
|
|
633
|
+
exact: true
|
|
634
|
+
}), 2000);
|
|
607
635
|
}, [
|
|
608
|
-
setItems
|
|
636
|
+
setItems,
|
|
637
|
+
queryClient,
|
|
638
|
+
collectionUrl
|
|
609
639
|
]);
|
|
610
640
|
return {
|
|
611
641
|
items: items,
|
|
612
|
-
|
|
613
|
-
loaded: loaded,
|
|
642
|
+
totalItems: totalItems,
|
|
614
643
|
error: error,
|
|
615
|
-
refetch:
|
|
644
|
+
refetch: refetch,
|
|
645
|
+
fetchNextPage: fetchNextPage,
|
|
646
|
+
hasNextPage: hasNextPage,
|
|
647
|
+
isLoading: isLoading,
|
|
648
|
+
isFetching: isFetching,
|
|
649
|
+
isFetchingNextPage: isFetchingNextPage,
|
|
650
|
+
status: status,
|
|
616
651
|
addItem: addItem,
|
|
617
652
|
removeItem: removeItem,
|
|
618
653
|
url: collectionUrl
|
|
@@ -657,24 +692,23 @@ var $7ce737d4a1c88e63$export$2e2bcd8739ae039 = $7ce737d4a1c88e63$var$CommentsFie
|
|
|
657
692
|
|
|
658
693
|
|
|
659
694
|
|
|
660
|
-
const $d3be168cd1e7aaae$var$CollectionList = ({ collectionUrl: collectionUrl, resource: resource, children: children
|
|
695
|
+
const $d3be168cd1e7aaae$var$CollectionList = ({ collectionUrl: collectionUrl, resource: resource, children: children })=>{
|
|
661
696
|
if ((0, $85cNH$react).Children.count(children) !== 1) throw new Error("<CollectionList> only accepts a single child");
|
|
662
|
-
|
|
663
|
-
const { data:
|
|
664
|
-
|
|
697
|
+
const { items: actorsUris } = (0, $c1e897431d8c5742$export$2e2bcd8739ae039)(collectionUrl);
|
|
698
|
+
const { data: data, isLoading: isLoading, isFetching: isFetching } = (0, $85cNH$useGetMany)(resource, {
|
|
699
|
+
ids: Array.isArray(actorsUris) ? actorsUris : [
|
|
700
|
+
actorsUris
|
|
701
|
+
]
|
|
702
|
+
}, {
|
|
703
|
+
enabled: !!actorsUris
|
|
665
704
|
});
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
children: /*#__PURE__*/ (0, $85cNH$jsx)((0, $85cNH$LinearProgress), {})
|
|
705
|
+
const listContext = (0, $85cNH$useList)({
|
|
706
|
+
data: data,
|
|
707
|
+
isLoading: isLoading,
|
|
708
|
+
isFetching: isFetching
|
|
671
709
|
});
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
reference: resource,
|
|
675
|
-
record: collection,
|
|
676
|
-
source: "items",
|
|
677
|
-
...rest,
|
|
710
|
+
return /*#__PURE__*/ (0, $85cNH$jsx)((0, $85cNH$ListContextProvider), {
|
|
711
|
+
value: listContext,
|
|
678
712
|
children: children
|
|
679
713
|
});
|
|
680
714
|
};
|
package/dist/index.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;AAAA,aAAa;;;;;;;;;;;;;;AGAN,MAAM,4CAAiB;IAC5B,QAAQ;IACR,KAAK;IACL,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;I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C1C;QACF;QAEA,WAAU,KAAK;YACb,IAAI,MAAM,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,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.js","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/hooks/useCollection.js","packages/activitypub-components/src/utils.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.js","packages/activitypub-components/src/hooks/useNodeinfo.js","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 <PostCommentForm\n context={context}\n helperText={helperText}\n userResource={userResource}\n placeholder={placeholder}\n mentions={mentions}\n addItem={addItem}\n removeItem={removeItem}\n />\n <CommentsList comments={comments} loading={loading} userResource={userResource} />\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 { 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 <Form onSubmit={onSubmit} className={classes.form}>\n <Box className={classes.container} onClick={openAuthIfDisconnected}>\n <Avatar\n src={\n identity?.webIdData?.[userDataModel?.fieldsMapping?.image] ||\n identity?.profileData?.[userDataModel?.fieldsMapping?.image]\n }\n className={classes.avatar}\n />\n <RichTextInput\n source=\"comment\"\n label=\" \"\n toolbar={<EmptyToolbar />}\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 <Button\n type=\"submit\"\n size=\"small\"\n variant=\"contained\"\n color=\"primary\"\n endIcon={<SendIcon />}\n className={classes.button}\n >\n Envoyer\n </Button>\n )}\n </Box>\n </Form>\n <AuthDialog\n open={openAuth}\n onClose={() => 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 TRAVAL: '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, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useOutbox = () => {\n const { identity } = useGetIdentity();\n\n const outboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.outbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async activity => {\n if (!outboxUrl)\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the loaded argument of useOutbox'\n );\n const token = localStorage.getItem('token');\n const { headers } = await fetchUtils.fetchJson(outboxUrl, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n }),\n headers: new Headers({\n 'Content-Type': 'application/ld+json',\n Authorization: `Bearer ${token}`\n })\n });\n return headers.get('Location');\n },\n [outboxUrl]\n );\n\n const fetch = useCallback(async () => {\n if (!sparqlEndpoint || !outboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${outboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n }, [sparqlEndpoint, outboxUrl]);\n\n return { post, fetch, url: outboxUrl, loaded: !!outboxUrl, owner: identity?.id };\n};\n\nexport default useOutbox;\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 <Box position=\"relative\">\n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n <Box className={classes.container} key={comment.id}>\n <Box className={classes.avatar}>\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <AvatarWithLabelField image={userDataModel?.fieldsMapping?.image} />\n </ReferenceField>\n </Box>\n <Box className={classes.text}>\n <Typography variant=\"body2\">\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <TextField variant=\"body2\" source={userDataModel?.fieldsMapping?.title} className={classes.label} />\n </ReferenceField>\n • \n <DateField record={comment} variant=\"body2\" source=\"published\" showTime />\n </Typography>\n <RichTextField record={comment} variant=\"body1\" source=\"content\" className={classes.content} />\n </Box>\n </Box>\n ))}\n {loading && (\n <Box minHeight={200}>\n <Box alignItems=\"center\" className={classes.loading}>\n <CircularProgress size={60} thickness={6} />\n </Box>\n </Box>\n )}\n </Box>\n );\n};\n\nexport default CommentsList;\n","import { useCallback, useMemo, useState, useEffect } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { arrayOf } from '../utils';\n\nconst useCollection = predicateOrUrl => {\n const { data: identity, isLoading: identityLoading } = useGetIdentity();\n const [items, setItems] = useState([]);\n const [loading, setLoading] = useState(false);\n const [loaded, setLoaded] = useState(false);\n const [error, setError] = useState(false);\n\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 }, [identity, predicateOrUrl]);\n\n const fetch = useCallback(async () => {\n if (!collectionUrl) return;\n\n setLoading(true);\n\n const headers = new Headers({ Accept: 'application/ld+json' });\n\n // Add authorization token if it is set and if the user is on the same server as the collection\n const identityOrigin = identity.id && new URL(identity.id).origin;\n const collectionOrigin = new URL(collectionUrl).origin;\n const token = localStorage.getItem('token');\n if (identityOrigin === collectionOrigin && token) {\n headers.set('Authorization', `Bearer ${token}`);\n }\n\n fetchUtils\n .fetchJson(collectionUrl, { headers })\n .then(({ json }) => {\n if (json && json.items) {\n setItems(arrayOf(json.items));\n } else if (json && json.orderedItems) {\n setItems(arrayOf(json.orderedItems));\n } else {\n setItems([]);\n }\n setError(false);\n setLoaded(true);\n setLoading(false);\n })\n .catch(() => {\n setError(true);\n setLoaded(true);\n setLoading(false);\n });\n }, [setItems, setLoaded, setLoading, setError, collectionUrl, identity]);\n\n useEffect(() => {\n if (!identityLoading && !loading && !loaded && !error) {\n fetch();\n }\n }, [fetch, identityLoading, loading, loaded, error]);\n\n const addItem = useCallback(\n item => {\n setItems(oldItems => [...oldItems, item]);\n },\n [setItems]\n );\n\n const removeItem = useCallback(\n itemId => {\n setItems(oldItems => oldItems.filter(item => (typeof item === 'string' ? item !== itemId : item.id !== itemId)));\n },\n [setItems]\n );\n\n return { items, loading, loaded, error, refetch: fetch, addItem, removeItem, url: collectionUrl };\n};\n\nexport default useCollection;\n","export const arrayOf = value => {\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 {\n arrayOf\n};\n","import React from 'react';\nimport { useGetOne, LinearProgress } from 'react-admin';\nimport { ReferenceArrayField } from '@semapps/field-components';\n\nconst CollectionList = ({ collectionUrl, resource, children, ...rest }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error('<CollectionList> only accepts a single child');\n }\n\n // TODO use a simple fetch call, as the resource is not good and it is useless\n const { data: collection, isLoading } = useGetOne(resource, collectionUrl, { enabled: !!collectionUrl });\n\n if (isLoading) {\n return (\n <div style={{ marginTop: 8 }}>\n <LinearProgress />\n </div>\n );\n }\n if (!collection) {\n return null;\n }\n\n return (\n <ReferenceArrayField reference={resource} record={collection} source=\"items\" {...rest}>\n {children}\n </ReferenceArrayField>\n );\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, record, reference, children, ...rest }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error('<ReferenceCollectionField> only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n <CollectionList resource={reference} collectionUrl={record[source]} {...rest}>\n {children}\n </CollectionList>\n );\n};\n\nexport default ReferenceCollectionField;\n","import { useCallback, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useInbox = () => {\n const { identity } = useGetIdentity();\n\n const inboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.inbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n const fetch = useCallback(\n async ({ filters }) => {\n if (!sparqlEndpoint || !inboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n let filtersWhereQuery = '';\n if (filters) {\n Object.keys(filters).forEach(predicate => {\n if (filters[predicate]) {\n const object = filters[predicate].startsWith('http') ? `<${filters[predicate]}>` : filters[predicate];\n filtersWhereQuery += `?s1 ${predicate} ${object} .`;\n }\n });\n }\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${inboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n FILTER( (isIRI(?s1)) ) .\n ${filtersWhereQuery}\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n },\n [sparqlEndpoint, inboxUrl]\n );\n\n return { fetch, url: inboxUrl, owner: identity?.id };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useNodeinfo = (host, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\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 } = 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 const { json } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\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 <div className={classes.items}>\n {props.items.length ? (\n props.items.map((item, index) => (\n <button\n className={classes.item + (index === selectedIndex ? ' selected' : '')}\n key={index}\n onClick={() => selectItem(index)}\n >\n {item.label}\n </button>\n ))\n ) : (\n <div className={classes.item}>Aucun résultat</div>\n )}\n </div>\n );\n});\n"],"names":[],"version":3,"file":"index.es.js.map"}
|
|
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;IAC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G,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.js","packages/activitypub-components/src/components/CommentsField/CustomMention.js","packages/activitypub-components/src/components/CommentsField/CommentsList.js","packages/activitypub-components/src/hooks/useCollection.js","packages/activitypub-components/src/utils.js","packages/activitypub-components/src/components/CollectionList.js","packages/activitypub-components/src/components/ReferenceCollectionField.js","packages/activitypub-components/src/hooks/useInbox.js","packages/activitypub-components/src/hooks/useNodeinfo.js","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 <PostCommentForm\n context={context}\n helperText={helperText}\n userResource={userResource}\n placeholder={placeholder}\n mentions={mentions}\n addItem={addItem}\n removeItem={removeItem}\n />\n <CommentsList comments={comments} loading={loading} userResource={userResource} />\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 { 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 <Form onSubmit={onSubmit} className={classes.form}>\n <Box className={classes.container} onClick={openAuthIfDisconnected}>\n <Avatar\n src={\n identity?.webIdData?.[userDataModel?.fieldsMapping?.image] ||\n identity?.profileData?.[userDataModel?.fieldsMapping?.image]\n }\n className={classes.avatar}\n />\n <RichTextInput\n source=\"comment\"\n label=\" \"\n toolbar={<EmptyToolbar />}\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 <Button\n type=\"submit\"\n size=\"small\"\n variant=\"contained\"\n color=\"primary\"\n endIcon={<SendIcon />}\n className={classes.button}\n >\n Envoyer\n </Button>\n )}\n </Box>\n </Form>\n <AuthDialog\n open={openAuth}\n onClose={() => 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 TRAVAL: '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, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useOutbox = () => {\n const { identity } = useGetIdentity();\n\n const outboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.outbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n // Post an activity to the logged user's outbox and return its URI\n const post = useCallback(\n async activity => {\n if (!outboxUrl)\n throw new Error(\n 'Cannot post to outbox before user identity is loaded. Please use the loaded argument of useOutbox'\n );\n const token = localStorage.getItem('token');\n const { headers } = await fetchUtils.fetchJson(outboxUrl, {\n method: 'POST',\n body: JSON.stringify({\n '@context': 'https://www.w3.org/ns/activitystreams',\n ...activity\n }),\n headers: new Headers({\n 'Content-Type': 'application/ld+json',\n Authorization: `Bearer ${token}`\n })\n });\n return headers.get('Location');\n },\n [outboxUrl]\n );\n\n const fetch = useCallback(async () => {\n if (!sparqlEndpoint || !outboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${outboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n }, [sparqlEndpoint, outboxUrl]);\n\n return { post, fetch, url: outboxUrl, loaded: !!outboxUrl, owner: identity?.id };\n};\n\nexport default useOutbox;\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 <Box position=\"relative\">\n {comments &&\n comments\n .sort((a, b) => new Date(b.published) - new Date(a.published))\n .map(comment => (\n <Box className={classes.container} key={comment.id}>\n <Box className={classes.avatar}>\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <AvatarWithLabelField image={userDataModel?.fieldsMapping?.image} />\n </ReferenceField>\n </Box>\n <Box className={classes.text}>\n <Typography variant=\"body2\">\n <ReferenceField record={comment} reference={userResource} source=\"attributedTo\" linkType=\"show\">\n <TextField variant=\"body2\" source={userDataModel?.fieldsMapping?.title} className={classes.label} />\n </ReferenceField>\n • \n <DateField record={comment} variant=\"body2\" source=\"published\" showTime />\n </Typography>\n <RichTextField record={comment} variant=\"body1\" source=\"content\" className={classes.content} />\n </Box>\n </Box>\n ))}\n {loading && (\n <Box minHeight={200}>\n <Box alignItems=\"center\" className={classes.loading}>\n <CircularProgress size={60} thickness={6} />\n </Box>\n </Box>\n )}\n </Box>\n );\n};\n\nexport default CommentsList;\n","import { useCallback, useMemo, useState, useEffect } from 'react';\nimport { useGetIdentity, useDataProvider } from 'react-admin';\nimport { useInfiniteQuery, useQueryClient } from 'react-query';\nimport { arrayOf } from '../utils';\n\nconst useCollection = (predicateOrUrl, options = {}) => {\n const { dereferenceItems = false } = options;\n const { data: identity } = useGetIdentity();\n const [items, setItems] = useState();\n const [totalItems, setTotalItems] = useState();\n const dataProvider = useDataProvider();\n const queryClient = useQueryClient();\n\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 }, [identity, predicateOrUrl]);\n\n const fetchCollection = useCallback(\n async ({ pageParam: nextPageUrl }) => {\n let { json } = await dataProvider.fetch(nextPageUrl || collectionUrl);\n if (json.totalItems) setTotalItems(json.totalItems);\n\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 // Force dereference of items\n if (dereferenceItems) {\n const itemPredicate = json.items ? 'items' : 'orderedItems';\n json[itemPredicate] =\n json[itemPredicate] &&\n (await Promise.all(\n arrayOf(json[itemPredicate]).map(async item => {\n if (typeof item === 'string') {\n const { json } = await dataProvider.fetch(item);\n return json;\n }\n return item;\n })\n ));\n }\n\n return json;\n },\n [dataProvider, collectionUrl, identity, setTotalItems]\n );\n\n const { data, error, fetchNextPage, refetch, hasNextPage, isLoading, isFetching, isFetchingNextPage, status } =\n useInfiniteQuery(['Collection', { collectionUrl }], fetchCollection, {\n enabled: !!(collectionUrl && identity?.id),\n getNextPageParam: lastPage => lastPage.next,\n getPreviousPageParam: firstPage => firstPage.prev\n });\n\n useEffect(() => {\n if (data?.pages) {\n setItems([].concat(...data.pages.map(p => arrayOf(p.orderedItems || p.items))));\n }\n }, [data, setItems]);\n\n const addItem = useCallback(\n item => {\n setItems(oldItems => [...oldItems, item]);\n // TODO use queryClient.setQueryData to update items directly in react-query cache\n setTimeout(\n () =>\n queryClient.refetchQueries(['Collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n 2000\n );\n },\n [setItems, queryClient, collectionUrl]\n );\n\n const removeItem = useCallback(\n itemId => {\n setItems(oldItems => oldItems.filter(item => (typeof item === 'string' ? item !== itemId : item.id !== itemId)));\n // TODO use queryClient.setQueryData to update items directly in react-query cache\n setTimeout(\n () =>\n queryClient.refetchQueries(['Collection', { collectionUrl }], {\n active: true,\n exact: true\n }),\n 2000\n );\n },\n [setItems, queryClient, collectionUrl]\n );\n\n return {\n items,\n totalItems,\n error,\n refetch,\n fetchNextPage,\n hasNextPage,\n isLoading,\n isFetching,\n isFetchingNextPage,\n status,\n addItem,\n removeItem,\n url: collectionUrl\n };\n};\n\nexport default useCollection;\n","export const arrayOf = value => {\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 {\n arrayOf\n};\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('<CollectionList> 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 <ListContextProvider value={listContext}>{children}</ListContextProvider>;\n};\n\nexport default CollectionList;\n","import React from 'react';\nimport CollectionList from './CollectionList';\n\nconst ReferenceCollectionField = ({ source, record, reference, children, ...rest }) => {\n if (React.Children.count(children) !== 1) {\n throw new Error('<ReferenceCollectionField> only accepts a single child');\n }\n\n if (!record || !record[source]) return null;\n\n return (\n <CollectionList resource={reference} collectionUrl={record[source]} {...rest}>\n {children}\n </CollectionList>\n );\n};\n\nexport default ReferenceCollectionField;\n","import { useCallback, useMemo } from 'react';\nimport { useGetIdentity, fetchUtils } from 'react-admin';\nimport { buildBlankNodesQuery } from '@semapps/semantic-data-provider';\n\nconst useInbox = () => {\n const { identity } = useGetIdentity();\n\n const inboxUrl = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.inbox;\n }\n }, [identity]);\n\n const sparqlEndpoint = useMemo(() => {\n if (identity?.webIdData) {\n return identity?.webIdData?.endpoints?.['void:sparqlEndpoint'] || `${identity?.id}/sparql`;\n }\n }, [identity]);\n\n const fetch = useCallback(\n async ({ filters }) => {\n if (!sparqlEndpoint || !inboxUrl) return;\n\n const token = localStorage.getItem('token');\n const blankNodesQuery = buildBlankNodesQuery(['as:object']);\n\n let filtersWhereQuery = '';\n if (filters) {\n Object.keys(filters).forEach(predicate => {\n if (filters[predicate]) {\n const object = filters[predicate].startsWith('http') ? `<${filters[predicate]}>` : filters[predicate];\n filtersWhereQuery += `?s1 ${predicate} ${object} .`;\n }\n });\n }\n\n const query = `\n PREFIX as: <https://www.w3.org/ns/activitystreams#>\n CONSTRUCT {\n ?s1 ?p1 ?o1 .\n ${blankNodesQuery.construct}\n }\n WHERE {\n <${inboxUrl}> as:items ?s1 .\n ?s1 ?p1 ?o1 .\n FILTER( (isIRI(?s1)) ) .\n ${filtersWhereQuery}\n ${blankNodesQuery.where}\n }\n `;\n\n const { json } = await fetchUtils.fetchJson(sparqlEndpoint, {\n method: 'POST',\n body: query,\n headers: new Headers({\n Accept: 'application/ld+json',\n Authorization: token ? `Bearer ${token}` : undefined\n })\n });\n\n if (json['@graph']) {\n return json['@graph'];\n }\n return null;\n },\n [sparqlEndpoint, inboxUrl]\n );\n\n return { fetch, url: inboxUrl, owner: identity?.id };\n};\n\nexport default useInbox;\n","import { useEffect, useState } from 'react';\nimport { fetchUtils } from 'react-admin';\n\nconst useNodeinfo = (host, rel = 'http://nodeinfo.diaspora.software/ns/schema/2.1') => {\n const [schema, setSchema] = useState();\n\n useEffect(() => {\n (async () => {\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 } = 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 const { json } = await fetchUtils.fetchJson(link.href);\n\n setSchema(json);\n } catch (e) {\n // Do nothing if nodeinfo can't be fetched\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 <div className={classes.items}>\n {props.items.length ? (\n props.items.map((item, index) => (\n <button\n className={classes.item + (index === selectedIndex ? ' selected' : '')}\n key={index}\n onClick={() => selectItem(index)}\n >\n {item.label}\n </button>\n ))\n ) : (\n <div className={classes.item}>Aucun résultat</div>\n )}\n </div>\n );\n});\n"],"names":[],"version":3,"file":"index.es.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semapps/activitypub-components",
|
|
3
|
-
"version": "0.6.0
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "React-Admin components for ActivityPub display",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Virtual Assembly",
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
"watch": "nodemon --watch src --exec 'yarn build'"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@semapps/auth-provider": "0.6.0
|
|
20
|
-
"@semapps/field-components": "0.6.0
|
|
21
|
-
"@semapps/semantic-data-provider": "0.6.0
|
|
19
|
+
"@semapps/auth-provider": "0.6.0",
|
|
20
|
+
"@semapps/field-components": "0.6.0",
|
|
21
|
+
"@semapps/semantic-data-provider": "0.6.0",
|
|
22
22
|
"@tiptap/core": "^2.0.0-beta.95",
|
|
23
23
|
"@tiptap/extension-mention": "^2.0.0-beta.95",
|
|
24
24
|
"@tiptap/extension-placeholder": "^2.0.0-beta.95",
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
"@mui/material": "^5.13.1",
|
|
33
33
|
"@mui/styles": "^5.13.1",
|
|
34
34
|
"react": "^18.2.0",
|
|
35
|
-
"react-admin": "^4.11.0"
|
|
35
|
+
"react-admin": "^4.11.0",
|
|
36
|
+
"react-query": "^3.39.3"
|
|
36
37
|
},
|
|
37
38
|
"publishConfig": {
|
|
38
39
|
"access": "public"
|
|
39
40
|
},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "9b1a0cfc313cd68f0d21c7001959fef6d1100aa6"
|
|
41
42
|
}
|