Skip to content

Commit

Permalink
Merge pull request #116 from icaldana/release/0.0.20
Browse files Browse the repository at this point in the history
Release 0.0.20
  • Loading branch information
icaldana authored Dec 17, 2024
2 parents 0392c6c + 289c711 commit c6e8ad5
Show file tree
Hide file tree
Showing 46 changed files with 197 additions and 97 deletions.
10 changes: 6 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
repos:
- repo: https://github.com/mercadolibre/fury_websec-git-hooks
rev: v1.0.5
- repo: https://github.com/melisource/fury_websec-git-hooks
rev: v2.0.0
hooks:
- id: pre_commit_hook
stages: [commit]
- id: post_commit_hook
stages: [post-commit]
- repo: https://github.com/mercadolibre/fury_datasec-git-hooks
rev: 1.0.1
- repo: https://github.com/melisource/fury_datasec-git-hooks
rev: 1.2.0
hooks:
- id: pre_commit_hook
stages: [commit]
verbose: true
- id: post_commit_hook
stages: [post-commit]
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,21 +329,27 @@ const cardToken = await createCardToken({

## Run SDK project

To use Mercado Pago React SDK, follow the steps:
> Replace the `<YOUR_PUBLIC_KEY>` on `examples/contants` with your public key.
Install project:
To run Mercado Pago React SDK, follow the steps:

Install project dependencies:

```
npm i
npm install
```

Execute project build:
Execute project build (_optional_):

```
npm build
npm run build
```

Execute `npm run start` to initialize storybook.
Execute storybook:

```
npm run start
```

<br/>

Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/BrandBrick/0-Simple.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Brand from '../../../src/bricks/brand';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-bfe30303-c7de-4da3-b765-c4be61b4f88b', {
initMercadoPago(PUBLIC_KEY, {
locale: 'es-AR',
});

Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/BrandBrick/1-Visual-Customization.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Brand from '../../../src/bricks/brand';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-bfe30303-c7de-4da3-b765-c4be61b4f88b', {
initMercadoPago(PUBLIC_KEY, {
locale: 'es-AR',
});

Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/CardPayment/0-Simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import Card from '../../../src/bricks/cardPayment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });
const App = () => {
return (
<Card
Expand Down
5 changes: 3 additions & 2 deletions examples/bricks/CardPayment/1-Customization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import Card from '../../../src/bricks/cardPayment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const customization = {
Expand All @@ -25,7 +26,7 @@ const App = () => {
.then((cardFormData) => {
console.log('cardFormData received, creating payment...', cardFormData);
})
.catch((error) => {});
.catch((error) => console.log(error));
}

return (
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/CardPayment/2-UpdateAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import Card, { useCardPaymentBrick } from '../../../src/bricks/cardPayment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const { update } = useCardPaymentBrick();
Expand Down
21 changes: 21 additions & 0 deletions examples/bricks/CardPayment/3-Custom-ContainerId.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import Card from '../../../src/bricks/cardPayment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
return (
<Card
initialization={{ amount: 100 }}
id="custom-container-id"
onSubmit={async (param) => {
console.log(param);
}}
/>
);
};

export default App;
3 changes: 2 additions & 1 deletion examples/bricks/Payment/0-Simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import Payment from '../../../src/bricks/payment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const initialization = {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/Payment/1-Visual-Customization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import Payment from '../../../src/bricks/payment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const initialization = {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/Payment/2-UpdateAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import Payment, { usePaymentBrick } from '../../../src/bricks/payment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const { update } = usePaymentBrick();
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/Payment/3-Review-Confirm-Simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React from 'react';
import Payment from '../../../src/bricks/payment';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { PUBLIC_KEY } from '../../constants';

initMercadoPago('TEST-d198443d-7e9f-4e5f-a770-e5b23ae627cb', { locale: 'es-MX' });
initMercadoPago(PUBLIC_KEY, { locale: 'es-MX' });

// This feature is temporarily exclusive for MLM (México) 🇲🇽 and MLA (Argentina) 🇦🇷
const App = () => {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/Payment/4-Review-Confirm-Full.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Payment from '../../../src/bricks/payment';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-d198443d-7e9f-4e5f-a770-e5b23ae627cb', { locale: 'es-MX' });
initMercadoPago(PUBLIC_KEY, { locale: 'es-MX' });

// This feature is temporarily exclusive for MLM (México) 🇲🇽 and MLA (Argentina) 🇦🇷
const App = () => {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/Payment/5-Marketplace.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Payment from '../../../src/bricks/payment';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const ExamplePaymentBrickMarketplace = () => {
return (
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/StatusScreen/0-Simple.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import StatusScreen from '../../../src/bricks/statusScreen';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const initialization = {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/StatusScreen/1-Visual-Customization.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import StatusScreen from '../../../src/bricks/statusScreen';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const initialization = {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/StatusScreen/2-Error-Status.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import StatusScreen from '../../../src/bricks/statusScreen';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-2b00e5a0-b421-4588-b9cb-846a553d760e', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const initialization = {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/StatusScreen/3-3DS-Challenge.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import StatusScreen from '../../../src/bricks/statusScreen';
import { PUBLIC_KEY } from '../../constants';

import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import { IStatusScreenBrickInitialization } from '../../../src/bricks/statusScreen/types';

initMercadoPago('TEST-2b00e5a0-b421-4588-b9cb-846a553d760e', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
const initialization: IStatusScreenBrickInitialization = {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/WalletBrick/0-Simple.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83');
initMercadoPago(PUBLIC_KEY);

const ExampleSimpleWalletBrick = () => {
return <Wallet initialization={{ preferenceId: 'YOUR_PREFERENCE_ID' }} />;
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/WalletBrick/1-Visual-Customization.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83');
initMercadoPago(PUBLIC_KEY);

const ExampleVisualCustomizationWalletBrick = () => {
return (
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/WalletBrick/2-Preference-onSubmit.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83');
initMercadoPago(PUBLIC_KEY);

const ExampleOnSubmitWalletBrick = () => {
function onSubmit() {
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/WalletBrick/3-Hide-Value-Prop.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83');
initMercadoPago(PUBLIC_KEY);

const ExampleVisualCustomizationWalletBrick = () => {
return (
Expand Down
3 changes: 2 additions & 1 deletion examples/bricks/WalletBrick/4-ValueProp-Customization.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83');
initMercadoPago(PUBLIC_KEY);

const ExampleValuePropCustomizationWalletBrick = () => {
return (
Expand Down
15 changes: 13 additions & 2 deletions examples/bricks/WalletBrick/5-Marketplace.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83');
initMercadoPago(PUBLIC_KEY);

// Chech the API reference for more details about how to create the preferenceId
// https://www.mercadopago.com.br/developers/en/reference/preferences/_checkout_preferences/post

const ExampleWalletBrickMarketplace = () => {
return <Wallet initialization={{ preferenceId: '207446753-ea3adb2e-a4f2-41dd-a656-11cb01b8772c', marketplace: true }} />;
return (
<Wallet
initialization={{
preferenceId: '<PREFERENCE_ID>',
marketplace: true,
}}
/>
);
};

export default ExampleWalletBrickMarketplace;
15 changes: 15 additions & 0 deletions examples/bricks/WalletBrick/6-Custom-ContainerId.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import Wallet from '../../../src/bricks/wallet';
import { PUBLIC_KEY } from '../../constants';

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

initMercadoPago(PUBLIC_KEY);

const ExampleSimpleWalletBrick = () => {
return (
<Wallet initialization={{ preferenceId: 'YOUR_PREFERENCE_ID' }} id="custom-container-id" />
);
};

export default ExampleSimpleWalletBrick;
1 change: 1 addition & 0 deletions examples/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const PUBLIC_KEY = '<YOUR_PUBLIC_KEY>';
9 changes: 5 additions & 4 deletions examples/secureFields/CardNumber/0-Simple.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';

import { PUBLIC_KEY } from '../../constants';
import initMercadoPago from '../../../src/mercadoPago/initMercadoPago';
import CardNumber from '../../../src/secureFields/cardNumber';

initMercadoPago('TEST-f4563544-ce69-40c3-b88e-6e7d1bd93a83', { locale: 'pt-BR' });
initMercadoPago(PUBLIC_KEY, { locale: 'pt-BR' });

const App = () => {
return (
<CardNumber
placeholder='Card Number'
style={{ fontFamily: "sans-serif" }}
<CardNumber
placeholder="Card Number"
style={{ fontFamily: 'sans-serif' }}
onReady={(event) => console.log('Card number ready!!', event)}
onError={(error) => console.log(error)}
/>
Expand Down
Loading

0 comments on commit c6e8ad5

Please sign in to comment.