@edifice.io/react 2.5.2-develop-b2school-actualites.20251127174432 → 2.5.2-develop-b2school-actualites.20251201115331
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/modules/modals/ShareModal/ShareModal.js +1 -1
- package/dist/modules/modals/ShareModal/ShareResources.d.ts +15 -10
- package/dist/modules/modals/ShareModal/ShareResources.js +8 -8
- package/dist/modules/modals/ShareModal/hooks/useShare.d.ts +2 -2
- package/dist/modules/modals/ShareModal/hooks/useShare.js +4 -4
- package/package.json +19 -19
|
@@ -26,7 +26,7 @@ function ShareResourceModal({
|
|
|
26
26
|
/* @__PURE__ */ jsx(Modal.Header, { onModalClose: onCancel, children: t("share.title") }),
|
|
27
27
|
/* @__PURE__ */ jsxs(Modal.Body, { children: [
|
|
28
28
|
/* @__PURE__ */ jsx(Alert, { type: "info", className: "mb-16", children: t("explorer.modal.share.alert.community") }),
|
|
29
|
-
/* @__PURE__ */ jsx(ShareResources, { shareOptions, shareResource, ref: refShareResources, onSuccess, onSaving, classNameSearchInput: "flex-fill" }),
|
|
29
|
+
/* @__PURE__ */ jsx(ShareResources, { shareOptions, shareResource, ref: refShareResources, onSuccess, onSubmit: onSaving, classNameSearchInput: "flex-fill" }),
|
|
30
30
|
children
|
|
31
31
|
] }),
|
|
32
32
|
/* @__PURE__ */ jsxs(Modal.Footer, { children: [
|
|
@@ -8,7 +8,12 @@ import { UseMutationResult } from '../../../node_modules/@tanstack/react-query';
|
|
|
8
8
|
* @property {RightStringified[]} resourceRights - Current rights assigned to the resource
|
|
9
9
|
* @property {string} resourceCreatorId - User ID of the resource creator
|
|
10
10
|
* @property {ShareRightActionDisplayName[]} [filteredActions] - Optional list of allowed actions to display
|
|
11
|
-
* @property {ShareUrls} [
|
|
11
|
+
* @property {ShareUrls} [shareUrls] - Optional custom URLs for API endpoints related to sharing operations default endpoints are used if not provided
|
|
12
|
+
* default: {
|
|
13
|
+
* getResourceRights: `/${app}/share/json/${resourceId}?search=`,
|
|
14
|
+
* saveResourceRights: `/${app}/share/resource/${resourceId}`,
|
|
15
|
+
* getShareMapping: `/${app}/rights/sharing`
|
|
16
|
+
* }
|
|
12
17
|
*
|
|
13
18
|
* @example Example related to sharing thread resources:
|
|
14
19
|
* ```ts
|
|
@@ -17,7 +22,7 @@ import { UseMutationResult } from '../../../node_modules/@tanstack/react-query';
|
|
|
17
22
|
* resourceRights: [],
|
|
18
23
|
* resourceCreatorId: 'user-67890',
|
|
19
24
|
* filteredActions: ['read', 'contrib'],
|
|
20
|
-
*
|
|
25
|
+
* shareUrls: {
|
|
21
26
|
* getResourceRights: '/api/V1/thread/shares', (get endpoint)
|
|
22
27
|
* saveResourceRights: '/api/V1/thread/shares', (put endpoint)
|
|
23
28
|
* getShareMapping: '/api/V1/rights/sharing'
|
|
@@ -32,7 +37,7 @@ import { UseMutationResult } from '../../../node_modules/@tanstack/react-query';
|
|
|
32
37
|
* resourceRights: [],
|
|
33
38
|
* resourceCreatorId: 'user-67890',
|
|
34
39
|
* filteredActions: ['read', 'contrib'],
|
|
35
|
-
*
|
|
40
|
+
* shareUrls: {
|
|
36
41
|
* getResourceRights: '/api/V1/info/shares', (get endpoint)
|
|
37
42
|
* saveResourceRights: '/api/V1/info/shares', (put endpoint)
|
|
38
43
|
* getShareMapping: '/api/V1/rights/sharing'
|
|
@@ -45,7 +50,7 @@ export type ShareOptions = {
|
|
|
45
50
|
resourceRights: RightStringified[];
|
|
46
51
|
resourceCreatorId: string;
|
|
47
52
|
filteredActions?: ShareRightActionDisplayName[];
|
|
48
|
-
|
|
53
|
+
shareUrls?: ShareUrls;
|
|
49
54
|
};
|
|
50
55
|
/**
|
|
51
56
|
* React Query mutation result for share operations
|
|
@@ -85,13 +90,13 @@ interface ShareResourceProps {
|
|
|
85
90
|
/**
|
|
86
91
|
* Callback when share rights change
|
|
87
92
|
*/
|
|
88
|
-
onChange?: (shareRights: ShareRight[], isDirty: boolean
|
|
93
|
+
onChange?: (shareRights: ShareRight[], isDirty: boolean) => void;
|
|
89
94
|
/**
|
|
90
|
-
* Callback when
|
|
95
|
+
* Callback when ShareResources component is submitting share rights or bookmark
|
|
91
96
|
*/
|
|
92
|
-
|
|
97
|
+
onSubmit?: () => void;
|
|
93
98
|
/**
|
|
94
|
-
* Optional className for the search input
|
|
99
|
+
* Optional className for the search input wrapper (default: 'col-6')
|
|
95
100
|
*/
|
|
96
101
|
classNameSearchInput?: string;
|
|
97
102
|
}
|
|
@@ -100,7 +105,6 @@ interface ShareResourceProps {
|
|
|
100
105
|
*
|
|
101
106
|
* @interface ShareResourcesRef
|
|
102
107
|
* @property {() => void} handleShare - Method to trigger the share operation
|
|
103
|
-
* @property {() => boolean} isSharing - Method to check if sharing is in progress
|
|
104
108
|
*
|
|
105
109
|
* @example
|
|
106
110
|
* ```tsx
|
|
@@ -153,7 +157,8 @@ export interface ShareResourcesRef {
|
|
|
153
157
|
* ref={shareRef}
|
|
154
158
|
* shareOptions={shareOptions}
|
|
155
159
|
* onSuccess={() => console.log('Shared successfully')}
|
|
156
|
-
* onChange={(rights, isDirty
|
|
160
|
+
* onChange={(rights, isDirty) => console.log('Rights changed:', isDirty)}
|
|
161
|
+
* onSubmit={() => console.log('Submitting share...')}
|
|
157
162
|
* />
|
|
158
163
|
* <button onClick={handleSave}>Save Changes</button>
|
|
159
164
|
* </>
|
|
@@ -24,7 +24,7 @@ const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
|
24
24
|
},
|
|
25
25
|
onChange = () => {
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
onSubmit = () => {
|
|
28
28
|
},
|
|
29
29
|
classNameSearchInput = "col-6"
|
|
30
30
|
}, ref) => {
|
|
@@ -33,7 +33,7 @@ const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
|
33
33
|
resourceCreatorId,
|
|
34
34
|
resourceRights,
|
|
35
35
|
filteredActions,
|
|
36
|
-
|
|
36
|
+
shareUrls
|
|
37
37
|
} = shareOptions, [isLoading, setIsLoading] = useState(!0), [isSavingBookmark, setIsSavingBookmark] = useState(!1), {
|
|
38
38
|
state: {
|
|
39
39
|
isSharing,
|
|
@@ -55,7 +55,7 @@ const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
|
55
55
|
setIsLoading,
|
|
56
56
|
onSuccess,
|
|
57
57
|
filteredActions,
|
|
58
|
-
|
|
58
|
+
shareUrls
|
|
59
59
|
}), {
|
|
60
60
|
state: {
|
|
61
61
|
searchResults,
|
|
@@ -72,7 +72,7 @@ const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
|
72
72
|
resourceCreatorId,
|
|
73
73
|
shareRights,
|
|
74
74
|
shareDispatch,
|
|
75
|
-
urlResourceRights:
|
|
75
|
+
urlResourceRights: shareUrls == null ? void 0 : shareUrls.getResourceRights
|
|
76
76
|
}), {
|
|
77
77
|
refBookmark,
|
|
78
78
|
showBookmark,
|
|
@@ -91,10 +91,10 @@ const ShareResources = /* @__PURE__ */ forwardRef(({
|
|
|
91
91
|
useImperativeHandle(ref, () => ({
|
|
92
92
|
handleShare
|
|
93
93
|
}), [handleShare]), useEffect(() => {
|
|
94
|
-
onChange(shareRights.rights, isDirty
|
|
95
|
-
}, [isDirty, shareRights.rights, onChange
|
|
96
|
-
|
|
97
|
-
}, [isSavingBookmark, isSharing,
|
|
94
|
+
onChange(shareRights.rights, isDirty);
|
|
95
|
+
}, [isDirty, shareRights.rights, onChange]), useEffect(() => {
|
|
96
|
+
(isSavingBookmark || isSharing) && onSubmit();
|
|
97
|
+
}, [isSavingBookmark, isSharing, onSubmit]);
|
|
98
98
|
const {
|
|
99
99
|
t
|
|
100
100
|
} = useTranslation(), searchPlaceholder = showSearchAdmlHint() ? t("explorer.search.adml.hint") : t("explorer.modal.share.search.placeholder");
|
|
@@ -19,7 +19,7 @@ interface UseShareResourceModalProps {
|
|
|
19
19
|
resourceShareRights?: ShareRightWithVisibles;
|
|
20
20
|
resourceShareRightActions?: ShareRightAction[];
|
|
21
21
|
filteredActions?: ShareRightActionDisplayName[];
|
|
22
|
-
|
|
22
|
+
shareUrls?: ShareUrls;
|
|
23
23
|
}
|
|
24
24
|
type State = {
|
|
25
25
|
isSharing: boolean;
|
|
@@ -43,7 +43,7 @@ export type ShareAction = {
|
|
|
43
43
|
type: 'isSharing';
|
|
44
44
|
payload: boolean;
|
|
45
45
|
};
|
|
46
|
-
export default function useShare({ resourceId, resourceRights, resourceCreatorId, shareResource, setIsLoading, onSuccess, filteredActions,
|
|
46
|
+
export default function useShare({ resourceId, resourceRights, resourceCreatorId, shareResource, setIsLoading, onSuccess, filteredActions, shareUrls, }: UseShareResourceModalProps): {
|
|
47
47
|
state: {
|
|
48
48
|
isSharing: boolean;
|
|
49
49
|
isDirty?: boolean;
|
|
@@ -57,7 +57,7 @@ function useShare({
|
|
|
57
57
|
setIsLoading,
|
|
58
58
|
onSuccess,
|
|
59
59
|
filteredActions,
|
|
60
|
-
|
|
60
|
+
shareUrls
|
|
61
61
|
}) {
|
|
62
62
|
const {
|
|
63
63
|
appCode
|
|
@@ -70,7 +70,7 @@ function useShare({
|
|
|
70
70
|
useEffect(() => {
|
|
71
71
|
resourceId && (async () => {
|
|
72
72
|
try {
|
|
73
|
-
const [shareRightActions, shareRights] = await Promise.all([odeServices.share().getActionsForApp(appCode,
|
|
73
|
+
const [shareRightActions, shareRights] = await Promise.all([odeServices.share().getActionsForApp(appCode, shareUrls == null ? void 0 : shareUrls.getShareMapping), odeServices.share().getRightsForResource(appCode, resourceId, shareUrls)]), filteredShareRightActions = filteredActions ? shareRightActions.filter((action) => filteredActions.includes(action.id)) : shareRightActions;
|
|
74
74
|
dispatch({
|
|
75
75
|
type: "init",
|
|
76
76
|
payload: {
|
|
@@ -177,10 +177,10 @@ function useShare({
|
|
|
177
177
|
});
|
|
178
178
|
notify && notifySuccess(result);
|
|
179
179
|
} else {
|
|
180
|
-
const result = await odeServices.share().saveRights(appCode, resourceId, shares,
|
|
180
|
+
const result = await odeServices.share().saveRights(appCode, resourceId, shares, shareUrls);
|
|
181
181
|
notify && notifySuccess(result);
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
shareUrls != null && shareUrls.getResourceRights && odeServices.cache().clearCache(shareUrls.getResourceRights), onSuccess();
|
|
184
184
|
} catch (error) {
|
|
185
185
|
typeof error == "string" && toast.error(t("explorer.shared.status.error")), typeof error == "object" && toast.error(t((error == null ? void 0 : error.error) || "explorer.shared.status.error")), console.error("Failed to save share", error);
|
|
186
186
|
} finally {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edifice.io/react",
|
|
3
|
-
"version": "2.5.2-develop-b2school-actualites.
|
|
3
|
+
"version": "2.5.2-develop-b2school-actualites.20251201115331",
|
|
4
4
|
"description": "Edifice React Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -82,17 +82,29 @@
|
|
|
82
82
|
"@pixi/react": "7.1.2",
|
|
83
83
|
"@popperjs/core": "2.11.8",
|
|
84
84
|
"@tiptap/core": "2.11.0",
|
|
85
|
+
"@tiptap/extension-blockquote": "2.11.0",
|
|
86
|
+
"@tiptap/extension-bullet-list": "2.11.0",
|
|
85
87
|
"@tiptap/extension-character-count": "2.11.0",
|
|
88
|
+
"@tiptap/extension-code": "2.11.0",
|
|
89
|
+
"@tiptap/extension-code-block": "2.11.0",
|
|
86
90
|
"@tiptap/extension-color": "2.11.0",
|
|
91
|
+
"@tiptap/extension-dropcursor": "2.11.0",
|
|
87
92
|
"@tiptap/extension-focus": "2.11.0",
|
|
88
93
|
"@tiptap/extension-font-family": "2.11.0",
|
|
94
|
+
"@tiptap/extension-gapcursor": "2.11.0",
|
|
95
|
+
"@tiptap/extension-hard-break": "2.11.0",
|
|
89
96
|
"@tiptap/extension-heading": "2.11.0",
|
|
90
97
|
"@tiptap/extension-highlight": "2.11.0",
|
|
98
|
+
"@tiptap/extension-history": "2.11.0",
|
|
99
|
+
"@tiptap/extension-horizontal-rule": "2.11.0",
|
|
91
100
|
"@tiptap/extension-image": "2.11.0",
|
|
101
|
+
"@tiptap/extension-italic": "2.11.0",
|
|
92
102
|
"@tiptap/extension-link": "2.11.0",
|
|
93
103
|
"@tiptap/extension-list-item": "2.11.0",
|
|
94
104
|
"@tiptap/extension-mathematics": "2.22.0",
|
|
105
|
+
"@tiptap/extension-ordered-list": "2.11.0",
|
|
95
106
|
"@tiptap/extension-placeholder": "2.11.0",
|
|
107
|
+
"@tiptap/extension-strike": "2.11.0",
|
|
96
108
|
"@tiptap/extension-subscript": "2.11.0",
|
|
97
109
|
"@tiptap/extension-superscript": "2.11.0",
|
|
98
110
|
"@tiptap/extension-table": "2.11.0",
|
|
@@ -106,20 +118,8 @@
|
|
|
106
118
|
"@tiptap/pm": "2.11.0",
|
|
107
119
|
"@tiptap/react": "2.11.0",
|
|
108
120
|
"@tiptap/starter-kit": "2.11.0",
|
|
109
|
-
"@tiptap/extension-blockquote": "2.11.0",
|
|
110
|
-
"@tiptap/extension-bullet-list": "2.11.0",
|
|
111
|
-
"@tiptap/extension-code": "2.11.0",
|
|
112
|
-
"@tiptap/extension-code-block": "2.11.0",
|
|
113
|
-
"@tiptap/extension-dropcursor": "2.11.0",
|
|
114
|
-
"@tiptap/extension-gapcursor": "2.11.0",
|
|
115
|
-
"@tiptap/extension-hard-break": "2.11.0",
|
|
116
|
-
"@tiptap/extension-history": "2.11.0",
|
|
117
|
-
"@tiptap/extension-horizontal-rule": "2.11.0",
|
|
118
|
-
"@tiptap/extension-italic": "2.11.0",
|
|
119
|
-
"@tiptap/extension-ordered-list": "2.11.0",
|
|
120
|
-
"@tiptap/extension-strike": "2.11.0",
|
|
121
121
|
"@uidotdev/usehooks": "^2.4.1",
|
|
122
|
-
"antd": "^
|
|
122
|
+
"antd": "^6.0.0",
|
|
123
123
|
"clsx": "^2.1.1",
|
|
124
124
|
"dayjs": "1.11.10",
|
|
125
125
|
"emoji-picker-react": "4.5.2",
|
|
@@ -133,9 +133,9 @@
|
|
|
133
133
|
"react-slugify": "^3.0.3",
|
|
134
134
|
"swiper": "^10.1.0",
|
|
135
135
|
"ua-parser-js": "^1.0.36",
|
|
136
|
-
"@edifice.io/bootstrap": "2.5.2-develop-b2school-actualites.
|
|
137
|
-
"@edifice.io/tiptap-extensions": "2.5.2-develop-b2school-actualites.
|
|
138
|
-
"@edifice.io/utilities": "2.5.2-develop-b2school-actualites.
|
|
136
|
+
"@edifice.io/bootstrap": "2.5.2-develop-b2school-actualites.20251201115331",
|
|
137
|
+
"@edifice.io/tiptap-extensions": "2.5.2-develop-b2school-actualites.20251201115331",
|
|
138
|
+
"@edifice.io/utilities": "2.5.2-develop-b2school-actualites.20251201115331"
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
141
|
"@babel/plugin-transform-react-pure-annotations": "^7.23.3",
|
|
@@ -166,8 +166,8 @@
|
|
|
166
166
|
"vite": "^5.4.11",
|
|
167
167
|
"vite-plugin-dts": "^4.1.0",
|
|
168
168
|
"vite-tsconfig-paths": "^5.0.1",
|
|
169
|
-
"@edifice.io/
|
|
170
|
-
"@edifice.io/
|
|
169
|
+
"@edifice.io/client": "2.5.2-develop-b2school-actualites.20251201115331",
|
|
170
|
+
"@edifice.io/config": "2.5.2-develop-b2school-actualites.20251201115331"
|
|
171
171
|
},
|
|
172
172
|
"peerDependencies": {
|
|
173
173
|
"@react-spring/web": "^9.7.5",
|