@qonto/embed-sdk 0.62.0 → 0.64.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/beneficiaries/client/beneficiaries.client.d.ts.map +1 -1
- package/dist/cards/{cards.d.ts → client/cards.client.d.ts} +64 -89
- package/dist/cards/client/cards.client.d.ts.map +1 -0
- package/dist/cards/client/cards.client.test.d.ts +2 -0
- package/dist/cards/client/cards.client.test.d.ts.map +1 -0
- package/dist/cards/index.d.ts +40 -10
- package/dist/cards/index.d.ts.map +1 -1
- package/dist/cards/index.server.d.ts +41 -0
- package/dist/cards/index.server.d.ts.map +1 -0
- package/dist/cards/server/cards.server.d.ts +60 -0
- package/dist/cards/server/cards.server.d.ts.map +1 -0
- package/dist/cards/server/cards.server.test.d.ts +2 -0
- package/dist/cards/server/cards.server.test.d.ts.map +1 -0
- package/dist/cards/shared/cards.api.d.ts.map +1 -0
- package/dist/cards/shared/cards.constants.d.ts +11 -0
- package/dist/cards/shared/cards.constants.d.ts.map +1 -0
- package/dist/{server/cards → cards/shared}/cards.helper.d.ts +2 -0
- package/dist/cards/shared/cards.helper.d.ts.map +1 -0
- package/dist/cards/shared/cards.serializer.d.ts +35 -0
- package/dist/cards/shared/cards.serializer.d.ts.map +1 -0
- package/dist/cards/shared/cards.shared.test.d.ts +2 -0
- package/dist/cards/shared/cards.shared.test.d.ts.map +1 -0
- package/dist/cards/{cards.types.d.ts → shared/cards.types.d.ts} +3 -8
- package/dist/cards/shared/cards.types.d.ts.map +1 -0
- package/dist/cards/{cards.validate.d.ts → shared/cards.validate.d.ts} +1 -1
- package/dist/cards/shared/cards.validate.d.ts.map +1 -0
- package/dist/index.umd.js +1 -1
- package/dist/mocks/handlers.d.ts +1 -1
- package/dist/mocks/handlers.d.ts.map +1 -1
- package/dist/payment-links/client/payment-links.client.d.ts +95 -0
- package/dist/payment-links/client/payment-links.client.d.ts.map +1 -0
- package/dist/payment-links/client/payment-links.client.test.d.ts +2 -0
- package/dist/payment-links/client/payment-links.client.test.d.ts.map +1 -0
- package/dist/payment-links/index.d.ts +27 -6
- package/dist/payment-links/index.d.ts.map +1 -1
- package/dist/payment-links/index.server.d.ts +35 -0
- package/dist/payment-links/index.server.d.ts.map +1 -0
- package/dist/payment-links/server/payment-links.server.d.ts +50 -0
- package/dist/payment-links/server/payment-links.server.d.ts.map +1 -0
- package/dist/payment-links/server/payment-links.server.test.d.ts +2 -0
- package/dist/payment-links/server/payment-links.server.test.d.ts.map +1 -0
- package/dist/payment-links/shared/currency.validation.d.ts.map +1 -0
- package/dist/payment-links/shared/payment-links.shared.test.d.ts +2 -0
- package/dist/payment-links/shared/payment-links.shared.test.d.ts.map +1 -0
- package/dist/{server/payment-links → payment-links/shared}/payment-links.types.d.ts +2 -2
- package/dist/payment-links/shared/payment-links.types.d.ts.map +1 -0
- package/dist/payment-links/{validation → shared}/payment-links.validate.d.ts +1 -1
- package/dist/payment-links/shared/payment-links.validate.d.ts.map +1 -0
- package/dist/payment-links/shared/unit.validation.d.ts.map +1 -0
- package/dist/server/beneficiaries/client/beneficiaries.client.d.ts.map +1 -1
- package/dist/server/cards/{cards.d.ts → client/cards.client.d.ts} +64 -89
- package/dist/server/cards/client/cards.client.d.ts.map +1 -0
- package/dist/server/cards/client/cards.client.test.d.ts +2 -0
- package/dist/server/cards/client/cards.client.test.d.ts.map +1 -0
- package/dist/server/cards/index.d.ts +40 -10
- package/dist/server/cards/index.d.ts.map +1 -1
- package/dist/server/cards/index.server.d.ts +41 -0
- package/dist/server/cards/index.server.d.ts.map +1 -0
- package/dist/server/cards/server/cards.server.d.ts +60 -0
- package/dist/server/cards/server/cards.server.d.ts.map +1 -0
- package/dist/server/cards/server/cards.server.test.d.ts +2 -0
- package/dist/server/cards/server/cards.server.test.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.api.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.constants.d.ts +11 -0
- package/dist/server/cards/shared/cards.constants.d.ts.map +1 -0
- package/dist/{cards → server/cards/shared}/cards.helper.d.ts +2 -0
- package/dist/server/cards/shared/cards.helper.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.serializer.d.ts +35 -0
- package/dist/server/cards/shared/cards.serializer.d.ts.map +1 -0
- package/dist/server/cards/shared/cards.shared.test.d.ts +2 -0
- package/dist/server/cards/shared/cards.shared.test.d.ts.map +1 -0
- package/dist/server/cards/{cards.types.d.ts → shared/cards.types.d.ts} +3 -8
- package/dist/{cards → server/cards/shared}/cards.types.d.ts.map +1 -1
- package/dist/server/cards/{cards.validate.d.ts → shared/cards.validate.d.ts} +1 -1
- package/dist/server/cards/shared/cards.validate.d.ts.map +1 -0
- package/dist/server/mocks/handlers.d.ts +1 -1
- package/dist/server/mocks/handlers.d.ts.map +1 -1
- package/dist/server/payment-links/client/payment-links.client.d.ts +95 -0
- package/dist/server/payment-links/client/payment-links.client.d.ts.map +1 -0
- package/dist/server/payment-links/client/payment-links.client.test.d.ts +2 -0
- package/dist/server/payment-links/client/payment-links.client.test.d.ts.map +1 -0
- package/dist/server/payment-links/index.d.ts +27 -6
- package/dist/server/payment-links/index.d.ts.map +1 -1
- package/dist/server/payment-links/index.server.d.ts +35 -0
- package/dist/server/payment-links/index.server.d.ts.map +1 -0
- package/dist/server/payment-links/server/payment-links.server.d.ts +50 -0
- package/dist/server/payment-links/server/payment-links.server.d.ts.map +1 -0
- package/dist/server/payment-links/server/payment-links.server.test.d.ts +2 -0
- package/dist/server/payment-links/server/payment-links.server.test.d.ts.map +1 -0
- package/dist/server/payment-links/shared/currency.validation.d.ts.map +1 -0
- package/dist/server/payment-links/shared/payment-links.shared.test.d.ts +2 -0
- package/dist/server/payment-links/shared/payment-links.shared.test.d.ts.map +1 -0
- package/dist/{payment-links → server/payment-links/shared}/payment-links.types.d.ts +2 -2
- package/dist/server/payment-links/shared/payment-links.types.d.ts.map +1 -0
- package/dist/server/payment-links/{validation → shared}/payment-links.validate.d.ts +1 -1
- package/dist/server/payment-links/shared/payment-links.validate.d.ts.map +1 -0
- package/dist/server/payment-links/shared/unit.validation.d.ts.map +1 -0
- package/dist/server/types/types.public-api.d.ts +2 -2
- package/dist/server/types/types.public-api.d.ts.map +1 -1
- package/dist/server/validation/operation-settings-validation.d.ts +2 -1
- package/dist/server/validation/operation-settings-validation.d.ts.map +1 -1
- package/dist/src/auth-links/shared/auth-links.api.js +1 -1
- package/dist/src/beneficiaries/client/beneficiaries.client.js +1 -1
- package/dist/src/cards/client/cards.client.js +1 -0
- package/dist/src/cards/index.js +1 -1
- package/dist/src/cards/shared/cards.api.js +1 -0
- package/dist/src/cards/shared/cards.constants.js +1 -0
- package/dist/src/cards/shared/cards.helper.js +1 -0
- package/dist/src/cards/shared/cards.serializer.js +1 -0
- package/dist/src/cards/{cards.types.js → shared/cards.types.js} +1 -1
- package/dist/src/cards/shared/cards.validate.js +1 -0
- package/dist/src/payment-links/client/payment-links.client.js +1 -0
- package/dist/src/payment-links/index.js +1 -1
- package/dist/src/payment-links/shared/payment-links.validate.js +1 -0
- package/dist/types/types.public-api.d.ts +2 -2
- package/dist/types/types.public-api.d.ts.map +1 -1
- package/dist/validation/operation-settings-validation.d.ts +2 -1
- package/dist/validation/operation-settings-validation.d.ts.map +1 -1
- package/package.json +9 -1
- package/dist/cards/cards.api.d.ts.map +0 -1
- package/dist/cards/cards.d.ts.map +0 -1
- package/dist/cards/cards.helper.d.ts.map +0 -1
- package/dist/cards/cards.public-api.d.ts +0 -10
- package/dist/cards/cards.public-api.d.ts.map +0 -1
- package/dist/cards/cards.serializer.d.ts +0 -72
- package/dist/cards/cards.serializer.d.ts.map +0 -1
- package/dist/cards/cards.test.d.ts +0 -2
- package/dist/cards/cards.test.d.ts.map +0 -1
- package/dist/cards/cards.validate.d.ts.map +0 -1
- package/dist/payment-links/payment-links.d.ts +0 -58
- package/dist/payment-links/payment-links.d.ts.map +0 -1
- package/dist/payment-links/payment-links.public-api.d.ts +0 -5
- package/dist/payment-links/payment-links.public-api.d.ts.map +0 -1
- package/dist/payment-links/payment-links.test.d.ts +0 -2
- package/dist/payment-links/payment-links.test.d.ts.map +0 -1
- package/dist/payment-links/payment-links.types.d.ts.map +0 -1
- package/dist/payment-links/validation/currency.validation.d.ts.map +0 -1
- package/dist/payment-links/validation/payment-links.validate.d.ts.map +0 -1
- package/dist/payment-links/validation/unit.validation.d.ts.map +0 -1
- package/dist/server/cards/cards.api.d.ts.map +0 -1
- package/dist/server/cards/cards.d.ts.map +0 -1
- package/dist/server/cards/cards.helper.d.ts.map +0 -1
- package/dist/server/cards/cards.public-api.d.ts +0 -10
- package/dist/server/cards/cards.public-api.d.ts.map +0 -1
- package/dist/server/cards/cards.serializer.d.ts +0 -72
- package/dist/server/cards/cards.serializer.d.ts.map +0 -1
- package/dist/server/cards/cards.test.d.ts +0 -2
- package/dist/server/cards/cards.test.d.ts.map +0 -1
- package/dist/server/cards/cards.types.d.ts.map +0 -1
- package/dist/server/cards/cards.validate.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.d.ts +0 -58
- package/dist/server/payment-links/payment-links.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.public-api.d.ts +0 -5
- package/dist/server/payment-links/payment-links.public-api.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.test.d.ts +0 -2
- package/dist/server/payment-links/payment-links.test.d.ts.map +0 -1
- package/dist/server/payment-links/payment-links.types.d.ts.map +0 -1
- package/dist/server/payment-links/validation/currency.validation.d.ts.map +0 -1
- package/dist/server/payment-links/validation/payment-links.validate.d.ts.map +0 -1
- package/dist/server/payment-links/validation/unit.validation.d.ts.map +0 -1
- package/dist/src/auth-links/auth-links.js +0 -1
- package/dist/src/cards/cards.api.js +0 -1
- package/dist/src/cards/cards.helper.js +0 -1
- package/dist/src/cards/cards.js +0 -1
- package/dist/src/cards/cards.public-api.js +0 -1
- package/dist/src/cards/cards.serializer.js +0 -1
- package/dist/src/cards/cards.validate.js +0 -1
- package/dist/src/payment-links/payment-links.js +0 -1
- package/dist/src/payment-links/payment-links.public-api.js +0 -1
- package/dist/src/payment-links/validation/payment-links.validate.js +0 -1
- /package/dist/cards/{cards.api.d.ts → shared/cards.api.d.ts} +0 -0
- /package/dist/payment-links/{validation → shared}/currency.validation.d.ts +0 -0
- /package/dist/payment-links/{validation → shared}/unit.validation.d.ts +0 -0
- /package/dist/server/cards/{cards.api.d.ts → shared/cards.api.d.ts} +0 -0
- /package/dist/server/payment-links/{validation → shared}/currency.validation.d.ts +0 -0
- /package/dist/server/payment-links/{validation → shared}/unit.validation.d.ts +0 -0
- /package/dist/src/payment-links/{validation → shared}/currency.validation.js +0 -0
- /package/dist/src/payment-links/{payment-links.types.js → shared/payment-links.types.js} +0 -0
- /package/dist/src/payment-links/{validation → shared}/unit.validation.js +0 -0
package/dist/mocks/handlers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Beneficiary, BeneficiaryDataObject } from '@beneficiaries/shared/beneficiaries.types';
|
|
2
|
-
import type { CardDataObject } from '@cards/cards.types';
|
|
2
|
+
import type { CardDataObject } from '@cards/shared/cards.types';
|
|
3
3
|
import type { BankAccountDataObject, OrganizationDataObject } from '@organizations/shared/organizations.types';
|
|
4
4
|
import type { BulkTransferDataObject, BulkTransferSettings, NewBulkTransfer, NewBulkTransferWithBeneficiary } from '@sepa-transfers/bulk-transfers/shared/bulk-transfers.types';
|
|
5
5
|
import type { SepaTransferDataObject } from '@sepa-transfers/shared/sepa-transfers.types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/mocks/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAMhE,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,2CAA2C,CAAC;AAInD,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EAEpB,eAAe,EAEf,8BAA8B,EAC/B,MAAM,4DAA4D,CAAC;AAEpE,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAIrF,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAK3D,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA+BzD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,sBAchC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,qBAY/B,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;CAOlC,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,qBAAqB,EAe1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,sBAkBpC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAqBrE,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,sBAqBxC,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,sBAAsB,EAoBrE,CAAC;AAEF,eAAO,MAAM,wBAAwB,iEAC2B,CAAC;AAEjE,eAAO,MAAM,YAAY,EAAE,cAuD1B,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,qBA2CzC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,qBAAqB,EA8EzD,CAAC;AAGF,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,wBAAwB,EAAE,WAYtC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAKtC,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,8BAKnC,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,oBAAoB,CAAC,eAAe,CAI7E,CAAC;AAEJ,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;CAiB1C,CAAC;AAEF,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;CAiB7C,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAI/B,CAAC;AAEF,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,2BAA2B,eAAe,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;CAKlB,CAAC;AAEX,eAAO,MAAM,WAAW,6BA26BvB,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { ClientOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { CreatePaymentLinkSettings, PaymentLinkParams } from '../shared/payment-links.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates the URL for initiating a payment link creation flow with specified items.
|
|
5
|
+
*
|
|
6
|
+
* **Client-side only** - Uses proxy-based authentication.
|
|
7
|
+
* For server-side operations, import from `'@qonto/embed-sdk/server/payment-links'`.
|
|
8
|
+
*
|
|
9
|
+
* @param params - An object containing:
|
|
10
|
+
* - `paymentLinkSettings`: An object containing:
|
|
11
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
12
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
13
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
14
|
+
* `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
|
|
15
|
+
* @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.
|
|
16
|
+
* @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
|
|
17
|
+
* `proxyRequestFunction` is provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.
|
|
18
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
23
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
24
|
+
* paymentLinkSettings: {
|
|
25
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
26
|
+
* callbackUrl: 'https://example.com/callback',
|
|
27
|
+
* },
|
|
28
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```
|
|
34
|
+
* // Alternative: Using proxyRequestFunction
|
|
35
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
36
|
+
* paymentLinkSettings: {
|
|
37
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
38
|
+
* callbackUrl: 'https://example.com/callback',
|
|
39
|
+
* },
|
|
40
|
+
* operationSettings: {
|
|
41
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
42
|
+
* // Implement your proxy logic here
|
|
43
|
+
* },
|
|
44
|
+
* }
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ClientOperationSettings>) => Promise<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Redirects to the payment link creation flow with specified items.
|
|
51
|
+
*
|
|
52
|
+
* **Client-side only** - Uses proxy-based authentication and browser redirect.
|
|
53
|
+
* This function is not available in server-side imports.
|
|
54
|
+
*
|
|
55
|
+
* @param params - An object containing:
|
|
56
|
+
* - `paymentLinkSettings`: An object containing:
|
|
57
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
58
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
59
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
60
|
+
* `proxyEndpointDescriptor` (preferred) or `proxyRequestFunction` (at least one required).
|
|
61
|
+
* @returns This function redirects the browser to the payment link creation flow. Due to the redirect, the returned promise will not resolve.
|
|
62
|
+
* @throws `InvalidParametersError` If neither `proxyEndpointDescriptor` nor
|
|
63
|
+
* `proxyRequestFunction` is provided, or if the provided items array is invalid, or if callbackUrl is missing or invalid.
|
|
64
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```
|
|
68
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
69
|
+
* await paymentLinks.redirectToPaymentLinkCreationFlow({
|
|
70
|
+
* paymentLinkSettings: {
|
|
71
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
72
|
+
* callbackUrl: 'https://example.com/callback',
|
|
73
|
+
* },
|
|
74
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```
|
|
80
|
+
* // Alternative: Using proxyRequestFunction
|
|
81
|
+
* await paymentLinks.redirectToPaymentLinkCreationFlow({
|
|
82
|
+
* paymentLinkSettings: {
|
|
83
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
84
|
+
* callbackUrl: 'https://example.com/callback',
|
|
85
|
+
* },
|
|
86
|
+
* operationSettings: {
|
|
87
|
+
* proxyRequestFunction: async (encodedCall) => {
|
|
88
|
+
* // Implement your proxy logic here
|
|
89
|
+
* },
|
|
90
|
+
* }
|
|
91
|
+
* });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare const redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ClientOperationSettings>) => Promise<void>;
|
|
95
|
+
//# sourceMappingURL=payment-links.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.client.d.ts","sourceRoot":"","sources":["../../../src/payment-links/client/payment-links.client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAGzF,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,6BAA6B,GAAU,6CAGjD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,MAAM,CA6BjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,iCAAiC,GAAU,6CAGrD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,IAAI,CAMf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.client.test.d.ts","sourceRoot":"","sources":["../../../src/payment-links/client/payment-links.client.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The paymentLinks namespace contains all the functions related to
|
|
3
|
-
* operations such as starting the payment link creation flow.
|
|
2
|
+
* The paymentLinks namespace contains all the client-side functions related to payment link
|
|
3
|
+
* operations such as starting the payment link creation flow.
|
|
4
|
+
*
|
|
5
|
+
* **Client-side only** - This namespace uses proxy-based authentication
|
|
6
|
+
* (`proxyEndpointDescriptor` (preferred), or `proxyRequestFunction`).
|
|
7
|
+
*
|
|
8
|
+
* For server-side operations using access token, import from
|
|
9
|
+
* `'@qonto/embed-sdk/server/payment-links'`.
|
|
10
|
+
*
|
|
11
|
+
* It can be accessed like this:
|
|
4
12
|
* ```ts
|
|
5
|
-
* import { paymentLinks } from '@qonto/embed-sdk/
|
|
6
|
-
*
|
|
7
|
-
*
|
|
13
|
+
* import { paymentLinks } from '@qonto/embed-sdk/payment-links';
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Then, the paymentLinks object contains the functions to perform payment link operations:
|
|
17
|
+
* ```ts
|
|
18
|
+
* // Preferred: Using proxyEndpointDescriptor
|
|
19
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
20
|
+
* paymentLinkSettings: {
|
|
21
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
22
|
+
* callbackUrl: 'https://example.com/callback',
|
|
23
|
+
* },
|
|
24
|
+
* operationSettings: { proxyEndpointDescriptor }
|
|
25
|
+
* });
|
|
8
26
|
* ```
|
|
9
27
|
*/
|
|
10
28
|
export declare const paymentLinks: {
|
|
11
|
-
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import("
|
|
29
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ClientOperationSettings>) => Promise<string>;
|
|
30
|
+
redirectToPaymentLinkCreationFlow: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ClientOperationSettings>) => Promise<void>;
|
|
12
31
|
};
|
|
32
|
+
export type * from './shared/payment-links.types';
|
|
33
|
+
export type { ClientOperationSettings, ClientOperationSettingsWithUI, } from '@validation/operation-settings-validation';
|
|
13
34
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/payment-links/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/payment-links/index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY;;;CAGxB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EACV,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The paymentLinks namespace contains all the server-side functions related to payment link operations.
|
|
3
|
+
* This version uses access token-based authentication and is designed for server environments.
|
|
4
|
+
*
|
|
5
|
+
* **Server-side only** - This namespace uses access token-based authentication.
|
|
6
|
+
*
|
|
7
|
+
* For client-side operations using proxy functions, import from `'@qonto/embed-sdk/payment-links'`.
|
|
8
|
+
*
|
|
9
|
+
* **Note:** The `redirectToPaymentLinkCreationFlow` function is not available in the server-side
|
|
10
|
+
* implementation as it requires browser-specific APIs (`window.location.href`).
|
|
11
|
+
*
|
|
12
|
+
* It can be accessed like this:
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { paymentLinks } from '@qonto/embed-sdk/server/payment-links';
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Then, the paymentLinks object contains the functions to perform payment link operations:
|
|
18
|
+
* ```ts
|
|
19
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
20
|
+
* paymentLinkSettings: {
|
|
21
|
+
* items: [{ id: '1', title: 'Item 1', type: 'service', quantity: 1, measureUnit: 'unit', unitPrice: { currency: 'EUR', value: '10' }, vatRate: '20' }],
|
|
22
|
+
* callbackUrl: 'https://example.com/callback',
|
|
23
|
+
* },
|
|
24
|
+
* operationSettings: {
|
|
25
|
+
* accessToken: 'your-access-token',
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const paymentLinks: {
|
|
31
|
+
getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: import(".").PaymentLinkParams<import(".").CreatePaymentLinkSettings, import("@validation/operation-settings-validation").ServerOperationSettings>) => Promise<string>;
|
|
32
|
+
};
|
|
33
|
+
export type * from './shared/payment-links.types';
|
|
34
|
+
export type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
35
|
+
//# sourceMappingURL=index.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../src/payment-links/index.server.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,YAAY;;CAExB,CAAC;AAGF,mBAAmB,8BAA8B,CAAC;AAClD,YAAY,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ServerOperationSettings } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { CreatePaymentLinkSettings, PaymentLinkParams } from '../shared/payment-links.types';
|
|
3
|
+
/**
|
|
4
|
+
* Generates the URL for initiating a payment link creation flow with specified items.
|
|
5
|
+
*
|
|
6
|
+
* **Server-side implementation** - Uses access token-based authentication.
|
|
7
|
+
* This implementation is designed for server environments where access tokens can be safely managed.
|
|
8
|
+
*
|
|
9
|
+
* For client-side operations using proxy functions, import from `'@qonto/embed-sdk/payment-links'`.
|
|
10
|
+
*
|
|
11
|
+
* @param params - An object containing:
|
|
12
|
+
* - `paymentLinkSettings`: An object containing:
|
|
13
|
+
* - `items`: An array of items to be included in the payment link. Each item must conform to the Item type and will be validated.
|
|
14
|
+
* - `callbackUrl`: Required callback URL to redirect to after payment link creation.
|
|
15
|
+
* - `operationSettings`: An object with operation-level settings such as
|
|
16
|
+
* `accessToken`, `stagingToken`, and other optional parameters.
|
|
17
|
+
* See {@link ServerOperationSettings}.
|
|
18
|
+
* @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.
|
|
19
|
+
* @throws `InvalidParametersError` If the provided items array is invalid or if callbackUrl is missing or invalid.
|
|
20
|
+
* @throws `AuthenticationError` If authentication fails (e.g., invalid or missing access token).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* import { paymentLinks } from '@qonto/embed-sdk/server/payment-links';
|
|
25
|
+
*
|
|
26
|
+
* const url = await paymentLinks.getPaymentLinkCreationFlowUrl({
|
|
27
|
+
* paymentLinkSettings: {
|
|
28
|
+
* items: [
|
|
29
|
+
* {
|
|
30
|
+
* id: '1',
|
|
31
|
+
* title: 'Item 1',
|
|
32
|
+
* type: 'service',
|
|
33
|
+
* quantity: 1,
|
|
34
|
+
* measureUnit: 'unit',
|
|
35
|
+
* unitPrice: { currency: 'EUR', value: '10' },
|
|
36
|
+
* vatRate: '20'
|
|
37
|
+
* }
|
|
38
|
+
* ],
|
|
39
|
+
* callbackUrl: 'https://example.com/callback',
|
|
40
|
+
* },
|
|
41
|
+
* operationSettings: {
|
|
42
|
+
* accessToken: 'your-access-token',
|
|
43
|
+
* }
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @see For client-side implementation using proxyEndpointDescriptor, import from `@qonto/embed-sdk/payment-links`
|
|
48
|
+
*/
|
|
49
|
+
export declare const getPaymentLinkCreationFlowUrl: ({ paymentLinkSettings, operationSettings, }: PaymentLinkParams<CreatePaymentLinkSettings, ServerOperationSettings>) => Promise<string>;
|
|
50
|
+
//# sourceMappingURL=payment-links.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.server.d.ts","sourceRoot":"","sources":["../../../src/payment-links/server/payment-links.server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEzF,OAAO,KAAK,EACV,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,+BAA+B,CAAC;AAMvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,6BAA6B,GAAU,6CAGjD,iBAAiB,CAClB,yBAAyB,EACzB,uBAAuB,CACxB,KAAG,OAAO,CAAC,MAAM,CAsBjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.server.test.d.ts","sourceRoot":"","sources":["../../../src/payment-links/server/payment-links.server.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.validation.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/currency.validation.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,SAMhD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.shared.test.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/payment-links.shared.test.ts"],"names":[],"mappings":""}
|
|
@@ -17,9 +17,9 @@ export interface CreatePaymentLinkSettings {
|
|
|
17
17
|
items?: Item[];
|
|
18
18
|
callbackUrl?: string;
|
|
19
19
|
}
|
|
20
|
-
export interface PaymentLinkParams<T> {
|
|
20
|
+
export interface PaymentLinkParams<T, O = OperationSettings> {
|
|
21
21
|
paymentLinkSettings: T;
|
|
22
|
-
operationSettings?:
|
|
22
|
+
operationSettings?: O;
|
|
23
23
|
}
|
|
24
24
|
export declare const LINK_TYPES: {
|
|
25
25
|
GOOD: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.types.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/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,EAAE,CAAC,GAAG,iBAAiB;IACzD,mBAAmB,EAAE,CAAC,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,CAAC;CACvB;AAED,eAAO,MAAM,UAAU;;;CAGtB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CreatePaymentLinkSettings, type Item } from '
|
|
1
|
+
import { type CreatePaymentLinkSettings, type Item } from './payment-links.types';
|
|
2
2
|
export declare function validateItems(items: Item[] | undefined): never[] | undefined;
|
|
3
3
|
export declare const validateType: (type: string) => void;
|
|
4
4
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-links.validate.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/payment-links.validate.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,IAAI,EAEV,MAAM,uBAAuB,CAAC;AAgB/B,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit.validation.d.ts","sourceRoot":"","sources":["../../../src/payment-links/shared/unit.validation.ts"],"names":[],"mappings":"AAgDA,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,SAMxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"beneficiaries.client.d.ts","sourceRoot":"","sources":["../../../../src/beneficiaries/client/beneficiaries.client.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAGnC,MAAM,2CAA2C,CAAC;AAWnD,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAQvC;;;;GAIG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B,CAAC,CAAC;IAC9C,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,6BAA6B,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,uBAAuB,CAAC,KAAK,CAAC,GACtD,OAAO,CAAC,wBAAwB,CAAC,
|
|
1
|
+
{"version":3,"file":"beneficiaries.client.d.ts","sourceRoot":"","sources":["../../../../src/beneficiaries/client/beneficiaries.client.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAGnC,MAAM,2CAA2C,CAAC;AAWnD,OAAO,KAAK,EACV,WAAW,EAEX,6BAA6B,EAC7B,wBAAwB,EACxB,cAAc,EACf,MAAM,+BAA+B,CAAC;AAQvC;;;;GAIG;AACH,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B,CAAC,CAAC;IAC9C,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,iBAAiB,CAAC,EAAE,6BAA6B,CAAC;CACnD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,sBAAsB,CAAC,EAAE,uBAAuB,CAAC,KAAK,CAAC,GACtD,OAAO,CAAC,wBAAwB,CAAC,CAkCnC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAuB3E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAAC,EACnC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAyBhE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CAAC,EACtC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC,6BAA6B,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CA+B/E;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,kBAAkB,CAAC,EACvC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,6BAA6B,CAAC;IAC/B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAwB1B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CAAC,EACzC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE,uBAAuB,CAAC;IAAE,cAAc,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,GAAG,OAAO,CAChE,WAAW,EAAE,CACd,CAuBA"}
|
|
@@ -1,101 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ClientOperationSettings, ClientOperationSettingsWithUI } from '@validation/operation-settings-validation';
|
|
2
|
+
import type { Card, CardOrderSettings, DisplayCardReturnObject, DisplayCardSettings, UnlockCardSettings } from '../shared/cards.types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* their only parameter. It consists of a `cardSettings` object and an optional
|
|
6
|
-
* `operationSettings` object. The `cardSettings` object's properties will be
|
|
7
|
-
* different depending on the function being called. Read the docs of each card
|
|
8
|
-
* related function to see the expected properties of the `cardSettings` object.
|
|
9
|
-
* The `operationSettings` object can include a `proxyRequestFunction` which allows
|
|
10
|
-
* the SDK to operate without needing an access token in the client. This is the
|
|
11
|
-
* recommended approach for production environments to avoid exposing sensitive tokens.
|
|
4
|
+
* Generic parameter type for client-side card operations
|
|
12
5
|
*/
|
|
13
|
-
export interface
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
export interface CardClientParams<T> {
|
|
7
|
+
cardSettings?: T;
|
|
8
|
+
operationSettings?: ClientOperationSettings;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generic parameter type for client-side card operations that require UI
|
|
12
|
+
*/
|
|
13
|
+
export interface CardClientParamsWithUI<T> {
|
|
18
14
|
cardSettings: T;
|
|
19
|
-
|
|
20
|
-
* Optional operation settings that can include:
|
|
21
|
-
* - `proxyRequestFunction`: A function that allows the SDK to make requests through your server
|
|
22
|
-
* to avoid exposing sensitive tokens in the client. This is the recommended approach.
|
|
23
|
-
* - `accessToken`: An access token for direct API calls (not recommended for client-side code)
|
|
24
|
-
* - `stagingToken`: A token for testing in staging environments
|
|
25
|
-
* - Other operation-specific settings
|
|
26
|
-
*/
|
|
27
|
-
operationSettings?: OperationSettings;
|
|
15
|
+
operationSettings: ClientOperationSettingsWithUI;
|
|
28
16
|
}
|
|
29
17
|
/**
|
|
30
|
-
* Fetches the list of cards for the current user.
|
|
18
|
+
* Fetches the list of cards for the current user (client-side version).
|
|
19
|
+
*
|
|
20
|
+
* This function uses proxy-based authentication and is designed for browser environments.
|
|
21
|
+
* It requires either `proxyEndpointDescriptor` or `proxyRequestFunction` in operationSettings.
|
|
22
|
+
*
|
|
31
23
|
* @param getCardsParams - An object with optional parameters:
|
|
32
24
|
* - `cardSettings`: An object that can contain the optional `membershipId` property.
|
|
33
|
-
* - `operationSettings`: An object with
|
|
34
|
-
*
|
|
35
|
-
* `accessToken`, `stagingToken`, and other optional parameters.
|
|
36
|
-
* See {@link OperationSettings} for more details.
|
|
37
|
-
* If the `membershipId` parameter is passed, the function will return the cards
|
|
38
|
-
* that belong to the specified membership only.
|
|
39
|
-
* If the `accessToken` is not provided, the function will use the token previously
|
|
40
|
-
* passed to the initialize function. The `stagingToken` is optional, but it has
|
|
41
|
-
* to be passed to use the SDK in staging environments (it will be ignored in production).
|
|
25
|
+
* - `operationSettings`: An object with `proxyEndpointDescriptor` or `proxyRequestFunction`
|
|
26
|
+
* (required), `stagingToken`, and other optional parameters.
|
|
42
27
|
* @returns A promise that resolves to an array of cards.
|
|
43
|
-
* @throws `
|
|
44
|
-
*
|
|
28
|
+
* @throws `InvalidParametersError` If neither proxyEndpointDescriptor nor proxyRequestFunction
|
|
29
|
+
* is provided, or if membershipId is invalid.
|
|
45
30
|
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
46
31
|
*/
|
|
47
|
-
export declare function getCards(getCardsParams?:
|
|
32
|
+
export declare function getCards(getCardsParams?: CardClientParams<{
|
|
48
33
|
membershipId?: string;
|
|
49
34
|
}>): Promise<Card[]>;
|
|
50
35
|
/**
|
|
51
|
-
* Fetches a card by its id.
|
|
36
|
+
* Fetches a card by its id (client-side version).
|
|
37
|
+
*
|
|
38
|
+
* This function uses proxy-based authentication and is designed for browser environments.
|
|
39
|
+
* It requires either `proxyRequestFunction` or `proxyEndpointDescriptor` in operationSettings.
|
|
40
|
+
*
|
|
52
41
|
* @param getCardParams - An object containing:
|
|
53
42
|
* - `cardSettings`: An object with the `cardId` property (string).
|
|
54
|
-
* - `operationSettings`: An object with
|
|
55
|
-
*
|
|
56
|
-
* `accessToken`, `stagingToken`, and other optional
|
|
57
|
-
* parameters. See {@link CardParams}.
|
|
43
|
+
* - `operationSettings`: An object with `proxyRequestFunction` or `proxyEndpointDescriptor`
|
|
44
|
+
* (required), `stagingToken`, and other optional parameters.
|
|
58
45
|
* @returns A promise that resolves to a card.
|
|
59
46
|
* @throws `InvalidParametersError` If the cardId is not provided, not a string, or
|
|
60
|
-
* if
|
|
61
|
-
* @throws `AuthenticationError` If both the `proxyRequestFunction` and
|
|
62
|
-
* `accessToken` are invalid or missing within `operationSettings`.
|
|
47
|
+
* if neither proxyRequestFunction nor proxyEndpointDescriptor is provided.
|
|
63
48
|
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
64
49
|
*/
|
|
65
|
-
export declare function getCard({ cardSettings, operationSettings, }:
|
|
66
|
-
|
|
67
|
-
|
|
50
|
+
export declare function getCard({ cardSettings, operationSettings, }: {
|
|
51
|
+
cardSettings: {
|
|
52
|
+
cardId: string;
|
|
53
|
+
};
|
|
54
|
+
operationSettings?: ClientOperationSettings;
|
|
55
|
+
}): Promise<Card>;
|
|
68
56
|
/**
|
|
69
|
-
* Requests the creation of a card by showing the user the UI to perform MFA in the calling page.
|
|
57
|
+
* Requests the creation of a card by showing the user the UI to perform MFA in the calling page (client-side only).
|
|
58
|
+
*
|
|
59
|
+
* This function is only available in client-side environments as it requires UI rendering.
|
|
70
60
|
* It will show an element on the screen where users will be able to go through the MFA
|
|
71
61
|
* authentication process and upon successful authentication, will perform the ordering operation.
|
|
62
|
+
*
|
|
72
63
|
* @param cardConfig - An object containing:
|
|
73
64
|
* - `cardSettings`: An object with the card order parameters (see examples below).
|
|
74
65
|
* - `operationSettings`: Required settings to configure this operation. Must include
|
|
75
66
|
* `uiParentElementId` to specify where the UI will be rendered. Also supports
|
|
76
67
|
* `accessToken`, `stagingToken`, `mfaPreference`, `debugMode`, and other properties.
|
|
77
|
-
* See {@link OperationSettings} for details.
|
|
78
68
|
* @returns A promise that resolves to an object representing the ordered card.
|
|
79
|
-
* @throws `InvalidParametersError` If `uiParentElementId` is missing
|
|
80
|
-
* settings are invalid
|
|
69
|
+
* @throws `InvalidParametersError` If `uiParentElementId` is missing or if the card
|
|
70
|
+
* settings are invalid.
|
|
81
71
|
* @throws `AuthenticationError` If the `accessToken` is invalid or missing.
|
|
82
72
|
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
73
|
+
*
|
|
83
74
|
* @example Ordering a physical card to be shipped to the org's business address
|
|
84
75
|
* ```ts
|
|
85
76
|
* const cardConfig = {
|
|
86
77
|
* cardSettings: {
|
|
87
|
-
* categories: [
|
|
88
|
-
* 'transport',
|
|
89
|
-
* 'restaurant_and_bar',
|
|
90
|
-
* 'food_and_grocery',
|
|
91
|
-
* 'it_and_electronics',
|
|
92
|
-
* 'utility',
|
|
93
|
-
* 'tax',
|
|
94
|
-
* 'legal_and_accounting',
|
|
95
|
-
* 'atm', 'office_supply',
|
|
96
|
-
* 'hardware_and_equipment',
|
|
97
|
-
* 'finance'
|
|
98
|
-
* ],
|
|
78
|
+
* categories: ['transport', 'restaurant_and_bar', 'food_and_grocery'],
|
|
99
79
|
* membershipId: 'membership-id',
|
|
100
80
|
* cardLevel: 'standard', // Other options are 'plus' or 'metal'
|
|
101
81
|
* cardDesign: 'standard.recycled.plastic.2023',
|
|
@@ -126,18 +106,7 @@ export declare function getCard({ cardSettings, operationSettings, }: CardParams
|
|
|
126
106
|
* ```ts
|
|
127
107
|
* const cardConfig = {
|
|
128
108
|
* cardSettings: {
|
|
129
|
-
* categories: [
|
|
130
|
-
* 'transport',
|
|
131
|
-
* 'restaurant_and_bar',
|
|
132
|
-
* 'food_and_grocery',
|
|
133
|
-
* 'it_and_electronics',
|
|
134
|
-
* 'utility',
|
|
135
|
-
* 'tax',
|
|
136
|
-
* 'legal_and_accounting',
|
|
137
|
-
* 'atm', 'office_supply',
|
|
138
|
-
* 'hardware_and_equipment',
|
|
139
|
-
* 'finance'
|
|
140
|
-
* ],
|
|
109
|
+
* categories: ['transport', 'restaurant_and_bar', 'food_and_grocery'],
|
|
141
110
|
* membershipId: 'membership-id',
|
|
142
111
|
* cardLevel: 'virtual',
|
|
143
112
|
* monthlyLimit: 1300,
|
|
@@ -153,22 +122,25 @@ export declare function getCard({ cardSettings, operationSettings, }: CardParams
|
|
|
153
122
|
* orderCard(cardConfig);
|
|
154
123
|
* ```
|
|
155
124
|
*/
|
|
156
|
-
export declare function orderCard(cardConfig:
|
|
125
|
+
export declare function orderCard(cardConfig: CardClientParamsWithUI<CardOrderSettings>): Promise<Card>;
|
|
157
126
|
/**
|
|
158
|
-
* Unlocks a locked card by showing the user the UI to perform MFA in the calling page.
|
|
127
|
+
* Unlocks a locked card by showing the user the UI to perform MFA in the calling page (client-side only).
|
|
128
|
+
*
|
|
129
|
+
* This function is only available in client-side environments as it requires UI rendering.
|
|
159
130
|
* It will show an element on the screen where users will be able to go through the MFA
|
|
160
131
|
* authentication process and upon successful authentication, will perform the unlock operation.
|
|
132
|
+
*
|
|
161
133
|
* @param cardConfig - An object containing:
|
|
162
134
|
* - `cardSettings`: An object with the `cardId` property (string).
|
|
163
135
|
* - `operationSettings`: Required settings to configure this operation. Must include
|
|
164
136
|
* `uiParentElementId` to specify where the UI will be rendered. Also supports
|
|
165
137
|
* `accessToken`, `stagingToken`, `mfaPreference`, `debugMode`, and other properties.
|
|
166
|
-
* See {@link OperationSettings} for details.
|
|
167
138
|
* @returns A promise that resolves to an object representing the unlocked card.
|
|
168
|
-
* @throws `InvalidParametersError` If `uiParentElementId` is missing
|
|
169
|
-
* is not provided or not a string
|
|
139
|
+
* @throws `InvalidParametersError` If `uiParentElementId` is missing or if the cardId
|
|
140
|
+
* is not provided or not a string.
|
|
170
141
|
* @throws `AuthenticationError` If the `accessToken` is invalid or missing.
|
|
171
142
|
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
143
|
+
*
|
|
172
144
|
* @example
|
|
173
145
|
* ```ts
|
|
174
146
|
* const cardConfig = {
|
|
@@ -182,24 +154,27 @@ export declare function orderCard(cardConfig: CardParams<CardOrderSettings>): Pr
|
|
|
182
154
|
* const unlockedCard = await unlockCard(cardConfig);
|
|
183
155
|
* ```
|
|
184
156
|
*/
|
|
185
|
-
export declare function unlockCard(cardConfig:
|
|
157
|
+
export declare function unlockCard(cardConfig: CardClientParamsWithUI<UnlockCardSettings>): Promise<Card>;
|
|
186
158
|
/**
|
|
187
159
|
* Displays a Cards UI in the calling page which allows the user to see card details and perform
|
|
188
|
-
* some operations.
|
|
160
|
+
* some operations (client-side only).
|
|
161
|
+
*
|
|
162
|
+
* This function is only available in client-side environments as it requires UI rendering.
|
|
163
|
+
* It supports both proxy-based and access token-based authentication.
|
|
164
|
+
*
|
|
189
165
|
* @param cardConfig - An object containing:
|
|
190
166
|
* - `cardSettings`: An object with the `cardId` property (string).
|
|
191
167
|
* - `operationSettings`: Required settings to configure this operation. Must include
|
|
192
168
|
* `uiParentElementId` to specify where the UI will be rendered. Also supports
|
|
193
169
|
* `proxyRequestFunction` (recommended for production to avoid exposing tokens),
|
|
194
|
-
* `accessToken`, `stagingToken`, and other properties.
|
|
195
|
-
* for details.
|
|
170
|
+
* `accessToken`, `stagingToken`, and other properties.
|
|
196
171
|
* @returns A promise that resolves to an object with a `destroyEmbedUI` function. When calling
|
|
197
172
|
* this function, the UI will be removed from the DOM.
|
|
198
|
-
* @throws `InvalidParametersError` If `uiParentElementId` is missing
|
|
199
|
-
* is not provided or not a string
|
|
173
|
+
* @throws `InvalidParametersError` If `uiParentElementId` is missing or if the cardId
|
|
174
|
+
* is not provided or not a string.
|
|
200
175
|
* @throws `AuthenticationError` If both `proxyRequestFunction` and `accessToken`
|
|
201
176
|
* are invalid or missing.
|
|
202
177
|
* @throws `EmbedApiError` If the API request fails or returns an error.
|
|
203
178
|
*/
|
|
204
|
-
export declare function displayCard(cardConfig:
|
|
205
|
-
//# sourceMappingURL=cards.d.ts.map
|
|
179
|
+
export declare function displayCard(cardConfig: CardClientParamsWithUI<DisplayCardSettings>): Promise<DisplayCardReturnObject>;
|
|
180
|
+
//# sourceMappingURL=cards.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cards.client.d.ts","sourceRoot":"","sources":["../../../../src/cards/client/cards.client.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,uBAAuB,EACvB,6BAA6B,EAE9B,MAAM,2CAA2C,CAAC;AAgBnD,OAAO,KAAK,EACV,IAAI,EAEJ,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAW/B;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC;IACvC,YAAY,EAAE,CAAC,CAAC;IAChB,iBAAiB,EAAE,6BAA6B,CAAC;CAClD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,QAAQ,CAC5B,cAAc,CAAC,EAAE,gBAAgB,CAAC;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAC3D,OAAO,CAAC,IAAI,EAAE,CAAC,CA8BjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,OAAO,CAAC,EAC5B,YAAY,EACZ,iBAAiB,GAClB,EAAE;IACD,YAAY,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACjC,iBAAiB,CAAC,EAAE,uBAAuB,CAAC;CAC7C,GAAG,OAAO,CAAC,IAAI,CAAC,CA6BhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,wBAAsB,SAAS,CAC7B,UAAU,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,GACpD,OAAO,CAAC,IAAI,CAAC,CAoCf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,UAAU,CAC9B,UAAU,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,GACrD,OAAO,CAAC,IAAI,CAAC,CA2Bf;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAC/B,UAAU,EAAE,sBAAsB,CAAC,mBAAmB,CAAC,GACtD,OAAO,CAAC,uBAAuB,CAAC,CAwDlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cards.client.test.d.ts","sourceRoot":"","sources":["../../../../src/cards/client/cards.client.test.ts"],"names":[],"mappings":""}
|