@scayle/storefront-core 7.43.0 → 7.44.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.44.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @aboutyou/backbone@16.2.0
|
|
9
|
+
|
|
10
|
+
## 7.44.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- Expose the `loginWithIDP` function from the `useSession` composable.
|
|
15
|
+
- Changes the signature of `handleIDPLoginCallback` to receive an object with the code inside instead of just the code for improved logging behavior.
|
|
16
|
+
|
|
3
17
|
## 7.43.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -7,12 +7,13 @@ exports.handleIDPLoginCallback = exports.getExternalIdpRedirect = void 0;
|
|
|
7
7
|
var _jose = require("jose");
|
|
8
8
|
var _types = require("../../../types/index.cjs");
|
|
9
9
|
var _oauth = require("../../../api/oauth.cjs");
|
|
10
|
+
var _user = require("../user.cjs");
|
|
10
11
|
const getExternalIdpRedirect = exports.getExternalIdpRedirect = async function getExternalIdpRedirect2(context) {
|
|
11
12
|
const shopId = context.shopId.toString();
|
|
12
13
|
const OAuthClient = (0, _oauth.getOAuthClient)(context);
|
|
13
14
|
const checkoutSecret = context.checkout.secret;
|
|
14
15
|
if (!context.idp?.enabled) {
|
|
15
|
-
|
|
16
|
+
return {};
|
|
16
17
|
}
|
|
17
18
|
const IDPKeys = context.idp.idpKeys;
|
|
18
19
|
const IDPRedirectURL = context.idp.idpRedirectURL;
|
|
@@ -39,7 +40,9 @@ const getExternalIdpRedirect = exports.getExternalIdpRedirect = async function g
|
|
|
39
40
|
}));
|
|
40
41
|
return Object.fromEntries(results);
|
|
41
42
|
};
|
|
42
|
-
const handleIDPLoginCallback = exports.handleIDPLoginCallback = async function handleIDPLoginCallback2(
|
|
43
|
+
const handleIDPLoginCallback = exports.handleIDPLoginCallback = async function handleIDPLoginCallback2({
|
|
44
|
+
code
|
|
45
|
+
}, context) {
|
|
43
46
|
(0, _types.assertSession)(context);
|
|
44
47
|
const OAuthClient = (0, _oauth.getOAuthClient)(context);
|
|
45
48
|
const {
|
|
@@ -50,6 +53,7 @@ const handleIDPLoginCallback = exports.handleIDPLoginCallback = async function h
|
|
|
50
53
|
accessToken,
|
|
51
54
|
refreshToken
|
|
52
55
|
});
|
|
56
|
+
await (0, _user.refreshUser)(context);
|
|
53
57
|
return {
|
|
54
58
|
message: "success"
|
|
55
59
|
};
|
|
@@ -2,6 +2,8 @@ import type { RpcContext } from '../../../types';
|
|
|
2
2
|
export declare const getExternalIdpRedirect: (context: RpcContext) => Promise<{
|
|
3
3
|
[k: string]: string;
|
|
4
4
|
}>;
|
|
5
|
-
export declare const handleIDPLoginCallback: (code
|
|
5
|
+
export declare const handleIDPLoginCallback: ({ code }: {
|
|
6
|
+
code: string;
|
|
7
|
+
}, context: RpcContext) => Promise<{
|
|
6
8
|
message: string;
|
|
7
9
|
}>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { SignJWT } from "jose";
|
|
2
2
|
import { assertSession } from "../../../types/index.mjs";
|
|
3
3
|
import { getOAuthClient } from "../../../api/oauth.mjs";
|
|
4
|
+
import { refreshUser } from "../user.mjs";
|
|
4
5
|
export const getExternalIdpRedirect = async function getExternalIdpRedirect2(context) {
|
|
5
6
|
const shopId = context.shopId.toString();
|
|
6
7
|
const OAuthClient = getOAuthClient(context);
|
|
7
8
|
const checkoutSecret = context.checkout.secret;
|
|
8
9
|
if (!context.idp?.enabled) {
|
|
9
|
-
|
|
10
|
+
return {};
|
|
10
11
|
}
|
|
11
12
|
const IDPKeys = context.idp.idpKeys;
|
|
12
13
|
const IDPRedirectURL = context.idp.idpRedirectURL;
|
|
@@ -35,7 +36,7 @@ export const getExternalIdpRedirect = async function getExternalIdpRedirect2(con
|
|
|
35
36
|
);
|
|
36
37
|
return Object.fromEntries(results);
|
|
37
38
|
};
|
|
38
|
-
export const handleIDPLoginCallback = async function handleIDPLoginCallback2(code, context) {
|
|
39
|
+
export const handleIDPLoginCallback = async function handleIDPLoginCallback2({ code }, context) {
|
|
39
40
|
assertSession(context);
|
|
40
41
|
const OAuthClient = getOAuthClient(context);
|
|
41
42
|
const { access_token: accessToken, refresh_token: refreshToken } = await OAuthClient.generateToken(code);
|
|
@@ -43,6 +44,7 @@ export const handleIDPLoginCallback = async function handleIDPLoginCallback2(cod
|
|
|
43
44
|
accessToken,
|
|
44
45
|
refreshToken
|
|
45
46
|
});
|
|
47
|
+
await refreshUser(context);
|
|
46
48
|
return {
|
|
47
49
|
message: "success"
|
|
48
50
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.44.1",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@aboutyou/backbone": "16.
|
|
62
|
+
"@aboutyou/backbone": "16.2.0",
|
|
63
63
|
"crypto-js": "4.2.0",
|
|
64
64
|
"jose": "5.2.2",
|
|
65
65
|
"radash": "12.0.0",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@scayle/eslint-config-storefront": "3.2.6",
|
|
73
73
|
"@types/crypto-js": "4.2.2",
|
|
74
|
-
"@types/node": "20.11.
|
|
74
|
+
"@types/node": "20.11.25",
|
|
75
75
|
"@types/webpack-env": "1.18.4",
|
|
76
76
|
"@vitest/coverage-v8": "1.3.1",
|
|
77
77
|
"dprint": "0.45.0",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"publint": "0.2.7",
|
|
81
81
|
"rimraf": "5.0.5",
|
|
82
82
|
"ts-node": "10.9.2",
|
|
83
|
-
"typescript": "5.
|
|
83
|
+
"typescript": "5.4.2",
|
|
84
84
|
"unbuild": "2.0.0",
|
|
85
85
|
"unstorage": "1.10.1",
|
|
86
86
|
"vitest": "1.3.1"
|