@legalplace/wizardx-core 4.0.6 → 4.1.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.1.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@4.0.6...@legalplace/wizardx-core@4.1.0) (2023-06-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * change import path of getQueryParamsObject ([5826799](https://git.legalplace.eu/legalplace/monorepo/commits/58267996520a4514e001f72c1d70245276199fdf)), closes [api#8730](https://git.legalplace.eu/legalplace/monorepo/issues/8730)
12
+ * delete unused caracter from request ([d090cb5](https://git.legalplace.eu/legalplace/monorepo/commits/d090cb5820a4112715c7faf71064b4063d7ae233)), closes [api#8730](https://git.legalplace.eu/legalplace/monorepo/issues/8730)
13
+
14
+
15
+ ### Features
16
+
17
+ * get token from url params ([a514d25](https://git.legalplace.eu/legalplace/monorepo/commits/a514d2571f7eeaaf594fa669f2cadd40a7ab76b8)), closes [api#7991](https://git.legalplace.eu/legalplace/monorepo/issues/7991) [api#8730](https://git.legalplace.eu/legalplace/monorepo/issues/8730)
18
+
19
+
20
+
21
+
22
+
6
23
  ## [4.0.6](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@4.0.5...@legalplace/wizardx-core@4.0.6) (2023-05-25)
7
24
 
8
25
  **Note:** Version bump only for package @legalplace/wizardx-core
@@ -4,3 +4,4 @@ export * from "./scriptsLoader";
4
4
  export * from "./propsEqualityCheck";
5
5
  export * from "./date.helper";
6
6
  export * from "./phoneNumber.helper";
7
+ export * from "./urlSearchParams";
@@ -4,3 +4,4 @@ export * from "./scriptsLoader";
4
4
  export * from "./propsEqualityCheck";
5
5
  export * from "./date.helper";
6
6
  export * from "./phoneNumber.helper";
7
+ export * from "./urlSearchParams";
@@ -0,0 +1,3 @@
1
+ export declare const getQueryParamsObject: (searchParams?: string) => {
2
+ [key: string]: string;
3
+ };
@@ -0,0 +1 @@
1
+ export const getQueryParamsObject = (searchParams = window.location.search) => Array.from(new URLSearchParams(searchParams)).reduce((queryParamsObject, currentParams) => (Object.assign(Object.assign({}, queryParamsObject), { [currentParams[0]]: currentParams[1] })), {});
@@ -108,14 +108,15 @@ export const getCreateInstanceArguments = (permalink, searchParams, modelVersion
108
108
  return createInstanceArguments;
109
109
  };
110
110
  export const getClientConfigArguments = (permalink, uniqid) => {
111
+ const userToken = getAuthToken();
111
112
  const apiEndpoint = getConfig().apiEndpoint + (/\/$/.test(getConfig().apiEndpoint) ? "" : "/");
112
- const route = `${apiEndpoint}client-config${permalink ? `?permalink=${permalink}` : ""}${uniqid ? "&disableOnBoarding=true" : ""}`;
113
+ const route = `${apiEndpoint}client-config${permalink ? `?permalink=${permalink}` : ""}${uniqid ? "&disableOnBoarding=true" : ""}${userToken ? `&token=${userToken}` : ""}`;
113
114
  return [
114
115
  route,
115
116
  {
116
117
  headers: {
117
118
  "Content-Type": "application/json",
118
- Authorization: `Bearer ${getAuthToken()}`,
119
+ Authorization: `Bearer ${userToken}`,
119
120
  },
120
121
  credentials: "include",
121
122
  },
@@ -1,3 +1,4 @@
1
1
  import Cookies from "universal-cookie";
2
+ import { getQueryParamsObject } from "../helpers/urlSearchParams";
2
3
  const cookies = new Cookies();
3
- export const getAuthToken = () => cookies.get("token");
4
+ export const getAuthToken = () => { var _a; return ((_a = getQueryParamsObject()) === null || _a === void 0 ? void 0 : _a.token) || cookies.get("token"); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.0.6",
3
+ "version": "4.1.0",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -95,5 +95,5 @@
95
95
  "*.test.ts",
96
96
  "*.test.tsx"
97
97
  ],
98
- "gitHead": "0b6b65f4b78cd60619331aa2e640fafd50a74e88"
98
+ "gitHead": "361e5ce8195e524afbcc142e9822208df93db142"
99
99
  }