@automattic/jetpack-connection 1.3.2 → 1.4.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
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
### This is a list detailing changes for the Jetpack RNA Connection Component releases.
|
|
4
4
|
|
|
5
|
+
## [1.4.1] - 2025-08-11
|
|
6
|
+
### Changed
|
|
7
|
+
- Update package dependencies. [#44677]
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- I18n: Improve context hints in comments for translators. [#44686]
|
|
11
|
+
|
|
12
|
+
## [1.4.0] - 2025-08-04
|
|
13
|
+
### Added
|
|
14
|
+
- Add "from" argument to user connection url. [#44587]
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- My Jetpack: Unify the user connection flow with a unified screen. [#44469]
|
|
18
|
+
|
|
5
19
|
## [1.3.2] - 2025-07-30
|
|
6
20
|
### Changed
|
|
7
21
|
- Update dependencies.
|
|
@@ -1120,6 +1134,8 @@
|
|
|
1120
1134
|
- `Main` and `ConnectUser` components added.
|
|
1121
1135
|
- `JetpackRestApiClient` API client added.
|
|
1122
1136
|
|
|
1137
|
+
[1.4.1]: https://github.com/Automattic/jetpack-connection-js/compare/v1.4.0...v1.4.1
|
|
1138
|
+
[1.4.0]: https://github.com/Automattic/jetpack-connection-js/compare/v1.3.2...v1.4.0
|
|
1123
1139
|
[1.3.2]: https://github.com/Automattic/jetpack-connection-js/compare/v1.3.1...v1.3.2
|
|
1124
1140
|
[1.3.1]: https://github.com/Automattic/jetpack-connection-js/compare/v1.3.0...v1.3.1
|
|
1125
1141
|
[1.3.0]: https://github.com/Automattic/jetpack-connection-js/compare/v1.2.14...v1.3.0
|
|
@@ -67,7 +67,7 @@ const ConnectionErrorNotice = props => {
|
|
|
67
67
|
<div className={ styles.message }>
|
|
68
68
|
{ icon }
|
|
69
69
|
{ sprintf(
|
|
70
|
-
/* translators:
|
|
70
|
+
/* translators: %s: the error. */
|
|
71
71
|
__( 'There was an error reconnecting Jetpack. Error: %s', 'jetpack-connection-js' ),
|
|
72
72
|
restoreConnectionError
|
|
73
73
|
) }
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getJetpackAdminPageUrl, getMyJetpackUrl } from '@automattic/jetpack-script-data';
|
|
2
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
3
|
+
|
|
4
|
+
export type UserConnectionUrlOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* The URL to redirect to after authentication.
|
|
7
|
+
*
|
|
8
|
+
* Defaults to the My Jetpack URL if not provided.
|
|
9
|
+
*/
|
|
10
|
+
redirect_url?: string | null;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The `from` to pass to Calypso for identification.
|
|
14
|
+
*
|
|
15
|
+
* This is typically used to identify the source of the connection request.
|
|
16
|
+
* If not provided, defaults to 'my-jetpack'.
|
|
17
|
+
*/
|
|
18
|
+
from?: string | null;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Whether to skip the pricing page after authentication.
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
skip_pricing?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generates the user connection URL.
|
|
30
|
+
*
|
|
31
|
+
* @param options - Options for generating the user connection URL.
|
|
32
|
+
*
|
|
33
|
+
* @return The URL for user connection.
|
|
34
|
+
*/
|
|
35
|
+
export function getUserConnectionUrl( options: UserConnectionUrlOptions = {} ): string {
|
|
36
|
+
const { redirect_url, from, skip_pricing = true } = options;
|
|
37
|
+
|
|
38
|
+
return addQueryArgs( getJetpackAdminPageUrl(), {
|
|
39
|
+
// 'connect_url_redirect' is handled in \Automattic\Jetpack\Connection\Webhooks::controller()
|
|
40
|
+
connect_url_redirect: 1,
|
|
41
|
+
redirect_after_auth: redirect_url ?? getMyJetpackUrl(),
|
|
42
|
+
from: from ?? 'my-jetpack',
|
|
43
|
+
skip_pricing,
|
|
44
|
+
} );
|
|
45
|
+
}
|
|
@@ -2,6 +2,7 @@ import restApi from '@automattic/jetpack-api';
|
|
|
2
2
|
import { getScriptData } from '@automattic/jetpack-script-data';
|
|
3
3
|
import { useDispatch } from '@wordpress/data';
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
|
+
import { getUserConnectionUrl } from '../../helpers/get-user-connection-url';
|
|
5
6
|
import { STORE_ID } from '../../state/store';
|
|
6
7
|
|
|
7
8
|
const { apiRoot, apiNonce } =
|
|
@@ -19,7 +20,7 @@ export default function useRestoreConnection() {
|
|
|
19
20
|
|
|
20
21
|
const { disconnectUserSuccess, setConnectionErrors } = useDispatch( STORE_ID );
|
|
21
22
|
|
|
22
|
-
const USER_CONNECTION_URL =
|
|
23
|
+
const USER_CONNECTION_URL = getUserConnectionUrl();
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* Initiate connection restore.
|
package/index.jsx
CHANGED
|
@@ -38,6 +38,7 @@ export { default as ManageConnectionDialog } from './components/manage-connectio
|
|
|
38
38
|
*/
|
|
39
39
|
export { default as thirdPartyCookiesFallbackHelper } from './helpers/third-party-cookies-fallback';
|
|
40
40
|
export { default as getCalypsoOrigin } from './helpers/get-calypso-origin';
|
|
41
|
+
export * from './helpers/get-user-connection-url.ts';
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* Store
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-connection",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Jetpack Connection Component",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/connection/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -11,27 +11,41 @@
|
|
|
11
11
|
"url": "https://github.com/Automattic/jetpack.git",
|
|
12
12
|
"directory": "projects/js-packages/connection"
|
|
13
13
|
},
|
|
14
|
-
"author": "Automattic",
|
|
15
14
|
"license": "GPL-2.0-or-later",
|
|
15
|
+
"author": "Automattic",
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"./state/store.jsx",
|
|
18
|
+
"*.css",
|
|
19
|
+
"*.scss"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./index.jsx"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
27
|
+
"test-coverage": "pnpm run test --coverage"
|
|
28
|
+
},
|
|
16
29
|
"dependencies": {
|
|
17
|
-
"@automattic/jetpack-analytics": "^1.0.
|
|
18
|
-
"@automattic/jetpack-api": "^1.0.
|
|
19
|
-
"@automattic/jetpack-components": "^1.1.
|
|
20
|
-
"@automattic/jetpack-config": "^1.0.
|
|
21
|
-
"@automattic/jetpack-script-data": "^0.5.
|
|
22
|
-
"@wordpress/base-styles": "6.
|
|
23
|
-
"@wordpress/browserslist-config": "6.
|
|
24
|
-
"@wordpress/components": "
|
|
25
|
-
"@wordpress/data": "10.
|
|
26
|
-
"@wordpress/element": "6.
|
|
27
|
-
"@wordpress/i18n": "
|
|
28
|
-
"@wordpress/icons": "10.
|
|
30
|
+
"@automattic/jetpack-analytics": "^1.0.4",
|
|
31
|
+
"@automattic/jetpack-api": "^1.0.7",
|
|
32
|
+
"@automattic/jetpack-components": "^1.1.18",
|
|
33
|
+
"@automattic/jetpack-config": "^1.0.4",
|
|
34
|
+
"@automattic/jetpack-script-data": "^0.5.1",
|
|
35
|
+
"@wordpress/base-styles": "6.3.0",
|
|
36
|
+
"@wordpress/browserslist-config": "6.27.0",
|
|
37
|
+
"@wordpress/components": "30.0.0",
|
|
38
|
+
"@wordpress/data": "10.27.0",
|
|
39
|
+
"@wordpress/element": "6.27.0",
|
|
40
|
+
"@wordpress/i18n": "6.0.0",
|
|
41
|
+
"@wordpress/icons": "10.27.0",
|
|
42
|
+
"@wordpress/url": "4.27.0",
|
|
29
43
|
"clsx": "2.1.1",
|
|
30
44
|
"debug": "4.4.1",
|
|
31
45
|
"prop-types": "^15.7.2"
|
|
32
46
|
},
|
|
33
47
|
"devDependencies": {
|
|
34
|
-
"@automattic/jetpack-base-styles": "^1.0.
|
|
48
|
+
"@automattic/jetpack-base-styles": "^1.0.7",
|
|
35
49
|
"@babel/core": "7.28.0",
|
|
36
50
|
"@babel/preset-react": "7.27.1",
|
|
37
51
|
"@testing-library/dom": "10.4.0",
|
|
@@ -47,18 +61,5 @@
|
|
|
47
61
|
"peerDependencies": {
|
|
48
62
|
"react": "^18.0.0",
|
|
49
63
|
"react-dom": "^18.0.0"
|
|
50
|
-
},
|
|
51
|
-
"type": "module",
|
|
52
|
-
"exports": {
|
|
53
|
-
".": "./index.jsx"
|
|
54
|
-
},
|
|
55
|
-
"sideEffects": [
|
|
56
|
-
"./state/store.jsx",
|
|
57
|
-
"*.css",
|
|
58
|
-
"*.scss"
|
|
59
|
-
],
|
|
60
|
-
"scripts": {
|
|
61
|
-
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
|
|
62
|
-
"test-coverage": "pnpm run test --coverage"
|
|
63
64
|
}
|
|
64
65
|
}
|