@payconductor/react 1.0.3 → 1.0.4

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.
Files changed (30) hide show
  1. package/dist/esm/three-ds.d.ts +1 -0
  2. package/dist/esm/tokenize.d.ts +1 -0
  3. package/dist/index.cjs.js +37 -2
  4. package/dist/index.cjs.js.map +1 -1
  5. package/dist/index.d.ts +4 -0
  6. package/dist/index.es.js +956 -291
  7. package/dist/index.es.js.map +1 -1
  8. package/dist/payconductor/hooks/index.d.ts +4 -0
  9. package/dist/payconductor/hooks/use-three-ds.d.ts +13 -0
  10. package/dist/payconductor/hooks/use-tokenize.d.ts +11 -0
  11. package/dist/payconductor/iframe/types.d.ts +49 -1
  12. package/dist/payconductor/loader.d.ts +1 -0
  13. package/dist/payconductor/payconductor-three-ds.d.ts +5 -0
  14. package/dist/payconductor/three-ds/browser.d.ts +13 -0
  15. package/dist/payconductor/three-ds/handler.d.ts +11 -0
  16. package/dist/payconductor/three-ds/index.d.ts +1 -0
  17. package/dist/payconductor/three-ds/providers/index.d.ts +6 -0
  18. package/dist/payconductor/three-ds/providers/mercado-pago.d.ts +9 -0
  19. package/dist/payconductor/three-ds/providers/pagarme.d.ts +9 -0
  20. package/dist/payconductor/three-ds/providers/pagseguro.d.ts +7 -0
  21. package/dist/payconductor/three-ds/providers/payconductor.d.ts +7 -0
  22. package/dist/payconductor/three-ds/types.d.ts +75 -0
  23. package/dist/payconductor/tokenize/api.d.ts +25 -0
  24. package/dist/payconductor/tokenize/index.d.ts +1 -0
  25. package/dist/payconductor/tokenize/providers/index.d.ts +5 -0
  26. package/dist/payconductor/tokenize/providers/mercado-pago.d.ts +6 -0
  27. package/dist/payconductor/tokenize/tokenize.d.ts +9 -0
  28. package/dist/payconductor/tokenize/types.d.ts +63 -0
  29. package/dist/payconductor/types.d.ts +3 -0
  30. package/package.json +1 -1
@@ -0,0 +1,75 @@
1
+ export type ThreeDSecureData = {
2
+ status?: string;
3
+ statusDetail?: string;
4
+ acquirer?: string;
5
+ environment?: "Sandbox" | "Production";
6
+ authToken?: string;
7
+ threeDsUrl?: string;
8
+ creq?: string;
9
+ operationUrl?: string;
10
+ publicKey?: string;
11
+ dsTransactionId?: string;
12
+ version?: string;
13
+ card?: {
14
+ number: string;
15
+ expMonth: string;
16
+ expYear: string;
17
+ holderName: string;
18
+ };
19
+ customer?: {
20
+ name: string;
21
+ email: string;
22
+ document?: string;
23
+ phones?: Array<{
24
+ countryCode: string;
25
+ areaCode: string;
26
+ number: string;
27
+ type?: string;
28
+ }>;
29
+ };
30
+ amount?: number;
31
+ currency?: string;
32
+ installments?: number;
33
+ billingAddress?: {
34
+ street: string;
35
+ number: string;
36
+ complement?: string;
37
+ district?: string;
38
+ state: string;
39
+ country: string;
40
+ city: string;
41
+ zipCode: string;
42
+ };
43
+ };
44
+ export type ThreeDSecureOptions = {
45
+ threeDSecure: ThreeDSecureData;
46
+ onComplete?: () => void;
47
+ onError?: (error: Error) => void;
48
+ onTimeout?: () => void;
49
+ timeoutMs?: number;
50
+ };
51
+ export declare enum ThreeDSecureResultStatus {
52
+ Success = "Success",
53
+ Failed = "Failed",
54
+ Timeout = "Timeout"
55
+ }
56
+ export type ThreeDSecureResult = {
57
+ status: ThreeDSecureResultStatus;
58
+ error?: Error;
59
+ authToken?: string;
60
+ dsTransactionId?: string;
61
+ };
62
+ export declare abstract class AbstractThreeDSProvider {
63
+ protected readonly data: ThreeDSecureData;
64
+ protected readonly options: ThreeDSecureOptions;
65
+ private overlay;
66
+ private modalContent;
67
+ constructor(data: ThreeDSecureData, options: ThreeDSecureOptions);
68
+ abstract authenticate(): Promise<ThreeDSecureResult>;
69
+ abstract cleanup(): void;
70
+ protected fail(message: string): ThreeDSecureResult;
71
+ protected showModal(): HTMLElement;
72
+ protected closeModal(): void;
73
+ protected resolveContainer(): HTMLElement;
74
+ private injectStyles;
75
+ }
@@ -0,0 +1,25 @@
1
+ import { CreateCustomerCard, IntegrationProvider, SaveTokensBody } from './types';
2
+
3
+ export declare class PayConductorApiError extends Error {
4
+ readonly title?: unknown | undefined;
5
+ constructor(message: string, title?: unknown | undefined);
6
+ }
7
+ export declare class PayConductorApi {
8
+ private readonly publicKey;
9
+ constructor(publicKey: string);
10
+ getSettings(): Promise<{
11
+ settings: {
12
+ settings: Record<string, string | number | boolean>;
13
+ key: IntegrationProvider;
14
+ integrationId: string;
15
+ }[];
16
+ }>;
17
+ createToken(input: CreateCustomerCard): Promise<{
18
+ token: string;
19
+ customerId: string;
20
+ }>;
21
+ saveTokens(data: SaveTokensBody[], customerId: string, cardToken: string): Promise<void>;
22
+ private parseResponseError;
23
+ private get baseUrl();
24
+ private get headers();
25
+ }
@@ -0,0 +1 @@
1
+ export { PayConductorTokenizeSDK } from './tokenize';
@@ -0,0 +1,5 @@
1
+ import { AbstractTokenizeProvider, TokenizeProviderInput, IntegrationProvider } from '../types';
2
+
3
+ type TokenizeProviderConstructor = new (input: TokenizeProviderInput) => AbstractTokenizeProvider;
4
+ export declare const tokenizeProviders: Partial<Record<IntegrationProvider, TokenizeProviderConstructor>>;
5
+ export {};
@@ -0,0 +1,6 @@
1
+ import { AbstractTokenizeProvider } from '../types';
2
+
3
+ export declare class MercadoPagoTokenizeProvider extends AbstractTokenizeProvider {
4
+ scriptUrl: string;
5
+ tokenize(): Promise<string>;
6
+ }
@@ -0,0 +1,9 @@
1
+ import { CardTokenizeRequest } from './types';
2
+
3
+ export declare class PayConductorTokenizeSDK {
4
+ private readonly publicKey;
5
+ private readonly api;
6
+ constructor(publicKey: string);
7
+ tokenizeCard(input: CardTokenizeRequest): Promise<string>;
8
+ private validateCard;
9
+ }
@@ -0,0 +1,63 @@
1
+ export declare enum DocumentType {
2
+ Cpf = "Cpf",
3
+ Cnpj = "Cnpj"
4
+ }
5
+ export declare enum IntegrationProvider {
6
+ Asaas = "Asaas",
7
+ Sandbox = "Sandbox",
8
+ MercadoPago = "MercadoPago",
9
+ NuPay = "NuPay",
10
+ PicPay = "PicPay",
11
+ Woovi = "Woovi",
12
+ PagarMe = "PagarMe",
13
+ PagSeguro = "PagSeguro",
14
+ BancoDoBrasil = "BancoDoBrasil"
15
+ }
16
+ export type CreateCustomerInput = {
17
+ documentNumber: string;
18
+ documentType: `${DocumentType}`;
19
+ email: string;
20
+ name: string;
21
+ phoneNumber: string;
22
+ address?: {
23
+ city: string;
24
+ country: string;
25
+ neighborhood: string;
26
+ number: string;
27
+ state: string;
28
+ street: string;
29
+ zipCode: string;
30
+ };
31
+ };
32
+ export type CreateCardInput = {
33
+ cvv: string;
34
+ expiration: {
35
+ month: number;
36
+ year: number;
37
+ };
38
+ holderName: string;
39
+ number: string;
40
+ };
41
+ export type TokenizeProviderInput = {
42
+ customer: CreateCustomerInput;
43
+ card: CreateCardInput;
44
+ setting: Record<string, string | number | boolean>;
45
+ saveCard?: boolean;
46
+ };
47
+ export type CardTokenizeRequest = Omit<TokenizeProviderInput, "setting">;
48
+ export declare abstract class AbstractTokenizeProvider {
49
+ protected readonly input: TokenizeProviderInput;
50
+ constructor(input: TokenizeProviderInput);
51
+ abstract scriptUrl: string;
52
+ abstract tokenize(): Promise<string>;
53
+ }
54
+ export type SaveTokensBody = {
55
+ integrationId: string;
56
+ providerKey: IntegrationProvider;
57
+ token: string;
58
+ };
59
+ export type CreateCustomerCard = {
60
+ customer: CreateCustomerInput;
61
+ card: CreateCardInput;
62
+ saveCard: boolean;
63
+ };
@@ -4,6 +4,9 @@ export * from './iframe/types';
4
4
  export type ConfirmPaymentOptions = {
5
5
  orderId: string;
6
6
  returnUrl?: string;
7
+ onThreeDSChallenge?: () => void;
8
+ onThreeDSComplete?: () => void;
9
+ onThreeDSError?: (error: Error) => void;
7
10
  };
8
11
  export type SubmitResult = {
9
12
  error?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payconductor/react",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "React SDK for PayConductor",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",