@ensofinance/checkout-widget 0.1.8 → 0.1.9

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.
Files changed (61) hide show
  1. package/dist/checkout-widget.es.js +24133 -25422
  2. package/dist/checkout-widget.umd.js +59 -65
  3. package/dist/index.d.ts +1 -3
  4. package/package.json +2 -2
  5. package/src/assets/usdc.webp +0 -0
  6. package/src/assets/usdt.webp +0 -0
  7. package/src/components/AmountInput.tsx +25 -41
  8. package/src/components/ChakraProvider.tsx +13 -36
  9. package/src/components/Checkout.tsx +0 -3
  10. package/src/components/CurrencySwapDisplay.tsx +22 -59
  11. package/src/components/DepositProcessing.tsx +1 -1
  12. package/src/components/ExchangeConfirmSecurity.tsx +1 -1
  13. package/src/components/QuoteParameters.tsx +1 -1
  14. package/src/components/TransactionDetailRow.tsx +2 -2
  15. package/src/components/cards/ExchangeCard.tsx +1 -1
  16. package/src/components/cards/OptionCard.tsx +1 -2
  17. package/src/components/cards/WalletCard.tsx +1 -1
  18. package/src/components/modal.tsx +3 -3
  19. package/src/components/steps/ExchangeFlow.tsx +1404 -231
  20. package/src/components/steps/FlowSelector.tsx +60 -117
  21. package/src/components/steps/WalletFlow/WalletAmountStep.tsx +2 -2
  22. package/src/components/steps/WalletFlow/WalletConfirmStep.tsx +51 -92
  23. package/src/components/steps/WalletFlow/WalletFlow.tsx +16 -17
  24. package/src/components/steps/WalletFlow/WalletQuoteStep.tsx +2 -2
  25. package/src/components/steps/WalletFlow/WalletTokenStep.tsx +4 -6
  26. package/src/components/ui/index.tsx +6 -23
  27. package/src/components/ui/toaster.tsx +1 -2
  28. package/src/types/index.ts +0 -97
  29. package/src/util/constants.tsx +0 -27
  30. package/src/util/enso-hooks.tsx +61 -75
  31. package/dist/checkout-widget.es.js.map +0 -1
  32. package/dist/checkout-widget.umd.js.map +0 -1
  33. package/src/assets/providers/alchemypay.svg +0 -21
  34. package/src/assets/providers/banxa.svg +0 -21
  35. package/src/assets/providers/binanceconnect.svg +0 -14
  36. package/src/assets/providers/kryptonim.svg +0 -6
  37. package/src/assets/providers/mercuryo.svg +0 -21
  38. package/src/assets/providers/moonpay.svg +0 -14
  39. package/src/assets/providers/stripe.svg +0 -16
  40. package/src/assets/providers/swapped.svg +0 -1
  41. package/src/assets/providers/topper.svg +0 -14
  42. package/src/assets/providers/transak.svg +0 -21
  43. package/src/assets/providers/unlimit.svg +0 -21
  44. package/src/components/steps/CardBuyFlow/CardBuyFlow.tsx +0 -412
  45. package/src/components/steps/CardBuyFlow/ChooseAmountStep.tsx +0 -352
  46. package/src/components/steps/CardBuyFlow/OpenWidgetStep.tsx +0 -193
  47. package/src/components/steps/SmartAccountFlow.tsx +0 -372
  48. package/src/components/steps/shared/ChooseAmountStep.tsx +0 -325
  49. package/src/components/steps/shared/SignUserOpStep.tsx +0 -117
  50. package/src/components/steps/shared/TrackUserOpStep.tsx +0 -625
  51. package/src/components/steps/shared/exchangeIntegration.ts +0 -19
  52. package/src/components/steps/shared/types.ts +0 -22
  53. package/src/components/ui/transitions.tsx +0 -16
  54. package/src/enso-api/model/bridgeTransactionResponse.ts +0 -37
  55. package/src/enso-api/model/bridgeTransactionResponseStatus.ts +0 -25
  56. package/src/enso-api/model/ensoEvent.ts +0 -30
  57. package/src/enso-api/model/ensoMetadata.ts +0 -23
  58. package/src/enso-api/model/layerZeroControllerCheckBridgeTransactionParams.ts +0 -21
  59. package/src/enso-api/model/layerZeroMessageStatus.ts +0 -39
  60. package/src/enso-api/model/refundDetails.ts +0 -21
  61. package/src/util/meld-hooks.tsx +0 -533
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ComponentType } from 'react';
2
2
  import { JSX as JSX_2 } from 'react/jsx-runtime';
3
3
  import { SystemConfig as WidgetTheme } from '@chakra-ui/react';
4
4
 
5
- export declare const Checkout: ({ config: { apiKey, tokenOut, chainIdOut, theme, enableExchange, enableCardBuy, cexBridgeChainMapping, recipient, enforceFlow, slippage, }, onClose, wrapper, }: {
5
+ export declare const Checkout: ({ config: { apiKey, tokenOut, chainIdOut, theme, enableExchange, cexBridgeChainMapping, recipient, enforceFlow, slippage, }, onClose, wrapper, }: {
6
6
  config: CheckoutConfig;
7
7
  wrapper?: ComponentType;
8
8
  onClose?: () => void;
@@ -14,8 +14,6 @@ export declare type CheckoutConfig = {
14
14
  apiKey: string;
15
15
  theme?: WidgetTheme;
16
16
  enableExchange?: SupportedExchanges[];
17
- /** Enable card purchases via MELD onramp */
18
- enableCardBuy?: boolean;
19
17
  /** Override the default CEX bridge chain mapping (maps target chains to intermediate chains for withdrawal + bridge) */
20
18
  cexBridgeChainMapping?: Record<number, number>;
21
19
  /** Override recipient address (defaults to connected wallet's smart account) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensofinance/checkout-widget",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "homepage": "https://www.enso.build/",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "generate-api": "orval",
22
22
  "publish": "npm publish --access public",
23
23
  "dev": "vite build --watch --mode=dev --minify=false --sourcemap=false --emptyOutDir=false",
24
- "build": "vite build",
24
+ "build": "vite build --sourcemap=false",
25
25
  "preview": "vite preview",
26
26
  "build:pump:publish": "npm run bump && npm run build && npm run publish"
27
27
  },
Binary file
Binary file
@@ -1,4 +1,4 @@
1
- import { Box, Icon, Skeleton, Text } from "@chakra-ui/react";
1
+ import { Box, Icon, Text } from "@chakra-ui/react";
2
2
  import { ArrowDownUpIcon } from "lucide-react";
3
3
  import { Input, IconButton, Tab } from "@/components/ui";
4
4
  import { formatNumber, formatUSD } from "@/util";
@@ -136,8 +136,6 @@ export const AmountInput = ({
136
136
  });
137
137
  };
138
138
 
139
- const isLoading = tokenPriceUsd === undefined && !tokenSymbol;
140
-
141
139
  const placeholder = value.mode === "usd" ? "$10.00" : "0.00";
142
140
  const displayValue =
143
141
  value.mode === "usd"
@@ -172,28 +170,24 @@ export const AmountInput = ({
172
170
  padding={"25.5px"}
173
171
  >
174
172
  {/* Main Input */}
175
- {isLoading ? (
176
- <Skeleton height="58px" width="180px" borderRadius="card" marginY={"8px"} />
177
- ) : (
178
- <Input
179
- inputMode="decimal"
180
- marginY={"8px"}
181
- variant={"text"}
182
- placeholder={placeholder}
183
- value={displayValue}
184
- onChange={(event) => handleInputChange(event.target.value)}
185
- />
186
- )}
173
+ <Input
174
+ inputMode="decimal"
175
+ marginY={"8px"}
176
+ variant={"text"}
177
+ placeholder={placeholder}
178
+ value={displayValue}
179
+ onChange={(event) => handleInputChange(event.target.value)}
180
+ />
187
181
 
188
182
  {/* Toggle Button and Equivalent Display */}
189
183
  <Box
190
184
  display={"flex"}
191
185
  gap={"3"}
192
186
  alignItems={"center"}
193
- onClick={isLoading ? undefined : handleToggleMode}
194
- _hover={isLoading ? undefined : { background: "bg.subtle" }}
195
- cursor={isLoading ? "default" : "pointer"}
196
- borderRadius={"card"}
187
+ onClick={handleToggleMode}
188
+ _hover={{ background: "bg.subtle" }}
189
+ cursor={"pointer"}
190
+ borderRadius={"lg"}
197
191
  px={"3"}
198
192
  >
199
193
  <IconButton
@@ -204,20 +198,16 @@ export const AmountInput = ({
204
198
  >
205
199
  <Icon
206
200
  as={ArrowDownUpIcon}
207
- color="fg.muted"
201
+ color="gray"
208
202
  width={"16px"}
209
203
  height={"16px"}
210
204
  />
211
205
  </IconButton>
212
206
 
213
207
  {/* Small equivalent value display */}
214
- {isLoading ? (
215
- <Skeleton height="16px" width="80px" borderRadius="card" />
216
- ) : (
217
- <Text fontSize="sm" color="fg.muted">
218
- {equivalentValue}
219
- </Text>
220
- )}
208
+ <Text fontSize="sm" color="fg.muted">
209
+ {equivalentValue}
210
+ </Text>
221
211
  </Box>
222
212
  </Box>
223
213
 
@@ -228,20 +218,14 @@ export const AmountInput = ({
228
218
  justifyContent={"center"}
229
219
  paddingBottom={"35px"}
230
220
  >
231
- {isLoading ? (
232
- percentOptions.map((option) => (
233
- <Skeleton key={option.label} height="32px" width="52px" borderRadius="control" />
234
- ))
235
- ) : (
236
- percentOptions.map((option) => (
237
- <Tab
238
- key={option.label}
239
- onClick={() => handlePercentSelect(option.value)}
240
- >
241
- {option.label}
242
- </Tab>
243
- ))
244
- )}
221
+ {percentOptions.map((option) => (
222
+ <Tab
223
+ key={option.label}
224
+ onClick={() => handlePercentSelect(option.value)}
225
+ >
226
+ {option.label}
227
+ </Tab>
228
+ ))}
245
229
  </Box>
246
230
  )}
247
231
  </Box>
@@ -22,7 +22,7 @@ export const buttonRecipe = defineRecipe({
22
22
  width: "100%",
23
23
  justifyContent: "center",
24
24
  alignItems: "center",
25
- borderRadius: "control",
25
+ borderRadius: "md",
26
26
  },
27
27
  variants: {
28
28
  variant: {
@@ -61,11 +61,11 @@ export const selectSlotRecipe = defineSlotRecipe({
61
61
  slots: selectAnatomy.keys(),
62
62
  base: {
63
63
  trigger: {
64
- borderRadius: "control",
64
+ borderRadius: "6px",
65
65
  boxShadow: "none",
66
66
  },
67
67
  content: {
68
- borderRadius: "control",
68
+ borderRadius: "6px",
69
69
  boxShadow: "none",
70
70
  },
71
71
  },
@@ -278,41 +278,18 @@ export const tableSlotRecipe = defineSlotRecipe({
278
278
 
279
279
  export const config = defineConfig({
280
280
  theme: {
281
- tokens: {
282
- radii: {
283
- container: { value: "16px" },
284
- card: { value: "8px" },
285
- control: { value: "6px" },
286
- },
287
- },
288
- keyframes: {
289
- fadeSlideUp: {
290
- from: { opacity: "0", transform: "translateY(6px)" },
291
- to: { opacity: "1", transform: "translateY(0)" },
292
- },
293
- fadeIn: {
294
- from: { opacity: "0" },
295
- to: { opacity: "1" },
296
- },
297
- },
298
281
  semanticTokens: {
299
282
  colors: {
300
- bg: { value: "#FFFFFF" },
301
- "bg.subtle": { value: "#F8FAFC" },
302
- "bg.emphasized": { value: "#F1F5F9" },
303
- "bg.muted": { value: "#F8FAFC" },
304
- fg: { value: "#1E171F" },
305
- "fg.muted": { value: "#64748B" },
306
- "fg.subtle": { value: "#94A3B8" },
307
- border: { value: "#E4E4E7" },
308
- "border.subtle": { value: "#F4F4F5" },
309
- "border.emphasized": { value: "#1e171f4d" },
283
+ border: {
284
+ value: "#E4E4E7",
285
+ },
286
+ "border.subtle": {
287
+ value: "#F4F4F5",
288
+ },
289
+ "border.emphasized": {
290
+ value: "#1e171f4d",
291
+ },
310
292
  primary: { value: "black" },
311
- "primary.emphasis": { value: "#000000" },
312
- "primary.muted": { value: "rgba(0,0,0,0.6)" },
313
- success: { value: "#10B981" },
314
- error: { value: "#EF4444" },
315
- warning: { value: "#F59E0B" },
316
293
  customBlack: { value: "#1E171F" },
317
294
  customWhite: { value: "#FAFAFA" },
318
295
  gray: {
@@ -369,7 +346,7 @@ const ChakraProvider = ({
369
346
  globalCss: {
370
347
  [varRoot]: {
371
348
  ...defaultConfig.globalCss?.html,
372
- borderRadius: "container",
349
+ borderRadius: "xl",
373
350
  shadow: "sm",
374
351
  border: "none",
375
352
  },
@@ -14,7 +14,6 @@ import posthog from "posthog-js";
14
14
  type ICheckoutContext = {
15
15
  handleClose: () => void;
16
16
  enableExchange?: SupportedExchanges[];
17
- enableCardBuy?: boolean;
18
17
  cexBridgeChainMapping?: Record<number, number>;
19
18
  enforceFlow?: EnforceFlow;
20
19
  };
@@ -28,7 +27,6 @@ const Checkout = ({
28
27
  chainIdOut,
29
28
  theme,
30
29
  enableExchange,
31
- enableCardBuy,
32
30
  cexBridgeChainMapping,
33
31
  recipient,
34
32
  enforceFlow,
@@ -91,7 +89,6 @@ const Checkout = ({
91
89
  value={{
92
90
  handleClose,
93
91
  enableExchange,
94
- enableCardBuy,
95
92
  cexBridgeChainMapping,
96
93
  enforceFlow,
97
94
  }}
@@ -1,11 +1,4 @@
1
- import {
2
- Box,
3
- chakra,
4
- Flex,
5
- Skeleton,
6
- SkeletonCircle,
7
- Text,
8
- } from "@chakra-ui/react";
1
+ import { Box, chakra, Flex, Text } from "@chakra-ui/react";
9
2
  import { ChevronRightIcon } from "lucide-react";
10
3
  import { Token } from "@/util/common";
11
4
  import {
@@ -191,16 +184,6 @@ const DepositItem = ({
191
184
  );
192
185
  };
193
186
 
194
- const SwapItemSkeleton = ({ size = 24 }: { size?: number }) => (
195
- <Flex align="center" gap={2}>
196
- <SkeletonCircle size={`${size}px`} />
197
- <Box>
198
- <Skeleton height="12px" width="48px" mb={1} borderRadius="card" />
199
- <Skeleton height="12px" width="36px" borderRadius="card" />
200
- </Box>
201
- </Flex>
202
- );
203
-
204
187
  const CurrencySwapDisplay = ({
205
188
  tokenIn,
206
189
  tokenOut,
@@ -216,50 +199,30 @@ const CurrencySwapDisplay = ({
216
199
  isNontokenized?: boolean;
217
200
  size?: number;
218
201
  }) => {
219
- const isLoading = !tokenIn || !tokenOut;
220
-
221
202
  return (
222
203
  <SwapWrapper>
223
- {isLoading ? (
224
- <>
225
- <SwapItemSkeleton size={size} />
226
- <ChevronRightIcon
227
- color={"var(--chakra-colors-fg-muted)"}
228
- width={"16px"}
229
- height={"16px"}
230
- />
231
- <SwapItemSkeleton size={size} />
232
- </>
204
+ <SwapItem
205
+ token={tokenIn}
206
+ chainId={chainIdIn}
207
+ title={"You send"}
208
+ subTitle={tokenIn?.symbol}
209
+ size={size}
210
+ />
211
+ <ChevronRightIcon
212
+ color={"#707070"}
213
+ width={"16px"}
214
+ height={"16px"}
215
+ />
216
+ {isNontokenized && tokenOut?.protocol ? (
217
+ <DepositItem token={tokenOut} chainId={chainIdOut} size={size} />
233
218
  ) : (
234
- <>
235
- <SwapItem
236
- token={tokenIn}
237
- chainId={chainIdIn}
238
- title={"You send"}
239
- subTitle={tokenIn?.symbol}
240
- size={size}
241
- />
242
- <ChevronRightIcon
243
- color={"var(--chakra-colors-fg-muted)"}
244
- width={"16px"}
245
- height={"16px"}
246
- />
247
- {isNontokenized && tokenOut?.protocol ? (
248
- <DepositItem
249
- token={tokenOut}
250
- chainId={chainIdOut}
251
- size={size}
252
- />
253
- ) : (
254
- <SwapItem
255
- token={tokenOut}
256
- chainId={chainIdOut}
257
- title={"You receive"}
258
- subTitle={tokenOut?.symbol}
259
- size={size}
260
- />
261
- )}
262
- </>
219
+ <SwapItem
220
+ token={tokenOut}
221
+ chainId={chainIdOut}
222
+ title={"You receive"}
223
+ subTitle={tokenOut?.symbol}
224
+ size={size}
225
+ />
263
226
  )}
264
227
  </SwapWrapper>
265
228
  );
@@ -50,7 +50,7 @@ const DepositProcessing = ({
50
50
  <Box
51
51
  border="1px solid"
52
52
  borderColor="border.subtle"
53
- borderRadius="card"
53
+ borderRadius="12px"
54
54
  width="100%"
55
55
  bg="bg"
56
56
  >
@@ -95,7 +95,7 @@ const ConfirmExchangeStep = ({
95
95
  />
96
96
 
97
97
  <Helper>
98
- <Image src={LogoSvg} color={"fg.muted"} w={"24px"} />
98
+ <Image src={LogoSvg} color={"gray"} w={"24px"} />
99
99
  Enso securely encrypts all user data.
100
100
  </Helper>
101
101
  </Box>
@@ -25,7 +25,7 @@ import {
25
25
  SupportedChainId,
26
26
  } from "@/util/constants";
27
27
  import { useMemo } from "react";
28
- import { EXCHANGE_ICON_BY_TYPE } from "@/components/steps/shared/exchangeIntegration";
28
+ import { EXCHANGE_ICON_BY_TYPE } from "@/components/steps/ExchangeFlow";
29
29
 
30
30
  export const ERROR_MSG =
31
31
  "Swap not found for a required underlying of defi route, please make sure your amount is within an acceptable range";
@@ -12,7 +12,7 @@ export const DetailRowContainer = chakra("div", {
12
12
  alignItems: "center",
13
13
  h: "36px",
14
14
  p: "8px 12px",
15
- borderRadius: "card",
15
+ borderRadius: "8px",
16
16
  bg: "bg",
17
17
  w: "100%",
18
18
  },
@@ -57,7 +57,7 @@ export const TransactionDetailRow = () => {
57
57
  <Box
58
58
  width="100%"
59
59
  bg="bg.subtle"
60
- borderRadius="card"
60
+ borderRadius="md"
61
61
  padding="12px"
62
62
  transition="all 0.2s"
63
63
  >
@@ -32,7 +32,7 @@ const ExchangeCard: FC<IProps> = ({
32
32
  ),
33
33
  low: <Tag>Low Balance</Tag>,
34
34
  connected: (
35
- <Icon as={CheckIcon} color="success" width={"16px"} height={"16px"} />
35
+ <Icon as={CheckIcon} color="green" width={"16px"} height={"16px"} />
36
36
  ),
37
37
  none: null,
38
38
  };
@@ -39,7 +39,6 @@ const OptionCard = ({
39
39
  <Image
40
40
  w={"32px"}
41
41
  h={"32px"}
42
- objectFit={"contain"}
43
42
  borderRadius={"full"}
44
43
  position={"relative"}
45
44
  zIndex={index}
@@ -50,7 +49,7 @@ const OptionCard = ({
50
49
  </Box>
51
50
  <Icon
52
51
  as={ChevronRight}
53
- color="fg.muted"
52
+ color="gray"
54
53
  width={"16px"}
55
54
  height={"16px"}
56
55
  />
@@ -85,7 +85,7 @@ const WalletCard = ({
85
85
  {status === WalletStatus.CONNECTED && (
86
86
  <Icon
87
87
  as={CheckIcon}
88
- color="success"
88
+ color="green"
89
89
  width={"16px"}
90
90
  height={"16px"}
91
91
  />
@@ -35,11 +35,11 @@ export const ModalWrapper = chakra("div", {
35
35
  maxWidth: "374px",
36
36
  justifyContent: "center",
37
37
  alignItems: "center",
38
- borderRadius: "card",
38
+ borderRadius: "lg",
39
39
  border: "1px solid",
40
- borderColor: "border",
40
+ borderColor: "gray.300",
41
41
  padding: "16px",
42
- backgroundColor: "bg",
42
+ backgroundColor: "white",
43
43
  },
44
44
  });
45
45