@automattic/jetpack-connection 0.39.7 → 0.39.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
@@ -2,6 +2,10 @@
2
2
 
3
3
  ### This is a list detailing changes for the Jetpack RNA Connection Component releases.
4
4
 
5
+ ## [0.39.8] - 2025-04-01
6
+ ### Fixed
7
+ - Fix Typescript configuration [#42762]
8
+
5
9
  ## [0.39.7] - 2025-03-31
6
10
  ### Changed
7
11
  - Update dependencies.
@@ -984,6 +988,7 @@
984
988
  - `Main` and `ConnectUser` components added.
985
989
  - `JetpackRestApiClient` API client added.
986
990
 
991
+ [0.39.8]: https://github.com/Automattic/jetpack-connection-js/compare/v0.39.7...v0.39.8
987
992
  [0.39.7]: https://github.com/Automattic/jetpack-connection-js/compare/v0.39.6...v0.39.7
988
993
  [0.39.6]: https://github.com/Automattic/jetpack-connection-js/compare/v0.39.5...v0.39.6
989
994
  [0.39.5]: https://github.com/Automattic/jetpack-connection-js/compare/v0.39.4...v0.39.5
@@ -6,7 +6,21 @@ import { STORE_ID } from '../../state/store';
6
6
 
7
7
  const initialState = window?.JP_CONNECTION_INITIAL_STATE || getScriptData()?.connection || {};
8
8
 
9
- export default ( {
9
+ /**
10
+ * Hook to handle the connection process.
11
+ *
12
+ * @param {object} [props] - The props.
13
+ * @param {string} [props.registrationNonce] - The registration nonce.
14
+ * @param {string} [props.apiRoot] - The API root URL.
15
+ * @param {string} [props.apiNonce] - The API nonce.
16
+ * @param {string} [props.redirectUri] - The redirect URI.
17
+ * @param {boolean} [props.autoTrigger] - Whether to auto-trigger the connection process.
18
+ * @param {string} [props.from] - Value that represents the redirect origin.
19
+ * @param {boolean} [props.skipUserConnection] - Whether to skip user connection.
20
+ * @param {boolean} [props.skipPricingPage] - Whether to skip the pricing page.
21
+ * @return {object} The connection state and handlers.
22
+ */
23
+ export default function useConnection( {
10
24
  registrationNonce = initialState.registrationNonce,
11
25
  apiRoot = initialState.apiRoot,
12
26
  apiNonce = initialState.apiNonce,
@@ -15,7 +29,7 @@ export default ( {
15
29
  from,
16
30
  skipUserConnection,
17
31
  skipPricingPage,
18
- } = {} ) => {
32
+ } = {} ) {
19
33
  const { registerSite, connectUser, refreshConnectedPlugins } = useDispatch( STORE_ID );
20
34
 
21
35
  const registrationError = useSelect( select => select( STORE_ID ).getRegistrationError() );
@@ -111,4 +125,4 @@ export default ( {
111
125
  connectionErrors,
112
126
  isOfflineMode,
113
127
  };
114
- };
128
+ }
@@ -0,0 +1,8 @@
1
+ import { ConnectionScriptData } from './types';
2
+
3
+ // Use module augmentation to add the social property to JetpackInitialState
4
+ declare module '@automattic/jetpack-script-data' {
5
+ interface JetpackScriptData {
6
+ connection: ConnectionScriptData;
7
+ }
8
+ }
package/index.jsx CHANGED
@@ -14,6 +14,9 @@ along with this program; if not, write to the Free Software
14
14
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15
15
  */
16
16
 
17
+ // Ensure that module augmentation is applied
18
+ export {} from './declarations.d.ts';
19
+
17
20
  /**
18
21
  * Components.
19
22
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-connection",
3
- "version": "0.39.7",
3
+ "version": "0.39.8",
4
4
  "description": "Jetpack Connection Component",
5
5
  "homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/connection/#readme",
6
6
  "bugs": {
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@automattic/jetpack-analytics": "^0.1.36",
18
18
  "@automattic/jetpack-api": "^0.20.0",
19
- "@automattic/jetpack-components": "^0.72.0",
19
+ "@automattic/jetpack-components": "^0.72.1",
20
20
  "@automattic/jetpack-config": "^0.1.29",
21
21
  "@automattic/jetpack-script-data": "^0.3.0",
22
22
  "@wordpress/base-styles": "5.19.0",
package/types.ts ADDED
@@ -0,0 +1,3 @@
1
+ export type ConnectionScriptData = {
2
+ calypsoEnv: string;
3
+ };