@automattic/jetpack-connection 0.35.14 → 0.35.15

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,13 @@
2
2
 
3
3
  ### This is a list detailing changes for the Jetpack RNA Connection Component releases.
4
4
 
5
+ ## [0.35.15] - 2024-11-04
6
+ ### Added
7
+ - Enable test coverage. [#39961]
8
+
9
+ ### Changed
10
+ - Skip pricing page when connecting via block editor. [#39865]
11
+
5
12
  ## [0.35.14] - 2024-10-15
6
13
  ### Changed
7
14
  - Update dependencies.
@@ -875,6 +882,7 @@
875
882
  - `Main` and `ConnectUser` components added.
876
883
  - `JetpackRestApiClient` API client added.
877
884
 
885
+ [0.35.15]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.14...v0.35.15
878
886
  [0.35.14]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.13...v0.35.14
879
887
  [0.35.13]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.12...v0.35.13
880
888
  [0.35.12]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.11...v0.35.12
@@ -30,6 +30,8 @@ export type Props = {
30
30
  assetBaseUrl?: string;
31
31
  // Whether to not require a user connection and just redirect after site connection
32
32
  skipUserConnection?: boolean;
33
+ // Whether to skip the pricing page after the connection screen
34
+ skipPricingPage?: boolean;
33
35
  // Additional page elements to show after the call to action
34
36
  footer?: React.ReactNode;
35
37
  // The logo to display at the top of the component
@@ -54,6 +56,7 @@ const ConnectScreen: React.FC< Props > = ( {
54
56
  autoTrigger,
55
57
  footer,
56
58
  skipUserConnection,
59
+ skipPricingPage,
57
60
  logo,
58
61
  } ) => {
59
62
  const {
@@ -70,6 +73,7 @@ const ConnectScreen: React.FC< Props > = ( {
70
73
  autoTrigger,
71
74
  from,
72
75
  skipUserConnection,
76
+ skipPricingPage,
73
77
  } );
74
78
 
75
79
  const displayButtonError = Boolean( registrationError );
@@ -14,6 +14,7 @@ export default ( {
14
14
  autoTrigger,
15
15
  from,
16
16
  skipUserConnection,
17
+ skipPricingPage,
17
18
  } = {} ) => {
18
19
  const { registerSite, connectUser, refreshConnectedPlugins } = useDispatch( STORE_ID );
19
20
 
@@ -45,7 +46,7 @@ export default ( {
45
46
  */
46
47
  const handleConnectUser = () => {
47
48
  if ( ! skipUserConnection ) {
48
- return connectUser( { from, redirectUri } );
49
+ return connectUser( { from, redirectUri, skipPricingPage } );
49
50
  } else if ( redirectUri ) {
50
51
  window.location = redirectUri;
51
52
  return Promise.resolve( redirectUri );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-connection",
3
- "version": "0.35.14",
3
+ "version": "0.35.15",
4
4
  "description": "Jetpack Connection Component",
5
5
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/connection/#readme",
6
6
  "bugs": {
@@ -14,11 +14,11 @@
14
14
  "author": "Automattic",
15
15
  "license": "GPL-2.0-or-later",
16
16
  "dependencies": {
17
- "@automattic/jetpack-analytics": "^0.1.31",
18
- "@automattic/jetpack-api": "^0.17.15",
19
- "@automattic/jetpack-components": "^0.58.0",
20
- "@automattic/jetpack-config": "^0.1.25",
21
- "@automattic/jetpack-script-data": "^0.1.2",
17
+ "@automattic/jetpack-analytics": "^0.1.32",
18
+ "@automattic/jetpack-api": "^0.17.16",
19
+ "@automattic/jetpack-components": "^0.58.1",
20
+ "@automattic/jetpack-config": "^0.1.26",
21
+ "@automattic/jetpack-script-data": "^0.1.3",
22
22
  "@wordpress/base-styles": "5.9.0",
23
23
  "@wordpress/browserslist-config": "6.9.0",
24
24
  "@wordpress/components": "28.9.0",
@@ -59,6 +59,7 @@
59
59
  "*.scss"
60
60
  ],
61
61
  "scripts": {
62
- "test": "NODE_OPTIONS=--experimental-vm-modules jest"
62
+ "test": "NODE_OPTIONS=--experimental-vm-modules jest",
63
+ "test-coverage": "pnpm run test --coverage"
63
64
  }
64
65
  }
package/state/actions.jsx CHANGED
@@ -72,15 +72,16 @@ const setIsOfflineMode = isOfflineMode => {
72
72
  /**
73
73
  * Connect site with wp.com user
74
74
  *
75
- * @param {object} Object - contains from and redirectFunc
76
- * @param {string} Object.from - Value that represents the redirect origin
77
- * @param {Function} Object.redirectFunc - A function to handle the redirect, defaults to location.assign
78
- * @param {string} [Object.redirectUri] - A URI that the user will be redirected to
75
+ * @param {object} Object - contains from and redirectFunc
76
+ * @param {string} Object.from - Value that represents the redirect origin
77
+ * @param {Function} Object.redirectFunc - A function to handle the redirect, defaults to location.assign
78
+ * @param {string} [Object.redirectUri] - A URI that the user will be redirected to
79
+ * @param {boolean} [Object.skipPricingPage] - A flag to skip the pricing page in the connection flow
79
80
  * @yield {object} Action object that will be yielded
80
81
  */
81
- function* connectUser( { from, redirectFunc, redirectUri } = {} ) {
82
+ function* connectUser( { from, redirectFunc, redirectUri, skipPricingPage } = {} ) {
82
83
  yield setUserIsConnecting( true );
83
- yield { type: CONNECT_USER, from, redirectFunc, redirectUri };
84
+ yield { type: CONNECT_USER, from, redirectFunc, redirectUri, skipPricingPage };
84
85
  }
85
86
 
86
87
  /**
@@ -7,7 +7,7 @@ const REGISTER_SITE = ( { registrationNonce, redirectUri, from } ) =>
7
7
 
8
8
  const CONNECT_USER = createRegistryControl(
9
9
  ( { resolveSelect } ) =>
10
- ( { from, redirectFunc, redirectUri } = {} ) => {
10
+ ( { from, redirectFunc, redirectUri, skipPricingPage } = {} ) => {
11
11
  return new Promise( ( resolve, reject ) => {
12
12
  resolveSelect( STORE_ID )
13
13
  .getAuthorizationUrl( redirectUri )
@@ -16,6 +16,10 @@ const CONNECT_USER = createRegistryControl(
16
16
 
17
17
  const url = new URL( authorizationUrl );
18
18
 
19
+ if ( skipPricingPage ) {
20
+ url.searchParams.set( 'skip_pricing', 'true' );
21
+ }
22
+
19
23
  if ( from ) {
20
24
  url.searchParams.set( 'from', encodeURIComponent( from ) );
21
25
  }