@lydianpay/sdk-web 1.1.4 → 1.1.6
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/lydian.iife.js +57 -50
- package/dist/types/.tsbuildinfo +1 -0
- package/dist/types/chains/adapters.d.ts +18 -0
- package/dist/types/constants.d.ts +85 -0
- package/dist/types/i18n/index.d.ts +5 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/network/base.d.ts +9 -0
- package/dist/types/network/cryptotransaction/index.d.ts +8 -0
- package/dist/types/network/customer/index.d.ts +6 -0
- package/dist/types/network/index.d.ts +6 -0
- package/dist/types/network/session/index.d.ts +8 -0
- package/dist/types/network/utils.d.ts +10 -0
- package/dist/types/services/lydianConnectService.d.ts +23 -0
- package/dist/types/types.d.ts +324 -0
- package/dist/types/ui/Checkout.d.ts +216 -0
- package/dist/types/ui/brandingHelpers.d.ts +6 -0
- package/dist/types/ui/buttons/assetButton.d.ts +2 -0
- package/dist/types/ui/buttons/networkButton.d.ts +2 -0
- package/dist/types/ui/buttons/optionButton.d.ts +11 -0
- package/dist/types/ui/buttons/walletButton.d.ts +2 -0
- package/dist/types/ui/components/additionalInfoContent.d.ts +1 -0
- package/dist/types/ui/components/alertBanner.d.ts +8 -0
- package/dist/types/ui/components/assetSelectContent.d.ts +1 -0
- package/dist/types/ui/components/closeTransactionModal.d.ts +1 -0
- package/dist/types/ui/components/connectWithQrContent.d.ts +1 -0
- package/dist/types/ui/components/connectingWalletContent.d.ts +1 -0
- package/dist/types/ui/components/copyField.d.ts +9 -0
- package/dist/types/ui/components/detailCard.d.ts +6 -0
- package/dist/types/ui/components/detailRow.d.ts +9 -0
- package/dist/types/ui/components/downloadWalletContent.d.ts +1 -0
- package/dist/types/ui/components/fileDropzone.d.ts +8 -0
- package/dist/types/ui/components/formField.d.ts +8 -0
- package/dist/types/ui/components/formSelect.d.ts +12 -0
- package/dist/types/ui/components/icons.d.ts +10 -0
- package/dist/types/ui/components/loadingContent.d.ts +1 -0
- package/dist/types/ui/components/networkPill.d.ts +5 -0
- package/dist/types/ui/components/networkSelectContent.d.ts +1 -0
- package/dist/types/ui/components/payButtons.d.ts +1 -0
- package/dist/types/ui/components/paymentFailureContent.d.ts +1 -0
- package/dist/types/ui/components/paymentHeader.d.ts +1 -0
- package/dist/types/ui/components/paymentSuccessContent.d.ts +1 -0
- package/dist/types/ui/components/restoreDetailsModal.d.ts +1 -0
- package/dist/types/ui/components/scanToPayContent.d.ts +1 -0
- package/dist/types/ui/components/summaryRow.d.ts +7 -0
- package/dist/types/ui/components/timerBanner.d.ts +1 -0
- package/dist/types/ui/components/underpaidContent.d.ts +3 -0
- package/dist/types/ui/components/walletSelectContent.d.ts +1 -0
- package/dist/types/ui/countries.d.ts +2 -0
- package/dist/types/ui/domHelpers.d.ts +3 -0
- package/dist/types/ui/flowConfig.d.ts +7 -0
- package/dist/types/ui/initConfig.d.ts +20 -0
- package/dist/types/ui/kycValidation.d.ts +23 -0
- package/dist/types/ui/networkListHelpers.d.ts +26 -0
- package/dist/types/ui/otpValidation.d.ts +20 -0
- package/dist/types/ui/redirectUrl.d.ts +1 -0
- package/dist/types/ui/restoreDetailsController.d.ts +41 -0
- package/dist/types/ui/sessionHelpers.d.ts +27 -0
- package/dist/types/ui/sessionQuoteWatcher.d.ts +15 -0
- package/dist/types/ui/telemetry.d.ts +2 -0
- package/dist/types/ui/walletInstallLink.d.ts +5 -0
- package/dist/types/utils/index.d.ts +16 -0
- package/package.json +4 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare abstract class Base {
|
|
2
|
+
private baseUri;
|
|
3
|
+
private publishableKey;
|
|
4
|
+
constructor(baseUri: string, publishableKey?: string);
|
|
5
|
+
private headers;
|
|
6
|
+
protected request<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
7
|
+
protected requestText(endpoint: string, options?: RequestInit): Promise<string>;
|
|
8
|
+
protected requestWithFormData<T>(endpoint: string, options?: RequestInit): Promise<T>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Base } from '../base.js';
|
|
2
|
+
import { CancelTransactionRequest, CreatePaymentRequest, CreateTransactionResponse, GetTransactionResponse, KYCVerificationRequest } from '../../types';
|
|
3
|
+
export declare class CryptoTransactions extends Base {
|
|
4
|
+
getCryptoTransaction(transactionID: string): Promise<GetTransactionResponse>;
|
|
5
|
+
createPaymentRequest(transactionID: string, paymentRequest: CreatePaymentRequest): Promise<CreateTransactionResponse>;
|
|
6
|
+
cancelCryptoTransaction(transactionID: string, cancelTransaction: CancelTransactionRequest): Promise<CreateTransactionResponse>;
|
|
7
|
+
kycVerification(transactionID: string, kycVerificationRequest: KYCVerificationRequest): Promise<CreateTransactionResponse>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Base } from '../base';
|
|
2
|
+
import { AuthenticateCustomerOTPRequest, CustomerKYCValidationStatusResponse, SendCustomerOTPRequest } from '../../types';
|
|
3
|
+
export declare class Customer extends Base {
|
|
4
|
+
sendCustomerOTP(sendOTPRequest: SendCustomerOTPRequest): Promise<string>;
|
|
5
|
+
authenticateCustomerOTP(authenticateOTPRequest: AuthenticateCustomerOTPRequest): Promise<CustomerKYCValidationStatusResponse>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Base } from './base';
|
|
2
|
+
import { CryptoTransactions } from './cryptotransaction';
|
|
3
|
+
import { Customer } from './customer';
|
|
4
|
+
import { Sessions } from './session';
|
|
5
|
+
export type API = Base & CryptoTransactions & Customer & Sessions;
|
|
6
|
+
export declare const API: new (baseUri: string, publishableKey?: string) => API;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Base } from '../base';
|
|
2
|
+
import { CreateSessionRequest, CreateSessionResponse, CreateSessionTransactionRequest, CreateTransactionResponse, GetSessionResponse } from '../../types';
|
|
3
|
+
export declare class Sessions extends Base {
|
|
4
|
+
createSession(newSession: CreateSessionRequest): Promise<CreateSessionResponse>;
|
|
5
|
+
getSession(sessionID: string): Promise<GetSessionResponse>;
|
|
6
|
+
createSessionTransaction(sessionID: string, sessionTransaction: CreateSessionTransactionRequest): Promise<CreateTransactionResponse>;
|
|
7
|
+
cancelSession(sessionID: string): Promise<string>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies the properties and methods of the base classes to the derived class
|
|
3
|
+
* @param derivedCtor - The derived class
|
|
4
|
+
* @param baseCtors - An array of base classes
|
|
5
|
+
*/
|
|
6
|
+
export declare function applyMixins(derivedCtor: {
|
|
7
|
+
prototype: object;
|
|
8
|
+
}, baseCtors: Array<{
|
|
9
|
+
prototype: object;
|
|
10
|
+
}>): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Connection } from '@lydianpay/lydianconnect';
|
|
2
|
+
export type WalletEventHandlers = {
|
|
3
|
+
onDisplayUri?: (uri: string) => void;
|
|
4
|
+
onDisconnect?: (walletId: string) => void;
|
|
5
|
+
onChainChanged?: (walletId: string, chainId: string) => void;
|
|
6
|
+
onAccountsChanged?: (walletId: string, account: string) => void;
|
|
7
|
+
onWalletOpenFailed?: (walletId: string, store?: {
|
|
8
|
+
ios?: string;
|
|
9
|
+
android?: string;
|
|
10
|
+
}) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare class LydianConnectService {
|
|
13
|
+
private client;
|
|
14
|
+
private unsubscribe;
|
|
15
|
+
private handlers;
|
|
16
|
+
init(walletConnectProjectId: string, handlers: WalletEventHandlers): Promise<void>;
|
|
17
|
+
private dispatch;
|
|
18
|
+
connect(walletId: string, chainId: string, signal?: AbortSignal): Promise<Connection>;
|
|
19
|
+
disconnect(walletId?: string): Promise<void>;
|
|
20
|
+
reset(): Promise<void>;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
export type { Connection };
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
export declare const currencies: readonly ["USD", "TRY"];
|
|
2
|
+
export type Currency = (typeof currencies)[number];
|
|
3
|
+
export declare function isCurrency(value: unknown): value is Currency;
|
|
4
|
+
export type Transaction = {
|
|
5
|
+
amount: number;
|
|
6
|
+
currency: Currency;
|
|
7
|
+
descriptor?: string;
|
|
8
|
+
referenceNumber: string;
|
|
9
|
+
};
|
|
10
|
+
export type InitFlowOptions = {
|
|
11
|
+
walletConnect?: boolean;
|
|
12
|
+
skipConfirmationPage?: boolean;
|
|
13
|
+
hideNoWalletOption?: boolean;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Every `redirectURL` below is the merchant's own URL from the session, and is only
|
|
17
|
+
* ever populated when it passed the SDK's http(s) validation. The SDK never
|
|
18
|
+
* navigates — inside an embed that would take the merchant's page down with it — so
|
|
19
|
+
* the host decides whether to follow it.
|
|
20
|
+
*/
|
|
21
|
+
export type PaymentResult = {
|
|
22
|
+
transactionID?: string;
|
|
23
|
+
/** Local currency amount as the customer was charged. */
|
|
24
|
+
amount?: number;
|
|
25
|
+
currency?: string;
|
|
26
|
+
asset?: string;
|
|
27
|
+
network?: string;
|
|
28
|
+
completedAt?: string;
|
|
29
|
+
/** `session.successURL`. */
|
|
30
|
+
redirectURL?: string;
|
|
31
|
+
};
|
|
32
|
+
export type PaymentFailureReason = 'sessionExpired' | 'timedOut' | 'blocked' | 'walletRejected' | 'error';
|
|
33
|
+
export type PaymentFailure = {
|
|
34
|
+
/**
|
|
35
|
+
* Whether the host should end the checkout — the only question it has to answer,
|
|
36
|
+
* so it is phrased as the answer rather than as a category of error.
|
|
37
|
+
*
|
|
38
|
+
* **False for most failures.** They leave the customer mid-flow with something
|
|
39
|
+
* still to do — nothing picked yet, a wallet prompt declined — and the SDK has
|
|
40
|
+
* already shown them an inline message. A host that redirected on every failure
|
|
41
|
+
* would eject customers on a retryable hiccup. Only a failure that ends the
|
|
42
|
+
* checkout carries a `redirectURL`.
|
|
43
|
+
*/
|
|
44
|
+
shouldEndCheckout: boolean;
|
|
45
|
+
reason: PaymentFailureReason;
|
|
46
|
+
transactionID?: string;
|
|
47
|
+
/** `session.failureURL`, and only when `shouldEndCheckout` is true. */
|
|
48
|
+
redirectURL?: string;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Lifecycle points the SDK reports through `onEvent`.
|
|
52
|
+
*
|
|
53
|
+
* A named union rather than `string`: it makes the set greppable, types the host's
|
|
54
|
+
* bridge, and forces a decision when someone adds one. Names are dot-namespaced to
|
|
55
|
+
* match what pay.lydian.com already sends to Sentry.
|
|
56
|
+
*/
|
|
57
|
+
export declare const checkoutEventNames: readonly ["session.loaded", "asset.selected", "network.selected", "wallet.selected", "wallet.connected", "wallet.disconnected", "wallet.chain_changed", "transaction.created", "qr.shown", "kyc.shown", "payment.succeeded", "payment.failed", "payment.canceled"];
|
|
58
|
+
export type CheckoutEventName = (typeof checkoutEventNames)[number];
|
|
59
|
+
export type PaymentCancellation = {
|
|
60
|
+
/** `session.cancelURL`. */
|
|
61
|
+
redirectURL?: string;
|
|
62
|
+
};
|
|
63
|
+
type CommonInitOptions = {
|
|
64
|
+
/** Target `api.lydian.dev`. Takes precedence over `sandbox`. */
|
|
65
|
+
dev?: boolean;
|
|
66
|
+
/** Target `api.sandbox.lydian.com`. Production is the default. */
|
|
67
|
+
sandbox?: boolean;
|
|
68
|
+
/** Required only when `flow.walletConnect` is on; unused otherwise. */
|
|
69
|
+
walletConnectProjectId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Extra arguments are additive: a callback declared with fewer parameters still
|
|
72
|
+
* satisfies these, so widening them cannot break an existing integration.
|
|
73
|
+
*/
|
|
74
|
+
paymentFailedListener: (failureMessage: string, failure: PaymentFailure) => void;
|
|
75
|
+
paymentSuccessListener: (result: PaymentResult) => void;
|
|
76
|
+
paymentCanceledListener: (cancellation: PaymentCancellation) => void;
|
|
77
|
+
/**
|
|
78
|
+
* Observability hook. Called at each lifecycle point so the host can forward to
|
|
79
|
+
* its own telemetry — which is how the SDK stays free of any analytics
|
|
80
|
+
* dependency, and how a merchant's bundle stays free of ours.
|
|
81
|
+
*
|
|
82
|
+
* Never carries personal data or a wallet address. Throwing from here is
|
|
83
|
+
* contained and will not break the checkout, but it is still the host's job not
|
|
84
|
+
* to.
|
|
85
|
+
*/
|
|
86
|
+
onEvent?: (name: CheckoutEventName, data?: Record<string, unknown>) => void;
|
|
87
|
+
/** Render inline rather than in a modal dialog. */
|
|
88
|
+
isEmbedded?: boolean;
|
|
89
|
+
flow?: InitFlowOptions;
|
|
90
|
+
};
|
|
91
|
+
/** Options for `window.Lydian.init` — the SDK creates the session and drives it. */
|
|
92
|
+
export type NewSessionInitOptions = CommonInitOptions & {
|
|
93
|
+
publishableKey: string;
|
|
94
|
+
transaction: Transaction;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Options for `window.Lydian.initExistingSession` — the SDK adopts a session the
|
|
98
|
+
* caller's backend already created.
|
|
99
|
+
*
|
|
100
|
+
* There is no publishable key here and none is needed: the merchant was identified
|
|
101
|
+
* when their backend created the session, and every route this flow touches accepts
|
|
102
|
+
* an anonymous caller. Possession of the session id is the credential.
|
|
103
|
+
*/
|
|
104
|
+
export type ExistingSessionInitOptions = CommonInitOptions & {
|
|
105
|
+
sessionID: string;
|
|
106
|
+
};
|
|
107
|
+
export type CheckoutInitOptions = NewSessionInitOptions | ExistingSessionInitOptions;
|
|
108
|
+
export declare function hasExistingSession(options: CheckoutInitOptions): options is ExistingSessionInitOptions;
|
|
109
|
+
export type CreateTransactionRequest = {
|
|
110
|
+
descriptor?: string;
|
|
111
|
+
referenceNumber?: string;
|
|
112
|
+
amount: number;
|
|
113
|
+
amountCurrency: string;
|
|
114
|
+
asset: string;
|
|
115
|
+
network: string;
|
|
116
|
+
customerUUID?: string;
|
|
117
|
+
};
|
|
118
|
+
export type SendCustomerOTPRequest = {
|
|
119
|
+
email: string;
|
|
120
|
+
country: string;
|
|
121
|
+
};
|
|
122
|
+
export type AuthenticateCustomerOTPRequest = {
|
|
123
|
+
otp: string;
|
|
124
|
+
email: string;
|
|
125
|
+
country: string;
|
|
126
|
+
};
|
|
127
|
+
export type CustomerKYCValidationStatusResponse = {
|
|
128
|
+
customerUUID: string;
|
|
129
|
+
kycValidated: boolean;
|
|
130
|
+
};
|
|
131
|
+
export type CreateSessionRequest = {
|
|
132
|
+
amount: number;
|
|
133
|
+
amountCurrency: string;
|
|
134
|
+
descriptor?: string;
|
|
135
|
+
referenceNumber?: string;
|
|
136
|
+
};
|
|
137
|
+
export type CreateSessionResponse = {
|
|
138
|
+
sessionID: string;
|
|
139
|
+
qrData: string;
|
|
140
|
+
cancelURL: string;
|
|
141
|
+
successURL: string;
|
|
142
|
+
failureURL: string;
|
|
143
|
+
fiatFXRate: number;
|
|
144
|
+
recommendedNetwork: string;
|
|
145
|
+
};
|
|
146
|
+
export type AmountPerNetwork = Record<string, number>;
|
|
147
|
+
export type AmountPerAsset = Record<string, number>;
|
|
148
|
+
export type AmountPerNetworkPerAsset = Record<string, Record<string, number>>;
|
|
149
|
+
export type AllowedWalletConfig = {
|
|
150
|
+
name?: string;
|
|
151
|
+
order?: number;
|
|
152
|
+
isFeatured?: boolean;
|
|
153
|
+
featuredNote?: string;
|
|
154
|
+
};
|
|
155
|
+
export type GetSessionResponse = {
|
|
156
|
+
sessionID: string;
|
|
157
|
+
amount: number;
|
|
158
|
+
amountCurrency: string;
|
|
159
|
+
status: number;
|
|
160
|
+
expiration: string;
|
|
161
|
+
transactionID: string;
|
|
162
|
+
cancelURL: string;
|
|
163
|
+
successURL: string;
|
|
164
|
+
failureURL: string;
|
|
165
|
+
allowedCrypto: string[] | null;
|
|
166
|
+
allowedWalletsConfig: AllowedWalletConfig[] | null;
|
|
167
|
+
recommendedNetwork: string;
|
|
168
|
+
merchantName?: string;
|
|
169
|
+
calculatedCryptoTotals?: AmountPerAsset;
|
|
170
|
+
calculatedCryptoTotalsPerNetwork?: AmountPerNetworkPerAsset;
|
|
171
|
+
customFlatFeePerNetwork?: AmountPerNetwork;
|
|
172
|
+
customFeePercentagePerNetwork?: AmountPerNetwork;
|
|
173
|
+
customFeeFiatPerNetwork?: AmountPerNetwork;
|
|
174
|
+
customFeeCryptoPerNetwork?: AmountPerNetworkPerAsset;
|
|
175
|
+
cryptoFXRates?: AmountPerAsset;
|
|
176
|
+
cryptoFXRateExpiration?: string;
|
|
177
|
+
fxRate?: number;
|
|
178
|
+
fxRateExpiration?: string;
|
|
179
|
+
checkoutConfig?: CheckoutConfig;
|
|
180
|
+
};
|
|
181
|
+
export type CreateSessionTransactionRequest = {
|
|
182
|
+
wallet: string;
|
|
183
|
+
asset: string;
|
|
184
|
+
network: string;
|
|
185
|
+
customerUUID?: string;
|
|
186
|
+
};
|
|
187
|
+
export type CalculatedTotals = {
|
|
188
|
+
cryptoCurrency: string;
|
|
189
|
+
baseAmountCrypto: number;
|
|
190
|
+
merchantCustomFeeCrypto: number;
|
|
191
|
+
additionalCustomerFeeCrypto: number;
|
|
192
|
+
totalAmountCrypto: number;
|
|
193
|
+
};
|
|
194
|
+
export type CreateTransactionResponse = {
|
|
195
|
+
transactionId: string;
|
|
196
|
+
paymentRequestId: string;
|
|
197
|
+
qrData: string;
|
|
198
|
+
assetAmount: string;
|
|
199
|
+
additionalCustomerFee: number;
|
|
200
|
+
address: string;
|
|
201
|
+
status: number;
|
|
202
|
+
requiredFields: string[];
|
|
203
|
+
supportedDocumentTypes: string[];
|
|
204
|
+
expiration?: string;
|
|
205
|
+
calculatedTotals?: CalculatedTotals;
|
|
206
|
+
cryptoFXRate?: number;
|
|
207
|
+
};
|
|
208
|
+
export type KYCVerificationRequest = {
|
|
209
|
+
asset: string;
|
|
210
|
+
network: string;
|
|
211
|
+
firstName: string;
|
|
212
|
+
lastName: string;
|
|
213
|
+
email: string;
|
|
214
|
+
street: string;
|
|
215
|
+
city: string;
|
|
216
|
+
region: string;
|
|
217
|
+
postalCode: string;
|
|
218
|
+
country: string;
|
|
219
|
+
storeKYC: boolean;
|
|
220
|
+
documentType: string | undefined;
|
|
221
|
+
documentFiles: File[];
|
|
222
|
+
customerUUID?: string;
|
|
223
|
+
};
|
|
224
|
+
export type CreatePaymentRequest = {
|
|
225
|
+
asset: string;
|
|
226
|
+
network: string;
|
|
227
|
+
};
|
|
228
|
+
export type CancelTransactionRequest = {
|
|
229
|
+
reason: string;
|
|
230
|
+
forfeit?: boolean;
|
|
231
|
+
};
|
|
232
|
+
export type Amounts = {
|
|
233
|
+
currency: string;
|
|
234
|
+
fxRateToUSD: number;
|
|
235
|
+
totalLocal: number;
|
|
236
|
+
totalUSD: number;
|
|
237
|
+
customerFeeUSD: number;
|
|
238
|
+
receivedUSD: number;
|
|
239
|
+
};
|
|
240
|
+
export type PaymentRequest = {
|
|
241
|
+
paymentRequestID: string;
|
|
242
|
+
transactionID: string;
|
|
243
|
+
cryptoAsset: string;
|
|
244
|
+
cryptoNetwork: string;
|
|
245
|
+
cryptoRatePerUSD: number;
|
|
246
|
+
expectedUSD: number;
|
|
247
|
+
expectedCrypto: number;
|
|
248
|
+
address: string;
|
|
249
|
+
qrData: string;
|
|
250
|
+
walletName: string;
|
|
251
|
+
expiration: string;
|
|
252
|
+
status: number;
|
|
253
|
+
receivedCrypto: number;
|
|
254
|
+
receivedUSD: number;
|
|
255
|
+
txnHash: string;
|
|
256
|
+
fromAddress: string;
|
|
257
|
+
confirmationCount: number;
|
|
258
|
+
completedAt: string;
|
|
259
|
+
gasFee: number;
|
|
260
|
+
gasFeeUnits: string;
|
|
261
|
+
};
|
|
262
|
+
export type GetTransactionResponse = {
|
|
263
|
+
transactionID: string;
|
|
264
|
+
merchantID: string;
|
|
265
|
+
accountID: string;
|
|
266
|
+
referenceNumber: string;
|
|
267
|
+
descriptor: string;
|
|
268
|
+
status: number;
|
|
269
|
+
paymentStatus: number;
|
|
270
|
+
expiration: string;
|
|
271
|
+
cancellationReason?: string;
|
|
272
|
+
amounts: Amounts;
|
|
273
|
+
remainingUSD: number;
|
|
274
|
+
remainingLocal: number;
|
|
275
|
+
payments: PaymentRequest[];
|
|
276
|
+
};
|
|
277
|
+
export type Asset = {
|
|
278
|
+
code: string;
|
|
279
|
+
type?: string;
|
|
280
|
+
title?: string;
|
|
281
|
+
img?: string;
|
|
282
|
+
networks: string[];
|
|
283
|
+
};
|
|
284
|
+
export type DisplayAsset = Asset & {
|
|
285
|
+
type: string;
|
|
286
|
+
title: string;
|
|
287
|
+
img: string;
|
|
288
|
+
precision: number;
|
|
289
|
+
decimals: number;
|
|
290
|
+
};
|
|
291
|
+
export type Network = {
|
|
292
|
+
code: string;
|
|
293
|
+
name: string;
|
|
294
|
+
img: string;
|
|
295
|
+
};
|
|
296
|
+
export type WalletConnectWallet = {
|
|
297
|
+
id: string;
|
|
298
|
+
name: string;
|
|
299
|
+
img: string;
|
|
300
|
+
wcPeerName?: string;
|
|
301
|
+
};
|
|
302
|
+
export type CheckoutTheme = {
|
|
303
|
+
primaryColor?: string;
|
|
304
|
+
backgroundColor?: string;
|
|
305
|
+
textColor?: string;
|
|
306
|
+
accentColor?: string;
|
|
307
|
+
};
|
|
308
|
+
export type CheckoutFonts = {
|
|
309
|
+
family?: string;
|
|
310
|
+
familyURL?: string;
|
|
311
|
+
};
|
|
312
|
+
export type CheckoutFlow = {
|
|
313
|
+
skipConfirmationPage?: boolean;
|
|
314
|
+
hideNoWalletOption?: boolean;
|
|
315
|
+
showApprovalPage?: boolean;
|
|
316
|
+
};
|
|
317
|
+
export type CheckoutConfig = {
|
|
318
|
+
logoURL?: string;
|
|
319
|
+
theme?: CheckoutTheme;
|
|
320
|
+
fonts?: CheckoutFonts;
|
|
321
|
+
flow?: CheckoutFlow;
|
|
322
|
+
termNotice?: string;
|
|
323
|
+
};
|
|
324
|
+
export {};
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { CheckoutInitOptions, Transaction } from '../types';
|
|
2
|
+
export declare class Checkout extends HTMLElement {
|
|
3
|
+
private shadow;
|
|
4
|
+
private initOptions;
|
|
5
|
+
private API;
|
|
6
|
+
private session;
|
|
7
|
+
private sessionPromoted;
|
|
8
|
+
private cryptoTransaction;
|
|
9
|
+
private linkedTransaction;
|
|
10
|
+
private consecutivePollFailures;
|
|
11
|
+
private walletChainWarned;
|
|
12
|
+
private getCryptoTransactionIntervalID;
|
|
13
|
+
private readonly sessionQuoteWatcher;
|
|
14
|
+
private containerPaymentSuccess;
|
|
15
|
+
private containerPaymentFailure;
|
|
16
|
+
private containerQRCode;
|
|
17
|
+
private lydianProcessingContainer;
|
|
18
|
+
private loadingLogo;
|
|
19
|
+
private btnCancelLoading;
|
|
20
|
+
private paymentHeaderWasVisible;
|
|
21
|
+
private paymentFailureMessage;
|
|
22
|
+
private displayPaymentId;
|
|
23
|
+
private paymentIdField;
|
|
24
|
+
private btnClosePaymentFailure;
|
|
25
|
+
private containerWalletSelect;
|
|
26
|
+
private modalContainerWalletSelect;
|
|
27
|
+
private containerConnectingWallet;
|
|
28
|
+
private modalContainerConnectingWallet;
|
|
29
|
+
private containerConnectWithQr;
|
|
30
|
+
private modalContainerConnectWithQr;
|
|
31
|
+
private containerDownloadWallet;
|
|
32
|
+
private modalContainerDownloadWallet;
|
|
33
|
+
private containerNetworks;
|
|
34
|
+
private containerNetworkList;
|
|
35
|
+
private lydianConnect;
|
|
36
|
+
private walletConnection;
|
|
37
|
+
private connectedAccount;
|
|
38
|
+
private connectAbort;
|
|
39
|
+
private btnCancelAssetSelection;
|
|
40
|
+
private btnCancelNetworkSelection;
|
|
41
|
+
private btnNetworkSummaryRow;
|
|
42
|
+
private networkSummaryLogo;
|
|
43
|
+
private networkSummaryName;
|
|
44
|
+
private assetSelectTotalAmount;
|
|
45
|
+
private paymentHeader;
|
|
46
|
+
private errorBannerSlot;
|
|
47
|
+
private pendingErrorBanner;
|
|
48
|
+
private paymentHeaderAmount;
|
|
49
|
+
private paymentHeaderMerchant;
|
|
50
|
+
private containerCryptoPayment;
|
|
51
|
+
private containerAssets;
|
|
52
|
+
private canvasQRCode;
|
|
53
|
+
private displayAssetTotal;
|
|
54
|
+
private displayQrTotal;
|
|
55
|
+
private displayQrSubtotal;
|
|
56
|
+
private displayQrNetworkFee;
|
|
57
|
+
private displayWalletAddress;
|
|
58
|
+
private qrNetworkLogo;
|
|
59
|
+
private qrNetworkName;
|
|
60
|
+
private btnCancelQr;
|
|
61
|
+
private btnOpenInWallet;
|
|
62
|
+
private qrCodeLink;
|
|
63
|
+
private pendingWalletSend;
|
|
64
|
+
private qrTimerClock;
|
|
65
|
+
private btnAppPayment;
|
|
66
|
+
private btnCryptoPayment;
|
|
67
|
+
private selectedAsset;
|
|
68
|
+
private selectedAssetNetworks;
|
|
69
|
+
private selectedNetwork;
|
|
70
|
+
private selectedWallet;
|
|
71
|
+
private modal;
|
|
72
|
+
private modalContainerPaymentSuccess;
|
|
73
|
+
private modalContainerPaymentFailure;
|
|
74
|
+
private modalContainerQRCode;
|
|
75
|
+
private modalContainerNetworks;
|
|
76
|
+
private modalContainerCryptoPayment;
|
|
77
|
+
private displaySuccessAmount;
|
|
78
|
+
private successOverpaidBanner;
|
|
79
|
+
private btnDoneSuccess;
|
|
80
|
+
private underpaidSlot;
|
|
81
|
+
private underpaidNoticeSlot;
|
|
82
|
+
private underpaidActionsSlot;
|
|
83
|
+
private labelAssetTotal;
|
|
84
|
+
private scanExactAmountNotice;
|
|
85
|
+
private modalButtonChooseDifferentAsset;
|
|
86
|
+
private modalCloseTransactionModal;
|
|
87
|
+
private modalButtonAcceptTransactionModalClose;
|
|
88
|
+
private modalButtonRejectTransactionModalClose;
|
|
89
|
+
private modalCloseTransactionModalDescription;
|
|
90
|
+
private containerKYCAndTravelRules;
|
|
91
|
+
private modalContainerKYCAndTravelRules;
|
|
92
|
+
private email;
|
|
93
|
+
private firstName;
|
|
94
|
+
private lastName;
|
|
95
|
+
private street;
|
|
96
|
+
private city;
|
|
97
|
+
private region;
|
|
98
|
+
private postalCode;
|
|
99
|
+
private country;
|
|
100
|
+
private documentType;
|
|
101
|
+
private documentFileFront;
|
|
102
|
+
private documentFileBackContainer;
|
|
103
|
+
private documentFileBack;
|
|
104
|
+
private buttonKYCVerificationAndTravelRules;
|
|
105
|
+
private btnCancelKyc;
|
|
106
|
+
private storeKYC;
|
|
107
|
+
private restoreController;
|
|
108
|
+
private kycStepLabel;
|
|
109
|
+
private kycStepBasic;
|
|
110
|
+
private kycStepAddress;
|
|
111
|
+
private kycStepDocument;
|
|
112
|
+
private btnKycNetworkSummaryRow;
|
|
113
|
+
private kycNetworkSummaryLogo;
|
|
114
|
+
private kycNetworkSummaryName;
|
|
115
|
+
private btnCoinSummaryRow;
|
|
116
|
+
private coinSummaryLogo;
|
|
117
|
+
private coinSummaryName;
|
|
118
|
+
private kycSteps;
|
|
119
|
+
private restoreContext;
|
|
120
|
+
private currentKycStepIndex;
|
|
121
|
+
private timeInterval;
|
|
122
|
+
private brandFontLink;
|
|
123
|
+
constructor();
|
|
124
|
+
initialize(options: CheckoutInitOptions): Promise<void>;
|
|
125
|
+
private initializeWalletConnect;
|
|
126
|
+
updateTransaction(transaction: Transaction): Promise<void>;
|
|
127
|
+
private amountForDisplay;
|
|
128
|
+
private loadOrCreateSession;
|
|
129
|
+
private createSession;
|
|
130
|
+
private loadSession;
|
|
131
|
+
private fetchLinkedTransaction;
|
|
132
|
+
private clearExpirationCountdown;
|
|
133
|
+
disconnectedCallback(): void;
|
|
134
|
+
private renewExpiredQuote;
|
|
135
|
+
private updateDisplayedAmounts;
|
|
136
|
+
private isScreenVisible;
|
|
137
|
+
private ensureFreshSession;
|
|
138
|
+
private markPromotedFrom;
|
|
139
|
+
private loadInitialState;
|
|
140
|
+
private setSelectedAsset;
|
|
141
|
+
private setSelectedNetwork;
|
|
142
|
+
private setSelectedWallet;
|
|
143
|
+
private setDetailRow;
|
|
144
|
+
private hideDetailRow;
|
|
145
|
+
private syncDetailCards;
|
|
146
|
+
private showPaymentSuccess;
|
|
147
|
+
private hidePaymentHeader;
|
|
148
|
+
private showUnderpaid;
|
|
149
|
+
private safeFormatCurrency;
|
|
150
|
+
private safeFormatLocal;
|
|
151
|
+
private reportFailure;
|
|
152
|
+
private showErrorBanner;
|
|
153
|
+
private flushPendingErrorBanner;
|
|
154
|
+
private clearErrorBanner;
|
|
155
|
+
private showPaymentFailure;
|
|
156
|
+
private hidePaymentFailure;
|
|
157
|
+
private hidePaymentSuccess;
|
|
158
|
+
private showProcessing;
|
|
159
|
+
private hideProcessing;
|
|
160
|
+
private enterCryptoFlow;
|
|
161
|
+
private emit;
|
|
162
|
+
private handleWalletChainChanged;
|
|
163
|
+
private showButtons;
|
|
164
|
+
private hideButtons;
|
|
165
|
+
private showQRCode;
|
|
166
|
+
private startExpirationCountdown;
|
|
167
|
+
private hideQRCode;
|
|
168
|
+
private render;
|
|
169
|
+
private initializeComponents;
|
|
170
|
+
private wireWarningIconFallbacks;
|
|
171
|
+
private wireCopyFields;
|
|
172
|
+
private flashCopyFeedback;
|
|
173
|
+
private attachListeners;
|
|
174
|
+
private startListeningCryptoTransaction;
|
|
175
|
+
private clearInterval;
|
|
176
|
+
private settleTerminalTransaction;
|
|
177
|
+
private updatePaymentHeader;
|
|
178
|
+
private setAssetButtons;
|
|
179
|
+
private attachListenersOnAssets;
|
|
180
|
+
private setWalletButtons;
|
|
181
|
+
private attachListenersOnWallets;
|
|
182
|
+
private flowSettings;
|
|
183
|
+
private hasConnectableWallet;
|
|
184
|
+
private connectSelectedWallet;
|
|
185
|
+
private releaseTopLayer;
|
|
186
|
+
private reclaimTopLayer;
|
|
187
|
+
private failWalletConnect;
|
|
188
|
+
private hideConnectScreens;
|
|
189
|
+
private buildConnectedWalletSend;
|
|
190
|
+
private showConnectingWallet;
|
|
191
|
+
private showWalletOpenFailed;
|
|
192
|
+
private showConnectWithQr;
|
|
193
|
+
private showScreen;
|
|
194
|
+
private showDownloadWallet;
|
|
195
|
+
private showWalletSelectFromDownload;
|
|
196
|
+
private setTextById;
|
|
197
|
+
private setNetworkButtons;
|
|
198
|
+
private attachListenerOnNetworks;
|
|
199
|
+
private applyBranding;
|
|
200
|
+
private beginPayment;
|
|
201
|
+
private beginTransaction;
|
|
202
|
+
private handleCreatedTransactionAndStartListening;
|
|
203
|
+
private signAndSubmit;
|
|
204
|
+
private showKycScreen;
|
|
205
|
+
private hideKycScreen;
|
|
206
|
+
private populateKycSummaryRows;
|
|
207
|
+
private applyKycFieldVisibility;
|
|
208
|
+
private renderKycStep;
|
|
209
|
+
private readKycFieldValues;
|
|
210
|
+
private showKycFieldError;
|
|
211
|
+
private clearKycFieldErrors;
|
|
212
|
+
private handleKycContinue;
|
|
213
|
+
private submitKycVerification;
|
|
214
|
+
private showDocumentOnlyKycScreen;
|
|
215
|
+
private restoreWithCustomerUUID;
|
|
216
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const isSafeColor: (color?: string) => color is string;
|
|
2
|
+
export declare const isSafeFontFamily: (fontFamily?: string) => fontFamily is string;
|
|
3
|
+
export declare const isAllowedFontUrl: (fontUrl?: string) => fontUrl is string;
|
|
4
|
+
export declare const isAllowedLogoUrl: (logoUrl?: string) => logoUrl is string;
|
|
5
|
+
export declare const resolveLogoUrl: (logoUrl?: string) => string;
|
|
6
|
+
export declare const sanitizeTermNotice: (rawHtml: string) => string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type OptionButtonProps = {
|
|
2
|
+
id: string;
|
|
3
|
+
imageUrl: string;
|
|
4
|
+
imageAlt: string;
|
|
5
|
+
label: string;
|
|
6
|
+
secondaryLabel?: string;
|
|
7
|
+
secondaryValue?: string;
|
|
8
|
+
trailingNote?: string;
|
|
9
|
+
badgeLabel?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function OptionButton({ id, imageUrl, imageAlt, label, secondaryLabel, secondaryValue, trailingNote, badgeLabel, }: OptionButtonProps): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AdditionalInfoContent(): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type AlertVariant = 'warning' | 'error';
|
|
2
|
+
export type AlertBannerProps = {
|
|
3
|
+
message: string;
|
|
4
|
+
variant?: AlertVariant;
|
|
5
|
+
linkText?: string;
|
|
6
|
+
linkId?: string;
|
|
7
|
+
};
|
|
8
|
+
export default function AlertBanner({ message, variant, linkText, linkId, }: AlertBannerProps): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function AssetSelectContent(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CloseTransactionModal(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ConnectWithQrContent(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function ConnectingWalletContent(): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type CopyFieldProps = {
|
|
2
|
+
valueId: string;
|
|
3
|
+
label: string;
|
|
4
|
+
copyLabel?: string;
|
|
5
|
+
valueClass?: string;
|
|
6
|
+
valueSizeClass?: string;
|
|
7
|
+
containerClass?: string;
|
|
8
|
+
};
|
|
9
|
+
export default function CopyField({ valueId, label, copyLabel, valueClass, valueSizeClass, containerClass, }: CopyFieldProps): string;
|