@imtbl/checkout-widgets 2.22.1-alpha.0 → 2.23.1-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/browser/{AddTokensWidget-Cf4C0hZj.js → AddTokensWidget-tcHNMJP7.js} +28 -28
- package/dist/browser/{BridgeWidget-B19ueu1h.js → BridgeWidget-C1hLvZ5m.js} +66 -63
- package/dist/browser/{CommerceWidget-rf4XjDiJ.js → CommerceWidget-BTBtsjTM.js} +183 -183
- package/dist/browser/{FeesBreakdown-Dwqe_nxl.js → FeesBreakdown-CIuOWa2U.js} +2 -2
- package/dist/browser/{OnRampWidget-CC6Xrigx.js → OnRampWidget-CGf2WgVI.js} +6 -6
- package/dist/browser/{SaleWidget-iITczQWp.js → SaleWidget-BufxWLju.js} +69 -69
- package/dist/browser/{SpendingCapHero-D1uS4qh5.js → SpendingCapHero-w-h2TkZQ.js} +1 -1
- package/dist/browser/{SwapWidget-D0KUO-VU.js → SwapWidget-BANOn9nl.js} +26 -28
- package/dist/browser/{TokenImage-_Qe7kkzS.js → TokenImage-DiRHQD1a.js} +1 -1
- package/dist/browser/{TopUpView-D15fyfG-.js → TopUpView-Ds0YUOWC.js} +8 -8
- package/dist/browser/{WalletApproveHero-Cwv7L_bn.js → WalletApproveHero-Dp4iuc4e.js} +5 -5
- package/dist/browser/{WalletWidget-DyiWaSwm.js → WalletWidget-CNJ3wq2K.js} +16 -16
- package/dist/browser/{auto-track-DbZaRYzJ.js → auto-track-Czzb_8aV.js} +1 -1
- package/dist/browser/{index-BCj_F4N5.js → index--LhCh8bH.js} +1 -1
- package/dist/browser/{index-BH3M5w3K.js → index-BDE66Im8.js} +39448 -19104
- package/dist/browser/{index-DA2LhN2H.js → index-BV45HG4m.js} +2 -2
- package/dist/browser/{index-D1K4g3zX.js → index-BqfzuXYY.js} +1 -1
- package/dist/browser/{index-7GBD2TGk.js → index-C6GZHO2x.js} +1 -1
- package/dist/browser/{index-D9SO3VpU.js → index-C7IyH910.js} +1 -1
- package/dist/browser/{index-RJOLDd8o.js → index-DkbMrE9I.js} +1 -1
- package/dist/browser/{index-DIMD3G3p.js → index-aCZSkeUi.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{index.umd-BQX9rJ7N.js → index.umd-BdWIFOPJ.js} +1 -1
- package/dist/browser/{useInterval-TNyi_xTA.js → useInterval-BihI5iZ3.js} +1 -1
- package/dist/types/components/NotEnoughGas/NotEnoughGasStyles.d.ts +1 -1
- package/dist/types/context/analytics-provider/SegmentAnalyticsProvider.d.ts +7 -8
- package/dist/types/lib/clients/checkoutApiType.d.ts +2 -2
- package/dist/types/lib/constants.d.ts +4 -4
- package/dist/types/lib/logoUtils.d.ts +2 -2
- package/dist/types/lib/squid/functions/execute.d.ts +2 -2
- package/dist/types/lib/utils.d.ts +1 -1
- package/dist/types/widgets/add-tokens/utils/animation.d.ts +6 -1
- package/dist/types/widgets/immutable-commerce/CommerceWidgetRoot.d.ts +11 -11
- package/dist/types/widgets/swap/functions/FetchQuote.d.ts +5 -2
- package/jest.config.cjs +11 -0
- package/package.json +29 -33
- package/src/context/analytics-provider/SegmentAnalyticsProvider.ts +12 -8
- package/src/widgets/bridge/components/BridgeReviewSummary.tsx +9 -4
- package/tsconfig.json +19 -8
- package/.eslintrc.cjs +0 -75
- package/jest.config.ts +0 -27
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e5 as __awaiter, e6 as __generator } from './index-
|
|
1
|
+
import { e5 as __awaiter, e6 as __generator } from './index-BDE66Im8.js';
|
|
2
2
|
|
|
3
3
|
function loadLegacyVideoPlugins(analytics) {
|
|
4
4
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -7,7 +7,7 @@ function loadLegacyVideoPlugins(analytics) {
|
|
|
7
7
|
switch (_a.label) {
|
|
8
8
|
case 0: return [4 /*yield*/, import(
|
|
9
9
|
// @ts-expect-error
|
|
10
|
-
'./index.umd-
|
|
10
|
+
'./index.umd-BdWIFOPJ.js').then(function (n) { return n.i; })
|
|
11
11
|
// This is super gross, but we need to support the `window.analytics.plugins` namespace
|
|
12
12
|
// that is linked in the segment docs in order to be backwards compatible with ajs-classic
|
|
13
13
|
// @ts-expect-error
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e5 as __awaiter, e6 as __generator, e7 as loadScript, e8 as getNextIntegrationsURL, e9 as unloadScript, ea as __spreadArray, eb as isOffline, ec as __assign, ed as ContextCancelation, ee as applyDestinationMiddleware, ef as dist, eg as isServer, eh as mergedOptions, ei as isPlainObject, ej as pWhile, ek as PriorityQueue, el as PersistedPriorityQueue, em as attempt, en as isOnline, eo as Context } from './index-
|
|
1
|
+
import { e5 as __awaiter, e6 as __generator, e7 as loadScript, e8 as getNextIntegrationsURL, e9 as unloadScript, ea as __spreadArray, eb as isOffline, ec as __assign, ed as ContextCancelation, ee as applyDestinationMiddleware, ef as dist, eg as isServer, eh as mergedOptions, ei as isPlainObject, ej as pWhile, ek as PriorityQueue, el as PersistedPriorityQueue, em as attempt, en as isOnline, eo as Context } from './index-BDE66Im8.js';
|
|
2
2
|
import { i as isPlanEventEnabled } from './is-plan-event-enabled-mXX0dwl-.js';
|
|
3
3
|
|
|
4
4
|
function normalizeName(name) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dX as se$1, dY as T$2, dZ as oe$1, d_ as R$1, d$ as a$2, e0 as te$1, e1 as p$1, e2 as ne$1, e3 as y$1 } from './index-
|
|
1
|
+
import { dX as se$1, dY as T$2, dZ as oe$1, d_ as R$1, d$ as a$2, e0 as te$1, e1 as p$1, e2 as ne$1, e3 as y$1 } from './index-BDE66Im8.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @license
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e5 as __awaiter, e6 as __generator, eg as isServer, e8 as getNextIntegrationsURL, e7 as loadScript } from './index-
|
|
1
|
+
import { e5 as __awaiter, e6 as __generator, eg as isServer, e8 as getNextIntegrationsURL, e7 as loadScript } from './index-BDE66Im8.js';
|
|
2
2
|
|
|
3
3
|
function remoteMiddlewares(ctx, settings, obfuscate) {
|
|
4
4
|
var _a;
|
package/dist/browser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { er as WidgetsFactory } from './index-
|
|
1
|
+
export { er as WidgetsFactory } from './index-BDE66Im8.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as reactExports, dW as useBrowserLayoutEffect } from './index-BDE66Im8.js';
|
|
2
2
|
|
|
3
3
|
// Inspired by https://usehooks-ts.com/react-hook/use-interval
|
|
4
4
|
function useInterval(callback, delay) {
|
|
@@ -13,11 +13,11 @@ export declare const headingTextStyles: {
|
|
|
13
13
|
paddingX: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const bodyTextStyles: {
|
|
16
|
-
color: string;
|
|
17
16
|
fontFamily: string;
|
|
18
17
|
textAlign: string;
|
|
19
18
|
marginTop: string;
|
|
20
19
|
paddingX: string;
|
|
20
|
+
color: string;
|
|
21
21
|
};
|
|
22
22
|
export declare const actionButtonContainerStyles: {
|
|
23
23
|
display: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StandardAnalyticsControlTypes } from '@imtbl/react-analytics';
|
|
2
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
2
3
|
export declare enum UserJourney {
|
|
3
4
|
CONNECT = "Connect",
|
|
4
5
|
WALLET = "Wallet",
|
|
@@ -11,14 +12,12 @@ export declare enum UserJourney {
|
|
|
11
12
|
TRANSFER = "Transfer"
|
|
12
13
|
}
|
|
13
14
|
export type AnalyticsControlTypes = StandardAnalyticsControlTypes | 'IframeEvent' | 'Event';
|
|
14
|
-
export declare const AnalyticsProvider: (
|
|
15
|
-
|
|
16
|
-
log?: typeof console.debug;
|
|
17
|
-
}>) => import("@emotion/react/jsx-runtime").JSX.Element, useAnalytics: () => {
|
|
15
|
+
export declare const AnalyticsProvider: (props: PropsWithChildren) => ReactElement;
|
|
16
|
+
export declare const useAnalytics: () => {
|
|
18
17
|
page: (props: {
|
|
19
18
|
screen: string;
|
|
20
19
|
userJourney: UserJourney;
|
|
21
|
-
action?: StandardAnalyticsActions | undefined;
|
|
20
|
+
action?: import("@imtbl/react-analytics").StandardAnalyticsActions | undefined;
|
|
22
21
|
extras?: Record<string, unknown> | undefined;
|
|
23
22
|
}) => Promise<import("@segment/analytics-next").Context>;
|
|
24
23
|
track: (props: {
|
|
@@ -26,13 +25,13 @@ export declare const AnalyticsProvider: ({ children, loaderOverride: browserClas
|
|
|
26
25
|
userJourney: UserJourney;
|
|
27
26
|
extras?: Record<string, unknown> | undefined;
|
|
28
27
|
} & ({
|
|
29
|
-
action: StandardAnalyticsActions;
|
|
28
|
+
action: import("@imtbl/react-analytics").StandardAnalyticsActions;
|
|
30
29
|
control?: undefined;
|
|
31
30
|
controlType?: undefined;
|
|
32
31
|
} | {
|
|
33
32
|
control: string;
|
|
34
33
|
controlType: AnalyticsControlTypes;
|
|
35
|
-
action?: StandardAnalyticsActions | undefined;
|
|
34
|
+
action?: import("@imtbl/react-analytics").StandardAnalyticsActions | undefined;
|
|
36
35
|
})) => Promise<import("@segment/analytics-next").Context>;
|
|
37
36
|
identify: import("@segment/analytics-next/dist/types/core/buffer").AnalyticsBuffered["identify"];
|
|
38
37
|
group(traits: import("@segment/analytics-next").GroupTraits): Promise<import("@segment/analytics-next").Context>;
|
|
@@ -2,8 +2,8 @@ export declare enum TransactionType {
|
|
|
2
2
|
BRIDGE = "bridge"
|
|
3
3
|
}
|
|
4
4
|
export declare const TransactionStatus: {
|
|
5
|
-
readonly IN_PROGRESS:
|
|
6
|
-
readonly WITHDRAWAL_PENDING:
|
|
5
|
+
readonly IN_PROGRESS: 'in_progress';
|
|
6
|
+
readonly WITHDRAWAL_PENDING: 'withdrawal_pending';
|
|
7
7
|
};
|
|
8
8
|
export type CurrentStatus = {
|
|
9
9
|
status: string;
|
|
@@ -60,7 +60,7 @@ export declare const DEFAULT_QUOTE_REFRESH_INTERVAL = 30000;
|
|
|
60
60
|
* Base URL for the checkout CDN based on the environment.
|
|
61
61
|
*/
|
|
62
62
|
export declare const CHECKOUT_CDN_BASE_URL: {
|
|
63
|
-
[
|
|
63
|
+
[ENV_DEVELOPMENT]: string;
|
|
64
64
|
sandbox: string;
|
|
65
65
|
production: string;
|
|
66
66
|
};
|
|
@@ -68,7 +68,7 @@ export declare const CHECKOUT_CDN_BASE_URL: {
|
|
|
68
68
|
* URL for axelar scan based on the environment
|
|
69
69
|
*/
|
|
70
70
|
export declare const AXELAR_SCAN_URL: {
|
|
71
|
-
[
|
|
71
|
+
[ENV_DEVELOPMENT]: string;
|
|
72
72
|
sandbox: string;
|
|
73
73
|
production: string;
|
|
74
74
|
};
|
|
@@ -76,12 +76,12 @@ export declare const AXELAR_SCAN_URL: {
|
|
|
76
76
|
* URL for passport based on environment
|
|
77
77
|
*/
|
|
78
78
|
export declare const PASSPORT_URL: {
|
|
79
|
-
[
|
|
79
|
+
[ENV_DEVELOPMENT]: string;
|
|
80
80
|
sandbox: string;
|
|
81
81
|
production: string;
|
|
82
82
|
};
|
|
83
83
|
export declare const IMAGE_RESIZER_URL: {
|
|
84
|
-
[
|
|
84
|
+
[ENV_DEVELOPMENT]: string;
|
|
85
85
|
sandbox: string;
|
|
86
86
|
production: string;
|
|
87
87
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { WalletProviderName } from '@imtbl/checkout-sdk';
|
|
2
|
-
export declare function getWalletLogoByName(walletProviderName: WalletProviderName | string): "
|
|
3
|
-
export declare function getWalletDisplayName(walletProviderName: WalletProviderName | string): "
|
|
2
|
+
export declare function getWalletLogoByName(walletProviderName: WalletProviderName | string): "MetaMaskSymbol" | "PassportSymbolOutlined" | "WalletConnectSymbol";
|
|
3
|
+
export declare function getWalletDisplayName(walletProviderName: WalletProviderName | string): "MetaMask" | "Other" | "Passport" | "WalletConnect";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EIP6963ProviderInfo, WrappedBrowserProvider } from '@imtbl/checkout-sdk';
|
|
2
2
|
import { Flow } from '@imtbl/metrics';
|
|
3
|
-
import {
|
|
3
|
+
import { TransactionReceipt } from 'ethers';
|
|
4
4
|
import { RouteResponse } from '@0xsquid/squid-types';
|
|
5
5
|
import { Squid } from '@0xsquid/sdk';
|
|
6
|
-
export declare const waitForReceipt: (provider: WrappedBrowserProvider, txHash: string, maxAttempts?: number) => Promise<
|
|
6
|
+
export declare const waitForReceipt: (provider: WrappedBrowserProvider, txHash: string, maxAttempts?: number) => Promise<TransactionReceipt>;
|
|
7
7
|
export declare const callApprove: (flow: Flow, fromProviderInfo: EIP6963ProviderInfo, provider: WrappedBrowserProvider, routeResponse: RouteResponse) => Promise<TransactionReceipt>;
|
|
8
8
|
export declare const callExecute: (flow: Flow, squid: Squid, fromProviderInfo: EIP6963ProviderInfo, provider: WrappedBrowserProvider, routeResponse: RouteResponse) => Promise<TransactionReceipt>;
|
|
@@ -6,7 +6,7 @@ export declare const tokenSymbolNameOverrides: {
|
|
|
6
6
|
timx: string;
|
|
7
7
|
};
|
|
8
8
|
export declare const sortTokensByAmount: (config: CheckoutConfiguration, tokens: GetBalanceResult[], chainId: ChainId) => GetBalanceResult[];
|
|
9
|
-
export declare const sortNetworksCompareFn: (a: NetworkInfo, b: NetworkInfo, config: CheckoutConfiguration) =>
|
|
9
|
+
export declare const sortNetworksCompareFn: (a: NetworkInfo, b: NetworkInfo, config: CheckoutConfiguration) => -1 | 0 | 1;
|
|
10
10
|
export declare const formatFiatString: (amount: number, decimals?: number) => string;
|
|
11
11
|
export declare const calculateCryptoToFiat: (amount: string, symbol: string, conversions: Map<string, number>, zeroString?: string, maxDecimals?: number) => string;
|
|
12
12
|
export declare const calculateFeesFiat: (quote: TransactionResponse, fromToken: TokenInfo, gasFeeToken: TokenInfo, conversions: Map<string, number>, gasFeeValue: string) => number;
|
|
@@ -4,17 +4,15 @@ export declare class CommerceWidgetRoot extends Base<WidgetType.IMMUTABLE_COMMER
|
|
|
4
4
|
protected eventTopic: IMTBLWidgetEvents;
|
|
5
5
|
protected getValidatedProperties({ config, }: WidgetProperties<WidgetType.IMMUTABLE_COMMERCE>): WidgetProperties<WidgetType.IMMUTABLE_COMMERCE>;
|
|
6
6
|
protected getValidConnectFlowParams(params: CommerceWidgetConnectFlowParams): {
|
|
7
|
-
flow: CommerceFlowType.CONNECT;
|
|
8
7
|
language?: import("@imtbl/checkout-sdk").WidgetLanguage;
|
|
9
8
|
targetChainId?: import("@imtbl/checkout-sdk").ChainId;
|
|
10
9
|
targetWalletRdns?: string | import("@imtbl/checkout-sdk").WalletProviderRdns;
|
|
11
10
|
blocklistWalletRdns?: string[];
|
|
12
11
|
allowlistWalletRdns?: string[];
|
|
12
|
+
flow: CommerceFlowType.CONNECT;
|
|
13
13
|
};
|
|
14
14
|
protected getValidWalletFlowParams(params: CommerceWidgetWalletFlowParams): CommerceWidgetWalletFlowParams;
|
|
15
15
|
protected getValidSaleFlowParams(params: CommerceWidgetSaleFlowParams): {
|
|
16
|
-
items: import("@imtbl/checkout-sdk").SaleItem[];
|
|
17
|
-
flow: CommerceFlowType.SALE;
|
|
18
16
|
environmentId?: string;
|
|
19
17
|
collectionName?: string;
|
|
20
18
|
walletProviderName?: import("@imtbl/checkout-sdk").WalletProviderName;
|
|
@@ -23,9 +21,10 @@ export declare class CommerceWidgetRoot extends Base<WidgetType.IMMUTABLE_COMMER
|
|
|
23
21
|
excludeFiatCurrencies?: string[];
|
|
24
22
|
preferredCurrency?: string;
|
|
25
23
|
customOrderData?: Record<string, unknown>;
|
|
24
|
+
flow: CommerceFlowType.SALE;
|
|
25
|
+
items: import("@imtbl/checkout-sdk").SaleItem[];
|
|
26
26
|
};
|
|
27
27
|
protected getValidAddTokensFlowParams(params: CommerceWidgetAddTokensFlowParams): {
|
|
28
|
-
flow: CommerceFlowType.ADD_TOKENS;
|
|
29
28
|
language?: import("@imtbl/checkout-sdk").WidgetLanguage;
|
|
30
29
|
showOnrampOption?: boolean;
|
|
31
30
|
showSwapOption?: boolean;
|
|
@@ -35,24 +34,24 @@ export declare class CommerceWidgetRoot extends Base<WidgetType.IMMUTABLE_COMMER
|
|
|
35
34
|
showBackButton?: boolean;
|
|
36
35
|
toProvider?: import("@imtbl/checkout-sdk").WrappedBrowserProvider;
|
|
37
36
|
experiments?: Record<string, string>;
|
|
37
|
+
flow: CommerceFlowType.ADD_TOKENS;
|
|
38
38
|
};
|
|
39
39
|
protected getValidPurchaseFlowParams(params: CommerceWidgetPurchaseFlowParams): {
|
|
40
|
-
items: import("@imtbl/checkout-sdk").SaleItem[];
|
|
41
|
-
flow: CommerceFlowType.PURCHASE;
|
|
42
40
|
language?: import("@imtbl/checkout-sdk").WidgetLanguage;
|
|
43
41
|
environmentId?: string;
|
|
44
42
|
showBackButton?: boolean;
|
|
43
|
+
flow: CommerceFlowType.PURCHASE;
|
|
44
|
+
items: import("@imtbl/checkout-sdk").SaleItem[];
|
|
45
45
|
};
|
|
46
46
|
protected getValidTransferFlowParams(params: CommerceWidgetTransferFlowParams): {
|
|
47
|
-
flow: CommerceFlowType.TRANSFER;
|
|
48
47
|
language?: import("@imtbl/checkout-sdk").WidgetLanguage;
|
|
49
48
|
amount?: string;
|
|
50
|
-
tokenAddress?: `0x${string}` |
|
|
49
|
+
tokenAddress?: `0x${string}` | 'native';
|
|
51
50
|
toAddress?: `0x${string}`;
|
|
52
51
|
showBackButton?: boolean;
|
|
52
|
+
flow: CommerceFlowType.TRANSFER;
|
|
53
53
|
};
|
|
54
54
|
protected getValidSwapFlowParams(params: CommerceWidgetSwapFlowParams): {
|
|
55
|
-
flow: CommerceFlowType.SWAP;
|
|
56
55
|
amount?: string;
|
|
57
56
|
fromTokenAddress?: string;
|
|
58
57
|
toTokenAddress?: string;
|
|
@@ -61,22 +60,23 @@ export declare class CommerceWidgetRoot extends Base<WidgetType.IMMUTABLE_COMMER
|
|
|
61
60
|
autoProceed?: boolean;
|
|
62
61
|
direction?: import("@imtbl/checkout-sdk").SwapDirection;
|
|
63
62
|
showBackButton?: boolean;
|
|
63
|
+
flow: CommerceFlowType.SWAP;
|
|
64
64
|
};
|
|
65
65
|
protected getValidBridgeFlowParams(params: CommerceWidgetBridgeFlowParams): {
|
|
66
|
-
flow: CommerceFlowType.BRIDGE;
|
|
67
66
|
tokenAddress?: string;
|
|
68
67
|
amount?: string;
|
|
69
68
|
walletProviderName?: import("@imtbl/checkout-sdk").WalletProviderName;
|
|
70
69
|
language?: import("@imtbl/checkout-sdk").WidgetLanguage;
|
|
71
70
|
showBackButton?: boolean;
|
|
71
|
+
flow: CommerceFlowType.BRIDGE;
|
|
72
72
|
};
|
|
73
73
|
protected getValidOnRampFlowParams(params: CommerceWidgetOnRampFlowParams): {
|
|
74
|
-
flow: CommerceFlowType.ONRAMP;
|
|
75
74
|
tokenAddress?: string;
|
|
76
75
|
amount?: string;
|
|
77
76
|
walletProviderName?: import("@imtbl/checkout-sdk").WalletProviderName;
|
|
78
77
|
language?: import("@imtbl/checkout-sdk").WidgetLanguage;
|
|
79
78
|
showBackButton?: boolean;
|
|
79
|
+
flow: CommerceFlowType.ONRAMP;
|
|
80
80
|
};
|
|
81
81
|
protected getValidatedParameters(params: CommerceWidgetParams): CommerceWidgetParams;
|
|
82
82
|
protected render(): void;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { Exchange, TransactionResponse } from '@imtbl/dex-sdk';
|
|
2
2
|
import { WrappedBrowserProvider, TokenInfo } from '@imtbl/checkout-sdk';
|
|
3
|
+
declare const fromAmountIn: (exchange: Exchange, provider: WrappedBrowserProvider, fromToken: TokenInfo, fromAmount: string, toToken: TokenInfo) => Promise<TransactionResponse>;
|
|
4
|
+
declare const fromAmountOut: (exchange: Exchange, provider: WrappedBrowserProvider, toToken: TokenInfo, toAmount: string, fromToken: TokenInfo) => Promise<TransactionResponse>;
|
|
3
5
|
export declare const quotesProcessor: {
|
|
4
|
-
fromAmountIn:
|
|
5
|
-
fromAmountOut:
|
|
6
|
+
fromAmountIn: typeof fromAmountIn;
|
|
7
|
+
fromAmountOut: typeof fromAmountOut;
|
|
6
8
|
};
|
|
9
|
+
export {};
|
package/jest.config.cjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { createJsdomJestConfig } = require('../../../jest.config.base.cjs');
|
|
2
|
+
|
|
3
|
+
module.exports = createJsdomJestConfig({
|
|
4
|
+
transform: {
|
|
5
|
+
'^.+\.(t|j)sx?$': '@swc/jest',
|
|
6
|
+
'^.+\.mjs?$': '@swc/jest',
|
|
7
|
+
},
|
|
8
|
+
transformIgnorePatterns: [
|
|
9
|
+
'../../../node_modules/.pnpm/(?!axios|@biom3/design-tokens)',
|
|
10
|
+
],
|
|
11
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/checkout-widgets",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.1-0",
|
|
4
4
|
"browserslist": {
|
|
5
5
|
"production": [
|
|
6
6
|
">0.2%",
|
|
@@ -18,18 +18,12 @@
|
|
|
18
18
|
"@biom3/design-tokens": "^0.4.5",
|
|
19
19
|
"@biom3/react": "^0.29.4",
|
|
20
20
|
"@emotion/react": "^11.11.3",
|
|
21
|
-
"@imtbl/bridge-sdk": "2.22.1-alpha.0",
|
|
22
|
-
"@imtbl/checkout-sdk": "2.22.1-alpha.0",
|
|
23
|
-
"@imtbl/config": "2.22.1-alpha.0",
|
|
24
|
-
"@imtbl/cryptofiat": "2.22.1-alpha.0",
|
|
25
|
-
"@imtbl/dex-sdk": "2.22.1-alpha.0",
|
|
26
|
-
"@imtbl/passport": "2.22.1-alpha.0",
|
|
27
21
|
"@imtbl/react-analytics": "0.3.4-alpha",
|
|
28
22
|
"@rive-app/react-canvas-lite": "^4.9.0",
|
|
29
23
|
"@walletconnect/ethereum-provider": "^2.11.1",
|
|
30
24
|
"@walletconnect/modal": "^2.6.2",
|
|
31
|
-
"axios": "^1.
|
|
32
|
-
"ethers": "^6.
|
|
25
|
+
"axios": "^1.18.1",
|
|
26
|
+
"ethers": "^6.17.0",
|
|
33
27
|
"framer-motion": "^11.0.6",
|
|
34
28
|
"i18next": "^23.7.6",
|
|
35
29
|
"i18next-browser-languagedetector": "^7.2.0",
|
|
@@ -37,23 +31,28 @@
|
|
|
37
31
|
"lodash.debounce": "^4.0.8",
|
|
38
32
|
"pako": "^2.1.0",
|
|
39
33
|
"pino-pretty": "^11.2.2",
|
|
40
|
-
"react": "^
|
|
41
|
-
"react-dom": "^
|
|
34
|
+
"react": "^19.2.8",
|
|
35
|
+
"react-dom": "^19.2.8",
|
|
42
36
|
"react-i18next": "^13.5.0",
|
|
43
37
|
"ts-deepmerge": "^7.0.2",
|
|
44
|
-
"uuid": "^9.0.1"
|
|
38
|
+
"uuid": "^9.0.1",
|
|
39
|
+
"@imtbl/bridge-sdk": "2.23.1-0",
|
|
40
|
+
"@imtbl/checkout-sdk": "2.23.1-0",
|
|
41
|
+
"@imtbl/config": "2.23.1-0",
|
|
42
|
+
"@imtbl/dex-sdk": "2.23.1-0",
|
|
43
|
+
"@imtbl/passport": "2.23.1-0",
|
|
44
|
+
"@imtbl/cryptofiat": "2.23.1-0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@0xsquid/squid-types": "^0.1.108",
|
|
48
|
-
"@jest/globals": "^29.
|
|
48
|
+
"@jest/globals": "^29.7.0",
|
|
49
49
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
50
50
|
"@rollup/plugin-json": "^6.1.0",
|
|
51
51
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
52
|
-
"@rollup/plugin-replace": "^
|
|
52
|
+
"@rollup/plugin-replace": "^6.0.3",
|
|
53
53
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
54
54
|
"@segment/analytics-next": "^1.53.2",
|
|
55
|
-
"@
|
|
56
|
-
"@swc/core": "^1.4.2",
|
|
55
|
+
"@swc/core": "^1.15.46",
|
|
57
56
|
"@swc/jest": "^0.2.37",
|
|
58
57
|
"@testing-library/jest-dom": "^5.16.5",
|
|
59
58
|
"@testing-library/react": "^13.4.0",
|
|
@@ -61,20 +60,16 @@
|
|
|
61
60
|
"@types/jest": "^29.5.12",
|
|
62
61
|
"@types/lodash.debounce": "^4.0.9",
|
|
63
62
|
"@types/node": "^22.10.7",
|
|
64
|
-
"@types/react": "^18.3.
|
|
65
|
-
"@types/react-dom": "^18.3.
|
|
63
|
+
"@types/react": "^18.3.18",
|
|
64
|
+
"@types/react-dom": "^18.3.5",
|
|
66
65
|
"@types/uuid": "^8.3.4",
|
|
67
|
-
"
|
|
66
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
68
67
|
"jest": "^29.7.0",
|
|
69
|
-
"jest-environment-jsdom": "^29.
|
|
70
|
-
"react-scripts": "5.0.1",
|
|
71
|
-
"rimraf": "^6.0.1",
|
|
68
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
72
69
|
"rollup": "^4.22.4",
|
|
73
70
|
"rollup-plugin-polyfill-node": "^0.13.0",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"unplugin-swc": "^1.5.1",
|
|
77
|
-
"web-vitals": "^2.1.4"
|
|
71
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
72
|
+
"unplugin-swc": "^1.5.1"
|
|
78
73
|
},
|
|
79
74
|
"exports": {
|
|
80
75
|
"development": {
|
|
@@ -96,20 +91,21 @@
|
|
|
96
91
|
"publishConfig": {
|
|
97
92
|
"access": "public"
|
|
98
93
|
},
|
|
99
|
-
"repository":
|
|
94
|
+
"repository": {
|
|
95
|
+
"type": "git",
|
|
96
|
+
"url": "immutable/ts-immutable-sdk.git"
|
|
97
|
+
},
|
|
100
98
|
"type": "module",
|
|
101
99
|
"types": "./dist/types/index.d.ts",
|
|
102
100
|
"scripts": {
|
|
103
101
|
"build": "NODE_ENV=production node --max-old-space-size=14366 ./node_modules/rollup/dist/bin/rollup --config rollup.config.js && pnpm typegen",
|
|
104
|
-
"transpile": "node --max-old-space-size=14366 ./node_modules/rollup/dist/bin/rollup --config rollup.config.js",
|
|
105
|
-
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types",
|
|
106
|
-
"pack:root": "pnpm pack --pack-destination $(dirname $(pnpm root -w))",
|
|
107
102
|
"build:local": "pnpm build && mkdir -p ../sample-app/public/lib/js && cp dist/browser/*.js ../sample-app/public/lib/js/",
|
|
108
|
-
"
|
|
109
|
-
"lint:fix": "eslint ./src --ext .ts,.jsx,.tsx --fix",
|
|
103
|
+
"pack:root": "pnpm pack --pack-destination $(dirname $(pnpm root -w))",
|
|
110
104
|
"start": "NODE_ENV=development rollup --config rollup.config.js --watch",
|
|
111
105
|
"test": "jest test --passWithNoTests",
|
|
112
106
|
"test:watch": "jest test --passWithNoTests --watch",
|
|
113
|
-
"
|
|
107
|
+
"transpile": "node --max-old-space-size=14366 ./node_modules/rollup/dist/bin/rollup --config rollup.config.js",
|
|
108
|
+
"typecheck": "tsc --customConditions default --customConditions \"default\" --noEmit",
|
|
109
|
+
"typegen": "tsc --customConditions default --emitDeclarationOnly --outDir dist/types"
|
|
114
110
|
}
|
|
115
111
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAnalytics,
|
|
3
|
-
StandardAnalyticsActions,
|
|
4
3
|
StandardAnalyticsControlTypes,
|
|
5
4
|
} from '@imtbl/react-analytics';
|
|
5
|
+
import type { PropsWithChildren, ReactElement } from 'react';
|
|
6
6
|
|
|
7
7
|
export enum UserJourney {
|
|
8
8
|
CONNECT = 'Connect',
|
|
@@ -23,15 +23,19 @@ export type AnalyticsControlTypes =
|
|
|
23
23
|
|
|
24
24
|
const productName = 'checkout';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
string,
|
|
30
|
-
|
|
31
|
-
AnalyticsControlTypes,
|
|
32
|
-
StandardAnalyticsActions
|
|
26
|
+
const analytics = createAnalytics<
|
|
27
|
+
UserJourney,
|
|
28
|
+
string,
|
|
29
|
+
string,
|
|
30
|
+
AnalyticsControlTypes
|
|
33
31
|
>({
|
|
34
32
|
writeKey: '',
|
|
35
33
|
appName: productName,
|
|
36
34
|
storageKeyPrefix: 'checkoutWidgets',
|
|
37
35
|
});
|
|
36
|
+
|
|
37
|
+
// Explicit annotation: createAnalytics returns emotion JSX.Element, which is not portable
|
|
38
|
+
export const AnalyticsProvider = analytics.AnalyticsProvider as (
|
|
39
|
+
props: PropsWithChildren,
|
|
40
|
+
) => ReactElement;
|
|
41
|
+
export const useAnalytics = analytics.useAnalytics;
|
|
@@ -383,10 +383,15 @@ export function BridgeReviewSummary() {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
try {
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
386
|
+
const provider = from?.browserProvider?.provider as
|
|
387
|
+
| { send: (method: string, params: unknown[]) => Promise<unknown> }
|
|
388
|
+
| undefined;
|
|
389
|
+
if (!provider) {
|
|
390
|
+
setShowSwitchNetworkDrawer(true);
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
const currentChainId = await provider.send('eth_chainId', []);
|
|
394
|
+
const parsedChainId = parseInt(String(currentChainId), 10);
|
|
390
395
|
if (parsedChainId !== from?.network) {
|
|
391
396
|
setShowSwitchNetworkDrawer(true);
|
|
392
397
|
return;
|
package/tsconfig.json
CHANGED
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "../../../tsconfig.base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
+
"rootDir": "./src",
|
|
4
5
|
"outDir": "./dist",
|
|
5
|
-
"lib": [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
"lib": [
|
|
7
|
+
"dom",
|
|
8
|
+
"dom.iterable",
|
|
9
|
+
"esnext"
|
|
10
|
+
],
|
|
10
11
|
"noImplicitAny": false,
|
|
11
12
|
"jsxImportSource": "@emotion/react",
|
|
12
13
|
"experimentalDecorators": true,
|
|
13
|
-
"types": [
|
|
14
|
+
"types": [
|
|
15
|
+
"@segment/analytics-next",
|
|
16
|
+
"jest",
|
|
17
|
+
"node"
|
|
18
|
+
],
|
|
19
|
+
"jsx": "react-jsx"
|
|
14
20
|
},
|
|
15
|
-
"include": [
|
|
16
|
-
|
|
21
|
+
"include": [
|
|
22
|
+
"src"
|
|
23
|
+
],
|
|
24
|
+
"exclude": [
|
|
25
|
+
"node_modules",
|
|
26
|
+
"dist"
|
|
27
|
+
]
|
|
17
28
|
}
|
package/.eslintrc.cjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
"extends": ["../../../.eslintrc", 'plugin:react-hooks/recommended'],
|
|
3
|
-
"ignorePatterns": ["jest.config.*", "rollup.config.*"],
|
|
4
|
-
"parser": "@typescript-eslint/parser",
|
|
5
|
-
"parserOptions": {
|
|
6
|
-
"project": "./tsconfig.json",
|
|
7
|
-
"tsconfigRootDir": __dirname
|
|
8
|
-
},
|
|
9
|
-
"rules": {
|
|
10
|
-
"@typescript-eslint/naming-convention": [
|
|
11
|
-
"error",
|
|
12
|
-
{
|
|
13
|
-
"selector": "default",
|
|
14
|
-
"format": ["camelCase"]
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"selector": "objectLiteralProperty",
|
|
18
|
-
"format": ["camelCase"]
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"selector": "variable",
|
|
22
|
-
"format": ["camelCase", "UPPER_CASE"]
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"selector": "variable",
|
|
26
|
-
"types": ["function"],
|
|
27
|
-
"format": ["camelCase", "PascalCase"]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"selector": "function",
|
|
31
|
-
"format": ["camelCase", "PascalCase"]
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"selector": "parameter",
|
|
35
|
-
"format": ["camelCase"],
|
|
36
|
-
"leadingUnderscore": "allow"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"selector": "class",
|
|
40
|
-
"format": ["PascalCase"]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"selector": "enum",
|
|
44
|
-
"format": ["PascalCase"]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"selector": "enumMember",
|
|
48
|
-
"format": ["UPPER_CASE"]
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"selector": "memberLike",
|
|
52
|
-
"modifiers": ["private"],
|
|
53
|
-
"format": ["camelCase", "UPPER_CASE"]
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"selector": "typeLike",
|
|
57
|
-
"format": ["PascalCase"]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"selector": "typeProperty",
|
|
61
|
-
"format": ["camelCase"]
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
"prefer-promise-reject-errors": "off",
|
|
65
|
-
"class-methods-use-this": ["off"],
|
|
66
|
-
"react/require-default-props": ["off"],
|
|
67
|
-
"react/react-in-jsx-scope": ["off"],
|
|
68
|
-
"jsx-a11y/anchor-is-valid": "off",
|
|
69
|
-
"jsx-a11y/anchor-has-content": "off",
|
|
70
|
-
"jsx-a11y/control-has-associated-label": "off",
|
|
71
|
-
"react/jsx-props-no-spreading": "off",
|
|
72
|
-
"implicit-arrow-linebreak": "off",
|
|
73
|
-
"operator-linebreak": "off",
|
|
74
|
-
}
|
|
75
|
-
}
|
package/jest.config.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { Config } from 'jest';
|
|
2
|
-
import { execSync } from 'child_process';
|
|
3
|
-
import { name } from './package.json';
|
|
4
|
-
|
|
5
|
-
const rootDirs = execSync(`pnpm --filter ${name}... exec pwd`)
|
|
6
|
-
.toString()
|
|
7
|
-
.split('\n')
|
|
8
|
-
.filter(Boolean)
|
|
9
|
-
.map((dir) => `${dir}/dist`);
|
|
10
|
-
|
|
11
|
-
const config: Config = {
|
|
12
|
-
clearMocks: true,
|
|
13
|
-
roots: ['<rootDir>/src', ...rootDirs],
|
|
14
|
-
coverageProvider: 'v8',
|
|
15
|
-
moduleDirectories: ['node_modules', 'src'],
|
|
16
|
-
moduleNameMapper: { '^@imtbl/(.*)$': '<rootDir>/../../../node_modules/@imtbl/$1/src' },
|
|
17
|
-
testEnvironment: 'jsdom',
|
|
18
|
-
transform: {
|
|
19
|
-
'^.+\\.(t|j)sx?$': '@swc/jest',
|
|
20
|
-
'^.+\\.mjs?$': '@swc/jest',
|
|
21
|
-
},
|
|
22
|
-
transformIgnorePatterns: [
|
|
23
|
-
"../../../node_modules/.pnpm/(?!axios|@biom3/design-tokens)",
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default config;
|