@lydianpay/sdk-web 3.15.4 → 3.16.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/chunks/{browser-DNsXaImz.js → browser-CvvbM3fl.js} +1 -1
- package/dist/chunks/{connect-multichain-Ca3bMak3.js → connect-multichain-JrYKtq5o.js} +9 -9
- package/dist/chunks/{index-CcN4gJw2.js → index-Bwl_cWLK.js} +1 -1
- package/dist/chunks/{index-VdHF6yby.js → index-CD8P_mOo.js} +2 -2
- package/dist/chunks/{index-CcZ7kGqa.js → index-DAsQ6TuK.js} +1 -1
- package/dist/chunks/{index-9_6otDrw.js → index-DFLPr81C.js} +3 -3
- package/dist/chunks/{index-CwJ0YzMA.js → index-DGLVpgOJ.js} +2 -2
- package/dist/chunks/{index-ItSygWuh.js → index-GdvVEXe8.js} +318 -247
- package/dist/chunks/{mountEngine-B721ZzjQ.js → mountEngine-B9qRQyLg.js} +11153 -10944
- package/dist/lydian.js +1 -1
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/network/gatewayRequestError.d.ts +9 -0
- package/dist/types/network/session/index.d.ts +2 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/ui/failureReport.d.ts +3 -1
- package/dist/types/ui/flowConfig.d.ts +1 -0
- package/dist/types/ui/react/AlertBanner.d.ts +1 -1
- package/dist/types/ui/react/CheckboxField.d.ts +8 -0
- package/dist/types/ui/react/EmailReceiptCard/EmailReceiptCard.d.ts +4 -0
- package/dist/types/ui/react/EmailReceiptCard/EmailReceiptForm.d.ts +7 -0
- package/dist/types/ui/react/EmailReceiptCard/emailReceiptHelpers.d.ts +7 -0
- package/dist/types/ui/react/EmailReceiptCard/useEmailReceiptSender.d.ts +7 -0
- package/dist/types/ui/react/FormField.d.ts +2 -1
- package/dist/types/ui/react/checkoutStore.d.ts +2 -1
- package/dist/types/ui/sessionBootstrap.d.ts +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class GatewayRequestError extends Error {
|
|
2
|
+
readonly errorCode: number | undefined;
|
|
3
|
+
constructor({ statusText, errorCode, response, }: {
|
|
4
|
+
statusText: string;
|
|
5
|
+
errorCode: number | undefined;
|
|
6
|
+
response?: Response;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export declare function toGatewayRequestError(response: Response): Promise<GatewayRequestError>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Base } from '../base';
|
|
2
|
-
import { CreateSessionRequest, CreateSessionResponse, CreateSessionTransactionRequest, CreateTransactionResponse, GetSessionResponse } from '../../types';
|
|
2
|
+
import { CreateSessionRequest, CreateSessionResponse, CreateSessionTransactionRequest, CreateTransactionResponse, GetSessionResponse, SendReceiptRequest } from '../../types';
|
|
3
3
|
export declare class Sessions extends Base {
|
|
4
4
|
createSession(newSession: CreateSessionRequest): Promise<CreateSessionResponse>;
|
|
5
5
|
getSession(sessionID: string): Promise<GetSessionResponse>;
|
|
6
6
|
createSessionTransaction(sessionID: string, sessionTransaction: CreateSessionTransactionRequest): Promise<CreateTransactionResponse>;
|
|
7
7
|
cancelSession(sessionID: string): Promise<string>;
|
|
8
|
+
sendReceipt(sessionID: string, receipt: SendReceiptRequest): Promise<void>;
|
|
8
9
|
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -193,6 +193,11 @@ export type CreateSessionTransactionRequest = {
|
|
|
193
193
|
network: string;
|
|
194
194
|
customerUUID?: string;
|
|
195
195
|
};
|
|
196
|
+
export type SendReceiptRequest = {
|
|
197
|
+
email: string;
|
|
198
|
+
marketingOptIn: boolean;
|
|
199
|
+
consentTextVersion: string;
|
|
200
|
+
};
|
|
196
201
|
export type CalculatedTotals = {
|
|
197
202
|
cryptoCurrency: string;
|
|
198
203
|
baseAmountCrypto: number;
|
|
@@ -346,6 +351,7 @@ export type CheckoutFlow = {
|
|
|
346
351
|
hideNoWalletOption?: boolean;
|
|
347
352
|
showApprovalPage?: boolean;
|
|
348
353
|
hideChangePaymentMethod?: boolean;
|
|
354
|
+
hideEmailReceipt?: boolean;
|
|
349
355
|
};
|
|
350
356
|
export type CheckoutConfig = {
|
|
351
357
|
logoURL?: string;
|
|
@@ -9,5 +9,7 @@ export declare function failureReport({ message, reason, shouldEndCheckout, tran
|
|
|
9
9
|
shouldEndCheckout: boolean;
|
|
10
10
|
/** The transaction the failure is about, when there is one. */
|
|
11
11
|
transactionID?: string;
|
|
12
|
-
session:
|
|
12
|
+
session: {
|
|
13
|
+
failureURL?: GetSessionResponse['failureURL'];
|
|
14
|
+
} | null;
|
|
13
15
|
}): FailureReport;
|
|
@@ -6,5 +6,6 @@ export type CheckoutFlowSettings = {
|
|
|
6
6
|
showApprovalPage: boolean;
|
|
7
7
|
hideOtherWallets: boolean;
|
|
8
8
|
hideChangePaymentMethod: boolean;
|
|
9
|
+
hideEmailReceipt: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare function resolveFlow(accountFlow?: CheckoutFlow, embedFlow?: InitFlowOptions): CheckoutFlowSettings;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export default function CheckboxField({ id, isChecked, onChange, describedBy, children, }: {
|
|
3
|
+
id: string;
|
|
4
|
+
isChecked: boolean;
|
|
5
|
+
onChange: (isChecked: boolean) => void;
|
|
6
|
+
describedBy?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ReceiptDetails } from './emailReceiptHelpers';
|
|
3
|
+
export default function EmailReceiptForm({ isSending, failureMessage, onSend, }: {
|
|
4
|
+
isSending: boolean;
|
|
5
|
+
failureMessage: string | null;
|
|
6
|
+
onSend: (receipt: ReceiptDetails) => void;
|
|
7
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GetSessionResponse, SendReceiptRequest } from '../../../types';
|
|
2
|
+
export declare const RECEIPT_MARKETING_CONSENT_VERSION = "receipt-marketing-v1";
|
|
3
|
+
export declare const MAX_EMAIL_ADDRESS_LENGTH = 254;
|
|
4
|
+
export type ReceiptDetails = Omit<SendReceiptRequest, 'consentTextVersion'>;
|
|
5
|
+
export declare function isEmailReceiptOffered(session: GetSessionResponse | null): session is GetSessionResponse;
|
|
6
|
+
export declare function buildReceiptRequest({ email, marketingOptIn }: ReceiptDetails): SendReceiptRequest;
|
|
7
|
+
export declare function getReceiptFailureMessage(error: unknown): string;
|
|
@@ -6,7 +6,7 @@ export declare function FieldShell({ id, label, labelFor, error, children, }: {
|
|
|
6
6
|
error?: string;
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}): React.JSX.Element;
|
|
9
|
-
export default function FormField({ id, label, placeholder, value, onChange, type, autoComplete, error, inputRef, }: {
|
|
9
|
+
export default function FormField({ id, label, placeholder, value, onChange, type, autoComplete, maxLength, error, inputRef, }: {
|
|
10
10
|
id: string;
|
|
11
11
|
label: string;
|
|
12
12
|
placeholder: string;
|
|
@@ -14,6 +14,7 @@ export default function FormField({ id, label, placeholder, value, onChange, typ
|
|
|
14
14
|
onChange: (value: string) => void;
|
|
15
15
|
type?: string;
|
|
16
16
|
autoComplete?: string;
|
|
17
|
+
maxLength?: number;
|
|
17
18
|
error?: string;
|
|
18
19
|
inputRef?: React.Ref<HTMLInputElement>;
|
|
19
20
|
}): React.JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTransactionResponse, InitFlowOptions, WalletConnectWallet } from '../../types';
|
|
1
|
+
import type { CreateTransactionResponse, DisplayAsset, GetSessionResponse, GetTransactionResponse, InitFlowOptions, SendReceiptRequest, WalletConnectWallet } from '../../types';
|
|
2
2
|
import type { CheckoutWallet } from '../../constants';
|
|
3
3
|
import type { RestoreContext } from '../sessionHelpers';
|
|
4
4
|
import type { KycFieldValues } from '../kycValidation';
|
|
@@ -110,6 +110,7 @@ export interface CheckoutCallbacks {
|
|
|
110
110
|
onSelectAsset(assetCode: string): void;
|
|
111
111
|
onSelectWallet(wallet: CheckoutWallet): void;
|
|
112
112
|
onDoneSuccess(): void;
|
|
113
|
+
onSendReceipt(sessionID: string, receipt: SendReceiptRequest): Promise<void>;
|
|
113
114
|
/** Cancels the active wallet connection attempt. */
|
|
114
115
|
onCancelConnect(): void;
|
|
115
116
|
/** Retries discovery for the selected wallet. */
|
|
@@ -10,8 +10,12 @@ export type SessionBootstrapResult = {
|
|
|
10
10
|
session: GetSessionResponse;
|
|
11
11
|
sessionPromoted: boolean;
|
|
12
12
|
linkedTransaction: GetTransactionResponse | null;
|
|
13
|
-
} | {
|
|
13
|
+
} | ({
|
|
14
14
|
ok: false;
|
|
15
|
+
} & UnavailableSessionRedirects);
|
|
16
|
+
type UnavailableSessionRedirects = {
|
|
17
|
+
failureURL?: string;
|
|
18
|
+
cancelURL?: string;
|
|
15
19
|
};
|
|
16
20
|
type Emit = (name: CheckoutEventName, data?: Record<string, unknown>) => void;
|
|
17
21
|
export declare function bootstrapSession({ api, options, emit, }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lydianpay/sdk-web",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "Drop-in crypto payment checkout for the web — a <lydian-checkout> web component and window.Lydian API across 20+ chains and major stablecoins.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|