@legalplace/wizardx-core 4.3.10 → 4.4.0

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.
@@ -1,10 +1,11 @@
1
1
  export const initInstanceReducer = (state, action) => {
2
- const { uniqid, isPaid, dataStatus, steps, companyUuid, employeeUuid } = action;
2
+ const { uniqid, isPaid, dataStatus, steps, filename, companyUuid, employeeUuid, } = action;
3
3
  return Object.assign(Object.assign({}, state), { instance: {
4
4
  dataStatus,
5
5
  uniqid,
6
6
  isPaid,
7
7
  steps,
8
+ filename,
8
9
  companyUuid,
9
10
  employeeUuid,
10
11
  } });
@@ -1,5 +1,5 @@
1
1
  export const updateInstanceReducer = (state, action) => {
2
- const { uniqid, isPaid, dataStatus, steps, companyUuid, employeeUuid } = action;
3
- return Object.assign(Object.assign({}, state), { instance: Object.assign(Object.assign({}, state.instance), { dataStatus: dataStatus || state.instance.dataStatus, uniqid: uniqid || state.instance.uniqid, isPaid, steps: steps || state.instance.steps, companyUuid,
2
+ const { uniqid, isPaid, dataStatus, steps, filename, companyUuid, employeeUuid, } = action;
3
+ return Object.assign(Object.assign({}, state), { instance: Object.assign(Object.assign({}, state.instance), { dataStatus: dataStatus || state.instance.dataStatus, uniqid: uniqid || state.instance.uniqid, isPaid, steps: steps || state.instance.steps, filename: filename || state.instance.filename, companyUuid,
4
4
  employeeUuid }) });
5
5
  };
@@ -46,6 +46,7 @@ describe('App Instance Reducer', () => {
46
46
  uniqid: '3jHD42343sDE',
47
47
  companyUuid: undefined,
48
48
  employeeUuid: undefined,
49
+ filename: undefined,
49
50
  isPaid: true,
50
51
  steps: '*',
51
52
  } }));
@@ -28,6 +28,7 @@ const appStateMock = {
28
28
  instance: {
29
29
  companyUuid: undefined,
30
30
  employeeUuid: undefined,
31
+ filename: undefined,
31
32
  dataStatus: 'saved',
32
33
  uniqid: '3jHD42343sDE',
33
34
  isPaid: false,
@@ -98,6 +99,7 @@ describe('App Reducer test suit', () => {
98
99
  uniqid: 'SomeUniqid123',
99
100
  employeeUuid: undefined,
100
101
  companyUuid: undefined,
102
+ filename: undefined,
101
103
  isPaid: true,
102
104
  steps: '*',
103
105
  } }));
@@ -114,6 +116,7 @@ describe('App Reducer test suit', () => {
114
116
  dataStatus: 'saved',
115
117
  employeeUuid: undefined,
116
118
  companyUuid: undefined,
119
+ filename: undefined,
117
120
  uniqid: '3jHD42343sDE',
118
121
  isPaid: false,
119
122
  steps: '*',
@@ -125,7 +125,7 @@ function* fetchModelInformation(modelUuid, permalink, prefix, queryParams) {
125
125
  return { ovc: response.ovc, references, meta: response.meta, smartScript };
126
126
  }
127
127
  function* fetchInstanceInformation(appStates, permalink, uniqid, uniqidParam, prefix, queryParams, pathReader) {
128
- var _a, _b;
128
+ var _a, _b, _c;
129
129
  let response = yield call(fetch, ...getFetchModelArguments(permalink, uniqidParam, prefix, queryParams));
130
130
  if (response === undefined) {
131
131
  throw new Error(`Unable to fetch ${permalink}${uniqid && uniqid.trim().length > 0 ? `/${uniqid}` : ""}, we did not recieve any response`);
@@ -155,8 +155,9 @@ function* fetchInstanceInformation(appStates, permalink, uniqid, uniqidParam, pr
155
155
  dataStatus: "saved",
156
156
  uniqid: uniqid || "",
157
157
  draft: response.instance && response.instance.draft,
158
- companyUuid: (_a = response.instance) === null || _a === void 0 ? void 0 : _a.companyUuid,
159
- employeeUuid: (_b = response.instance) === null || _b === void 0 ? void 0 : _b.employeeUuid,
158
+ filename: (_a = response.instance) === null || _a === void 0 ? void 0 : _a.filename,
159
+ companyUuid: (_b = response.instance) === null || _b === void 0 ? void 0 : _b.companyUuid,
160
+ employeeUuid: (_c = response.instance) === null || _c === void 0 ? void 0 : _c.employeeUuid,
160
161
  isPaid: response.instance &&
161
162
  (response.instance.isPaid.toString() === "1" ||
162
163
  response.instance.isPaid === true),
@@ -169,6 +170,14 @@ function* fetchInstanceInformation(appStates, permalink, uniqid, uniqidParam, pr
169
170
  if (pathReader.modelVersion)
170
171
  instance.steps = "*";
171
172
  yield put(initInstanceAction(instance));
173
+ const { brand } = getConfig();
174
+ const { name, documentTitle } = brand || {};
175
+ if (documentTitle !== false && instance.filename) {
176
+ document.title =
177
+ typeof documentTitle === "string"
178
+ ? documentTitle
179
+ : `${instance.filename} - ${name || "LegalPlace"}`;
180
+ }
172
181
  const availableAppStates = appStates || getConfig().appStates;
173
182
  if (typeof response.user === "object" &&
174
183
  typeof response.user.email === "string" &&
@@ -52,7 +52,7 @@ export const selectOutputsIds = createSelector((state, document) => {
52
52
  return state.app.wizard.availableSections.reduce((a, b) => `${a}${b}`, "");
53
53
  });
54
54
  export const selectPermalink = createSelector((state) => state.app.meta.permalink, (state) => state.app.meta.permalink);
55
- export const selectDocumentTitle = createSelector((state) => state.app.meta.title, (state) => state.app.meta.title);
55
+ export const selectDocumentTitle = createSelector((state) => state.app.instance.filename || state.app.meta.title, (state) => state.app.instance.filename || state.app.meta.title);
56
56
  export const selectDocumentId = createSelector((state) => state.app.meta.id, (state) => state.app.meta.id.toString());
57
57
  export const selectDocumentModelVersion = createSelector((state) => state.app.meta.modelVersion, (state) => state.app.meta.modelVersion.toString());
58
58
  export const selectDocumentProductType = createSelector((state) => state.app.meta.productType, (state) => state.app.meta.productType);
@@ -166,6 +166,7 @@ export interface AppCustomizationMetaType extends ModelV3CustomizationMeta {
166
166
  export interface AppInstanceType {
167
167
  dataStatus: "saved" | "unsaved" | "saving" | "failed";
168
168
  uniqid: string;
169
+ filename?: string;
169
170
  companyUuid?: string;
170
171
  employeeUuid?: string;
171
172
  isPaid?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.3.10",
3
+ "version": "4.4.0",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -24,9 +24,9 @@
24
24
  "@legalplace/lp-events": "1.14.0",
25
25
  "@legalplace/lplogic": "^2.1.6",
26
26
  "@legalplace/model-healthcheck": "^1.1.5",
27
- "@legalplace/referencesparser": "^3.0.3",
27
+ "@legalplace/referencesparser": "^3.0.4",
28
28
  "@legalplace/storybook": "^2.171.0",
29
- "@legalplace/typeorm-constants": "^3.15.0",
29
+ "@legalplace/typeorm-constants": "^3.16.0",
30
30
  "@loadable/component": "^5.15.0",
31
31
  "@redux-saga/core": "^1.1.3",
32
32
  "connected-react-router": "^6.8.0",
@@ -55,9 +55,9 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@legalplace/eslint-config": "^2.2.0",
58
- "@legalplace/models-v3-types": "^5.1.17",
58
+ "@legalplace/models-v3-types": "^5.1.18",
59
59
  "@legalplace/prettier-config": "^2.1.3",
60
- "@legalplace/typeorm-entities": "^5.21.1",
60
+ "@legalplace/typeorm-entities": "^5.22.0",
61
61
  "@swc-node/jest": "^1.3.2",
62
62
  "@swc/core": "^1.2.93",
63
63
  "@swc/jest": "^0.2.4",
@@ -95,5 +95,5 @@
95
95
  "*.test.ts",
96
96
  "*.test.tsx"
97
97
  ],
98
- "gitHead": "51a847e33a9dd648e0447d58478a3b75cc98e594"
98
+ "gitHead": "095bb47bf79e380b4a909dbb702b70f4c7485528"
99
99
  }