Skip to content

Commit

Permalink
Merge pull request #26 from mercadopago/feature/add-redirectMode-type
Browse files Browse the repository at this point in the history
Adding redirectMode support
  • Loading branch information
AdaltonLeite authored Apr 10, 2023
2 parents ae78b3d + 8de4486 commit dad4a16
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
19 changes: 19 additions & 0 deletions examples/bricks/WalletBrick/4-Redirect-Mode-Modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';

initMercadoPago('TEST-e06664f9-d9e8-4eb1-9648-978abae52d90');

const ExampleRedirectModeModalOnWalletBrick = () => {
return (
<Wallet
initialization={{
preferenceId: '239656545-89accc4d-3fc9-4835-828b-b8fa16b2fdce',
redirectMode: 'modal',
}}
/>
);
};

export default ExampleRedirectModeModalOnWalletBrick;
15 changes: 14 additions & 1 deletion src/bricks/wallet/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ export interface PreferenceOnSubmit extends IBrickSettings {
/**
* Optional. An object containing initialization options.
*/
initialization?: never;
initialization?: {
/**
* Optional. The opening scheme allows you to define how the checkout will open for the user. For example modal. Default 'self'
*
* @tutorial {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/wallet-brick/additional-customization/opening-mode#editor_2 Redirect Mode} documentation.
* */
redirectMode?: 'modal' | 'blank' | 'self';
};
/**
* Optional. An object containing customization options.
*/
Expand All @@ -100,6 +107,12 @@ export interface PreferenceOnInitialization extends IBrickSettings {
* @tutorial {@link https://www.mercadopago.com/developers/en/reference/preferences/_checkout_preferences/post Create preference} documentation.
* */
preferenceId: string;
/**
* Optional. The opening scheme allows you to define how the checkout will open for the user. For example modal. Default 'self'
*
* @tutorial {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/wallet-brick/additional-customization/opening-mode#editor_2 Redirect Mode} documentation.
* */
redirectMode?: 'modal' | 'blank' | 'self';
};
/**
* Optional. An object containing customization options.
Expand Down

0 comments on commit dad4a16

Please sign in to comment.