@portnet/ui 5.0.22 → 5.0.24

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.
@@ -31,11 +31,11 @@ const PuiHelpWidgetProvider = _ref => {
31
31
  apiAuthUrl,
32
32
  guideBaseUrl,
33
33
  token,
34
+ portailId = null,
34
35
  showReclamation = true,
35
36
  showGuides = true,
36
37
  showTijaria = true,
37
38
  currentProjectCode = null,
38
- portailId = null,
39
39
  children
40
40
  } = _ref;
41
41
  const axiosInstance = (0, _react.useMemo)(() => {
@@ -67,7 +67,8 @@ const PuiHelpWidgetProvider = _ref => {
67
67
  guideImageService: (0, _guideImageService.default)(publicAxiosInstance),
68
68
  tijariaUrl,
69
69
  apiAuthUrl,
70
- token: token || sessionStorage.getItem("access_token")
70
+ token: token || sessionStorage.getItem("access_token"),
71
+ portailId
71
72
  };
72
73
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRedux.Provider, {
73
74
  store: widgetStore,
@@ -9,7 +9,10 @@ require("core-js/modules/es.array.includes.js");
9
9
  require("core-js/modules/es.array-buffer.constructor.js");
10
10
  require("core-js/modules/es.array-buffer.slice.js");
11
11
  require("core-js/modules/es.promise.js");
12
+ require("core-js/modules/es.regexp.exec.js");
13
+ require("core-js/modules/es.regexp.test.js");
12
14
  require("core-js/modules/es.string.includes.js");
15
+ require("core-js/modules/es.string.split.js");
13
16
  require("core-js/modules/es.string.trim.js");
14
17
  require("core-js/modules/es.typed-array.uint8-array.js");
15
18
  require("core-js/modules/es.typed-array.fill.js");
@@ -1251,8 +1254,7 @@ const CustomChatInterface = _ref3 => {
1251
1254
  const ReclamationFormModal = _ref4 => {
1252
1255
  let {
1253
1256
  open,
1254
- onClose,
1255
- portailId = null
1257
+ onClose
1256
1258
  } = _ref4;
1257
1259
  const [activeStep, setActiveStep] = (0, _react.useState)(0);
1258
1260
  const [formData, setFormData] = (0, _react.useState)({
@@ -1267,11 +1269,11 @@ const ReclamationFormModal = _ref4 => {
1267
1269
  const {
1268
1270
  mutate: createReclamation,
1269
1271
  isLoading
1270
- } = (0, _useReclamation.useCreateReclamation)(portailId);
1272
+ } = (0, _useReclamation.useCreateReclamation)();
1271
1273
  const {
1272
1274
  data: listServiceReclamation,
1273
1275
  isFetching: isFetchingListServiceReclamation
1274
- } = (0, _useReclamation.useListServiceReclamation)(portailId);
1276
+ } = (0, _useReclamation.useListServiceReclamation)();
1275
1277
  const [error, setError] = (0, _react.useState)(null);
1276
1278
  const errorRef = (0, _react.useRef)(null);
1277
1279
  const CustomPopper = props => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popper, _objectSpread(_objectSpread({}, props), {}, {
@@ -1794,7 +1796,7 @@ const ReclamationsList = _ref5 => {
1794
1796
  data: reclamations,
1795
1797
  isFetching,
1796
1798
  error
1797
- } = (0, _useReclamation.useListReclamation)(page);
1799
+ } = (0, _useReclamation.useListReclamation)(page, searchKey);
1798
1800
  const {
1799
1801
  mutate: downloadDocument,
1800
1802
  isLoading: isDownloading,
@@ -1825,6 +1827,22 @@ const ReclamationsList = _ref5 => {
1825
1827
  return "#757575";
1826
1828
  }
1827
1829
  };
1830
+ const renderTextWithLinks = text => {
1831
+ if (!text) return null;
1832
+ const parts = text.split(/(https?:\/\/[^\s)]+)/g);
1833
+ return parts.map((part, i) => /^https?:\/\//.test(part) ? /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
1834
+ href: part,
1835
+ target: "_blank",
1836
+ rel: "noopener noreferrer",
1837
+ style: {
1838
+ color: "var(--primary-color, #222f67)",
1839
+ wordBreak: "break-all"
1840
+ },
1841
+ children: part
1842
+ }, i) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
1843
+ children: part
1844
+ }, i));
1845
+ };
1828
1846
  const handleReclamationClick = reclamation => {
1829
1847
  setSelectedReclamation(reclamation);
1830
1848
  setDetailsDialogOpen(true);
@@ -1928,6 +1946,7 @@ const ReclamationsList = _ref5 => {
1928
1946
  });
1929
1947
  };
1930
1948
  const onSearch = () => {
1949
+ setPage(1);
1931
1950
  setSearchKey(search);
1932
1951
  };
1933
1952
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -2655,7 +2674,7 @@ const ReclamationsList = _ref5 => {
2655
2674
  marginBottom: "4px"
2656
2675
  },
2657
2676
  children: "\uD83D\uDCAC R\xE9ponse"
2658
- }), entry.reponse]
2677
+ }), renderTextWithLinks(entry.reponse)]
2659
2678
  }), ((_entry$documents = entry.documents) === null || _entry$documents === void 0 ? void 0 : _entry$documents.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
2660
2679
  style: {
2661
2680
  marginTop: "8px",
@@ -3412,14 +3431,14 @@ const PuiHelpWidget = _ref7 => {
3412
3431
  showGuides = false,
3413
3432
  showTijaria = true,
3414
3433
  currentProjectCode = null,
3415
- guideBaseUrl,
3416
- portailId = null
3434
+ guideBaseUrl
3417
3435
  } = _ref7;
3418
3436
  const [dropdownOpen, setDropdownOpen] = (0, _react.useState)(false);
3419
3437
  const [isTourActive, setIsTourActive] = (0, _react.useState)(false);
3420
3438
  const {
3421
3439
  guideApi
3422
3440
  } = (0, _PuiHelpWidgetContext.useHelpWidget)();
3441
+ const queryClient = (0, _reactQuery.useQueryClient)();
3423
3442
  const toggle = () => {
3424
3443
  setDropdownOpen(prev => !prev);
3425
3444
  };
@@ -3690,7 +3709,10 @@ const PuiHelpWidget = _ref7 => {
3690
3709
  icon: _freeSolidSvgIcons.faClipboardList,
3691
3710
  title: "Mes réclamations",
3692
3711
  id: "mes-reclamations",
3693
- action: () => setViewingReclamations(true)
3712
+ action: () => {
3713
+ queryClient.invalidateQueries("get_list_reclamation");
3714
+ setViewingReclamations(true);
3715
+ }
3694
3716
  }, {
3695
3717
  icon: _freeSolidSvgIcons.faBullhorn,
3696
3718
  title: "Nouvelle réclamation",
@@ -4105,8 +4127,7 @@ const PuiHelpWidget = _ref7 => {
4105
4127
  })]
4106
4128
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(ReclamationFormModal, {
4107
4129
  open: reclamationModalOpen,
4108
- onClose: () => setReclamationModalOpen(false),
4109
- portailId: portailId
4130
+ onClose: () => setReclamationModalOpen(false)
4110
4131
  })]
4111
4132
  });
4112
4133
  };
@@ -24,9 +24,10 @@ const useListReclamation = (page, search) => {
24
24
  });
25
25
  };
26
26
  exports.useListReclamation = useListReclamation;
27
- const useCreateReclamation = portailId => {
27
+ const useCreateReclamation = () => {
28
28
  const {
29
- reclamationApi
29
+ reclamationApi,
30
+ portailId
30
31
  } = (0, _PuiHelpWidgetContext.useHelpWidget)();
31
32
  const queryClient = (0, _reactQuery.useQueryClient)();
32
33
  return (0, _reactQuery.useMutation)({
@@ -52,39 +53,48 @@ const useDownloadDocument = () => {
52
53
  });
53
54
  };
54
55
  exports.useDownloadDocument = useDownloadDocument;
55
- const useListServiceReclamation = exports.useListServiceReclamation = function useListServiceReclamation() {
56
- let portailId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
56
+ const useListServiceReclamation = () => {
57
57
  const {
58
- reclamationApi
58
+ reclamationApi,
59
+ portailId
59
60
  } = (0, _PuiHelpWidgetContext.useHelpWidget)();
60
61
  return (0, _reactQuery.useQuery)({
61
62
  queryKey: ["get_list_service_reclamation", portailId],
62
- queryFn: () =>
63
- // portailId === ID_PMPCE
64
- portailId !== null ? reclamationApi.getListServiceReclamationByPortailApi(portailId) : reclamationApi.getListServiceReclamationApi(),
63
+ queryFn: () => portailId !== null ? reclamationApi.getListServiceReclamationByPortailApi(portailId) : reclamationApi.getListServiceReclamationApi(),
65
64
  initialData: {},
66
65
  retry: 1,
67
66
  refetchOnWindowFocus: false,
68
67
  refetchOnReconnect: false
69
68
  });
70
69
  };
70
+ exports.useListServiceReclamation = useListServiceReclamation;
71
71
  const useClotureReclamation = () => {
72
72
  const {
73
73
  reclamationApi
74
74
  } = (0, _PuiHelpWidgetContext.useHelpWidget)();
75
- return (0, _reactQuery.useMutation)(id => reclamationApi.cloturerReclamation(id));
75
+ const queryClient = (0, _reactQuery.useQueryClient)();
76
+ return (0, _reactQuery.useMutation)(id => reclamationApi.cloturerReclamation(id), {
77
+ onSuccess: () => {
78
+ queryClient.invalidateQueries("get_list_reclamation");
79
+ }
80
+ });
76
81
  };
77
82
  exports.useClotureReclamation = useClotureReclamation;
78
83
  const useReouvreReclamation = () => {
79
84
  const {
80
85
  reclamationApi
81
86
  } = (0, _PuiHelpWidgetContext.useHelpWidget)();
87
+ const queryClient = (0, _reactQuery.useQueryClient)();
82
88
  return (0, _reactQuery.useMutation)(_ref => {
83
89
  let {
84
90
  id,
85
91
  formData
86
92
  } = _ref;
87
93
  return reclamationApi.reourrirReclamation(id, formData);
94
+ }, {
95
+ onSuccess: () => {
96
+ queryClient.invalidateQueries("get_list_reclamation");
97
+ }
88
98
  });
89
99
  };
90
100
  exports.useReouvreReclamation = useReouvreReclamation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portnet/ui",
3
- "version": "5.0.22",
3
+ "version": "5.0.24",
4
4
  "description": "Portnet UI",
5
5
  "keywords": [
6
6
  "react",