@qonto/embed-sdk 0.48.0 → 0.49.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/dist/index.umd.js +3 -3
- package/dist/payment-links/index.d.ts +1 -1
- package/dist/payment-links/payment-links.d.ts +26 -14
- package/dist/payment-links/payment-links.d.ts.map +1 -1
- package/dist/payment-links/payment-links.public-api.d.ts +1 -1
- package/dist/payment-links/payment-links.types.d.ts +1 -1
- package/dist/payment-links/payment-links.types.d.ts.map +1 -1
- package/dist/payment-links/validation/payment-links.validate.d.ts +5 -2
- package/dist/payment-links/validation/payment-links.validate.d.ts.map +1 -1
- package/dist/src/payment-links/payment-links.js +1 -1
- package/dist/src/payment-links/validation/payment-links.validate.js +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
10
|
export declare const paymentLinks: {
|
|
11
|
-
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => string
|
|
11
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => Promise<string>;
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,43 +4,55 @@ import type { CreatePaymentLinkSettings, PaymentLinkParams } from './payment-lin
|
|
|
4
4
|
*
|
|
5
5
|
* @param params - An object containing:
|
|
6
6
|
* - paymentLinkSettings: An object containing:
|
|
7
|
-
* - authUrl: The embed auth link retrieved from the Qonto API. Must be a valid URL.
|
|
8
7
|
* - items: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
8
|
+
* - callbackUrl: Required callback URL to redirect to after payment link creation.
|
|
9
|
+
* - operationSettings: An object with operation-level settings such as `proxyRequestFunction`, `accessToken`, `stagingToken`, etc.
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```ts
|
|
12
|
-
* const url = getPaymentLinkCreationFlowUrl({
|
|
13
|
+
* const url = await getPaymentLinkCreationFlowUrl({
|
|
13
14
|
* paymentLinkSettings: {
|
|
14
|
-
*
|
|
15
|
-
*
|
|
15
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
16
|
+
* },
|
|
17
|
+
* operationSettings: {
|
|
18
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
19
|
+
* // Implement your proxy logic here
|
|
20
|
+
* },
|
|
16
21
|
* }
|
|
17
22
|
* });
|
|
18
23
|
* ```
|
|
19
|
-
* @returns
|
|
24
|
+
* @returns Promise resolving to the full URL as a string, which can be used to launch the payment link creation flow in an iframe or browser.
|
|
20
25
|
*
|
|
21
|
-
* @throws `InvalidParametersError` If the provided
|
|
26
|
+
* @throws `InvalidParametersError` If the provided items array is invalid or if callbackUrl is missing or invalid.
|
|
27
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
22
28
|
*/
|
|
23
|
-
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, }: PaymentLinkParams<CreatePaymentLinkSettings>) => string
|
|
29
|
+
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings>) => Promise<string>;
|
|
24
30
|
/**
|
|
25
31
|
* Redirects to the payment link creation flow with specified items.
|
|
26
32
|
*
|
|
27
33
|
* @param params - An object containing:
|
|
28
34
|
* - paymentLinkSettings: An object containing:
|
|
29
|
-
* - authUrl: The embed auth link retrieved from the Qonto API. Must be a valid URL.
|
|
30
35
|
* - items: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
36
|
+
* - callbackUrl: Required callback URL to redirect to after payment link creation.
|
|
37
|
+
* - operationSettings: An object with operation-level settings such as `proxyRequestFunction`, `accessToken`, `stagingToken`, etc.
|
|
31
38
|
*
|
|
32
39
|
* @example
|
|
33
40
|
* ```ts
|
|
34
|
-
*
|
|
41
|
+
* await redirectToPaymentLinkCreationFlow({
|
|
35
42
|
* paymentLinkSettings: {
|
|
36
|
-
*
|
|
37
|
-
*
|
|
43
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
44
|
+
* },
|
|
45
|
+
* operationSettings: {
|
|
46
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
47
|
+
* // Implement your proxy logic here
|
|
48
|
+
* },
|
|
38
49
|
* }
|
|
39
50
|
* });
|
|
40
51
|
* ```
|
|
41
|
-
* @returns
|
|
52
|
+
* @returns This function redirects the browser to the payment link creation flow. Due to the redirect, the returned promise will not resolve.
|
|
42
53
|
*
|
|
43
|
-
* @throws `InvalidParametersError` If the provided
|
|
54
|
+
* @throws `InvalidParametersError` If the provided items array is invalid or if callbackUrl is missing or invalid.
|
|
55
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
44
56
|
*/
|
|
45
|
-
export declare const redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, }: PaymentLinkParams<CreatePaymentLinkSettings>) => void
|
|
57
|
+
export declare const redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings>) => Promise<void>;
|
|
46
58
|
//# sourceMappingURL=payment-links.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-links.d.ts","sourceRoot":"","sources":["../../src/payment-links/payment-links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"payment-links.d.ts","sourceRoot":"","sources":["../../src/payment-links/payment-links.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAQ/B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,6BAA6B,GAAU,6CAGjD,iBAAiB,CAAC,yBAAyB,CAAC,KAAG,OAAO,CAAC,MAAM,CAsB/D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,iCAAiC,GAAU,6CAGrD,iBAAiB,CAAC,yBAAyB,CAAC,KAAG,OAAO,CAAC,IAAI,CAM7D,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const paymentLinks: {
|
|
2
|
-
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => string
|
|
2
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("./payment-links.types").PaymentLinkParams<import("./payment-links.types").CreatePaymentLinkSettings>) => Promise<string>;
|
|
3
3
|
};
|
|
4
4
|
export { paymentLinks };
|
|
5
5
|
//# sourceMappingURL=payment-links.public-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-links.types.d.ts","sourceRoot":"","sources":["../../src/payment-links/payment-links.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,MAAM,CAAC,CAAC,GAAG,MAAM;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,yBAAyB;IACxC,
|
|
1
|
+
{"version":3,"file":"payment-links.types.d.ts","sourceRoot":"","sources":["../../src/payment-links/payment-links.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAEnF,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,MAAM,CAAC,CAAC,GAAG,MAAM;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,mBAAmB,EAAE,CAAC,CAAC;IACvB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED,eAAO,MAAM,UAAU;;;CAGtB,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { type Item } from '../payment-links.types';
|
|
1
|
+
import { type Item, type CreatePaymentLinkSettings } from '../payment-links.types';
|
|
2
2
|
export declare function validateItems(items: Item[] | undefined): never[] | undefined;
|
|
3
|
-
export declare function validateAuthUrl(authUrl: string): void;
|
|
4
3
|
export declare const validateType: (type: string) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Validates payment link creation flow params to ensure callbackUrl is provided
|
|
6
|
+
*/
|
|
7
|
+
export declare function validatePaymentLinkCreationFlowParams(paymentLinkSettings: CreatePaymentLinkSettings | undefined): string;
|
|
5
8
|
//# sourceMappingURL=payment-links.validate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-links.validate.d.ts","sourceRoot":"","sources":["../../../src/payment-links/validation/payment-links.validate.ts"],"names":[],"mappings":"AAMA,OAAO,
|
|
1
|
+
{"version":3,"file":"payment-links.validate.d.ts","sourceRoot":"","sources":["../../../src/payment-links/validation/payment-links.validate.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAgBhC,wBAAgB,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,uBAqCtD;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,SAOxC,CAAC;AAEF;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,mBAAmB,EAAE,yBAAyB,GAAG,SAAS,GACzD,MAAM,CAaR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{validateItems as t,validatePaymentLinkCreationFlowParams as n}from"./validation/payment-links.validate.js";import{request as i}from"../auth-links/auth-links.js";import{AUTH_LINK_ACTIONS as o}from"../common/constants.js";const s=async({paymentLinkSettings:s,operationSettings:a})=>{const{items:r}=s;t(r);const e=n(s),m=await i({requestSettings:{action:o.PAYMENT_LINK_CREATE,callbackUrl:e},operationSettings:a}),c=new URLSearchParams({...r?{items:JSON.stringify(r)}:{}});return c.toString()?`${m.url}?${c.toString()}`:m.url};export{s as getPaymentLinkCreationFlowUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{validatePresenceOfRequiredParams as t,validateExpectedStringValues as e,validateExpectedNumericValues as r}from"../../validation/input-param-validation.js";import{InvalidParametersError as i}from"../../errors/InvalidParametersError.js";import{LINK_TYPES as a}from"../payment-links.types.js";import{validateCurrency as n}from"./currency.validation.js";import{validateUnit as c}from"./unit.validation.js";const l=[{name:"id"},{name:"title"},{name:"type"},{name:"quantity"},{name:"measureUnit"},{name:"unitPrice"},{name:"vatRate"}],o=[{name:"currency"},{name:"value"}];function m(a){if(!a||!Array.isArray(a))return[];a.forEach((a=>{t(a,l),t(a.unitPrice,o);const m=[...e({id:a.id,title:a.title,vatRate:a.vatRate,currency:a.unitPrice.currency,measureUnit:a.measureUnit,unitPrice:a.unitPrice.value,...a.description?{description:a.description}:{}}),...r({quantity:a.quantity})].flat();if(m.length>0)throw new i(m);u(a.type),n(a.unitPrice.currency),c(a.measureUnit)}))}const u=t=>{if(!Object.values(a).includes(t))throw new i(`type ${t} is not valid, valid types are ${Object.values(a).join(", ")}`)};function s(t){if(!t?.callbackUrl)throw new i("callbackUrl parameter is required for the payment link creation flow");if("string"!=typeof t.callbackUrl)throw new i("callbackUrl must be a string");if(""===t.callbackUrl.trim())throw new i("callbackUrl cannot be empty");return t.callbackUrl}export{m as validateItems,s as validatePaymentLinkCreationFlowParams,u as validateType};
|