@automattic/jetpack-connection 0.32.4 → 0.33.0
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.33.0] - 2024-03-01
|
|
6
|
+
### Changed
|
|
7
|
+
- allow post-checkout URL to be updated as run-time [#35908]
|
|
8
|
+
|
|
5
9
|
## [0.32.4] - 2024-02-27
|
|
6
10
|
### Changed
|
|
7
11
|
- Update dependencies.
|
|
@@ -714,6 +718,7 @@
|
|
|
714
718
|
- `Main` and `ConnectUser` components added.
|
|
715
719
|
- `JetpackRestApiClient` API client added.
|
|
716
720
|
|
|
721
|
+
[0.33.0]: https://github.com/Automattic/jetpack-connection-js/compare/v0.32.4...v0.33.0
|
|
717
722
|
[0.32.4]: https://github.com/Automattic/jetpack-connection-js/compare/v0.32.3...v0.32.4
|
|
718
723
|
[0.32.3]: https://github.com/Automattic/jetpack-connection-js/compare/v0.32.2...v0.32.3
|
|
719
724
|
[0.32.2]: https://github.com/Automattic/jetpack-connection-js/compare/v0.32.1...v0.32.2
|
|
@@ -118,10 +118,14 @@ export default function useProductCheckoutWorkflow( {
|
|
|
118
118
|
debug( 'connectAfterCheckout is %s', connectAfterCheckout );
|
|
119
119
|
debug( 'checkoutUrl is %s', checkoutUrl );
|
|
120
120
|
|
|
121
|
-
const handleAfterRegistration = () => {
|
|
121
|
+
const handleAfterRegistration = ( redirect = null ) => {
|
|
122
122
|
return Promise.resolve(
|
|
123
123
|
siteProductAvailabilityHandler && siteProductAvailabilityHandler()
|
|
124
124
|
).then( siteHasWpcomProduct => {
|
|
125
|
+
if ( redirect ) {
|
|
126
|
+
checkoutUrl.searchParams.set( 'redirect_to', redirect );
|
|
127
|
+
}
|
|
128
|
+
|
|
125
129
|
if ( siteHasWpcomProduct ) {
|
|
126
130
|
debug( 'handleAfterRegistration: Site has a product associated' );
|
|
127
131
|
return handleConnectUser();
|
|
@@ -134,7 +138,11 @@ export default function useProductCheckoutWorkflow( {
|
|
|
134
138
|
} );
|
|
135
139
|
};
|
|
136
140
|
|
|
137
|
-
const connectAfterCheckoutFlow = () => {
|
|
141
|
+
const connectAfterCheckoutFlow = ( redirect = null ) => {
|
|
142
|
+
if ( redirect ) {
|
|
143
|
+
checkoutUrl.searchParams.set( 'redirect_to', redirect );
|
|
144
|
+
}
|
|
145
|
+
|
|
138
146
|
debug( 'Redirecting to connectAfterCheckout flow: %s', checkoutUrl );
|
|
139
147
|
|
|
140
148
|
window.location.href = checkoutUrl;
|
|
@@ -144,19 +152,20 @@ export default function useProductCheckoutWorkflow( {
|
|
|
144
152
|
* Handler to run the checkout workflow.
|
|
145
153
|
*
|
|
146
154
|
* @param {Event} [event] - Event that dispatched run
|
|
155
|
+
* @param {string} redirect - A possible redirect URL to go to after the checkout
|
|
147
156
|
* @returns {void} Nothing.
|
|
148
157
|
*/
|
|
149
|
-
const run = event => {
|
|
158
|
+
const run = ( event, redirect = null ) => {
|
|
150
159
|
event && event.preventDefault();
|
|
151
160
|
setCheckoutStarted( true );
|
|
152
161
|
// By default we will connect first prior to checkout unless `props.connectAfterCheckout`
|
|
153
162
|
// is set (true), in which we will connect after purchase is completed.
|
|
154
163
|
if ( connectAfterCheckout ) {
|
|
155
|
-
return connectAfterCheckoutFlow();
|
|
164
|
+
return connectAfterCheckoutFlow( redirect );
|
|
156
165
|
}
|
|
157
166
|
|
|
158
167
|
if ( isRegistered ) {
|
|
159
|
-
return handleAfterRegistration();
|
|
168
|
+
return handleAfterRegistration( redirect );
|
|
160
169
|
}
|
|
161
170
|
|
|
162
171
|
registerSite( { registrationNonce, redirectUri: redirectUrl } ).then( handleAfterRegistration );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/jetpack-connection",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "Jetpack Connection Component",
|
|
5
5
|
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/js-packages/connection/#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"license": "GPL-2.0-or-later",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@automattic/jetpack-analytics": "^0.1.29",
|
|
18
|
-
"@automattic/jetpack-api": "^0.
|
|
19
|
-
"@automattic/jetpack-components": "^0.49.
|
|
18
|
+
"@automattic/jetpack-api": "^0.17.0",
|
|
19
|
+
"@automattic/jetpack-components": "^0.49.1",
|
|
20
20
|
"@automattic/jetpack-config": "^0.1.24",
|
|
21
21
|
"@wordpress/base-styles": "4.42.0",
|
|
22
22
|
"@wordpress/browserslist-config": "5.34.0",
|