@imtbl/checkout-widgets 2.24.7 → 2.24.9-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-aAZMavtt.js → AddTokensWidget-CIR8BF_I.js} +24 -297
- package/dist/browser/{BridgeWidget-CWWCr015.js → BridgeWidget-C5Uljhhx.js} +13 -294
- package/dist/browser/{CommerceWidget-B36D9SAt.js → CommerceWidget-CeBBYCbK.js} +17 -47
- package/dist/browser/{FeesBreakdown-WeqZxAT6.js → FeesBreakdown-BU4haotD.js} +1 -1
- package/dist/browser/{OnRampWidget-DpxysET8.js → OnRampWidget-Ccvb3QkT.js} +5 -80
- package/dist/browser/{SaleWidget-CMkn5eAJ.js → SaleWidget-CPARFlzv.js} +61 -219
- package/dist/browser/{SpendingCapHero-BuWrv_Rb.js → SpendingCapHero-B-0YYZho.js} +1 -1
- package/dist/browser/{SwapWidget-CEnCMtGs.js → SwapWidget-ujE6uX-N.js} +12 -206
- package/dist/browser/{TokenImage-EqfdG328.js → TokenImage-BeUf_Ulv.js} +1 -1
- package/dist/browser/{TopUpView-D3BxE8R3.js → TopUpView-GMv3360Q.js} +3 -54
- package/dist/browser/{WalletApproveHero-C_8es7r9.js → WalletApproveHero-BJi7ufqM.js} +4 -12
- package/dist/browser/{WalletWidget-Czye7zS5.js → WalletWidget-BABrqsfd.js} +4 -96
- package/dist/browser/{index-WfurfROg.js → index-CcxHW36j.js} +1275 -9717
- package/dist/browser/{index-CcLq9am4.js → index-Cp1w6map.js} +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/{useInterval-CrmneADn.js → useInterval-DbCsm_gG.js} +1 -1
- package/dist/types/components/FormComponents/SelectForm/SelectForm.d.ts +1 -5
- package/dist/types/components/FormComponents/SelectInput/SelectInput.d.ts +1 -5
- package/dist/types/components/Transak/TransakIframe.d.ts +0 -1
- package/dist/types/components/Transak/useTransakEvents.d.ts +0 -4
- package/dist/types/components/WalletDrawer/ConnectWalletDrawer.d.ts +1 -2
- package/dist/types/lib/squid/hooks/useExecute.d.ts +1 -2
- package/dist/types/views/top-up/TopUpView.d.ts +1 -5
- package/dist/types/widgets/add-tokens/hooks/useError.d.ts +1 -1
- package/dist/types/widgets/purchase/components/PurchaseConnectWalletDrawer.d.ts +1 -3
- package/dist/types/widgets/sale/hooks/useSaleEvents.d.ts +5 -31
- package/dist/types/widgets/swap/components/Fees.d.ts +1 -1
- package/package.json +7 -9
- package/src/components/ConnectLoader/ConnectLoader.tsx +0 -16
- package/src/components/FormComponents/SelectForm/SelectForm.tsx +2 -18
- package/src/components/FormComponents/SelectInput/SelectInput.tsx +1 -12
- package/src/components/RouteOptionsDrawer/RouteOptionsDrawer.tsx +2 -26
- package/src/components/Transactions/ChangeWallet.tsx +1 -12
- package/src/components/Transactions/ClaimWithdrawalInProgress.tsx +0 -11
- package/src/components/Transactions/NoTransactions.tsx +0 -10
- package/src/components/Transactions/TransactionItemWithdrawPending.tsx +1 -13
- package/src/components/Transactions/Transactions.tsx +2 -28
- package/src/components/Transak/TransakIframe.tsx +0 -6
- package/src/components/Transak/useTransakEvents.ts +1 -70
- package/src/components/WalletDrawer/ConnectWalletDrawer.tsx +2 -35
- package/src/components/WalletDrawer/PayWithWalletDrawer.tsx +0 -1
- package/src/context/view-context/test-components/ViewContextTestComponent.tsx +14 -15
- package/src/lib/squid/hooks/useExecute.ts +5 -18
- package/src/views/top-up/TopUpView.tsx +5 -56
- package/src/widgets/add-tokens/AddTokensRoot.tsx +28 -29
- package/src/widgets/add-tokens/AddTokensWidget.tsx +2 -17
- package/src/widgets/add-tokens/components/TokenDrawerMenu.tsx +2 -18
- package/src/widgets/add-tokens/hooks/useError.tsx +1 -18
- package/src/widgets/add-tokens/hooks/useErrorHandler.ts +2 -12
- package/src/widgets/add-tokens/views/AddTokens.tsx +8 -154
- package/src/widgets/add-tokens/views/Review.tsx +6 -94
- package/src/widgets/bridge/BridgeWidget.tsx +0 -35
- package/src/widgets/bridge/BridgeWidgetRoot.tsx +17 -18
- package/src/widgets/bridge/components/BridgeForm.tsx +0 -20
- package/src/widgets/bridge/components/BridgeReviewSummary.tsx +1 -49
- package/src/widgets/bridge/components/WalletAndNetworkSelector.tsx +3 -122
- package/src/widgets/bridge/views/ApproveTransaction.tsx +1 -15
- package/src/widgets/bridge/views/Bridge.tsx +1 -16
- package/src/widgets/bridge/views/BridgeReview.tsx +1 -12
- package/src/widgets/bridge/views/ClaimWithdrawal.tsx +0 -11
- package/src/widgets/bridge/views/MoveInProgress.tsx +0 -24
- package/src/widgets/bridge/views/WalletNetworkSelectionView.tsx +1 -12
- package/src/widgets/connect/ConnectWidget.tsx +2 -18
- package/src/widgets/connect/ConnectWidgetRoot.tsx +15 -16
- package/src/widgets/connect/components/WalletList.tsx +6 -55
- package/src/widgets/connect/views/ConnectWallet.tsx +1 -12
- package/src/widgets/connect/views/ReadyToConnect.tsx +2 -29
- package/src/widgets/connect/views/SwitchNetworkEth.tsx +3 -22
- package/src/widgets/connect/views/SwitchNetworkZkEVM.tsx +0 -18
- package/src/widgets/immutable-commerce/CommerceWidgetRoot.tsx +17 -19
- package/src/widgets/on-ramp/OnRampWidget.tsx +0 -2
- package/src/widgets/on-ramp/OnRampWidgetRoot.tsx +23 -24
- package/src/widgets/on-ramp/views/OnRampMain.tsx +1 -91
- package/src/widgets/purchase/PurchaseWidgetRoot.tsx +22 -23
- package/src/widgets/purchase/components/PurchaseConnectWalletDrawer.tsx +2 -34
- package/src/widgets/purchase/components/PurchaseDeliverToWalletDrawer.tsx +0 -1
- package/src/widgets/purchase/components/PurchasePayWithWalletDrawer.tsx +0 -2
- package/src/widgets/purchase/components/PurchaseRouteOptionsDrawer/RouteOptionsDrawer.tsx +1 -30
- package/src/widgets/purchase/components/WithCard.tsx +0 -4
- package/src/widgets/purchase/views/Purchase.tsx +1 -2
- package/src/widgets/sale/SaleWidget.tsx +0 -2
- package/src/widgets/sale/SaleWidgetRoot.tsx +32 -33
- package/src/widgets/sale/components/OrderReview.tsx +2 -29
- package/src/widgets/sale/components/WithCard.tsx +0 -2
- package/src/widgets/sale/hooks/useSaleEvents.ts +3 -185
- package/src/widgets/sale/views/OrderSummary.tsx +2 -15
- package/src/widgets/sale/views/PayWithCard.tsx +4 -46
- package/src/widgets/sale/views/PayWithCoins.tsx +4 -9
- package/src/widgets/sale/views/PaymentMethods.tsx +3 -6
- package/src/widgets/sale/views/SaleErrorView.tsx +1 -1
- package/src/widgets/swap/SwapWidget.tsx +0 -24
- package/src/widgets/swap/SwapWidgetRoot.tsx +29 -30
- package/src/widgets/swap/components/Fees.tsx +1 -1
- package/src/widgets/swap/components/SwapForm.tsx +2 -140
- package/src/widgets/swap/views/ApproveERC20Onboarding.tsx +1 -36
- package/src/widgets/swap/views/SwapCoins.tsx +0 -17
- package/src/widgets/swap/views/SwapInProgress.tsx +0 -14
- package/src/widgets/transfer/TransferForm.tsx +3 -25
- package/src/widgets/transfer/TransferWidget.tsx +1 -23
- package/src/widgets/wallet/WalletWidgetRoot.tsx +24 -25
- package/src/widgets/wallet/components/BalanceItem/BalanceItem.tsx +1 -50
- package/src/widgets/wallet/components/NetworkMenu/NetworkMenu.tsx +0 -13
- package/src/widgets/wallet/components/WalletAddress/WalletAddress.tsx +0 -13
- package/src/widgets/wallet/views/CoinInfo.tsx +1 -12
- package/src/widgets/wallet/views/Settings.tsx +1 -15
- package/src/widgets/wallet/views/WalletBalances.tsx +0 -24
- package/tsconfig.json +0 -1
- package/dist/browser/auto-track-BcwQjFJ1.js +0 -105
- package/dist/browser/index-BSnE_6oQ.js +0 -27
- package/dist/browser/index-CKGatDzP.js +0 -60
- package/dist/browser/index-Cnt0i-EY.js +0 -65
- package/dist/browser/index-DLXeqRzN.js +0 -65
- package/dist/browser/index-MANbU_qG.js +0 -5634
- package/dist/browser/index-lHICKwNF.js +0 -446
- package/dist/browser/index.umd-Cn1Q502t.js +0 -32
- package/dist/browser/is-plan-event-enabled-mXX0dwl-.js +0 -17
- package/dist/types/context/analytics-provider/CustomAnalyticsProvider.d.ts +0 -7
- package/dist/types/context/analytics-provider/SegmentAnalyticsProvider.d.ts +0 -42
- package/dist/types/context/analytics-provider/SetupAnalytics.d.ts +0 -7
- package/dist/types/lib/analytics/identifyUser.d.ts +0 -8
- package/dist/types/lib/analytics/identifyUser.test.d.ts +0 -1
- package/src/context/analytics-provider/CustomAnalyticsProvider.tsx +0 -22
- package/src/context/analytics-provider/SegmentAnalyticsProvider.ts +0 -41
- package/src/context/analytics-provider/SetupAnalytics.tsx +0 -35
- package/src/lib/analytics/identifyUser.test.ts +0 -44
- package/src/lib/analytics/identifyUser.ts +0 -26
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect } from 'react';
|
|
2
|
-
import { Checkout, TelemetryConfig } from '@imtbl/checkout-sdk';
|
|
3
|
-
import { useAnalytics } from './SegmentAnalyticsProvider';
|
|
4
|
-
|
|
5
|
-
type SetupAnalyticsProps = {
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
checkout: Checkout
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function SetupAnalytics(
|
|
11
|
-
{ children, checkout }: SetupAnalyticsProps,
|
|
12
|
-
) {
|
|
13
|
-
const { updateWriteKey } = useAnalytics();
|
|
14
|
-
|
|
15
|
-
const telemetry = useCallback(async () => {
|
|
16
|
-
try {
|
|
17
|
-
return await checkout?.config?.remote.getConfig('telemetry');
|
|
18
|
-
} catch (err: any) {
|
|
19
|
-
// eslint-disable-next-line no-console
|
|
20
|
-
console.error('unable to fetch telemetry config: ', err);
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
}, [checkout]);
|
|
24
|
-
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
(async () => {
|
|
27
|
-
const config = await telemetry() as TelemetryConfig;
|
|
28
|
-
if (!config) return;
|
|
29
|
-
updateWriteKey(config.segmentPublishableKey);
|
|
30
|
-
})();
|
|
31
|
-
}, [telemetry]);
|
|
32
|
-
|
|
33
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
34
|
-
return (<>{children}</>);
|
|
35
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { WrappedBrowserProvider } from '@imtbl/checkout-sdk';
|
|
2
|
-
import { identifyUser } from './identifyUser';
|
|
3
|
-
|
|
4
|
-
describe('identifyUser', () => {
|
|
5
|
-
let provider;
|
|
6
|
-
let identify;
|
|
7
|
-
beforeEach(() => {
|
|
8
|
-
jest.resetAllMocks();
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
-
identify = jest.fn().mockReturnValue({});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('should identify a user by their wallet address and add properties isMetaMask and isPassportWallet', async () => {
|
|
14
|
-
provider = {
|
|
15
|
-
getSigner: jest.fn().mockReturnValue({
|
|
16
|
-
getAddress: jest.fn().mockResolvedValue('0xtest'),
|
|
17
|
-
}),
|
|
18
|
-
ethereumProvider: {
|
|
19
|
-
isMetaMask: true,
|
|
20
|
-
request: jest.fn(),
|
|
21
|
-
},
|
|
22
|
-
} as any as WrappedBrowserProvider;
|
|
23
|
-
|
|
24
|
-
await identifyUser(identify, provider);
|
|
25
|
-
expect(identify).toBeCalledWith('0xtest', { isMetaMask: true, isPassportWallet: false }, undefined);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should correctly identify users wallet as Passport', async () => {
|
|
29
|
-
const options = { foo: 'bar' };
|
|
30
|
-
|
|
31
|
-
provider = {
|
|
32
|
-
getSigner: jest.fn().mockReturnValue({
|
|
33
|
-
getAddress: jest.fn().mockResolvedValue('0xtest'),
|
|
34
|
-
}),
|
|
35
|
-
send: jest.fn(),
|
|
36
|
-
ethereumProvider: {
|
|
37
|
-
isPassport: true,
|
|
38
|
-
request: jest.fn(),
|
|
39
|
-
},
|
|
40
|
-
} as any as WrappedBrowserProvider;
|
|
41
|
-
await identifyUser(identify, provider, options);
|
|
42
|
-
expect(identify).toBeCalledWith('0xtest', { isMetaMask: false, isPassportWallet: true }, options);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { WrappedBrowserProvider } from '@imtbl/checkout-sdk';
|
|
2
|
-
import { isMetaMaskProvider, isPassportProvider } from '../provider';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* identifyUser - function to identify a user by their wallet address and call the function to raise analytics
|
|
6
|
-
* @param identify - The identify function from the useAnalytics() hook
|
|
7
|
-
* @param provider - the WrappedBrowserProvider used to find the user's walletAddress
|
|
8
|
-
* @param options - additional options to pass to the identify function
|
|
9
|
-
*/
|
|
10
|
-
export async function identifyUser(
|
|
11
|
-
identify: (id: string, attributes: Record<string, any>, options?: Record<string, any>) => void,
|
|
12
|
-
provider: WrappedBrowserProvider,
|
|
13
|
-
options?: Record<string, any>,
|
|
14
|
-
) {
|
|
15
|
-
// WT-1698 Analytics - Identify user here then progress to widget
|
|
16
|
-
const walletAddress = (await (await provider.getSigner()).getAddress()).toLowerCase();
|
|
17
|
-
const isMetaMask = isMetaMaskProvider(provider);
|
|
18
|
-
const isPassport = isPassportProvider(provider);
|
|
19
|
-
try {
|
|
20
|
-
identify(walletAddress, {
|
|
21
|
-
isMetaMask,
|
|
22
|
-
isPassportWallet: isPassport,
|
|
23
|
-
}, options);
|
|
24
|
-
// eslint-disable-next-line no-console
|
|
25
|
-
} catch (error: any) { console.error('analytics: unable to identify user: ', error); }
|
|
26
|
-
}
|