File tree 1 file changed +15
-5
lines changed
1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ import {
42
42
getSDKAttribute ,
43
43
getJsSdkLibrary ,
44
44
wasShopperInsightsUsed ,
45
+ isPayPalTrustedUrl ,
45
46
} from "@paypal/sdk-client/src" ;
46
47
import {
47
48
rememberFunding ,
@@ -292,15 +293,24 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
292
293
} ,
293
294
294
295
props : {
295
- // App Switch Properties
296
296
appSwitchWhenAvailable : {
297
- // this value is a string for now while we test the app switch
298
- // feature. Before we give this to a real merchant, we should
299
- // change this to a boolean - Shane 11 Dec 2024
300
- type : "string" ,
297
+ type : "boolean" ,
298
+ queryParam : true ,
301
299
required : false ,
302
300
} ,
303
301
302
+ redirect : {
303
+ type : "function" ,
304
+ sendToChild : true ,
305
+ value : ( ) => ( url ) => {
306
+ if ( isPayPalTrustedUrl ( url ) ) {
307
+ location . href = url ;
308
+ } else {
309
+ throw new Error ( `Unable to redirect to provided url ${ url } ` ) ;
310
+ }
311
+ } ,
312
+ } ,
313
+
304
314
hashChangeHandler : {
305
315
type : "function" ,
306
316
sendToChild : false ,
You can’t perform that action at this time.
0 commit comments