@automattic/jetpack-connection 0.35.2 → 0.35.3

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.35.3] - 2024-08-21
6
+ ### Changed
7
+ - Internal updates.
8
+
5
9
  ## [0.35.2] - 2024-08-19
6
10
  ### Changed
7
11
  - Updated package dependencies. [#38893]
@@ -827,6 +831,7 @@
827
831
  - `Main` and `ConnectUser` components added.
828
832
  - `JetpackRestApiClient` API client added.
829
833
 
834
+ [0.35.3]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.2...v0.35.3
830
835
  [0.35.2]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.1...v0.35.2
831
836
  [0.35.1]: https://github.com/Automattic/jetpack-connection-js/compare/v0.35.0...v0.35.1
832
837
  [0.35.0]: https://github.com/Automattic/jetpack-connection-js/compare/v0.34.2...v0.35.0
@@ -8,7 +8,7 @@ import useConnection from '../use-connection';
8
8
  * The RNA connection component.
9
9
  *
10
10
  * @param {object} props -- The properties.
11
- * @returns {React.Component} The RNA connection component.
11
+ * @return {React.Component} The RNA connection component.
12
12
  */
13
13
  const ConnectButton = props => {
14
14
  const {
@@ -9,7 +9,7 @@ import ConnectScreenRequiredPlanVisual from './visual';
9
9
  * The Connection Screen Visual component for consumers that require a Plan.
10
10
  *
11
11
  * @param {object} props -- The properties.
12
- * @returns {React.Component} The `ConnectScreenForRequiredPlan` component.
12
+ * @return {React.Component} The `ConnectScreenForRequiredPlan` component.
13
13
  */
14
14
  const ConnectScreenRequiredPlan = props => {
15
15
  const {
@@ -19,7 +19,7 @@ const debug = debugFactory( 'jetpack:connection:ConnectScreenRequiredPlanVisual'
19
19
  * The Connection Screen Visual component for consumers that require a Plan.
20
20
  *
21
21
  * @param {object} props -- The properties.
22
- * @returns {React.Component} The `ConnectScreenRequiredPlanVisual` component.
22
+ * @return {React.Component} The `ConnectScreenRequiredPlanVisual` component.
23
23
  */
24
24
  const ConnectScreenRequiredPlanVisual = props => {
25
25
  const {
@@ -5,12 +5,12 @@ import { useState, useEffect } from 'react';
5
5
  /**
6
6
  * The user connection component.
7
7
  *
8
- * @param {object} props -- The properties.
8
+ * @param {object} props -- The properties.
9
9
  * @param {Function} props.redirectFunc -- The redirect function (`window.location.assign()` by default).
10
- * @param {string} props.connectUrl -- The authorization URL (no-iframe).
11
- * @param {string} props.redirectUri -- The redirect admin URI.
12
- * @param {string} props.from -- Where the connection request is coming from.
13
- * @returns {null} -- Nothing to return.
10
+ * @param {string} props.connectUrl -- The authorization URL (no-iframe).
11
+ * @param {string} props.redirectUri -- The redirect admin URI.
12
+ * @param {string} props.from -- Where the connection request is coming from.
13
+ * @return {null} -- Nothing to return.
14
14
  */
15
15
  const ConnectUser = props => {
16
16
  const {
@@ -7,7 +7,7 @@ import DisconnectCard from '../disconnect-card';
7
7
  * Render a list of connected plugins.
8
8
  *
9
9
  * @param {object} props - The properties
10
- * @returns {React.Component} - The ConnectedPlugins React component
10
+ * @return {React.Component} - The ConnectedPlugins React component
11
11
  */
12
12
 
13
13
  const ConnectedPlugins = props => {
@@ -9,7 +9,7 @@ import styles from './styles.module.scss';
9
9
  * The RNA Connection Error Notice component.
10
10
  *
11
11
  * @param {object} props -- The properties.
12
- * @returns {React.Component} The `ConnectionErrorNotice` component.
12
+ * @return {React.Component} The `ConnectionErrorNotice` component.
13
13
  */
14
14
  const ConnectionErrorNotice = props => {
15
15
  const { message, isRestoringConnection, restoreConnectionCallback, restoreConnectionError } =
@@ -8,7 +8,7 @@ import './style.scss';
8
8
  * Used in the disconnection flow.
9
9
  *
10
10
  * @param {object} props - The Properties.
11
- * @returns {React.Component} DisconnectCard - The disconnect card component.
11
+ * @return {React.Component} DisconnectCard - The disconnect card component.
12
12
  */
13
13
  const DisconnectCard = props => {
14
14
  const { title, value, description } = props;
@@ -15,7 +15,7 @@ import StepThankYou from './steps/step-thank-you';
15
15
  * The RNA Disconnect Dialog component.
16
16
  *
17
17
  * @param {object} props -- The properties.
18
- * @returns {React.Component} The `DisconnectDialog` component.
18
+ * @return {React.Component} The `DisconnectDialog` component.
19
19
  */
20
20
  const DisconnectDialog = props => {
21
21
  const [ isDisconnecting, setIsDisconnecting ] = useState( false );
@@ -302,7 +302,7 @@ const DisconnectDialog = props => {
302
302
  /**
303
303
  * Determine what step to show based on the current state
304
304
  *
305
- * @returns { React.Component|undefined } - component for current step
305
+ * @return { React.Component|undefined } - component for current step
306
306
  */
307
307
  const getCurrentStep = () => {
308
308
  if ( ! isDisconnected ) {
@@ -11,7 +11,7 @@ import disconnectImage from '../images/disconnect-confirm.jpg';
11
11
  * Will only show option to provide feedback if the canProvideFeedback prop is true.
12
12
  *
13
13
  * @param {object} props - The properties.
14
- * @returns {React.Component} - StepDisconnectConfirm Component
14
+ * @return {React.Component} - StepDisconnectConfirm Component
15
15
  */
16
16
  const StepDisconnectConfirm = props => {
17
17
  const { onExit, canProvideFeedback, onProvideFeedback } = props;
@@ -10,7 +10,7 @@ import ConnectedPlugins from '../../connected-plugins';
10
10
  * Disconnect step in disconnection flow.
11
11
  *
12
12
  * @param {object} props - The properties.
13
- * @returns {React.Component} - The StepDisconnect component
13
+ * @return {React.Component} - The StepDisconnect component
14
14
  */
15
15
  const StepDisconnect = props => {
16
16
  const {
@@ -66,7 +66,7 @@ const StepDisconnect = props => {
66
66
  /**
67
67
  * Render the disconnect button, allows for some variance based on context.
68
68
  *
69
- * @returns {React.Component} - Button used for disconnect.
69
+ * @return {React.Component} - Button used for disconnect.
70
70
  */
71
71
  const renderDisconnectButton = () => {
72
72
  let buttonText = __( 'Disconnect', 'jetpack' );
@@ -93,7 +93,7 @@ const StepDisconnect = props => {
93
93
  * Show some fallback output if there are no connected plugins to show and no passed disconnect component.
94
94
  * This is a more generic message about disconnecting Jetpack.
95
95
  *
96
- * @returns {React.ElementType|undefined} - Fallback message for when there are no connected plugins or passed components to show.
96
+ * @return {React.ElementType|undefined} - Fallback message for when there are no connected plugins or passed components to show.
97
97
  */
98
98
  const renderFallbackOutput = () => {
99
99
  const hasOtherConnectedPlugins =
@@ -10,7 +10,7 @@ import DisconnectSurvey from '../../disconnect-survey';
10
10
  * Show the survey step and allow the user to select a response.
11
11
  *
12
12
  * @param {object} props - The properties.
13
- * @returns {React.Component} The StepSurvey Component
13
+ * @return {React.Component} The StepSurvey Component
14
14
  */
15
15
  const StepSurvey = props => {
16
16
  const { onExit, onFeedBackProvided, isSubmittingFeedback } = props;
@@ -10,7 +10,7 @@ import disconnectImage from '../images/disconnect-thanks.jpg';
10
10
  * Show the "thank you" step following survey submission
11
11
  *
12
12
  * @param {object} props - The properties.
13
- * @returns {React.Component} - The StepThankYou Component
13
+ * @return {React.Component} - The StepThankYou Component
14
14
  */
15
15
  const StepThankYou = props => {
16
16
  const { onExit } = props;
@@ -8,7 +8,7 @@ import SurveyChoice from './survey-choice';
8
8
  * Handles showing the disconnect survey.
9
9
  *
10
10
  * @param {object} props - The component props.
11
- * @returns {React.Component} - DisconnectSurvey component.
11
+ * @return {React.Component} - DisconnectSurvey component.
12
12
  */
13
13
  const DisconnectSurvey = props => {
14
14
  const { onSubmit, isSubmittingFeedback } = props;
@@ -68,8 +68,8 @@ const DisconnectSurvey = props => {
68
68
  /**
69
69
  * Checks to see if an option is the currently selected option, returns a css class name if it matches.
70
70
  *
71
- * @param {string} optionId - ID of the option to check for.
72
- * @returns {string} - The "selected" class if this option is currently selected.
71
+ * @param {string} optionId - ID of the option to check for.
72
+ * @return {string} - The "selected" class if this option is currently selected.
73
73
  */
74
74
  const selectedClass = optionId => {
75
75
  if ( optionId === selectedAnswer ) {
@@ -83,7 +83,7 @@ const DisconnectSurvey = props => {
83
83
  * Event handler for keyboard events on the answer blocks.
84
84
  *
85
85
  * @param {string} answerId - The slug of the answer that has been selected.
86
- * @param {object} e - Keydown event.
86
+ * @param {object} e - Keydown event.
87
87
  */
88
88
  const handleAnswerKeyDown = useCallback(
89
89
  ( answerId, e ) => {
@@ -102,7 +102,7 @@ const DisconnectSurvey = props => {
102
102
  /**
103
103
  * Show all the survey options from the options array.
104
104
  *
105
- * @returns {React.ElementType []} - Mapped array of rendered survey options.
105
+ * @return {React.ElementType []} - Mapped array of rendered survey options.
106
106
  */
107
107
  const renderOptions = () => {
108
108
  return options.map( option => {
@@ -123,7 +123,7 @@ const DisconnectSurvey = props => {
123
123
  * Show the custom input survey option.
124
124
  * Contains an input field for a custom response.
125
125
  *
126
- * @returns {React.ElementType} - The custom survey option with an input field.
126
+ * @return {React.ElementType} - The custom survey option with an input field.
127
127
  */
128
128
  const renderCustomOption = () => {
129
129
  return (
@@ -5,12 +5,12 @@ import './_jp-connect_disconnect-survey-card.scss';
5
5
  /**
6
6
  * SurveyChoice - Present one choice in the survey.
7
7
  *
8
- * @param {string} props.id - The ID/slug string of the survey option
9
- * @param {Function} props.onClick - Event handler for clicking on the survey option.
10
- * @param {Function} props.onKeydown - Event handler for pressing a key on the survey option.
11
- * @param {React.ElementType} props.children - Any passed elements as children to this component.
12
- * @param {string} props.className - A class name to apply to the survey choice.
13
- * @returns {React.Component} SurveyChoice - The SurveyChoice component.
8
+ * @param {string} props.id - The ID/slug string of the survey option
9
+ * @param {Function} props.onClick - Event handler for clicking on the survey option.
10
+ * @param {Function} props.onKeydown - Event handler for pressing a key on the survey option.
11
+ * @param {React.ElementType} props.children - Any passed elements as children to this component.
12
+ * @param {string} props.className - A class name to apply to the survey choice.
13
+ * @return {React.Component} SurveyChoice - The SurveyChoice component.
14
14
  */
15
15
 
16
16
  const SurveyChoice = props => {
@@ -7,18 +7,18 @@ import './style.scss';
7
7
  /**
8
8
  * The in-place connection component.
9
9
  *
10
- * @param {object} props -- The properties.
11
- * @param {string} props.title -- Element title.
12
- * @param {boolean} props.isLoading -- Whether the element is still loading.
13
- * @param {string|number} props.width -- Iframe width.
14
- * @param {string|number} props.height -- Iframe height.
15
- * @param {boolean} props.displayTOS -- Whether the site has connection owner connected.
16
- * @param {boolean} props.scrollToIframe -- Whether we need to auto-scroll the window upon element rendering.
17
- * @param {string} props.connectUrl -- The connection URL.
18
- * @param {Function} props.onComplete -- The callback to be called upon complete of the connection process.
19
- * @param {Function} props.onThirdPartyCookiesBlocked -- The callback to be called if third-party cookies are disabled.
20
- * @param {string} props.location -- Component location identifier passed to WP.com.
21
- * @returns {React.Component} The in-place connection component.
10
+ * @param {object} props -- The properties.
11
+ * @param {string} props.title -- Element title.
12
+ * @param {boolean} props.isLoading -- Whether the element is still loading.
13
+ * @param {string|number} props.width -- Iframe width.
14
+ * @param {string|number} props.height -- Iframe height.
15
+ * @param {boolean} props.displayTOS -- Whether the site has connection owner connected.
16
+ * @param {boolean} props.scrollToIframe -- Whether we need to auto-scroll the window upon element rendering.
17
+ * @param {string} props.connectUrl -- The connection URL.
18
+ * @param {Function} props.onComplete -- The callback to be called upon complete of the connection process.
19
+ * @param {Function} props.onThirdPartyCookiesBlocked -- The callback to be called if third-party cookies are disabled.
20
+ * @param {string} props.location -- Component location identifier passed to WP.com.
21
+ * @return {React.Component} The in-place connection component.
22
22
  */
23
23
  const InPlaceConnection = props => {
24
24
  const {
@@ -19,7 +19,7 @@ import './style.scss';
19
19
  * The RNA Manage Connection Dialog component.
20
20
  *
21
21
  * @param {object} props -- The properties.
22
- * @returns {React.JSX} The `ManageConnectionDialog` component.
22
+ * @return {React.JSX} The `ManageConnectionDialog` component.
23
23
  */
24
24
  const ManageConnectionDialog = props => {
25
25
  const {
@@ -41,7 +41,7 @@ export default ( {
41
41
  /**
42
42
  * User register process handler.
43
43
  *
44
- * @returns {Promise} - Promise which resolves when the product status is activated.
44
+ * @return {Promise} - Promise which resolves when the product status is activated.
45
45
  */
46
46
  const handleConnectUser = () => {
47
47
  if ( ! skipUserConnection ) {
@@ -64,7 +64,7 @@ export default ( {
64
64
  * the site was successfully registered.
65
65
  *
66
66
  * @param {Event} [e] - Event that dispatched handleRegisterSite
67
- * @returns {Promise} Promise when running the registration process. Otherwise, nothing.
67
+ * @return {Promise} Promise when running the registration process. Otherwise, nothing.
68
68
  */
69
69
  const handleRegisterSite = e => {
70
70
  e && e.preventDefault();
@@ -3,7 +3,7 @@ import { getScriptData } from '@automattic/jetpack-script-data';
3
3
  /**
4
4
  * Get the Calypso origin based on the development environment.
5
5
  *
6
- * @returns {string} The Calypso url origin.
6
+ * @return {string} The Calypso url origin.
7
7
  */
8
8
  export default function getCalypsoOrigin() {
9
9
  const calypsoEnv = (
@@ -7,7 +7,7 @@ import useRestoreConnection from '../../hooks/use-restore-connection/index.jsx';
7
7
  * Returns a ConnectionErrorNotice component and the conditional flag on whether
8
8
  * to render the component or not.
9
9
  *
10
- * @returns {object} - The hook data.
10
+ * @return {object} - The hook data.
11
11
  */
12
12
  export default function useConnectionErrorNotice() {
13
13
  const { connectionErrors } = useConnection( {} );
@@ -22,17 +22,17 @@ const defaultAdminUrl =
22
22
  * Custom hook that performs the needed steps
23
23
  * to concrete the checkout workflow.
24
24
  *
25
- * @param {object} props - The props passed to the hook.
26
- * @param {string} props.productSlug - The WordPress product slug.
27
- * @param {string} props.redirectUrl - The URI to redirect to after checkout.
28
- * @param {string} [props.siteSuffix] - The site suffix.
29
- * @param {string} [props.adminUrl] - The site wp-admin url.
30
- * @param {boolean} props.connectAfterCheckout - Whether or not to conect after checkout if not connected (default false - connect before).
25
+ * @param {object} props - The props passed to the hook.
26
+ * @param {string} props.productSlug - The WordPress product slug.
27
+ * @param {string} props.redirectUrl - The URI to redirect to after checkout.
28
+ * @param {string} [props.siteSuffix] - The site suffix.
29
+ * @param {string} [props.adminUrl] - The site wp-admin url.
30
+ * @param {boolean} props.connectAfterCheckout - Whether or not to conect after checkout if not connected (default false - connect before).
31
31
  * @param {Function} props.siteProductAvailabilityHandler - The function used to check whether the site already has the requested product. This will be checked after registration and the checkout page will be skipped if the promise returned resloves true.
32
32
  * @param {Function} props.from - The plugin slug initiated the flow.
33
- * @param {number} [props.quantity] - The quantity of the product to purchase.
34
- * @param {boolean} [props.useBlogIdSuffix] - Use blog ID instead of site suffix in the checkout URL.
35
- * @returns {Function} The useEffect hook.
33
+ * @param {number} [props.quantity] - The quantity of the product to purchase.
34
+ * @param {boolean} [props.useBlogIdSuffix] - Use blog ID instead of site suffix in the checkout URL.
35
+ * @return {Function} The useEffect hook.
36
36
  */
37
37
  export default function useProductCheckoutWorkflow( {
38
38
  productSlug,
@@ -152,9 +152,9 @@ export default function useProductCheckoutWorkflow( {
152
152
  /**
153
153
  * Handler to run the checkout workflow.
154
154
  *
155
- * @param {Event} [event] - Event that dispatched run
155
+ * @param {Event} [event] - Event that dispatched run
156
156
  * @param {string} redirect - A possible redirect URL to go to after the checkout
157
- * @returns {void} Nothing.
157
+ * @return {void} Nothing.
158
158
  */
159
159
  const run = ( event, redirect = null ) => {
160
160
  event && event.preventDefault();
@@ -11,7 +11,7 @@ const { apiRoot, apiNonce } =
11
11
  * Restore connection hook.
12
12
  * It will initiate an API request attempting to restore the connection, or reconnect if it cannot be restored.
13
13
  *
14
- * @returns {object} - The hook data.
14
+ * @return {object} - The hook data.
15
15
  */
16
16
  export default function useRestoreConnection() {
17
17
  const [ isRestoringConnection, setIsRestoringConnection ] = useState( false );
@@ -25,7 +25,7 @@ export default function useRestoreConnection() {
25
25
  * Initiate connection restore.
26
26
  *
27
27
  * @param {boolean} autoReconnectUser - If user connection needs to be reestablished, automatically initiate the flow.
28
- * @returns {Promise<object>} - The API request promise.
28
+ * @return {Promise<object>} - The API request promise.
29
29
  */
30
30
  const restoreConnection = ( autoReconnectUser = true ) => {
31
31
  setIsRestoringConnection( true );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-connection",
3
- "version": "0.35.2",
3
+ "version": "0.35.3",
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.29",
18
- "@automattic/jetpack-api": "^0.17.10",
19
- "@automattic/jetpack-components": "^0.55.8",
17
+ "@automattic/jetpack-analytics": "^0.1.30",
18
+ "@automattic/jetpack-api": "^0.17.11",
19
+ "@automattic/jetpack-components": "^0.55.9",
20
20
  "@automattic/jetpack-config": "^0.1.24",
21
- "@automattic/jetpack-script-data": "^0.1.1",
21
+ "@automattic/jetpack-script-data": "^0.1.2",
22
22
  "@wordpress/base-styles": "5.5.0",
23
23
  "@wordpress/browserslist-config": "6.5.0",
24
24
  "@wordpress/components": "28.5.0",
package/state/actions.jsx CHANGED
@@ -72,11 +72,11 @@ 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
79
- * @yields {object} Action object that will be yielded
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
+ * @yield {object} Action object that will be yielded
80
80
  */
81
81
  function* connectUser( { from, redirectFunc, redirectUri } = {} ) {
82
82
  yield setUserIsConnecting( true );
@@ -87,12 +87,12 @@ function* connectUser( { from, redirectFunc, redirectUri } = {} ) {
87
87
  *
88
88
  * Register an site into jetpack
89
89
  *
90
- * @param {object} Object - contains registrationNonce and redirectUri
90
+ * @param {object} Object - contains registrationNonce and redirectUri
91
91
  * @param {string} Object.registrationNonce - Registration nonce
92
- * @param {string} Object.redirectUri - URI that user will be redirected
93
- * @param {string} [Object.from] - Value that represents the origin of the request (optional)
94
- * @yields {object} Action object that will be yielded
95
- * @returns {Promise} Resolved or rejected value of registerSite
92
+ * @param {string} Object.redirectUri - URI that user will be redirected
93
+ * @param {string} [Object.from] - Value that represents the origin of the request (optional)
94
+ * @yield {object} Action object that will be yielded
95
+ * @return {Promise} Resolved or rejected value of registerSite
96
96
  */
97
97
  function* registerSite( { registrationNonce, redirectUri, from = '' } ) {
98
98
  yield clearRegistrationError();
@@ -114,7 +114,7 @@ function* registerSite( { registrationNonce, redirectUri, from = '' } ) {
114
114
  /**
115
115
  * Side effect action which will fetch a new list of connectedPlugins from the server
116
116
  *
117
- * @returns {Promise} - Promise which resolves when the product status is activated.
117
+ * @return {Promise} - Promise which resolves when the product status is activated.
118
118
  */
119
119
  const refreshConnectedPlugins =
120
120
  () =>
@@ -12,7 +12,7 @@ const connectionSelectors = {
12
12
  * Checks whether the store is fetching the connection status from the server
13
13
  *
14
14
  * @deprecated since 0.14.0
15
- * @returns {boolean} Is the store is fetching the connection status from the server?
15
+ * @return {boolean} Is the store is fetching the connection status from the server?
16
16
  */
17
17
  getConnectionStatusIsFetching: () => false,
18
18
  getSiteIsRegistering: state => state.siteIsRegistering || false,