@funkit/connect 0.1.13 → 0.1.15

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 (30) hide show
  1. package/dist/{chunk-UOUEGWLS.js → chunk-47OHV4T2.js} +2 -2
  2. package/dist/{chunk-Q73FKLU4.js → chunk-C2QHNJBG.js} +2 -2
  3. package/dist/{chunk-BQU2NRO5.js → chunk-IDQLTS4C.js} +231 -98
  4. package/dist/components/FunCheckoutHistoryModal/FunCheckoutHistoryDetail.d.ts +1 -1
  5. package/dist/components/FunCheckoutHistoryModal/FunCheckoutHistoryModal.d.ts +2 -1
  6. package/dist/components/FunkitProvider/FunkitCheckoutContext.d.ts +8 -4
  7. package/dist/components/FunkitProvider/ModalContext.d.ts +1 -1
  8. package/dist/components/index.js +3 -3
  9. package/dist/hooks/useCheckoutType.d.ts +5 -0
  10. package/dist/hooks/useFunListeners.d.ts +2 -1
  11. package/dist/index.js +3 -3
  12. package/dist/themes/darkTheme.js +1 -1
  13. package/dist/themes/lightTheme.js +1 -1
  14. package/dist/utils/checkout.d.ts +1 -0
  15. package/dist/wallets/walletConnectors/index.js +41 -41
  16. package/package.json +4 -4
  17. package/dist/wallets/walletConnectors/chunk-2XHTO74O.js +0 -226
  18. package/dist/wallets/walletConnectors/chunk-4WS4ZSRN.js +0 -84
  19. package/dist/wallets/walletConnectors/chunk-BDKAIAQA.js +0 -71
  20. package/dist/wallets/walletConnectors/chunk-DBMFZSXN.js +0 -52
  21. package/dist/wallets/walletConnectors/chunk-FTTYELWN.js +0 -71
  22. package/dist/wallets/walletConnectors/chunk-JJICTRJY.js +0 -114
  23. package/dist/wallets/walletConnectors/chunk-KUXG7P5Q.js +0 -102
  24. package/dist/wallets/walletConnectors/chunk-LBSWP7R6.js +0 -81
  25. package/dist/wallets/walletConnectors/chunk-MDDT3PSR.js +0 -110
  26. package/dist/wallets/walletConnectors/chunk-Q6N2YWW4.js +0 -112
  27. package/dist/wallets/walletConnectors/chunk-RL5OHS6R.js +0 -113
  28. package/dist/wallets/walletConnectors/chunk-TORM2ZGA.js +0 -117
  29. package/dist/wallets/walletConnectors/chunk-VAR774R5.js +0 -105
  30. package/dist/wallets/walletConnectors/chunk-X6A7D2EA.js +0 -71
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  darkTheme
4
- } from "./chunk-UOUEGWLS.js";
4
+ } from "./chunk-47OHV4T2.js";
5
5
  import {
6
6
  lightTheme
7
- } from "./chunk-Q73FKLU4.js";
7
+ } from "./chunk-C2QHNJBG.js";
8
8
 
9
9
  // src/components/index.ts
10
10
  import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3 } from "@funkit/core";
@@ -1653,7 +1653,6 @@ function GeneralWalletProvider({ children }) {
1653
1653
  DEFAULT_FUNWALLET_INDEX
1654
1654
  )
1655
1655
  });
1656
- console.log(">>>", await newFunWallet.getAddress());
1657
1656
  }
1658
1657
  logger.log("setupFunWallet_result", { newFunWallet, newFunWalletAuth });
1659
1658
  setFunWallet(newFunWallet);
@@ -14930,6 +14929,7 @@ import {
14930
14929
  getCheckoutByDepositAddress,
14931
14930
  getCheckoutQuote as getApiCheckoutQuote,
14932
14931
  getCheckoutsByFunWalletAddress,
14932
+ getCheckoutsByRecipientAddress,
14933
14933
  getMoonpayBuyQuoteForCreditCard,
14934
14934
  initializeCheckout as postApiInitializeCheckout,
14935
14935
  isAddress as isAddress3,
@@ -15295,11 +15295,13 @@ function generateDefaultCheckoutHistoryStateMap() {
15295
15295
  function categorizeCheckoutHistories(checkoutHistoryList) {
15296
15296
  const stateMap = generateDefaultCheckoutHistoryStateMap();
15297
15297
  const depositAddrMap = {};
15298
+ const currentDepositAddrMap = {};
15298
15299
  checkoutHistoryList.forEach((item) => {
15299
15300
  depositAddrMap[item.depositAddr] = item;
15301
+ currentDepositAddrMap[item.currentDepositAddr] = item;
15300
15302
  stateMap[item.state].push(item);
15301
15303
  });
15302
- return { stateMap, depositAddrMap };
15304
+ return { stateMap, depositAddrMap, currentDepositAddrMap };
15303
15305
  }
15304
15306
  function getCheckoutStateStepNumber(state) {
15305
15307
  if (FROM_PROGRESS_CHECKOUT_STATES.includes(state)) {
@@ -17371,7 +17373,11 @@ function FunTransactionSummary({
17371
17373
  src: CHECKOUT_ASSET[symbol.toLowerCase()].icon,
17372
17374
  height: 16,
17373
17375
  width: 16,
17374
- style: { marginRight: "6px" }
17376
+ style: {
17377
+ maxHeight: 16,
17378
+ maxWidth: 16,
17379
+ marginRight: "6px"
17380
+ }
17375
17381
  }), /* @__PURE__ */ React56.createElement(Text, {
17376
17382
  weight: "medium",
17377
17383
  color: "modalText",
@@ -17843,8 +17849,8 @@ import React75 from "react";
17843
17849
 
17844
17850
  // src/components/FunPayments/FunPaymentMeshType.tsx
17845
17851
  import {
17846
- createFrontConnection
17847
- } from "@front-finance/link";
17852
+ createLink
17853
+ } from "@meshconnect/web-link-sdk";
17848
17854
  import React66, { useCallback as useCallback10, useEffect as useEffect17, useMemo as useMemo12, useState as useState15 } from "react";
17849
17855
 
17850
17856
  // src/components/FunSelect/FunSelect.tsx
@@ -18073,19 +18079,19 @@ function FunPaymentMeshType({
18073
18079
  const [meshPreError, setMeshPreError] = useState15("");
18074
18080
  const funkitConfig = useFunkitConfig();
18075
18081
  const { options } = useMeshExchanges({ fullInfo: true });
18076
- const [frontConnection, setFrontConnection] = useState15(null);
18082
+ const [linkConnection, setLinkConnection] = useState15(null);
18077
18083
  useEffect17(() => {
18078
- const frontConnect = createFrontConnection({
18084
+ const newLinkConnection = createLink({
18079
18085
  clientId: "e1880c6d-5af8-4634-3182-08dba58a99a5",
18080
- onBrokerConnected: (brokerData) => {
18081
- logger.log(">onBrokerConnected", brokerData);
18086
+ onIntegrationConnected: (brokerData) => {
18087
+ logger.log("meshLink:onBrokerConnected", brokerData);
18082
18088
  onFinish(brokerData);
18083
18089
  },
18084
18090
  onTransferFinished: (payload) => {
18085
- logger.log(">onTransferFinished", payload);
18091
+ logger.log("meshLink:onTransferFinished", payload);
18086
18092
  },
18087
18093
  onEvent: (payload) => {
18088
- logger.log(">onEvent", payload);
18094
+ logger.log("meshLink:onEvent", payload);
18089
18095
  },
18090
18096
  onExit: (error) => {
18091
18097
  onSoftHide(false);
@@ -18096,7 +18102,7 @@ function FunPaymentMeshType({
18096
18102
  },
18097
18103
  accessTokens: []
18098
18104
  });
18099
- setFrontConnection({ ...frontConnect });
18105
+ setLinkConnection({ ...newLinkConnection });
18100
18106
  }, [onFinish, onSoftHide]);
18101
18107
  const onClickContinue = useCallback10(async () => {
18102
18108
  try {
@@ -18110,9 +18116,9 @@ function FunPaymentMeshType({
18110
18116
  }
18111
18117
  const response = await fetchMeshLinkToken(exchange, funkitConfig.apiKey);
18112
18118
  const linkToken = response.linkToken;
18113
- if (frontConnection && linkToken) {
18119
+ if (linkConnection && linkToken) {
18114
18120
  onSoftHide(true);
18115
- frontConnection.openLink(linkToken);
18121
+ linkConnection.openLink(linkToken);
18116
18122
  }
18117
18123
  } catch (err) {
18118
18124
  logger.error("Unable to fetch link token", err);
@@ -18123,7 +18129,7 @@ function FunPaymentMeshType({
18123
18129
  } finally {
18124
18130
  setIsLoadingMeshModal(false);
18125
18131
  }
18126
- }, [exchange, frontConnection, funkitConfig?.apiKey, onSoftHide]);
18132
+ }, [exchange, linkConnection, funkitConfig?.apiKey, onSoftHide]);
18127
18133
  const canContinue = useMemo12(() => isNotNullish(exchange), [exchange]);
18128
18134
  const hasMeshPreError = useMemo12(() => meshPreError !== "", [meshPreError]);
18129
18135
  const filteredOptions = useMemo12(
@@ -19963,6 +19969,7 @@ var FunkitCheckoutContext = createContext12({
19963
19969
  checkoutHistoryList: [],
19964
19970
  checkoutHistoryStateMap: {},
19965
19971
  checkoutHistoryDepositAddrMap: {},
19972
+ checkoutHistoryCurrentDepositAddrMap: {},
19966
19973
  isCheckoutHistoryInited: false,
19967
19974
  isRefreshingCheckoutHistory: true,
19968
19975
  _startCheckoutHistoryListener: () => void 0,
@@ -19982,23 +19989,36 @@ function FunkitCheckoutProvider({ children }) {
19982
19989
  const [checkoutHistoryList, setCheckoutHistoryList] = useState22([]);
19983
19990
  const {
19984
19991
  stateMap: checkoutHistoryStateMap,
19985
- depositAddrMap: checkoutHistoryDepositAddrMap
19992
+ depositAddrMap: checkoutHistoryDepositAddrMap,
19993
+ currentDepositAddrMap: checkoutHistoryCurrentDepositAddrMap
19986
19994
  } = useMemo18(() => {
19987
19995
  return categorizeCheckoutHistories(checkoutHistoryList);
19988
19996
  }, [checkoutHistoryList]);
19989
19997
  const [activeCheckouts, setActiveCheckouts] = useState22({});
19990
19998
  const [refreshSymbol, triggerRefreshSymbol] = useSymbolRefresh_default();
19999
+ const [historyRecipientAddress, setHistoryRecipientAddress] = useState22();
19991
20000
  const [isCheckoutHistoryInited, setIsCheckoutHistoryInited] = useState22(false);
19992
20001
  const [isRefreshingCheckoutHistory, setIsRefreshingCheckoutHistory] = useState22(true);
19993
20002
  const _refreshCheckoutHistory = useCallback15(async () => {
19994
20003
  const funWalletAddress = await funWallet?.getAddress();
19995
- if (funkitConfig?.apiKey && funWalletAddress) {
20004
+ if (funkitConfig?.apiKey) {
19996
20005
  try {
19997
20006
  setIsRefreshingCheckoutHistory(true);
19998
- const newCheckoutHistoryList = await getCheckoutsByFunWalletAddress({
19999
- funWalletAddress,
20000
- apiKey: funkitConfig?.apiKey
20001
- });
20007
+ let newCheckoutHistoryList = [];
20008
+ if (funWalletAddress) {
20009
+ logger.log("getCheckoutsByFunWalletAddress");
20010
+ newCheckoutHistoryList = await getCheckoutsByFunWalletAddress({
20011
+ funWalletAddress,
20012
+ apiKey: funkitConfig?.apiKey
20013
+ });
20014
+ } else if (historyRecipientAddress) {
20015
+ logger.log("getCheckoutsByRecipientAddress");
20016
+ newCheckoutHistoryList = await getCheckoutsByRecipientAddress({
20017
+ recipientAddress: historyRecipientAddress,
20018
+ apiKey: funkitConfig?.apiKey
20019
+ });
20020
+ }
20021
+ logger.log("newCheckoutHistoryList", newCheckoutHistoryList);
20002
20022
  setCheckoutHistoryList(
20003
20023
  newCheckoutHistoryList.sort((a, b) => b.createdTimeMs - a.createdTimeMs)
20004
20024
  );
@@ -20009,16 +20029,20 @@ function FunkitCheckoutProvider({ children }) {
20009
20029
  setIsRefreshingCheckoutHistory(false);
20010
20030
  }
20011
20031
  }
20012
- }, [funWallet, funkitConfig?.apiKey]);
20032
+ }, [funWallet, funkitConfig?.apiKey, historyRecipientAddress]);
20013
20033
  useEffect21(() => {
20014
20034
  _refreshCheckoutHistory();
20015
20035
  }, [refreshSymbol]);
20016
- const _startCheckoutHistoryListener = useCallback15(() => {
20017
- clearInterval(intervalRef.current);
20018
- intervalRef.current = setInterval(() => {
20019
- triggerRefreshSymbol();
20020
- }, CHECKOUT_HISTORY_REFETCH_INTERVAL_MS);
20021
- }, [triggerRefreshSymbol]);
20036
+ const _startCheckoutHistoryListener = useCallback15(
20037
+ (recipientAddr) => {
20038
+ setHistoryRecipientAddress(recipientAddr);
20039
+ clearInterval(intervalRef.current);
20040
+ intervalRef.current = setInterval(() => {
20041
+ triggerRefreshSymbol();
20042
+ }, CHECKOUT_HISTORY_REFETCH_INTERVAL_MS);
20043
+ },
20044
+ [triggerRefreshSymbol]
20045
+ );
20022
20046
  const _stopCheckoutHistoryListener = useCallback15(() => {
20023
20047
  clearInterval(intervalRef.current);
20024
20048
  }, []);
@@ -20346,6 +20370,7 @@ function FunkitCheckoutProvider({ children }) {
20346
20370
  checkoutHistoryList,
20347
20371
  checkoutHistoryStateMap,
20348
20372
  checkoutHistoryDepositAddrMap,
20373
+ checkoutHistoryCurrentDepositAddrMap,
20349
20374
  isCheckoutHistoryInited,
20350
20375
  isRefreshingCheckoutHistory,
20351
20376
  _startCheckoutHistoryListener,
@@ -20397,9 +20422,12 @@ var useFunkitPreCheckoutInternal = (checkoutId) => {
20397
20422
  getCheckoutDraftDollarValue: async () => await _getCheckoutDraftDollarValue(checkoutId)
20398
20423
  };
20399
20424
  };
20400
- var useFunkitPostCheckoutInternal = (depositAddress) => {
20425
+ var useFunkitPostCheckoutInternal = (depositAddress, isCheckoutSpecialCrFlow) => {
20401
20426
  const funkitConfig = useFunkitConfig();
20402
- const { checkoutHistoryDepositAddrMap } = useContext11(FunkitCheckoutContext);
20427
+ const {
20428
+ checkoutHistoryDepositAddrMap,
20429
+ checkoutHistoryCurrentDepositAddrMap
20430
+ } = useContext11(FunkitCheckoutContext);
20403
20431
  const [checkoutHistoryInfo, setCheckoutHistoryInfo] = useState22();
20404
20432
  const [isLoading, setIsLoading] = useState22(false);
20405
20433
  if (!depositAddress || !isAddress3(depositAddress)) {
@@ -20410,20 +20438,41 @@ var useFunkitPostCheckoutInternal = (depositAddress) => {
20410
20438
  setIsLoading(true);
20411
20439
  let checkoutHistory;
20412
20440
  if (checkoutHistoryDepositAddrMap?.[depositAddress]) {
20441
+ logger.log("setupCheckoutHistory:checkoutHistoryDepositAddrMap");
20413
20442
  checkoutHistory = checkoutHistoryDepositAddrMap[depositAddress];
20443
+ } else if (checkoutHistoryCurrentDepositAddrMap?.[depositAddress]) {
20444
+ logger.log("setupCheckoutHistory:checkoutHistoryCurrentDepositAddrMap");
20445
+ checkoutHistory = checkoutHistoryCurrentDepositAddrMap[depositAddress];
20446
+ } else if (isCheckoutSpecialCrFlow) {
20447
+ logger.log("setupCheckoutHistory:getCheckoutsByRecipientAddress");
20448
+ const historyList = await getCheckoutsByRecipientAddress({
20449
+ recipientAddress: depositAddress,
20450
+ apiKey: funkitConfig?.apiKey
20451
+ });
20452
+ checkoutHistory = historyList.sort(
20453
+ (a, b) => b.createdTimeMs - a.createdTimeMs
20454
+ )[0];
20414
20455
  } else {
20456
+ logger.log("setupCheckoutHistory:getCheckoutByDepositAddress");
20415
20457
  checkoutHistory = await getCheckoutByDepositAddress({
20416
20458
  depositAddress,
20417
20459
  apiKey: funkitConfig?.apiKey
20418
20460
  });
20419
20461
  }
20462
+ logger.log("setupCheckoutHistory:checkoutHistory", checkoutHistory);
20420
20463
  setCheckoutHistoryInfo(checkoutHistory);
20421
20464
  } catch (err) {
20422
20465
  logger.error("setupCheckoutHistory:error", err);
20423
20466
  } finally {
20424
20467
  setIsLoading(false);
20425
20468
  }
20426
- }, [checkoutHistoryDepositAddrMap, depositAddress, funkitConfig?.apiKey]);
20469
+ }, [
20470
+ checkoutHistoryCurrentDepositAddrMap,
20471
+ checkoutHistoryDepositAddrMap,
20472
+ depositAddress,
20473
+ funkitConfig?.apiKey,
20474
+ isCheckoutSpecialCrFlow
20475
+ ]);
20427
20476
  useEffect21(() => {
20428
20477
  setupCheckoutHistory().catch(logger.warn);
20429
20478
  }, [depositAddress, checkoutHistoryDepositAddrMap]);
@@ -20464,6 +20513,13 @@ var useFunkitCheckout = (props) => {
20464
20513
  },
20465
20514
  [onError]
20466
20515
  );
20516
+ const onOpenWrapper = useCallback15(
20517
+ (newId) => {
20518
+ props?.onOpen?.();
20519
+ openFunCheckoutModal?.(newId);
20520
+ },
20521
+ [openFunCheckoutModal, props]
20522
+ );
20467
20523
  const beginCheckout = useCallback15(
20468
20524
  async (inputConfig = config) => {
20469
20525
  const validationResult = validateCheckoutConfig(inputConfig);
@@ -20488,7 +20544,7 @@ var useFunkitCheckout = (props) => {
20488
20544
  return;
20489
20545
  }
20490
20546
  }
20491
- openFunCheckoutModal?.(newId);
20547
+ onOpenWrapper?.(newId);
20492
20548
  } else {
20493
20549
  openConnectModal?.();
20494
20550
  setWaitingLogin(inputConfig);
@@ -20507,8 +20563,8 @@ var useFunkitCheckout = (props) => {
20507
20563
  _initNewCheckout,
20508
20564
  props,
20509
20565
  isUserLoggedIn,
20566
+ onOpenWrapper,
20510
20567
  walletAddress,
20511
- openFunCheckoutModal,
20512
20568
  onErrorWrapper,
20513
20569
  openConnectModal
20514
20570
  ]
@@ -20527,14 +20583,14 @@ var useFunkitCheckout = (props) => {
20527
20583
  };
20528
20584
 
20529
20585
  // src/hooks/useFunListeners.ts
20530
- function useCheckoutHistoryListener(activate = true) {
20586
+ function useCheckoutHistoryListener(activate = true, recipientAddr) {
20531
20587
  const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useFunkitAllPostCheckoutsInternal();
20532
20588
  useEffect22(() => {
20533
20589
  if (activate) {
20534
- startCheckoutHistoryListener();
20590
+ startCheckoutHistoryListener(recipientAddr);
20535
20591
  }
20536
20592
  return () => stopCheckoutHistoryListener();
20537
- }, []);
20593
+ }, [activate]);
20538
20594
  }
20539
20595
  function useWalletAssetsListener(activate = true) {
20540
20596
  const { startAssetsListener, stopAssetsListener } = useGeneralWallet();
@@ -20543,7 +20599,7 @@ function useWalletAssetsListener(activate = true) {
20543
20599
  startAssetsListener();
20544
20600
  }
20545
20601
  return () => stopAssetsListener();
20546
- }, []);
20602
+ }, [activate]);
20547
20603
  }
20548
20604
 
20549
20605
  // src/components/FunNotification/FunCheckoutNotification.tsx
@@ -20568,6 +20624,22 @@ function useCheckoutStateBooleans(checkoutState) {
20568
20624
  };
20569
20625
  }
20570
20626
 
20627
+ // src/hooks/useCheckoutType.ts
20628
+ function useCheckoutType(checkoutItem) {
20629
+ if (!checkoutItem) {
20630
+ return {
20631
+ isCheckoutCrFlow: false,
20632
+ isCheckoutSpecialCrFlow: false
20633
+ };
20634
+ }
20635
+ const isCheckoutCrFlow = checkoutItem.initSettings.config.customRecipient;
20636
+ const isCheckoutSpecialCrFlow = isCheckoutCrFlow && checkoutItem.selectedSourceAssetInfo.chainId === checkoutItem.initSettings.config.targetChain && checkoutItem.selectedSourceAssetInfo.address.toLowerCase() === checkoutItem.initSettings.config.targetAsset.toLowerCase();
20637
+ return {
20638
+ isCheckoutCrFlow,
20639
+ isCheckoutSpecialCrFlow
20640
+ };
20641
+ }
20642
+
20571
20643
  // src/components/FunButton/FunViewTxButton.tsx
20572
20644
  import React86 from "react";
20573
20645
  function FunViewTxButton({ onClick }) {
@@ -20625,6 +20697,9 @@ function FunCheckoutNotification({
20625
20697
  checkoutHistoryItem,
20626
20698
  onBeforeRedirect
20627
20699
  }) {
20700
+ const { isCheckoutSpecialCrFlow } = useCheckoutType(
20701
+ checkoutHistoryItem.clientMetadata
20702
+ );
20628
20703
  const { openFunCheckoutHistoryModal } = useFunCheckoutHistoryModal();
20629
20704
  const { isProcessing, isCompleted, isError, isExpired, isTerminal } = useCheckoutStateBooleans(checkoutHistoryItem.state);
20630
20705
  const titleVerb = useMemo19(() => {
@@ -20689,7 +20764,10 @@ function FunCheckoutNotification({
20689
20764
  onClick: () => {
20690
20765
  if (checkoutHistoryItem.depositAddr) {
20691
20766
  onBeforeRedirect?.();
20692
- openFunCheckoutHistoryModal?.(checkoutHistoryItem.depositAddr);
20767
+ openFunCheckoutHistoryModal?.(
20768
+ checkoutHistoryItem.depositAddr,
20769
+ isCheckoutSpecialCrFlow
20770
+ );
20693
20771
  }
20694
20772
  }
20695
20773
  })));
@@ -21940,6 +22018,7 @@ function FunCheckoutHistoryDetail({
21940
22018
  checkoutHistoryInfo
21941
22019
  }) {
21942
22020
  const checkoutItem = checkoutHistoryInfo.clientMetadata;
22021
+ const { isCheckoutCrFlow, isCheckoutSpecialCrFlow } = useCheckoutType(checkoutItem);
21943
22022
  const {
21944
22023
  isProcessing,
21945
22024
  isCompleted,
@@ -21948,7 +22027,11 @@ function FunCheckoutHistoryDetail({
21948
22027
  isExpired,
21949
22028
  isTerminal
21950
22029
  } = useCheckoutStateBooleans(checkoutHistoryInfo.state);
21951
- useCheckoutHistoryListener(isProcessing);
22030
+ const isFailedFinal = isFailed && !isCheckoutSpecialCrFlow;
22031
+ useCheckoutHistoryListener(
22032
+ isProcessing && !isCheckoutSpecialCrFlow,
22033
+ isCheckoutCrFlow ? checkoutHistoryInfo.recipientAddr : void 0
22034
+ );
21952
22035
  useWalletAssetsListener(isProcessing || isCompleted);
21953
22036
  const timelineLabels = useMemo25(() => {
21954
22037
  const explorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6[checkoutHistoryInfo.fromChainId].explorerInfo;
@@ -21960,26 +22043,34 @@ function FunCheckoutHistoryDetail({
21960
22043
  )
21961
22044
  },
21962
22045
  {
21963
- text: "Order Processing",
22046
+ text: isCheckoutSpecialCrFlow ? "Order Funded" : "Order Processing",
21964
22047
  description: formatTimestamp(
21965
22048
  new Date(checkoutHistoryInfo.createdTimeMs + FAKE_DELAY_MS)
21966
22049
  ),
21967
22050
  linkText: `View on ${explorerInfo.name}`,
21968
- linkUrl: `${explorerInfo.url}/address/${checkoutHistoryInfo.depositAddr}`
21969
- },
21970
- {
21971
- text: `Order ${isError ? "Failed" : isExpired ? "Expired" : "Delivered"}`,
21972
- description: isExpired ? formatTimestamp(
21973
- new Date(checkoutHistoryInfo.expirationTimestampSeconds * 1e3)
21974
- ) : isTerminal ? formatTimestamp(new Date(checkoutHistoryInfo.lastUpdatedTimeMs)) : ""
21975
- }
22051
+ linkUrl: `${explorerInfo.url}/address/${isCheckoutSpecialCrFlow ? checkoutHistoryInfo.recipientAddr : checkoutHistoryInfo.depositAddr}`
22052
+ },
22053
+ ...isCheckoutSpecialCrFlow ? [] : [
22054
+ {
22055
+ text: `Order ${isError ? "Failed" : isExpired ? "Expired" : "Delivered"}`,
22056
+ description: isExpired ? formatTimestamp(
22057
+ new Date(
22058
+ checkoutHistoryInfo.expirationTimestampSeconds * 1e3
22059
+ )
22060
+ ) : isTerminal ? formatTimestamp(
22061
+ new Date(checkoutHistoryInfo.lastUpdatedTimeMs)
22062
+ ) : ""
22063
+ }
22064
+ ]
21976
22065
  ];
21977
22066
  }, [
22067
+ checkoutHistoryInfo.fromChainId,
21978
22068
  checkoutHistoryInfo.createdTimeMs,
22069
+ checkoutHistoryInfo.recipientAddr,
21979
22070
  checkoutHistoryInfo.depositAddr,
21980
22071
  checkoutHistoryInfo.expirationTimestampSeconds,
21981
- checkoutHistoryInfo.fromChainId,
21982
22072
  checkoutHistoryInfo.lastUpdatedTimeMs,
22073
+ isCheckoutSpecialCrFlow,
21983
22074
  isError,
21984
22075
  isExpired,
21985
22076
  isTerminal
@@ -21993,17 +22084,17 @@ function FunCheckoutHistoryDetail({
21993
22084
  display: "flex",
21994
22085
  flexDirection: "column",
21995
22086
  gap: "24",
21996
- style: { opacity: isFailed ? 0.5 : 1 }
22087
+ style: { opacity: isFailedFinal ? 0.5 : 1 }
21997
22088
  }, /* @__PURE__ */ React106.createElement(CheckoutPrimaryInfoSnapshot, {
21998
22089
  checkoutItem,
21999
22090
  isLoading: false
22000
- }), isTerminal ? null : /* @__PURE__ */ React106.createElement(FunNotification, {
22091
+ }), isCheckoutSpecialCrFlow || isTerminal ? null : /* @__PURE__ */ React106.createElement(FunNotification, {
22001
22092
  description: "We are currently processing your order."
22002
22093
  }), /* @__PURE__ */ React106.createElement(FunVerticalProgressBar, {
22003
- step: isTerminal ? 3 : 2,
22004
- totalSteps: 3,
22094
+ step: isCheckoutSpecialCrFlow ? 2 : isTerminal ? 3 : 2,
22095
+ totalSteps: timelineLabels.length,
22005
22096
  labels: timelineLabels
22006
- }), isTerminal ? null : /* @__PURE__ */ React106.createElement(Box, {
22097
+ }), isCheckoutSpecialCrFlow || isTerminal ? null : /* @__PURE__ */ React106.createElement(Box, {
22007
22098
  display: "flex",
22008
22099
  flexDirection: "column",
22009
22100
  alignItems: "center",
@@ -22011,7 +22102,7 @@ function FunCheckoutHistoryDetail({
22011
22102
  }, /* @__PURE__ */ React106.createElement(Text, {
22012
22103
  size: "12",
22013
22104
  color: "modalTextDim"
22014
- }, "You will receive a notification when your order has finished."))), isFailed ? /* @__PURE__ */ React106.createElement(FunToast, {
22105
+ }, "You will receive a notification when your order has finished."))), isFailedFinal ? /* @__PURE__ */ React106.createElement(FunToast, {
22015
22106
  type: 1 /* ERROR */,
22016
22107
  title: "Order Failed",
22017
22108
  isDescriptionText: false,
@@ -22039,14 +22130,18 @@ function FunCheckoutHistoryDetail({
22039
22130
  function FunCheckoutHistoryModal({
22040
22131
  onClose,
22041
22132
  open,
22042
- depositAddress
22133
+ depositAddress,
22134
+ isCheckoutSpecialCrFlow
22043
22135
  }) {
22044
22136
  if (open && !depositAddress) {
22045
22137
  throw new Error(
22046
22138
  "Unable to open checkout history modal without a depositAddress"
22047
22139
  );
22048
22140
  }
22049
- const { checkoutHistoryInfo, isLoading } = useFunkitPostCheckoutInternal(depositAddress);
22141
+ const { checkoutHistoryInfo, isLoading } = useFunkitPostCheckoutInternal(
22142
+ depositAddress,
22143
+ isCheckoutSpecialCrFlow
22144
+ );
22050
22145
  return /* @__PURE__ */ React107.createElement(Dialog, {
22051
22146
  open,
22052
22147
  onClose,
@@ -22277,7 +22372,7 @@ function MeshOrAccountSelectAsset({
22277
22372
  weight: "semibold"
22278
22373
  }, "Select Asset to Pay")), /* @__PURE__ */ React108.createElement(Box, {
22279
22374
  paddingBottom: "24",
22280
- paddingTop: "18"
22375
+ paddingTop: "8"
22281
22376
  }, isLoadingAssets ? /* @__PURE__ */ React108.createElement(Box, {
22282
22377
  display: "flex",
22283
22378
  flexDirection: "column",
@@ -22296,7 +22391,8 @@ function MeshOrAccountSelectAsset({
22296
22391
  isDropdownOpen: true,
22297
22392
  options: assetOptions,
22298
22393
  selectedValue: selectedTokenSymbol || "",
22299
- optionItemPadding: "12"
22394
+ optionItemPadding: "12",
22395
+ showBorder: false
22300
22396
  })), showErrorNotification ? /* @__PURE__ */ React108.createElement(Box, {
22301
22397
  paddingBottom: "24"
22302
22398
  }, /* @__PURE__ */ React108.createElement(FunNotification, {
@@ -22487,16 +22583,31 @@ function FunCheckoutModal({
22487
22583
  checkoutStep,
22488
22584
  selectedPaymentMethodInfo?.paymentMethod
22489
22585
  ]);
22586
+ const onCloseWrapper = useCallback17(() => {
22587
+ checkoutItem?.initSettings?.onClose?.();
22588
+ onClose?.();
22589
+ }, [checkoutItem?.initSettings, onClose]);
22590
+ const { isCheckoutSpecialCrFlow } = useCheckoutType(checkoutItem);
22490
22591
  const redirectToCheckoutHistory = useCallback17(
22491
22592
  (depositAddress) => {
22492
22593
  if (depositAddress) {
22493
- onClose?.();
22494
- openFunCheckoutHistoryModal?.(depositAddress);
22594
+ checkoutItem?.initSettings?.onSuccess?.({
22595
+ type: "success",
22596
+ message: "Checkout funding step completed successfully.",
22597
+ metadata: {}
22598
+ });
22599
+ onCloseWrapper?.();
22600
+ openFunCheckoutHistoryModal?.(depositAddress, isCheckoutSpecialCrFlow);
22495
22601
  } else {
22496
22602
  logger.warn("No depositAddress generated");
22497
22603
  }
22498
22604
  },
22499
- [onClose, openFunCheckoutHistoryModal]
22605
+ [
22606
+ checkoutItem?.initSettings,
22607
+ isCheckoutSpecialCrFlow,
22608
+ onCloseWrapper,
22609
+ openFunCheckoutHistoryModal
22610
+ ]
22500
22611
  );
22501
22612
  const [isSourceAssetConfirming, setIsSourceAssetConfirming] = useState30(false);
22502
22613
  const onSourceAssetConfirmed = useCallback17(async () => {
@@ -22602,7 +22713,7 @@ function FunCheckoutModal({
22602
22713
  const { showToast } = useFunToast();
22603
22714
  return /* @__PURE__ */ React110.createElement(Dialog, {
22604
22715
  open,
22605
- onClose,
22716
+ onClose: onCloseWrapper,
22606
22717
  titleId: "fun-checkout-modal",
22607
22718
  isHidden: isSoftHidden
22608
22719
  }, /* @__PURE__ */ React110.createElement(DialogContent, {
@@ -22616,7 +22727,7 @@ function FunCheckoutModal({
22616
22727
  onBack: titleConfig.onBack,
22617
22728
  title: titleConfig.title,
22618
22729
  hasCloseButton: true,
22619
- onClose
22730
+ onClose: onCloseWrapper
22620
22731
  }), checkoutStep === "payment" /* SELECT_PAYMENT_METHOD */ ? /* @__PURE__ */ React110.createElement(FunCheckoutVerifyDetailsStep, {
22621
22732
  checkoutId,
22622
22733
  onSelectPaymentMethod
@@ -24155,6 +24266,26 @@ function useModalStateValueWithId() {
24155
24266
  }, [])
24156
24267
  };
24157
24268
  }
24269
+ function useCheckoutHistoryModalState() {
24270
+ const [isModalOpen, setModalOpen] = useState36(false);
24271
+ const [depositAddress, setDepositAddress] = useState36(null);
24272
+ const [isCheckoutSpecialCrFlow, setIsCheckoutSpecialCrFlow] = useState36(false);
24273
+ return {
24274
+ closeModal: useCallback21(() => {
24275
+ setDepositAddress(null);
24276
+ setIsCheckoutSpecialCrFlow(false);
24277
+ setModalOpen(false);
24278
+ }, []),
24279
+ isModalOpen,
24280
+ depositAddress,
24281
+ isCheckoutSpecialCrFlow,
24282
+ openModal: useCallback21((id, isCheckoutSpecialCrFlow2) => {
24283
+ setDepositAddress(id);
24284
+ setIsCheckoutSpecialCrFlow(isCheckoutSpecialCrFlow2);
24285
+ setModalOpen(true);
24286
+ }, [])
24287
+ };
24288
+ }
24158
24289
  var ModalContext = createContext14({
24159
24290
  accountModalOpen: false,
24160
24291
  chainModalOpen: false,
@@ -24189,8 +24320,9 @@ function ModalProvider({ children }) {
24189
24320
  closeModal: closeFunCheckoutHistoryModal,
24190
24321
  isModalOpen: funCheckoutHistoryModalOpen,
24191
24322
  openModal: openFunCheckoutHistoryModal,
24192
- modalId: funCheckoutHistoryModalId
24193
- } = useModalStateValueWithId();
24323
+ depositAddress,
24324
+ isCheckoutSpecialCrFlow
24325
+ } = useCheckoutHistoryModalState();
24194
24326
  const {
24195
24327
  closeModal: closeFunDevTestModal,
24196
24328
  isModalOpen: funDevTestModalOpen,
@@ -24224,7 +24356,8 @@ function ModalProvider({ children }) {
24224
24356
  funCheckoutModalOpen,
24225
24357
  funCheckoutModalId,
24226
24358
  funCheckoutHistoryModalOpen,
24227
- funCheckoutHistoryModalId,
24359
+ depositAddress,
24360
+ isCheckoutSpecialCrFlow,
24228
24361
  openFunCheckoutModal,
24229
24362
  openFunCheckoutHistoryModal,
24230
24363
  funDevTestModalOpen,
@@ -24240,7 +24373,8 @@ function ModalProvider({ children }) {
24240
24373
  funCheckoutModalOpen,
24241
24374
  funCheckoutModalId,
24242
24375
  funCheckoutHistoryModalOpen,
24243
- funCheckoutHistoryModalId,
24376
+ depositAddress,
24377
+ isCheckoutSpecialCrFlow,
24244
24378
  openFunCheckoutModal,
24245
24379
  openFunCheckoutHistoryModal,
24246
24380
  funDevTestModalOpen,
@@ -24266,10 +24400,11 @@ function ModalProvider({ children }) {
24266
24400
  open: funCheckoutModalOpen,
24267
24401
  checkoutId: funCheckoutModalId,
24268
24402
  key: funCheckoutModalId
24269
- }), funCheckoutHistoryModalId ? /* @__PURE__ */ React127.createElement(FunCheckoutHistoryModal, {
24403
+ }), depositAddress ? /* @__PURE__ */ React127.createElement(FunCheckoutHistoryModal, {
24270
24404
  onClose: closeFunCheckoutHistoryModal,
24271
24405
  open: funCheckoutHistoryModalOpen,
24272
- depositAddress: funCheckoutHistoryModalId
24406
+ depositAddress,
24407
+ isCheckoutSpecialCrFlow
24273
24408
  }) : null, /* @__PURE__ */ React127.createElement(FunDevTestModal, {
24274
24409
  onClose: closeFunDevTestModal,
24275
24410
  open: funDevTestModalOpen
@@ -24868,7 +25003,7 @@ function setRainbowKitVersion({ version }) {
24868
25003
  }
24869
25004
  function useFingerprint() {
24870
25005
  const fingerprint = useCallback22(() => {
24871
- setRainbowKitVersion({ version: "0.1.13" });
25006
+ setRainbowKitVersion({ version: "0.1.15" });
24872
25007
  }, []);
24873
25008
  useEffect33(() => {
24874
25009
  fingerprint();
@@ -24954,31 +25089,29 @@ function FunkitProvider(props) {
24954
25089
  validateFunkitProviderProps(props);
24955
25090
  const appWagmiConfig = props.wagmiConfig;
24956
25091
  const initialChainId = getInitialChainIdFromFunkitProviderProps(props);
24957
- if (props?.funkitConfig?.enabledLoginOptions?.web2) {
24958
- const existingWalletGroupList = appWagmiConfig?.connectors?.(true) || [];
24959
- const filteredWalletGroupList = [];
24960
- existingWalletGroupList.forEach((groupItem) => {
24961
- if (groupItem.groupName === RESERVED_GROUP_NAME) {
24962
- } else {
24963
- filteredWalletGroupList.push(groupItem);
24964
- }
24965
- });
24966
- const newConnectors = connectorsForWallets([
24967
- ...filteredWalletGroupList,
24968
- {
24969
- groupName: RESERVED_GROUP_NAME,
24970
- wallets: [
24971
- funkitConnectWallet({
24972
- funkitOptions: {
24973
- chain: initialChainId,
24974
- apiKey: props.funkitConfig.apiKey
24975
- }
24976
- })
24977
- ]
24978
- }
24979
- ]);
24980
- appWagmiConfig.connectors = newConnectors;
24981
- }
25092
+ const existingWalletGroupList = appWagmiConfig?.connectors?.(true) || [];
25093
+ const filteredWalletGroupList = [];
25094
+ existingWalletGroupList.forEach((groupItem) => {
25095
+ if (groupItem.groupName === RESERVED_GROUP_NAME) {
25096
+ } else {
25097
+ filteredWalletGroupList.push(groupItem);
25098
+ }
25099
+ });
25100
+ const newConnectors = connectorsForWallets([
25101
+ ...filteredWalletGroupList,
25102
+ {
25103
+ groupName: RESERVED_GROUP_NAME,
25104
+ wallets: [
25105
+ funkitConnectWallet({
25106
+ funkitOptions: {
25107
+ chain: initialChainId,
25108
+ apiKey: props.funkitConfig.apiKey
25109
+ }
25110
+ })
25111
+ ]
25112
+ }
25113
+ ]);
25114
+ appWagmiConfig.connectors = newConnectors;
24982
25115
  const config = createConfig(appWagmiConfig);
24983
25116
  logger.configure(props.funkitConfig.apiKey, !!props.debug);
24984
25117
  return /* @__PURE__ */ React132.createElement(WagmiConfig, {