Skip to content

Commit

Permalink
Merge pull request #97 from andreagostinho-meli/main
Browse files Browse the repository at this point in the history
Feature: payment_methods_logos and actionComplement
  • Loading branch information
andreagostinho-meli authored Mar 28, 2024
2 parents 1a34a99 + 6e129f7 commit aa365aa
Show file tree
Hide file tree
Showing 9 changed files with 2,092 additions and 15,253 deletions.
17,241 changes: 2,041 additions & 15,200 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mercadopago/sdk-react",
"version": "0.0.18",
"version": "0.0.19",
"description": "Mercado Pago SDK React",
"main": "index.js",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions src/@types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ declare global {
/**
* Updates data in Payment Brick preserving the current instance.
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/additional-customization/update-data Payment Brick # Default rendering} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/advanced-features/update-data Payment Brick # Update data} documentation.
*/
update: (updateValues: UpdateValues) => boolean;
};
Expand All @@ -21,7 +21,7 @@ declare global {
/**
* Updates data in Card Payment Brick preserving the current instance.
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/update-data Payment Brick # Default rendering} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/update-data Payment Brick # Update data} documentation.
*/
update: (updateValues: UpdateValues) => boolean;
};
Expand Down
8 changes: 2 additions & 6 deletions src/bricks/brand/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,9 @@ import { TBrand } from './types';
* export default Example
* ```
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/brand-brick/introduction Brand Brick documentation} for more information.
* @see {@link https://www.mercadopago.com.ar/developers/en/docs/checkout-bricks/brand-brick/introduction Brand Brick documentation} for more information.
*/
const Brand = ({
onReady = onReadyDefault,
customization,
locale,
}: TBrand) => {
const Brand = ({ onReady = onReadyDefault, customization, locale }: TBrand) => {
useEffect(() => {
// Brand uses a debounce to prevent unnecessary reRenders.
let timer: ReturnType<typeof setTimeout>;
Expand Down
20 changes: 7 additions & 13 deletions src/bricks/brand/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,18 @@ type BrandBorderColor = 'dark' | 'light';
export interface IBrandPaymentMethodCustomization {
/**
* Optional. Specify the payment methods you don't want to show.
* ['master', 'visa', 'amex', 'naranja', 'maestro', 'cabal', 'cencosud', 'cordobesa', 'argencard', 'diners', 'tarshop', 'cmr', 'rapipago', 'pagofacil', 'mercadopago']
* ['master', 'visa', 'amex', 'naranja', 'maestro', 'cabal', 'cencosud', 'cordobesa', 'argencard', 'diners', 'tarshop', 'cmr', 'rapipago', 'pagofacil']
*
* @see {@link https://mercadopago.com.ar/developers/en/docs/checkout-bricks/brand-brick/settings/payment-methods Brick # Payment methods} documentation.
*/
excludedPaymentMethods?: TBrandPaymentMethods[];
excludedPaymentMethods?: TBrandExcludedPaymentMethods[];
/**
* Optional. Specify the payment types you don't want to show.
* ['credit_card', 'debit_card', 'ticket', 'account_money', 'mercado_credito'].
* ['credit_card', 'debit_card', 'ticket'].
*
* @see {@link https://mercadopago.com.ar/developers/en/docs/checkout-bricks/brand-brick/settings/payment-methods Brick # Payment methods} documentation.
*/
excludedPaymentTypes?: TBrandPaymentTypes[];
excludedPaymentTypes?: TBrandExcludedPaymentTypes[];
/**
* Optional. Add an installment limit.
*
Expand All @@ -198,7 +198,7 @@ export interface IBrandPaymentMethodCustomization {
interestFreeInstallments?: boolean;
}

type TBrandPaymentMethods =
type TBrandExcludedPaymentMethods =
| 'master'
| 'visa'
| 'amex'
Expand All @@ -212,12 +212,6 @@ type TBrandPaymentMethods =
| 'tarshop'
| 'cmr'
| 'rapipago'
| 'pagofacil'
| 'mercadopago';
| 'pagofacil';

type TBrandPaymentTypes =
| 'credit_card'
| 'debit_card'
| 'ticket'
| 'account_money'
| 'mercado_credito';
type TBrandExcludedPaymentTypes = 'credit_card' | 'debit_card' | 'ticket';
18 changes: 9 additions & 9 deletions src/bricks/cardPayment/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type TCardPayment = {
* Required. Function. Receives function to send the payment to backend
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/default-rendering Card Payment Brick # Default rendering} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/additional-data Card Payment Brick # Additional Settings # Additional data} documentatio to understand the second param.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/additional-data Card Payment Brick # Advanced features # Additional data} documentatio to understand the second param.
*/
onSubmit: (
param: ICardPaymentFormData<ICardPaymentBrickPayer>,
Expand All @@ -34,7 +34,7 @@ export type TCardPayment = {
/**
* Optional. Function. It is used to get the bin of the card being inserted into the Brick. This callback is called on the fly whenever the card bin is updated
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/additional-callbacks Card Payment Brick # Additional Settings # Additional callbacks} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/additional-callbacks Card Payment Brick # Advanced features # Additional callbacks} documentation.
*/
onBinChange?: (param: string) => void;
/**
Expand All @@ -55,7 +55,7 @@ export type TCardPayment = {
/**
* Optional. Object. Receives information from payer and fill up the correspondent fields
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/initialize-data-on-the-bricks Card Payment Brick # Additional Settings # Initialize data on the Brick} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/initialize-data-on-the-bricks Card Payment Brick # Advanced features # Initialize data on the Brick} documentation.
*/
payer?: ICardPaymentBrickPayer;
};
Expand All @@ -66,7 +66,7 @@ export type TCardPayment = {
/**
* Optional. Object. Receives information about installments and payment method types
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/configure-installments Card Payment Brick # Additional Settings # Configure Installments} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/configure-installments Card Payment Brick # Advanced features # Configure Installments} documentation.
*/
paymentMethods?: {
/**
Expand All @@ -80,7 +80,7 @@ export type TCardPayment = {
/**
* Optional. Object. Receives excluded attribute
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/configure-payment-methods Card Payment Brick # Additional Settings # Configure accepted payment methods} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/configure-payment-methods Card Payment Brick # Advanced features # Configure accepted payment methods} documentation.
*/
types?: {
/**
Expand All @@ -93,8 +93,8 @@ export type TCardPayment = {
/**
* Optional. Object. Receives information about visual attributes, such as themes
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/hide-element Card Payment Brick # Additional Settings # Hide Elements} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/change-texts Card Payment Brick # Additional Settings # Change texts} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/visual-customizations/hide-element Card Payment Brick # Visual customizations # Hide Elements} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/visual-customizations/change-texts Card Payment Brick # Visual customizations # Change texts} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/additional-content/set-theme General Customization # Set theme} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/additional-content/modify-css-variables General Customization # Modify CSS variables} documentation.
*/
Expand Down Expand Up @@ -172,7 +172,7 @@ export interface IAdditionalData {
/**
* Bin of the card entered by the user.
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/additional-data Card Payment Brick # Additional Settings # Additional data customization} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/additional-data Card Payment Brick # Advanced features # Additional data customization} documentation.
*/
bin: string;
/**
Expand All @@ -192,7 +192,7 @@ export interface IAdditionalData {
/**
* Card payment types
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/additional-customization/configure-payment-methods Card Payment Brick # Additional Settings # Configure accepted payment methods} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/card-payment-brick/advanced-features/configure-payment-methods Card Payment Brick # Advanced features # Configure accepted payment methods} documentation.
*/
type TCardPaymentBrickPaymentType = 'credit_card' | 'debit_card';

Expand Down
12 changes: 6 additions & 6 deletions src/bricks/payment/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,19 +295,19 @@ export interface IPaymentFormData {
/**
* Required. Payment type returned at onSubmit.
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods/brasil Returned data} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods Returned data} documentation.
*/
paymentType: TPaymentBrickPaymentType;
/**
* Required. Selected payment method returned at onSubmit.
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods/brasil Returned data} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods Returned data} documentation.
*/
selectedPaymentMethod: TPaymentBrickPaymentType;
/**
* Required. Information returned at onSubmit.
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods/brasil Returned data} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods Returned data} documentation.
*/
formData: ICardPaymentFormData<ICardPaymentBrickPayer> &
ICardPaymentFormData<ISavedCardPayer> &
Expand Down Expand Up @@ -585,7 +585,7 @@ export interface IPaymentBrickVisual {
/**
* Required. Configuration of which payment methods will be accepted
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/additional-customization/manage-payment-methods Payment} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/advanced-features/manage-payment-methods Payment} documentation.
*/
type TPaymentBrickPaymentMethods = IPaymentBrickPaymentMethods &
(
Expand Down Expand Up @@ -705,7 +705,7 @@ export interface IPaymentBrickCustomizableTexts {
addressComplement?: { label?: string };
}

export interface IPaymentBrickStyle extends IBrickStyle<IPaymentBrickCustomVariables> {}
export type IPaymentBrickStyle = IBrickStyle<IPaymentBrickCustomVariables>;

export interface IPaymentBrickCustomVariables extends IBrickCustomVariables {
/**
Expand Down Expand Up @@ -778,7 +778,7 @@ export interface IAddress extends Partial<IDefaultAddress> {
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/cards Cards type documentation}
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/wallet-credits Mercado Pago Wallet and Installments without card documentation},
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/pix Pix documentation}
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods/brasil Other payment methods documentation}.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/payment-submission/other-payment-methods Other payment methods documentation}.
*/
type TPaymentBrickPaymentType =
| 'atm'
Expand Down
2 changes: 1 addition & 1 deletion src/bricks/util/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export interface IBrickBinCallback {
/**
* Bin of the card entered by the user.
*
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/additional-customization/additional-data additional data customization} documentation.
* @see {@link https://www.mercadopago.com/developers/en/docs/checkout-bricks/payment-brick/advanced-features/additional-callbacks additional callbacks customization} documentation.
*/
onBinChange?: (bin: string) => void;
}
Expand Down
Loading

0 comments on commit aa365aa

Please sign in to comment.