@gofynd/fdk-client-javascript 2.0.0 → 2.0.1
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/README.md +1 -1
- package/package.json +1 -1
- package/sdk/common/Utility.js +6 -3
- package/sdk/common/utils.d.ts +0 -1
- package/sdk/common/utils.js +0 -14
package/README.md
CHANGED
|
@@ -237,7 +237,7 @@ console.log("Active Theme: ", response.information.name);
|
|
|
237
237
|
The above code will log the curl command in the console
|
|
238
238
|
|
|
239
239
|
```bash
|
|
240
|
-
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 2.0.
|
|
240
|
+
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 2.0.1' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
|
|
241
241
|
Active Theme: Emerge
|
|
242
242
|
```
|
|
243
243
|
|
package/package.json
CHANGED
package/sdk/common/Utility.js
CHANGED
|
@@ -5,9 +5,12 @@ function convertUrlToAction(url) {
|
|
|
5
5
|
if (url) {
|
|
6
6
|
const path = utils.trimChar(url);
|
|
7
7
|
const query = utils.getQuery(path);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
let pathname;
|
|
9
|
+
try {
|
|
10
|
+
pathname = new URL(path).pathname;
|
|
11
|
+
} catch (e) {
|
|
12
|
+
pathname = path.split("?")[0];
|
|
13
|
+
}
|
|
11
14
|
const allNavigations = Object.assign({}, Constant.NAVIGATORS);
|
|
12
15
|
const typeLink = {};
|
|
13
16
|
for (nav in allNavigations) {
|
package/sdk/common/utils.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export function findBestMatchingLink(allLinks?: any[], pathname?: string): {
|
|
|
7
7
|
value: string;
|
|
8
8
|
params: {};
|
|
9
9
|
};
|
|
10
|
-
export function validURL(str: any): boolean;
|
|
11
10
|
export function convertStringToBase64(string: any): string;
|
|
12
11
|
export function isBrowser(): boolean;
|
|
13
12
|
export function isNode(): boolean;
|
package/sdk/common/utils.js
CHANGED
|
@@ -94,19 +94,6 @@ const trimChar = (string = "", charToRemove = "/") => {
|
|
|
94
94
|
return string;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
function validURL(str) {
|
|
98
|
-
var pattern = new RegExp(
|
|
99
|
-
"^(https?:\\/\\/)?" + // protocol
|
|
100
|
-
"((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
|
|
101
|
-
"((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
|
|
102
|
-
"(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
|
|
103
|
-
"(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
|
|
104
|
-
"(\\#[-a-z\\d_]*)?$",
|
|
105
|
-
"i"
|
|
106
|
-
); // fragment locator
|
|
107
|
-
return !!pattern.test(str);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
97
|
const findBestMatchingLink = (allLinks = [], pathname = "/") => {
|
|
111
98
|
let bestMatch = { value: "", params: {} };
|
|
112
99
|
pathname = trimChar(pathname); // -> product/test-product-tag/reviews
|
|
@@ -221,7 +208,6 @@ module.exports = {
|
|
|
221
208
|
trimChar,
|
|
222
209
|
generateUrlWithParams,
|
|
223
210
|
findBestMatchingLink,
|
|
224
|
-
validURL,
|
|
225
211
|
convertStringToBase64,
|
|
226
212
|
isBrowser,
|
|
227
213
|
isNode,
|