ode-explorer 1.4.12-develop-b2school.202406121448 → 1.4.12-develop-b2school.202406131654

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.js CHANGED
@@ -56388,38 +56388,48 @@ const useDropdown = (placement, extraTriggerKeyDownHandler) => {
56388
56388
  };
56389
56389
  }, useDropdown$1 = useDropdown, useDropzone = () => {
56390
56390
  const [dragging, setDragging] = reactExports.useState(false), [files, setFiles] = reactExports.useState([]), inputRef = reactExports.useRef(null), addFile = (file) => {
56391
- setFiles((prevFiles) => [...prevFiles, file]);
56391
+ addFiles([file]);
56392
56392
  }, deleteFile = (file) => {
56393
56393
  setFiles((prevFiles) => prevFiles.filter((prevFile) => prevFile.name !== file.name));
56394
+ }, addFiles = (files2) => {
56395
+ setFiles((prevFiles) => [...prevFiles, ...files2]);
56394
56396
  }, cleanFiles = () => {
56395
56397
  setFiles([]);
56396
56398
  }, handleOnChange = (event) => {
56397
56399
  const files2 = event.target.files;
56398
- files2 && [...files2].forEach((file) => {
56399
- addFile(file);
56400
- });
56400
+ files2 && addFiles([...files2]);
56401
56401
  }, handleDragging = (event) => {
56402
56402
  event.preventDefault(), event.stopPropagation(), setDragging(true);
56403
56403
  }, handleDragLeave = (event) => {
56404
56404
  event.preventDefault(), event.stopPropagation(), setDragging(false);
56405
56405
  };
56406
56406
  return {
56407
+ /** Reference to an `input[type=file]` HTMLElement, null at first. */
56407
56408
  inputRef,
56409
+ /** Read-only list of File·s managed by this hook. */
56408
56410
  files,
56411
+ /** Truthy when a drag event is triggered. */
56409
56412
  dragging,
56413
+ /** Callback to attach to your drop zone (any HTMLElement). */
56410
56414
  handleDragging,
56415
+ /** Callback to attach to your drop zone (any HTMLElement). */
56411
56416
  handleDragLeave,
56417
+ /** Callback to attach to your drop zone (any HTMLElement). */
56412
56418
  handleDrop: (event) => {
56413
56419
  var _a2;
56414
56420
  handleDragLeave(event);
56415
56421
  const files2 = (_a2 = event.dataTransfer) == null ? void 0 : _a2.files;
56416
- files2 && [...files2].forEach((file) => {
56417
- addFile(file);
56418
- }), inputRef != null && inputRef.current && files2 && (inputRef.current.files = files2);
56422
+ files2 && (addFiles([...files2]), inputRef != null && inputRef.current && (inputRef.current.files = files2));
56419
56423
  },
56424
+ /** Use it to remove a file from the `files` list. */
56420
56425
  deleteFile,
56426
+ /** Use it to add a file to the `files` list. */
56421
56427
  addFile,
56428
+ /** Use it to add many files to the `files` list. */
56429
+ addFiles,
56430
+ /** Use it to empty the `files` list. */
56422
56431
  cleanFiles,
56432
+ /** Callback to attach to your `input[type=file]` HTMLElement. */
56423
56433
  handleOnChange
56424
56434
  };
56425
56435
  }, useDropzone$1 = useDropzone, DEFAULT_POSITION = "top-right";
@@ -59077,7 +59087,49 @@ const useSlug = ({
59077
59087
  ] })
59078
59088
  ] })
59079
59089
  ] });
59080
- }, BlogPublic$1 = BlogPublic, initialState$1 = {
59090
+ }, BlogPublic$1 = BlogPublic, ShareBookmark = ({
59091
+ bookmark,
59092
+ refBookmark,
59093
+ onBookmarkChange,
59094
+ onSave
59095
+ }) => {
59096
+ const {
59097
+ t: t2
59098
+ } = useTranslation();
59099
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-16", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FormControl$1, { id: "bookmarkName", className: "d-flex flex-wrap align-items-center gap-16", children: [
59100
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-fill", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FormControl$1.Input, { ref: refBookmark, onChange: onBookmarkChange, placeholder: t2("explorer.modal.share.sharebookmark.placeholder"), size: "sm", type: "text" }, bookmark.id) }),
59101
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "button", color: "primary", variant: "ghost", disabled: bookmark.name.length === 0, leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgSave$1, {}), onClick: onSave, className: "text-nowrap", children: t2("explorer.modal.share.sharebookmark.save") })
59102
+ ] }) });
59103
+ }, hasRight = (shareRight, shareAction) => shareRight.actions.filter((a2) => shareAction.id === a2.id).length > 0, showShareRightLine = (shareRight, showBookmarkMembers) => shareRight.isBookmarkMember && showBookmarkMembers || !shareRight.isBookmarkMember, ShareBookmarkLine = ({
59104
+ shareRights,
59105
+ showBookmark,
59106
+ toggleBookmark,
59107
+ shareRightActions,
59108
+ toggleRight,
59109
+ onDeleteRow
59110
+ }) => {
59111
+ const {
59112
+ t: t2
59113
+ } = useTranslation();
59114
+ return shareRights == null ? void 0 : shareRights.rights.map((shareRight) => showShareRightLine(shareRight, showBookmark) && /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: shareRight.isBookmarkMember ? "bg-light" : "", children: [
59115
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("td", { children: [
59116
+ shareRight.type !== "sharebookmark" && /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { alt: t2("explorer.modal.share.avatar.shared.alt"), size: "xs", src: shareRight.avatarUrl, variant: "circle" }),
59117
+ shareRight.type === "sharebookmark" && /* @__PURE__ */ jsxRuntimeExports.jsx(SvgBookmark$1, {})
59118
+ ] }),
59119
+ /* @__PURE__ */ jsxRuntimeExports.jsx("td", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "d-flex", children: [
59120
+ shareRight.type === "sharebookmark" && /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { color: "tertiary", rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgRafterDown$1, { title: t2("show"), className: "w-16 min-w-0", style: {
59121
+ transition: "rotate 0.2s ease-out",
59122
+ rotate: showBookmark ? "-180deg" : "0deg"
59123
+ } }), type: "button", variant: "ghost", className: "fw-normal ps-0", onClick: toggleBookmark, children: shareRight.displayName }),
59124
+ shareRight.type !== "sharebookmark" && shareRight.displayName,
59125
+ shareRight.type === "user" && ` (${t2(shareRight.profile || "")})`
59126
+ ] }) }),
59127
+ shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsxRuntimeExports.jsx("td", { style: {
59128
+ width: "80px"
59129
+ }, className: "text-center text-white", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox$1, { checked: hasRight(shareRight, shareRightAction), onChange: () => toggleRight(shareRight, shareRightAction.id) }) }, shareRightAction.displayName)),
59130
+ /* @__PURE__ */ jsxRuntimeExports.jsx("td", { children: !shareRight.isBookmarkMember && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton$1, { "aria-label": t2("close"), color: "tertiary", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgClose$1, {}), type: "button", variant: "ghost", title: t2("close"), onClick: () => onDeleteRow(shareRight) }) })
59131
+ ] }, shareRight.id));
59132
+ }, initialState$1 = {
59081
59133
  searchInputValue: "",
59082
59134
  searchResults: [],
59083
59135
  searchAPIResults: [],
@@ -59126,7 +59178,8 @@ const defaultActions = [{
59126
59178
  id: "comment",
59127
59179
  displayName: "comment"
59128
59180
  }], useSearch = ({
59129
- resource,
59181
+ resourceId,
59182
+ resourceCreatorId,
59130
59183
  shareRights,
59131
59184
  shareDispatch
59132
59185
  }) => {
@@ -59147,17 +59200,17 @@ const defaultActions = [{
59147
59200
  payload: value
59148
59201
  });
59149
59202
  }, search = async (debouncedSearchInputValue2) => {
59150
- if (resource) {
59203
+ if (resourceId) {
59151
59204
  if (dispatch({
59152
59205
  type: "isSearching",
59153
59206
  payload: true
59154
59207
  }), !isAdml && debouncedSearchInputValue2.length >= 1 || isAdml && debouncedSearchInputValue2.length >= 3) {
59155
- const resSearchShareSubjects = await odeServices.share().searchShareSubjects(appCode, resource.assetId, debouncedSearchInputValue2);
59208
+ const resSearchShareSubjects = await odeServices.share().searchShareSubjects(appCode, resourceId, debouncedSearchInputValue2);
59156
59209
  dispatch({
59157
59210
  type: "addApiResult",
59158
59211
  payload: resSearchShareSubjects
59159
59212
  });
59160
- const adaptedResults = resSearchShareSubjects.filter((right2) => !shareRights.rights.find((shareRight) => shareRight.id === right2.id)).filter((right2) => !(right2.type === "user" && right2.id === (resource == null ? void 0 : resource.creatorId))).map((searchResult) => {
59213
+ const adaptedResults = resSearchShareSubjects.filter((right2) => !shareRights.rights.find((shareRight) => shareRight.id === right2.id)).filter((right2) => !(right2.type === "user" && right2.id === resourceCreatorId)).map((searchResult) => {
59161
59214
  let label = searchResult.displayName;
59162
59215
  return searchResult.type === "user" && searchResult.profile ? label = `${label} (${t2(searchResult.profile)})` : searchResult.type === "group" && searchResult.structureName && (label = `${label} (${searchResult.structureName})`), {
59163
59216
  value: searchResult.id,
@@ -59284,9 +59337,12 @@ function reducer(state, action) {
59284
59337
  }
59285
59338
  }
59286
59339
  function useShare({
59287
- onSuccess,
59288
- resource,
59289
- shareResource
59340
+ resourceId,
59341
+ resourceRights,
59342
+ resourceCreatorId,
59343
+ shareResource,
59344
+ setIsLoading,
59345
+ onSuccess
59290
59346
  }) {
59291
59347
  const {
59292
59348
  appCode
@@ -59297,20 +59353,25 @@ function useShare({
59297
59353
  t: t2
59298
59354
  } = useTranslation(), [state, dispatch] = reactExports.useReducer(reducer, initialState$2);
59299
59355
  return reactExports.useEffect(() => {
59300
- resource && (async () => {
59301
- const shareRightActions = await odeServices.share().getActionsForApp(appCode), shareRights = await odeServices.share().getRightsForResource(appCode, resource == null ? void 0 : resource.assetId);
59302
- dispatch({
59303
- type: "init",
59304
- payload: {
59305
- shareRightActions,
59306
- shareRights
59307
- }
59308
- });
59356
+ resourceId && (async () => {
59357
+ try {
59358
+ const [shareRightActions, shareRights] = await Promise.all([odeServices.share().getActionsForApp(appCode), odeServices.share().getRightsForResource(appCode, resourceId)]);
59359
+ dispatch({
59360
+ type: "init",
59361
+ payload: {
59362
+ shareRightActions,
59363
+ shareRights
59364
+ }
59365
+ });
59366
+ } catch (error) {
59367
+ console.error(error);
59368
+ }
59369
+ setIsLoading(false);
59309
59370
  })();
59310
- }, [resource]), {
59371
+ }, [resourceId]), {
59311
59372
  state,
59312
59373
  dispatch,
59313
- currentIsAuthor: () => !!(resource && resource.creatorId === (user == null ? void 0 : user.userId)),
59374
+ currentIsAuthor: () => resourceCreatorId === (user == null ? void 0 : user.userId),
59314
59375
  myAvatar: avatar,
59315
59376
  handleDeleteRow: (shareRight) => {
59316
59377
  dispatch({
@@ -59330,7 +59391,7 @@ function useShare({
59330
59391
  payload: true
59331
59392
  });
59332
59393
  try {
59333
- const myRights = resource.rights.filter((right2) => user && right2.includes(`user:${user.userId}`)).map((right2) => right2.split(":")[2]).filter((right2) => !!right2), shares = [...state.shareRights.rights];
59394
+ const myRights = resourceRights.filter((right2) => user && right2.includes(`user:${user.userId}`)).map((right2) => right2.split(":")[2]).filter((right2) => !!right2), shares = [...state.shareRights.rights];
59334
59395
  if (myRights.length > 0) {
59335
59396
  const actions = myRights.map((right2) => ({
59336
59397
  displayName: right2,
@@ -59346,9 +59407,9 @@ function useShare({
59346
59407
  });
59347
59408
  }
59348
59409
  shareResource ? await shareResource.mutateAsync({
59349
- resourceId: resource == null ? void 0 : resource.assetId,
59410
+ resourceId,
59350
59411
  rights: shares
59351
- }) : await odeServices.share().saveRights(appCode, resource == null ? void 0 : resource.assetId, shares), toast2.success(t2("explorer.shared.status.saved")), onSuccess();
59412
+ }) : await odeServices.share().saveRights(appCode, resourceId, shares), toast2.success(t2("explorer.shared.status.saved")), onSuccess();
59352
59413
  } catch (error) {
59353
59414
  typeof error == "string" && toast2.error(t2("explorer.shared.status.error")), console.error("Failed to save share", error);
59354
59415
  } finally {
@@ -59464,60 +59525,20 @@ const useShareBookmark = ({
59464
59525
  toggleBookmark,
59465
59526
  toggleBookmarkInput
59466
59527
  };
59467
- }, ShareBookmark = ({
59468
- bookmark,
59469
- refBookmark,
59470
- onBookmarkChange,
59471
- onSave
59472
- }) => {
59473
- const {
59474
- t: t2
59475
- } = useTranslation();
59476
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-16", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(FormControl$1, { id: "bookmarkName", className: "d-flex flex-wrap align-items-center gap-16", children: [
59477
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-fill", children: /* @__PURE__ */ jsxRuntimeExports.jsx(FormControl$1.Input, { ref: refBookmark, onChange: onBookmarkChange, placeholder: t2("explorer.modal.share.sharebookmark.placeholder"), size: "sm", type: "text" }, bookmark.id) }),
59478
- /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "button", color: "primary", variant: "ghost", disabled: bookmark.name.length === 0, leftIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgSave$1, {}), onClick: onSave, className: "text-nowrap", children: t2("explorer.modal.share.sharebookmark.save") })
59479
- ] }) });
59480
- }, hasRight = (shareRight, shareAction) => shareRight.actions.filter((a2) => shareAction.id === a2.id).length > 0, showShareRightLine = (shareRight, showBookmarkMembers) => shareRight.isBookmarkMember && showBookmarkMembers || !shareRight.isBookmarkMember, ShareBookmarkLine = ({
59481
- shareRights,
59482
- showBookmark,
59483
- toggleBookmark,
59484
- shareRightActions,
59485
- toggleRight,
59486
- onDeleteRow
59487
- }) => {
59488
- const {
59489
- t: t2
59490
- } = useTranslation();
59491
- return shareRights == null ? void 0 : shareRights.rights.map((shareRight) => showShareRightLine(shareRight, showBookmark) && /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: shareRight.isBookmarkMember ? "bg-light" : "", children: [
59492
- /* @__PURE__ */ jsxRuntimeExports.jsxs("td", { children: [
59493
- shareRight.type !== "sharebookmark" && /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar$1, { alt: t2("explorer.modal.share.avatar.shared.alt"), size: "xs", src: shareRight.avatarUrl, variant: "circle" }),
59494
- shareRight.type === "sharebookmark" && /* @__PURE__ */ jsxRuntimeExports.jsx(SvgBookmark$1, {})
59495
- ] }),
59496
- /* @__PURE__ */ jsxRuntimeExports.jsx("td", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "d-flex", children: [
59497
- shareRight.type === "sharebookmark" && /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { color: "tertiary", rightIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgRafterDown$1, { title: t2("show"), className: "w-16 min-w-0", style: {
59498
- transition: "rotate 0.2s ease-out",
59499
- rotate: showBookmark ? "-180deg" : "0deg"
59500
- } }), type: "button", variant: "ghost", className: "fw-normal ps-0", onClick: toggleBookmark, children: shareRight.displayName }),
59501
- shareRight.type !== "sharebookmark" && shareRight.displayName,
59502
- shareRight.type === "user" && ` (${t2(shareRight.profile || "")})`
59503
- ] }) }),
59504
- shareRightActions.map((shareRightAction) => /* @__PURE__ */ jsxRuntimeExports.jsx("td", { style: {
59505
- width: "80px"
59506
- }, className: "text-center text-white", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox$1, { checked: hasRight(shareRight, shareRightAction), onChange: () => toggleRight(shareRight, shareRightAction.id) }) }, shareRightAction.displayName)),
59507
- /* @__PURE__ */ jsxRuntimeExports.jsx("td", { children: !shareRight.isBookmarkMember && /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton$1, { "aria-label": t2("close"), color: "tertiary", icon: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgClose$1, {}), type: "button", variant: "ghost", title: t2("close"), onClick: () => onDeleteRow(shareRight) }) })
59508
- ] }, shareRight.id));
59509
59528
  };
59510
59529
  function ShareResourceModal({
59511
59530
  isOpen,
59512
- resourceId,
59531
+ shareOptions,
59513
59532
  shareResource,
59514
59533
  children,
59515
59534
  onSuccess,
59516
59535
  onCancel
59517
59536
  }) {
59518
59537
  const {
59519
- appCode: application
59520
- } = useOdeClient(), resource = useResource$1(application, resourceId), {
59538
+ resourceId,
59539
+ resourceCreatorId,
59540
+ resourceRights
59541
+ } = shareOptions, [isLoading, setIsLoading] = reactExports.useState(true), {
59521
59542
  state: {
59522
59543
  isSharing,
59523
59544
  shareRights,
@@ -59530,8 +59551,11 @@ function ShareResourceModal({
59530
59551
  toggleRight,
59531
59552
  handleDeleteRow
59532
59553
  } = useShare({
59533
- resource,
59554
+ resourceId,
59555
+ resourceCreatorId,
59556
+ resourceRights,
59534
59557
  shareResource,
59558
+ setIsLoading,
59535
59559
  onSuccess
59536
59560
  }), {
59537
59561
  state: {
@@ -59545,7 +59569,8 @@ function ShareResourceModal({
59545
59569
  handleSearchInputChange,
59546
59570
  handleSearchResultsChange
59547
59571
  } = useSearch({
59548
- resource,
59572
+ resourceId,
59573
+ resourceCreatorId,
59549
59574
  shareRights,
59550
59575
  shareDispatch
59551
59576
  }), {
@@ -59563,11 +59588,11 @@ function ShareResourceModal({
59563
59588
  }), {
59564
59589
  t: t2
59565
59590
  } = useTranslation(), searchPlaceholder = showSearchAdmlHint() ? t2("explorer.search.adml.hint") : t2("explorer.modal.share.search.placeholder");
59566
- return resource ? /* @__PURE__ */ reactDomExports.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1, { id: "share_modal", size: "lg", isOpen, onModalClose: onCancel, children: [
59591
+ return /* @__PURE__ */ reactDomExports.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1, { id: "share_modal", size: "lg", isOpen, onModalClose: onCancel, children: [
59567
59592
  /* @__PURE__ */ jsxRuntimeExports.jsx(Modal$1.Header, { onModalClose: onCancel, children: t2("share.title") }),
59568
59593
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1.Body, { children: [
59569
59594
  /* @__PURE__ */ jsxRuntimeExports.jsx(Heading$1, { headingStyle: "h4", level: "h3", className: "mb-16", children: t2("explorer.modal.share.usersWithAccess") }),
59570
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "table-responsive", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: "table border align-middle mb-0", children: [
59595
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "table-responsive", children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingScreen$1, {}) : /* @__PURE__ */ jsxRuntimeExports.jsxs("table", { className: "table border align-middle mb-0", children: [
59571
59596
  /* @__PURE__ */ jsxRuntimeExports.jsx("thead", { className: "bg-secondary", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { children: [
59572
59597
  /* @__PURE__ */ jsxRuntimeExports.jsx("th", { scope: "col", className: "w-32", children: /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHidden$1, { children: t2("explorer.modal.share.avatar.shared.alt") }) }),
59573
59598
  /* @__PURE__ */ jsxRuntimeExports.jsx("th", { scope: "col", children: /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHidden$1, { children: t2("explorer.modal.share.search.placeholder") }) }),
@@ -59599,23 +59624,23 @@ function ShareResourceModal({
59599
59624
  /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip$1, { message: "Vos favoris de partage s’affichent en priorité dans votre liste lorsque vous recherchez un groupe ou une personne, vous pouvez les retrouver dans l’annuaire.", placement: "top", children: /* @__PURE__ */ jsxRuntimeExports.jsx(SvgInfoCircle$1, { className: "c-pointer", height: "18" }) })
59600
59625
  ] }),
59601
59626
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "row", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "col-10", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Combobox$1, { value: searchInputValue, placeholder: searchPlaceholder, isLoading: showSearchLoading(), noResult: showSearchNoResults(), options: searchResults, searchMinLength: getSearchMinLength(), onSearchInputChange: handleSearchInputChange, onSearchResultsChange: handleSearchResultsChange }) }) }),
59602
- typeof children == "function" ? children(resource) : children
59627
+ children
59603
59628
  ] }),
59604
59629
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1.Footer, { children: [
59605
59630
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "button", color: "tertiary", variant: "ghost", onClick: onCancel, children: t2("explorer.cancel") }),
59606
59631
  /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "button", color: "primary", variant: "filled", isLoading: isSharing, onClick: handleShare, disabled: isSharing, children: t2("share") })
59607
59632
  ] })
59608
- ] }), document.getElementById("portal")) : /* @__PURE__ */ jsxRuntimeExports.jsx(LoadingScreen$1, {});
59633
+ ] }), document.getElementById("portal"));
59609
59634
  }
59610
59635
  function ShareBlog({
59611
- resource,
59636
+ resourceId,
59612
59637
  updateResource
59613
59638
  }) {
59614
59639
  const {
59615
59640
  appCode
59616
59641
  } = useOdeClient(), {
59617
59642
  t: t2
59618
- } = useTranslation(appCode), publishType = resource && resource["publish-type"], [radioPublicationValue, setRadioPublicationValue] = reactExports.useState(publishType ?? "RESTRAINT"), handleRadioPublicationChange = async (event) => {
59643
+ } = useTranslation(appCode), resource = useResource$1("blog", resourceId), publishType = resource && resource["publish-type"], [radioPublicationValue, setRadioPublicationValue] = reactExports.useState(publishType ?? "RESTRAINT"), handleRadioPublicationChange = async (event) => {
59619
59644
  const value = event.target.value;
59620
59645
  (async () => {
59621
59646
  const params = {
@@ -63136,14 +63161,18 @@ function ActionBarContainer() {
63136
63161
  ShareResourceModal,
63137
63162
  {
63138
63163
  isOpen: isShareResourceOpen,
63139
- resourceId: selectedResource.assetId,
63140
63164
  shareResource,
63165
+ shareOptions: {
63166
+ resourceCreatorId: selectedResource.creatorId,
63167
+ resourceId: selectedResource.assetId,
63168
+ resourceRights: selectedResource.rights
63169
+ },
63141
63170
  onCancel: onShareResourceCancel,
63142
63171
  onSuccess: onShareResourceSuccess,
63143
63172
  children: appCode === "blog" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
63144
63173
  ShareBlog,
63145
63174
  {
63146
- resource: selectedResource,
63175
+ resourceId: selectedResource.assetId,
63147
63176
  updateResource
63148
63177
  }
63149
63178
  ) : null
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-b2school-SNAPSHOT 12/06/2024 14:48:47
1
+ ode-explorer=1.0-b2school-SNAPSHOT 13/06/2024 16:54:32
@@ -4,7 +4,7 @@ import { useUser as pe, Button as W, useOdeClient as he, ActionBar as fe, Loadin
4
4
  import { useTransition as Oe, animated as ye } from "@react-spring/web";
5
5
  import { useTranslation as ee } from "react-i18next";
6
6
  import { odeServices as D, ACTION as c } from "edifice-ts-client";
7
- import { e as X, f as be, b as ve, h as Ae, i as se, j as Ie, k as Me, l as ge, m as Pe, d as we, n as xe, u as te, a as Fe, o as Te, p as Be, q as De } from "./index2.js";
7
+ import { e as X, f as be, b as Ie, h as ve, i as se, j as Ae, k as ge, l as Me, m as Pe, d as we, n as xe, u as te, a as Fe, o as Te, p as Be, q as De } from "./index2.js";
8
8
  import "@edifice-ui/icons";
9
9
  import "i18next";
10
10
  import "zustand";
@@ -15,7 +15,7 @@ function Le({
15
15
  action: s
16
16
  }) {
17
17
  const [d, t] = L(!1), {
18
- user: S
18
+ user: E
19
19
  } = pe(), h = X();
20
20
  Z(() => {
21
21
  f();
@@ -43,7 +43,7 @@ function Le({
43
43
  t(!0);
44
44
  return;
45
45
  }
46
- if (h && ((r = (l = o[0]) == null ? void 0 : l.trashedBy) != null && r.includes(S == null ? void 0 : S.userId)) && s === "restore" && !((m = o[0]) != null && m.trashed)) {
46
+ if (h && ((r = (l = o[0]) == null ? void 0 : l.trashedBy) != null && r.includes(E == null ? void 0 : E.userId)) && s === "restore" && !((m = o[0]) != null && m.trashed)) {
47
47
  t(!0);
48
48
  return;
49
49
  }
@@ -52,7 +52,7 @@ function Le({
52
52
  if (typeof o[0] == "string")
53
53
  await R(o);
54
54
  else {
55
- const b = o.map((v) => v.rights);
55
+ const b = o.map((I) => I.rights);
56
56
  await p(b);
57
57
  }
58
58
  else
@@ -66,7 +66,7 @@ function Le({
66
66
  };
67
67
  }
68
68
  function oe() {
69
- const [n, o] = L(!1), [s, d] = L("void"), [t, S] = L(), h = be((e) => e.config), R = ve(), p = Ae(), f = se(), l = Ie(), r = Me(), m = X(), b = ge(), v = Pe(), g = we(), _ = xe(), {
69
+ const [n, o] = L(!1), [s, d] = L("void"), [t, E] = L(), h = be((e) => e.config), R = Ie(), p = ve(), f = se(), l = Ae(), r = ge(), m = X(), b = Me(), I = Pe(), M = we(), _ = xe(), {
70
70
  openResource: N,
71
71
  printSelectedResource: P,
72
72
  openFolder: k,
@@ -80,7 +80,7 @@ function oe() {
80
80
  o(!1);
81
81
  return;
82
82
  }
83
- if (v) {
83
+ if (I) {
84
84
  o(!1);
85
85
  return;
86
86
  }
@@ -88,7 +88,7 @@ function oe() {
88
88
  }, [p, r]);
89
89
  async function U(e) {
90
90
  var B;
91
- switch ((B = document.getElementById("root")) == null || B.setAttribute("aria-hidden", "true"), S(e), e.id) {
91
+ switch ((B = document.getElementById("root")) == null || B.setAttribute("aria-hidden", "true"), E(e), e.id) {
92
92
  case c.OPEN:
93
93
  return p.length > 0 ? N(f[0]) : k({
94
94
  folder: l[0],
@@ -149,18 +149,18 @@ function oe() {
149
149
  await b.mutate();
150
150
  else
151
151
  throw new Error("Cannot restore untrashed resources");
152
- A();
152
+ v();
153
153
  } catch (e) {
154
154
  console.error(e);
155
155
  }
156
156
  }
157
- function A() {
157
+ function v() {
158
158
  var e;
159
159
  d("void"), t != null && t.id && ((e = document.getElementById(t == null ? void 0 : t.id)) == null || e.focus());
160
160
  }
161
161
  const i = (e) => () => {
162
- s === e && (A(), w(), x());
163
- }, J = i("move"), E = i("move"), z = i("delete"), T = i("delete"), V = i("publish"), I = i("publish"), M = i("edit_folder"), u = i("edit_folder"), $ = i("edit_resource"), q = i("edit_resource"), ne = i("share"), re = i("share"), ce = i("export"), ae = i("export");
162
+ s === e && (v(), w(), x());
163
+ }, J = i("move"), S = i("move"), z = i("delete"), T = i("delete"), V = i("publish"), A = i("publish"), g = i("edit_folder"), u = i("edit_folder"), $ = i("edit_resource"), q = i("edit_resource"), ne = i("share"), re = i("share"), ce = i("export"), ae = i("export");
164
164
  async function ie() {
165
165
  if (f && f.length > 0) {
166
166
  const e = f[0];
@@ -171,7 +171,7 @@ function oe() {
171
171
  if (p && p.length > 0) {
172
172
  const e = f[0].assetId;
173
173
  (h == null ? void 0 : h.app) == "scrapbook" ? Te({
174
- searchParams: g,
174
+ searchParams: M,
175
175
  assetId: e
176
176
  }) : d("edit_resource");
177
177
  } else
@@ -191,16 +191,16 @@ function oe() {
191
191
  isActionBarOpen: n,
192
192
  isMoveModalOpen: s === "move",
193
193
  onMoveCancel: J,
194
- onMoveSuccess: E,
194
+ onMoveSuccess: S,
195
195
  isDeleteModalOpen: s === "delete",
196
196
  onDeleteCancel: T,
197
197
  onDeleteSuccess: z,
198
198
  isPublishModalOpen: s === "publish",
199
- onPublishCancel: I,
199
+ onPublishCancel: A,
200
200
  onPublishSuccess: V,
201
201
  isEditFolderOpen: s === "edit_folder",
202
202
  onEditFolderCancel: u,
203
- onEditFolderSuccess: M,
203
+ onEditFolderSuccess: g,
204
204
  isEditResourceOpen: s === "edit_resource",
205
205
  onEditResourceCancel: q,
206
206
  onEditResourceSuccess: $,
@@ -210,7 +210,7 @@ function oe() {
210
210
  isExportModalOpen: s === "export",
211
211
  onExportCancel: ce,
212
212
  onExportSuccess: ae,
213
- onClearActionBar: A
213
+ onClearActionBar: v
214
214
  };
215
215
  }
216
216
  function _e({
@@ -221,7 +221,7 @@ function _e({
221
221
  renderWhenForbidden: t
222
222
  }) {
223
223
  const {
224
- t: S
224
+ t: E
225
225
  } = ee(), {
226
226
  overrideLabel: h
227
227
  } = oe(), {
@@ -235,7 +235,7 @@ function _e({
235
235
  } = te(), f = X();
236
236
  return R ? /* @__PURE__ */ a(G, { children: d }) : t ? t() : f && !R ? /* @__PURE__ */ a(W, { type: "button", color: "primary", variant: "filled", onClick: () => {
237
237
  p(!0);
238
- }, children: S(h(s)) }) : /* @__PURE__ */ a(G, {});
238
+ }, children: E(h(s)) }) : /* @__PURE__ */ a(G, {});
239
239
  }
240
240
  const Ne = /* @__PURE__ */ y(async () => await import("./PublishModal.js")), ke = /* @__PURE__ */ y(async () => await import("./ResourceModal.js")), He = /* @__PURE__ */ y(async () => await import("./DeleteModal.js")), Ue = /* @__PURE__ */ y(async () => await import("./MoveModal.js")), Ye = /* @__PURE__ */ y(async () => await import("./FolderModal.js")), je = /* @__PURE__ */ y(async () => await import("./ExportModal.js"));
241
241
  function es() {
@@ -247,7 +247,7 @@ function es() {
247
247
  actions: s,
248
248
  selectedElement: d,
249
249
  isMoveModalOpen: t,
250
- isDeleteModalOpen: S,
250
+ isDeleteModalOpen: E,
251
251
  isPublishModalOpen: h,
252
252
  isActionBarOpen: R,
253
253
  isEditFolderOpen: p,
@@ -256,8 +256,8 @@ function es() {
256
256
  onEditFolderSuccess: r,
257
257
  isEditResourceOpen: m,
258
258
  onEditResourceCancel: b,
259
- onEditResourceSuccess: v,
260
- isShareResourceOpen: g,
259
+ onEditResourceSuccess: I,
260
+ isShareResourceOpen: M,
261
261
  onShareResourceCancel: _,
262
262
  onShareResourceSuccess: N,
263
263
  isExportModalOpen: P,
@@ -269,9 +269,9 @@ function es() {
269
269
  onDeleteSuccess: Y,
270
270
  onPublishCancel: j,
271
271
  onPublishSuccess: F,
272
- isActivable: A,
272
+ isActivable: v,
273
273
  handleClick: i
274
- } = oe(), E = se()[0], z = Be(n), T = De(n), V = Oe(R, {
274
+ } = oe(), S = se()[0], z = Be(n), T = De(n), V = Oe(R, {
275
275
  from: {
276
276
  opacity: 0,
277
277
  transform: "translateY(100%)"
@@ -286,20 +286,24 @@ function es() {
286
286
  }
287
287
  });
288
288
  return /* @__PURE__ */ Q(G, { children: [
289
- V((I, M) => M && /* @__PURE__ */ a(ye.div, { className: "position-fixed bottom-0 start-0 end-0", style: {
290
- ...I,
289
+ V((A, g) => g && /* @__PURE__ */ a(ye.div, { className: "position-fixed bottom-0 start-0 end-0", style: {
290
+ ...A,
291
291
  zIndex: 4
292
- }, children: /* @__PURE__ */ a(fe, { children: s == null ? void 0 : s.filter((u) => u.available && u.target === "actionbar").map((u) => A(u) && /* @__PURE__ */ a(_e, { resourceRights: d, roleExpected: u.right, action: u, children: /* @__PURE__ */ a(W, { id: u.id, type: "button", color: "primary", variant: "filled", onClick: () => {
292
+ }, children: /* @__PURE__ */ a(fe, { children: s == null ? void 0 : s.filter((u) => u.available && u.target === "actionbar").map((u) => v(u) && /* @__PURE__ */ a(_e, { resourceRights: d, roleExpected: u.right, action: u, children: /* @__PURE__ */ a(W, { id: u.id, type: "button", color: "primary", variant: "filled", onClick: () => {
293
293
  i(u);
294
294
  }, children: o(f(u)) }, u.id) }, u.id)) }) })),
295
295
  /* @__PURE__ */ Q(de, { fallback: /* @__PURE__ */ a(me, {}), children: [
296
296
  t && /* @__PURE__ */ a(Ue, { isOpen: t, onCancel: x, onSuccess: H }),
297
- S && /* @__PURE__ */ a(He, { isOpen: S, onCancel: U, onSuccess: Y }),
298
- h && E && /* @__PURE__ */ a(Ne, { isOpen: h, resourceId: E.assetId, onCancel: j, onSuccess: F }),
297
+ E && /* @__PURE__ */ a(He, { isOpen: E, onCancel: U, onSuccess: Y }),
298
+ h && S && /* @__PURE__ */ a(Ne, { isOpen: h, resourceId: S.assetId, onCancel: j, onSuccess: F }),
299
299
  p && /* @__PURE__ */ a(Ye, { edit: !0, isOpen: p, onCancel: l, onSuccess: r }),
300
- m && E && /* @__PURE__ */ a(ke, { mode: "update", isOpen: m, resourceId: E.assetId, updateResource: T, onCancel: b, onSuccess: v, children: (I, M, u, $, q) => n === "blog" && Re("createPublic", s) && /* @__PURE__ */ a(Se, { appCode: n, isUpdating: M, resource: I, watch: u, setValue: $, register: q }) }),
301
- g && E && /* @__PURE__ */ a(Ee, { isOpen: g, resourceId: E.assetId, shareResource: z, onCancel: _, onSuccess: N, children: n === "blog" ? /* @__PURE__ */ a(Ce, { resource: E, updateResource: T }) : null }),
302
- P && E && /* @__PURE__ */ a(je, { isOpen: P, onCancel: k, onSuccess: w })
300
+ m && S && /* @__PURE__ */ a(ke, { mode: "update", isOpen: m, resourceId: S.assetId, updateResource: T, onCancel: b, onSuccess: I, children: (A, g, u, $, q) => n === "blog" && Re("createPublic", s) && /* @__PURE__ */ a(Se, { appCode: n, isUpdating: g, resource: A, watch: u, setValue: $, register: q }) }),
301
+ M && S && /* @__PURE__ */ a(Ee, { isOpen: M, shareResource: z, shareOptions: {
302
+ resourceCreatorId: S.creatorId,
303
+ resourceId: S.assetId,
304
+ resourceRights: S.rights
305
+ }, onCancel: _, onSuccess: N, children: n === "blog" ? /* @__PURE__ */ a(Ce, { resourceId: S.assetId, updateResource: T }) : null }),
306
+ P && S && /* @__PURE__ */ a(je, { isOpen: P, onCancel: k, onSuccess: w })
303
307
  ] })
304
308
  ] });
305
309
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "1.4.12-develop-b2school.202406121448",
3
+ "version": "1.4.12-develop-b2school.202406131654",
4
4
  "description": "Edifice Explorer",
5
5
  "homepage": "https://github.com/edificeio/explorer#readme",
6
6
  "bugs": {