ode-explorer 1.4.2-develop-integration.202405161426 → 1.4.2-develop-pedago.202405171024

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
@@ -4100,6 +4100,12 @@ const usePrevious = (value, ignore) => {
4100
4100
  }, [value, ignore]);
4101
4101
  return ref2.current;
4102
4102
  };
4103
+ function alwaysNewT(i18n, language, namespace, keyPrefix) {
4104
+ return i18n.getFixedT(language, namespace, keyPrefix);
4105
+ }
4106
+ function useMemoizedT(i18n, language, namespace, keyPrefix) {
4107
+ return reactExports.useCallback(alwaysNewT(i18n, language, namespace, keyPrefix), [i18n, language, namespace, keyPrefix]);
4108
+ }
4103
4109
  function useTranslation(ns) {
4104
4110
  let props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
4105
4111
  const {
@@ -4143,9 +4149,9 @@ function useTranslation(ns) {
4143
4149
  if (i18n.reportNamespaces.addUsedNamespaces)
4144
4150
  i18n.reportNamespaces.addUsedNamespaces(namespaces);
4145
4151
  const ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every((n2) => hasLoadedNamespace(n2, i18n, i18nOptions));
4146
- function getT() {
4147
- return i18n.getFixedT(props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
4148
- }
4152
+ const memoGetT = useMemoizedT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
4153
+ const getT = () => memoGetT;
4154
+ const getNewT = () => alwaysNewT(i18n, props.lng || null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
4149
4155
  const [t2, setT] = reactExports.useState(getT);
4150
4156
  let joinedNS = namespaces.join();
4151
4157
  if (props.lng)
@@ -4162,21 +4168,21 @@ function useTranslation(ns) {
4162
4168
  if (props.lng) {
4163
4169
  loadLanguages(i18n, props.lng, namespaces, () => {
4164
4170
  if (isMounted.current)
4165
- setT(getT);
4171
+ setT(getNewT);
4166
4172
  });
4167
4173
  } else {
4168
4174
  loadNamespaces(i18n, namespaces, () => {
4169
4175
  if (isMounted.current)
4170
- setT(getT);
4176
+ setT(getNewT);
4171
4177
  });
4172
4178
  }
4173
4179
  }
4174
4180
  if (ready && previousJoinedNS && previousJoinedNS !== joinedNS && isMounted.current) {
4175
- setT(getT);
4181
+ setT(getNewT);
4176
4182
  }
4177
4183
  function boundReset() {
4178
4184
  if (isMounted.current)
4179
- setT(getT);
4185
+ setT(getNewT);
4180
4186
  }
4181
4187
  if (bindI18n && i18n)
4182
4188
  i18n.on(bindI18n, boundReset);
@@ -4190,13 +4196,11 @@ function useTranslation(ns) {
4190
4196
  bindI18nStore.split(" ").forEach((e2) => i18n.store.off(e2, boundReset));
4191
4197
  };
4192
4198
  }, [i18n, joinedNS]);
4193
- const isInitial = reactExports.useRef(true);
4194
4199
  reactExports.useEffect(() => {
4195
- if (isMounted.current && !isInitial.current) {
4200
+ if (isMounted.current && ready) {
4196
4201
  setT(getT);
4197
4202
  }
4198
- isInitial.current = false;
4199
- }, [i18n, keyPrefix]);
4203
+ }, [i18n, keyPrefix, ready]);
4200
4204
  const ret = [t2, i18n, ready];
4201
4205
  ret.t = t2;
4202
4206
  ret.i18n = i18n;
@@ -4235,7 +4239,10 @@ instance.use(Backend).use(initReactI18next).init({
4235
4239
  prefix: "[[",
4236
4240
  suffix: "]]"
4237
4241
  },
4238
- debug: false
4242
+ debug: false,
4243
+ react: {
4244
+ useSuspense: false
4245
+ }
4239
4246
  });
4240
4247
  var Subscribable = class {
4241
4248
  constructor() {
@@ -62603,6 +62610,42 @@ const useConversation = () => {
62603
62610
  }, useConversation$1 = useConversation;
62604
62611
  dayjs.extend(relativeTime);
62605
62612
  dayjs.extend(customParseFormat);
62613
+ function useDate() {
62614
+ const [lang, setLang] = reactExports.useState("fr"), sessionQuery = useSession();
62615
+ function parseDate(date, lang2) {
62616
+ if (date.length < 11)
62617
+ return dayjs(date, ["YYYY-MM-DD"], lang2);
62618
+ if (date.split("").findIndex((char) => "0" > char || char > "9") < 0)
62619
+ return dayjs(Number.parseInt(date));
62620
+ {
62621
+ let day = dayjs(date);
62622
+ return day.isValid() || (day = dayjs(date, ["YYYY-MM-DD HH:mm:ss.SSS"])), day;
62623
+ }
62624
+ }
62625
+ const fromNow = reactExports.useCallback((date) => {
62626
+ let computedDate = dayjs();
62627
+ try {
62628
+ return typeof date > "u" ? "" : (typeof date == "string" ? computedDate = parseDate(date, lang) : typeof date.$date == "number" ? computedDate = dayjs(new Date(date.$date)) : typeof date.$date == "string" && (computedDate = parseDate(date.$date, lang)), computedDate.isValid() ? computedDate.fromNow() : "");
62629
+ } catch {
62630
+ return "";
62631
+ }
62632
+ }, [lang]), formatDate = reactExports.useCallback((date, format) => {
62633
+ let computedDate = dayjs();
62634
+ try {
62635
+ return typeof date > "u" ? "" : (typeof date == "string" ? computedDate = parseDate(date, lang) : typeof date.$date == "number" ? computedDate = dayjs(new Date(date.$date)) : typeof date.$date == "string" && (computedDate = parseDate(date.$date, lang)), computedDate.isValid() ? computedDate.locale(lang).format(format || "D MMMM YYYY HH:mm:ss") : "");
62636
+ } catch {
62637
+ return "";
62638
+ }
62639
+ }, [lang]);
62640
+ return reactExports.useEffect(() => {
62641
+ var _a2;
62642
+ const lang2 = ((_a2 = sessionQuery == null ? void 0 : sessionQuery.data) == null ? void 0 : _a2.currentLanguage) || "fr";
62643
+ setLang(lang2), dayjs.locale(lang2);
62644
+ }, [sessionQuery == null ? void 0 : sessionQuery.data, setLang]), {
62645
+ fromNow,
62646
+ formatDate
62647
+ };
62648
+ }
62606
62649
  const DEFAULT_EVENTS = ["mousedown", "touchstart"];
62607
62650
  function useClickOutside(handler, events2, nodes) {
62608
62651
  const ref2 = reactExports.useRef();
@@ -63105,98 +63148,6 @@ function useXitiTrackPageLoad() {
63105
63148
  xitiStatus
63106
63149
  };
63107
63150
  }
63108
- function useZendeskGuide() {
63109
- const sessionQuery = useSession(), {
63110
- isAdml
63111
- } = useIsAdml(), {
63112
- theme
63113
- } = useOdeTheme(), hasSupportWorkflow = useHasWorkflow("net.atos.entng.support.controllers.DisplayController|view"), [locationPathname, setLocationPathname] = reactExports.useState(""), [dataModule, setDataModule] = reactExports.useState(void 0), setZendeskGuideLabels = () => {
63114
- var _a2;
63115
- const modulePathnameSplit = locationPathname.split("/");
63116
- let moduleLabel = "", labels = "";
63117
- if (dataModule != null && dataModule.labels && Object.keys(dataModule == null ? void 0 : dataModule.labels).length > 0 && modulePathnameSplit.length > 1) {
63118
- for (let i2 = 1; i2 < modulePathnameSplit.length; i2++)
63119
- modulePathnameSplit[i2].length > 0 && modulePathnameSplit[i2].match(/\d/) == null && (moduleLabel.length === 0 ? moduleLabel = modulePathnameSplit[i2] : moduleLabel = moduleLabel + "/" + modulePathnameSplit[i2]);
63120
- dataModule != null && dataModule.labels && Object.prototype.hasOwnProperty.call(dataModule == null ? void 0 : dataModule.labels, moduleLabel) ? labels = dataModule == null ? void 0 : dataModule.labels[moduleLabel] : dataModule != null && dataModule.default && String(dataModule.default).length > 0 && (labels = dataModule == null ? void 0 : dataModule.default);
63121
- } else
63122
- dataModule != null && dataModule.default && String(dataModule == null ? void 0 : dataModule.default).length > 0 && (labels = dataModule == null ? void 0 : dataModule.default);
63123
- if (labels.includes("${adml}") && (isAdml ? labels = labels.replace("${adml}", "adml") : labels = labels.replace("/${adml}", "")), labels.includes("${profile}")) {
63124
- const userProfile = ((_a2 = sessionQuery == null ? void 0 : sessionQuery.data) == null ? void 0 : _a2.userProfile[0]) || "";
63125
- labels = labels.replace("${profile}", userProfile.toLowerCase());
63126
- }
63127
- labels.includes("${theme") && (theme != null && theme.is1d ? labels = labels.replace("${theme}", "1D") : labels = labels.replace("${theme}", "2D")), window.zE("webWidget", "helpCenter:setSuggestions", {
63128
- labels: [labels]
63129
- });
63130
- };
63131
- return reactExports.useEffect(() => {
63132
- window.location.pathname !== locationPathname && setLocationPathname(window.location.pathname), !(dataModule === void 0 || Object.keys(dataModule).length === 0) && setZendeskGuideLabels();
63133
- }, [window.location.pathname, dataModule]), reactExports.useEffect(() => {
63134
- document.getElementById("ze-snippet") || hasSupportWorkflow === void 0 || (async () => {
63135
- var _a2;
63136
- const zendeskGuideConfig = await odeServices.http().get("/zendeskGuide/config");
63137
- if (zendeskGuideConfig && zendeskGuideConfig.key && zendeskGuideConfig.key !== "") {
63138
- const scriptZendesk = document.createElement("script");
63139
- scriptZendesk.id = "ze-snippet", scriptZendesk.src = `https://static.zdassets.com/ekr/snippet.js?key=${zendeskGuideConfig.key}`;
63140
- const currentLanguage = ((_a2 = sessionQuery == null ? void 0 : sessionQuery.data) == null ? void 0 : _a2.currentLanguage) || "fr";
63141
- document.body.appendChild(scriptZendesk).onload = () => {
63142
- currentLanguage === "es" ? window.zE(function() {
63143
- window.zE.setLocale("es-419");
63144
- }) : window.zE(function() {
63145
- window.zE.setLocale("fr");
63146
- }), Object.keys(zendeskGuideConfig.module).length > 0 && setDataModule(zendeskGuideConfig.module), window.zE("webWidget", "updateSettings", {
63147
- webWidget: {
63148
- color: {
63149
- theme: zendeskGuideConfig.color || "#ffc400"
63150
- },
63151
- zIndex: 2,
63152
- launcher: {
63153
- mobile: {
63154
- labelVisible: true
63155
- }
63156
- },
63157
- contactForm: {
63158
- suppress: !hasSupportWorkflow
63159
- },
63160
- helpCenter: {
63161
- messageButton: {
63162
- "*": "Assistance ENT",
63163
- "es-419": "Asistencia ENT"
63164
- }
63165
- }
63166
- }
63167
- }), window.addEventListener("scroll", () => {
63168
- window.zE("webWidget", "updateSettings", {
63169
- webWidget: {
63170
- launcher: {
63171
- mobile: {
63172
- labelVisible: window.scrollY <= 5
63173
- }
63174
- }
63175
- }
63176
- });
63177
- }), window.zE("webWidget:on", "open", function() {
63178
- hasSupportWorkflow && window.zE("webWidget", "updateSettings", {
63179
- webWidget: {
63180
- contactForm: {
63181
- suppress: false
63182
- }
63183
- }
63184
- });
63185
- }), window.zE("webWidget:on", "userEvent", function(ref2) {
63186
- const category = ref2.category, action = ref2.action, properties2 = ref2.properties;
63187
- action === "Contact Form Shown" && category === "Zendesk Web Widget" && properties2 && properties2.name === "contact-form" && hasSupportWorkflow && (window.zE("webWidget", "updateSettings", {
63188
- webWidget: {
63189
- contactForm: {
63190
- suppress: true
63191
- }
63192
- }
63193
- }), window.zE("webWidget", "close"), window.open("/support", "_blank"));
63194
- });
63195
- };
63196
- }
63197
- })();
63198
- }, [hasSupportWorkflow]), null;
63199
- }
63200
63151
  const Image$1 = /* @__PURE__ */ reactExports.forwardRef(({
63201
63152
  src,
63202
63153
  alt,
@@ -63648,8 +63599,8 @@ const Image$1 = /* @__PURE__ */ reactExports.forwardRef(({
63648
63599
  onMenuItemKeyDown,
63649
63600
  onMenuItemMouseEnter,
63650
63601
  onMenuItemClick
63651
- } = itemProps, handleOnClick = () => {
63652
- onClick2 == null || onClick2(), type2 === "action" && onMenuItemClick();
63602
+ } = itemProps, handleOnClick = (event) => {
63603
+ onClick2 == null || onClick2(event), type2 === "action" && onMenuItemClick();
63653
63604
  }, id2 = reactExports.useId(), dropdownItem = clsx("dropdown-item", {
63654
63605
  focus: isFocused === id2
63655
63606
  });
@@ -64095,7 +64046,8 @@ const TextArea = /* @__PURE__ */ reactExports.forwardRef(({
64095
64046
  className,
64096
64047
  ...restProps
64097
64048
  }, ref2) => {
64098
- const {
64049
+ var _a2, _b2;
64050
+ const [content, setContent] = reactExports.useState(((_a2 = restProps.defaultValue) == null ? void 0 : _a2.toString()) || ((_b2 = restProps.value) == null ? void 0 : _b2.toString())), {
64099
64051
  id: id2,
64100
64052
  isRequired,
64101
64053
  isReadOnly,
@@ -64112,7 +64064,16 @@ const TextArea = /* @__PURE__ */ reactExports.forwardRef(({
64112
64064
  "form-control-plaintext": isReadOnly,
64113
64065
  "no-validation-icon": noValidationIcon
64114
64066
  }, className);
64115
- return /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { ref: ref2, id: id2, className: classes2, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps });
64067
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
64068
+ /* @__PURE__ */ jsxRuntimeExports.jsx("textarea", { ref: ref2, id: id2, className: classes2, placeholder, required: isRequired, readOnly: isReadOnly, ...restProps, value: content, onChange: (event) => {
64069
+ setContent(event.target.value);
64070
+ } }),
64071
+ restProps.maxLength && content && /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "small text-gray-700 p-2 text-end", children: [
64072
+ content.length,
64073
+ " / ",
64074
+ restProps.maxLength
64075
+ ] })
64076
+ ] });
64116
64077
  }), TextArea$1 = TextArea;
64117
64078
  function useTreeItemEvents(nodeId, label, expanded, setExpanded, onItemSelect, onItemFold, onItemUnfold, onItemFocus, onItemBlur) {
64118
64079
  const handleItemClick = (event) => {
@@ -64885,15 +64846,19 @@ const useThumb = ({
64885
64846
  /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { children: t2("title") }),
64886
64847
  /* @__PURE__ */ jsxRuntimeExports.jsx(Input$1, { type: "text", defaultValue: isUpdating ? resource == null ? void 0 : resource.name : "", ...register("title", {
64887
64848
  required: true,
64849
+ maxLength: 60,
64888
64850
  pattern: {
64889
64851
  value: /[^ ]/,
64890
64852
  message: "invalid title"
64891
64853
  }
64892
- }), placeholder: t2("explorer.resource.editModal.title.placeholder"), size: "md", "aria-required": true })
64854
+ }), placeholder: t2("explorer.resource.editModal.title.placeholder"), size: "md", "aria-required": true, maxLength: 60 })
64893
64855
  ] }),
64894
64856
  /* @__PURE__ */ jsxRuntimeExports.jsxs(FormControl$1, { id: "description", isOptional: true, children: [
64895
64857
  /* @__PURE__ */ jsxRuntimeExports.jsx(Label$1, { children: t2("description") }),
64896
- /* @__PURE__ */ jsxRuntimeExports.jsx(TextArea$1, { defaultValue: isUpdating ? resource == null ? void 0 : resource.description : "", ...register("description"), placeholder: t2("explorer.resource.editModal.description.placeholder"), size: "md" })
64858
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TextArea$1, { value: resource.description, ...register("description", {
64859
+ required: false,
64860
+ maxLength: 400
64861
+ }), placeholder: t2("explorer.resource.editModal.description.placeholder"), size: "md", maxLength: 400 })
64897
64862
  ] })
64898
64863
  ] })
64899
64864
  ] }),
@@ -66385,14 +66350,35 @@ const SearchEngine = () => {
66385
66350
  showCookiesConsent,
66386
66351
  handleConsultCookies,
66387
66352
  handleCloseCookiesConsent
66388
- } = useCookiesConsent();
66389
- useZendeskGuide();
66390
- const classes2 = clsx("d-flex flex-column bg-white", {
66353
+ } = useCookiesConsent(), classes2 = clsx("d-flex flex-column bg-white", {
66391
66354
  "container-fluid": !headless,
66392
66355
  "rounded-4 border": (theme == null ? void 0 : theme.is1d) && !headless,
66393
66356
  "mt-24": (theme == null ? void 0 : theme.is1d) && !headless
66394
- }), renderHeader = headless ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Header$2, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderCookies = showCookiesConsent && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert$1, { type: "info", className: "m-12", isConfirm: true, position: "bottom-right", button: /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { color: "tertiary", variant: "ghost", onClick: handleConsultCookies, children: t2("rgpd.cookies.banner.button.consult") }), onClose: handleCloseCookiesConsent, children: t2("rgpd.cookies.banner.text1") }), renderToaster = /* @__PURE__ */ jsxRuntimeExports.jsx(Ie$1, { toastOptions: {
66395
- position: "top-right"
66357
+ }), renderHeader = headless ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Header$2, { is1d: theme == null ? void 0 : theme.is1d, src: theme == null ? void 0 : theme.basePath }), renderCookies = showCookiesConsent && /* @__PURE__ */ jsxRuntimeExports.jsx(Alert$1, { type: "info", className: "m-12", isConfirm: true, position: "bottom-right", button: /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { color: "tertiary", variant: "ghost", onClick: handleConsultCookies, children: t2("rgpd.cookies.banner.button.consult") }), onClose: handleCloseCookiesConsent, children: t2("rgpd.cookies.banner.text1") }), renderToaster = /* @__PURE__ */ jsxRuntimeExports.jsx(Ie$1, { containerStyle: {
66358
+ zIndex: 0
66359
+ }, toastOptions: {
66360
+ position: "top-right",
66361
+ style: {},
66362
+ success: {
66363
+ style: {
66364
+ zIndex: 9999
66365
+ }
66366
+ },
66367
+ error: {
66368
+ style: {
66369
+ zIndex: 9999
66370
+ }
66371
+ },
66372
+ loading: {
66373
+ style: {
66374
+ zIndex: 9999
66375
+ }
66376
+ },
66377
+ custom: {
66378
+ style: {
66379
+ zIndex: 9999
66380
+ }
66381
+ }
66396
66382
  } });
66397
66383
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
66398
66384
  renderHeader,
@@ -67221,7 +67207,7 @@ const useSearchForm = () => {
67221
67207
  function ExplorerBreadcrumb() {
67222
67208
  const { appCode } = useOdeClient();
67223
67209
  const { gotoPreviousFolder } = useStoreActions();
67224
- const { t: t2 } = useTranslation();
67210
+ const { t: t2 } = useTranslation(["common", appCode]);
67225
67211
  const { inputSearch } = useSearchForm();
67226
67212
  const selectedNodesIds = useSelectedNodesIds();
67227
67213
  const isTrashFolder = useIsTrash();
@@ -67677,7 +67663,7 @@ const useCopyResource = () => {
67677
67663
  }
67678
67664
  );
67679
67665
  }
67680
- if (currentFolder.id && currentFolder.id !== "default") {
67666
+ if (currentFolder.id && currentFolder.id !== FOLDER.DEFAULT) {
67681
67667
  moveToFolder({
67682
67668
  searchParams,
67683
67669
  resourceIds: [data.duplicateId],
@@ -68059,10 +68045,9 @@ const useCreateResource = () => {
68059
68045
  var _a2, _b2, _c2;
68060
68046
  await queryClient2.cancelQueries({ queryKey });
68061
68047
  const previousData = queryClient2.getQueryData(queryKey);
68062
- const { thumbnail } = variables;
68063
68048
  const newResource = {
68064
68049
  ...variables,
68065
- thumbnail: thumbnail ? URL.createObjectURL(thumbnail) : "",
68050
+ thumbnail: data.thumbnail || "",
68066
68051
  application,
68067
68052
  assetId: data._id || data.entId || "",
68068
68053
  id: data._id || data.entId || "",
@@ -68126,7 +68111,7 @@ const List = () => {
68126
68111
  const treeData = useTreeData();
68127
68112
  const toast = useToast();
68128
68113
  const { appCode } = useOdeClient();
68129
- const { t: t2 } = useTranslation();
68114
+ const { t: t2 } = useTranslation([appCode]);
68130
68115
  const { setSearchParams, setSearchConfig, setTreeData } = useStoreActions();
68131
68116
  const { data, isError: isError2, error, isLoading, isFetching, fetchNextPage } = useSearchContext();
68132
68117
  const hasNoFolders = (data == null ? void 0 : data.pages[0].folders.length) === 0;
@@ -68369,7 +68354,10 @@ const TreeViewContainer = () => {
68369
68354
  /* @__PURE__ */ jsxRuntimeExports.jsx(
68370
68355
  TreeView$1,
68371
68356
  {
68372
- data: treeData,
68357
+ data: {
68358
+ ...treeData,
68359
+ name: t2("explorer.filters.mine", { ns: appCode })
68360
+ },
68373
68361
  selectedNodesIds,
68374
68362
  onTreeItemSelect: selectTreeItem,
68375
68363
  onTreeItemFold: foldTreeItem,
@@ -68787,7 +68775,7 @@ const ResourceCard = ({
68787
68775
  Image$2,
68788
68776
  {
68789
68777
  alt: "",
68790
- src: resource == null ? void 0 : resource.thumbnail,
68778
+ src: `${resource == null ? void 0 : resource.thumbnail}?thumbnail=80x80`,
68791
68779
  objectFit: "cover",
68792
68780
  className: "h-full w-100"
68793
68781
  }
@@ -68844,13 +68832,13 @@ const ResourceCard = ({
68844
68832
  );
68845
68833
  };
68846
68834
  ResourceCard.displayName = "ResourceCard";
68847
- dayjs.extend(relativeTime);
68848
68835
  const ResourcesList = ({
68849
68836
  data,
68850
68837
  fetchNextPage
68851
68838
  }) => {
68852
- const { currentApp, currentLanguage } = useOdeClient();
68839
+ const { currentApp } = useOdeClient();
68853
68840
  const { t: t2 } = useTranslation();
68841
+ const { fromNow } = useDate();
68854
68842
  const searchParams = useSearchParams();
68855
68843
  const resourceIds = useResourceIds();
68856
68844
  const selectedResources = useSelectedResources();
@@ -68902,7 +68890,7 @@ const ResourcesList = ({
68902
68890
  // eslint-disable-next-line react/no-array-index-key
68903
68891
  /* @__PURE__ */ jsxRuntimeExports.jsx(React$2.Fragment, { children: page.resources.map((resource) => {
68904
68892
  const { id: id2, updatedAt } = resource;
68905
- const time = dayjs(updatedAt).locale(currentLanguage).fromNow();
68893
+ const time = fromNow(updatedAt);
68906
68894
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
68907
68895
  animated.li,
68908
68896
  {
@@ -69044,6 +69032,7 @@ function FolderModal$1({
69044
69032
  type: "text",
69045
69033
  ...register("name", {
69046
69034
  required: true,
69035
+ maxLength: 60,
69047
69036
  pattern: {
69048
69037
  value: /[^ ]/,
69049
69038
  message: "invalid title"
@@ -69051,7 +69040,8 @@ function FolderModal$1({
69051
69040
  }),
69052
69041
  placeholder: t2("explorer.create.folder.name"),
69053
69042
  size: "md",
69054
- "aria-required": true
69043
+ "aria-required": true,
69044
+ maxLength: 60
69055
69045
  }
69056
69046
  )
69057
69047
  ] }) }) }),
@@ -69173,7 +69163,7 @@ const Library = () => {
69173
69163
  href: libraryUrl,
69174
69164
  target: "_blank",
69175
69165
  rel: "noreferrer",
69176
- className: "d-inline-flex gap-4 btn btn-ghost-primary py-0 p-0 pe-8",
69166
+ className: "d-inline-flex align-items-center gap-4 btn btn-ghost-primary py-0 p-0 pe-8",
69177
69167
  children: [
69178
69168
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: t2("explorer.libray.btn") }),
69179
69169
  /* @__PURE__ */ jsxRuntimeExports.jsx(SvgArrowRight$1, {})
@@ -69315,14 +69305,10 @@ function useActionBar() {
69315
69305
  case ACTION.UPD_PROPS:
69316
69306
  case "edit":
69317
69307
  return onEdit();
69318
- case "export":
69319
- if (resourceIds.length > 0) {
69320
- return onExport();
69321
- } else {
69322
- return null;
69323
- }
69324
69308
  case ACTION.SHARE:
69325
69309
  return setOpenedModalName("share");
69310
+ case ACTION.EXPORT:
69311
+ return setOpenedModalName("export");
69326
69312
  default:
69327
69313
  throw Error(`Unknown action: ${action.id}`);
69328
69314
  }
@@ -69394,6 +69380,8 @@ function useActionBar() {
69394
69380
  const onEditResourceCancel = onFinish("edit_resource");
69395
69381
  const onShareResourceSuccess = onFinish("share");
69396
69382
  const onShareResourceCancel = onFinish("share");
69383
+ const onExportCancel = onFinish("export");
69384
+ const onExportSuccess = onFinish("export");
69397
69385
  async function onCopy() {
69398
69386
  if (selectedResources && selectedResources.length > 0) {
69399
69387
  const selectedResource = selectedResources[0];
@@ -69410,12 +69398,6 @@ function useActionBar() {
69410
69398
  setOpenedModalName("edit_folder");
69411
69399
  }
69412
69400
  }
69413
- function onExport() {
69414
- if (resourceIds && resourceIds.length > 0) {
69415
- const selectedResource = selectedResources[0].assetId;
69416
- goToExport({ searchParams, assetId: selectedResource });
69417
- }
69418
- }
69419
69401
  function overrideLabel(action) {
69420
69402
  if (action.id === "edit" && folderIds.length > 0) {
69421
69403
  return "explorer.rename";
@@ -69449,6 +69431,9 @@ function useActionBar() {
69449
69431
  isShareResourceOpen: openedModalName === "share",
69450
69432
  onShareResourceCancel,
69451
69433
  onShareResourceSuccess,
69434
+ isExportModalOpen: openedModalName === "export",
69435
+ onExportCancel,
69436
+ onExportSuccess,
69452
69437
  onClearActionBar
69453
69438
  };
69454
69439
  }
@@ -69498,6 +69483,7 @@ const UpdateModal = reactExports.lazy(
69498
69483
  const DeleteModal$2 = reactExports.lazy(async () => await __vitePreload(() => Promise.resolve().then(() => DeleteModal$1), true ? void 0 : void 0));
69499
69484
  const MoveModal$2 = reactExports.lazy(async () => await __vitePreload(() => Promise.resolve().then(() => MoveModal$1), true ? void 0 : void 0));
69500
69485
  const FolderModal = reactExports.lazy(async () => await __vitePreload(() => Promise.resolve().then(() => FolderModal$2), true ? void 0 : void 0));
69486
+ const ExportModal$2 = reactExports.lazy(async () => await __vitePreload(() => Promise.resolve().then(() => ExportModal$1), true ? void 0 : void 0));
69501
69487
  function ActionBarContainer() {
69502
69488
  const { appCode } = useOdeClient();
69503
69489
  const { t: t2 } = useTranslation();
@@ -69518,6 +69504,9 @@ function ActionBarContainer() {
69518
69504
  isShareResourceOpen,
69519
69505
  onShareResourceCancel,
69520
69506
  onShareResourceSuccess,
69507
+ isExportModalOpen,
69508
+ onExportCancel,
69509
+ onExportSuccess,
69521
69510
  onMoveCancel,
69522
69511
  onMoveSuccess,
69523
69512
  onDeleteCancel,
@@ -69646,6 +69635,14 @@ function ActionBarContainer() {
69646
69635
  }
69647
69636
  ) : null
69648
69637
  }
69638
+ ),
69639
+ isExportModalOpen && selectedResource && /* @__PURE__ */ jsxRuntimeExports.jsx(
69640
+ ExportModal$2,
69641
+ {
69642
+ isOpen: isExportModalOpen,
69643
+ onCancel: onExportCancel,
69644
+ onSuccess: onExportSuccess
69645
+ }
69649
69646
  )
69650
69647
  ] })
69651
69648
  ] });
@@ -69899,6 +69896,69 @@ const MoveModal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
69899
69896
  __proto__: null,
69900
69897
  default: MoveModal
69901
69898
  }, Symbol.toStringTag, { value: "Module" }));
69899
+ const useExportModal = (onSuccess) => {
69900
+ const selectedResources = useSelectedResources();
69901
+ const searchParams = useSearchParams();
69902
+ const toast = useToast();
69903
+ const { t: t2 } = useTranslation();
69904
+ const handleExportClick = () => {
69905
+ if (selectedResources.length) {
69906
+ goToExport({ searchParams, assetId: selectedResources[0].assetId });
69907
+ onSuccess();
69908
+ } else {
69909
+ toast.error(t2("explorer.error.noResourceSelected"));
69910
+ }
69911
+ };
69912
+ return { handleExportClick };
69913
+ };
69914
+ function ExportModal({
69915
+ isOpen,
69916
+ onSuccess,
69917
+ onCancel
69918
+ }) {
69919
+ const { handleExportClick } = useExportModal(onSuccess);
69920
+ const { t: t2 } = useTranslation();
69921
+ return reactDomExports.createPortal(
69922
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1, { isOpen, onModalClose: onCancel, id: "exportModal", children: [
69923
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Modal$1.Header, { onModalClose: onCancel, children: t2("explorer.export.title") }),
69924
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1.Body, { children: [
69925
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { children: [
69926
+ /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("explorer.export.body.info.1") }),
69927
+ /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("explorer.export.body.info.2") }),
69928
+ /* @__PURE__ */ jsxRuntimeExports.jsx("li", { children: t2("explorer.export.body.info.3") })
69929
+ ] }),
69930
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Alert$1, { type: "warning", children: t2("explorer.export.body.warning") })
69931
+ ] }),
69932
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1.Footer, { children: [
69933
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
69934
+ Button$1,
69935
+ {
69936
+ color: "tertiary",
69937
+ onClick: onCancel,
69938
+ type: "button",
69939
+ variant: "ghost",
69940
+ children: t2("explorer.cancel")
69941
+ }
69942
+ ),
69943
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
69944
+ Button$1,
69945
+ {
69946
+ color: "primary",
69947
+ onClick: handleExportClick,
69948
+ type: "button",
69949
+ variant: "filled",
69950
+ children: t2("explorer.actions.export")
69951
+ }
69952
+ )
69953
+ ] })
69954
+ ] }),
69955
+ document.getElementById("portal")
69956
+ );
69957
+ }
69958
+ const ExportModal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
69959
+ __proto__: null,
69960
+ default: ExportModal
69961
+ }, Symbol.toStringTag, { value: "Module" }));
69902
69962
  function __vite__mapDeps(indexes) {
69903
69963
  if (!__vite__mapDeps.viteFileDeps) {
69904
69964
  __vite__mapDeps.viteFileDeps = []
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-b2school-SNAPSHOT 16/05/2024 14:26:40
1
+ ode-explorer=1.0-b2school-SNAPSHOT 17/05/2024 10:25:10