@scayle/storefront-core 7.65.7 → 7.65.8
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
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.65.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed an issue with handling the deprecated MD5 hash support, e.g. used for generating a user-specific basket hash, resulting in a potential application crash
|
|
8
|
+
|
|
3
9
|
## 7.65.7
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -349,8 +355,8 @@
|
|
|
349
355
|
|
|
350
356
|
```ts
|
|
351
357
|
const { data: externalIDPRedirects } = await useIDP({
|
|
352
|
-
queryParams: { redirectTo:
|
|
353
|
-
})
|
|
358
|
+
queryParams: { redirectTo: '/account' },
|
|
359
|
+
})
|
|
354
360
|
```
|
|
355
361
|
|
|
356
362
|
Please note that `code` and `state` are not supported as these are used by the SCAYLE Authentication API.
|
|
@@ -967,7 +973,7 @@
|
|
|
967
973
|
|
|
968
974
|
```js
|
|
969
975
|
env: {
|
|
970
|
-
SFC_OMIT_MD5: true
|
|
976
|
+
SFC_OMIT_MD5: true
|
|
971
977
|
}
|
|
972
978
|
```
|
|
973
979
|
|
|
@@ -975,7 +981,7 @@
|
|
|
975
981
|
|
|
976
982
|
```js
|
|
977
983
|
env: {
|
|
978
|
-
SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
|
|
984
|
+
SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
|
|
979
985
|
}
|
|
980
986
|
```
|
|
981
987
|
|
|
@@ -1013,7 +1019,7 @@
|
|
|
1013
1019
|
|
|
1014
1020
|
```js
|
|
1015
1021
|
env: {
|
|
1016
|
-
SFC_OMIT_MD5: true
|
|
1022
|
+
SFC_OMIT_MD5: true
|
|
1017
1023
|
}
|
|
1018
1024
|
```
|
|
1019
1025
|
|
|
@@ -1021,7 +1027,7 @@
|
|
|
1021
1027
|
|
|
1022
1028
|
```js
|
|
1023
1029
|
env: {
|
|
1024
|
-
SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
|
|
1030
|
+
SFC_OMIT_MD5: process.env.SFC_OMIT_MD5
|
|
1025
1031
|
}
|
|
1026
1032
|
```
|
|
1027
1033
|
|
|
@@ -37,7 +37,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
|
|
|
37
37
|
carrier,
|
|
38
38
|
basketId: context.basketKey,
|
|
39
39
|
campaignKey: context.campaignKey
|
|
40
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.
|
|
40
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.8"}`).setProtectedHeader({
|
|
41
41
|
alg: "HS256",
|
|
42
42
|
typ: "JWT"
|
|
43
43
|
}).sign(secret);
|
|
@@ -35,7 +35,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
|
|
|
35
35
|
carrier,
|
|
36
36
|
basketId: context.basketKey,
|
|
37
37
|
campaignKey: context.campaignKey
|
|
38
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.
|
|
38
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.65.8"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
|
|
39
39
|
return {
|
|
40
40
|
accessToken: refreshedAccessToken,
|
|
41
41
|
checkoutJwt
|
package/dist/utils/hash.cjs
CHANGED
|
@@ -5,12 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.verifyOrderSuccessToken = exports.sha256 = exports.md5 = exports.hmac = exports.encodeBase64 = exports.decodeBase64 = exports.buildSignature = exports.buildHashPayload = void 0;
|
|
7
7
|
var _uncrypto = require("uncrypto");
|
|
8
|
+
function stringToBoolean(value, defaultValue = false) {
|
|
9
|
+
return value ? value.toLowerCase() === "true" : defaultValue;
|
|
10
|
+
}
|
|
8
11
|
const md5 = async value => {
|
|
9
|
-
if (!process.env.SFC_OMIT_MD5) {
|
|
10
|
-
const md5EncryptImport = await Promise.resolve().then(() => require("crypto-js/md5"));
|
|
11
|
-
const hexImport = await Promise.resolve().then(() => require("crypto-js/enc-hex"));
|
|
12
|
-
const md5Encrypt = md5EncryptImport.default && typeof md5EncryptImport.default === "function" ? md5EncryptImport.default : md5EncryptImport;
|
|
13
|
-
const hex = hexImport.default && typeof hexImport.default === "function" ? hexImport.default : hexImport;
|
|
12
|
+
if (!stringToBoolean(process.env.SFC_OMIT_MD5)) {
|
|
13
|
+
const md5EncryptImport = await Promise.resolve().then(() => require("crypto-js/md5.js"));
|
|
14
|
+
const hexImport = await Promise.resolve().then(() => require("crypto-js/enc-hex.js"));
|
|
15
|
+
const md5Encrypt = md5EncryptImport.default && (typeof md5EncryptImport.default === "function" || typeof md5EncryptImport.default === "object") ? md5EncryptImport.default : md5EncryptImport;
|
|
16
|
+
const hex = hexImport.default && (typeof hexImport.default === "function" || typeof hexImport.default === "object") ? hexImport.default : hexImport;
|
|
14
17
|
return hex.stringify(md5Encrypt(value));
|
|
15
18
|
} else {
|
|
16
19
|
throw Error("SFC was built without support for MD5");
|
package/dist/utils/hash.mjs
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { subtle } from "uncrypto";
|
|
2
|
+
function stringToBoolean(value, defaultValue = false) {
|
|
3
|
+
return value ? value.toLowerCase() === "true" : defaultValue;
|
|
4
|
+
}
|
|
2
5
|
export const md5 = async (value) => {
|
|
3
|
-
if (!process.env.SFC_OMIT_MD5) {
|
|
4
|
-
const md5EncryptImport = await import("crypto-js/md5");
|
|
5
|
-
const hexImport = await import("crypto-js/enc-hex");
|
|
6
|
-
const md5Encrypt = md5EncryptImport.default && typeof md5EncryptImport.default === "function" ? md5EncryptImport.default : md5EncryptImport;
|
|
7
|
-
const hex = hexImport.default && typeof hexImport.default === "function" ? hexImport.default : hexImport;
|
|
6
|
+
if (!stringToBoolean(process.env.SFC_OMIT_MD5)) {
|
|
7
|
+
const md5EncryptImport = await import("crypto-js/md5.js");
|
|
8
|
+
const hexImport = await import("crypto-js/enc-hex.js");
|
|
9
|
+
const md5Encrypt = md5EncryptImport.default && (typeof md5EncryptImport.default === "function" || typeof md5EncryptImport.default === "object") ? md5EncryptImport.default : md5EncryptImport;
|
|
10
|
+
const hex = hexImport.default && (typeof hexImport.default === "function" || typeof hexImport.default === "object") ? hexImport.default : hexImport;
|
|
8
11
|
return hex.stringify(md5Encrypt(value));
|
|
9
12
|
} else {
|
|
10
13
|
throw Error("SFC was built without support for MD5");
|