@lydianpay/sdk-web 3.15.5 → 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.
@@ -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
  }
@@ -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;
@@ -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;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export type AlertVariant = 'warning' | 'error';
2
+ export type AlertVariant = 'warning' | 'error' | 'success';
3
3
  export default function AlertBanner({ message, variant, }: {
4
4
  message: string;
5
5
  variant?: AlertVariant;
@@ -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,4 @@
1
+ import * as React from 'react';
2
+ export default function EmailReceiptCard({ sessionID }: {
3
+ sessionID: string;
4
+ }): 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;
@@ -0,0 +1,7 @@
1
+ import { type ReceiptDetails } from './emailReceiptHelpers';
2
+ export declare function useEmailReceiptSender(sessionID: string): {
3
+ send: (receipt: ReceiptDetails) => Promise<void>;
4
+ isSending: boolean;
5
+ hasSent: boolean;
6
+ failureMessage: string | null;
7
+ };
@@ -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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lydianpay/sdk-web",
3
- "version": "3.15.5",
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": {