@yuno-payments/sdk-web-types 2.0.0-beta.1 → 3.0.0
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.
- package/README.md +24 -0
- package/dist/global.d.ts +37 -18
- package/dist/index.d.ts +38 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -36,3 +36,27 @@ By including `"types": ["@yuno-payments/sdk-web-types/dist/global"]` in your `ts
|
|
|
36
36
|
- To use **`Yuno` globally**, include the configuration in `tsconfig.json` to make `Yuno` available throughout your project without importing it.
|
|
37
37
|
|
|
38
38
|
With this setup, your Yuno SDK integration will be smooth, and TypeScript's type checking and autocompletion will help you ensure correctness in your code.
|
|
39
|
+
|
|
40
|
+
## 📝 Version History
|
|
41
|
+
|
|
42
|
+
### SDK v1.1
|
|
43
|
+
In version 1.1, all methods in the `YunoInstance` interface have been updated to return Promises. This change makes the SDK fully asynchronous and allows for better handling of asynchronous operations. The following methods now return `Promise<void>`:
|
|
44
|
+
|
|
45
|
+
- `startCheckout`
|
|
46
|
+
- `mountCheckout`
|
|
47
|
+
- `mountCheckoutLite`
|
|
48
|
+
- `mountSeamlessCheckoutLite`
|
|
49
|
+
- `updateCheckoutSession`
|
|
50
|
+
- `submitOneTimeTokenForm`
|
|
51
|
+
- `startPayment`
|
|
52
|
+
- `continuePayment`
|
|
53
|
+
- `notifyError`
|
|
54
|
+
- `mountEnrollmentLite`
|
|
55
|
+
- `showLoader`
|
|
56
|
+
- `hideLoader`
|
|
57
|
+
- `mountFraud`
|
|
58
|
+
- `mountStatusPayment`
|
|
59
|
+
|
|
60
|
+
Additionally, the `secureFields` method now returns `Promise<SecureFieldInstance>`.
|
|
61
|
+
|
|
62
|
+
These changes enable better async/await support and more consistent error handling across the SDK.
|
package/dist/global.d.ts
CHANGED
|
@@ -180,7 +180,7 @@ type ApiClientPaymentReturn = {
|
|
|
180
180
|
getThreeDSecureChallenge: GetThreeDSecureChallenge;
|
|
181
181
|
generateHeadlessToken: GenerateHeadlessToken;
|
|
182
182
|
};
|
|
183
|
-
type ApiClientPayment = (args: ApiClientPaymentArgs) => ApiClientPaymentReturn
|
|
183
|
+
type ApiClientPayment = (args: ApiClientPaymentArgs) => Promise<ApiClientPaymentReturn>;
|
|
184
184
|
|
|
185
185
|
type ApiClientEnrollArgs = {
|
|
186
186
|
customer_session: string;
|
|
@@ -204,7 +204,7 @@ type ContinueEnrollmentReturn = {
|
|
|
204
204
|
type ApiClientEnrollReturn = {
|
|
205
205
|
continueEnrollment: (args: ContinueEnrollmentArgs) => Promise<ContinueEnrollmentReturn>;
|
|
206
206
|
};
|
|
207
|
-
type ApiClientEnroll = (args: ApiClientEnrollArgs) => ApiClientEnrollReturn
|
|
207
|
+
type ApiClientEnroll = (args: ApiClientEnrollArgs) => Promise<ApiClientEnrollReturn>;
|
|
208
208
|
|
|
209
209
|
type Status = 'FAIL' | 'REJECT' | 'SUCCEEDED' | 'PROCESSING' | 'READY';
|
|
210
210
|
type EnrollmentStatus = 'CREATED' | 'EXPIRED' | 'REJECTED' | 'READY_TO_ENROLL' | 'ENROLL_IN_PROCESS' | 'UNENROLL_IN_PROCESS' | 'ENROLLED' | 'DECLINED' | 'CANCELED' | 'ERROR' | 'UNENROLLED';
|
|
@@ -478,6 +478,10 @@ interface TextsCustom {
|
|
|
478
478
|
sendOtpButton?: string;
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
+
type Font = {
|
|
482
|
+
familyName: string;
|
|
483
|
+
files: FontFile[];
|
|
484
|
+
};
|
|
481
485
|
interface CardConfig {
|
|
482
486
|
styles?: string;
|
|
483
487
|
type?: 'extends' | 'step';
|
|
@@ -486,6 +490,21 @@ interface CardConfig {
|
|
|
486
490
|
texts?: ButtonTextCard;
|
|
487
491
|
documentEnable?: boolean;
|
|
488
492
|
isCreditCardProcessingOnly?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* This property helps to load fonts into the card form, due to the fact that the fields are rendered as iframes.
|
|
495
|
+
* With this, you can use the fonts in the styles property.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* fonts: [
|
|
500
|
+
* {
|
|
501
|
+
* familyName: 'Arial',
|
|
502
|
+
* files: ['https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap']
|
|
503
|
+
* }
|
|
504
|
+
* ]
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
fonts?: Font[];
|
|
489
508
|
}
|
|
490
509
|
interface FormElementSelector {
|
|
491
510
|
apmForm?: string;
|
|
@@ -587,27 +606,27 @@ interface MountStatusPaymentArgs {
|
|
|
587
606
|
yunoError?: YunoConfig['yunoError'];
|
|
588
607
|
}
|
|
589
608
|
interface YunoInstance {
|
|
590
|
-
startCheckout(args: StartCheckoutArgs): void
|
|
591
|
-
mountCheckout(args: MountCheckoutArgs): void
|
|
592
|
-
mountCheckoutLite(args: MountCheckoutLiteArgs): void
|
|
593
|
-
mountSeamlessCheckoutLite(args: MountSeamlessCheckoutLiteArgs): void
|
|
594
|
-
updateCheckoutSession(checkout: string): void
|
|
595
|
-
submitOneTimeTokenForm(): void
|
|
596
|
-
startPayment(): void
|
|
609
|
+
startCheckout(args: StartCheckoutArgs): Promise<void>;
|
|
610
|
+
mountCheckout(args: MountCheckoutArgs): Promise<void>;
|
|
611
|
+
mountCheckoutLite(args: MountCheckoutLiteArgs): Promise<void>;
|
|
612
|
+
mountSeamlessCheckoutLite(args: MountSeamlessCheckoutLiteArgs): Promise<void>;
|
|
613
|
+
updateCheckoutSession(checkout: string): Promise<void>;
|
|
614
|
+
submitOneTimeTokenForm(): Promise<void>;
|
|
615
|
+
startPayment(): Promise<void>;
|
|
597
616
|
continuePayment(): Promise<void>;
|
|
598
|
-
notifyError(): void
|
|
599
|
-
mountEnrollmentLite(args: MountEnrollmentLiteArgs): void
|
|
600
|
-
showLoader(): void
|
|
601
|
-
hideLoader(): void
|
|
602
|
-
updateCheckoutSession(checkoutSession: string): void
|
|
603
|
-
mountFraud(args: mountFraudArgs): void
|
|
604
|
-
mountStatusPayment(args: MountStatusPaymentArgs): void
|
|
605
|
-
secureFields(args: SecureFieldsArgs): SecureFieldInstance
|
|
617
|
+
notifyError(): Promise<void>;
|
|
618
|
+
mountEnrollmentLite(args: MountEnrollmentLiteArgs): Promise<void>;
|
|
619
|
+
showLoader(): Promise<void>;
|
|
620
|
+
hideLoader(): Promise<void>;
|
|
621
|
+
updateCheckoutSession(checkoutSession: string): Promise<void>;
|
|
622
|
+
mountFraud(args: mountFraudArgs): Promise<void>;
|
|
623
|
+
mountStatusPayment(args: MountStatusPaymentArgs): Promise<void>;
|
|
624
|
+
secureFields(args: SecureFieldsArgs): Promise<SecureFieldInstance>;
|
|
606
625
|
apiClientPayment: ApiClientPayment;
|
|
607
626
|
apiClientEnroll: ApiClientEnroll;
|
|
608
627
|
}
|
|
609
628
|
interface Yuno {
|
|
610
|
-
initialize(publicApiKey: string): YunoInstance
|
|
629
|
+
initialize(publicApiKey: string): Promise<YunoInstance>;
|
|
611
630
|
}
|
|
612
631
|
|
|
613
632
|
declare const Yuno: Yuno;
|
package/dist/index.d.ts
CHANGED
|
@@ -180,7 +180,7 @@ type ApiClientPaymentReturn = {
|
|
|
180
180
|
getThreeDSecureChallenge: GetThreeDSecureChallenge;
|
|
181
181
|
generateHeadlessToken: GenerateHeadlessToken;
|
|
182
182
|
};
|
|
183
|
-
type ApiClientPayment = (args: ApiClientPaymentArgs) => ApiClientPaymentReturn
|
|
183
|
+
type ApiClientPayment = (args: ApiClientPaymentArgs) => Promise<ApiClientPaymentReturn>;
|
|
184
184
|
|
|
185
185
|
type ApiClientEnrollArgs = {
|
|
186
186
|
customer_session: string;
|
|
@@ -204,7 +204,7 @@ type ContinueEnrollmentReturn = {
|
|
|
204
204
|
type ApiClientEnrollReturn = {
|
|
205
205
|
continueEnrollment: (args: ContinueEnrollmentArgs) => Promise<ContinueEnrollmentReturn>;
|
|
206
206
|
};
|
|
207
|
-
type ApiClientEnroll = (args: ApiClientEnrollArgs) => ApiClientEnrollReturn
|
|
207
|
+
type ApiClientEnroll = (args: ApiClientEnrollArgs) => Promise<ApiClientEnrollReturn>;
|
|
208
208
|
|
|
209
209
|
type Status = 'FAIL' | 'REJECT' | 'SUCCEEDED' | 'PROCESSING' | 'READY';
|
|
210
210
|
type EnrollmentStatus = 'CREATED' | 'EXPIRED' | 'REJECTED' | 'READY_TO_ENROLL' | 'ENROLL_IN_PROCESS' | 'UNENROLL_IN_PROCESS' | 'ENROLLED' | 'DECLINED' | 'CANCELED' | 'ERROR' | 'UNENROLLED';
|
|
@@ -478,6 +478,10 @@ interface TextsCustom {
|
|
|
478
478
|
sendOtpButton?: string;
|
|
479
479
|
};
|
|
480
480
|
}
|
|
481
|
+
type Font = {
|
|
482
|
+
familyName: string;
|
|
483
|
+
files: FontFile[];
|
|
484
|
+
};
|
|
481
485
|
interface CardConfig {
|
|
482
486
|
styles?: string;
|
|
483
487
|
type?: 'extends' | 'step';
|
|
@@ -486,6 +490,21 @@ interface CardConfig {
|
|
|
486
490
|
texts?: ButtonTextCard;
|
|
487
491
|
documentEnable?: boolean;
|
|
488
492
|
isCreditCardProcessingOnly?: boolean;
|
|
493
|
+
/**
|
|
494
|
+
* This property helps to load fonts into the card form, due to the fact that the fields are rendered as iframes.
|
|
495
|
+
* With this, you can use the fonts in the styles property.
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* ```ts
|
|
499
|
+
* fonts: [
|
|
500
|
+
* {
|
|
501
|
+
* familyName: 'Arial',
|
|
502
|
+
* files: ['https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap']
|
|
503
|
+
* }
|
|
504
|
+
* ]
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
507
|
+
fonts?: Font[];
|
|
489
508
|
}
|
|
490
509
|
interface FormElementSelector {
|
|
491
510
|
apmForm?: string;
|
|
@@ -587,27 +606,27 @@ interface MountStatusPaymentArgs {
|
|
|
587
606
|
yunoError?: YunoConfig['yunoError'];
|
|
588
607
|
}
|
|
589
608
|
interface YunoInstance {
|
|
590
|
-
startCheckout(args: StartCheckoutArgs): void
|
|
591
|
-
mountCheckout(args: MountCheckoutArgs): void
|
|
592
|
-
mountCheckoutLite(args: MountCheckoutLiteArgs): void
|
|
593
|
-
mountSeamlessCheckoutLite(args: MountSeamlessCheckoutLiteArgs): void
|
|
594
|
-
updateCheckoutSession(checkout: string): void
|
|
595
|
-
submitOneTimeTokenForm(): void
|
|
596
|
-
startPayment(): void
|
|
609
|
+
startCheckout(args: StartCheckoutArgs): Promise<void>;
|
|
610
|
+
mountCheckout(args: MountCheckoutArgs): Promise<void>;
|
|
611
|
+
mountCheckoutLite(args: MountCheckoutLiteArgs): Promise<void>;
|
|
612
|
+
mountSeamlessCheckoutLite(args: MountSeamlessCheckoutLiteArgs): Promise<void>;
|
|
613
|
+
updateCheckoutSession(checkout: string): Promise<void>;
|
|
614
|
+
submitOneTimeTokenForm(): Promise<void>;
|
|
615
|
+
startPayment(): Promise<void>;
|
|
597
616
|
continuePayment(): Promise<void>;
|
|
598
|
-
notifyError(): void
|
|
599
|
-
mountEnrollmentLite(args: MountEnrollmentLiteArgs): void
|
|
600
|
-
showLoader(): void
|
|
601
|
-
hideLoader(): void
|
|
602
|
-
updateCheckoutSession(checkoutSession: string): void
|
|
603
|
-
mountFraud(args: mountFraudArgs): void
|
|
604
|
-
mountStatusPayment(args: MountStatusPaymentArgs): void
|
|
605
|
-
secureFields(args: SecureFieldsArgs): SecureFieldInstance
|
|
617
|
+
notifyError(): Promise<void>;
|
|
618
|
+
mountEnrollmentLite(args: MountEnrollmentLiteArgs): Promise<void>;
|
|
619
|
+
showLoader(): Promise<void>;
|
|
620
|
+
hideLoader(): Promise<void>;
|
|
621
|
+
updateCheckoutSession(checkoutSession: string): Promise<void>;
|
|
622
|
+
mountFraud(args: mountFraudArgs): Promise<void>;
|
|
623
|
+
mountStatusPayment(args: MountStatusPaymentArgs): Promise<void>;
|
|
624
|
+
secureFields(args: SecureFieldsArgs): Promise<SecureFieldInstance>;
|
|
606
625
|
apiClientPayment: ApiClientPayment;
|
|
607
626
|
apiClientEnroll: ApiClientEnroll;
|
|
608
627
|
}
|
|
609
628
|
interface Yuno {
|
|
610
|
-
initialize(publicApiKey: string): YunoInstance
|
|
629
|
+
initialize(publicApiKey: string): Promise<YunoInstance>;
|
|
611
630
|
}
|
|
612
631
|
|
|
613
|
-
export { type ButtonTextCard, type CardConfig, type CreateArgsSF, type ExternalPaymentButtons, ExternalPaymentButtonsTypes, type FormElementSelector, type Language, type LoadingType, type MountCheckoutArgs, type MountCheckoutLiteArgs, type MountEnrollmentLiteArgs, type MountSeamlessCheckoutLiteArgs, type MountStatusPaymentArgs, type OnChangeDataSF, type RenderMode, type SecureFieldInstance, type SecureFieldsArgs, type StartCheckoutArgs, type TextsCustom, type Yuno, type YunoConfig, type YunoInstance, type mountFraudArgs };
|
|
632
|
+
export { type ButtonTextCard, type CardConfig, type CreateArgsSF, type ExternalPaymentButtons, ExternalPaymentButtonsTypes, type Font, type FormElementSelector, type Language, type LoadingType, type MountCheckoutArgs, type MountCheckoutLiteArgs, type MountEnrollmentLiteArgs, type MountSeamlessCheckoutLiteArgs, type MountStatusPaymentArgs, type OnChangeDataSF, type RenderMode, type SecureFieldInstance, type SecureFieldsArgs, type StartCheckoutArgs, type TextsCustom, type Yuno, type YunoConfig, type YunoInstance, type mountFraudArgs };
|