@legalplace/wizardx-core 4.44.2 → 4.44.4

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.
@@ -4,7 +4,7 @@ import { matchPath, generatePath } from "react-router";
4
4
  import { getConfig } from "../config";
5
5
  import { getPluginsPageAppStates } from "../PluginLoader";
6
6
  import { selectAvailableSections, selectAvailableAppStates, selectInstanceUniqid, selectMetaFetchStatus, } from "../redux/selectors/app";
7
- import { selectSectionReference } from "../redux/selectors/references";
7
+ import { selectAllSectionsReferences, selectSectionReference, } from "../redux/selectors/references";
8
8
  import Globals from "../Globals";
9
9
  import { getQueryStringValues } from "../helpers";
10
10
  export class PathReader {
@@ -86,10 +86,21 @@ export class PathReader {
86
86
  return availableSections[availableSectionsIndex];
87
87
  }
88
88
  getCurrentLinkPage() {
89
- const { sectionId } = getQueryStringValues();
90
- if (!sectionId)
89
+ var _a;
90
+ const { sectionId, sectionSlug } = getQueryStringValues();
91
+ if (!sectionId && !sectionSlug)
91
92
  return undefined;
92
- const pageNumber = selectAvailableSections().indexOf(Number(sectionId)) + 1;
93
+ let pageNumber;
94
+ if (sectionId) {
95
+ pageNumber = selectAvailableSections().indexOf(Number(sectionId)) + 1;
96
+ }
97
+ else if (sectionSlug) {
98
+ const sectionReference = Object.values(selectAllSectionsReferences() || {});
99
+ const sectionReferenceId = (_a = sectionReference.find((section) => section.slug === sectionSlug)) === null || _a === void 0 ? void 0 : _a.id;
100
+ if (!sectionReferenceId)
101
+ return this.parsePath(1);
102
+ pageNumber = selectAvailableSections().indexOf(sectionReferenceId) + 1;
103
+ }
93
104
  return this.parsePath(pageNumber);
94
105
  }
95
106
  getPagination() {
@@ -147,6 +158,8 @@ export class PathReader {
147
158
  const queryParams = getQueryStringValues();
148
159
  if (queryParams.version !== undefined)
149
160
  delete queryParams.version;
161
+ if (queryParams.sectionSlug !== undefined)
162
+ delete queryParams.sectionSlug;
150
163
  if (queryParams.sectionId !== undefined)
151
164
  delete queryParams.sectionId;
152
165
  const cleanQueryString = queryString.stringify(queryParams);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.44.2",
3
+ "version": "4.44.4",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -21,7 +21,7 @@
21
21
  "dependencies": {
22
22
  "@appnest/masonry-layout": "^2.0.8",
23
23
  "@cryptography/sha1": "^0.2.0",
24
- "@legalplace/data-gouv": "^1.6.112",
24
+ "@legalplace/data-gouv": "^1.6.113",
25
25
  "@legalplace/lp-events": "1.14.0",
26
26
  "@legalplace/lplogic": "2.3.1",
27
27
  "@legalplace/model-healthcheck": "^1.1.5",
@@ -62,7 +62,7 @@
62
62
  "@legalplace/eslint-config": "^2.3.0",
63
63
  "@legalplace/models-v3-types": "^5.15.8",
64
64
  "@legalplace/prettier-config": "^2.1.3",
65
- "@legalplace/typeorm-entities": "^5.70.4",
65
+ "@legalplace/typeorm-entities": "^5.71.0",
66
66
  "@swc-node/jest": "^1.3.2",
67
67
  "@swc/core": "^1.2.93",
68
68
  "@swc/jest": "^0.2.4",
@@ -100,5 +100,5 @@
100
100
  "*.test.ts",
101
101
  "*.test.tsx"
102
102
  ],
103
- "gitHead": "f37e442fc90385e82b44b637f5ed72f9e5184e84"
103
+ "gitHead": "2238105b5a6c369968a64cf3ce0bbef7c563ab9f"
104
104
  }