@yuno-payments/sdk-web-types 1.22.2-beta.7 → 2.0.0-beta.1

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 CHANGED
@@ -1,11 +1,38 @@
1
- ## Include Type in tsconfig.js
2
- ```bash
3
- "types": ["@yuno-payments/sdk-web-types"]
1
+ Using Yuno SDK Types
2
+
3
+ This package provides TypeScript types for integrating the Yuno SDK into your application. You can use the types in two ways: **importing them explicitly** or **using them globally**.
4
+
5
+ ## 1. Including Types in `tsconfig.json`
6
+
7
+ To make the types available globally across your project, include them in your `tsconfig.json` file:
8
+
9
+ ```json
10
+ {
11
+ "compilerOptions": {
12
+ "types": ["@yuno-payments/sdk-web-types/dist/global"]
13
+ }
14
+ }
4
15
  ```
5
16
 
6
- ## how to use types in your code
17
+ ## 2. How to Use Types in Your Code
18
+
19
+ ### a) **Importing Specific Types**
20
+
21
+ If you prefer to import specific types explicitly, you can do so like this:
22
+
7
23
  ```typescript
8
- import { YunoInstance } from '@yuno-payments/sdk-web-types/dist/types'
24
+ import { YunoInstance } from '@yuno-payments/sdk-web-types'
9
25
 
10
- const yunoInstance: YunoInstance = Yuno.initialize('publickAPikey')
26
+ const yunoInstance: YunoInstance = Yuno.initialize('publicApiKey')
11
27
  ```
28
+
29
+ ## 3. What Does the `tsconfig.json` Configuration Do?
30
+
31
+ By including `"types": ["@yuno-payments/sdk-web-types/dist/global"]` in your `tsconfig.json`, **you ensure that global types** (like `Yuno`) are available across your project without the need to import them explicitly.
32
+
33
+ ## 🚀 Summary
34
+
35
+ - To use **explicit types**, import the specific types you need from `@yuno-payments/sdk-web-types`.
36
+ - To use **`Yuno` globally**, include the configuration in `tsconfig.json` to make `Yuno` available throughout your project without importing it.
37
+
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.
package/dist/global.d.ts CHANGED
@@ -152,7 +152,7 @@ declare enum CountryCode {
152
152
  }
153
153
 
154
154
  type ApiClientPaymentArgs = {
155
- checkout_session: string;
155
+ checkout_session?: string;
156
156
  country_code: CountryCode;
157
157
  };
158
158
  type GenerateTokenArgs$1 = {
@@ -166,14 +166,19 @@ type GenerateTokenArgs$1 = {
166
166
  third_party_session_id?: string | null;
167
167
  };
168
168
  };
169
+ type GenerateHeadlessTokenArgs = Omit<GenerateTokenArgs$1, 'checkout_session'> & {
170
+ account_id: string;
171
+ };
169
172
  type GetThreeDSecureChallengeReturn = {
170
173
  url: string;
171
174
  };
172
175
  type GenerateToken = (args: GenerateTokenArgs$1) => Promise<OneTimeToken$1>;
176
+ type GenerateHeadlessToken = (args: GenerateHeadlessTokenArgs) => Promise<OneTimeToken$1>;
173
177
  type GetThreeDSecureChallenge = (checkoutSession?: string) => Promise<GetThreeDSecureChallengeReturn>;
174
178
  type ApiClientPaymentReturn = {
175
179
  generateToken: GenerateToken;
176
180
  getThreeDSecureChallenge: GetThreeDSecureChallenge;
181
+ generateHeadlessToken: GenerateHeadlessToken;
177
182
  };
178
183
  type ApiClientPayment = (args: ApiClientPaymentArgs) => ApiClientPaymentReturn;
179
184
 
@@ -297,8 +302,6 @@ interface FullInstallmentInfo {
297
302
  };
298
303
  type?: string;
299
304
  first_installment_deferral?: string;
300
- id?: string;
301
- additional_data?: Record<string, unknown>;
302
305
  }
303
306
  interface FullInstallmentsInfo {
304
307
  installments: FullInstallmentInfo[];
@@ -607,4 +610,4 @@ interface Yuno {
607
610
  initialize(publicApiKey: string): YunoInstance;
608
611
  }
609
612
 
610
- declare const Yuno: Yuno = window.Yuno;
613
+ declare const Yuno: Yuno;
package/dist/index.d.ts CHANGED
@@ -152,7 +152,7 @@ declare enum CountryCode {
152
152
  }
153
153
 
154
154
  type ApiClientPaymentArgs = {
155
- checkout_session: string;
155
+ checkout_session?: string;
156
156
  country_code: CountryCode;
157
157
  };
158
158
  type GenerateTokenArgs$1 = {
@@ -166,14 +166,19 @@ type GenerateTokenArgs$1 = {
166
166
  third_party_session_id?: string | null;
167
167
  };
168
168
  };
169
+ type GenerateHeadlessTokenArgs = Omit<GenerateTokenArgs$1, 'checkout_session'> & {
170
+ account_id: string;
171
+ };
169
172
  type GetThreeDSecureChallengeReturn = {
170
173
  url: string;
171
174
  };
172
175
  type GenerateToken = (args: GenerateTokenArgs$1) => Promise<OneTimeToken$1>;
176
+ type GenerateHeadlessToken = (args: GenerateHeadlessTokenArgs) => Promise<OneTimeToken$1>;
173
177
  type GetThreeDSecureChallenge = (checkoutSession?: string) => Promise<GetThreeDSecureChallengeReturn>;
174
178
  type ApiClientPaymentReturn = {
175
179
  generateToken: GenerateToken;
176
180
  getThreeDSecureChallenge: GetThreeDSecureChallenge;
181
+ generateHeadlessToken: GenerateHeadlessToken;
177
182
  };
178
183
  type ApiClientPayment = (args: ApiClientPaymentArgs) => ApiClientPaymentReturn;
179
184
 
@@ -297,8 +302,6 @@ interface FullInstallmentInfo {
297
302
  };
298
303
  type?: string;
299
304
  first_installment_deferral?: string;
300
- id?: string;
301
- additional_data?: Record<string, unknown>;
302
305
  }
303
306
  interface FullInstallmentsInfo {
304
307
  installments: FullInstallmentInfo[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuno-payments/sdk-web-types",
3
- "version": "1.22.2-beta.7",
3
+ "version": "2.0.0-beta.1",
4
4
  "types": "dist/index.d.ts",
5
5
  "type": "module",
6
6
  "publishConfig": {