-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
simpletrade-9038e1c93efb0857.js
2 lines (2 loc) · 547 KB
/
simpletrade-9038e1c93efb0857.js
1
2
"use strict";(("undefined"!=typeof self?self:this).webpackChunk_cb_app=("undefined"!=typeof self?self:this).webpackChunk_cb_app||[]).push([[3],{1521:(e,a,n)=>{n.d(a,{Z:()=>wc});const l={argumentDefinitions:[{kind:"RootArgument",name:"includeAutoStakingCheck"},{kind:"RootArgument",name:"nativeCurrency"}],kind:"Fragment",metadata:{plural:!0},name:"BuySellViewerAssetsFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],kind:"ScalarField",name:"marketCapV2",storageKey:null}],storageKey:null},{condition:"includeAutoStakingCheck",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,concreteType:"EarnAsset",kind:"LinkedField",name:"earnAsset",plural:!1,selections:[{alias:null,args:null,concreteType:"EarnAutoStakingEnrollment",kind:"LinkedField",name:"autoStaking",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEnrolled",storageKey:null}],storageKey:null}],storageKey:null}]},{args:null,kind:"FragmentSpread",name:"BuySellAssetsFragment"},{args:null,kind:"FragmentSpread",name:"BuySellProviderFragment"}],type:"ViewerAsset",abstractKey:null,hash:"96b74a334cd472834a2bbc6aede3172c"},t=l,r={fragment:{argumentDefinitions:s=[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{defaultValue:null,kind:"LocalArgument",name:"includeAutoStakingCheck"},{defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{defaultValue:null,kind:"LocalArgument",name:"shouldIncludeBalanceSummaryInfo"}],kind:"Fragment",metadata:null,name:"BuySellAssetsRefetchable",selections:[{args:[{kind:"Variable",name:"cursor",variableName:"cursor"},{kind:"Variable",name:"paginationCount",variableName:"paginationCount"}],kind:"FragmentSpread",name:"BuySellPaginationFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:s,kind:"Operation",name:"BuySellAssetsRefetchable",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"tradableAssets",args:i=[{kind:"Variable",name:"after",variableName:"cursor"},{kind:"Variable",name:"first",variableName:"paginationCount"}],concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"tradableAssetsV2",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[u={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:c=[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],kind:"ScalarField",name:"marketCapV2",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},g={name:"isStablecoin",args:null,fragment:{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"AssetCategory",kind:"LinkedField",name:"categories",plural:!0,selections:[m={alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},o],storageKey:null}],type:"Asset",abstractKey:null},kind:"RelayResolver",storageKey:null,isOutputType:!0},p={alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},m,k={alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null},{alias:null,args:[{kind:"Literal",name:"filter",value:{quoteCurrency:"USD"}}],concreteType:"RetailBrokerageProduct",kind:"LinkedField",name:"brokerageProduct",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"baseIncrement",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"quoteIncrement",storageKey:null},o,{alias:null,args:null,kind:"ScalarField",name:"baseMaxSize",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"baseMinSize",storageKey:null}],storageKey:'brokerageProduct(filter:{"quoteCurrency":"USD"})'},f={alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},{alias:null,args:c,concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[b={alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},u,{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:F=[S={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[v={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[d,o,k,u,g,y,p,m,f,{alias:null,args:null,concreteType:"DestinationTag",kind:"LinkedField",name:"destinationTag",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"regex",storageKey:null}],storageKey:null},g,{alias:null,args:c,kind:"ScalarField",name:"unitPriceScaleV2",storageKey:null},{alias:null,args:c,concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[b,{alias:null,args:null,concreteType:"PercentChanges",kind:"LinkedField",name:"percentChanges",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"day",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AssetBalanceBreakdown",kind:"LinkedField",name:"assetBalanceBreakdown",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalanceFiat",plural:!1,selections:F,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalance",plural:!1,selections:F,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[h={alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"Node",abstractKey:"__isNode"},C={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},k],type:"TiersCurrency",abstractKey:null}],storageKey:null},o,{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:F,storageKey:null},y,{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalance",plural:!1,selections:T=[S],storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalanceInNativeCurrency",plural:!1,selections:T,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SupportedContextsV2",kind:"LinkedField",name:"supportedContextsV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTradable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isConvertible",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[h,{alias:null,args:null,kind:"ScalarField",name:"statsLabel",storageKey:null},S],storageKey:null},{alias:null,args:null,concreteType:"Staking",kind:"LinkedField",name:"staking",plural:!1,selections:[{alias:null,args:null,concreteType:"StakingBuyAndStakeInfo",kind:"LinkedField",name:"buyAndStakeInfo",plural:!1,selections:[{alias:null,args:null,concreteType:"StakeDetails",kind:"LinkedField",name:"unstakingPeriod",plural:!1,selections:[S,{alias:null,args:null,concreteType:"StakingInfoTray",kind:"LinkedField",name:"infoTray",plural:!1,selections:[v,{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},A={alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"buyCta",storageKey:null},{alias:null,args:null,concreteType:"StakingBuyAndStakeInfoUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"messageId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},A],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"StakingActionEligibility",kind:"LinkedField",name:"actionEligibility",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"action",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isEnabled",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isHidden",storageKey:null}],storageKey:null}],storageKey:null},o,v,{condition:"includeAutoStakingCheck",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,concreteType:"EarnAsset",kind:"LinkedField",name:"earnAsset",plural:!1,selections:[{alias:null,args:null,concreteType:"EarnAutoStakingEnrollment",kind:"LinkedField",name:"autoStaking",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEnrolled",storageKey:null},o],storageKey:null},o],storageKey:null}]},{kind:"InlineFragment",selections:[C,{condition:"shouldIncludeBalanceSummaryInfo",kind:"Condition",passingValue:!0,selections:[{kind:"InlineFragment",selections:[y],type:"TiersCurrency",abstractKey:null}]}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"tradableAssets",args:i,filters:null,handle:"connection",key:"Query_viewer_tradableAssets",kind:"LinkedHandle",name:"tradableAssetsV2"},o],storageKey:null}]},params:{id:"1d9b9c605e909cd76f6cd247a79b8c07ea0dba5a48c13b87411d7a02b53f0114",metadata:{},name:"BuySellAssetsRefetchable",operationKind:"query",text:null}};var s,i,u,o,c,d,m,g,p,y,k,f,b,S,F,v,h,C,T,A;r.hash="d3306f7fb71e46c4a2f955c64a8d6950";const K=r,x=function(){var e=["viewer","tradableAssets"];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{kind:"RootArgument",name:"includeAutoStakingCheck"},{kind:"RootArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{kind:"RootArgument",name:"shouldIncludeBalanceSummaryInfo"}],kind:"Fragment",metadata:{connection:[{count:"paginationCount",cursor:"cursor",direction:"forward",path:e}],refetch:{connection:{forward:{count:"paginationCount",cursor:"cursor"},backward:null,path:e},fragmentPathInResult:[],operation:K}},name:"BuySellPaginationFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{kind:"RequiredField",field:{alias:"tradableAssets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"__Query_viewer_tradableAssets_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"BuySellViewerAssetsFragment"},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},action:"THROW",path:"viewer.tradableAssets"}],storageKey:null}],type:"Query",abstractKey:null}}();x.hash="d3306f7fb71e46c4a2f955c64a8d6950";const w=x,B=function(){var e=[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"BuySellViewerAssetsFragment"}],a=[{args:null,kind:"FragmentSpread",name:"PolicyRestrictionEnforcerFragment"}],n=[{kind:"Variable",name:"productKey",variableName:"productKey"}];return{argumentDefinitions:[{kind:"RootArgument",name:"accountUuid"},{kind:"RootArgument",name:"assetSlug"},{kind:"RootArgument",name:"assetSymbol"},{kind:"RootArgument",name:"assetUuid"},{defaultValue:null,kind:"LocalArgument",name:"productKey"},{kind:"RootArgument",name:"skipAccountUuid"},{kind:"RootArgument",name:"skipAssetSlug"},{kind:"RootArgument",name:"skipAssetSymbol"},{kind:"RootArgument",name:"skipAssetUuid"}],kind:"Fragment",metadata:null,name:"BuySellFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellPaginationFragment"},{args:null,kind:"FragmentSpread",name:"useLimitGetterForTransferType"},{args:null,kind:"FragmentSpread",name:"useFormattedPaymentMethodsFragment"},{args:null,kind:"FragmentSpread",name:"BuySellContentFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"btcViewerAsset",args:[{kind:"Literal",name:"symbol",value:"BTC"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:e,storageKey:'assetBySymbol(symbol:"BTC")'},{condition:"skipAssetUuid",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"uuid",variableName:"assetUuid"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetByUuid",plural:!1,selections:e,storageKey:null}]},{condition:"skipAssetSymbol",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"symbol",variableName:"assetSymbol"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:e,storageKey:null}]},{condition:"skipAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"slug",variableName:"assetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:e,storageKey:null}]},{condition:"skipAccountUuid",kind:"Condition",passingValue:!1,selections:[{alias:"accountByUuid",args:[{kind:"Variable",name:"uuid",variableName:"accountUuid"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:e,type:"ViewerAsset",abstractKey:null}],storageKey:null}],storageKey:null}]},{alias:null,args:null,concreteType:"BalanceData",kind:"LinkedField",name:"balanceData",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"balanceInWbl",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null},{alias:"buyPolicyRestrictions",args:[{kind:"Literal",name:"action",value:"buys"}],concreteType:"PolicyRestriction",kind:"LinkedField",name:"policyRestrictions",plural:!0,selections:a,storageKey:'policyRestrictions(action:"buys")'},{alias:"sellPolicyRestrictions",args:[{kind:"Literal",name:"action",value:"sells"}],concreteType:"PolicyRestriction",kind:"LinkedField",name:"policyRestrictions",plural:!0,selections:a,storageKey:'policyRestrictions(action:"sells")'},{alias:null,args:n,concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useBuyPresetAmountsFragment"},{args:n,kind:"FragmentSpread",name:"useSubscriberStatusFragment"},{args:null,kind:"FragmentSpread",name:"useIsFreeTradePromoCodeEligibleFragment"}],type:"Query",abstractKey:null}}();B.hash="96ab5f04d9677831962c11c77bf2144b";const L=B;const I={argumentDefinitions:[],kind:"Fragment",metadata:{plural:!0},name:"BuySellAssetsFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,fragment:{args:null,kind:"FragmentSpread",name:"AssetIsStablecoinFragment"},kind:"RelayResolver",name:"isStablecoin",resolverModule:n(280).W,path:"asset.isStablecoin"}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{args:null,kind:"FragmentSpread",name:"BuyStatusStepAccountFragment"},{args:null,kind:"FragmentSpread",name:"BuyStatusStepDeprecatedAccountFragment"},{args:null,kind:"FragmentSpread",name:"BuyWaitTimerStepAccountFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepBuySellAccountFragment"},{args:null,kind:"FragmentSpread",name:"ProcessingPayoutStepAccountFragment"},{args:null,kind:"FragmentSpread",name:"SellStatusStepAccountFragment"},{args:null,kind:"FragmentSpread",name:"SellStatusStepDeprecatedAccountFragment"},{args:null,kind:"FragmentSpread",name:"WBLStepAccountFragment"},{args:null,kind:"FragmentSpread",name:"SellPreviewStepAccountFragment"},{args:null,kind:"FragmentSpread",name:"BuyPreviewStepAccountFragment"},{args:null,kind:"FragmentSpread",name:"RecurringRewardTermsStepAccountFragment"}],storageKey:null},{args:null,kind:"FragmentSpread",name:"SelectAssetStepFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepBuySellAssetFragment"},{args:null,kind:"FragmentSpread",name:"SellStatusStepDeprecatedFragment"},{args:null,kind:"FragmentSpread",name:"BuyStatusStepDeprecatedViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"WBLStepAssetOrCurrencyFragment"},{args:null,kind:"FragmentSpread",name:"RecurringRewardTermsStepAssetOrCurrencyFragment"},{args:null,kind:"FragmentSpread",name:"usePreloadBuySellPreviewFragment"},{args:null,kind:"FragmentSpread",name:"BuyAndStakeSwitchRowFragment"},{args:null,kind:"FragmentSpread",name:"BuyPreviewStepViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"SelectAssetStepViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"SellStatusStepViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"BuyStatusStepViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderInputStepViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"FeesInfoStepViewerAssetsFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderPreviewStepViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"PriceInfoStepFragment"},{args:null,kind:"FragmentSpread",name:"UnstakingInfoStepFragment"},{args:null,kind:"FragmentSpread",name:"SellPreviewStepViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"4adc72a5ca726b072b76704155d74491"},P=I,R={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuySellContentFragment",selections:[{args:null,kind:"FragmentSpread",name:"AddCashStepFragment"},{args:null,kind:"FragmentSpread",name:"PaymentMethodInfoStepFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepBuySellFragment"},{args:null,kind:"FragmentSpread",name:"SellStatusStepDeprecatedViewerFragment"},{args:null,kind:"FragmentSpread",name:"WBLStepFragment"},{args:null,kind:"FragmentSpread",name:"RecurringRewardTermsStepragment"},{args:null,kind:"FragmentSpread",name:"SelectPaymentStepFragment"},{args:null,kind:"FragmentSpread",name:"SellStatusStepFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderInputStepFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderPreviewStepContentFragment"},{args:[{kind:"Literal",name:"skip",value:!1}],kind:"FragmentSpread",name:"useTradeBenefitDataFragment"},{args:null,kind:"FragmentSpread",name:"useIsPaymentMethodEnabledInEuropeFragment"}],type:"Query",abstractKey:null,hash:"5f0b94e0e4a2d933fcf1704e4e9108f7"},M=R;var E=n(0),_=n(8),V=n.n(_),D=n(33),j=n(10),N=n(53),O=n(782),Z=n(3594),U=n(44),q=n(15),Q=n(7),H=n(1398),W=n(3),z=n(1402),G=n(350),J=n(366),$=n(549),Y=n(65),X=n(3654),ee=n(801),ae=n(73),ne=n(1500),le=n(1394),te=n(3655),re=n(838),se=n(105),ie=n(817),ue=n(871),oe=n(860),ce=n(3892),de=n(3893),me=n(123),ge=n(1390),pe=n(125),ye=n(187),ke=n(107),fe=n(744),be=n(911),Se=n(140),Fe=n(557),ve=n(572);const he={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useIsFreeTradePromoCodeEligibleFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"filter",value:{incentiveType:"TRADE_CODE",redemptionStatus:"REDEEMABLE",userIncentiveStatus:"ACTIVE"}}],concreteType:"UserIncentive",kind:"LinkedField",name:"userIncentives",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"userIncentiveStatus",storageKey:null},{alias:null,args:null,concreteType:"IncentivesRedemptionMetadata",kind:"LinkedField",name:"redemptionMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"redemptionStatus",storageKey:null}],storageKey:null}],storageKey:'userIncentives(filter:{"incentiveType":"TRADE_CODE","redemptionStatus":"REDEEMABLE","userIncentiveStatus":"ACTIVE"})'}],storageKey:null}],type:"Query",abstractKey:null,hash:"8927a0bc050de53daa61249b9fc4cab4"},Ce=he;var Te=n(29);const Ae={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"usePreloadBuySellPreviewFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"f12b34ccaad6c7866e6a0f07e023311a"},Ke=Ae,xe={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyPreviewStepViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuyPreviewStepViewerAssetNewFragment"},{args:null,kind:"FragmentSpread",name:"BuyPreviewStepViewerAssetOldFragment"}],type:"ViewerAsset",abstractKey:null,hash:"a463ca1bae44e00dc766255ff17baacd"},we=xe,Be={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyPreviewStepViewerAssetNewFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuyPreviewStepViewerAssetContentFragment"}],type:"ViewerAsset",abstractKey:null,hash:"f2b82acdea3a6879fafe2e87df8a57ad"},Le=Be,Ie={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyPreviewStepViewerAssetOldFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"BuyPreviewStepViewerAssetContentFragment"}],type:"ViewerAsset",abstractKey:null,hash:"205aad8daf244b5b9ccde174b2387f84"},Pe=Ie,Re={argumentDefinitions:[{kind:"RootArgument",name:"includeAutoStakingCheck"}],kind:"Fragment",metadata:null,name:"BuyPreviewStepViewerAssetContentFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Staking",kind:"LinkedField",name:"staking",plural:!1,selections:[{alias:null,args:null,concreteType:"StakingBuyAndStakeInfo",kind:"LinkedField",name:"buyAndStakeInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"buyCta",storageKey:null}],storageKey:null}],storageKey:null},{condition:"includeAutoStakingCheck",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,concreteType:"EarnAsset",kind:"LinkedField",name:"earnAsset",plural:!1,selections:[{alias:null,args:null,concreteType:"EarnAutoStakingEnrollment",kind:"LinkedField",name:"autoStaking",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEnrolled",storageKey:null}],storageKey:null}],storageKey:null}]},{args:null,kind:"FragmentSpread",name:"RewardApyLabelFragment"},{args:null,kind:"FragmentSpread",name:"BuyAndStakeSwitchRowFragment"},{args:null,kind:"FragmentSpread",name:"useBuyAndStakeEligibleFragment"},{args:null,kind:"FragmentSpread",name:"useBuyAndStakeUserWarningsFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"},{args:null,kind:"FragmentSpread",name:"useBuyQuoteSubmitterViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useBuyCommitterViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"abdb822cf6027a6fe011422c9ee9eaff"},Me=Re,Ee={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyPreviewStepAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{args:null,kind:"FragmentSpread",name:"useBuyCommitterFragment"},{args:null,kind:"FragmentSpread",name:"useBuyQuoteSubmitterFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"6953c477ce0be4387be451b392eb7d19"},_e=Ee,Ve={argumentDefinitions:[{kind:"RootArgument",name:"action"}],kind:"Fragment",metadata:null,name:"BuyPreviewStepContentFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"},{args:null,kind:"FragmentSpread",name:"BuyPreviewCardsFragment"},{args:null,kind:"FragmentSpread",name:"useTradeSubscriptionSignupVariantFragment"},{args:null,kind:"FragmentSpread",name:"useFormattedFreeTrialLengthFragment"},{args:null,kind:"FragmentSpread",name:"useShowSubscriptionUpgradeUpsellFragment"},{args:null,kind:"FragmentSpread",name:"usePremiumTierPlanFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"action",variableName:"action"}],concreteType:"PolicyRestriction",kind:"LinkedField",name:"policyRestrictions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useIsEligibleForFreeTrialFragment"}],storageKey:null}],type:"Query",abstractKey:null,hash:"07f355e406ea61493cb80dea01525526"},De=Ve,je=function(){var e={defaultValue:null,kind:"LocalArgument",name:"action"},a={defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},n={defaultValue:null,kind:"LocalArgument",name:"productKey"},l={alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null},s=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},r],i={alias:null,args:null,kind:"ScalarField",name:"tier",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"accountUuid",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"paymentMethodUuid",storageKey:null},g={alias:null,args:null,concreteType:null,kind:"LinkedField",name:"metadata",plural:!1,selections:[o,{kind:"InlineFragment",selections:[c,d,{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"balance",plural:!1,selections:s,storageKey:null}],type:"CoinbaseSubscriptionFiatAccountMetadata",abstractKey:null},{kind:"InlineFragment",selections:[m,{alias:null,args:null,kind:"ScalarField",name:"accountName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"accountNumber",storageKey:null}],type:"CoinbaseSubscriptionACHMetadata",abstractKey:null},{kind:"InlineFragment",selections:[m,{alias:null,args:null,kind:"ScalarField",name:"institutionName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cardLast4",storageKey:null}],type:"CoinbaseSubscriptionWorldpayCardMetadata",abstractKey:null},{kind:"InlineFragment",selections:[c,{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,concreteType:"AssetCurrentBalance",kind:"LinkedField",name:"assetCurrentBalance",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToTradeBalance",plural:!1,selections:s,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToTradeBalanceFiat",plural:!1,selections:s,storageKey:null},t],storageKey:null},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},d,t],storageKey:null},t],storageKey:null}],type:"CoinbaseSubscriptionCryptoAccountMetadata",abstractKey:null}],storageKey:null},p=[{alias:null,args:null,kind:"ScalarField",name:"isEligible",storageKey:null}],y={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"proratedPrice",plural:!1,selections:s,storageKey:null};return{fragment:{argumentDefinitions:[e,a,n],kind:"Fragment",metadata:null,name:"BuyPreviewStepQuery",selections:[{args:null,kind:"FragmentSpread",name:"BuyPreviewStepContentFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,e,n],kind:"Operation",name:"BuyPreviewStepQuery",selections:[{alias:null,args:[{kind:"Variable",name:"baseCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"exchangeRatesV3",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"quoteCurrency",storageKey:null},l],storageKey:null},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProperties",kind:"LinkedField",name:"userProperties",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"nativeCurrency",storageKey:null},{alias:null,args:null,concreteType:"RegionFeatures",kind:"LinkedField",name:"regionFeatures",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"supportsFiatTransfers",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"supportsCryptoToCryptoTransfers",storageKey:null}],storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"hasMadeAPurchase",storageKey:null},{alias:null,args:null,concreteType:"Country",kind:"LinkedField",name:"country",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],storageKey:null}],storageKey:null},{alias:"assets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"tradableAssets",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[l],storageKey:null},t],storageKey:null},t],storageKey:null}],storageKey:null}],storageKey:null},t,{alias:null,args:[{kind:"Variable",name:"productKey",variableName:"productKey"}],concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},t,{alias:null,args:null,concreteType:"SubscriptionRenewalSummary",kind:"LinkedField",name:"renewalSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"renewalAmount",plural:!1,selections:s,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[i,t],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPaymentMethod",kind:"LinkedField",name:"activePaymentMethodV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isDeleted",storageKey:null},u,r,g],storageKey:null}],storageKey:null},{alias:"freeTrialEligibility",args:[{kind:"Literal",name:"eligibleEntities",value:["FREE_TRIAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:p,storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["FREE_TRIAL"])'},{alias:null,args:[{kind:"Literal",name:"eligibleEntities",value:["COINBASE_ONE_GENERAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:p,storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["COINBASE_ONE_GENERAL"])'},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPaymentMethod",kind:"LinkedField",name:"coinbaseSubscriptionPaymentMethods",plural:!0,selections:[u,r,g],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"coinbaseSubscriptionPlans",plural:!0,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"displayName",storageKey:null},u,{alias:null,args:null,kind:"ScalarField",name:"product",storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanBillingFrequency",kind:"LinkedField",name:"planBillingFrequency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"unit",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numberOfUnits",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"subscriptionPlanUuid",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"price",plural:!1,selections:s,storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPromotion",kind:"LinkedField",name:"promotion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"promotionType",storageKey:null},t,o],storageKey:null},y,i,{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanMetadata",kind:"LinkedField",name:"metadata",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"migrationMetadata",plural:!1,selections:[o,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"initialBillingPeriodEnd",storageKey:null},y,{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"creditRefund",plural:!1,selections:s,storageKey:null}],type:"CoinbaseSubscriptionPlanMigrationBillingCycleChange",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:[{kind:"Variable",name:"action",variableName:"action"}],concreteType:"PolicyRestriction",kind:"LinkedField",name:"policyRestrictions",plural:!0,selections:[o,t],storageKey:null}],storageKey:null}]},params:{id:"71ac79336d434d578093d15f6c864553d2f6f4f1a2dfc2a2a350e1ba9d35ec9d",metadata:{},name:"BuyPreviewStepQuery",operationKind:"query",text:null}}}();je.hash="7122cbe3e4a8c7392102d7469151bcca";const Ne=je;var Oe=n(48),Ze=n(357),Ue=n(35),qe=n(4),Qe=n(1399),He=n(3618),We=n(3619),ze=n(3683),Ge=n(3580),Je=n(1607),$e=n(1411),Ye=n(785),Xe=n(947),ea=n(786);function aa(){const e=(0,Te.y)("kill_simple_trade_eitri_web"),a=(0,U.Q)("jun_2023_www_simple_trade_eitri_preloading",{skipTracking:e});return!e&&a}var na=n(544),la=n(520),ta=n(23),ra=n(3599),sa=n(3593),ia=n(3684),ua=n(3685),oa=n(3686),ca=n(3687),da=n(885),ma=n(872),ga=n(790),pa=n(11),ya=n(9),ka=n(2);const fa=(0,pa.vU)({amountIn:{id:"TransferCashReceipt.amountIn",defaultMessage:"Amount in {name}"},total:{id:"TransferCashReceipt.total",defaultMessage:"Total"}});function ba({receiptTaxAndFees:e,to:a,toValue:n,from:l,fromValue:t,totalValue:r}){const{formatMessage:s}=(0,ya.Z)();return(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.aR,{label:s(fa.amountIn,{name:l}),rightContent:t}),(0,ka.jsx)(G.aR,{label:s(fa.amountIn,{name:a}),rightContent:n}),e,(0,ka.jsx)(G.aR,{leftTextStrong:!0,label:s(fa.total),rightContent:r,rightTextStrong:!0})]})}var Sa=n(839),Fa=n(1304);const va=(0,E.memo)((function({onGoToFeesInfoStep:e,...a}){const{goToStep:n}=(0,ae.tC)(ke.Ex),{previewFeeDisclosure:l,showCbOneBannerOnInfoStep:t}=(0,N.jf)(ke.cr),{trackEvent:r}=(0,Se.Z)(),s=(0,E.useCallback)((e=>{r(e,{content:"coinbase_fees"})}),[r]),i=(0,E.useCallback)(((a,r)=>{s(Se.N[a?.name??""]),a?.disclosure&&l.onChange(a.disclosure),t.onChange(r),e?.(),n("feesInfo")}),[n,e,l,t,s]);return(0,ka.jsx)(Fa.Z,{...a,onGoToFeesInfoStep:i,zeroOrFree:"free"})}));var ha=n(374),Ca=n(1545),Ta=n(1391);const Aa=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"resource",storageKey:null},r=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],s={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:r,storageKey:null},i={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:r,storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"recurringPayment",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null}],c={alias:null,args:null,concreteType:"CommitNoticeData",kind:"LinkedField",name:"commitNotice",plural:!1,selections:o,storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"cardStatus",storageKey:null},m={alias:null,args:null,concreteType:"TransferWblUxData",kind:"LinkedField",name:"wblUxData",plural:!1,selections:o,storageKey:null},g={alias:null,args:null,concreteType:"TransferNextStep",kind:"LinkedField",name:"nextStep",plural:!1,selections:[{alias:"action",args:null,kind:"ScalarField",name:"Action",storageKey:null},{alias:"maxPollAttempts",args:null,kind:"ScalarField",name:"MaxPollAttempts",storageKey:null},{alias:"pollIntervalMs",args:null,kind:"ScalarField",name:"PollIntervalInMs",storageKey:null}],storageKey:null},p={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],type:"GenericError",abstractKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useBuyCommitterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"commitBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"commitBuyFragment",selections:[l,t,s,i,u,c,d,m,g],args:null,argumentDefinitions:[]}],storageKey:null}],type:"CommitBuySuccess",abstractKey:null},p],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useBuyCommitterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"commitBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[l,t,s,i,u,c,d,m,g,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}],type:"CommitBuySuccess",abstractKey:null},p],storageKey:null}]},params:{id:"149fab32b5dccd48f1f569a8e7630453ac598edc06f6e9ea87564c76af06e17b",metadata:{},name:"useBuyCommitterMutation",operationKind:"mutation",text:null}}}();Aa.hash="6ce43b7aaf8caa39160c52c27c3dcb52";const Ka=Aa,xa={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyCommitterViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"7ae17ac3a39e97edab567b1e5333688b"},wa=xa,Ba={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyCommitterFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],type:"Account",abstractKey:null,hash:"19b756f6ac91e7d16fada027882c7274"},La=Ba;var Ia=n(32),Pa=n(840),Ra=n(156),Ma=n(378),Ea=n(3631),_a=n(2410),Va=n(124);const Da={kind:"InlineDataFragment",name:"commitBuyFragment",hash:"9f0dd64506077d0f9f38de7f71ae34d3"},ja=Da;var Na=n(224),Oa=n(3586),Za=n.n(Oa),Ua=n(1431),qa=n(369);const Qa=(0,pa.vU)({genericError:{id:"UseApplePayBuySubmitter.genericError",defaultMessage:"Something went wrong. Please try again later"}}),Ha="Coinbase",Wa=({total:e,paymentMethod:a})=>{const[{paymentRequest:n,applePayClient:l},t]=(0,E.useState)({}),{getBraintreeClient:r}=(0,Ua.X)("apple_pay"),{formatMessage:s}=(0,ya.Z)(),{showErrorToast:i}=(0,Va.Z)(),u=(0,E.useCallback)(((e,a)=>{(0,q.cB)(e,{owner:"trading",context:a}),i(s(Qa.genericError))}),[i,s]);(0,E.useEffect)((()=>{let n,l;if("apple_pay"===a?.type){const{promise:s,cancel:i}=(0,q.HO)((async()=>{try{n=await r(),l=await Za().applePay.create({client:n})}catch(e){u(e,"buy_sell")}})());return s.then((()=>{if(l){const n=l.createPaymentRequest({total:{label:Ha,amount:e.value},...(0,qa.cH)(a?.pickerData)});t({applePayClient:l,paymentRequest:n})}})).catch((e=>{u(e,"buy_sell")})),()=>{i(),n?.teardown(),l?.teardown()}}}),[]);return{isApplePayReady:(0,E.useMemo)((()=>!(!l||!n)),[l,n]),submitApplePayBuy:(0,E.useCallback)((e=>{if(l)try{const a=new ApplePaySession(3,n);a.onvalidatemerchant=e=>{l.performValidation({validationURL:e.validationURL,displayName:Ha},((e,n)=>{e?u(e,"buy_sell"):a.completeMerchantValidation(n)}))},a.onpaymentauthorized=n=>{l.tokenize({token:n.payment.token},((n,l)=>{if(n)return u(n,"buy_sell"),void a.completePayment(ApplePaySession.STATUS_FAILURE);a.completePayment(ApplePaySession.STATUS_SUCCESS),e(l.nonce)}))},a.begin()}catch(e){u(e,"buy_sell"),console.error(e)}}),[n,l,u])}};var za=n(353),Ga=n(3894),Ja=n(2409);const $a=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"accountId"},{defaultValue:null,kind:"LocalArgument",name:"transferId"}],a=[{kind:"Variable",name:"uuid",variableName:"accountId"}],n=[{kind:"Variable",name:"uuid",variableName:"transferId"}],l={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"requiresCompletionStep",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"cardStatus",storageKey:null},s={alias:null,args:null,concreteType:"Secure3DVerificationData",kind:"LinkedField",name:"secure3DVerification",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null},{alias:null,args:null,concreteType:"Secure3DVerificationDataPayload",kind:"LinkedField",name:"payload",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"checkoutUrl",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"usePollFor3dsDetailsQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:n,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[l,t,r,s,i],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"usePollFor3dsDetailsQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:n,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[l,t,r,s,i,u],storageKey:null},u],storageKey:null},u],storageKey:null}]},params:{id:"3ad7bee6c68a8974ddaccebedf583f040c24c049ce0bc217509f0ab992c1ae28",metadata:{},name:"usePollFor3dsDetailsQuery",operationKind:"query",text:null}}}();$a.hash="398f0c353bb2f66a3b58751d34fc61e2";const Ya=$a;var Xa=n(1465),en=n(217),an=n(155);const nn=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"accountId"},{defaultValue:null,kind:"LocalArgument",name:"transferId"}],a=[{kind:"Variable",name:"uuid",variableName:"accountId"}],n=[{kind:"Variable",name:"uuid",variableName:"transferId"}],l={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},t={alias:null,args:null,concreteType:"VerificationPayload",kind:"LinkedField",name:"verification",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null},r={alias:null,args:null,concreteType:"TransferCancelReason",kind:"LinkedField",name:"cancelReason",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"usePollForOpenBankingRedirectUrlQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:n,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[l,t,r],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"usePollForOpenBankingRedirectUrlQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:n,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[l,t,r,s],storageKey:null},s],storageKey:null},s],storageKey:null}]},params:{id:"30ece09514a2b62207e33ae7684d8c4e64415900634d8372f4c464e5fa992ab8",metadata:{},name:"usePollForOpenBankingRedirectUrlQuery",operationKind:"query",text:null}}}();nn.hash="34805e224de09cf2372ab0f8737db1fb";const ln=nn,tn=()=>{const e=(0,E.useRef)(0),a=(0,W.ld)(),n=(0,E.useCallback)((({accountId:l,transferId:t,onPollEnd:r,maxPollAttempts:s=50,pollIntervalInMs:i=1e3})=>{let u;const o=(0,W.Ch)(a,ln,{accountId:l,transferId:t},{fetchPolicy:"network-only"}).subscribe({next:({viewer:a})=>{const{status:c,verification:d,cancelReason:m}=a.accountByUuidV2?.buyByUuid||{};"STARTED"!==c&&"CREATED"!==c||!d?.url?"CANCELED"===c?(clearTimeout(u),o.unsubscribe(),r({status:c,redirectUrl:"",cancelReason:m?.code}),e.current=0):(e.current+=1,e.current<=s?u=setTimeout((()=>n({accountId:l,transferId:t,onPollEnd:r,maxPollAttempts:s,pollIntervalInMs:i})),i):(r({status:"CANCELED",redirectUrl:"",cancelReason:"TIMEOUT"}),e.current=0,clearTimeout(u),o.unsubscribe())):(clearTimeout(u),o.unsubscribe(),r({status:c,redirectUrl:d?.url}),e.current=0)}});return{subscription:o}}),[a]);return{pollForOpenBankingRedirectUrl:n}},rn=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"validateMerchant",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"validationResponse",storageKey:null}],type:"ValidateMerchantSuccess",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],type:"BadRequestError",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useValidateMerchantMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useValidateMerchantMutation",selections:a},params:{id:"ffdcff50f0d34c19af4112ae72eb6f021941a81f8e5c83433f36c0883fed04f2",metadata:{},name:"useValidateMerchantMutation",operationKind:"mutation",text:null}}}();rn.hash="dbcadefa7433ddba35451d6a79e42b26";const sn=rn;var un=n(96);const on=(0,pa.vU)({genericError:{id:"UseCheckoutApplePayBuySubmitter.genericError",defaultMessage:"Something went wrong. Please try again later"}}),cn=({total:e,paymentMethod:a})=>{const{countryCode:n}=(0,ta.Z)(),[{paymentRequest:l},t]=(0,E.useState)({}),{formatMessage:r}=(0,ya.Z)(),{showErrorToast:s}=(0,Va.Z)(),[i]=function(){const[e,a]=(0,W.Db)(sn);return[(0,E.useCallback)((a=>new Promise(((n,l)=>{e({variables:{input:{validationUrl:a}},onCompleted:({response:e})=>{(0,W.V4)(e.validateMerchant).when("ValidateMerchantSuccess",(({validationResponse:e})=>{n(e)})).when("BadRequestError",(({message:e})=>{l(new Error(e))})).otherwise((()=>{const e=new Error("validateMerchant returned unknown response or null.");l(e)}))},onError:({alreadyReportedError:e})=>{l((0,un.Xv)(e))}})}))),[e]),a]}(),u=(0,E.useCallback)(((e,a)=>{(0,q.cB)(e,{owner:"trading",context:a}),s(r(on.genericError))}),[s,r]);(0,E.useEffect)((()=>{if("apple_pay"===a?.type){const l={total:{label:"Coinbase",amount:e.value},countryCode:n,currencyCode:e.currency,...(0,qa.cH)(a?.pickerData)};t({paymentRequest:l})}}),[]);return{isApplePayReady:(0,E.useMemo)((()=>!!l),[l]),submitApplePayBuy:(0,E.useCallback)((e=>{try{const a=new ApplePaySession(6,l);a.onvalidatemerchant=async e=>{try{const n=await i(e.validationURL);a.completeMerchantValidation(n)}catch(e){u(e,"buy_sell")}},a.onpaymentauthorized=n=>{const l=n.payment.token;l.length>0?(a.completePayment(ApplePaySession.STATUS_SUCCESS),e(l)):a.completePayment(ApplePaySession.STATUS_FAILURE)},a.begin()}catch(e){u(e,"buy_sell"),console.error(e)}}),[l,i,u])}};var dn=n(865);const mn=(0,pa.vU)({genericError:{id:"UseGooglePayBuySubmitter.genericError",defaultMessage:"Something went wrong. Please try again later"}}),gn=({total:e,paymentMethod:a})=>{const[{paymentRequest:n,googlePayClient:l},t]=(0,E.useState)({}),{getBraintreeClient:r}=(0,Ua.X)("google_pay"),{formatMessage:s}=(0,ya.Z)(),{showErrorToast:i}=(0,Va.Z)(),{country:u}=(0,ta.Z)(),o=(0,E.useCallback)(((e,a)=>{(0,q.cB)(e,{owner:"trading",context:a}),i(s(mn.genericError))}),[i,s]);(0,E.useEffect)((()=>{let n,l;if("google_pay"===a?.type&&e){const{promise:a,cancel:s}=(0,q.HO)(Promise.resolve());return a.then((async()=>{n=await r()})).then((async()=>{l=await Za().googlePayment.create({client:n,googlePayVersion:dn.googlePayConfig.googlePayVersion,googleMerchantId:dn.googlePayConfig.googleMerchantId})})).then((()=>{if(l)return l.createPaymentDataRequest({transactionInfo:{currencyCode:e.currency,totalPriceStatus:"FINAL",totalPrice:e.value,totalPriceLabel:"Total",checkoutOption:"COMPLETE_IMMEDIATE_PURCHASE",displayItems:[{label:"Subtotal",type:"SUBTOTAL",price:e.value}]}})})).then((e=>{if(!e)return;const{billingAddressParameters:a,billingAddressRequired:n,allowCreditCards:r,allowPrepaidCards:s}=dn.googlePayConfig,i=e.allowedPaymentMethods.find((e=>"CARD"===e.type));i&&(i.parameters.billingAddressRequired=n,i.parameters.billingAddressParameters=a,i.parameters.allowCreditCards=r,i.parameters.allowPrepaidCards=s),e.callbackIntents=["PAYMENT_AUTHORIZATION"],e.merchantInfo.merchantName="Coinbase",e.transactionInfo.countryCode=u.code,t({googlePayClient:l,paymentRequest:e})})).catch((e=>{o(e,"buy_sell")})),()=>{s(),l?.teardown(),n?.teardown()}}}),[]);return{isGooglePayReady:!(!l||!n),submitGooglePayBuy:(0,E.useCallback)((async()=>{try{if(!l||!n)throw new Error("Google Pay Braintree client not initialized");const e=new google.payments.api.PaymentsClient({environment:dn.googlePayConfig.environment,paymentDataCallbacks:{onPaymentAuthorized:()=>({transactionState:"SUCCESS"})}}),a=await e.loadPaymentData(n);return(await l.parseResponse(a)).nonce}catch(e){if("CANCELED"===e?.statusCode)return!1;o(e,"buy_sell")}}),[n,l,o])}};function pn({accountRef:e,viewerAssetRef:a}){const n=(0,W.Jc)(La,e),l=(0,W.Jc)(wa,a),t=(0,E.useRef)(""),r=(0,E.useRef)(""),[s,i]=(0,E.useState)(!1),{showErrorToast:u}=(0,Va.Z)(),{formatMessage:o}=(0,ya.Z)(),c=(0,Ia.TH)(),{buyQuoteResponse:d,buyCommitResponse:m,acceptDisclosureForAllExperimentalAssets:g,shouldBuyAndStake:p,openBankingRedirectUrl:y,activeAccountUuid:k}=(0,N.jf)(ke.cr),{goToStep:f}=(0,ae.tC)(ke.Ex),b=(0,Na.Z)(),{logSardineAnalyticsEvent:S}=(0,Pa.g)(),F=function(){const e=(0,Xa.Z)(),a=(0,an.Z)(),{goToStep:n}=(0,ae.tC)(ke.Ex),{cardStatus:l}=(0,N.jf)(ke.cr),t=(0,en.Z)();return(0,E.useCallback)((({accountId:r,transferId:s,onComplete:i,maxPollAttempts:u=100,pollIntervalInMs:o=1e3})=>{e({maxPollAttempts:u,retryDelayMilliseconds:o,resource:async()=>a(Ya,{accountId:r,transferId:s}),onResponse:({viewer:e})=>{const{status:a,secure3DVerification:r,cardStatus:s,requiresCompletionStep:i,checkoutUrl:u}=e.accountByUuidV2?.buyByUuid||{};switch(a){case"CANCELED":return s?(t().then((()=>{l.onChange(s),n("paymentError")})),{type:"ContinuePolling"}):{type:"Result",result:{status:a}};case"COMPLETED":return{type:"Result",result:{status:a}};case"STARTED":case"CREATED":if(i){if(null===u)throw new Error("checkoutUrl is null.");const e=u?{checkoutUrl:u}:r;if(!e)throw new Error("secure3DOptions is not defined.");return{type:"Result",result:{status:a,options:e}}}return{type:"ContinuePolling"};default:return{type:"ContinuePolling"}}},onComplete:e=>{switch(e.type){case"Success":return i(e.result);case"MaxRetries":case"Error":return i({status:"CANCELED"})}}})}),[l,t,a,n,e])}(),{pollForOpenBankingRedirectUrl:v}=tn(),h=(0,$.zC)({assetId:l.asset.uuid}),C=(0,_a.K)(),T=d.value?.transferBuy;V()(T,"There should be a quote id");const A="apple_pay"===b.type,K="google_pay"===b.type,x=(0,E.useMemo)((()=>"fiat_account"===b.type),[b.type]),w=(0,Ea.Z)(),{submitApplePayBuy:B,isApplePayReady:L}=Wa({total:T.total,paymentMethod:b}),{submitApplePayBuy:I,isApplePayReady:P}=cn({total:T.total,paymentMethod:b}),{authenticateApplePayBuy:R,isApplePayReady:M}=(0,E.useMemo)((()=>({authenticateApplePayBuy:w?I:B,isApplePayReady:w?P:L})),[w,B,L,I,P]),{submitGooglePayBuy:_,isGooglePayReady:D}=gn({total:T.total,paymentMethod:b}),[j,O]=(0,W.Db)(Ka),Z=(0,E.useCallback)((e=>{const a=(0,W.fR)(ja,e);if("deneb_upi"===b.type)return m.onChange(a),f("buyWaitTimer");const t="open_banking_redirect"===a?.nextStep?.action&&"uk_bank_account"===b.type;if("poll_and_secure3d_redirect"!==a.nextStep?.action&&!t)return m.onChange(a),f("buyStatus");const r=e=>{switch(i(!1),e.status){case"CANCELED":case"COMPLETED":return m.onChange(a),f("buyStatus");case"STARTED":case"CREATED":return function({verify3dsOptions:e,onError:a,accountId:n,originRoute:l,commitResponse:t,paymentMethodId:r,assetId:s}){const i=()=>{za.ZP.track("three_ds_load_failed",{action:Q.Us.render,componentType:Q.re.page}),a()};try{if("checkoutUrl"in e)(0,Ga.u)(e.checkoutUrl,"GET",[]);else{const a={id:t.uuid,assetId:s};if(localStorage.setItem(Ja.Pc,n),localStorage.setItem(Ja.gj,JSON.stringify(a)),localStorage.setItem(Ja.$5,r),localStorage.setItem(Ja.Ah,l),localStorage.getItem(Ja.Pc)&&localStorage.getItem(Ja.gj)&&localStorage.getItem(Ja.$5)){za.ZP.track("three_ds_load_completed",{action:Q.Us.render,componentType:Q.re.page});const{url:a,payload:n}=e;(0,Ga.u)(a,"POST",n)}else i()}}catch(e){(0,q.cB)(e,{owner:"trading",context:"buy_sell"}),i()}}({verify3dsOptions:e.options,commitResponse:a,onError:()=>u(o(Ma.s.commitError)),accountId:n.uuid??l.asset.platformName,paymentMethodId:b.id,assetId:l.asset.uuid,originRoute:c.pathname})}},s=e=>{switch((0,Q.Kz)("buy_redirection_polling_completed",{componentType:Q.re.modal,action:Q.Us.measurement,transferId:a.uuid,accountId:n.uuid??"",status:e.status,cancelReason:e.cancelReason??"",paymentMethod:b.type??"",isRedirectUrlPresent:e.redirectUrl.length>0?"true":"false"}),i(!1),e.status){case"CANCELED":return"HIGH_RISK_SCORE_CANCELED"===e.cancelReason?f("obRiskFailure"):u(o(Ma.s.commitError));case"COMPLETED":return m.onChange(a),f("buyStatus");case"STARTED":case"CREATED":return m.onChange(a),y.onChange(e.redirectUrl),k.onChange(n.uuid??""),f("openBankingQrcode")}};i(!0),t?v({accountId:n.uuid??"",transferId:a.uuid,onPollEnd:s,...a.nextStep}):F({accountId:n.uuid??l.asset.platformName,transferId:a.uuid,onComplete:r,...a.nextStep})}),[b.type,b.id,m,f,n.uuid,l.asset.platformName,l.asset.uuid,c.pathname,u,o,y,k,v,F]),U=(0,E.useCallback)((async()=>{l.asset.experimental&&h(g.value);const e=()=>{j({variables:{input:{accountUuid:n.uuid??l.asset.platformName,transferBuyUuid:T.uuid,applePayNonce:t.current,braintreePmNonce:r.current,shouldStake:p.value}},updater:e=>{C||e.get(n?.id??"")?.invalidateRecord()},onCompleted:({response:e})=>{const a=e?.commitBuy;switch(a?.__typename){case"CommitBuySuccess":return S(x?"fiat_buy":"buy"),Z(a.transferBuy);case"GenericError":{const e=new Error("Commit buy request failed");let n=a.message;return"UPSTREAM_GENERIC_ERROR"===a.code&&(n=o(Ma.s.genericErrorMessage)),e.cause=a.message,(0,q.cB)(e,{owner:"trading",context:"buy_sell"}),u(n)}default:(0,q.cB)(new Error("Unexpected typename returned"),{owner:"trading",typename:a?.__typename,context:"buy_sell"})}},onError:({alreadyReportedError:e})=>{(0,q.cB)((0,Ra.Xv)(e),{owner:"trading",context:"buy_sell"}),u(o(Ma.s.commitError))}})};if(A)R((a=>{t.current=a,e()}));else if(K){const a=await _();a&&(r.current=a,e())}else e()}),[l.asset.experimental,l.asset.platformName,A,K,h,g.value,j,n.uuid,T.uuid,p,S,x,Z,u,o,R,_,n?.id,C]),H=(0,E.useMemo)((()=>O||s||A&&!M||K&&!D),[O,s,A,K,M,D]);return(0,E.useMemo)((()=>({commitBuy:U,isCommitting:H})),[U,H])}var yn=n(1305),kn=n(948);const fn={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyPreviewCardsFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProperties",kind:"LinkedField",name:"userProperties",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasMadeAPurchase",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"19d3929ded0908975c2b8be625c1ce09"},bn=fn;var Sn=n(154),Fn=n(139),vn=n(157),hn=n(550);function Cn(e){return(0,ka.jsx)(Fn.Z,{owner:"trading",context:"buy_sell","data-element":"ErrorBoundary","data-component":"BuyPreviewCards",children:(0,ka.jsx)(vn.Z,{owner:"trading",boundaryName:"BuyPreviewCards",context:"buy_sell","data-element":"NetworkErrorBoundary",children:(0,ka.jsx)(Sn.Z,{instrumentationId:"BuyPreviewCardsContent",fallback:null,"data-element":"SuspenseWithTransition",children:(0,ka.jsx)(Tn,{...e,"data-element":"BuyPreviewCardsContent"})})})})}function Tn({queryRef:e,buyQuote:a}){const{viewer:n}=(0,W.Jc)(bn,e),{userProperties:l}=n,{hasMadeAPurchase:t}=l,r=(0,hn.ZP)(),{defaultFee:s,fee:i}=a,u=(0,E.useMemo)((()=>!t&&s&&i&&s.value!==i.value&&0===parseFloat(i.value)),[s,t,i]),o=(0,E.useMemo)((()=>{const e=[];return u?e.push((0,ka.jsx)(Ge.oU,{testID:"first-buy-card",icon:"circleCheckmark",description:r.feeWaived},"first-buy-card")):r.wblNoticeTextNew&&e.push((0,ka.jsx)(Ge.oU,{testID:"wbl-card",description:r.wblNoticeText},"wbl-card")),r.instantAchText&&e.push((0,ka.jsx)(Ge.oU,{testID:"instant-ach-card",description:r.instantAchText},"instant-ach-card")),e}),[u,r]);return(0,ka.jsx)(An,{"data-element":"PreviewCardGrid","data-component":"BuyPreviewCardsContent",children:o})}const An=j.ZP.div.withConfig({displayName:"BuyPreviewCards__PreviewCardGrid",componentId:"sc-1v5b2h-0"})(["display:grid;grid-auto-rows:auto;grid-gap:16px;padding-left:24px;padding-right:24px;padding-bottom:16px;"]);var Kn=n(1608);const xn=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"spreadPercentage",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},s=[r,{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],i={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:s,storageKey:null},u={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:s,storageKey:null},o={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:s,storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null},p={alias:null,args:null,concreteType:"FeeDetails",kind:"LinkedField",name:"fees",plural:!0,selections:[c,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},i,{alias:null,args:null,concreteType:"Disclosure",kind:"LinkedField",name:"disclosure",plural:!1,selections:[d,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[m,g],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"WaivedDetails",kind:"LinkedField",name:"waivedDetails",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null}],storageKey:null}],storageKey:null},y={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:s,storageKey:null},k={alias:null,args:null,concreteType:"TaxDetails",kind:"LinkedField",name:"taxDetails",plural:!0,selections:[c,i],storageKey:null},f={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"defaultFee",plural:!1,selections:s,storageKey:null},b={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:s,storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"appliedSubscriptionBenefit",storageKey:null},F={alias:null,args:null,concreteType:"SubscriptionInfo",kind:"LinkedField",name:"subscriptionInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasBenefitCap",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"freeTradingResetDate",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"remainingFreeTradingVolume",plural:!1,selections:[r],storageKey:null}],storageKey:null},v={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"unitPrice",plural:!1,selections:[i],storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"holdDays",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"recurringPayment",storageKey:null},T={alias:null,args:null,concreteType:"InstantAchData",kind:"LinkedField",name:"instantAch",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTotalInstant",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"instantAchAmount",plural:!1,selections:s,storageKey:null}],storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"resource",storageKey:null},K={alias:null,args:null,kind:"ScalarField",name:"hasBeenApplied",storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"redemptionStatus",storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"endsAt",storageKey:null},B={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutIncentive",plural:!1,selections:s,storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},P={alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[g,m],storageKey:null},R={alias:null,args:null,concreteType:"TransferUserWarningContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"details",storageKey:null},d,{alias:null,args:null,kind:"ScalarField",name:"linkText",storageKey:null}],storageKey:null},M={kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"GenericError",kind:"LinkedField",name:"error",plural:!1,selections:[I],storageKey:null}],type:"CreateBuyPartialError",abstractKey:null},E={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useRefreshBuyQuoteMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{kind:"InlineDataFragmentSpread",name:"createBuyFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[l,t,i,u,o,p,y,k,f,b,{kind:"InlineDataFragmentSpread",name:"simpleTradeBenefit_buy",selections:[y,S,b,F],args:null,argumentDefinitions:[]},v,h,C,T,A,{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[K,x,w,B],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[L,I,P,R],storageKey:null}],args:null,argumentDefinitions:[]}],type:"CreateBuySuccess",abstractKey:null},M],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useRefreshBuyQuoteMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[l,t,i,u,o,p,y,k,f,b,S,F,v,h,C,T,A,{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[K,x,w,B,E],storageKey:null},E],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[L,I,P,R,E],storageKey:null}],type:"CreateBuySuccess",abstractKey:null},M],storageKey:null}]},params:{id:"86d9fd0b578a2fad301f1435ae9ee94c930b58e1d0823c53ce7ac0cc4800f0ea",metadata:{},name:"useRefreshBuyQuoteMutation",operationKind:"mutation",text:null}}}();xn.hash="faa6976d150e68e2db2e2d7b1974cbba";const wn=xn;var Bn=n(506),Ln=n(1501);const In=4e3,Pn=({input:e,exchangeRate:a,subscriptionUpsellFlowComplete:n})=>{const l=(0,E.useRef)(),[t,r]=(0,W.Db)(wn),{startTimeout:s,stopTimeout:i}=(0,Ln.Z)(),{buyQuoteResponse:u}=(0,N.jf)(ke.cr),o=(0,E.useRef)(a),[c,d]=(0,E.useState)(!1),m=(0,E.useCallback)((e=>{const a=(0,W.fR)(kn.$,e);u.onChange(a),parseFloat(a.transferBuy.unitPrice.amount.value)/parseFloat(o.current)>1.02&&d(!0)}),[u]),g=(0,E.useCallback)((()=>t({variables:{input:e},onCompleted:({response:e})=>{const a=e.createBuy;if("CreateBuySuccess"===a?.__typename)return m(a),void s((()=>{l.current=g()}),In);(0,q.cB)(new Error("Buy quote refresh failed"),{owner:"trading",context:"buy_sell"})},onError:e=>{(0,q.cB)((0,un.Xv)(e),{owner:"trading",context:"buy_sell"})}})),[t,m,e,s]),p=(0,E.useCallback)((()=>{l.current?.dispose(),i()}),[i]);return(0,E.useEffect)((()=>(s((()=>{l.current=g()}),In),()=>{p()})),[]),(0,E.useEffect)((()=>{p(),l.current=g()}),[n]),(0,Bn.Z)((()=>{p(),l.current=g()}),[e.tradeIncentiveInputs]),{stopPolling:p,isSignificantChange:c,isCommitting:r,submitQuote:g}};var Rn=n(54),Mn=n(179),En=n(52),_n=n(14),Vn=n(2427);const Dn=(0,pa.vU)({redirectionBannerTitle:{id:"OBRedirectionBanner.redirectionBannerTitle",defaultMessage:"Next we’ll redirect you to {bankName} to complete the transaction."}}),jn=(0,E.memo)((function({paymentMethod:e}){const{formatMessage:a}=(0,ya.Z)(),{pickerData:n,type:l}=e||{},{institutionName:t,institutionLogoUrl:r,trueLayerBankProviderId:s}=n||{};return(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.jQ,{children:(0,ka.jsxs)(Rn.HStack,{alignItems:"center",borderRadius:"rounded",borderColor:"line",bordered:!0,spacingVertical:2,spacingStart:2,spacingEnd:1,children:[(0,ka.jsx)(En.VStack,{spacingEnd:1,children:(0,ka.jsx)(Vn.Z,{type:l,institutionLogoUrl:r,trueLayerBankProviderId:s})}),(0,ka.jsx)(En.VStack,{flexShrink:1,children:(0,ka.jsx)(_n.TextLegal,{as:"p",children:a(Dn.redirectionBannerTitle,{bankName:t})})})]})}),(0,ka.jsx)(Mn.Spacer,{vertical:2})]})}));var Nn=n(19);const On=(0,pa.vU)({termsAndConditions:{id:"OpenBankingTncCell.termsAndConditions",defaultMessage:"By continuing you are permitting TrueLayer to initiate a payment from your bank account to Coinbase. You also agree to TrueLayer’s {eut} and {privacy}"},endUserTerms:{id:"OpenBankingTncCell.endUserTerms",defaultMessage:"End User Terms of Service"},privacy:{id:"OpenBankingTncCell.privacy",defaultMessage:"Privacy Policy"}}),Zn=(0,E.memo)((function(){const{formatMessage:e}=(0,ya.Z)(),a=(0,E.useCallback)((e=>{e?(0,Q.Kz)("ob_buy_privacy_link_clicked",{action:Q.Us.click,componentType:Q.re.link}):(0,Q.Kz)("ob_buy_user_terms_link_clicked",{action:Q.Us.click,componentType:Q.re.link})}),[]);return(0,ka.jsx)(G.jQ,{children:(0,ka.jsx)(Nn.Box,{spacingBottom:2,children:(0,ka.jsx)(_n.TextLegal,{color:"foregroundMuted",as:"p",children:e(On.termsAndConditions,{eut:(0,ka.jsx)(_n.Link,{to:"https://truelayer.com/enduser_tos",openInNewWindow:!0,onPress:()=>a(!1),children:e(On.endUserTerms)}),privacy:(0,ka.jsx)(_n.Link,{to:"https://truelayer.com/privacy/",openInNewWindow:!0,onPress:()=>a(!0),children:e(On.privacy)})})})})})})),Un=["buy_ach_notice","buy_ny_notice","buy_trade_disclosure"],qn=[...Un,"rewards_notice"],Qn=(e=[])=>{const a=E.Children.toArray((0,D.compact)(e));return a.length>0?a:null};function Hn({tradeWarning:e,onClick:a}){return(0,Q.bH)("trade_disclosure",{componentType:Q.re.card,display_type:"label"}),(0,ka.jsx)(G.$M,{text:e.message,link:{text:e?.context?.linkText??"",onClick:a},"data-element":"PreviewFooterNotice","data-component":"TradeFooterNotice"})}const Wn=Ne;function zn({queryRef:e,accountRef:a,viewerAssetRef:n,handleTaxInfoClicked:l,handlePromoCodeInfoClicked:t,isFreeTradePromoCodeEligible:r}){const s=(0,W.Jc)(De,e),i=(0,W.Jc)(_e,a),u=(0,W.Jc)(Me,n),{viewer:o}=s,c=(0,ha.Z)(),{goToStep:d,goBack:m}=(0,ae.tC)(ke.Ex),{eventContext:g,buyQuoteResponse:p,recurringPeriod:y,isFiatInput:k,buyInputParams:f,freeTradePromoCode:b,shouldBuyAndStake:S}=(0,N.jf)(ke.cr),{isCoinbaseOneSubscriber:F,variant:v,subscriptionUpsellFlowComplete:h}=(0,pe.f)(),{isInSingapore:C}=(0,ta.Z)(),[T,{toggle:A}]=(0,Ze.useToggler)(!0),K=(0,q.$T)(),x=(0,Ye.h)(),w=(0,E.useMemo)((()=>p.value?.transferBuy),[p.value?.transferBuy]),B=(0,E.useMemo)((()=>p.value?.userWarnings??[]),[p.value?.userWarnings]),L=(0,Ta.R)(),I=(0,ea.S)(),P=(0,E.useMemo)((()=>"USDC"===w?.amount?.currency),[w?.amount?.currency]);V()(w,"There should be a buy quote response");const{commitBuy:R,isCommitting:M}=pn({accountRef:i,viewerAssetRef:u}),{trackEvent:_}=(0,Se.Z)(),D=(0,hn.oT)(v);V()(f.value,"buy input params should be set");const j=!D.recurringValue&&!F&&r,{isFreeTradePromoCodeValid:O}=(0,Ca.V)({inputParams:f,response:w,freeTradePromoCode:b}),{stopPolling:Z,isSignificantChange:U}=Pn({input:f.value,exchangeRate:w.unitPrice.amount.value,subscriptionUpsellFlowComplete:h}),H=(0,He.o7)({viewerAssetRef:u}),z=Boolean(u.earnAsset?.autoStaking?.isEnrolled),J=H&&!w.recurringPayment,{showModal:$}=(0,la.Z)(),Y=(0,E.useCallback)((()=>{Z(),m()}),[m,Z]),X=(0,E.useCallback)((()=>{Z()}),[Z]);(0,E.useEffect)((()=>{U&&$((0,ka.jsx)(Xe.D,{asset:u.asset.displaySymbol??"",displayInputCurrency:w.total.currency,onConfirm:Z,onBack:Y}))}),[U]);const{setWalletTxnTimestamp:ee}=(0,na.W)(),ne=(0,E.useCallback)((()=>{r&&!O()||(S.value&&(0,We.N4)({asset:u.asset.platformName||"",eventContext:g.value,currencyType:k.value?"fiat":"crypto",isAutoStakingEnrolled:z}),_("tapped_confirm_button",{paymentMethodType:c.type}),(0,Q.$Y)("trigger_buy_order_confirm_button"),Z(),ee({pmType:c.type,trackType:"buy",id:c.id}),R())}),[c,ee,r,O,S.value,_,Z,R,u.asset.platformName,z,g.value,k.value]),le=(0,Q.ld)("trade_disclosure_cta",{action:Q.Us.click,componentType:Q.re.button,display_type:"label",cta_type:"primary"}),te="tapped_buy_fee_explanation_button",re=(0,E.useCallback)((()=>{_(te,{content:"coinbase_fees"})}),[_,te]),se=(0,E.useCallback)((()=>{re(),d("feesInfo")}),[re,d]),ie=(0,E.useCallback)((()=>{_(te,{content:"price"}),d("priceInfo")}),[d,_]),ue=(0,E.useCallback)((()=>{(0,We.lI)({asset:u.asset.platformName||"",eventContext:g.value,isAutoStakingEnrolled:z}),d("unstakingInfo")}),[d,u,z,g.value]),oe=w.recurringPayment,ce=(0,ve.Z)(),{hasConvertTradeToRecurringSwitch:de,isToggled:me,setIsToggled:ge}=(0,Kn.Z)({recurringBuyPolicyRestrictionCount:o.policyRestrictions?.length??0,recurringPayment:oe,hasRecurringOptions:ce}),{submitBuy:ye,isSubmittingBuy:fe}=(0,yn.Z)({accountRef:i,viewerAssetRef:u}),be=(0,E.useMemo)((()=>k.value?"total":"amount"),[k.value]),Fe=(0,E.useCallback)(((e,a,n,l)=>{f.value&&(f.onChange({...f.value,tradeIncentiveInputs:e}),Z(),ye({variables:{tradeIncentiveInputs:e,[be]:w[be].value,currency:w[be].currency},onSuccess:r=>{const s=(0,W.fR)(kn.$,r);p.onChange(s),e&&(s.transferBuy.tradeIncentiveInfo?(t(a),n()):l())},onError:()=>d("entry")}))}),[Z,ye,p,w,be,d,f,t]),he=(0,E.useCallback)((()=>{_("tapped_recurring_trade_upsell_banner",{recurringPeriod:"weekly"}),Z(),ge(!me),ye({variables:{recurringPeriod:me?null:"weekly",[be]:w[be].value,currency:w[be].currency},onSuccess:e=>{Z(),p.onChange((0,W.fR)(kn.$,e)),y.onChange(me?"never":"weekly"),me&&S.onChange(!1),A()},onError:()=>d("entry")})}),[_,Z,ye,ge,A,be,w,p,y,S,me,d]),Ce=w.fee,Te=w.fees,Ae=w.tradeIncentiveInfo?.feeWithoutIncentive,Ke=w.defaultFee,xe=w?.taxDetails,we=(0,E.useMemo)((()=>"uk_bank_account"===c?.type&&!!c?.pickerData?.trueLayerBankProviderId),[c]);function Be(e){return B.find((a=>a.code===e))}(0,E.useEffect)((()=>(_("viewed_preview",{paymentMethodType:c.type}),(0,Q.$Y)("loaded_buy_order_preview"),Z)),[]);const Le=(0,E.useMemo)((()=>({INDIA_WITHHOLDING:D.tdsLabel,AUSTRALIA_GST:D.gstLabel,SINGAPORE_GST:D.gstLabel})),[D]),Ie=(0,E.useMemo)((()=>B.filter((e=>P?!qn.includes(e.code):!Un.includes(e.code))).map((e=>(0,ka.jsx)(G.ab,{text:e.message,link:e?.link||void 0})))),[P,B]),Pe=(0,E.useMemo)((()=>{if(P){const e=B.find((e=>"rewards_notice"===e.code));return e&&(0,ka.jsx)(G.ab,{text:e.message,link:e?.link||void 0})}}),[P,B]),Re=(0,He.Yp)(u).map((e=>(0,ka.jsx)(G.ab,{noBorder:!0,text:e.message,link:e.link}))),Ee=Re.length>0&&S.value,Ve=Be("buy_ach_notice"),je=Ve?(0,ka.jsx)(G.$M,{text:Ve.message}):null,Ne=Be("buy_ny_notice"),Oe=Ne?(0,ka.jsx)(G.$M,{text:Ne.message}):null,$e=Be("buy_trade_disclosure"),aa=$e?.context?(0,ka.jsx)(Hn,{tradeWarning:$e,onClick:()=>{d("buyDisclosures"),le()}}):null,ga=(0,E.useMemo)((()=>(0,ka.jsx)(G.h4,{goBack:M?void 0:Y,title:D.header,testID:"buy-preview"})),[Y,M,D.header]),pa=Boolean(Ce&&Ke&&Ce.value!==Ke.value),ya=(0,E.useMemo)((()=>(0,Qe.xx)(w,"buy")),[w]),fa=(0,ca.c)({queryRef:s,tradeVolumeValue:w.total.value}),Fa=(0,oa.I)({queryRef:s,subscriptionFeeBenefit:ya,feeValue:Ce?.value||"0"}),Aa=(0,Qe.A1)({viewerRef:o}),Ka=(0,ra.l)({queryRef:s}),{premiumTierPlan:xa}=(0,sa.i)(s),wa=(0,E.useMemo)((()=>Fa&&xa&&Ce?(0,ka.jsx)(ua.d,{onPress:()=>{d("coinbaseOneChangePlan")},potentialSavings:Ce,testID:"subscription-trade-upgrade-cell"}):"cell"===fa&&Ce&&!F?(0,ka.jsx)(ia.v,{onPress:()=>{d("coinbaseOneSignup")},fee:Ce,isEligibleForFreeTrial:Aa,formattedFreeTrialLength:Ka,testID:"subscription-trade-signup-cell"}):null),[Ka,d,F,Aa,xa,Fa,Ce,fa]),Ba=(0,E.useCallback)((()=>Ce?Ke&&pa?(0,ka.jsxs)(Gn,{children:[(0,ka.jsx)(Jn,{children:0===parseFloat(Ce?.value)?D.free:K({amount:Ce,isFiat:!0})}),(0,ka.jsx)($n,{...Ke,amount:Ke.value})]}):F?(0,ka.jsx)(da.F,{subscriptionFeeBenefit:ya}):K({amount:Ae||Ce,isFiat:!0}):null),[Ke,Ce,K,ya,F,pa,D.free,Ae]),La=(0,ka.jsx)(ka.Fragment,{children:xe?.map(((e,a)=>e?(0,ka.jsx)(G.oO,{label:Le[e.name],rightContent:K({amount:e.amount,isFiat:!0}),onClick:()=>l(e.name),isInfo:!0,testID:"tax"},a):null))}),Ia=(0,ka.jsx)(G.aR,{label:D.paymentLabel,rightContent:D.paymentValue,rightIcon:we?null:c.icon}),Pa=(0,ka.jsx)(G.hc,{includesTaxes:!1,hasPromo:!1,label:D.priceLabel,rightContent:D.priceValue,onClick:ie}),Ra=(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.hc,{includesTaxes:C&&!(xe?.length&&xe?.length>=0),hasPromo:pa,rightContent:Ba(),onClick:se,testID:"buy-preview"}),La,F&&(0,ka.jsx)(ma.c,{subscriptionFeeBenefit:ya})]}),Ma=(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.mG,{accessibilityLabel:D.accessibilityLabel,text:D.cryptoAmount,useTicker:!0}),(0,ka.jsx)(Je.Z,{viewerAssetRef:u}),(0,ka.jsx)(G.LZ,{size:"enormous"})]});let Ea=(0,ka.jsxs)(ka.Fragment,{children:[Ia,(!T||D.recurringValue)&&(0,ka.jsx)(G.aR,{label:D.recurringLabel,testID:"recurring-preview-row",rightContent:(0,ka.jsxs)(ka.Fragment,{children:[D.recurringValue,(0,ka.jsx)("br",{}),D.recurringValueDetails]})}),Pa,(0,ka.jsx)(G.aR,{label:D.actionLabel,rightContent:D.actionValue}),!x&&Ra,x&&(0,ka.jsx)(va,{fees:Te,subscriptionFeeBenefit:ya,onGoToFeesInfoStep:X,isCoinbaseOneSubscriber:F}),j&&!x&&(0,ka.jsx)(ze.Z,{handleFreeTradePromoCodeAction:Fe,fee:w.fee,tradeIncentiveInfo:w.tradeIncentiveInfo}),(0,ka.jsx)(G.aR,{label:D.totalLabel,rightContent:D.totalValue,isLastRow:!de&&!J}),J&&(0,ka.jsx)(He.EB,{viewerAssetRef:u,checked:S.value,onChange:S.onChange,handleInfoClick:ue}),de&&(0,ka.jsx)(Ge.As,{onChange:he,isToggled:me,isDisabled:fe||M})]});"cashTransfer"===v&&(Ea=(0,ka.jsx)(ba,{from:w.total.currency,fromValue:D.totalValue,to:w.amount.currency,toValue:D.cryptoAmount,totalValue:D.totalValue,receiptTaxAndFees:Ra}));const _a=Qn([Ie,Pe]),Va=Qn([je,aa,Oe]),Da=(0,E.useMemo)((()=>S.value&&u?.staking?.buyAndStakeInfo?.buyCta?u?.staking?.buyAndStakeInfo?.buyCta:D.button),[D.button,S.value,u?.staking?.buyAndStakeInfo?.buyCta]);return(0,ka.jsxs)(G.cp,{"data-element":"PreviewWrapper","data-component":"BuyPreviewStepContent",children:[(0,ka.jsxs)(G.zP,{"data-element":"PreviewSection",children:[ga,(0,ka.jsxs)(G.jQ,{"data-element":"HorizontalPadding",children:[Ma,Ea]}),(0,ka.jsx)(G.LZ,{size:"medium","data-element":"Spacer"}),wa,(0,ka.jsx)(Cn,{queryRef:s,buyQuote:w,"data-element":"BuyPreviewCards"}),_a&&(0,ka.jsx)(G.vl,{children:_a}),Ee&&(0,ka.jsx)(G.vl,{children:Re}),we?(0,ka.jsx)(jn,{paymentMethod:c}):null]}),(0,ka.jsxs)(G.zP,{"data-element":"PreviewSection",children:[(0,ka.jsx)(G.jQ,{"data-element":"HorizontalPadding",children:(0,ka.jsx)(Ue.Button,{block:!0,loading:M||fe,onPress:ne,testID:"buy-confirm-button","data-testid":"buy-confirm-button",disabled:L||I,"data-element":"Button",children:Da})}),(0,ka.jsx)(Sa.Z,{entryPoint:"unsupported",queryRef:s,accountRef:i,assetOrCurrencyRef:u,"data-element":"BuySellFooter"}),we?(0,ka.jsx)(Zn,{}):null]}),Va?(0,ka.jsx)(G.lK,{hasBorderTop:!0,children:Va}):(0,ka.jsx)(qe.Spacer,{vertical:3})]})}const Gn=(0,j.ZP)(Oe.Z).attrs((()=>({align:"center"}))).withConfig({displayName:"BuyPreviewStep__PromoContainer",componentId:"sc-94uc9-0"})([""]),Jn=j.ZP.div.withConfig({displayName:"BuyPreviewStep__PromoAmount",componentId:"sc-94uc9-1"})(["color:",";margin-right:8px;"],(({theme:e})=>e.color.textAccent)),$n=(0,j.ZP)($e.Z).withConfig({displayName:"BuyPreviewStep__StrikedFormattedAmount",componentId:"sc-94uc9-2"})(["text-decoration:line-through;"]);function Yn({viewerAssetRef:e,...a}){const n=(0,W.Jc)(Pe,e);V()(n.asset.platformName&&n.asset.uuid,"There should be a selectedAsset for preview step");const l=(0,se.Z)(),t=(0,W.pp)(Wn,{action:"recurring_buys",nativeCurrency:l,productKey:ga.sP});return(0,ka.jsx)(zn,{...a,queryRef:t,viewerAssetRef:n,"data-element":"BuyPreviewStepContent","data-component":"BuyPreviewStepContainerDeprecated"})}function Xn({preloadedQueryRef:e,viewerAssetRef:a,...n}){const l=(0,W.Uh)(Wn,e),t=(0,W.Jc)(Le,a);return(0,ka.jsx)(zn,{...n,queryRef:l,viewerAssetRef:t,"data-element":"BuyPreviewStepContent","data-component":"BuyPreviewStepContainer"})}function el({viewerAssetRef:e,...a}){const n=(0,W.Jc)(we,e);return aa()?(0,ka.jsx)(Xn,{...a,viewerAssetRef:n}):(0,ka.jsx)(Yn,{...a,viewerAssetRef:n})}const al={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellPreviewStepViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"},{args:null,kind:"FragmentSpread",name:"useSellQuoteSubmitterViewerAssetFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"f95c68472808649034ca00bfd8704b54"},nl=al,ll={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellPreviewStepAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{args:null,kind:"FragmentSpread",name:"useSellCommitterFragment"},{args:null,kind:"FragmentSpread",name:"useSellQuoteSubmitterFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"ecf6d241512e843a608363271c33b8a1"},tl=ll,rl={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellPreviewStepContentFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"},{args:null,kind:"FragmentSpread",name:"useTradeSubscriptionSignupVariantFragment"},{args:null,kind:"FragmentSpread",name:"useFormattedFreeTrialLengthFragment"},{args:null,kind:"FragmentSpread",name:"useShowSubscriptionUpgradeUpsellFragment"},{args:null,kind:"FragmentSpread",name:"usePremiumTierPlanFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"useIsEligibleForFreeTrialFragment"}],storageKey:null}],type:"Query",abstractKey:null,hash:"ddb82a04acff8b2c658f031adc8fb01f"},sl=rl,il=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},{defaultValue:null,kind:"LocalArgument",name:"productKey"}],a={alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null},t=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},l],r={alias:null,args:null,kind:"ScalarField",name:"tier",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"accountUuid",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"paymentMethodUuid",storageKey:null},d={alias:null,args:null,concreteType:null,kind:"LinkedField",name:"metadata",plural:!1,selections:[i,{kind:"InlineFragment",selections:[u,o,{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"balance",plural:!1,selections:t,storageKey:null}],type:"CoinbaseSubscriptionFiatAccountMetadata",abstractKey:null},{kind:"InlineFragment",selections:[c,{alias:null,args:null,kind:"ScalarField",name:"accountName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"accountNumber",storageKey:null}],type:"CoinbaseSubscriptionACHMetadata",abstractKey:null},{kind:"InlineFragment",selections:[c,{alias:null,args:null,kind:"ScalarField",name:"institutionName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cardLast4",storageKey:null}],type:"CoinbaseSubscriptionWorldpayCardMetadata",abstractKey:null},{kind:"InlineFragment",selections:[u,{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,concreteType:"AssetCurrentBalance",kind:"LinkedField",name:"assetCurrentBalance",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToTradeBalance",plural:!1,selections:t,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToTradeBalanceFiat",plural:!1,selections:t,storageKey:null},n],storageKey:null},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},o,n],storageKey:null},n],storageKey:null}],type:"CoinbaseSubscriptionCryptoAccountMetadata",abstractKey:null}],storageKey:null},m=[{alias:null,args:null,kind:"ScalarField",name:"isEligible",storageKey:null}],g={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"proratedPrice",plural:!1,selections:t,storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"SellPreviewStepQuery",selections:[{args:null,kind:"FragmentSpread",name:"SellPreviewStepContentFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"SellPreviewStepQuery",selections:[{alias:null,args:[{kind:"Variable",name:"baseCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"exchangeRatesV3",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"quoteCurrency",storageKey:null},a],storageKey:null},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProperties",kind:"LinkedField",name:"userProperties",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"nativeCurrency",storageKey:null},{alias:null,args:null,concreteType:"RegionFeatures",kind:"LinkedField",name:"regionFeatures",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"supportsFiatTransfers",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"supportsCryptoToCryptoTransfers",storageKey:null}],storageKey:null},n,{alias:null,args:null,concreteType:"Country",kind:"LinkedField",name:"country",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],storageKey:null}],storageKey:null},{alias:"assets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"tradableAssets",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[a],storageKey:null},n],storageKey:null},n],storageKey:null}],storageKey:null}],storageKey:null},n,{alias:null,args:[{kind:"Variable",name:"productKey",variableName:"productKey"}],concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},n,{alias:null,args:null,concreteType:"SubscriptionRenewalSummary",kind:"LinkedField",name:"renewalSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"renewalAmount",plural:!1,selections:t,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[r,n],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPaymentMethod",kind:"LinkedField",name:"activePaymentMethodV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isDeleted",storageKey:null},s,l,d],storageKey:null}],storageKey:null},{alias:"freeTrialEligibility",args:[{kind:"Literal",name:"eligibleEntities",value:["FREE_TRIAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:m,storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["FREE_TRIAL"])'},{alias:null,args:[{kind:"Literal",name:"eligibleEntities",value:["COINBASE_ONE_GENERAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:m,storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["COINBASE_ONE_GENERAL"])'},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPaymentMethod",kind:"LinkedField",name:"coinbaseSubscriptionPaymentMethods",plural:!0,selections:[s,l,d],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"coinbaseSubscriptionPlans",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"displayName",storageKey:null},s,{alias:null,args:null,kind:"ScalarField",name:"product",storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanBillingFrequency",kind:"LinkedField",name:"planBillingFrequency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"unit",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numberOfUnits",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"subscriptionPlanUuid",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"price",plural:!1,selections:t,storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPromotion",kind:"LinkedField",name:"promotion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"promotionType",storageKey:null},n,i],storageKey:null},g,r,{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanMetadata",kind:"LinkedField",name:"metadata",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"migrationMetadata",plural:!1,selections:[i,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"initialBillingPeriodEnd",storageKey:null},g,{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"creditRefund",plural:!1,selections:t,storageKey:null}],type:"CoinbaseSubscriptionPlanMigrationBillingCycleChange",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{id:"365a54e2206a0709f5518649975e307b5b31152105c87fc2d8dbf4dfc0d2e9d2",metadata:{},name:"SellPreviewStepQuery",operationKind:"query",text:null}}}();il.hash="c238ffe93c159d08779421048a696869";const ul=il;var ol=n(1392);const cl=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"success",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},r={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},u={kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"GenericError",kind:"LinkedField",name:"error",plural:!1,selections:[s,i],storageKey:null}],type:"CommitSellPartialError",abstractKey:null},o={kind:"InlineFragment",selections:[i,s],type:"GenericError",abstractKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useSellCommitterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"commitSell",plural:!1,selections:[n,{kind:"InlineFragment",selections:[l,{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[t,r],storageKey:null}],type:"CommitSellSuccess",abstractKey:null},u,o],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useSellCommitterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"commitSell",plural:!1,selections:[n,{kind:"InlineFragment",selections:[l,{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[t,r,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}],type:"CommitSellSuccess",abstractKey:null},u,o],storageKey:null}]},params:{id:"6bc2a824bf4df9c606ea43067e6d05e388023b3fe0f357616c6128dc3d849240",metadata:{},name:"useSellCommitterMutation",operationKind:"mutation",text:null}}}();cl.hash="1edee196062ce33ee612ffca8f516ae3";const dl=cl,ml={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSellCommitterFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],type:"Account",abstractKey:null,hash:"8ad306f83fe27619a7f3b8d5d0ce748e"},gl=ml;var pl=n(1306),yl=n(949),kl=n(1609);const fl=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"spreadPercentage",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},s=[r,{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],i={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:s,storageKey:null},u={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:s,storageKey:null},o={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:s,storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null},p={alias:null,args:null,concreteType:"FeeDetails",kind:"LinkedField",name:"fees",plural:!0,selections:[c,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},i,{alias:null,args:null,concreteType:"Disclosure",kind:"LinkedField",name:"disclosure",plural:!1,selections:[d,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[m,g],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"WaivedDetails",kind:"LinkedField",name:"waivedDetails",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null}],storageKey:null}],storageKey:null},y={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:s,storageKey:null},k={alias:null,args:null,concreteType:"TaxDetails",kind:"LinkedField",name:"taxDetails",plural:!0,selections:[c,i],storageKey:null},f={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"defaultFee",plural:!1,selections:s,storageKey:null},b={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:s,storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"appliedSubscriptionBenefit",storageKey:null},F={alias:null,args:null,concreteType:"SubscriptionInfo",kind:"LinkedField",name:"subscriptionInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasBenefitCap",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"freeTradingResetDate",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"remainingFreeTradingVolume",plural:!1,selections:[r],storageKey:null}],storageKey:null},v={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"unitPrice",plural:!1,selections:[i],storageKey:null},h={alias:null,args:null,kind:"ScalarField",name:"resource",storageKey:null},C={alias:null,args:null,kind:"ScalarField",name:"hasBeenApplied",storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"redemptionStatus",storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"endsAt",storageKey:null},K={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutIncentive",plural:!1,selections:s,storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},B={alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[g,m],storageKey:null},L={alias:null,args:null,concreteType:"TransferUserWarningContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"details",storageKey:null},d,{alias:null,args:null,kind:"ScalarField",name:"linkText",storageKey:null}],storageKey:null},I={kind:"InlineFragment",selections:[w],type:"GenericError",abstractKey:null},P={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useRefreshSellQuoteMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createSell",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{kind:"InlineDataFragmentSpread",name:"createSellFragment",selections:[{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[l,t,i,u,o,p,y,k,f,b,{kind:"InlineDataFragmentSpread",name:"simpleTradeBenefit_sell",selections:[y,S,b,F],args:null,argumentDefinitions:[]},v,h,{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[C,T,A,K],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[x,w,B,L],storageKey:null}],args:null,argumentDefinitions:[]}],type:"CreateSellSuccess",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"error",plural:!1,selections:[I],storageKey:null}],type:"CreateSellPartialError",abstractKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useRefreshSellQuoteMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createSell",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[l,t,i,u,o,p,y,k,f,b,S,F,v,h,{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[C,T,A,K,P],storageKey:null},P],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[x,w,B,L,P],storageKey:null}],type:"CreateSellSuccess",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"error",plural:!1,selections:[n,I],storageKey:null}],type:"CreateSellPartialError",abstractKey:null}],storageKey:null}]},params:{id:"33d7c9e380e38110de0a132ee7042ce237da893ea89530b7f37d395594db119d",metadata:{},name:"useRefreshSellQuoteMutation",operationKind:"mutation",text:null}}}();fl.hash="404bfe92aa3ebbb91875f3afdae663ec";const bl=fl,Sl=({input:e,exchangeRate:a,subscriptionUpsellFlowComplete:n})=>{const[l,t]=(0,W.Db)(bl),r=(0,E.useRef)(),{startTimeout:s,stopTimeout:i}=(0,Ln.Z)(),{sellQuoteResponse:u}=(0,N.jf)(ke.cr),{onChange:o}=u,c=(0,E.useRef)(a),[d,m]=(0,E.useState)(!1),g=(0,E.useCallback)((e=>{const a=(0,W.fR)(yl.P,e);o(a),parseFloat(a.transferSell.unitPrice.amount.value)/parseFloat(c.current)<.98&&m(!0)}),[o]),p=(0,E.useCallback)((()=>l({variables:{input:e},onCompleted:({response:e})=>{const a=e.createSell;if("CreateSellSuccess"===a?.__typename)return g(a),void s((()=>{r.current=p()}),In);(0,q.cB)(new Error("Sell quote refresh failed"),{owner:"trading",context:"buy_sell"})},onError:e=>{(0,q.cB)((0,Ra.Xv)(e),{owner:"trading",context:"buy_sell"})}})),[l,e,g,s]),y=(0,E.useCallback)((()=>{r.current?.dispose(),i()}),[i]);return(0,E.useEffect)((()=>(s((()=>{r.current=p()}),In),()=>{y()})),[]),(0,E.useEffect)((()=>{y(),r.current=p()}),[n]),(0,Bn.Z)((()=>{y(),r.current=p()}),[e.tradeIncentiveInputs]),{stopPolling:y,isSignificantChange:d,isCommitting:t}},Fl=["sells_unsupported"],vl=(e=[])=>{const a=E.Children.toArray((0,D.compact)(e));return a.length>0?a:null},hl=ul;function Cl({queryRef:e,accountRef:a,viewerAssetRef:n,handleTaxInfoClicked:l,isFreeTradePromoCodeEligible:t,handlePromoCodeInfoClicked:r}){const s=(0,W.Jc)(sl,e),i=(0,W.Jc)(tl,a),u=(0,W.Jc)(nl,n),o=(0,ha.Z)(),{goToStep:c,goBack:d}=(0,ae.tC)(ke.Ex),{sellQuoteResponse:m,sellInputParams:g,freeTradePromoCode:p}=(0,N.jf)(ke.cr),{isCoinbaseOneSubscriber:y,variant:k}=(0,pe.f)(),{isInSingapore:f}=(0,ta.Z)(),b=(0,q.$T)(),S=(0,Ye.h)(),F=(0,ol.p)(),v=(0,ea.S)(),h=m.value?.transferSell,C=m.value?.userWarnings??[];V()(h,"There should be a sell quote response");const{commitSell:T,isCommitting:A}=function(e){const a=(0,W.Jc)(gl,e),{showErrorToast:n}=(0,Va.Z)(),{sellQuoteResponse:l,sellCommitResponse:t}=(0,N.jf)(ke.cr),{goToStep:r}=(0,ae.tC)(ke.Ex),{formatMessage:s}=(0,ya.Z)(),i=(0,Na.Z)(),u=(0,_a.K)(),o="deneb_imps"===i.type,c=l.value?.transferSell.uuid;V()(c,"There should be a sell quote id");const[d,m]=(0,W.Db)(dl);return{commitSell:(0,E.useCallback)((()=>{d({variables:{input:{accountUuid:a.uuid,transferSellUuid:c}},updater:e=>{u||e.get(a?.id??"")?.invalidateRecord()},onCompleted:({response:e})=>{const a=e?.commitSell;switch(a?.__typename){case"CommitSellSuccess":t.onChange(a.transferSell),r(o?"processingPayout":"sellStatus");break;case"GenericError":{const e=new Error("Commit sell request failed");let l=a.message;return"UPSTREAM_GENERIC_ERROR"===a.code&&(l=s(Ma.s.genericErrorMessage)),e.cause=a.message,(0,q.cB)(e,{owner:"trading",context:"buy_sell"}),n(l)}default:(0,q.cB)(new Error("Unexpected typename returned"),{owner:"trading",context:"buy_sell",typename:a?.__typename})}},onError:({alreadyReportedError:e})=>{(0,q.cB)((0,Ra.Xv)(e),{owner:"trading",context:"buy_sell"}),n(s(Ma.s.commitError))}})}),[d,a.uuid,c,t,o,r,n,s,a?.id,u]),isCommitting:m}}(i),{trackEvent:K}=(0,Se.Z)(),x=(0,kl.Z)(k),w=!y&&t,{isFreeTradePromoCodeValid:B}=(0,Ca.V)({inputParams:g,response:h,freeTradePromoCode:p});V()(g.value,"sell input params should be set");const{submitSell:L}=(0,pl.Z)({accountRef:i,viewerAssetRef:u}),{stopPolling:I,isSignificantChange:P}=Sl({input:g.value,exchangeRate:h.unitPrice.amount.value}),{showModal:R}=(0,la.Z)(),M=(0,E.useCallback)((()=>{I(),d()}),[d,I]),_=(0,E.useCallback)((()=>{I()}),[I]);(0,E.useEffect)((()=>{P&&R((0,ka.jsx)(Xe.D,{asset:u.asset.displaySymbol??"",displayInputCurrency:h.total.currency,onConfirm:I,onBack:M}))}),[P]);const{setWalletTxnTimestamp:D}=(0,na.W)(),j=(0,E.useCallback)((()=>{t&&!B()||(K("tapped_confirm_button",{paymentMethodType:o.type}),(0,Q.$Y)("trigger_sell_order_confirm_button"),I(),D({pmType:o.type,trackType:"sell-or-add-cash",id:o.id}),T())}),[K,I,T,B,t,D,o]),O="tapped_sell_fee_explanation_button",Z=(0,E.useCallback)((e=>{K(O,{content:e})}),[K,O]),U=(0,E.useCallback)((()=>{Z("coinbase_fees"),c("feesInfo")}),[Z,c]),H=(0,E.useCallback)((()=>{Z("price"),c("priceInfo")}),[c,Z]),z=(0,E.useCallback)(((e,a,n,l)=>{g.value&&(g.onChange({...g.value,tradeIncentiveInputs:e}),I(),L({variables:{...g.value,tradeIncentiveInputs:e},onSuccess:t=>{const s=(0,W.fR)(yl.P,t);m.onChange(s),e&&(s.transferSell.tradeIncentiveInfo?(r(a),n()):l())},onError:()=>c("entry")}))}),[I,L,m,c,g,r]),J=h.fee,$=h.fees,Y=h.tradeIncentiveInfo?.feeWithoutIncentive,X=h.defaultFee,ee=h?.taxDetails;(0,E.useEffect)((()=>(K("viewed_preview",{paymentMethodType:o.type}),(0,Q.$Y)("loaded_sell_order_preview"),I)),[]);const ne=(0,E.useMemo)((()=>({INDIA_WITHHOLDING:x.tdsLabel,AUSTRALIA_GST:x.gstLabel,SINGAPORE_GST:x.gstLabel})),[x]),le=C.find((e=>"sells_unsupported"===e.code))?(0,ka.jsx)(G.ab,{text:x.sellsUnsupportedText,link:{text:x.sellsUnsupportedLink,url:G.B2}}):null,te=C.filter((e=>!Fl.includes(e.code))).map((e=>(0,ka.jsx)(G.ab,{text:e.message}))),re=(0,E.useMemo)((()=>(0,ka.jsx)(G.h4,{goBack:A?void 0:M,title:x.header,testID:"sell-preview"})),[M,A,x.header]),se=Boolean(J&&X&&J.value!==X.value),ie=x.actionLabel,ue=(0,E.useMemo)((()=>(0,Qe.xx)(h,"sell")),[h]),oe=(0,E.useCallback)((()=>J?X&&se?(0,ka.jsxs)(Tl,{children:[(0,ka.jsx)(Al,{children:0===parseFloat(J?.value)?x.free:b({amount:J,isFiat:!0})}),(0,ka.jsx)(Kl,{...X,amount:X.value})]}):y?(0,ka.jsx)(da.F,{subscriptionFeeBenefit:ue}):b({amount:Y||J,isFiat:!0}):null),[X,J,b,ue,y,se,x.free,Y]),ce=(0,ka.jsx)(G.aR,{label:x.paymentLabel,rightContent:x.paymentValue,rightIcon:o.icon}),de=(0,ka.jsx)(G.hc,{hasPromo:!1,includesTaxes:!1,label:x.priceLabel,rightContent:x.priceValue,onClick:H}),me=(0,ka.jsx)(ka.Fragment,{children:ee?.map(((e,a)=>e?(0,ka.jsx)(G.oO,{label:ne[e.name],rightContent:b({amount:e.amount,isFiat:!0}),onClick:()=>l(e.name),isInfo:!0,testID:"tax"},a):null))}),ge=(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.hc,{includesTaxes:f&&!(ee?.length&&ee?.length>=0),hasPromo:se,rightContent:oe(),onClick:U,testID:"sell-preview"}),me,y&&(0,ka.jsx)(ma.c,{subscriptionFeeBenefit:ue})]}),ye="cashTransfer"===k,fe=ye?x.totalValue:x.cryptoAmount,be=(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.mG,{text:fe,useTicker:!0}),(0,ka.jsx)(G.LZ,{size:"enormous"})]});let Fe=(0,ka.jsxs)(ka.Fragment,{children:[ce,de,(0,ka.jsx)(G.aR,{label:ie,rightContent:x.actionValue}),!S&&ge,S&&(0,ka.jsx)(va,{fees:$,subscriptionFeeBenefit:ue,onGoToFeesInfoStep:_,isCoinbaseOneSubscriber:y}),w&&!S&&(0,ka.jsx)(ze.Z,{handleFreeTradePromoCodeAction:z,fee:h.fee,tradeIncentiveInfo:h.tradeIncentiveInfo}),(0,ka.jsx)(G.aR,{label:x.totalLabel,rightContent:x.totalValue,isLastRow:!0})]});ye&&(Fe=(0,ka.jsx)(ba,{to:h.total.currency,toValue:x.totalValue,from:h.amount.currency,fromValue:x.cryptoAmount,totalValue:x.totalValue,receiptTaxAndFees:ge}));const ve=vl([le,...te]),he=(0,ca.c)({queryRef:s,tradeVolumeValue:h.total.value}),Ce=(0,oa.I)({queryRef:s,subscriptionFeeBenefit:ue,feeValue:J?.value||"0"}),Te=(0,Qe.A1)({viewerRef:s.viewer}),Ae=(0,ra.l)({queryRef:s}),{premiumTierPlan:Ke}=(0,sa.i)(s),xe=(0,E.useMemo)((()=>Ce&&Ke&&J?(0,ka.jsx)(ua.d,{onPress:()=>{c("coinbaseOneChangePlan")},potentialSavings:J,testID:"subscription-trade-upgrade-cell"}):"cell"===he&&J&&!y?(0,ka.jsx)(ia.v,{onPress:()=>{c("coinbaseOneSignup")},fee:J,isEligibleForFreeTrial:Te,formattedFreeTrialLength:Ae,testID:"subscription-trade-signup-cell"}):null),[Ce,Ke,J,he,y,c,Te,Ae]);return(0,ka.jsxs)(G.cp,{"data-element":"PreviewWrapper","data-component":"SellPreviewStepContent",children:[(0,ka.jsxs)(G.zP,{"data-element":"PreviewSection",children:[re,(0,ka.jsxs)(G.jQ,{"data-element":"HorizontalPadding",children:[be,Fe]}),xe,(0,ka.jsx)(G.LZ,{size:"medium","data-element":"Spacer"}),ve&&(0,ka.jsx)(G.vl,{children:ve})]}),(0,ka.jsxs)(G.zP,{"data-element":"PreviewSection",children:[(0,ka.jsx)(G.jQ,{"data-element":"HorizontalPadding",children:(0,ka.jsx)(Ue.Button,{block:!0,loading:A,onPress:j,disabled:A||F||v,testID:"sell-confirm-button","data-testid":"sell-confirm-button","data-element":"Button",children:x.button})}),(0,ka.jsx)(Sa.Z,{queryRef:s,accountRef:i,entryPoint:"sell",assetOrCurrencyRef:u,"data-element":"BuySellFooter"})]})]})}const Tl=(0,j.ZP)(Oe.Z).attrs((()=>({align:"center"}))).withConfig({displayName:"SellPreviewStep__PromoContainer",componentId:"sc-1e8wnre-0"})([""]),Al=j.ZP.div.withConfig({displayName:"SellPreviewStep__PromoAmount",componentId:"sc-1e8wnre-1"})(["color:",";margin-right:8px;"],(({theme:e})=>e.color.textAccent)),Kl=(0,j.ZP)($e.Z).withConfig({displayName:"SellPreviewStep__StrikedFormattedAmount",componentId:"sc-1e8wnre-2"})(["text-decoration:line-through;"]);function xl(e){const a=(0,se.Z)(),n=(0,W.pp)(hl,{nativeCurrency:a,productKey:Qe.sP});return(0,ka.jsx)(Cl,{...e,queryRef:n,"data-element":"SellPreviewStepContent","data-component":"SellPreviewStepContainerDeprecated"})}function wl({preloadedQueryRef:e,...a}){const n=(0,W.Uh)(hl,e);return(0,ka.jsx)(Cl,{...a,queryRef:n,"data-element":"SellPreviewStepContent","data-component":"SellPreviewStepContainer"})}function Bl(e){return aa()?(0,ka.jsx)(wl,{...e}):(0,ka.jsx)(xl,{...e})}var Ll=n(60);var Il=n(82),Pl=n(1420),Rl=n(273),Ml=n(1302);const El=(0,pa.vU)({title:{id:"PaymentMethodsEnforcer.title",defaultMessage:"You're almost ready to buy. Please complete your account."},description:{id:"PaymentMethodsEnforcer.description",defaultMessage:"To make an investment, please add a payment method."},action:{id:"PaymentMethodsEnforcer.action",defaultMessage:"Add a Payment Method"}});function _l({children:e,transferType:a,closeModal:n}){const{formatMessage:l}=(0,ya.Z)(),t=(0,Ia.k6)(),r=(0,Ml.Z)(),{renderTabs:s}=(0,E.useContext)(Rl.xk),i=(0,E.useCallback)((()=>{t.push("/settings/linked-accounts"),n?.()}),[n,t]);return r?(0,ka.jsx)(ka.Fragment,{children:e}):(0,ka.jsxs)(ka.Fragment,{children:[s&&s(),(0,ka.jsx)(Pl.Z,{testID:"payment-methods-missing",isWidget:!0,transferType:a,title:l(El.title),description:l(El.description),heroSquareImage:"bigWarning",action:(0,ka.jsx)(Il.Button,{block:!0,onPress:i,children:l(El.action)})})]})}const Vl={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyStatusStepViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"},{args:null,kind:"FragmentSpread",name:"useBuyStatusViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"BuyUpsellBannerViewerAssetFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"7c1902bc43e600b7bcb65c32f1847b7b"},Dl=Vl,jl={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyStatusStepAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{args:null,kind:"FragmentSpread",name:"useBuyStatusFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"8ff107c70db25e9c848bd4c46e1c9cf2"},Nl=jl,Ol=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},{defaultValue:null,kind:"LocalArgument",name:"productKey"}],a={alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},t=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],r=[{alias:null,args:null,concreteType:"AssetBalanceBreakdown",kind:"LinkedField",name:"assetBalanceBreakdown",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalanceFiat",plural:!1,selections:t,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalance",plural:!1,selections:t,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null},n,{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null}],storageKey:null},n],s={alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},u=[n],o={alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},c={alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanBenefit",kind:"LinkedField",name:"benefits",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"benefitType",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"benefitDetails",plural:!1,selections:[i,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"cryptoBackPercentage",storageKey:null},n],type:"AdvancedTradeBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"limit",plural:!1,selections:t,storageKey:null}],type:"NoTradingFeeCoinbaseSubscriptionBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"apy",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"stakingCap",plural:!1,selections:t,storageKey:null},n],type:"USDCBoostedRewardBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"AtoProtectionBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"BoostedCardRewardsBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"BoostedStakingBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"CointrackerBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"CryptoBackCoinbaseSubscriptionBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"CryptoTaxCalculatorBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"MessariTrialBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"PriorityPhoneSupportBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"SweepstakesBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"TaxCenterBenefitDetails",abstractKey:null}],storageKey:null},n],storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"BuyStatusStepQuery",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"},{args:null,kind:"FragmentSpread",name:"StatusStepFragment"},{args:null,kind:"FragmentSpread",name:"BuyUpsellBannerFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"BuyStatusStepQuery",selections:[{alias:null,args:[{kind:"Variable",name:"baseCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"exchangeRatesV3",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"quoteCurrency",storageKey:null},a],storageKey:null},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProperties",kind:"LinkedField",name:"userProperties",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"nativeCurrency",storageKey:null},{alias:null,args:null,concreteType:"RegionFeatures",kind:"LinkedField",name:"regionFeatures",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"supportsFiatTransfers",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"supportsCryptoToCryptoTransfers",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isInUs",storageKey:null}],storageKey:null},n,{alias:null,args:null,concreteType:"Country",kind:"LinkedField",name:"country",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PersonalDetails",kind:"LinkedField",name:"personalDetails",plural:!1,selections:[{alias:null,args:null,concreteType:"MailingAddress",kind:"LinkedField",name:"address",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"state",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasSsn",storageKey:null}],storageKey:null},{alias:"assets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"tradableAssets",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[a],storageKey:null},n],storageKey:null},n],storageKey:null}],storageKey:null}],storageKey:null},n,{alias:"ethAssetBySymbol",args:[{kind:"Literal",name:"symbol",value:"ETH"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:r,storageKey:'assetBySymbol(symbol:"ETH")'},{alias:"eth2AssetBySymbol",args:[{kind:"Literal",name:"symbol",value:"ETH2"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:r,storageKey:'assetBySymbol(symbol:"ETH2")'},{alias:"eth2ViewerAsset",args:[{kind:"Literal",name:"slug",value:"ethereum-2"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:[{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null},n,{alias:null,args:null,concreteType:"YieldPromotion",kind:"LinkedField",name:"yieldPromotion",plural:!1,selections:[{alias:null,args:null,concreteType:"YieldPromotionAssetCta",kind:"LinkedField",name:"assetCta",plural:!1,selections:[s],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,concreteType:"AccountHistoryEntryConnection",kind:"LinkedField",name:"accountHistoryEntries",plural:!1,selections:[{alias:null,args:null,concreteType:"AccountHistoryEntryEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[i],storageKey:null}],storageKey:null},n],storageKey:null}],storageKey:'assetBySlug(slug:"ethereum-2")'},{alias:"ethViewerAsset",args:[{kind:"Literal",name:"slug",value:"ethereum"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:[{alias:null,args:null,concreteType:"YieldPromotion",kind:"LinkedField",name:"yieldPromotion",plural:!1,selections:[{alias:null,args:null,concreteType:"YieldPromotionAssetCta",kind:"LinkedField",name:"assetCta",plural:!1,selections:[s,{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"cta",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},n],storageKey:'assetBySlug(slug:"ethereum")'},{alias:null,args:null,concreteType:"RecurringTransaction",kind:"LinkedField",name:"recurringTransactions",plural:!0,selections:[{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"account",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[i,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,n],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:u,type:"Node",abstractKey:"__isNode"}],storageKey:null},n],storageKey:null},n],storageKey:null},{alias:null,args:[{kind:"Literal",name:"eligibleEntities",value:["COINBASE_ONE_GENERAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEligible",storageKey:null}],storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["COINBASE_ONE_GENERAL"])'},{alias:null,args:[{kind:"Variable",name:"productKey",variableName:"productKey"}],concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[o,c,n],storageKey:null},n],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"coinbaseSubscriptionPlans",plural:!0,selections:[o,{alias:null,args:null,concreteType:"CoinbaseSubscriptionPromotion",kind:"LinkedField",name:"promotion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"promotionType",storageKey:null},n],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanBillingFrequency",kind:"LinkedField",name:"planBillingFrequency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"unit",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numberOfUnits",storageKey:null}],storageKey:null},c,n],storageKey:null}],storageKey:null}]},params:{id:"40b9670cc5bd84acaeb8f673e399f404c48d00feaf99114064bf02f2c9ae3a07",metadata:{},name:"BuyStatusStepQuery",operationKind:"query",text:null}}}();Ol.hash="5690aa13f07fbdaaff5e308d60d737a4";const Zl=Ol;var Ul=n(505),ql=n(186);const Ql=function(){var e={defaultValue:null,kind:"LocalArgument",name:"accountId"},a={defaultValue:null,kind:"LocalArgument",name:"transferId"},n=[{kind:"Variable",name:"uuid",variableName:"accountId"}],l=[{kind:"Variable",name:"uuid",variableName:"transferId"}],t={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[e,a],kind:"Fragment",metadata:null,name:"useBuyStatusQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[t],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,e],kind:"Operation",name:"useBuyStatusQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[t,r],storageKey:null},r],storageKey:null},r],storageKey:null}]},params:{id:"6060427d3bde90e7e1a889a872886584c931abc5491abc94e23bb660c88c548b",metadata:{},name:"useBuyStatusQuery",operationKind:"query",text:null}}}();Ql.hash="b74ef67cacd58a62026deba60f726454";const Hl=Ql,Wl={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyStatusViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"a7b02266b8b6f9cb1dcf63b3331aeff8"},zl=Wl,Gl={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyStatusFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],type:"Account",abstractKey:null,hash:"6858537843d2c99fe9c41d433bec1341"},Jl=Gl;function $l({accountRef:e,viewerAssetRef:a,transferId:n}){const l=(0,W.Jc)(Jl,e),t=(0,W.Jc)(zl,a),[r,s]=(0,E.useState)(),i=(0,Xa.Z)(),u=(0,an.Z)(),o=(0,E.useCallback)((()=>{i({maxPollAttempts:6,resource:async()=>u(Hl,{transferId:n,accountId:l.uuid??t.asset.platformName}),onResponse:e=>{const a=e.viewer.accountByUuidV2,n=a?.buyByUuid?.status;switch(n){case"COMPLETED":return{type:"Result",result:"completed"};case"CANCELED":return{type:"Result",result:"canceled"};default:return{type:"ContinuePolling"}}},onComplete:e=>{const a="Success"===e.type?"success":"MaxRetries"===e.type?"pending":"failure";switch((0,Q.Kz)("buy_transaction_complete",{action:Q.Us.measurement,componentType:Q.re.page,status:a}),e.type){case"Success":s(e.result);break;case"MaxRetries":s("created");break;default:s("canceled")}}})}),[i,u,n,l.uuid,t.asset.platformName]);return(0,E.useEffect)((()=>{o()}),[]),r}var Yl=n(1502);const Xl=["secure3d_card","worldpay_card","sofort","ideal_bank_account","rtp","apple_pay","google_pay","deneb_upi"];function et(e){return Xl.includes(e)}const at={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyUpsellBannerViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useBuyStatusUpsellViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"fa39263037eed7f62d3c901acaa3f8fd"},nt=at,lt={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyUpsellBannerFragment",selections:[{args:null,kind:"FragmentSpread",name:"useBuyStatusUpsellFragment"}],type:"Query",abstractKey:null,hash:"3b52cd5cd81ff2a7c47025956d36b675"},tt=lt;var rt=n(3681),st=n(3689);const it=(0,E.memo)((function({queryRef:e,viewerAssetRef:a}){const n=(0,W.Jc)(tt,e),l=(0,W.Jc)(nt,a),{isCoinbaseOneSubscriber:t}=(0,pe.f)();return(0,st.Z)({queryRef:n,viewerAssetRef:l,isSubscribedUser:t})}));function ut(e){const a=(0,ge.T)()?null:(0,ka.jsx)(rt.A,{});return(0,ka.jsx)(W.zq,{instrumentationId:"BuyUpsellBanner",fallback:a,"data-element":"InstrumentedSuspense","data-component":"BuyUpsellBanner",children:(0,ka.jsx)(it,{...e,"data-element":"BuyUpsellBannerContent"})})}const ot=(0,E.memo)(ut);var ct=n(950);function dt({accountRef:e,viewerAssetRef:a,closeModal:n,onComplete:l,showStatusHeaderClose:t,assetName:r,isFreeTradePromoCodeEligible:s=!1,recurringPeriod:i}){const{nativeCurrency:u}=(0,ta.Z)(),o=(0,W.pp)(Zl,{nativeCurrency:u,productKey:Qe.sP}),c=(0,W.Jc)(Nl,e),d=(0,W.Jc)(Dl,a);V()(d.asset.uuid,"There should be a selectedAsset for buy status step");const m=(0,Ia.k6)(),g=(0,Ll.Z)(),{goToStep:p}=(0,ae.tC)(ke.Ex),y=(0,Na.Z)(),k=(0,q.$T)(),{trackEvent:f}=(0,Se.Z)(),{endTradePerfMark:b}=(0,ql.Z)(),{eventContext:S,tradeComplete:F,buyCommitResponse:v,transferType:h,buyWaitTimerResponse:C}=(0,N.jf)(ke.cr),T=v.value;V()(T,"There should be a commit response");const A=$l({accountRef:c,viewerAssetRef:d,transferId:T.uuid}),K=(0,Yl.Z)(),x=Boolean(T.commitNotice?.title&&T.commitNotice?.description||T.wblUxData?.title&&T.wblUxData?.description),w=(0,E.useCallback)((e=>{F.onChange(!0),"success"===e&&K()}),[F,K]),B=(0,E.useCallback)((()=>{x&&p("wbl")}),[x,p]),L=(0,E.useCallback)((()=>{n&&n()}),[n]),I=(0,E.useCallback)((()=>{const e=d.asset.slug;g&&"assetPage"===S.value&&e?m.push((0,Ul.pW)(e)):(n&&n(),p("entry"))}),[d.asset,g,S.value,m,n,p]),P=(0,E.useCallback)((()=>{b("status","buy"),et(y.type)?(0,Q.$Y)("loaded_buy_order_confirmation_redirected_temp_eitri_exp"):(0,Q.$Y)("loaded_buy_order_confirmation_temp_eitri_exp")}),[y.type,b]),R=C.value?.viewer.accountByUuidV2?.buyByUuid?.cancelReason?.message,M=(0,E.useMemo)((()=>({status:A,assetName:r,type:h.value,sourceAmount:k({amount:T.amount,isFiat:!1}),sourceCurrency:y.currency,targetCurrency:T.amount.currency,accountId:c.uuid??d.asset.platformName,fiatAccountId:y.fiatAccount?.id,isCommitting:!1,apiError:R,assetId:d.asset.uuid})),[A,r,h.value,k,T.amount,y.currency,y.fiatAccount?.id,c.uuid,d.asset.platformName,d.asset.uuid,R]),_=(0,E.useCallback)((()=>p("entry")),[p]),D=(0,E.useMemo)((()=>(0,ka.jsx)(ot,{queryRef:o,viewerAssetRef:d})),[o,d]),j=(0,E.useMemo)((()=>(0,ka.jsx)(Sa.Z,{queryRef:o,accountRef:c,entryPoint:"unsupported",assetOrCurrencyRef:d})),[d,c,o]);return(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G._,{tradeData:M,showWBL:x,onComplete:l,onContinue:B,onRetry:_,onViewTransaction:L,onClose:I,onAnimationEnd:w,trackEvent:f,footer:j,banner:D,showStatusHeaderClose:t,onViewedStatus:P,isFreeTradePromoCodeEligible:s,queryRef:o,recurringPeriod:i}),(0,ka.jsx)(ct.Z,{tradeType:"buy",assetId:d.asset.uuid,assetSymbol:d.asset.platformName})]})}const mt=(0,E.memo)(dt),gt={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyStatusStepDeprecatedViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"},{args:null,kind:"FragmentSpread",name:"useBuyStatusUpsellViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useBuyStatusViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"9d30b3ba690f7d8ad5cdd47861881cde"},pt=gt,yt={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyStatusStepDeprecatedAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{args:null,kind:"FragmentSpread",name:"useBuyStatusFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"62d66c8607a5fb5be591f903cf931ffd"},kt=yt,ft=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},{defaultValue:null,kind:"LocalArgument",name:"productKey"}],a={alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},t=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],r=[{alias:null,args:null,concreteType:"AssetBalanceBreakdown",kind:"LinkedField",name:"assetBalanceBreakdown",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalanceFiat",plural:!1,selections:t,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalance",plural:!1,selections:t,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null},n,{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null}],storageKey:null},n],s={alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},u=[n],o={alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},c={alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanBenefit",kind:"LinkedField",name:"benefits",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"benefitType",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"benefitDetails",plural:!1,selections:[i,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"cryptoBackPercentage",storageKey:null},n],type:"AdvancedTradeBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"limit",plural:!1,selections:t,storageKey:null}],type:"NoTradingFeeCoinbaseSubscriptionBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"apy",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"stakingCap",plural:!1,selections:t,storageKey:null},n],type:"USDCBoostedRewardBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"AtoProtectionBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"BoostedCardRewardsBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"BoostedStakingBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"CointrackerBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"CryptoBackCoinbaseSubscriptionBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"CryptoTaxCalculatorBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"MessariTrialBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"PriorityPhoneSupportBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"SweepstakesBenefitDetails",abstractKey:null},{kind:"InlineFragment",selections:u,type:"TaxCenterBenefitDetails",abstractKey:null}],storageKey:null},n],storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"BuyStatusStepDeprecatedQuery",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"},{args:null,kind:"FragmentSpread",name:"StatusStepDeprecatedFragment"},{args:null,kind:"FragmentSpread",name:"useBuyStatusUpsellFragment"},{args:null,kind:"FragmentSpread",name:"useFirstStakeIncentiveEligibleFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"BuyStatusStepDeprecatedQuery",selections:[{alias:null,args:[{kind:"Variable",name:"baseCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"exchangeRatesV3",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"quoteCurrency",storageKey:null},a],storageKey:null},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProperties",kind:"LinkedField",name:"userProperties",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"nativeCurrency",storageKey:null},{alias:null,args:null,concreteType:"RegionFeatures",kind:"LinkedField",name:"regionFeatures",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"supportsFiatTransfers",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"supportsCryptoToCryptoTransfers",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isInUs",storageKey:null}],storageKey:null},n,{alias:null,args:null,kind:"ScalarField",name:"hasSsn",storageKey:null},{alias:null,args:null,concreteType:"Country",kind:"LinkedField",name:"country",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PersonalDetails",kind:"LinkedField",name:"personalDetails",plural:!1,selections:[{alias:null,args:null,concreteType:"MailingAddress",kind:"LinkedField",name:"address",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"state",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:"assets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"tradableAssets",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[a],storageKey:null},n],storageKey:null},n],storageKey:null}],storageKey:null}],storageKey:null},n,{alias:"ethAssetBySymbol",args:[{kind:"Literal",name:"symbol",value:"ETH"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:r,storageKey:'assetBySymbol(symbol:"ETH")'},{alias:"eth2AssetBySymbol",args:[{kind:"Literal",name:"symbol",value:"ETH2"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:r,storageKey:'assetBySymbol(symbol:"ETH2")'},{alias:"eth2ViewerAsset",args:[{kind:"Literal",name:"slug",value:"ethereum-2"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:[{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null},n,{alias:null,args:null,concreteType:"YieldPromotion",kind:"LinkedField",name:"yieldPromotion",plural:!1,selections:[{alias:null,args:null,concreteType:"YieldPromotionAssetCta",kind:"LinkedField",name:"assetCta",plural:!1,selections:[s],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,concreteType:"AccountHistoryEntryConnection",kind:"LinkedField",name:"accountHistoryEntries",plural:!1,selections:[{alias:null,args:null,concreteType:"AccountHistoryEntryEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[i],storageKey:null}],storageKey:null},n],storageKey:null}],storageKey:'assetBySlug(slug:"ethereum-2")'},{alias:"ethViewerAsset",args:[{kind:"Literal",name:"slug",value:"ethereum"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:[{alias:null,args:null,concreteType:"YieldPromotion",kind:"LinkedField",name:"yieldPromotion",plural:!1,selections:[{alias:null,args:null,concreteType:"YieldPromotionAssetCta",kind:"LinkedField",name:"assetCta",plural:!1,selections:[s,{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"cta",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},n],storageKey:'assetBySlug(slug:"ethereum")'},{alias:null,args:null,concreteType:"RecurringTransaction",kind:"LinkedField",name:"recurringTransactions",plural:!0,selections:[{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"account",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[i,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,n],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:u,type:"Node",abstractKey:"__isNode"}],storageKey:null},n],storageKey:null},n],storageKey:null},{alias:null,args:[{kind:"Literal",name:"eligibleEntities",value:["COINBASE_ONE_GENERAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEligible",storageKey:null}],storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["COINBASE_ONE_GENERAL"])'},{alias:null,args:[{kind:"Variable",name:"productKey",variableName:"productKey"}],concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[o,c,n],storageKey:null},n],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"coinbaseSubscriptionPlans",plural:!0,selections:[o,{alias:null,args:null,concreteType:"CoinbaseSubscriptionPromotion",kind:"LinkedField",name:"promotion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"promotionType",storageKey:null},n],storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlanBillingFrequency",kind:"LinkedField",name:"planBillingFrequency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"unit",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"numberOfUnits",storageKey:null}],storageKey:null},c,n],storageKey:null}],storageKey:null}]},params:{id:"455a93d232742c61484d12e54a350b06240ff9c0f738ec3780533abf1125e3e4",metadata:{},name:"BuyStatusStepDeprecatedQuery",operationKind:"query",text:null}}}();ft.hash="32fe8f68606afa6516259d3c87447bf2";const bt=ft;var St=n(533),Ft=n(545);function vt({accountRef:e,viewerAssetRef:a,closeModal:n,onComplete:l,showStatusHeaderClose:t,assetName:r,isFreeTradePromoCodeEligible:s=!1,recurringPeriod:i}){const{nativeCurrency:u}=(0,ta.Z)(),o=(0,W.pp)(bt,{nativeCurrency:u,productKey:Qe.sP}),c=(0,W.Jc)(kt,e),d=(0,W.Jc)(pt,a),m=(0,Ia.k6)(),g=(0,Ll.Z)(),{goToStep:p}=(0,ae.tC)(ke.Ex),y=(0,Na.Z)(),k=(0,q.$T)(),{trackEvent:f}=(0,Se.Z)(),{isCoinbaseOneSubscriber:b}=(0,pe.f)(),{endTradePerfMark:S}=(0,ql.Z)(),{eventContext:F,tradeComplete:v,buyCommitResponse:h,transferType:C,buyWaitTimerResponse:T}=(0,N.jf)(ke.cr),A=h.value;V()(A,"There should be a commit response");const K=$l({accountRef:c,viewerAssetRef:d,transferId:A.uuid}),x=(0,St.p)({queryRef:o,assetCode:A.amount.currency,transferType:C.value,status:K}),w=(0,Yl.Z)(),B=Boolean(A.commitNotice?.title&&A.commitNotice?.description||A.wblUxData?.title&&A.wblUxData?.description),L=(0,E.useCallback)((e=>{v.onChange(!0),"success"===e&&w()}),[v,w]),I=(0,E.useCallback)((()=>{B&&p("wbl")}),[B,p]),P=(0,E.useCallback)((()=>{n&&n()}),[n]),R=(0,E.useCallback)((()=>{const e=d.asset.slug;g&&"assetPage"===F.value&&e?m.push((0,Ul.pW)(e)):(n&&n(),p("entry"))}),[d.asset,g,F.value,m,n,p]),M=(0,E.useCallback)((()=>{S("status","buy"),et(y.type)?(0,Q.$Y)("loaded_buy_order_confirmation_redirected"):(0,Q.$Y)("loaded_buy_order_confirmation")}),[y.type,S]),_=(0,st.Z)({queryRef:o,viewerAssetRef:d,isSubscribedUser:b}),D=T.value?.viewer.accountByUuidV2?.buyByUuid?.cancelReason?.message,j=(0,E.useMemo)((()=>({status:K,assetName:r,type:C.value,sourceAmount:k({amount:A.amount,isFiat:!1}),sourceCurrency:y.currency,targetCurrency:A.amount.currency,accountId:c?.uuid??d.asset.platformName,fiatAccountId:y.fiatAccount?.id,isCommitting:!1,apiError:D,assetId:d.asset.uuid})),[K,r,C.value,k,A.amount,y.currency,y.fiatAccount?.id,c?.uuid,d.asset.platformName,d.asset.uuid,D]);return(0,Ft.e)("COMPLETE_ASSET_BUY","buy",{uuid:d.asset.uuid,symbol:d.asset.platformName}),(0,ka.jsx)(G.kU,{tradeData:j,showWBL:B,onComplete:l,onContinue:I,onRetry:()=>p("entry"),onViewTransaction:P,onClose:R,onAnimationEnd:L,trackEvent:f,footer:(0,ka.jsx)(Sa.Z,{queryRef:o,accountRef:c,entryPoint:"unsupported",assetOrCurrencyRef:d}),banner:_,showStatusHeaderClose:t,onViewedStatus:M,isFirstStakeIncentiveEligible:x,isFreeTradePromoCodeEligible:s,queryRef:o,recurringPeriod:i,"data-element":"SharedStatusStep","data-component":"BuyStatusStepDeprecated"})}const ht=(0,E.memo)(vt),Ct=function(){var e={defaultValue:null,kind:"LocalArgument",name:"accountId"},a={defaultValue:null,kind:"LocalArgument",name:"transferId"},n=[{kind:"Variable",name:"uuid",variableName:"accountId"}],l=[{kind:"Variable",name:"uuid",variableName:"transferId"}],t={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},r={alias:null,args:null,concreteType:"TransferCancelReason",kind:"LinkedField",name:"cancelReason",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[e,a],kind:"Fragment",metadata:null,name:"BuyWaitTimerStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[t,r],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,e],kind:"Operation",name:"BuyWaitTimerStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[t,r,s],storageKey:null},s],storageKey:null},s],storageKey:null}]},params:{id:"943f526c6d6f048fc764127e44413259209e12be21184dcfb09dd9706ee464e3",metadata:{},name:"BuyWaitTimerStepQuery",operationKind:"query",text:null}}}();Ct.hash="844983cbfea86ed78174479513369a42";const Tt=Ct,At={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyWaitTimerStepAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],type:"Account",abstractKey:null,hash:"887f86bfc67d4002d94820e4669d6c27"},Kt=At;var xt=n(61),wt=n(3626),Bt=n(64);function Lt({icon:e,message:a}){return(0,ka.jsxs)(qe.HStack,{alignItems:"center",alignContent:"flex-start",spacingBottom:2,"data-element":"HStack","data-component":"BuyWaitTodoItem",children:[(0,ka.jsx)(qe.Box,{minHeight:32,minWidth:32,background:"backgroundAlternate",borderRadius:"roundedFull",alignItems:"center",justifyContent:"center",alignContent:"center","data-element":"Box",children:(0,ka.jsx)(Bt.Icon,{name:e,size:"xs",color:"foregroundMuted","data-element":"Icon"})}),(0,ka.jsx)(qe.Box,{width:14,"data-element":"Box"}),(0,ka.jsx)(_n.TextLabel2,{as:"p","data-element":"TextLabel2",children:a})]})}const It=(0,E.memo)(Lt);var Pt=n(1546);const Rt=(0,pa.vU)({titleUPIOpenApp:{id:"TransferStatusWaiting.titleUPIOpenApp",defaultMessage:"Complete your payment"},chekUPIApp:{id:"TransferStatusWaiting.chekUPIApp",defaultMessage:"Check your UPI application."},pendingTransaction:{id:"TransferStatusWaiting.pendingTransaction",defaultMessage:"Look at pending transactions"},upiPin:{id:"TransferStatusWaiting.upiPin",defaultMessage:"Enter UPI pin to complete payment"}});function Mt({accountRef:e}){const a=(0,W.Jc)(Kt,e),[n,l]=(0,E.useState)(!1),{formatMessage:t}=(0,ya.Z)(),{buyCommitResponse:r,buyWaitTimerResponse:s}=(0,N.jf)(ke.cr),{goToStep:i}=(0,ae.tC)(ke.Ex),u=(0,an.Z)(),o=(0,E.useCallback)((0,D.throttle)((async()=>{if(!n){l(!0);const e=r?.value?.uuid;if(e)try{const n=await u(Tt,{transferId:e,accountId:a.uuid}),l=n.viewer.accountByUuidV2,t=l?.buyByUuid?.status;("COMPLETED"===t||"CANCELED"===t)&&(i("buyStatus"),s.onChange(n))}catch(e){(0,q.cB)((0,Ra.Xv)(e),{owner:"trading",context:"buy_sell"})}}}),5e3),[]),{timeRemaining:c}=(0,wt.J)({duration:45e4,onStep:o,onTimerEnd:()=>{za.ZP.track("buy_waiting_timer_end",{action:Q.Us.unknown,componentType:Q.re.unknown}),i("buyStatus")}});return(0,ka.jsxs)(En.VStack,{flexGrow:1,width:"100%","data-element":"VStack","data-component":"BuyWaitTimerStep",children:[(0,ka.jsx)(qe.Box,{spacingTop:5,width:"100%",justifyContent:"center","data-element":"Box",children:(0,ka.jsx)(xt.HeroSquare,{name:"buyFirstCrypto",testID:"waiting-illustration","data-element":"HeroSquare"})}),(0,ka.jsxs)(En.VStack,{alignContent:"flex-start",alignSelf:"center",spacingStart:9,spacingEnd:6,"data-element":"VStack",children:[(0,ka.jsx)(_n.TextTitle3,{as:"h3",spacingTop:4,spacingBottom:2,align:"start","data-element":"TextTitle3",children:t(Rt.titleUPIOpenApp)}),(0,ka.jsx)(It,{icon:"externalLink",message:t(Rt.chekUPIApp),"data-element":"BuyWaitTodoItem"}),(0,ka.jsx)(It,{icon:"pay",message:t(Rt.pendingTransaction),"data-element":"BuyWaitTodoItem"}),(0,ka.jsx)(It,{icon:"statusDot",message:t(Rt.upiPin),"data-element":"BuyWaitTodoItem"})]}),(0,ka.jsx)(Pt.Z,{timeRemaining:c,testID:"time-remaining-counter","data-element":"TimeRemaining"})]})}const Et=(0,E.memo)(Mt),_t=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"resource",storageKey:null},r=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],s={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:r,storageKey:null},i={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:r,storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"recurringPayment",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null}],c={alias:null,args:null,concreteType:"CommitNoticeData",kind:"LinkedField",name:"commitNotice",plural:!1,selections:o,storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"cardStatus",storageKey:null},m={alias:null,args:null,concreteType:"TransferWblUxData",kind:"LinkedField",name:"wblUxData",plural:!1,selections:o,storageKey:null},g={alias:null,args:null,concreteType:"TransferNextStep",kind:"LinkedField",name:"nextStep",plural:!1,selections:[{alias:"action",args:null,kind:"ScalarField",name:"Action",storageKey:null},{alias:"maxPollAttempts",args:null,kind:"ScalarField",name:"MaxPollAttempts",storageKey:null},{alias:"pollIntervalMs",args:null,kind:"ScalarField",name:"PollIntervalInMs",storageKey:null}],storageKey:null},p={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null}],type:"GenericError",abstractKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"use3dsBuyCompleterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"completeSecure3DBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"commitBuyFragment",selections:[l,t,s,i,u,c,d,m,g],args:null,argumentDefinitions:[]}],storageKey:null}],type:"CompleteSecure3DBuySuccess",abstractKey:null},p],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"use3dsBuyCompleterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"completeSecure3DBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[l,t,s,i,u,c,d,m,g,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}],type:"CompleteSecure3DBuySuccess",abstractKey:null},p],storageKey:null}]},params:{id:"3aaf49724baaf29e0c0cf009e499bb3d167470dc9a0abc0695d4c1700a006d03",metadata:{},name:"use3dsBuyCompleterMutation",operationKind:"mutation",text:null}}}();_t.hash="80eabc320af9f4e9b1854a75a4cad668";const Vt=_t;function Dt(){return(0,E.useCallback)((e=>{za.ZP.track(e,{action:Q.Us.unknown,componentType:Q.re.unknown})}),[])}function jt(){const{assetId:e,buyCommitResponse:a}=(0,N.jf)(ke.cr),{goToStep:n}=(0,ae.tC)(ke.Ex),l=Dt(),t=function(){const e=Dt(),{formatMessage:a}=(0,ya.Z)(),[n]=(0,W.Db)(Vt);return(0,E.useCallback)((({accountId:l,transferId:t,pares:r,onCompleted:s,onError:i})=>{e("three_ds_commit_start"),n({variables:{input:{accountUuid:l,transferBuyUuid:t,redirectParams:r}},onCompleted:({response:e})=>{const a=e.completeSecure3DBuy;switch(a?.__typename){case"CompleteSecure3DBuySuccess":return s(a.transferBuy);case"GenericError":{const e=new Error("Commit buy request failed");return e.cause=a.message,(0,q.cB)(e,{owner:"trading",context:"buy_sell"}),i(a.message)}default:(0,q.cB)(new Error("Unexpected typename returned"),{owner:"trading",context:"buy_sell",typename:a?.__typename})}},onError:()=>i(a(Ma.s.commitError))})}),[n,a,e])}(),{showErrorToast:r}=(0,Va.Z)(),s=(0,E.useCallback)((e=>{const l=(0,W.fR)(ja,e);return a.onChange(l),n("buyStatus")}),[a,n]);return(0,E.useEffect)((()=>(l("three_ds_page_loaded"),()=>(0,Ja.uY)())),[]),(0,E.useEffect)((()=>{l("three_ds_verification_completed");const a=(0,Ja.kI)();if(!a)throw l("three_ds_local_storage_missing_data"),new Error("missing local3dsData");const{transferData:n,accountId:i,pares:u}=a;e.onChange(n.assetId),t({accountId:i,transferId:n.id,pares:u,onCompleted:s,onError:e=>r(e)})}),[]),null}const Nt=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"accountId"},{defaultValue:null,kind:"LocalArgument",name:"transferId"}],a=[{kind:"Variable",name:"uuid",variableName:"accountId"}],n=[{kind:"Variable",name:"uuid",variableName:"transferId"}],l={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"resource",storageKey:null},r=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],s={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:r,storageKey:null},i={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:r,storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"recurringPayment",storageKey:null},o=[{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null}],c={alias:null,args:null,concreteType:"CommitNoticeData",kind:"LinkedField",name:"commitNotice",plural:!1,selections:o,storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"cardStatus",storageKey:null},m={alias:null,args:null,concreteType:"TransferWblUxData",kind:"LinkedField",name:"wblUxData",plural:!1,selections:o,storageKey:null},g={alias:null,args:null,concreteType:"TransferNextStep",kind:"LinkedField",name:"nextStep",plural:!1,selections:[{alias:"action",args:null,kind:"ScalarField",name:"Action",storageKey:null},{alias:"maxPollAttempts",args:null,kind:"ScalarField",name:"MaxPollAttempts",storageKey:null},{alias:"pollIntervalMs",args:null,kind:"ScalarField",name:"PollIntervalInMs",storageKey:null}],storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"ConfirmBuyStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:n,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[{kind:"InlineDataFragmentSpread",name:"commitBuyFragment",selections:[l,t,s,i,u,c,d,m,g],args:null,argumentDefinitions:[]}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"ConfirmBuyStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:n,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[l,t,s,i,u,c,d,m,g,p],storageKey:null},p],storageKey:null},p],storageKey:null}]},params:{id:"d01307d8756ac0475f57977ed09cf3069c7dd2b0b5176a0ae387871b3324179b",metadata:{},name:"ConfirmBuyStepQuery",operationKind:"query",text:null}}}();Nt.hash="a1e906b3948b67cd617b65c34b89a67f";const Ot=Nt,Zt=(0,pa.vU)({errorHeader:{id:"ConfirmBuyErrorScreen.errorHeader",defaultMessage:"Connection trouble"},errorBody:{id:"ConfirmBuyErrorScreen.errorBody",defaultMessage:"We were unable to get the status of your purchase. Please check your email for updates on whether your purchase was completed."},done:{id:"ConfirmBuyErrorScreen.done",defaultMessage:"Done"}});function Ut({closeModal:e}){const{formatMessage:a}=(0,ya.Z)();return(0,ka.jsx)(qe.Box,{height:"100%",testID:"confirm-buy-error-screen","data-element":"Box","data-component":"ErrorScreen",children:(0,ka.jsxs)(qe.VStack,{spacing:2,alignItems:"center",height:"100%","data-element":"VStack",children:[(0,ka.jsxs)(qe.VStack,{alignItems:"center",flexGrow:1,justifyContent:"center","data-element":"VStack",children:[(0,ka.jsx)(xt.Pictogram,{name:"warning",scaleMultiplier:2,"data-element":"Pictogram"}),(0,ka.jsx)(_n.TextTitle3,{as:"h3",spacing:2,"data-element":"TextTitle3",children:a(Zt.errorHeader)}),(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",align:"center","data-element":"TextBody",children:a(Zt.errorBody)})]}),(0,ka.jsx)(Ue.Button,{block:!0,variant:"secondary",onPress:e,"data-element":"Button",children:a(Zt.done)})]})})}function qt({accountId:e,buyId:a}){const{viewer:n}=(0,W.pp)(Ot,{accountId:e??"",transferId:a??""}),{buyCommitResponse:l}=(0,N.jf)(ke.cr),{goToStep:t}=(0,ae.tC)(ke.Ex);return(0,E.useEffect)((()=>{const r=n.accountByUuidV2;if(!r?.buyByUuid||!e||!a)throw new Error("Missing dependencies to going to buyStatus step");const s=r.buyByUuid,i=(0,W.fR)(ja,s);l.onChange(i),t("buyStatus")}),[]),null}function Qt({accountId:e,buyId:a,closeModal:n}){return(0,ka.jsx)(q.SV,{owner:"trading",skipErrorLogging:!0,onCatch:n=>{const l=new Error("Error fetching buy transaction status after external redirect");l.cause=n,(0,q.cB)(l,{owner:"trading",accountId:e,buyId:a,context:"buy_sell"})},fallback:()=>(0,ka.jsx)(Ut,{closeModal:n}),context:"buy_sell","data-element":"ErrorBoundary","data-component":"ConfirmBuyStepContainer",children:(0,ka.jsx)(qt,{accountId:e,buyId:a,"data-element":"ConfirmBuyStepContent"})})}var Ht=n(1372);const Wt=(0,pa.vU)({backToOrderPreview:{id:"BuySellStepper.DisclosuresStep.backToOrderPreview",defaultMessage:"Back to order preview"}});const zt=function(){const{formatMessage:e}=(0,ya.Z)(),{goBack:a}=(0,ae.tC)(ke.Ex),{buyQuoteResponse:n}=(0,N.jf)(ke.cr),l=(n.value?.userWarnings??[]).find((e=>"buy_trade_disclosure"===e.code));return(0,E.useEffect)((()=>{l?.context||a()}),[l]),l?.context?(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.h4,{goBack:a,title:l.context.title}),(0,ka.jsxs)(G.RF,{paddingBottom:24,align:"flex-start",children:[(0,ka.jsx)(En.VStack,{flexGrow:1,flexShrink:1,flexBasis:"auto",children:l.context.details.map((e=>(0,ka.jsx)(Ht.u,{color:"light",paddingBottom:"md",children:e})))}),(0,ka.jsx)(Il.Button,{block:!0,onPress:a,variant:"secondary",children:e(Wt.backToOrderPreview)})]})]}):null};var Gt=n(1307),Jt=n(952),$t=n(337),Yt=n(95),Xt=n(1522),er=n(521);const ar=(0,pa.vU)({ctaLabel:{id:"FreeTradePromoCodeInfoStep.ctaLabel",defaultMessage:"Got it"}});function nr({promoCodeTrayMsg:e}){const{goBack:a}=(0,ae.tC)(ke.Ex),{freeTradePromoCode:n}=(0,N.jf)(ke.cr),{formatMessage:l}=(0,ya.Z)(),t=(0,E.useCallback)((()=>{(0,Xt.sQ)(n.value)}),[n.value]),r=(0,ka.jsxs)(Yt.TextBody,{as:"p",color:"foregroundMuted",children:[`${n.value} ${e.trayMsg} `,(0,ka.jsx)($t.Link,{href:e.termsUrl,color:"primary",onClick:t,openInNewWindow:!0,children:e.termsText})]});return(0,ka.jsx)(er.Z,{onBackPress:a,message:r,headerTitle:e.trayTitle,ctaText:l(ar.ctaLabel),"data-element":"InfoStep","data-component":"FreeTradePromoCodeInfoStep"})}const lr=(0,E.memo)(nr),tr={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"AddCashStepFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"fiatAccounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],type:"TiersCurrency",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"d424115dc933671002a1551f895b1196"},rr=tr;var sr=n(791),ir=n(953);function ur({queryRef:e}){const{viewer:a}=(0,W.Jc)(rr,e),{goToStep:n}=(0,ae.tC)(ke.Ex),{depositRequirements:l}=(0,N.jf)(ke.cr),{trackEvent:t}=(0,Se.Z)(),r=(0,E.useMemo)((()=>(a.fiatAccounts||[]).find((e=>"TiersCurrency"===e?.assetOrFiatCurrency?.__typename&&"USD"===e.assetOrFiatCurrency.code))),[a.fiatAccounts]),s=(0,E.useCallback)((()=>n("limitOrderEntry")),[n]),i=(0,E.useCallback)((()=>n("limitOrderPreview")),[n]);return(0,E.useEffect)((()=>{r&&t("deposit_viewed",{action:Q.Us.render,componentType:Q.re.modal})}),[]),r?(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(sr.Z,{goBack:s,backIconPosition:"right",backIcon:"close"}),(0,ka.jsx)(qe.Box,{spacingBottom:2,children:(0,ka.jsx)(ir.DepositFiatModalContent,{accountUuid:r.uuid,accountCurrencyCode:"USD",close:s,entryPoint:"limitOrderAddCash",suggestedAmount:l.value||10,onSuccess:i})})]}):null}const or=(0,E.memo)(ur),cr=(0,pa.vU)({orderPlaced:{id:"LimitOrderConfirmationScreen.orderPlaced",defaultMessage:"Order placed!"},viewOrder:{id:"LimitOrderConfirmationScreen.viewOrder",defaultMessage:"View and manage your order on the {asset} page."},orderDetails:{id:"LimitOrderConfirmationScreen.orderDetails",defaultMessage:"{amount} of your USD balance will be placed on hold to fill this order. The hold will be released if you cancel."},subscriptionBenefit:{id:"LimitOrderConfirmationScreen.subscriptionBenefit",defaultMessage:"{amount} saved with CoinbaseOne"},done:{id:"LimitOrderConfirmationScreen.done",defaultMessage:"Done"}});function dr({closeModal:e}){const{formatMessage:a,formatNumber:n}=(0,ya.Z)(),{createLimitOrderResponse:l}=(0,N.jf)(ke.cr),{goToStep:t}=(0,ae.tC)(ke.Ex),r=l.value?.limitOrder,s=(0,E.useCallback)((()=>{e?e():t("limitOrderEntry")}),[e,t]);return(0,ka.jsxs)(qe.VStack,{alignItems:"center",spacing:3,"data-element":"VStack","data-component":"LimitOrderConfirmationStep",children:[(0,ka.jsx)(qe.Box,{spacingTop:5,"data-element":"Box",children:(0,ka.jsx)(xt.SpotSquare,{name:"nuxRecurringBuys","data-element":"SpotSquare"})}),(0,ka.jsx)(_n.TextTitle3,{as:"p",spacingBottom:1,spacingTop:2,"data-element":"TextTitle3",children:a(cr.orderPlaced)}),(0,ka.jsx)(qe.Box,{spacingHorizontal:.5,"data-element":"Box",children:(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",align:"center","data-element":"TextBody",children:a(cr.viewOrder,{asset:r?.amount?.currency})})}),(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",align:"center",spacingTop:2,"data-element":"TextBody",children:a(cr.orderDetails,{amount:n(Number(r?.total?.value),{style:"currency",currency:r?.total?.currency})})}),(0,ka.jsx)(qe.HStack,{alignItems:"center",spacingTop:3,spacingBottom:6,"data-element":"HStack",children:"0"===r?.fee?.value?(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(xt.SpotRectangle,{name:"coinbaseOneLogo",scaleMultiplier:.12,testID:"subscription-fee-logo"}),(0,ka.jsx)(_n.TextLabel2,{as:"p",color:"foregroundMuted",children:a(cr.subscriptionBenefit,{amount:n(Number(r?.feeWithoutSubscriptionBenefit?.value),{style:"currency",currency:r?.feeWithoutSubscriptionBenefit?.currency})})})]}):null}),(0,ka.jsx)(Ue.Button,{onPress:s,variant:"secondary",block:!0,"data-element":"Button",children:a(cr.done)})]})}const mr=(0,E.memo)(dr),gr={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderPreviewStepViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useConvertIncrementToPrecisionFragment"},{args:null,kind:"FragmentSpread",name:"useAvailableBalanceForAssetViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"DepositingFundsCheckViewerAssetFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"6764bde798c1c0943c14282d85b2f3af"},pr=gr,yr={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderPreviewStepContentFragment",selections:[{args:null,kind:"FragmentSpread",name:"DepositingFundsCheckFragment"}],type:"Query",abstractKey:null,hash:"a1721a01b8a0010b86e1185ba6467437"},kr=yr;var fr=n(781),br=n(55),Sr=n(1386),Fr=n(490),vr=n(3572),hr=n(2413),Cr=n(3656),Tr=n(870);const Ar=function(){var e={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},a=[e,{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}];return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSimpleTradeLimitOrderBenefitFromQuoteFragment",selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:a,storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"appliedSubscriptionBenefit",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:a,storageKey:null},{alias:null,args:null,concreteType:"SubscriptionInfo",kind:"LinkedField",name:"subscriptionInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasBenefitCap",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"freeTradingResetDate",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"remainingFreeTradingVolume",plural:!1,selections:[e],storageKey:null}],storageKey:null}],type:"LimitOrder",abstractKey:null}}();Ar.hash="e053129e7698b70628eab8b2bc8929c7";const Kr=Ar;const xr=function(){var e={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DepositingFundsCheckQuery",selections:[{args:null,kind:"FragmentSpread",name:"useHasEnoughBalanceFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DepositingFundsCheckQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"fiatAccount",args:[{kind:"Literal",name:"uuid",value:"USD"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null},e],storageKey:'accountByUuidV2(uuid:"USD")'},e],storageKey:null}]},params:{id:"fcdde8d902fe8e44d021aa958cf054ca6b5cb0cfdc2af4abe4bb944e4c81b47e",metadata:{},name:"DepositingFundsCheckQuery",operationKind:"query",text:null}}}();xr.hash="fc3955c70c4bef9e54da9bcfed0cced6";const wr=xr,Br={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DepositingFundsCheckViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useHandleCreateLimitOrderViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"1a156b43f93e917e945dcaf33a3eb917"},Lr=Br,Ir={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DepositingFundsCheckFragment",selections:[{args:null,kind:"FragmentSpread",name:"useHandleCreateLimitOrderFragment"},{args:null,kind:"FragmentSpread",name:"useHasEnoughBalanceFragment"}],type:"Query",abstractKey:null,hash:"1c6db0f8b45018013fe58be86c7c42aa"},Pr=Ir,Rr=function(){var e={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useHandleCreateLimitOrderViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useConvertIncrementToPrecisionFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[e,{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[e,{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null}}();Rr.hash="f1763110c5f03122f0ecfedd4aa83271";const Mr=Rr,Er={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useHandleCreateLimitOrderFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"fiatAccount",args:[{kind:"Literal",name:"uuid",value:"USD"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:'accountByUuidV2(uuid:"USD")'}],storageKey:null}],type:"Query",abstractKey:null,hash:"11d088dfb51f6b941097915a77668549"},_r=Er;function Vr(e,a){const n=10**a;return Math.trunc(e*n)/n}function Dr({amount:e,to:a,target:n}){return String("crpyto"===a?Number(e)/Number(n):Number(e)*Number(n))}const jr=.03,Nr=({amountToBuyInUsd:e,balance:a,fee:n})=>{var l;const t=e+(n?(l=n,Math.ceil(100*l)/100):jr*e)-a;return t>0?t<10?10:t:0};const Or=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"success",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},o=[u,{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],c={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:o,storageKey:null},d={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:o,storageKey:null},m={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:o,storageKey:null},g={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:o,storageKey:null},p={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:o,storageKey:null},y={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"unitPrice",plural:!1,selections:[c,{alias:null,args:null,kind:"ScalarField",name:"scale",storageKey:null}],storageKey:null},k={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"paymentMethodFee",plural:!1,selections:o,storageKey:null},f={alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[s,t,l,{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarningContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"linkText",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"details",storageKey:null}],storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useCreateLimitOrderMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createLimitOrder",plural:!1,selections:[{kind:"InlineFragment",selections:[n,l,t],type:"GenericError",abstractKey:null},{kind:"InlineFragment",selections:[n,r,{alias:null,args:null,concreteType:"LimitOrder",kind:"LinkedField",name:"limitOrder",plural:!1,selections:[s,i,{args:null,kind:"FragmentSpread",name:"useSimpleTradeLimitOrderBenefitFromQuoteFragment"},c,d,m,g,p,y,k],storageKey:null},f],type:"CreateLimitOrderSuccess",abstractKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useCreateLimitOrderMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createLimitOrder",plural:!1,selections:[n,{kind:"InlineFragment",selections:[l,t],type:"GenericError",abstractKey:null},{kind:"InlineFragment",selections:[r,{alias:null,args:null,concreteType:"LimitOrder",kind:"LinkedField",name:"limitOrder",plural:!1,selections:[s,i,d,{alias:null,args:null,kind:"ScalarField",name:"appliedSubscriptionBenefit",storageKey:null},p,{alias:null,args:null,concreteType:"SubscriptionInfo",kind:"LinkedField",name:"subscriptionInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasBenefitCap",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"freeTradingResetDate",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"remainingFreeTradingVolume",plural:!1,selections:[u],storageKey:null}],storageKey:null},c,m,g,y,k],storageKey:null},f],type:"CreateLimitOrderSuccess",abstractKey:null}],storageKey:null}]},params:{id:"61b1956f909e7054dbf5dc5092dda9a7b56f1469eba48f82c59989baf1dcd3ec",metadata:{},name:"useCreateLimitOrderMutation",operationKind:"mutation",text:null}}}();Or.hash="1b22b04d767479c14a042bd6b9b935c9";const Zr=Or;function Ur({queryRef:e,viewerAssetRef:a,operation:n,inputAmount:l,inputUnit:t,targetAmount:r}){const s=(0,W.Jc)(_r,e),i=(0,W.Jc)(Mr,a),u=i?.asset,{fiatPrecision:o,cryptoPrecision:c}=(0,Tr.h)(i),d=(0,E.useMemo)((()=>i?.accounts?.find((e=>e?.primary))?.uuid??""),[i?.accounts]),m=s.viewer?.fiatAccount,g=m?.uuid??"",p="buy"===n,y=p?g:d,k=p?d:g,[f,b]=function(){const[e,a]=(0,W.Db)(Zr);return[(0,E.useCallback)((async a=>new Promise(((n,l)=>{e({variables:{input:a},onError:({alreadyReportedError:e})=>{l(e)},onCompleted:({response:e})=>{n(e.createLimitOrder)}})}))),[e]),a]}(),S=(0,E.useMemo)((()=>{const e=String(Number(l)),a="FIAT"===t?Number(e)/Number(r):e;return String(Vr(Number(a),c))}),[l,t,r,c]),F=(0,E.useMemo)((()=>({amount:{value:S,currency:u?.platformName??"BTC"},price:{value:String(Vr(Number(r),o)),currency:"USD"},sourceUuid:y,targetUuid:k,orderSide:n.toUpperCase()})),[o,S,u?.platformName,y,k,n,r]);return{isCreatingLimitOrder:b,handlePreviewBuy:(0,E.useCallback)((async()=>{try{return await f(F)}catch(e){(0,q.cB)((0,Ra.Xv)(e),{owner:"simple-trade",context:"limit-order"})}}),[f,F]),inputParams:F,cryptoAccountUuid:d}}function qr(){return(0,Te.y)("kill_simple_trade_limit_order_fund_flow_web")}var Qr=n(1612);const Hr={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useHasEnoughBalanceFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"fiatAccount",args:[{kind:"Literal",name:"uuid",value:"USD"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:'accountByUuidV2(uuid:"USD")'}],storageKey:null}],type:"Query",abstractKey:null,hash:"ef85458c5c0b83d63aa47c7126ff6dac"},Wr=Hr;const zr=(0,pa.vU)({checkingBalances:{id:"LimitOrderDepositingFundsCheck.depositingFunds",defaultMessage:"Checking balances"}}),Gr=(0,E.memo)((function({queryRef:e,viewerAssetRef:a,children:n}){const{createLimitOrderResponse:l,inputCryptoAmount:t,targetPrice:r,transferType:s,depositRequirements:i}=(0,N.jf)(ke.cr),{formatMessage:u}=(0,ya.Z)(),o=l.value?.limitOrder?.total?.value,c=l.value?.limitOrder?.fee?.value,d=(0,W.Jc)(Pr,e),m=(0,W.Jc)(Lr,a),[,g]=(0,W.un)(wr),{handlePreviewBuy:p}=Ur({queryRef:d,viewerAssetRef:m,operation:"buy",inputAmount:t.value,inputUnit:"CRYPTO",targetAmount:r.value}),y=function({queryRef:e,fee:a,buyAmount:n}){const l=(0,W.Jc)(Wr,e);return(Number(l.viewer.fiatAccount?.availableBalance.value)||0)-Number(n)-Number(a)>0}({queryRef:d,fee:c,buyAmount:o}),k=(0,E.useCallback)((async()=>{const e=await p();e instanceof Error||"GenericError"===e?.__typename||"CreateLimitOrderSuccess"===e?.__typename&&l.onChange(e)}),[l,p]),f="buy"===s.value;!function(e,a){const n=(0,E.useRef)(void 0);a!==n.current&&(e(n.current),n.current=a)}((e=>{f&&!e&&y&&k()}),y);const b=qr();return(0,E.useEffect)((()=>{if(!f||y||!i||b)return()=>{};const e=setInterval((()=>{y||g({},{fetchPolicy:"network-only"})}),1e3);return()=>clearInterval(e)}),[f,g,y]),!f||y||!i||b?(0,ka.jsx)(ka.Fragment,{children:n}):(0,ka.jsx)(Qr.f,{spacingTop:3,title:u(zr.checkingBalances)})}));var Jr=n(507);const $r=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},u=[s,i],o={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:u,storageKey:null},c={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:u,storageKey:null},d={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:[i,s],storageKey:null},m={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"unitPrice",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:[s],storageKey:null}],storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useCommitLimitOrderMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"commitLimitOrder",plural:!1,selections:[{kind:"InlineFragment",selections:[n,l,t],type:"GenericError",abstractKey:null},{kind:"InlineFragment",selections:[n,{alias:null,args:null,concreteType:"LimitOrder",kind:"LinkedField",name:"limitOrder",plural:!1,selections:[r,{alias:null,args:null,concreteType:"BrokerageOrder",kind:"LinkedField",name:"brokerageOrder",plural:!1,selections:[r],storageKey:null},o,c,d,m],storageKey:null}],type:"CommitLimitOrderSuccess",abstractKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useCommitLimitOrderMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"commitLimitOrder",plural:!1,selections:[n,{kind:"InlineFragment",selections:[l,t],type:"GenericError",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"LimitOrder",kind:"LinkedField",name:"limitOrder",plural:!1,selections:[r,{alias:null,args:null,concreteType:"BrokerageOrder",kind:"LinkedField",name:"brokerageOrder",plural:!1,selections:[r,g],storageKey:null},o,c,d,m,g],storageKey:null}],type:"CommitLimitOrderSuccess",abstractKey:null}],storageKey:null}]},params:{id:"b6e836ec8ace224dee7b1180d91875374fd297c6501c7eb8f12e778a0aa0de16",metadata:{},name:"useCommitLimitOrderMutation",operationKind:"mutation",text:null}}}();$r.hash="d59b7f5f1b52bb0486d0258dd606e191";const Yr=$r;const Xr=(0,pa.vU)({placeOrderTitle:{id:"LimitOrderCommitOrderButton.placeOrderTitle",defaultMessage:"Place order"},error:{id:"LimitOrderCommitOrderButton.error",defaultMessage:"Something unexpected happened."}}),es=(0,E.memo)((function({uuid:e,onPress:a,onSuccess:n,onError:l}){const{formatMessage:t}=(0,ya.Z)(),[r,s]=function(){const[e,a]=(0,W.Db)(Yr);return[(0,E.useCallback)((async a=>new Promise(((n,l)=>{e({variables:{input:a},onError:e=>{l(e)},onCompleted:({response:e})=>{n(e)}})}))),[e]),a]}(),{trackEvent:i}=(0,Se.Z)(),u=(0,E.useCallback)((async()=>{a?.();try{const a={tradeUuid:e},t=await r(a);if("GenericError"===t.commitLimitOrder?.__typename){const e=t.commitLimitOrder.message;return void l(e)}if("CommitLimitOrderSuccess"===t.commitLimitOrder?.__typename)return void n()}catch(e){(0,Jr.ZP)(e,{owner:"simple-trade",context:"limit-order-commit"})}}),[a,e,r,l,n]),o=(0,E.useCallback)((()=>{i("tapped_confirm_button",{action:Q.Us.click,componentType:Q.re.button}),u()}),[u,i]);return(0,ka.jsx)(Il.Button,{onPress:o,loading:s,block:!0,children:t(Xr.placeOrderTitle)})})),as=(0,pa.vU)({header:{id:"LimitOrderPreviewScreen.header",defaultMessage:"Order preview"},review:{id:"LimitOrderPreviewScreen.review",defaultMessage:"Review order"},placeOrder:{id:"LimitOrderPreviewScreen.placeOrder",defaultMessage:"Place Order"},buyHeader:{id:"LimitOrderPreviewScreen.buyHeader",defaultMessage:"Buy {amount}"},sellHeader:{id:"LimitOrderPreviewScreen.sellHeader",defaultMessage:"Sell {amount}"},paymentMethodTitle:{id:"LimitOrderPreviewScreen.paymentMethodTitle",defaultMessage:"Pay with"},depositToTitle:{id:"LimitOrderPreviewScreen.depositToTitle",defaultMessage:"Deposit to"},paymentMethodDetail:{id:"LimitOrderPreviewScreen.paymentMethodDetail",defaultMessage:"USD balance"},targetPrice:{id:"LimitOrderPreviewScreen.targetPrice",defaultMessage:"Target price"},targetPriceContent:{id:"LimitOrderPreviewScreen.targetPriceContent",defaultMessage:"{amount} / 1 {asset}"},expirationTitle:{id:"LimitOrderPreviewScreen.expirationTitle",defaultMessage:"Expiration"},expirationDetail:{id:"LimitOrderPreviewScreen.expirationDetail",defaultMessage:"Good until canceled"},coinbaseFee:{id:"LimitOrderPreviewScreen.coinbaseFee",defaultMessage:"Coinbase fee"},coinbaseFeeAccessibilityLabel:{id:"LimitOrderPreviewScreen.coinbaseFeeAccessibilityLabel",defaultMessage:"Coinbase fee more information"},total:{id:"LimitOrderPreviewScreen.total",defaultMessage:"Total"},cashAddedSuccessfully:{id:"LimitOrderPreviewScreen.cashAddedSuccessfully",defaultMessage:"Cash added successfully"},error:{id:"LimitOrderPreviewScreen.error",defaultMessage:"Error"},paymentMethodInfoAccessibilityLabel:{id:"LimitOrderPreviewScreen.paymentMethodInfoAccessibilityLabel",defaultMessage:"Payment method information"}});function ns({queryRef:e,viewerAssetRef:a}){const n=(0,W.Jc)(kr,e),l=(0,W.Jc)(pr,a),{asset:t}=l,{createLimitOrderResponse:r,depositRequirements:s}=(0,N.jf)(ke.cr),i=r.value?.limitOrder,u=r.value?.userWarnings;if(!i)throw new Error("Limit order data is not available");const{uuid:o,amount:c,total:d,unitPrice:m,fee:g}=i,[p,y]=(0,E.useState)(""),{transferType:k}=(0,N.jf)(ke.cr),{goToStep:f}=(0,hr.Z)(ke.Ex),{isCoinbaseOneSubscriber:b}=(0,pe.f)(),{formatMessage:S}=(0,ya.Z)(),F=(0,q.$T)(),v="buy"===k.value,{fiatPrecision:h,cryptoPrecision:C}=(0,Tr.h)(l),T=(0,Sr.p)(),{trackEvent:A}=(0,Se.Z)();(0,E.useEffect)((()=>{A("viewed_preview",{action:Q.Us.render,componentType:Q.re.modal}),s.value&&T.show(S(as.cashAddedSuccessfully))}),[]);const K=(0,E.useMemo)((()=>(0,ka.jsx)(vr.Z,{goBack:()=>{f("limitOrderEntry")},title:S(as.header),testID:"limit-order-preview"})),[S,f]),x=(0,E.useMemo)((()=>(0,ka.jsx)(_n.TextTitle2,{color:"primary",as:"p",align:"center",spacingTop:1,children:S(v?as.buyHeader:as.sellHeader,{amount:F({amount:c,isFiat:!1,exponent:C})})})),[c,C,F,S,v]),w=(0,E.useCallback)((()=>{f("paymentMethodInfo")}),[f]),B=(0,E.useMemo)((()=>(0,ka.jsx)(Ge.aR,{leftColor:"foreground",isNewDesign:!0,label:S(v?as.paymentMethodTitle:as.depositToTitle),leftIcon:(0,ka.jsx)(Fr.PressableOpacity,{as:"button",accessibilityLabel:S(as.paymentMethodInfoAccessibilityLabel),onPress:w,children:(0,ka.jsx)(br.Icon,{name:"questionMark",size:"xs",color:"foregroundMuted",testID:"payment-info-button"})}),rightContent:(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:S(as.paymentMethodDetail)})},"paymentMethodCell")),[S,w,v]),L=(0,E.useMemo)((()=>(0,ka.jsx)(Ge.aR,{label:S(as.targetPrice),leftColor:"foreground",isNewDesign:!0,rightContent:(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:S(as.targetPriceContent,{amount:F({amount:m?.amount,isFiat:!0,exponent:h}),asset:t.displaySymbol})})},"targetPrice")),[t.displaySymbol,h,F,S,m?.amount]),I=(0,E.useMemo)((()=>(0,ka.jsx)(Ge.aR,{isLastRow:!0,label:S(as.total),isNewDesign:!0,leftColor:"foreground",rightContent:(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:F({amount:d,isFiat:!0,exponent:h})})},"total")),[h,F,S,d]),P=function(e){const a=(0,W.Jc)(Kr,e);if(null===a.fee)throw new Error("Missing fee data");const n=a.feeWithoutSubscriptionBenefit?.currency??a.fee.currency;if(null===n)throw new Error("Missing currency data");let l="FULL";const t=parseFloat(a.fee.value??""),r=parseFloat(a.feeWithoutSubscriptionBenefit?.value??t.toString());if(!a.appliedSubscriptionBenefit)return{feePaid:t,feeCurrency:n,feeCoverage:l,feeWithoutBenefit:r,isBenefitCapped:!1,benefitCapResetDate:null,availableCapAfterTrade:null};const s=a.subscriptionInfo?.hasBenefitCap??!1,i=a.subscriptionInfo?.freeTradingResetDate??null,u=a.subscriptionInfo?.remainingFreeTradingVolume?.value?parseFloat(a.subscriptionInfo.remainingFreeTradingVolume.value):null;return 0===u&&t>0&&t<r?l="PARTIAL":0===u&&t===r&&(l="NONE"),{feePaid:t,feeCurrency:n,feeCoverage:l,feeWithoutBenefit:r,isBenefitCapped:s,benefitCapResetDate:i,availableCapAfterTrade:u}}(i),R=(0,E.useCallback)((()=>{A("tapped_fee_explanation_button"),f("feesInfo")}),[f,A]),M=(0,E.useMemo)((()=>g?(0,ka.jsx)(Ge.hc,{onClick:R,rightContent:(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:F({amount:g,isFiat:!0})}),testID:"fee",isNewDesign:!0},"coinbaseFee"):null),[g,F,R]),_=(0,E.useMemo)((()=>(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(Ge.hc,{onClick:R,rightContent:(0,ka.jsx)(Cr.F,{subscriptionFeeBenefit:P}),testID:"LimitOrderPreview_transactionSubscriptionFeeCell",isNewDesign:!0},"transactionSubscriptionFeeCell"),(0,ka.jsx)(ma.c,{subscriptionFeeBenefit:P})]})),[R,P]),V=(0,E.useMemo)((()=>(0,ka.jsx)(Ge.aR,{label:S(as.expirationTitle),leftColor:"foreground",isNewDesign:!0,rightContent:(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:S(as.expirationDetail)})},"expiration")),[S]),D=(0,E.useMemo)((()=>o?(0,ka.jsx)(Nn.Box,{spacingTop:3,children:(0,ka.jsx)(es,{uuid:o,onPress:()=>{y("")},onSuccess:()=>{f("limitOrderConfirmation")},onError:e=>{y(e)}})}):null),[f,o]),j=(0,E.useMemo)((()=>""!==p?(0,ka.jsx)(Nn.Box,{spacingHorizontal:3,display:"block",children:(0,ka.jsx)(fr.j,{title:p,variant:"warning",startIcon:"error",showDismiss:!0,children:(0,ka.jsx)(ka.Fragment,{})})}):null),[p]),O=(0,E.useCallback)((()=>{f("buyDisclosures")}),[f]),Z=(0,E.useMemo)((()=>{const e=u?.find((e=>"buy_trade_disclosure"===e?.code));return e?.context?(0,ka.jsx)(Nn.Box,{justifyContent:"center",children:(0,ka.jsx)(Ge.$M,{text:e.message,link:{text:e?.context?.linkText??"",onClick:O}})}):null}),[O,u]);return(0,ka.jsx)(Ge.qb,{"data-element":"PreviewWrapper","data-component":"LimitOrderPreviewStep",children:(0,ka.jsxs)(Ge.zP,{"data-element":"PreviewSection",children:[K,j,x,(0,ka.jsxs)(En.VStack,{spacingHorizontal:3,spacingTop:3,spacingBottom:2,"data-element":"VStack",children:[B,L,V,b?_:M,I,(0,ka.jsx)(Gr,{queryRef:n,viewerAssetRef:l,"data-element":"DepositingFundsCheck",children:D}),Z&&(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(qe.Divider,{offsetHorizontal:3,spacingBottom:2}),Z]})]})]})})}const ls=(0,E.memo)(ns),ts={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PaymentMethodInfoStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"useFiatAccountAvailableBalanceFragment"}],type:"Query",abstractKey:null,hash:"6048ac82e17180d4ab1fdaa0c81de5bd"},rs=ts;var ss=n(162),is=n(2415);const us={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useFiatAccountAvailableBalanceFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"uuid",value:"USD"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:'accountByUuidV2(uuid:"USD")'}],storageKey:null}],type:"Query",abstractKey:null,hash:"7d0d743ec3f36e1ebf9800a8e690da68"},os=us;function cs(e){const{viewer:a}=(0,W.Jc)(os,e);return(0,E.useMemo)((()=>a.accountByUuidV2?.availableBalance.value??"0"),[a.accountByUuidV2?.availableBalance.value])}const ds=(0,pa.vU)({title:{id:"PaymentMethodInfoStep.title",defaultMessage:"USD balance only, for now"},message:{id:"PaymentMethodInfoStep.message",defaultMessage:"We currently only allow you to use your USD balance as your payment method for conditional orders. We’ll be adding more ways to pay in the future."},ok:{id:"PaymentMethodInfoStep.ok",defaultMessage:"OK"},balanceTitle:{id:"PaymentMethodInfoStep.balanceTitle",defaultMessage:"US Dollar"},balance:{id:"PaymentMethodInfoStep.balance",defaultMessage:"Balance"}});function ms({queryRef:e}){const{goBack:a}=(0,ae.tC)(ke.Ex),{formatMessage:n}=(0,ya.Z)(),l=cs((0,W.Jc)(rs,e)),t=(0,q.$T)(),r=(0,E.useMemo)((()=>t({amount:{value:l,currency:"USD"},isFiat:!0,exponent:2})),[t,l]),s=(0,E.useMemo)((()=>(0,ka.jsx)(ss.ListCell,{outerSpacing:{spacing:0},media:(0,ka.jsx)(is.Z,{symbol:"USD",size:32}),title:n(ds.balanceTitle),detail:(0,ka.jsxs)(qe.VStack,{alignItems:"flex-end",children:[(0,ka.jsx)(_n.TextBody,{as:"p",children:r}),(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:n(ds.balance)})]})})),[n,r]);return(0,ka.jsx)(er.Z,{onBackPress:a,headerTitle:n(ds.title),message:n(ds.message),postMessage:s,"data-element":"InfoStep","data-component":"PaymentMethodInfoStep"})}const gs=(0,E.memo)(ms),ps={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputStepViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useAssetSelectorViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderAccountBalanceViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderInputCTAViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderInputFieldsContentViewerAssetFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"0f74ab5259a57061fd31e6dc3ca781e0"},ys=ps,ks={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderInputFieldsContentFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderInputCTAFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderAccountBalanceFragment"}],type:"Query",abstractKey:null,hash:"6312a44f683dec2853909503782ec54c"},fs=ks;var bs=n(182),Ss=n(712),Fs=n(177),vs=n(3643),hs=n(1311),Cs=n(748);const Ts={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderAccountBalanceFragment",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderAccountBalanceFiatFragment"}],type:"Query",abstractKey:null,hash:"a07d1f6200b9833c57cfc98b60fa744c"},As=Ts,Ks=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"CryptoAccountBalanceComponentRefetchable",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderAccountBalanceViewerAssetFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"CryptoAccountBalanceComponentRefetchable",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},n],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalance",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalanceInNativeCurrency",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:l,storageKey:null},n],storageKey:null}],type:"ViewerAsset",abstractKey:null}],storageKey:null}]},params:{id:"31217e8f0edb43ed1e61f59e0e28f5e1fc76061e58df3c3f2014569a2074c44d",metadata:{},name:"CryptoAccountBalanceComponentRefetchable",operationKind:"query",text:null}}}();Ks.hash="d256c8125d27c5b0ad3f9ad9824a82c3";const xs={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Ks,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"LimitOrderAccountBalanceViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useAvailableBalanceForAssetViewerAssetFragment"},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"d256c8125d27c5b0ad3f9ad9824a82c3"},ws=xs,Bs=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"productKey"}],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"FiatAccountBalanceComponentRefetchable",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderAccountBalanceFiatFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"FiatAccountBalanceComponentRefetchable",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"uuid",value:"USD"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null},a],storageKey:'accountByUuidV2(uuid:"USD")'},a,{alias:null,args:[{kind:"Variable",name:"productKey",variableName:"productKey"}],concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},a],storageKey:null},a],storageKey:null}],storageKey:null}]},params:{id:"3532f5e381fcc5feea9c44605e37fb5dee4707b332eb0b3d8fea4111e9ba8bfb",metadata:{},name:"FiatAccountBalanceComponentRefetchable",operationKind:"query",text:null}}}();Bs.hash="b67986c56d6467278fd04c326c96dec4";const Ls={argumentDefinitions:[{kind:"RootArgument",name:"productKey"}],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Bs}},name:"LimitOrderAccountBalanceFiatFragment",selections:[{args:null,kind:"FragmentSpread",name:"useFiatAccountAvailableBalanceFragment"},{args:null,kind:"FragmentSpread",name:"useIsCoinbaseOneUserFragment"}],type:"Query",abstractKey:null,hash:"b67986c56d6467278fd04c326c96dec4"},Is=Ls;var Ps=n(511),Rs=n(264),Ms=n(38),Es=n(3598);const _s=function(){var e=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useAvailableBalanceForAssetViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalance",plural:!1,selections:e,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"totalBalanceInNativeCurrency",plural:!1,selections:e,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:e,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:e,storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null}}();_s.hash="ea8d490969518f231694951198b25665";const Vs=_s;function Ds(e){const a=(0,W.Jc)(Vs,e),n=a?.accounts?.find((e=>e?.primary));return(0,E.useMemo)((()=>({totalBalanceInCrypto:n?.totalBalance?.value??"0",totalBalanceInFiat:n?.totalBalanceInNativeCurrency?.value??"0",availableBalanceInFiat:n?.availableBalanceInNativeCurrency?.value??"0",availableBalanceInCrypto:n?.availableBalance?.value??"0"})),[n?.availableBalance?.value,n?.availableBalanceInNativeCurrency?.value,n?.totalBalance?.value,n?.totalBalanceInNativeCurrency?.value])}const js={argumentDefinitions:[{kind:"RootArgument",name:"productKey"}],kind:"Fragment",metadata:null,name:"useIsCoinbaseOneUserFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"productKey",variableName:"productKey"}],concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"e2729f9d386bfcbf650ef3b80c615a02"},Ns=js;var Os=n(804);function Zs(e){const{viewer:a}=(0,W.Jc)(Ns,e),n=a.coinbaseSubscription?.status??"NOT_SUBSCRIBED";return"PAUSE_PLAN"!==a.coinbaseSubscription?.subscriptionPlan?.type&&(0,Os.Y)(n)}function Us(e,a,n){const l=(0,q.$T)();return(0,E.useMemo)((()=>l({amount:{value:e,currency:a},isFiat:"fiat"===n})),[e,a,l,n])}const qs=(0,pa.vU)({balance:{id:"LimitOrderAccountBalance.balance",defaultMessage:"Available {currency}"}});function Qs(e="USD",a="United States Dollar",n=""){const{openModal:l,closeModal:t}=(0,Ps.useModal)();return(0,E.useCallback)((()=>{l((0,ka.jsx)(Es.l,{visible:!0,onClose:t,entryPoint:"limit_order",currencyCode:e,currencyName:a,currencyUuid:n}))}),[t,e,a,n,l])}const Hs=(0,E.memo)((function({queryRef:e}){const{formatMessage:a}=(0,ya.Z)(),[n,l]=(0,W.qA)(Is,e),t=cs(n),r=Zs(n),s=Us((0,E.useMemo)((()=>r?t:String(Number(t)*(1-jr))),[t,r]),"USD","fiat"),i=Qs();return(0,E.useEffect)((()=>{l({},{fetchPolicy:"network-only"})}),[]),(0,ka.jsx)(Ms.Pressable,{onPress:i,backgroundColor:"transparent",width:"100%",children:(0,ka.jsxs)(Rn.HStack,{width:"100%",alignItems:"center",gap:1,children:[(0,ka.jsx)(_n.TextBody,{as:"p",children:a(qs.balance,{currency:"USD"})}),(0,ka.jsx)(Mn.Spacer,{}),(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:s}),(0,ka.jsx)(br.Icon,{size:"s",name:"caretRight",color:"foregroundMuted"})]})})})),Ws=(0,E.memo)((function({viewerAssetRef:e}){const{formatMessage:a}=(0,ya.Z)(),[n,l]=(0,W.qA)(ws,e),{availableBalanceInFiat:t,totalBalanceInFiat:r}=Ds(n),{asset:s}=n,i=s.platformName??void 0,u=s.name??void 0,o=s.uuid??void 0,c=s.displaySymbol??void 0,d=Us(t,"USD","fiat"),m=Qs(i,u,o),g=(0,E.useMemo)((()=>r!==t),[t,r]);(0,E.useEffect)((()=>{l({},{fetchPolicy:"network-only"})}),[]);const p=(0,E.useMemo)((()=>(0,ka.jsxs)(Rn.HStack,{width:"100%",alignItems:"center",gap:1,children:[(0,ka.jsx)(_n.TextBody,{as:"p",numberOfLines:1,children:a(qs.balance,{balance:d,currency:c})}),g&&(0,ka.jsx)(br.Icon,{size:"s",name:"caretRight",color:"foregroundMuted"}),(0,ka.jsx)(Mn.Spacer,{}),(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:d})]})),[c,d,a,g]);return g?(0,ka.jsx)(Ms.Pressable,{onPress:m,backgroundColor:"transparent",width:"100%",children:p}):p}));function zs({isLoading:e}){const{formatMessage:a}=(0,ya.Z)();return(0,ka.jsx)(Ms.Pressable,{onPress:D.noop,backgroundColor:"transparent",width:"100%","data-element":"Pressable","data-component":"LabelFallback",children:(0,ka.jsxs)(Rn.HStack,{width:"100%",alignItems:"center",gap:1,"data-element":"HStack",children:[(0,ka.jsx)(_n.TextBody,{as:"p","data-element":"TextBody",children:a(qs.balance,{currency:""})}),(0,ka.jsx)(br.Icon,{name:"info",size:"xs",color:"foregroundMuted","data-element":"Icon"}),(0,ka.jsx)(Mn.Spacer,{"data-element":"Spacer"}),e?(0,ka.jsx)(Rs.Spinner,{size:2}):(0,ka.jsx)(_n.TextBody,{as:"p",color:"foregroundMuted",children:"---"})]})})}const Gs=(0,E.memo)((function(e){return(0,ka.jsx)(vn.Z,{fallback:()=>(0,ka.jsx)(zs,{}),owner:"simple-trade",context:"limit-order",boundaryName:"FiatAccountBalance",children:(0,ka.jsx)(W.zq,{instrumentationId:"FiatAccountBalanceComponent",fallback:(0,ka.jsx)(zs,{isLoading:!0}),children:(0,ka.jsx)(Hs,{...e})})})})),Js=(0,E.memo)((function(e){return(0,ka.jsx)(vn.Z,{fallback:()=>(0,ka.jsx)(zs,{}),owner:"simple-trade",context:"limit-order",boundaryName:"CryptoAccountBalance",children:(0,ka.jsx)(W.zq,{instrumentationId:"CryptoAccountBalanceComponent",fallback:(0,ka.jsx)(zs,{isLoading:!0}),children:(0,ka.jsx)(Ws,{...e})})})}));function $s({queryRef:e,viewerAssetRef:a}){const n=(0,W.Jc)(As,e),{transferType:l}=(0,N.jf)(ke.cr);return(0,ka.jsx)(Nn.Box,{spacingTop:2,spacingHorizontal:3,"data-element":"Box","data-component":"LimitOrderAccountBalance",children:"buy"===l.value?(0,ka.jsx)(Gs,{queryRef:n}):(0,ka.jsx)(Js,{viewerAssetRef:a})})}const Ys=(0,E.memo)($s),Xs={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputCTAViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderInputErrorSectionViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderReviewOrderButtonViewerAssetFragment"},{kind:"InlineDataFragmentSpread",name:"useFormStateMachineViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useLatestQuoteViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useBaseSizesViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useAvailableBalanceForAssetViewerAssetFragment"}],args:null,argumentDefinitions:[]},{args:null,kind:"FragmentSpread",name:"LimitOrderSuggestionSectionViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"b46c75d585351a272a7731baf8ac4af8"},ei=Xs,ai={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputCTAFragment",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderReviewOrderButtonFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderSuggestionSectionFragment"}],type:"Query",abstractKey:null,hash:"396082fb9319fd81a29478cbc75df798"},ni=ai,li={kind:"InlineDataFragment",name:"useFormStateMachineViewerAssetFragment",hash:"dde41737fb60658b1bbd16f8cc865aa8"},ti=li,ri={percent:"1%",fraction:.01,plus:1.010002,minus:.989999},si={minAmountValue:"minAmountValue",maxSellValue:"maxSellValue",minimumSellPercentage:"minimumSellPercentage",minimumBuyPercentage:"minimumBuyPercentage",needCryptoToSell:"needCryptoToSell",maxTradeValueApiLimit:"maxTradeValueApiLimit",minTradeValueApiLimit:"minTradeValueApiLimit"},ii={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBaseSizesViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"filter",value:{quoteCurrency:"USD"}}],concreteType:"RetailBrokerageProduct",kind:"LinkedField",name:"brokerageProduct",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"baseMaxSize",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"baseMinSize",storageKey:null}],storageKey:'brokerageProduct(filter:{"quoteCurrency":"USD"})'}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"9d8d25d1f2b8770a73210599e30ffdd2"},ui=ii;function oi(e){const a=(0,W.Jc)(ui,e),n=a?.asset;return(0,E.useMemo)((()=>({maxSize:n?.brokerageProduct?.baseMaxSize??"0",minSize:n?.brokerageProduct?.baseMinSize??"0"})),[n?.brokerageProduct?.baseMaxSize,n?.brokerageProduct?.baseMinSize])}function ci(e,a,n=500){const[l,t]=(0,E.useState)(e);return(0,E.useEffect)((()=>{const a=setTimeout((()=>{l!==e&&t(e)}),n);return()=>clearTimeout(a)}),[a,e,n,l]),l}var di=n(873);const mi={Suggestion:"Suggestion",Error:"Error",Submit:"Submit"};function gi(e){const{inputFiatAmount:a,inputCryptoAmount:n,targetPrice:l,currentFocus:t,transferType:r}=(0,N.jf)(ke.cr),s=(0,W.fR)(ti,e),{availableBalanceInCrypto:i}=Ds(s),u=(0,di.z)(s),{maxSize:o,minSize:c}=oi(s),d="amount"===t.value?a.value:l.value,{variant:m,error:g}=(0,E.useMemo)((()=>{if(0===Number(d))return{variant:mi.Submit};const e=function({operation:e,targetPrice:a,tradeAmountInUSD:n,tradeAmountInCrypto:l,isTradeInputSelected:t,cryptoPrice:r,availableCrypto:s,minSize:i,maxSize:u}){const o="sell"===e;if(n<=5&&t)return{action:si.minAmountValue};if(s<=0&&o)return{action:si.needCryptoToSell};if(l>u)return{action:si.maxTradeValueApiLimit};if(0!==l&&l<i)return{action:si.minTradeValueApiLimit};if(o&&!(s>=l)&&t)return{action:si.maxSellValue};const c=Math.abs((a-r)/r)<ri.fraction;return!("sell"===e&&t||!("buy"===e?a>=r:a<=r)&&!c)&&{action:"sell"===e?si.minimumSellPercentage:si.minimumBuyPercentage}}({operation:r.value,tradeAmountInUSD:Number(a.value),tradeAmountInCrypto:Number(n.value),cryptoPrice:Number(u??"0"),availableCrypto:Number(i),targetPrice:Number(l.value),isTradeInputSelected:"amount"===t.value,maxSize:Number(o),minSize:Number(c)});return e?{variant:mi.Error,error:e}:{variant:mi.Submit}}),[i,t.value,n.value,a.value,u,o,c,l.value,r.value,d]),p=ci(g,d),y=ci(m,d);return{error:p,buttonToUse:"Error"===m?y:m}}const pi={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputErrorSectionViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useLatestQuoteViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useHandleInputFieldChangeViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useBaseSizesViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useAvailableBalanceForAssetViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"0d034cdd454da653b398a19d79bd1b53"},yi=pi;var ki=n(216),fi=n.n(ki),bi=n(180),Si=n(67),Fi=n(98);const vi={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useHandleInputFieldChangeViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useLatestQuoteViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"763dea5716338abe479c36809e3de815"},hi=vi;function Ci(e){const a=(0,W.Jc)(hi,e),{inputFiatAmount:n,inputCryptoAmount:l,targetPrice:t,isFiatInput:r}=(0,N.jf)(ke.cr),s=(0,di.z)(a);function i(e,a){const n=e.slice(-1);return"."===n||"0"===n?""===a?"0.":e:String(Number(e))}const u=(0,E.useCallback)(((e,a)=>{const u=0===Number(t.value)?s:t.value,o=r.value,c=i(e,o?n.value:l.value);o||a?(n.onChange(c),l.onChange(Dr({amount:c,to:"crpyto",target:u}))):(l.onChange(c),n.onChange(Dr({amount:c,to:"fiat",target:u})))}),[l,n,r.value,s,t.value]),o=(0,E.useCallback)((e=>{const a=i(e,t.value);t.onChange(a);const u=0===Number(a)?s:a;r.value?l.onChange(Dr({amount:n.value,to:"crpyto",target:u})):n.onChange(Dr({amount:l.value,to:"fiat",target:u}))}),[l,n,r.value,s,t]);return(0,E.useMemo)((()=>({handleInputAmountChange:u,handleTargetAmountChange:o})),[u,o])}const Ti=(0,pa.vU)({[`${si.needCryptoToSell}Title`]:{id:"LimitOrderLimitOrderInputErrorSection.needCryptoToSellTitle",defaultMessage:"Add more {platformName} to complete this order."},[`${si.needCryptoToSell}Action`]:{id:"LimitOrderLimitOrderInputErrorSection.needCryptoToSellAction",defaultMessage:"Buy {platformName}"},[`${si.maxSellValue}Title`]:{id:"LimitOrderLimitOrderInputErrorSection.maxSellValueTitle",defaultMessage:"You can sell up to {cryptoBalance}."},[`${si.maxSellValue}Action`]:{id:"LimitOrderLimitOrderInputErrorSection.maxSellValueAction",defaultMessage:"Sell max"},[`${si.maxTradeValueApiLimit}Title`]:{id:"LimitOrderLimitOrderInputErrorSection.maxTradeValueApiLimitTitle",defaultMessage:"The maximum {platformName} you can trade is {baseMaxSize} {platformName}."},[`${si.minTradeValueApiLimit}Title`]:{id:"LimitOrderLimitOrderInputErrorSection.minTradeValueApiLimitTitle",defaultMessage:"The minimum {platformName} you can trade is {baseMinSize} {platformName}."},[`${si.minimumBuyPercentage}Title`]:{id:"LimitOrderLimitOrderInputErrorSection.minBuyPercentageTitle",defaultMessage:"Set a price at least {percentageThreshold} below {platformName}’s current price."},[`${si.minimumBuyPercentage}Action`]:{id:"LimitOrderLimitOrderInputErrorSection.minBuyPercentageAction",defaultMessage:"↘ {percentageThreshold}"},[`${si.minimumSellPercentage}Title`]:{id:"LimitOrderLimitOrderInputErrorSection.minSellPercentageTitle",defaultMessage:"Set a price at least {percentageThreshold} above {platformName}’s current price."},[`${si.minimumSellPercentage}Action`]:{id:"LimitOrderLimitOrderInputErrorSection.minSellPercentageAction",defaultMessage:"↗ {percentageThreshold}"},[`${si.minAmountValue}Title`]:{id:"LimitOrderLimitOrderInputErrorSection.minAmountValueTitle",defaultMessage:"Minimum amount is $5.01 dollars."},[`${si.minAmountValue}Action`]:{id:"LimitOrderLimitOrderInputErrorSection.minAmountValueAction",defaultMessage:"Set minimum"}}),Ai=(0,E.memo)((function({action:e,viewerAssetRef:a}){const n=(0,W.Jc)(yi,a),l=n.asset.platformName??"",{isFiatInput:t,targetPrice:r}=(0,N.jf)(ke.cr),{availableBalanceInFiat:s,availableBalanceInCrypto:i}=Ds(n),{handleInputAmountChange:u,handleTargetAmountChange:o}=Ci(n),{maxSize:c,minSize:d}=oi(n),m=(0,di.z)(n),{trackEvent:g}=(0,Se.Z)();(0,E.useEffect)((()=>{e===si.minimumBuyPercentage&&g("limit_price_error",{action:Q.Us.view,componentType:Q.re.banner,amount:r.value})}),[]);const p=(0,E.useCallback)((()=>{switch(e){case si.minAmountValue:u("5.01",!0),t.onChange(!0);break;case si.maxSellValue:u(t.value?s:i),t.onChange(!1);break;case si.minimumBuyPercentage:g("tapped_limit_price_error",{action:Q.Us.click,componentType:Q.re.button}),o(String(Number(m)*ri.minus));break;case si.minimumSellPercentage:g("tapped_limit_price_error",{action:Q.Us.click,componentType:Q.re.button}),o(String(Number(m)*ri.plus));case si.maxTradeValueApiLimit:case si.minTradeValueApiLimit:case si.needCryptoToSell:}}),[e,u,t,s,i,g,o,m]),{formatMessage:y,formatNumber:k}=(0,ya.Z)(),f=(0,q.$T)(),b=(0,E.useMemo)((()=>e===si.maxSellValue?`${f({amount:{value:i,currency:l},isFiat:!1})}`:"--"),[e,i,f,l]),S=(0,E.useMemo)((()=>y(Ti[`${e}Title`],{percentageThreshold:ri.percent,cryptoBalance:b,platformName:l,baseMaxSize:k(Number(c)),baseMinSize:k(Number(d),{maximumFractionDigits:d.length??0})})),[y,e,b,l,k,c,d]),F=e!==si.maxTradeValueApiLimit&&e!==si.minTradeValueApiLimit&&e!==si.needCryptoToSell,v=(0,E.useMemo)((()=>F?y(Ti[`${e}Action`],{percentageThreshold:ri.percent,platformName:l}):""),[e,y,F,l]);return(0,ka.jsxs)(Rn.HStack,{spacingHorizontal:3,alignItems:"center",minHeight:"56px",width:"100%",children:[(0,ka.jsx)(Nn.Box,{spacingVertical:1,flexGrow:1,flexBasis:0,spacingEnd:2,children:(0,ka.jsx)(Fi.TextLabel2,{as:"p",spacing:0,children:S})}),(0,ka.jsx)(Si.Pressable,{onPress:p,backgroundColor:"transparent",accessibilityHint:v,children:(0,ka.jsx)(_n.TextHeadline,{as:"p",color:"primary",numberOfLines:1,children:v})})]})}));function Ki(){return(0,ka.jsxs)(Rn.HStack,{offsetBottom:1,gap:2,flexGrow:1,justifyContent:"space-between",background:"secondary",alignItems:"center",spacing:2,spacingVertical:0,minHeight:"56px","data-element":"HStack","data-component":"LimitOrderInputErrorSectionContentFallback",children:[(0,ka.jsx)(Nn.Box,{flexShrink:1,"data-element":"Box",children:(0,ka.jsx)(bi.Fallback,{width:100,height:25,"data-element":"Fallback"})}),(0,ka.jsx)(Si.Pressable,{onPress:fi(),backgroundColor:"transparent","data-element":"Pressable",children:(0,ka.jsx)(bi.Fallback,{width:30,height:25,"data-element":"Fallback"})})]})}function xi(e){return(0,ka.jsx)(Fn.Z,{owner:"simple-trade",fallback:()=>(0,ka.jsx)(Ki,{}),context:"limit_order","data-element":"ErrorBoundary","data-component":"LimitOrderInputErrorSection",children:(0,ka.jsx)(vn.Z,{owner:"simple-trade",fallback:()=>(0,ka.jsx)(Ki,{}),boundaryName:"LimitORderInputErrorSection",context:"limit_order","data-element":"NetworkErrorBoundary",children:(0,ka.jsx)(Nn.Box,{background:"secondary","data-element":"Box",children:(0,ka.jsx)(Ai,{...e,"data-element":"LimitOrderInputErrorSectionContent"})})})})}const wi=(0,E.memo)(xi),Bi={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderReviewOrderButtonViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useHandleCreateLimitOrderViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"7afa60eb34e592d3b0823758749594a0"},Li=Bi,Ii={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderReviewOrderButtonFragment",selections:[{args:null,kind:"FragmentSpread",name:"useHandleCreateLimitOrderFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"fiatAccount",args:[{kind:"Literal",name:"uuid",value:"USD"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:'accountByUuidV2(uuid:"USD")'}],storageKey:null}],type:"Query",abstractKey:null,hash:"a187f84430d3ccc33d9df93faffaeb5d"},Pi=Ii;var Ri=n(271);const Mi=(0,pa.vU)({reviewOrder:{id:"LimitOrderReviewOrderButton.reviewOrder",defaultMessage:"Review order"}});function Ei({queryRef:e,viewerAssetRef:a}){const{formatMessage:n}=(0,ya.Z)(),{goToStep:l}=(0,ae.tC)(ke.Ex),{inputCryptoAmount:t,targetPrice:r,createLimitOrderResponse:s,depositRequirements:i,transferType:u}=(0,N.jf)(ke.cr),o=(0,W.Jc)(Pi,e),c=(0,W.Jc)(Li,a),d=0===Number(t.value)||0===Number(r.value),{isCreatingLimitOrder:m,handlePreviewBuy:g}=Ur({queryRef:o,viewerAssetRef:c,operation:u.value,inputAmount:t.value,inputUnit:"CRYPTO",targetAmount:r.value}),{trackEvent:p}=(0,Se.Z)(),y=qr(),k=(0,Sr.p)(),f=(0,E.useCallback)((async()=>{p("tapped_preview",{action:Q.Us.click,componentType:Q.re.button});const e=await g(),a=o.viewer?.fiatAccount;if("CreateLimitOrderSuccess"===e?.__typename){const n=Number(e?.limitOrder?.total?.value)??0,t=Number(a?.availableBalance?.value)??0,r=Number(e?.limitOrder?.fee?.value)??0,o=Nr({amountToBuyInUsd:n,balance:t,fee:r});s.onChange(e),"buy"===u.value&&o>0&&!y?(i.onChange(o),(0,Ri.Or)({transferType:"deposit",entryPoint:"limitOrderAddCash"}),l("limitOrderDeposit")):l("limitOrderPreview")}"GenericError"===e?.__typename&&k.show(e.message,{variant:"negative"})}),[s,i,l,g,y,o.viewer?.fiatAccount,k,p,u.value]);return(0,ka.jsx)(Nn.Box,{spacingHorizontal:3,"data-element":"Box","data-component":"LimitOrderReviewOrderButton",children:(0,ka.jsx)(Il.Button,{block:!0,disabled:d,loading:m,onPress:f,"data-element":"Button",children:n(Mi.reviewOrder)})})}const _i=(0,E.memo)(Ei),Vi={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderSuggestionSectionViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useLatestQuoteViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useHandleInputFieldChangeViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useAvailableBalanceForAssetViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"a92cbdc8abf1fd359b02391cec7aef19"},Di=Vi,ji={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderSuggestionSectionFragment",selections:[{args:null,kind:"FragmentSpread",name:"useFiatAccountAvailableBalanceFragment"},{args:null,kind:"FragmentSpread",name:"useIsCoinbaseOneUserFragment"}],type:"Query",abstractKey:null,hash:"a1573499d80367780ef1f062916c2fab"},Ni=ji;function Oi({suggestedValues:e,onPress:a,compact:n=!1}){const l=(0,E.useMemo)((()=>e.map((({value:e,title:l,ariaLabel:t})=>(0,ka.jsx)(Zi,{value:e,title:l,ariaLabel:t,onPress:a,compact:n},e)))),[e,a,n]);return(0,ka.jsx)(Rn.HStack,{justifyContent:n?"flex-start":"space-evenly",alignItems:"center",width:"100%",minHeight:n?"40px":"56px",gap:1,spacingHorizontal:n?0:3,"data-element":"HStack","data-component":"LimitOrderSuggestionButtons",children:l})}function Zi({value:e,title:a,ariaLabel:n,onPress:l,compact:t}){const{trackEvent:r}=(0,Se.Z)(),s=(0,E.useCallback)((()=>{const a=e.replaceAll(/↘ |↗ |%/g,"");r("tapped_preset_limit_price",{action:Q.Us.click,componentType:Q.re.button,price:a}),l(e)}),[l,r,e]);return t?(0,ka.jsx)(Si.Pressable,{onPress:s,backgroundColor:"secondary",accessibilityLabel:n,borderRadius:"roundedFull",children:(0,ka.jsx)(Nn.Box,{spacingVertical:1,spacingHorizontal:2,children:(0,ka.jsx)(_n.TextHeadline,{as:"p",children:a})})}):(0,ka.jsx)(Ue.Button,{variant:"secondary",onPress:s,accessibilityLabel:n,compact:t,children:a})}const Ui=(0,E.memo)(Oi),qi=(0,pa.vU)({maxValue:{id:"LimitOrderSuggestionEngineButton.maxValue",defaultMessage:"Max"},down:{id:"LimitOrderSuggestionEngineButton.down",defaultMessage:"Down"},up:{id:"LimitOrderSuggestionEngineButton.up",defaultMessage:"Up"}}),Qi={PERCENTAGE_DOWN:"PERCENTAGE_DOWN",PERCENTAGE_UP:"PERCENTAGE_UP",BALANCE:"BALANCE"},Hi=["50","100","maxValue"],Wi=["↘ 2%","↘ 5%","↘ 10%"].map((e=>({title:e,value:e}))),zi=["↗ 2%","↗ 5%","↗ 10%"].map((e=>({title:e,value:e})));function Gi(e,a){return a?"BALANCE":"sell"===e?Qi.PERCENTAGE_UP:Qi.PERCENTAGE_DOWN}function Ji({variant:e,queryRef:a,viewerAssetRef:n,compact:l}){const t=(0,W.Jc)(Ni,a),r=(0,W.Jc)(Di,n),{isFiatInput:s,targetPrice:i,currentFocus:u,transferType:o}=(0,N.jf)(ke.cr),c=(0,di.z)(r),d=cs(t),{availableBalanceInFiat:m,availableBalanceInCrypto:g}=Ds(r),p=s.value?m:g,y=Zs(t),{formatMessage:k,formatNumber:f}=(0,ya.Z)(),{handleInputAmountChange:b,handleTargetAmountChange:S}=Ci(r),F="amount"===u.value?b:S,v=(0,E.useMemo)((()=>{switch(e){case Qi.PERCENTAGE_UP:return zi.map((e=>({...e,ariaLabel:e.title.replace("↗",k(qi.up))})));case Qi.PERCENTAGE_DOWN:return Wi.map((e=>({...e,ariaLabel:e.title.replace("↘",k(qi.down))})));case Qi.BALANCE:return Hi.map((e=>{const a="maxValue"===e?k(qi.maxValue):f(Number(e),{style:"currency",maximumFractionDigits:0,currency:"USD"});return{title:a,value:e,ariaLabel:a}}));default:return[]}}),[e,f,k]),h=(0,E.useCallback)((e=>{F(function(e,a,n,l,t,r,s){const i=e.match(/\d+/)?.[0]??e;if(e.includes("↗")){const e=1+Number(i)/100;return String(Number(n)*e)}if(e.includes("↘")){const e=1-Number(i)/100;return String(Number(n)*e)}const u=Number(r)||Number(n);if(e.includes("maxValue")){const e=Number(a),n=l?e:e*("sell"===s?1:1-jr);return String("buy"===s&&t?n/u:n)}return t?String(Number(e)/u):e}(e,"sell"===o.value?p:d,c,y,!s.value,i.value,o.value))}),[F,o.value,p,d,c,y,s.value,i.value]);return(0,ka.jsx)(Ui,{suggestedValues:v,onPress:h,compact:l,"data-element":"LimitOrderSuggestionButtons","data-component":"LimitOrderSuggestionSectionContent"})}function $i(e){return(0,ka.jsx)(Fn.Z,{owner:"simple-trade",fallback:()=>(0,ka.jsx)(Ui,{suggestedValues:zi,onPress:fi()}),context:"limit_order","data-element":"ErrorBoundary","data-component":"LimitOrderSuggestionSection",children:(0,ka.jsx)(vn.Z,{owner:"simple-trade",fallback:()=>(0,ka.jsx)(Ui,{suggestedValues:zi,onPress:fi()}),boundaryName:"LimitOrderSuggestionSection",context:"limit_order","data-element":"NetworkErrorBoundary",children:(0,ka.jsx)(Ji,{...e,"data-element":"LimitOrderSuggestionSectionContent"})})})}const Yi=(0,E.memo)($i);function Xi({queryRef:e,viewerAssetRef:a}){const n=(0,W.Jc)(ni,e),l=(0,W.Jc)(ei,a),{transferType:t,currentFocus:r}=(0,N.jf)(ke.cr),{buttonToUse:s,error:i}=gi(l),u=(0,E.useMemo)((()=>Gi(t.value,"amount"===r.value)),[t.value,r.value]);switch(s){case"Error":return i?(0,ka.jsx)(wi,{action:i.action,viewerAssetRef:l}):null;case"Suggestion":return(0,ka.jsx)(Yi,{variant:u,queryRef:n,viewerAssetRef:l});case"Submit":return(0,ka.jsx)(_i,{queryRef:n,viewerAssetRef:l});default:return null}}const eu=(0,E.memo)(Xi),au={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputFieldsContentViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderAmountInputViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useHandleInputFieldChangeViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"002a19722c1efcda4d851c62cf860008"},nu=au,lu={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputFieldsContentFragment",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderAmountInputFragment"}],type:"Query",abstractKey:null,hash:"b6a7b05d087156cd07dd8196355b0583"},tu=lu,ru={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderAmountInputViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useConvertIncrementToPrecisionFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderSuggestionSectionViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"LimitOrderInputFieldSublineViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"a93023c59953e0c28c17f1bfff21e93b"},su=ru,iu={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderAmountInputFragment",selections:[{args:null,kind:"FragmentSpread",name:"LimitOrderSuggestionSectionFragment"}],type:"Query",abstractKey:null,hash:"cd3edca3915256b0f9f8520e83429cd2"},uu=iu;var ou=n(3653),cu=n(3885),du=n(3652),mu=n(16),gu=n(3621),pu=n(3629),yu=n(3680);const ku={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LimitOrderInputFieldSublineViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useLatestQuoteViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"6af66ffba4cebef41c8d64c64a6b6f98"},fu=ku;function bu({targetPrice:e,viewerAssetRef:a}){const n=(0,W.Jc)(fu,a),l=Number((0,di.z)(n))??0,{formatNumber:t}=(0,ya.Z)(),r=(0,E.useMemo)((()=>{const a=Number(e),n=a-l,r=0===a||0===l;let s="";return!r&&n<0?s="↘":!r&&n>0&&(s="↗"),{arrow:s,percentage:t(r?0:n/l,{style:"percent",maximumFractionDigits:1,minimumFractionDigits:1})}}),[t,l,e]);return(0,ka.jsx)(Nn.Box,{"data-element":"Box","data-component":"LimitOrderInputFieldSubline",children:(0,ka.jsx)(Rn.HStack,{gap:1,alignItems:"center","data-element":"HStack",children:(0,ka.jsxs)(_n.TextLabel2,{as:"p","data-element":"TextLabel2",children:[r.arrow," ",r.percentage]})})})}const Su=(0,E.memo)(bu);function Fu({code:e,amount:a,onPress:n,isVisibile:l=!0,precision:t=2}){const{trackEvent:r}=(0,Se.Z)(),s=(0,E.useCallback)((()=>{r("tapped_switch",{action:Q.Us.click,ComponentType:Q.re.button}),n?.()}),[n,r]),{formatNumber:i}=(0,ya.Z)(),u=(0,E.useMemo)((()=>(0,ka.jsxs)(Rn.HStack,{gap:1,children:[a&&(0,ka.jsx)(_n.TextLabel1,{as:"p",color:"primary",children:i(Number(a),{maximumFractionDigits:t})}),e&&(0,ka.jsx)(_n.TextLabel1,{as:"p",color:"primary",children:e})]})),[a,e,i,t]);return(0,ka.jsx)(Nn.Box,{visibility:l?"visible":"hidden","data-element":"Box","data-component":"LimitOrderInputFieldSwapButton",children:(0,ka.jsx)(Ms.Pressable,{onPress:s,backgroundColor:"transparent","data-element":"Pressable",children:(0,ka.jsxs)(Rn.HStack,{gap:1,alignItems:"center","data-element":"HStack",children:[(0,ka.jsx)(Bt.Icon,{name:"arrowsVertical",size:"xs",color:"primary","data-element":"Icon"}),u]})})})}const vu=(0,E.memo)(Fu),hu=(0,pa.vU)({amount:{id:"LimitOrderAmountInput.amount",defaultMessage:"Amount"},targetPrice:{id:"LimitOrderAmountInput.targetPrice",defaultMessage:"Target price"}});function Cu({symbol:e,displaySymbol:a,fiatAmount:n,cryptoAmount:l,onBlur:t,onChange:r,noCommas:s,type:i="amount",isFocused:u,onFocus:o,autoFocus:c=!1,targetPriceValue:d="",isFiatInput:m,transferType:g,onSwapButtonPress:p,queryRef:y,viewerAssetRef:k}){const f=(0,W.Jc)(uu,y),b=(0,W.Jc)(su,k),{formatNumber:S,locale:F,formatMessage:v}=(0,ya.Z)(),{decimalSeparator:h,groupSeparator:C}=(0,E.useMemo)((()=>(0,du.Z)({locale:F})),[F]),{fiatPrecision:T,cryptoPrecision:A}=(0,Tr.h)(b),K=(0,pu.Z)(),x=m&&K,w=m?n:l,B=m?T:A,L=(0,E.useCallback)((e=>{r(e??"",i)}),[r,i]),I=(0,E.useMemo)((()=>"amount"===i?w:d),[d,i,w]),P="target_price"===i?T:B,R=(0,E.useMemo)((()=>{const e="amount"===i?w:d;return function(e){return Math.floor(e)===e?0:e.toString().split(".")[1]?.length||0}(Number(e))>P?S(Number(e),{maximumFractionDigits:P}):e}),[i,w,d,P,S]),M=(0,E.useMemo)((()=>"amount"===i?m?e:a??"":e),[a,m,e,i]),{displayLocalizedValue:_,handleLocalizedChange:V,handleLocalizedBlur:D,updateInputCursorPosition:j,clearFormattedValue:N}=(0,gu.Z)({value:I,decimalSeparator:h,fiatPrecision:T,onBlur:t,onChange:L,newLocalizedCurrencyInput:x}),O=s?R:(0,yu.Z)(R,h,C),{displayValue:Z,handleChange:U,handleBlur:q,handleUpdateInputCallback:Q,handleClearFormattedValue:H}=(0,E.useMemo)((()=>x?{displayValue:_,handleChange:V,handleBlur:D,handleUpdateInputCallback:j,handleClearFormattedValue:N}:{displayValue:O,handleChange:L,handleBlur:t}),[x,_,O,V,L,D,t,j,N]),z=(0,E.useCallback)((()=>{o?.(i)}),[o,i]),G=(0,E.useMemo)((()=>Gi(g,!1)),[g]),J=(0,E.useMemo)((()=>{if("target_price"===i)return(0,ka.jsxs)(En.VStack,{visibility:u?"visible":"hidden",gap:2,children:[(0,ka.jsx)(Su,{viewerAssetRef:b,targetPrice:d}),(0,ka.jsx)(Yi,{variant:G,queryRef:f,viewerAssetRef:b,compact:!0})]});{const t=0!==Number(d)?m?l:n:void 0;return(0,ka.jsx)(vu,{code:m?a??"":e,amount:t,onPress:p,isVisibile:u,precision:m?A:T})}}),[l,A,a,n,T,m,u,p,f,b,G,e,d,i]),$=(0,E.useMemo)((()=>(0,ka.jsx)(ou.B9,{...(0,cu.Z)({formatNumber:S,currency:M,isNewDesign:!0,isCrypto:!m}),placeholder:"0",value:Z,onChange:U,onBlur:q,updateInputCallback:Q,clearFormattedValue:H,onFocus:z,align:"flex-start",color:mu.palette.foreground,symbolColor:mu.palette.foregroundMuted,autoFocus:c,maxWidth:330,precision:P,ariaLabel:v("amount"===i?hu.amount:hu.targetPrice)})),[M,c,Z,v,S,q,U,H,z,Q,P,m,i]);return(0,ka.jsxs)(En.VStack,{gap:.5,"data-element":"VStack","data-component":"LimitOrderAmountInput",children:[$,J]})}const Tu=(0,E.memo)(Cu),Au=(0,pa.vU)({amountInputTitle:{id:"SimpleLimitOrderInput.amountInputTitle",defaultMessage:"Amount"},targetPriceTitle:{id:"SimpleLimitOrderInput.targetPriceTitle",defaultMessage:"When price reaches"}});function Ku(e){const a=(0,W.Jc)(tu,e.queryRef),n=(0,W.Jc)(nu,e.viewerAssetRef),{inputFiatAmount:l,inputCryptoAmount:t,targetPrice:r,isFiatInput:s,currentFocus:i,transferType:u}=(0,N.jf)(ke.cr),{formatMessage:o}=(0,ya.Z)(),{trackEvent:c}=(0,Se.Z)(),d=(0,E.useCallback)((e=>{"target_price"===e&&c("tapped_limit_price",{action:Q.Us.focus,componentType:Q.re.text_input}),i.onChange(e)}),[i,c]),{handleInputAmountChange:m,handleTargetAmountChange:g}=Ci(n),p=(0,E.useCallback)(((e,a)=>{c("tapped_numpad",{action:Q.Us.keyPress,componentType:Q.re.text_input}),"amount"===a?m(e??""):"target_price"===a&&g(e??"")}),[m,g,c]),y=(0,E.useCallback)((()=>{s.onChange(!s.value)}),[s]),k={...e,onChange:p,onFocus:d,targetPriceValue:r.value,isFiatInput:s.value,fiatAmount:l.value,cryptoAmount:t.value,transferType:u.value,queryRef:a,viewerAssetRef:n};return(0,ka.jsxs)(En.VStack,{"data-element":"VStack","data-component":"LimitOrderInputFieldsContent",children:[(0,ka.jsx)(Nn.Box,{spacingBottom:.5,"data-element":"Box",children:(0,ka.jsx)(_n.TextBody,{as:"p","data-element":"TextBody",children:o(Au.amountInputTitle)})}),(0,ka.jsx)(Tu,{type:"amount",isFocused:"amount"===i.value,autoFocus:!0,onSwapButtonPress:y,...k,"data-element":"LimitOrderAmountInput"}),(0,ka.jsx)(Mn.Spacer,{vertical:4,"data-element":"Spacer"}),(0,ka.jsx)(Nn.Box,{"data-element":"Box",children:(0,ka.jsx)(_n.TextBody,{as:"p","data-element":"TextBody",children:o(Au.targetPriceTitle)})}),(0,ka.jsx)(Tu,{type:"target_price",isFocused:"target_price"===i.value,...k,"data-element":"LimitOrderAmountInput"})]})}const xu=(0,E.memo)(Ku);function wu({queryRef:e,viewerAssetRef:a,closeModal:n}){const l=(0,W.Jc)(fs,e),t=(0,W.Jc)(ys,a),{renderTabs:r}=(0,E.useContext)(Rl.xk),s=(0,Na.Z)().currency,i=t.asset.displaySymbol??"",u=(0,hs.Z)({isNewDesign:!0,viewerAssetRef:t}),o=(0,E.useMemo)((()=>r?.()??null),[r]),c=(0,Ll.Z)()&&!!n,{depositRequirements:d}=(0,N.jf)(ke.cr),{trackEvent:m}=(0,Se.Z)();(0,E.useEffect)((()=>{d.onChange(void 0),m("viewed",{action:Q.Us.render,componentType:Q.re.modal})}),[]);const g=(0,E.useMemo)((()=>c?n:void 0),[c,n]),p=(0,E.useMemo)((()=>c?{goBack:g}:null),[g,c]);return(0,ka.jsxs)(ka.Fragment,{children:[o,p&&(0,ka.jsx)(G.h4,{...p}),(0,ka.jsxs)(vs.Z,{paddingTopDesktop:Fs.wG,paddingTopMobile:Fs.wG,paddingBottom:Fs.wG,paddingLeft:0,paddingRight:0,children:[(0,ka.jsxs)(qe.VStack,{spacingHorizontal:3,children:[(0,ka.jsx)(qe.Box,{alignSelf:"flex-end",spacingBottom:1,children:(0,ka.jsx)(Cs.Z,{showOrderTypeSelector:!0})}),(0,ka.jsx)(xu,{symbol:s,displaySymbol:i,queryRef:l,viewerAssetRef:t})]}),(0,ka.jsx)(G.JM,{leftColumnWidth:0,...u,isLimitOrder:!0}),(0,ka.jsx)(eu,{queryRef:l,viewerAssetRef:t}),(0,ka.jsx)(Ys,{queryRef:l,viewerAssetRef:t})]})]})}function Bu(e){return(0,ka.jsx)(W.zq,{instrumentationId:"LimitOrderInputStep",fallback:(0,ka.jsx)(Lu,{}),"data-element":"InstrumentedSuspense","data-component":"LimitOrderInputStep",children:(0,ka.jsx)(q.SV,{owner:"simple-trade",context:"limit_order_input","data-element":"ErrorBoundary",children:(0,ka.jsx)(wu,{...e,"data-element":"LimitOrderInputStepContent"})})})}function Lu(){return(0,ka.jsx)(Iu,{"data-element":"Container","data-component":"LimitOrderFallback",children:(0,ka.jsx)(Ss.Spinner,{size:5,color:"primary","data-element":"Spinner"})})}function Iu({children:e}){const a=(0,bs.Z)("phone");return(0,ka.jsx)(qe.Box,{alignItems:"center",background:"background",bordered:!0,borderColor:"line",borderRadius:"roundedSmall",justifyContent:"center",minHeight:a?350:Fs.Qd,flexGrow:1,flexShrink:1,flexBasis:"auto",spacingStart:3,spacingEnd:3,"data-element":"Box","data-component":"Container",children:e})}const Pu=(0,E.memo)(Bu),Ru=function(){var e={defaultValue:null,kind:"LocalArgument",name:"accountId"},a={defaultValue:null,kind:"LocalArgument",name:"transferId"},n=[{kind:"Variable",name:"uuid",variableName:"accountId"}],l=[{kind:"Variable",name:"uuid",variableName:"transferId"}],t={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},r={alias:null,args:null,concreteType:"VerificationPayload",kind:"LinkedField",name:"verification",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"verificationStatus",storageKey:null}],storageKey:null},s={alias:null,args:null,concreteType:"TransferCancelReason",kind:"LinkedField",name:"cancelReason",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[e,a],kind:"Fragment",metadata:null,name:"OpenBankingQrCodeStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[t,r,s],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,e],kind:"Operation",name:"OpenBankingQrCodeStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferBuy",kind:"LinkedField",name:"buyByUuid",plural:!1,selections:[t,r,s,i],storageKey:null},i],storageKey:null},i],storageKey:null}]},params:{id:"3824266ce5644f0e250d76916421c531e7709c6341352c2f0238f4f775c962e9",metadata:{},name:"OpenBankingQrCodeStepQuery",operationKind:"query",text:null}}}();Ru.hash="45d38df4e757f52cc8dc2cc23830c981";const Mu=Ru;var Eu=n(3576),_u=n.n(Eu),Vu=n(3913),Du=n(495),ju=n(136),Nu=n(1613);const Ou=(0,pa.vU)({header:{id:"OpenBankingQrCodeStep.header",defaultMessage:"Complete payment"},timerWarning:{id:"OpenBankingQrCodeStep.timerWarning",defaultMessage:"Complete the payment within the time limit to avoid cancellation"},scanQRCode:{id:"OpenBankingQrCodeStep.scanQRCode",defaultMessage:"Scan the QR code on your mobile device"},authorisePayment:{id:"OpenBankingQrCodeStep.authorisePayment",defaultMessage:"Authorise the payment on your banking app or website"},returnToDevice:{id:"OpenBankingQrCodeStep.returnToDevice",defaultMessage:"Once authorised, return to this device"},continueWithDesktop:{id:"OpenBankingQrCodeStep.continueWithDesktop",defaultMessage:"Skip this and continue on desktop"},completePaymentInstructions:{id:"OpenBankingQrCodeStep.completePaymentInstructions",defaultMessage:"Tap on <b>Complete payment</b> and authorise the payment on your banking app or website"},returnToCoinbase:{id:"OpenBankingQrCodeStep.returnToCoinbase",defaultMessage:"Once authorised, return to Coinbase"},completePayment:{id:"OpenBankingQrCodeStep.completePayment",defaultMessage:"Complete payment"}}),Zu="OpenBankingAuth";function Uu(){const[e,a]=(0,E.useState)(!1),[n,l]=(0,E.useState)(null),{formatMessage:t}=(0,ya.Z)(),{buyCommitResponse:r,buyWaitTimerResponse:s,openBankingRedirectUrl:i,activeAccountUuid:u}=(0,N.jf)(ke.cr),{goToStep:o,goBack:c}=(0,ae.tC)(ke.Ex),d=(0,an.Z)(),m=r?.value?.uuid,g=(0,Ll.Z)(),p=(0,E.useMemo)((()=>[{title:t(Ou.scanQRCode)},{title:t(Ou.authorisePayment)},{title:t(Ou.returnToDevice)}]),[t]),y=(0,E.useMemo)((()=>[{title:t(Ou.completePaymentInstructions,{b:e=>(0,ka.jsx)("b",{children:e})})},{title:t(Ou.returnToCoinbase)}]),[t]),k=(0,E.useCallback)((0,D.throttle)((async()=>{if(!e&&(a(!0),m))try{const e=await d(Mu,{transferId:m,accountId:u.value}),a=e.viewer.accountByUuidV2,n=a?.buyByUuid?.status,l=a?.buyByUuid?.verification?.verificationStatus;"COMPLETED"!==n&&"CANCELED"!==n&&"AUTHORIZED"!==l||((0,Q.Kz)("ob_buy_navigating_to_buy_status",{componentType:Q.re.modal,action:Q.Us.measurement,transferId:m,status:n}),o("buyStatus"),s.onChange(e))}catch(e){(0,q.cB)((0,Ra.Xv)(e),{owner:"trading",context:"buy_sell"})}}),3e3),[]);(0,Q.bH)("ob_buy_qr_code_step",{componentType:Q.re.modal,action:Q.Us.view});const{timeRemaining:f}=(0,wt.J)({duration:45e4,onStep:k,onTimerEnd:()=>{o("buyStatus")}}),b=(0,E.useCallback)((()=>{(0,Q.Kz)("ob_buy_qr_code_step_back_click",{componentType:Q.re.icon,action:Q.Us.click}),c()}),[c]);(0,E.useEffect)((()=>(localStorage.removeItem(Zu),()=>{localStorage.removeItem(Zu)})),[]),(0,Vu.Z)("storage",(()=>{n&&"CLOSE"===localStorage.getItem(Zu)&&((0,Q.Kz)("ob_buy_auto_tab_close",{componentType:Q.re.modal,action:Q.Us.measurement,transferId:m}),localStorage.removeItem(Zu),n.close(),l(null),o("buyStatus"))}));const S=e=>{if(e&&e.preventDefault(),i.value){(0,Q.Kz)("ob_buy_contiue_on_desktop",{componentType:Q.re.link,action:Q.Us.click,transferId:m});const e=window.open(i.value,"_blank");l(e),localStorage.setItem(Zu,"OPEN")}};return(0,ka.jsxs)(En.VStack,{flexGrow:1,width:"100%","data-element":"VStack","data-component":"OpenBankingQrCodeStep",children:[(0,ka.jsx)(G.h4,{goBack:b,title:t(Ou.header),"data-element":"Header"}),(0,ka.jsx)(G.jQ,{"data-element":"HorizontalPadding",children:(0,ka.jsxs)(Nn.Box,{flexDirection:"row",spacingHorizontal:3,spacingVertical:2,borderRadius:"rounded",bordered:!0,alignItems:"center","data-element":"Box",children:[(0,ka.jsx)(Fi.TextLabel2,{as:"p","data-element":"TextLabel2",children:t(Ou.timerWarning)}),(0,ka.jsx)(Pt.Z,{timeRemaining:f,showTitle:!1,"data-element":"TimeRemaining"})]})}),g?(0,ka.jsx)(Nn.Box,{spacingTop:3,spacingBottom:4,width:"100%",justifyContent:"center",children:(0,ka.jsx)(Du.HeroSquare,{name:"bitcoinAndOtherCrypto",dimension:"200x200"})}):(0,ka.jsx)(En.VStack,{spacingVertical:3,alignItems:"center",justifyContent:"center",children:(0,ka.jsx)(Nn.Box,{spacing:1,borderRadius:"rounded",bordered:!0,children:(0,ka.jsx)(_u(),{id:"verification-url-qr",size:225,level:"L",includeMargin:!0,value:i.value})})}),(0,ka.jsxs)(G.jQ,{"data-element":"HorizontalPadding",children:[(0,ka.jsx)(Nu.Z,{timelineItems:g?y:p,"data-element":"TimeLine"}),(0,ka.jsx)(qe.Spacer,{vertical:4,"data-element":"Spacer"}),g?(0,ka.jsx)(qu,{children:(0,ka.jsx)(Ue.Button,{onPress:S,variant:"primary",block:!0,children:t(Ou.completePayment)})}):(0,ka.jsx)($t.Link,{openInNewWindow:!0,to:i.value,onClick:S,children:(0,ka.jsx)(ju.TextHeadline,{as:"h1",color:"primary",children:t(Ou.continueWithDesktop)})}),(0,ka.jsx)(qe.Spacer,{vertical:4,"data-element":"Spacer"})]})]})}const qu=j.ZP.div.withConfig({displayName:"OpenBankingQrCodeStep__ButtonContainer",componentId:"slwksa-0"})(["position:absolute;padding:0px 24px;bottom:24px;width:100%;"]),Qu=(0,E.memo)(Uu);var Hu=n(792),Wu=n(573);const zu=(0,pa.vU)({title:{id:"OrderTypeSelectStep.title",defaultMessage:"Order types"}}),Gu=["MARKET","LIMIT","RECURRING"];function Ju(){const{formatMessage:e}=(0,ya.Z)(),{goToStep:a,goBack:n}=(0,ae.tC)(ke.Ex),{orderType:l,recurringPeriod:t,transferType:r}=(0,N.jf)(ke.cr),{setRecurringOption:s}=(0,ye.D)(),{trackEvent:i}=(0,Se.Z)(),u=(0,E.useCallback)((e=>{i("_order_type_selected",{orderType:e}),"RECURRING"===e?a("recurringSelect"):(l.onChange(e),t.onChange("never"),s("never"),a("MARKET"===e?"entry":"limitOrderEntry"))}),[a,l,t,s,i]),o=(0,Wu.Z)();return(0,ka.jsxs)(Hu.V8,{"data-element":"StepWrapper","data-component":"OrderTypeSelectStep",children:[(0,ka.jsx)(sr.Z,{goBack:n,title:e(zu.title),"data-element":"Header"}),(0,ka.jsx)($u,{"data-element":"StyledInnerStepContent",children:Gu.map((e=>{if("sell"===r.value&&"RECURRING"===e)return null;const a=e===l.value,n=o(e);return(0,ka.jsx)(ss.ListCell,{as:"li",selected:a,variant:"foregroundMuted",onPress:()=>u(e),title:n?.title,description:n?.message,testID:`${e}-option`,multiline:!0},e)}))})]})}const $u=(0,j.ZP)(Hu.Nq).withConfig({displayName:"OrderTypeSelectStep__StyledInnerStepContent",componentId:"sc-1gc9112-0"})(["padding:0 ",";"],(e=>e.theme.size.medium)),Yu=(0,E.memo)(Ju);var Xu=n(3627),eo=n(276);function ao(){const{goToStep:e,previousStep:a}=(0,ae.tC)(ke.Ex),{transferType:n,cardStatus:l}=(0,N.jf)(ke.cr),{formattedPaymentMethods:t}=(0,pe.f)(),r=(0,ha.Z)(),{trackEvent:s}=(0,Se.Z)(),i=(0,eo.Z)(),u=(0,E.useMemo)((()=>"REJECTED"===l.value?"rejected":"DECLINED"===l.value?"declined":r.rejected?"rejected":"declined"),[l,r.rejected]);(0,E.useEffect)((()=>()=>l.onChange(void 0)),[]);const o=(0,E.useCallback)((()=>{i(),e("entry")}),[e,i]),c=(0,E.useCallback)((()=>{s("tapped_select_payment_method",{step:"entry"===a?.toString()?"order_input":"order_preview"}),e("selectPayment")}),[e,a,s]),d=!l.value;return(0,ka.jsx)(Xu.Z,{cardStatus:u,onAddAccountsSuccess:o,onAddAgainSuccess:d?o:void 0,onChangePaymentMethod:t.length>1?c:void 0,onGoBack:()=>e("entry"),paymentMethod:r,transferType:n.value,entryPoint:"buy_sell_payment_error","data-element":"PaymentError","data-component":"PaymentErrorStep"})}const no=(0,E.memo)(ao);var lo=n(3694);const to=(0,j.ZP)(lo.Z).withConfig({displayName:"PlaidRelinkStep__StyledPlaidRelink",componentId:"sc-1n6m8o3-0"})(["display:flex;flex-direction:column;flex:1 0 auto;justify-content:space-between;"]),ro=function(){const{goToStep:e}=(0,ae.tC)(ke.Ex),{trackEvent:a}=(0,Se.Z)();(0,E.useEffect)((()=>{a("BuySellStepper.PlaidRelink.presented")}),[]);const n=(0,E.useCallback)((()=>{e("entry")}),[e]),l=(0,Na.Z)();return(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G.h4,{goBack:n}),(0,ka.jsx)(G.RF,{paddingTopDesktop:8,paddingTopMobile:8,paddingBottom:24,children:(0,ka.jsx)(to,{"data-testid":"plaid-relink",paymentMethod:l,onRelinked:n})})]})};var so=n(1312);const io=function(){var e={defaultValue:null,kind:"LocalArgument",name:"accountId"},a={defaultValue:null,kind:"LocalArgument",name:"transferId"},n=[{kind:"Variable",name:"uuid",variableName:"accountId"}],l=[{kind:"Variable",name:"uuid",variableName:"transferId"}],t={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[e,a],kind:"Fragment",metadata:null,name:"ProcessingPayoutStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferSell",kind:"LinkedField",name:"sellByUuid",plural:!1,selections:[t,{alias:null,args:null,concreteType:"AccountHistoryEntry",kind:"LinkedField",name:"accountHistory",plural:!1,selections:[t],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,e],kind:"Operation",name:"ProcessingPayoutStepQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferSell",kind:"LinkedField",name:"sellByUuid",plural:!1,selections:[t,{alias:null,args:null,concreteType:"AccountHistoryEntry",kind:"LinkedField",name:"accountHistory",plural:!1,selections:[t,r],storageKey:null},r],storageKey:null},r],storageKey:null},r],storageKey:null}]},params:{id:"8a29a03cae9816e6558484d3a086e20cdbc1c77084b169d29a7726158dc1e551",metadata:{},name:"ProcessingPayoutStepQuery",operationKind:"query",text:null}}}();io.hash="fe7d7379a99accae2150146c94f60c51";const uo=io,oo={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ProcessingPayoutStepAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],type:"Account",abstractKey:null,hash:"423c7db2fb9952601ab1329d046fc5ad"},co=oo,mo=(0,pa.vU)({title:{id:"ProcessingPayout.title",defaultMessage:"Processing payout"},description:{id:"ProcessingPayout.description",defaultMessage:"Please wait while we process your payout. This may take 2-3 minutes."},goToSupport:{id:"ProcessingPayout.getSupport",defaultMessage:"Get Support"}});function go({accountRef:e}){const a=(0,W.Jc)(co,e),{formatMessage:n,locale:l}=(0,ya.Z)(),t=(0,an.Z)(),{sellCommitResponse:r}=(0,N.jf)(ke.cr),{goToStep:s}=(0,ae.tC)(ke.Ex),i=r.value?.uuid,{isInIndia:u}=(0,ta.Z)(),o=u?`https://help.coinbase.com/${l}/coinbase/trading-and-funding/buying-selling-or-converting-crypto/selling-crypto-india`:"https://help.coinbase.com/",c=(0,E.useCallback)((0,D.throttle)((async()=>{if(i)try{const e=(await t(uo,{transferId:i,accountId:a.uuid})).viewer.accountByUuidV2,n=e?.sellByUuid?.status;"CANCELED"!==n&&"COMPLETED"!==n||s("sellStatus")}catch(e){s("sellStatus")}}),5e3),[]),d=(0,E.useCallback)((()=>{s("sellStatus")}),[s]);return(0,wt.J)({duration:18e4,onStep:c,onTimerEnd:d}),(0,ka.jsxs)(qe.VStack,{alignItems:"flex-start",flexGrow:1,width:"100%",spacingTop:10,"data-element":"VStack","data-component":"ProcessingPayoutStep",children:[(0,ka.jsx)(qe.Box,{spacingTop:10,width:"100%",justifyContent:"center","data-element":"Box",children:(0,ka.jsx)(xt.HeroSquare,{name:"addMoreCrypto","data-element":"HeroSquare"})}),(0,ka.jsxs)(qe.VStack,{alignContent:"center",spacingHorizontal:4,spacingTop:10,width:"100%",alignItems:"center","data-element":"VStack",children:[(0,ka.jsx)(_n.TextHeadline,{as:"h3","data-element":"TextHeadline",children:n(mo.title)}),(0,ka.jsx)(_n.TextBody,{spacingTop:1,align:"center",as:"p","data-element":"TextBody",children:n(mo.description)}),(0,ka.jsx)(_n.Link,{target:"_blank",variant:"body",href:o,"data-element":"Link",children:n(mo.goToSupport)})]}),(0,ka.jsx)(qe.Spacer,{vertical:8,"data-element":"Spacer"})]})}const po=(0,E.memo)(go);var yo=n(1313);const ko={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"RecurringRewardTermsStepAssetOrCurrencyFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency",hash:"56e6d2b8ad8f6dc810fbe30674f6a233"},fo=ko,bo={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"RecurringRewardTermsStepAccountFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"bc122203c861add9801646ec5f75534b"},So=bo,Fo={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"RecurringRewardTermsStepragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"}],type:"Query",abstractKey:null,hash:"2ecf1a4981eca10efaa28ca6cee103d6"},vo=Fo;var ho=n(498);const Co=(0,pa.vU)({title:{id:"RecurringRewardTermsStep.title",defaultMessage:"Terms and conditions"},termsAndConditions:{id:"RecurringRewardTermsStep.termsAndConditions",defaultMessage:"• To receive this reward, complete the required number of recurring crypto buys. Only one reward per invited customer. Not available for USDC buys or if Coinbase finds gaming or fraudulent activity.<br></br><br></br>\n • Allow 5 days after your qualifying buy to receive reward, which will be paid in Bitcoin (BTC).<br></br><br></br>\n • Coinbase may cancel this offer at anytime prior to you scheduling recurring buys."},understand:{id:"RecurringRewardTermsStep.understand",defaultMessage:"I understand"}});function To({queryRef:e,accountRef:a,assetOrCurrencyRef:n,onDone:l}){const{formatMessage:t}=(0,ya.Z)(),r=(0,W.Jc)(vo,e),s=(0,W.Jc)(So,a),i=(0,W.Jc)(fo,n);return(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsxs)(Ao,{children:[(0,ka.jsxs)(Ko,{column:!0,auto:!0,align:"center",children:[(0,ka.jsx)(ho.h,{level:3,marginBottom:"lg",children:t(Co.title)}),(0,ka.jsx)(Ht.u,{color:"light",align:"left",children:t(Co.termsAndConditions,{br:()=>[(0,ka.jsx)("br",{})]})})]}),(0,ka.jsx)(xo,{column:!0,bottomPadded:!0,children:(0,ka.jsx)(Il.Button,{block:!0,onPress:l,variant:"secondary",children:t(Co.understand)})})]}),(0,ka.jsx)(Sa.Z,{queryRef:r,accountRef:s,assetOrCurrencyRef:i,entryPoint:"unsupported"})]})}const Ao=(0,j.ZP)(Oe.Z).attrs((()=>({column:!0,auto:!0,justify:"space-between"}))).withConfig({displayName:"RecurringRewardTermsStep__PaddedContent",componentId:"oqihga-0"})(["position:relative;flex:1;flex-shrink:0;padding:","px ","px 0 ","px;"],Fs.Wh,Fs.Wh,Fs.Wh),Ko=(0,j.ZP)(Oe.Z).withConfig({displayName:"RecurringRewardTermsStep__TopContent",componentId:"oqihga-1"})(["text-align:center;"]),xo=(0,j.ZP)(Oe.Z).withConfig({displayName:"RecurringRewardTermsStep__BottomContent",componentId:"oqihga-2"})(["",";padding-top:","px;"],(e=>e.bottomPadded&&`padding-bottom: ${Fs.Wh}px`),Fs.Wh),wo=(0,E.memo)(To);var Bo=n(1314),Lo=n(749),Io=n(954);const Po={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellStatusStepViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"9b5fdee2a6ebd050b759eb7722e2f36f"},Ro=Po,Mo={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellStatusStepAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{args:null,kind:"FragmentSpread",name:"useSellStatusFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"6161166ee7bb3018d9cf812f744e0415"},Eo=Mo,_o={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellStatusStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"},{args:null,kind:"FragmentSpread",name:"StatusStepFragment"},{kind:"InlineDataFragmentSpread",name:"isEligibleForSubscriptionFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"eligibleEntities",value:["COINBASE_ONE_GENERAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEligible",storageKey:null}],storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["COINBASE_ONE_GENERAL"])'}],storageKey:null}],args:null,argumentDefinitions:[]}],type:"Query",abstractKey:null,hash:"974658de8a033ec5ceedf8e45307ac51"},Vo=_o;var Do=n(3657),jo=n(856);const No=function(){var e={defaultValue:null,kind:"LocalArgument",name:"accountId"},a={defaultValue:null,kind:"LocalArgument",name:"transferId"},n=[{kind:"Variable",name:"uuid",variableName:"accountId"}],l=[{kind:"Variable",name:"uuid",variableName:"transferId"}],t={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[e,a],kind:"Fragment",metadata:null,name:"useSellStatusQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferSell",kind:"LinkedField",name:"sellByUuid",plural:!1,selections:[t],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,e],kind:"Operation",name:"useSellStatusQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:n,concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:l,concreteType:"TransferSell",kind:"LinkedField",name:"sellByUuid",plural:!1,selections:[t,r],storageKey:null},r],storageKey:null},r],storageKey:null}]},params:{id:"337b323a1cb5e26d0984b9d5db5e33768862417b3eab77d90801910692be32a6",metadata:{},name:"useSellStatusQuery",operationKind:"query",text:null}}}();No.hash="5b82477fa418b61c82ee3394615c76a1";const Oo=No,Zo={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSellStatusFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],type:"Account",abstractKey:null,hash:"97ad21e5fa7c11dc79747f29f8071c8b"},Uo=Zo;function qo({accountRef:e,transferId:a,maxPollAttempts:n,retryDelayMilliseconds:l}){const t=(0,W.Jc)(Uo,e),[r,s]=(0,E.useState)(),i=(0,Xa.Z)(),u=(0,an.Z)(),o=(0,E.useCallback)((()=>{i({maxPollAttempts:n??6,retryDelayMilliseconds:l,resource:async()=>u(Oo,{transferId:a,accountId:t.uuid}),onResponse:e=>{const a=e.viewer.accountByUuidV2,n=a?.sellByUuid?.status;switch(n){case"COMPLETED":return{type:"Result",result:"completed"};case"CANCELED":return{type:"Result",result:"canceled"};default:return{type:"ContinuePolling"}}},onComplete:e=>{const a="Success"===e.type?"success":"MaxRetries"===e.type?"pending":"failure";switch((0,Q.Kz)("sell_transaction_complete",{action:Q.Us.measurement,componentType:Q.re.page,status:a}),e.type){case"Success":s(e.result);break;case"MaxRetries":s("created");break;default:s("canceled")}}})}),[t.uuid,u,n,i,l,a]);return(0,E.useEffect)((()=>{o()}),[]),r}function Qo({queryRef:e,accountRef:a,viewerAssetRef:n,closeModal:l,onComplete:t,showStatusHeaderClose:r,assetName:s,isFreeTradePromoCodeEligible:i=!1,forceHideCbOneSubscriptionUpsell:u}){const o=(0,W.Jc)(Vo,e),c=(0,W.Jc)(Eo,a),d=(0,W.Jc)(Ro,n),m=(0,Ia.k6)(),g=(0,Ll.Z)(),{goToStep:p}=(0,ae.tC)(ke.Ex),y=(0,q.$T)(),{trackEvent:k}=(0,Se.Z)(),{endTradePerfMark:f}=(0,ql.Z)(),b=(0,jo.D)(o),{isCoinbaseOneSubscriber:S}=(0,pe.f)(),{eventContext:F,tradeComplete:v,sellCommitResponse:h,sellQuoteResponse:C,transferType:T}=(0,N.jf)(ke.cr),A=h.value;V()(A,"There should be a commit response");const K=qo({accountRef:c,transferId:A.uuid}),x=(0,Yl.Z)(),w=(0,E.useCallback)((e=>{v.onChange(!0),"success"===e&&x()}),[v,x]),B=(0,E.useCallback)((()=>{l&&l()}),[l]),L=(0,E.useCallback)((()=>{const e=d.asset.slug;g&&"assetPage"===F.value&&e?m.push((0,Ul.pW)(e)):(l&&l(),p("entry"))}),[d.asset,g,F.value,m,l,p]),I=(0,E.useCallback)((()=>{f("status","sell"),(0,Q.$Y)("loaded_sell_order_confirmation_temp_eitri_exp")}),[f]),P=(0,E.useMemo)((()=>{const e=C.value;return b&&!u&&Number(e?.transferSell.fee?.value||"0")>0?(0,ka.jsx)(Do.Z,{closeModal:l,isSubscribed:S}):null}),[C.value,b,u,l,S]),R=(0,E.useMemo)((()=>({status:K,type:T.value,sourceAmount:y({amount:A.amount,isFiat:!1}),targetCurrency:A.amount.currency,accountId:c.uuid,isCommitting:!1,assetName:s})),[c.uuid,y,A.amount,K,T.value,s]),M=(0,E.useCallback)((()=>p("entry")),[p]),_=(0,E.useMemo)((()=>(0,ka.jsx)(Sa.Z,{queryRef:o,accountRef:c,assetOrCurrencyRef:d,entryPoint:"sell"})),[d,c,o]);return(0,ka.jsxs)(ka.Fragment,{children:[(0,ka.jsx)(G._,{tradeData:R,onComplete:t,onRetry:M,onViewTransaction:B,onClose:L,onAnimationEnd:w,trackEvent:k,footer:_,banner:P,showStatusHeaderClose:r,onViewedStatus:I,isFreeTradePromoCodeEligible:i,queryRef:o}),(0,ka.jsx)(ct.Z,{tradeType:"sell",assetId:d.asset.uuid,assetSymbol:d.asset.platformName})]})}const Ho=(0,E.memo)(Qo),Wo={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellStatusStepDeprecatedFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"9946769bfba1e2725328489fb4cb0a93"},zo=Wo,Go={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellStatusStepDeprecatedAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{args:null,kind:"FragmentSpread",name:"useSellStatusFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"d3938019aa2ed80f71c6085cde4d8ed4"},Jo=Go,$o={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellStatusStepDeprecatedViewerFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"},{args:null,kind:"FragmentSpread",name:"StatusStepDeprecatedFragment"},{kind:"InlineDataFragmentSpread",name:"isEligibleForSubscriptionFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"eligibleEntities",value:["COINBASE_ONE_GENERAL"]}],concreteType:"CoinbaseSubscriptionEligibileEntityStatus",kind:"LinkedField",name:"coinbaseSubscriptionEligibility",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEligible",storageKey:null}],storageKey:'coinbaseSubscriptionEligibility(eligibleEntities:["COINBASE_ONE_GENERAL"])'}],storageKey:null}],args:null,argumentDefinitions:[]}],type:"Query",abstractKey:null,hash:"bb090ab69b5c5b91a98b97e620998e4c"},Yo=$o;function Xo({queryRef:e,accountRef:a,viewerAssetRef:n,closeModal:l,onComplete:t,showStatusHeaderClose:r,assetName:s,isFreeTradePromoCodeEligible:i=!1,forceHideCbOneSubscriptionUpsell:u}){const o=(0,W.Jc)(Yo,e),c=(0,W.Jc)(Jo,a),d=(0,W.Jc)(zo,n),m=(0,Ia.k6)(),g=(0,Ll.Z)(),{goToStep:p}=(0,ae.tC)(ke.Ex),y=(0,q.$T)(),{trackEvent:k}=(0,Se.Z)(),{endTradePerfMark:f}=(0,ql.Z)(),b=(0,jo.D)(o),{isCoinbaseOneSubscriber:S}=(0,pe.f)(),{eventContext:F,tradeComplete:v,sellCommitResponse:h,transferType:C,sellQuoteResponse:T}=(0,N.jf)(ke.cr),A=h.value;V()(A,"There should be a commit response");const K=qo({accountRef:c,transferId:A.uuid}),x=(0,Yl.Z)(),w=(0,E.useCallback)((e=>{v.onChange(!0),"success"===e&&x()}),[v,x]),B=(0,E.useCallback)((()=>{l&&l()}),[l]),L=(0,E.useCallback)((()=>{const e=d.asset.slug;g&&"assetPage"===F.value&&e?m.push((0,Ul.pW)(e)):(l&&l(),p("entry"))}),[d.asset,g,F.value,m,l,p]),I=(0,E.useCallback)((()=>{f("status","sell"),(0,Q.$Y)("loaded_sell_order_confirmation")}),[f]),P=(0,E.useMemo)((()=>{const e=T.value;return b&&!u&&Number(e?.transferSell.fee?.value||"0")>0?(0,ka.jsx)(Do.Z,{closeModal:l,isSubscribed:S}):null}),[T.value,b,u,l,S]),R=(0,E.useMemo)((()=>({status:K,type:C.value,sourceAmount:y({amount:A.amount,isFiat:!1}),targetCurrency:A.amount.currency,accountId:c.uuid,isCommitting:!1,assetName:s})),[c.uuid,y,A.amount,K,C.value,s]);return(0,Ft.e)("COMPLETE_ASSET_BUY","sell",{uuid:d.asset.uuid,symbol:d.asset.platformName}),(0,ka.jsx)(G.kU,{tradeData:R,onComplete:t,onRetry:()=>p("entry"),onViewTransaction:B,onClose:L,onAnimationEnd:w,trackEvent:k,footer:(0,ka.jsx)(Sa.Z,{queryRef:o,accountRef:c,assetOrCurrencyRef:d,entryPoint:"sell"}),banner:P,showStatusHeaderClose:r,onViewedStatus:I,isFreeTradePromoCodeEligible:i,queryRef:o,"data-element":"SharedStatusStep","data-component":"StatusStepDeprecated"})}const ec=(0,E.memo)(Xo);var ac=n(1614);const nc=(0,pa.vU)({tdsTitle:{id:"SellTaxInfo.tdsTitle",defaultMessage:"About TDS"},tdsContent:{id:"SellTaxInfo.tdsContent",defaultMessage:"The government of India mandates you pay TDS (tax deducted at source) on all conversions and sales of crypto."},learnMore:{id:"SellTaxInfo.learnMore",defaultMessage:"Learn more"},gstTitle:{id:"SellTaxInfo.gstTitle",defaultMessage:"About GST"},auGstContent:{id:"SellTaxInfo.auGstContent",defaultMessage:"The government of Australia mandates a 10% GST (Goods & Services Tax) on all transfers and sales of crypto."},sgGstContent:{id:"SellTaxInfo.sgGstContent",defaultMessage:"The government of Singapore mandates a GST (Goods and Services Tax) on crypto transactions."}});function lc({taxType:e}){const{goBack:a}=(0,ae.tC)(ke.Ex),{formatMessage:n}=(0,ya.Z)(),l=(0,E.useMemo)((()=>{switch(e){case"INDIA_WITHHOLDING":return{title:n(nc.tdsTitle),content:n(nc.tdsContent),helpUrl:ac.gJ};case"AUSTRALIA_GST":return{title:n(nc.gstTitle),content:n(nc.auGstContent),helpUrl:ac.B7};case"SINGAPORE_GST":return{title:n(nc.gstTitle),content:n(nc.sgGstContent),helpUrl:ac.VT};default:return{}}}),[n,e]);return e?(0,ka.jsx)(er.Z,{onBackPress:a,headerTitle:(0,ka.jsx)(tc,{goBack:a,title:l?.title}),message:(0,ka.jsxs)(Yt.TextBody,{as:"p",color:"foregroundMuted",overflow:"clip",children:[l?.content,"\n"]}),ctaUrl:l?.helpUrl,ctaText:n(nc.learnMore),"data-element":"InfoStep","data-component":"TaxInfoStep"},"taxInfo"):null}const tc=(0,j.ZP)(G.h4).withConfig({displayName:"TaxInfoStep__StyledHeader",componentId:"b3himx-0"})(["h3{text-align:center;}"]),rc=(0,E.memo)(lc),sc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UnstakingInfoStepFragment",selections:[{alias:null,args:null,concreteType:"Staking",kind:"LinkedField",name:"staking",plural:!1,selections:[{alias:null,args:null,concreteType:"StakingBuyAndStakeInfo",kind:"LinkedField",name:"buyAndStakeInfo",plural:!1,selections:[{alias:null,args:null,concreteType:"StakeDetails",kind:"LinkedField",name:"unstakingPeriod",plural:!1,selections:[{alias:null,args:null,concreteType:"StakingInfoTray",kind:"LinkedField",name:"infoTray",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"f7d7840afd7746f3b89a3995a3996138"},ic=sc;function uc({viewerAssetRef:e}){const{goBack:a}=(0,ae.tC)(ke.Ex),n=(0,W.Jc)(ic,e),l=n?.staking?.buyAndStakeInfo?.unstakingPeriod?.infoTray;return(0,ka.jsx)(er.Z,{onBackPress:a,headerTitle:l?.title??"",message:l?.description??"",ctaUrl:l?.link?.url??"",ctaText:l?.link?.text??"","data-element":"InfoStep","data-component":"UnstakingInfoStep"})}const oc=(0,E.memo)(uc),cc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"WBLStepAssetOrCurrencyFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency",hash:"bb8800c43abac2e6e39dc7ddebecc676"},dc=cc,mc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"WBLStepAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"}],type:"Account",abstractKey:null,hash:"b6157a5f128389257dbe47adc50dc584"},gc=mc,pc={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"WBLStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"}],type:"Query",abstractKey:null,hash:"d64c6816c2763283e566862a55f3a534"},yc=pc;var kc=n(3644),fc=n(3665);const bc=(0,pa.vU)({ackButton:{id:"WBLStep.ackButton",defaultMessage:"Got it"}});function Sc({assetOrCurrencyRef:e,queryRef:a,accountRef:n,onComplete:l}){const t=(0,W.Jc)(yc,a),r=(0,W.Jc)(gc,n),s=(0,W.Jc)(dc,e),{formatMessage:i}=(0,ya.Z)(),{buyCommitResponse:u}=(0,N.jf)(ke.cr),o=(0,Y._x)(),c=u.value;V()(c,"Commit data should be defined");const d=(0,E.useCallback)((()=>{o&&o()}),[o]),m=!!c.commitNotice,g=(0,E.useMemo)((()=>m?(V()(c.commitNotice,"instant ach data should be present"),{header:c.commitNotice.title,body:c.commitNotice.description}):(V()(c.wblUxData,"wbl data should be present"),{header:c.wblUxData.title,body:c.wblUxData.description})),[m,c.commitNotice,c.wblUxData]),p=(0,E.useMemo)((()=>{if(m)return(0,ka.jsx)(Ue.Button,{block:!0,variant:"secondary",onPress:o,children:i(bc.ackButton)});const e={type:"buy",accountId:r.uuid};return(0,ka.jsx)(kc.Ch,{buttonType:"success",tradeData:e,onViewTransaction:d,onComplete:l})}),[m,r.uuid,d,l,o,i]),y=(0,E.useMemo)((()=>(0,ka.jsx)(Sa.Z,{queryRef:t,accountRef:r,assetOrCurrencyRef:s,entryPoint:"unsupported"})),[s,t,r]);return(0,ka.jsx)(fc.Z,{heroName:m?"sendCryptoFaster":"tradeImmediately",content:g,ctas:p,footer:y,"data-element":"HeroInterstitial","data-component":"WBLStep"})}const Fc=(0,E.memo)(Sc);var vc=n(874),hc=n(558);const Cc=90,Tc=(0,E.memo)((function({queryRef:e,viewerAssetRefs:a,isVisible:n=!0,closeModal:l,onComplete:t,onTransferTypeChange:r,openRecurrence:s,recurringPeriod:i,initialInputAmount:u,showStatusHeaderClose:o=!0,assetName:c,skipToBuyStatus:d,isFreeTradePromoCodeEligible:m,disableAssetSelectors:g,disableSourceAssetSelection:p,totalNativeBalance:y,forceHideCbOneSubscriptionUpsell:k=!1,entryStepAssetSelectorLabelOverride:f,entryStepModalHeaderTitle:b,transferType:S,eventContext:F}){const v=(0,ge.T)(),{activePaymentMethodId:h,assetId:C,amount:T,recurringPeriod:A,orderType:K,tradeComplete:x,acceptDisclosureForAllExperimentalAssets:w,buyQuoteResponse:B,sellQuoteResponse:L}=(0,N.jf)(ke.cr),I=(0,W.Jc)(M,e),R=(0,W.Jc)(P,a),_=(0,E.useMemo)((()=>{const e=R.find((({asset:e})=>e.uuid===C.value));return e||((0,q.cB)(new Error("Failed to find initial asset in tradableAssets"),{owner:"trading",transferType:S,assetId:C.value,context:"buy_sell"}),R[0])}),[C,R,S]);V()(_,"There should always be a selected asset");const D=(0,fe.M)(_),j=(0,H.v)(I),{currentStep:Z,goToStep:U,goBack:J,replaceStep:ee}=(0,ae.tC)(ke.Ex),[le,re]=(0,E.useState)(""),[ue,oe]=(0,E.useState)({trayMsg:"",trayTitle:"",termsText:"",termsUrl:""}),me=(0,ve.Z)(),{allowedPaymentMethods:ye}=(0,pe.f)(),{trackEvent:be}=(0,Se.Z)(),Fe=(0,ie.Z)(h.value??"");(0,ne.Z)(ye);const he=(0,E.useMemo)((()=>ye.find((e=>"paypal_account"===e.type?.toLowerCase()))),[ye]);(0,te.G)(I,S,"never"!==A.value,!!he);const Ce=(0,E.useCallback)((()=>{U("entry")}),[U]),Te=e=>{e&&oe(e)},Ae=(0,E.useCallback)((e=>{re(e),U("taxInfo")}),[U]);(0,E.useEffect)((()=>{s&&me&&A.onChange(i??"monthly")}),[]),(0,E.useEffect)((()=>{u&&T.onChange(u)}),[]);const xe=(0,E.useMemo)((()=>"modal"===F||"convertModal"===F),[F]);(0,E.useEffect)((()=>{n&&be("viewed",{autoDisplayed:!xe,paymentMethodType:Fe?.type})}),[n]),(0,E.useEffect)((()=>{(0,Q.$Y)("loaded_asset_detail_trade_order_form_screen")}),[]);const we=(0,E.useCallback)((()=>{("buyStatus"!==Z||x.value)&&("buyStatus"===Z&&x.value&&(x.onChange(!1),A.onChange("never")),Ce(),be("tapped_close"))}),[Z,Ce,A,be,x]),Be=function(){const{currentStep:e}=(0,ae.tC)(ke.Ex),a=(0,Y.RA)(),n=(0,Ll.Z)();return(0,E.useMemo)((()=>"entry"!==e&&"limitOrderEntry"!==e&&!a&&!n),[e,n,a])}(),Le=(0,E.useCallback)((e=>{w.onChange(e),ee("buyPreview")}),[ee,w]),{buyPreviewPreloadedQueryRef:Ie,sellPreviewPreloadedQueryRef:Pe}=function(e){const a=(0,W.Jc)(Ke,e),[n,l]=(0,W.un)(Wn),[t,r]=(0,W.un)(hl),s=(0,se.Z)(),{amount:i,transferType:u}=(0,N.jf)(ke.cr),o=aa();return(0,E.useEffect)((()=>{o&&("buy"===u.value&&i.value&&l({action:"recurring_buys",nativeCurrency:s,productKey:ga.sP}),"sell"===u.value&&r({nativeCurrency:s,productKey:ga.sP}))}),[a.asset.uuid,s,u.value,i.value]),(0,E.useMemo)((()=>({buyPreviewPreloadedQueryRef:n,sellPreviewPreloadedQueryRef:t})),[n,t])}(_),Re=(0,E.useMemo)((()=>"buy"===S?B.value?.transferBuy.spreadPercentage:L.value?.transferSell.spreadPercentage),[B,L,S]),Me=(0,E.useCallback)((()=>{U("entry")}),[U]);return(0,ka.jsxs)(z.ZP,{paymentMethodType:"paypal_account",entryPoint:"buy",children:[(0,ka.jsx)(O.Z,{show:Be,onClick:we,backgroundColor:"rgb(50, 53, 61, 0.33)"}),(0,ka.jsx)(xc,{showOverlay:Be,children:(0,ka.jsxs)(ke.Ex.Steps,{speed:"extraFast",children:[(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Gt.Z,{queryRef:I,accountRef:D,viewerAssetRef:_,closeModal:l,disableAssetSelectors:g,disableSourceAssetSelection:p,totalNativeBalance:y,assetSelectorLabelOverride:f,entryStepModalHeaderTitle:b,onEntrySelectorSwitch:r})},"entry"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(ro,{})},"plaidRelink"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(yo.Z,{recurringPeriod:A,orderType:K,onBack:J,onDone:Me,trackEvent:be,isStablecoin:!!_.asset.isStablecoin})},"recurringSelect"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Yu,{})},"orderTypeSelect"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(no,{})},"paymentError"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(el,{accountRef:D,viewerAssetRef:_,handleTaxInfoClicked:Ae,handlePromoCodeInfoClicked:Te,isFreeTradePromoCodeEligible:m,preloadedQueryRef:Ie})},"buyPreview"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Bl,{accountRef:D,viewerAssetRef:_,isFreeTradePromoCodeEligible:m,handleTaxInfoClicked:Ae,handlePromoCodeInfoClicked:Te,preloadedQueryRef:Pe})},"sellPreview"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(zt,{})},"buyDisclosures"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Lo.Z,{transferType:S,paymentMethods:ye,activePaymentMethodId:h.value,isRecurring:"never"!==A.value,selectedAssetId:_.asset.uuid,queryRef:I,trackEvent:be,onBack:J,children:e=>(0,ka.jsx)(Io.Z,{...e})})},"selectPayment"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Bo.Z,{viewerAssetRefs:R,viewerAssetRef:_})},"selectAsset"),(0,ka.jsx)(G.zA,{children:v?(0,ka.jsx)(mt,{viewerAssetRef:_,accountRef:D,closeModal:l,onComplete:t,showStatusHeaderClose:o,assetName:c,isFreeTradePromoCodeEligible:m,recurringPeriod:A.value}):(0,ka.jsx)(ht,{viewerAssetRef:_,accountRef:D,closeModal:l,onComplete:t,showStatusHeaderClose:o,assetName:c,isFreeTradePromoCodeEligible:m,recurringPeriod:A.value})},"buyStatus"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Et,{accountRef:D})},"buyWaitTimer"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Qu,{})},"openBankingQrcode"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(X.Z,{entryPoint:"buy"})},"obRiskFailure"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(po,{accountRef:D})},"processingPayout"),(0,ka.jsx)(G.zA,{children:v?(0,ka.jsx)(Ho,{queryRef:I,viewerAssetRef:_,accountRef:D,assetName:c,closeModal:l,onComplete:t,showStatusHeaderClose:o,isFreeTradePromoCodeEligible:m,forceHideCbOneSubscriptionUpsell:k}):(0,ka.jsx)(ec,{accountRef:D,assetName:c,closeModal:l,onComplete:t,showStatusHeaderClose:o,isFreeTradePromoCodeEligible:m,forceHideCbOneSubscriptionUpsell:k,viewerAssetRef:_,queryRef:I})},"sellStatus"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Fc,{accountRef:D,assetOrCurrencyRef:_,queryRef:I,onComplete:t})},"wbl"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)($.ZP,{onBack:J,assetId:_.asset.uuid,onContinue:Le})},"experimentalAssetConfirmation"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(oc,{viewerAssetRef:_})},"unstakingInfo"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(wo,{assetOrCurrencyRef:_,accountRef:D,onDone:J,queryRef:I})},"recurringRewardTerms"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Jt.Z,{viewerAssetRef:_,cb1TradeBenefitData:j})},"feesInfo"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(so.Z,{viewerAssetRef:_,spreadPercentage:Re,onBack:J})},"priceInfo"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(rc,{taxType:le})},"taxInfo"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(jt,{})},"confirm3ds"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Qt,{closeModal:l,accountId:d?.accountId,buyId:d?.buyId})},"confirmBuy"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(lr,{promoCodeTrayMsg:ue})},"freeTradePromoCodeInfo"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(Pu,{queryRef:I,viewerAssetRef:_,closeModal:l})},"limitOrderEntry"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(ls,{queryRef:I,viewerAssetRef:_})},"limitOrderPreview"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(or,{queryRef:I})},"limitOrderDeposit"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(gs,{queryRef:I})},"paymentMethodInfo"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(mr,{closeModal:l})},"limitOrderConfirmation"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(de.V,{})},"coinbaseOneSignup"),(0,ka.jsx)(G.zA,{children:(0,ka.jsx)(ce.Z,{})},"coinbaseOneChangePlan")]})})]})}));function Ac({queryRef:e,eventContext:a,transferType:n="buy",assetId:l,assetName:r,confirm3ds:s=!1,skipToBuyStatus:i,isBuyAndStakePreselected:u,entryPoint:o,paymentMethods:c,forceHideCbOneSubscriptionUpsell:d,closeModal:m,totalNativeBalance:g,initialPaymentMethodProxyId:p,shouldUseNativeFiatWallet:y=!1,unverifiedSelectedPaymentMethod:k,...f}){const b=(0,W.Jc)(L,e),{data:S,loadNext:F,hasNext:v,isLoadingNext:h}=(0,W.nu)(w,b),C=(0,U.Q)("feb_2024_helper_text_google_pay"),{viewer:T}=b,{assetByUuid:A,assetBySymbol:K,assetBySlug:x,accountByUuid:B,btcViewerAsset:I,buyPolicyRestrictions:P,sellPolicyRestrictions:R}=T,M=(0,E.useMemo)((()=>A||(K||(x||("ViewerAsset"===B?.assetOrFiatCurrency?.__typename?B?.assetOrFiatCurrency:I)))),[A,K,x,B?.assetOrFiatCurrency,I]),_=(0,E.useMemo)((()=>{const e=(0,me.D)(S.viewer.tradableAssets.edges.map((({node:e})=>e))),a=!!M&&e.every((e=>e.asset.uuid!==M.asset.uuid));return[...e,...a?[M]:[]]}),[S.viewer.tradableAssets.edges,M]),V=(0,W.Jc)(t,_);(0,ue.Z)({loadNext:F,hasNext:v,isLoadingNext:h},Cc);const{isSubscribed:j,refetchSubscriberStatus:N}=(0,oe.x)(b),O=(0,E.useMemo)((()=>"buy"===n?(0,D.orderBy)(V,(e=>Number(e.asset.marketCapV2)),["desc"]):[...V]),[V,n]),Q=(0,E.useMemo)((()=>{switch(n){case"buy":return(0,me.D)(P||[]);case"sell":return(0,me.D)(R||[]);default:return(0,Z.Z)(n),[]}}),[n,P,R]),H=(0,E.useMemo)((()=>(0,hc.l)({entryPoint:o,type:n})),[o,n]),z=(0,le.j)(),G=(0,E.useMemo)((()=>{const e=(0,vc.Z)(c,n,z,H,k);return"buy"===n&&C?e.filter((e=>"google_pay"!==e.type)):e}),[c,n,z,H,k,C]),J=parseFloat(T.balanceData?.balanceInWbl?.value||"0"),$=(0,Fe.Z)({queryRef:b,paymentMethods:G,totalHoldBalance:J,totalNativeBalance:g,transferType:n,unverifiedSelectedPaymentMethod:k}),X=(0,re.U)({queryRef:b,totalHoldBalance:J,totalNativeBalance:g}),ae=(0,se.Z)(),ne=(y||"cashTransfer"===H?G.find((e=>"fiat_account"===e.type&&e.currency===ae)):void 0)??G.find((e=>"buy"===n?e.primaryBuy:e.primarySell))??G[0],te=ne?X({paymentMethod:ne,transferType:n}):0,ie=(0,be.Z)({queryRef:b,fiatLimit:te??0}),{selectedCryptoId:ce,paymentMethodId:de}=(0,ye.D)(),ge=(0,Y._x)(),fe=m??ge,Se=(0,E.useMemo)((()=>{if("sell"===n&&"cashOut"===H){const e=G.find((e=>"ach_bank_account"===e.type))?.id;if(e)return e}return p||(k?k.id:de||"")}),[p,n,H,de,G,k]),ve=(0,E.useMemo)((()=>{const e=ce||"";if(e)return e;return O.find((({asset:e})=>e.uuid===l))?l:((0,q.cB)(new Error("Failed to find initial asset in tradableAssets"),{owner:"trading",transferType:n,assetId:l,context:"buy_sell"}),O[0]?.asset.uuid)}),[l,ce,O,n]),he=(0,E.useMemo)((()=>{const e=O.find((({asset:e})=>e.uuid===ve));return e?.earnAsset?.autoStaking?.isEnrolled}),[ve,O]),Ae=(0,E.useMemo)((()=>Boolean(u||he)),[he,u]),Ke=(0,E.useMemo)((()=>({...ke.Sc,eventContext:a,transferType:n,assetId:ve,activePaymentMethodId:Se||ne?.id,showPresetAmountsIfAvailable:"buy"===n&&!!ie,orderType:"MARKET",shouldBuyAndStake:Ae})),[a,n,ve,Se,ne?.id,ie,Ae]),xe=function({queryRef:e}){const a=(0,Te.y)("kill_free_trade_promo_code"),{viewer:{userIncentives:n}}=(0,W.Jc)(Ce,e),l=n&&n.length>0;return!a&&(l||!1)}({queryRef:b}),we=(0,E.useMemo)((()=>s?"confirm3ds":i?"confirmBuy":"entry"),[s,i]);return(0,ka.jsx)(ee.Z,{action:`${n}s`,policyRestrictionRefs:Q,onClose:m,"data-element":"PolicyRestrictionEnforcer","data-component":"BuySellProviders",children:(0,ka.jsx)(ke.cr.Provider,{onSubmit:D.noop,initialValues:Ke,"data-element":"unknown",children:(0,ka.jsx)(pe.Z,{viewerAssetRefs:O,entryPoint:o,allowedPaymentMethods:G,formattedPaymentMethods:$,isCoinbaseOneSubscriber:j&&"PAUSE_PLAN"!==T.coinbaseSubscription?.subscriptionPlan?.type,refetchSubscriberStatus:N,variant:H,"data-element":"BuySellProvider",children:(0,ka.jsx)(_l,{transferType:n,closeModal:fe,"data-element":"PaymentMethodsEnforcer",children:(0,ka.jsx)(ke.Ex.Provider,{defaultStep:we,"data-element":"unknown",children:(0,ka.jsx)(Tc,{...f,queryRef:b,viewerAssetRefs:O,transferType:n,closeModal:m,assetName:r,skipToBuyStatus:i,isBuyAndStakePreselected:u,isFreeTradePromoCodeEligible:xe,totalNativeBalance:g,forceHideCbOneSubscriptionUpsell:d,eventContext:a,"data-element":"BuySellContent"})})})})})})}function Kc(e){return(0,ka.jsx)(J.Z,{"data-element":"BuySellBoundary","data-component":"BuySell",children:(0,ka.jsx)(Ac,{...e,"data-element":"BuySellProviders"})})}const xc=j.ZP.div.withConfig({displayName:"BuySell__Container",componentId:"sc-1b30qzj-0"})(["display:flex;flex:1;z-index:",";transition:z-index ",";"],(e=>e.showOverlay?e.theme.zIndex.overlay:e.theme.zIndex.normal),(e=>e.showOverlay?"0ms":"0ms ease-out 1000ms")),wc=(0,E.memo)(Kc)},839:(e,a,n)=>{n.d(a,{I:()=>f,Z:()=>b});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuySellFooterAssetOrCurrencyFragment",selections:[{args:null,kind:"FragmentSpread",name:"FooterFragment"}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency",hash:"010d7b7eff082d38150988f5db46813c"},t=l,r={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuySellFooterAccountFragment",selections:[{args:null,kind:"FragmentSpread",name:"useAssetBalanceInfoAccountFragment"}],type:"Account",abstractKey:null,hash:"a5853f6be96669f44917df91df26f0ca"},s=r,i={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuySellFooterQueryFragment",selections:[{args:null,kind:"FragmentSpread",name:"useAssetBalanceInfoFragment"}],type:"Query",abstractKey:null,hash:"8c52675b6f3e2e407f0aba79609369bc"},u=i;var o=n(0),c=n(98),d=n(3),m=n(3628),g=n(1303),p=n(2);function y({queryRef:e,accountRef:a,assetOrCurrencyRef:n,entryPoint:l,testID:r}){const i=(0,d.Jc)(u,e),o=(0,d.Jc)(s,a),c=(0,d.Jc)(t,n??null),{assetBalance:y,assetBalanceInFiat:k}=(0,g.Z)({queryRef:i,accountRef:o});return(0,p.jsx)(m.Z,{balance:y,fiatBalance:k,entryPoint:l,assetOrCurrencyRef:c,testID:r,"data-element":"Footer","data-component":"BuySellFooterContent"})}function k(e){return(0,p.jsx)(d.zq,{instrumentationId:"BuySellFooter",fallback:null,"data-element":"InstrumentedSuspense","data-component":"BuySellFooter",children:(0,p.jsx)(y,{...e,"data-element":"BuySellFooterContent"})})}const f=(0,o.memo)((function({currency:e,amount:a}){return(0,p.jsx)(m.P,{leftColumn:(0,p.jsx)(c.TextLabel2,{as:"span",color:"foregroundMuted",children:e}),rightColumn:(0,p.jsx)(c.TextLabel2,{as:"span",color:"foreground",children:a})})})),b=(0,o.memo)(k)},125:(e,a,n)=>{n.d(a,{Z:()=>m,f:()=>d});const l={argumentDefinitions:[],kind:"Fragment",metadata:{plural:!0},name:"BuySellProviderFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"6596214ed4d477d0940f94a8a87c3255"},t=l;var r=n(0),s=n(3),i=n(110),u=n(2);const o=(0,r.createContext)({allowedPaymentMethods:[],formattedPaymentMethods:[],isCoinbaseOneSubscriber:!1,refetchSubscriberStatus:void 0,entryPoint:void 0,variant:void 0,selectedAsset:{platformName:"",displaySymbol:"",name:""},subscriptionUpsellFlowComplete:!1,setSubscriptionUpsellFlowComplete:()=>{}});function c({children:e,viewerAssetRefs:a,allowedPaymentMethods:n,formattedPaymentMethods:l,isCoinbaseOneSubscriber:c,refetchSubscriberStatus:d,entryPoint:m,variant:g}){const{assetId:p}=(0,i.Z)(),y=(0,s.Jc)(t,a),k=(0,r.useMemo)((()=>{const e=y.find((({asset:e})=>e.uuid===p.value));return{platformName:e?.asset.platformName||"",displaySymbol:e?.asset.displaySymbol||"",name:e?.asset.name||""}}),[p.value,y]),[f,b]=(0,r.useState)(!1),S=(0,r.useMemo)((()=>({selectedAsset:k,allowedPaymentMethods:n,formattedPaymentMethods:l,isCoinbaseOneSubscriber:c,entryPoint:m,variant:g,refetchSubscriberStatus:d,subscriptionUpsellFlowComplete:f,setSubscriptionUpsellFlowComplete:b})),[k,n,l,c,m,g,d,f,b]);return(0,u.jsx)(o.Provider,{value:S,"data-element":"unknown","data-component":"BuySellProvider",children:e})}function d(){return(0,r.useContext)(o)}const m=(0,r.memo)(c)},187:(e,a,n)=>{n.d(a,{D:()=>o,Z:()=>c});var l=n(0),t=n(33),r=n(544),s=n(2);const i=(0,l.createContext)({setCryptoAssetId:t.noop,setPaymentMethodId:t.noop,setSelectedCryptoId:t.noop,setRecurringOption:t.noop});function u({initialValue:e,transferType:a,children:n,disableInitialCryptoValue:t}){const[u,o]=(0,l.useState)(t?void 0:e),[c,d]=(0,l.useState)(""),[m,g]=(0,l.useState)(""),[p,y]=(0,l.useState)(""),[k,f]=(0,l.useState)(""),[b,S]=(0,l.useState)(),[F,v]=(0,l.useState)(void 0),{stickyTxns:h}=(0,r.W)();(0,l.useEffect)((()=>{const e="buy"===a?h?.lastBuy:void 0;"asset"!==e?.type||t?"fiat_account"===e?.type&&o(void 0):o(e.assetId)}),[h,a]);const C=(0,l.useMemo)((()=>({cryptoAssetId:u,setCryptoAssetId:e=>{o(e)},paymentMethodId:c,setPaymentMethodId:d,selectedCryptoId:m,setSelectedCryptoId:g,fiatInput:p,setFiatInput:y,cryptoInput:k,setCryptoInput:f,isFiatInputValue:b,setIsFiatInput:S,recurringOption:F,setRecurringOption:e=>{v(e)}})),[u,c,m,p,y,k,f,b,S,F]);return(0,s.jsx)(i.Provider,{value:C,"data-element":"unknown","data-component":"BuySellProxyProvider",children:n?.(u)})}function o(){return(0,l.useContext)(i)}const c=(0,l.memo)(u)},1304:(e,a,n)=>{n.d(a,{Z:()=>k});var l=n(0),t=n(9),r=n(10),s=n(55),i=n(54),u=n(98),o=n(15),c=n(350),d=n(1411),m=n(885),g=n(872),p=n(550),y=n(2);function k({fees:e,subscriptionFeeBenefit:a,onGoToFeesInfoStep:n,isCoinbaseOneSubscriber:t,zeroOrFree:r="zero"}){const s=(0,l.useMemo)((()=>e?.filter((e=>"Coinbase One"!==e?.name))),[e]);return(0,y.jsx)(y.Fragment,{children:s?.map(((e,l)=>Number(e?.amount.value??"0")||"Coinbase Fee"===e?.name?(0,y.jsx)(f,{feeDetail:e,subscriptionFeeBenefit:a,onGoToFeesInfoStep:n,isCoinbaseOneSubscriber:t,zeroOrFree:r},e?.name??l):null))})}function f({feeDetail:e,subscriptionFeeBenefit:a,onGoToFeesInfoStep:n,isCoinbaseOneSubscriber:r,zeroOrFree:d}){const{formatMessage:k}=(0,t.Z)(),f=(0,o.$T)(),S=(0,l.useCallback)(((e,n,l=!1)=>{if(r){const l=Number(e.value)+Number(n.value);return(0,y.jsx)(m.F,{subscriptionFeeBenefit:{...a,feePaid:l,feeCurrency:e.currency,feeWithoutBenefit:Number(e.value),feeCoverage:l<=0?"FULL":"PARTIAL"},flipLayout:!0})}return(0,y.jsxs)(i.HStack,{alignItems:"center",gap:.5,children:[(0,y.jsx)(s.Icon,{name:"dropsActive",size:"s",color:"primary",testID:"generic-icon"}),(0,y.jsx)(u.TextLabel2,{as:"p",children:l?k(p.hS.free):f({amount:e,isFiat:!0})}),(0,y.jsx)(b,{amount:n.value,currency:n.currency})]})}),[f,k,r,a]);if(!e)return null;const F=e.waivedDetails?.amount,v=e.amount,h=Number(e.amount.value||"0")+Number(F?.value||"0"),C=!!Number(F?.value||"0")&&"Coinbase Fee"===e.name&&"COINBASE_ONE"===e.waivedDetails?.source,T=Boolean(h<=0),A=0===Number(v.value??"0")&&"free"===d?(0,y.jsx)(u.TextLabel2,{as:"p",color:"positive",children:k(p.hS.free)}):Number(F?.value||"0")&&F?S(v,F,T):f({amount:v,isFiat:!0});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(c.hc,{label:e.label??"",rightContent:A,onClick:()=>{n?.(e,C)}}),r&&C&&(0,y.jsx)(g.c,{subscriptionFeeBenefit:a})]})}const b=(0,r.ZP)(d.Z).withConfig({displayName:"PreviewFeeRows__StrikedFormattedAmount",componentId:"sc-7tuq8w-0"})(["text-decoration:line-through;"])},107:(e,a,n)=>{n.d(a,{Ex:()=>s,Sc:()=>i,cr:()=>u});var l=n(53),t=n(73),r=n(946);const s=(0,t.vj)({steps:["entry","recurringSelect","paymentError","buyPreview","sellPreview","buyStatus","sellStatus","wbl","selectAsset","selectPayment","recurringRewardTerms","buyPresetAmounts","plaidRelink","buyDisclosures","feesInfo","paymentMethodInfo","priceInfo","taxInfo","unstakingInfo","experimentalAssetConfirmation","confirm3ds","buyWaitTimer","openBankingQrcode","obRiskFailure","processingPayout","confirmBuy","freeTradePromoCodeInfo","orderTypeSelect","limitOrderEntry","limitOrderPreview","limitOrderDeposit","limitOrderConfirmation","coinbaseOneSignup","coinbaseOneChangePlan"],defaultStep:"entry"}),i={orderType:"MARKET",amount:"",activePaymentMethodId:void 0,recurringPeriod:"never",isFiatInput:!0,tradeComplete:!1,showPresetAmountsIfAvailable:!1,eventContext:"assetPage",transferType:"buy",assetId:"",freeTradePromoCode:"",shouldBuyAndStake:!1,buyQuoteResponse:void 0,sellQuoteResponse:void 0,buyCommitResponse:void 0,sellCommitResponse:void 0,cardStatus:void 0,buyInputParams:void 0,sellInputParams:void 0,acceptDisclosureForAllExperimentalAssets:!1,buyWaitTimerResponse:void 0,openBankingRedirectUrl:"",activeAccountUuid:"",previewFeeDisclosure:null,showCbOneBannerOnInfoStep:!1,...r.z},u=(0,l.Np)({initialValues:i})},744:(e,a,n)=>{n.d(a,{M:()=>i});var l=n(0),t=n(53),r=n(123),s=n(107);function i(e){const a=function(e){const{transferType:a}=(0,t.jf)(s.cr);return(0,l.useMemo)((()=>{const n=(0,r.D)(e.accounts||[]);return"buy"===a.value?n.filter((e=>!["MULTISIG_VAULT","MULTISIG"].includes(e.type))):n.filter((e=>"WALLET"===e.type))}),[e,a])}(e),n=e.asset.platformName;return(0,l.useMemo)((()=>a.find((e=>"BTC"===n&&e.primary||"BTC"!==n&&"WALLET"===e.type))||a[0]),[n,a])}},224:(e,a,n)=>{n.d(a,{Z:()=>s});var l=n(8),t=n.n(l),r=n(1302);function s(){const e=(0,r.Z)();return t()(e,"there should always be an active payment method"),e}},1302:(e,a,n)=>{n.d(a,{Z:()=>i});var l=n(0),t=n(110),r=n(817),s=n(125);function i(){const{activePaymentMethodId:e}=(0,t.Z)(),{allowedPaymentMethods:a}=(0,s.f)(),n=(0,r.Z)(e.value||"");return(0,l.useMemo)((()=>a.find((a=>e.value===a.id))||n),[a,e,n])}},1303:(e,a,n)=>{n.d(a,{Z:()=>m});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useAssetBalanceInfoAccountFragment",selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null}],storageKey:null}],type:"Account",abstractKey:null,hash:"afef44c47899923464992756869b2c1f"},t=l,r={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useAssetBalanceInfoFragment",selections:[{args:null,kind:"FragmentSpread",name:"useCurrencyConverterFragment"}],type:"Query",abstractKey:null,hash:"74bc8ce785e94a51d6e1a039d2b63975"},s=r;var i=n(0),u=n(33),o=n(15),c=n(3),d=n(224);function m({queryRef:e,accountRef:a}){const n=(0,c.Jc)(s,e),l=(0,c.Jc)(t,a),r=(0,o.uJ)({queryRef:n}),m=(0,d.Z)().currency,g=(0,i.useMemo)((()=>({amount:l.availableBalance.value,currency:l.availableBalance.currency})),[l]),p=r({currency:l.assetOrFiatCurrency?.asset?.platformName??"",amount:g.amount},m);return{assetBalance:g,assetBalanceInFiat:(0,i.useMemo)((()=>({amount:(0,u.toString)(p),currency:m})),[m,p])}}},1311:(e,a,n)=>{n.d(a,{Z:()=>F});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useAssetSelectorViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useLatestQuoteViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useConvertIncrementToPrecisionFragment"}],type:"ViewerAsset",abstractKey:null,hash:"298a08e554001e9713045db08d6d76d8"},t=l;var r=n(0),s=n(9),i=n(154),u=n(180),o=n(52),c=n(14),d=n(3),m=n(186),g=n(110),p=n(229),y=n(188),k=n(870),f=n(873),b=n(140),S=n(2);function F({isNewDesign:e=!1,viewerAssetRef:a}){const n=(0,d.Jc)(t,a),{asset:l}=n,u=(0,f.z)(n),{fiatPrecision:F}=(0,k.h)(n),{goToStep:h}=(0,p.Z)(),{transferType:C}=(0,g.Z)(),{name:T,imageUrl:A}=l,{trackEvent:K}=(0,b.Z)(),{formatNumber:x}=(0,s.Z)(),{startTradePerfMark:w}=(0,m.Z)(),B=(0,y.m)(C.value),L=(0,r.useMemo)((()=>{const e=x(Number(u??""),{maximumFractionDigits:F,minimumFractionDigits:F});return(0,S.jsx)(i.Z,{instrumentationId:"LivePrice",fallback:(0,S.jsx)(v,{}),children:(0,S.jsxs)(o.VStack,{alignItems:"flex-end",spacingEnd:1,children:[(0,S.jsx)(c.TextBody,{as:"p",children:e}),(0,S.jsx)(c.TextBody,{as:"p",color:"foregroundMuted",children:B.price})]})})}),[x,F,u,B.price]),I=(0,r.useMemo)((()=>(0,S.jsx)(c.TextHeadline,{as:"p",children:T})),[T]),P=(0,r.useCallback)((()=>{w("load_assets",C.value),K("_tapped_select_asset",{step:"order_input"}),h("selectAsset")}),[h,w,K,C]);return(0,r.useMemo)((()=>({primaryLabel:!e&&B.selectAssetLabel,image:A,secondaryLabel:e?I:T,onPress:P,testID:`${C.value}-asset-selector`,rightIcon:e?L:void 0})),[e,B.selectAssetLabel,A,T,P,C.value,L,I])}function v(){return(0,S.jsxs)(o.VStack,{"data-element":"VStack","data-component":"LivePriceFallback",children:[(0,S.jsx)(u.Fallback,{width:80,height:24,"data-element":"Fallback"}),(0,S.jsx)(u.Fallback,{width:40,height:24,"data-element":"Fallback"})]})}},911:(e,a,n)=>{n.d(a,{Z:()=>o});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyPresetAmountsFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProperties",kind:"LinkedField",name:"userProperties",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"nativeCurrency",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasBuyDepositPaymentMethods",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"da9ff32320f07cfdf7edfd4ae093c2dd"},t=l;var r=n(0),s=n(29),i=n(3);const u=["USD","EUR","GBP","CAD","AUD","SGD"];function o({queryRef:e,fiatLimit:a}){const{viewer:n}=(0,i.Jc)(t,e),{userProperties:l}=n,{nativeCurrency:o,hasBuyDepositPaymentMethods:c}=l||{},d=(0,s.y)("kill_preset_buys_in_trade_web"),m=u.includes(o||"")&&c,g=["10","50","100"];return(0,r.useMemo)((()=>{if(!m||d)return;return Number(g?g[g.length-1]:void 0)<=a?g:void 0}),[g,a,m,d])}},140:(e,a,n)=>{n.d(a,{N:()=>u,Z:()=>o});var l=n(0),t=n(33),r=n(7),s=n(125),i=n(110);const u={"Coinbase Fee":"preview_tapped_coinbase_fee_info","Service Fee":"preview_tapped_service_fee_info","Bank Fee":"preview_tapped_bank_fee_info",INDIA_WITHHOLDING:"preview_tapped_india_withholding_info",AUSTRALIA_GST:"preview_tapped_aus_gst_info",SINGAPORE_GST:"preview_tapped_sg_gst_info"};function o(){const{selectedAsset:e}=(0,s.f)(),{isFiatInput:a,eventContext:n,transferType:u,recurringPeriod:o,orderType:c}=(0,i.Z)(),d="never"===o.value?{MARKET:"one-time",LIMIT:"limit",UNKNOWN_ORDER_TYPE:"one-time",STOP:"stop",STOP_LIMIT:"stop-limit"}[c.value]:o.value,m=(0,l.useMemo)((()=>({currencyType:a.value?"fiat":"crypto",currency:e.platformName??"",context:n.value,orderType:d})),[a.value,e.platformName,n.value,d]);return{trackEvent:(0,l.useCallback)(((e,a={})=>{const n=(0,t.snakeCase)(`${u.value}_${e}`);(0,r.Kz)(n,{componentType:r.re.button,action:r.Us.click,...m,...a}),(0,r.HR)({metricName:n,metricType:r.t0.count,value:1})}),[m,u.value])}}},374:(e,a,n)=>{n.d(a,{Z:()=>u});var l=n(0),t=n(8),r=n.n(t),s=n(110),i=n(125);function u(){const{activePaymentMethodId:e}=(0,s.Z)(),{formattedPaymentMethods:a}=(0,i.f)();return(0,l.useEffect)((()=>{!a.find((a=>a.id===e.value))&&a.length>0&&e.onChange(a[0].id)}),[a,e]),(0,l.useMemo)((()=>{let n=a.find((a=>a.id===e.value));return!n&&a.length>0&&(n=a[0]),r()(n,"there should always be a formatted payment method"),n}),[e.value,a])}},557:(e,a,n)=>{n.d(a,{Z:()=>d});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useFormattedPaymentMethodsFragment",selections:[{args:null,kind:"FragmentSpread",name:"useLimitGetterForTransferType"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"fiatAccounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"5b45a95fe832d1e398b14793de055cfb"},t=l;var r=n(0),s=n(9),i=n(3),u=n(838),o=n(123),c=n(3636);function d({paymentMethods:e,totalHoldBalance:a,totalNativeBalance:n,transferType:l,queryRef:d,unverifiedSelectedPaymentMethod:m}){const g=(0,s.Z)(),p=(0,i.Jc)(t,d),y=(0,r.useMemo)((()=>(0,o.D)(p.viewer.fiatAccounts||[]).map((e=>({uuid:e.uuid,availableBalance:{value:e.availableBalance.value,currency:e.availableBalance.currency}})))),[p.viewer.fiatAccounts]),k=(0,u.U)({queryRef:p,totalHoldBalance:a,totalNativeBalance:n});return(0,r.useMemo)((()=>(m?[m,...e]:e).map((e=>(0,c.Z)({fiatAccounts:y,intl:g,transferType:l,limit:k({paymentMethod:e,transferType:l}),paymentMethod:e})))),[e,y,g,l,k,m])}},3620:(e,a,n)=>{n.d(a,{Z:()=>r});var l=n(29),t=n(23);function r(){const{isInUS:e}=(0,t.Z)();return!(0,l.y)("kill_add_cash_usdc_web")&&e}},3696:(e,a,n)=>{n.d(a,{Z:()=>s});var l=n(29),t=n(44),r=n(23);function s(){const{isInUS:e}=(0,r.Z)(),a=(0,l.y)("kill_cash_out_usdc_web"),n=(0,t.Q)("sep_2023_www_cash_out_usdc",{skipTracking:a||!e});return!a&&n&&e}},3926:(e,a,n)=>{n.d(a,{Z:()=>r});var l=n(29),t=n(23);function r(){const{isInUS:e}=(0,t.Z)();return!(0,l.y)("kill_cash_transfer_usdc_web")&&e}},2411:(e,a,n)=>{n.d(a,{Z:()=>t});var l=n(29);function t(){return!(0,l.y)("kill_recurring_buys_usdc_web")}},572:(e,a,n)=>{n.d(a,{Z:()=>r});var l=n(0),t=n(224);function r(){const e=(0,t.Z)();return(0,l.useMemo)((()=>e?.recurringOptions?.length>0),[e?.recurringOptions])}},1545:(e,a,n)=>{n.d(a,{V:()=>o,s:()=>u});var l=n(0),t=n(11),r=n(9),s=n(1386),i=n(1522);const u=(0,t.vU)({promoCodeExpired:{id:"FreeTradePromoCodeValidator.promoCodeExpired",defaultMessage:"Promo code has expired"},promoCodeRedeemed:{id:"FreeTradePromoCodeValidator.promoCodeRedeemed",defaultMessage:"Promo code has already been redeemed"},genericPromoCodeError:{id:"FreeTradePromoCodeValidator.genericPromoCodeError",defaultMessage:"Something went wrong. Please try again later"}}),o=({inputParams:e,response:a,freeTradePromoCode:n})=>{const t=(0,s.p)(),{formatMessage:o}=(0,r.Z)();return{isFreeTradePromoCodeValid:(0,l.useCallback)((()=>{if(a.tradeIncentiveInfo&&!a.tradeIncentiveInfo.hasBeenApplied){const l=Date.parse((new Date).toString()),r=a.tradeIncentiveInfo?.endsAt;if(!e.value)return;let s;return e.onChange({...e.value,tradeIncentiveInputs:void 0}),n.onChange(""),"REDEEMABLE"!==a.tradeIncentiveInfo?.redemptionStatus?(s=o(u.promoCodeRedeemed),t.show(s)):r&&Date.parse(r)<l?(s=o(u.promoCodeExpired),t.show(s)):(s=o(u.genericPromoCodeError),t.show(s)),(0,i.zU)({errorEventData:{codeValue:n.value,errorMessage:s,errorType:"Trade"}}),!1}return!0}),[o,t,n,a.tradeIncentiveInfo,e])}}},1391:(e,a,n)=>{n.d(a,{R:()=>t});var l=n(29);const t=()=>(0,l.y)("kill_simple_trade_buy_web")},1392:(e,a,n)=>{n.d(a,{p:()=>t});var l=n(29);const t=()=>(0,l.y)("kill_simple_trade_sell_web")},573:(e,a,n)=>{n.d(a,{Z:()=>i});var l=n(0),t=n(11),r=n(9);const s=(0,t.vU)({marketTitle:{id:"OrderType.marketTitle",defaultMessage:"One-time order"},marketMessage:{id:"OrderType.marketMessage",defaultMessage:"Order executes as soon as possible at the current price"},limitTitle:{id:"OrderType.limitTitleV2",defaultMessage:"Limit order"},limitMessage:{id:"OrderType.limitMessageV2",defaultMessage:"Order executes at a target price you set, or better"},recurringTitle:{id:"OrderType.recurringTitle",defaultMessage:"Recurring buy"},recurringMessage:{id:"OrderType.recurringMessage",defaultMessage:"Set up automatic daily, weekly, bi-weekly or monthly purchases"}}),i=()=>{const{formatMessage:e}=(0,r.Z)();return(0,l.useCallback)((a=>{switch(a){case"MARKET":return{title:e(s.marketTitle),message:e(s.marketMessage)};case"LIMIT":return{title:e(s.limitTitle),message:e(s.limitMessage)};case"RECURRING":return{title:e(s.recurringTitle),message:e(s.recurringMessage)};default:return{title:"",message:""}}}),[e])}},785:(e,a,n)=>{n.d(a,{h:()=>t});var l=n(44);function t(e=!1){return(0,l.Q)("oct_2023_rn_simple_trade_preview",{skipTracking:e})}},745:(e,a,n)=>{n.d(a,{Z:()=>d});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSharedQuoteParamsViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"c1280ab63694537a164cda0410e5677c"},t=l,r={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSharedQuoteParamsFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],type:"Account",abstractKey:null,hash:"7332754fc17c75750e8092090e940b06"},s=r;var i=n(0),u=n(3),o=n(110),c=n(224);function d({accountRef:e,viewerAssetRef:a}){const n=(0,u.Jc)(s,e),l=(0,u.Jc)(t,a),{isFiatInput:r}=(0,o.Z)(),d=(0,c.Z)(),m=n.uuid??l.asset.platformName;return(0,i.useMemo)((()=>({amount:void 0,total:void 0,quote:!1,commit:!1,accountUuid:m,currency:r.value?d.currency:l.asset.platformName??"",paymentMethodUuid:d.id,pmsvcId:d.pmsvcId,donationAmount:void 0,donationModality:void 0,tradeIncentiveInputs:void 0})),[m,d.currency,d.id,d.pmsvcId,r.value,l.asset])}},186:(e,a,n)=>{n.d(a,{Z:()=>r});var l=n(0),t=n(365);function r(){const{startMark:e,endMark:a}=(0,t.Z)();return{startTradePerfMark:(0,l.useCallback)(((a,n)=>{e("simple_trade",a,{tradeType:n})}),[e]),endTradePerfMark:(0,l.useCallback)(((e,n)=>{a("simple_trade",e,{tradeType:n})}),[a])}}},1305:(e,a,n)=>{n.d(a,{Z:()=>Se});const l={fragment:{argumentDefinitions:t=[{defaultValue:null,kind:"LocalArgument",name:"input"}],kind:"Fragment",metadata:null,name:"useBuyQuoteSubmitterMutation",selections:[{alias:null,args:r=[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"createBuy",plural:!1,selections:[s={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{kind:"InlineDataFragmentSpread",name:"createBuyFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[i={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"spreadPercentage",storageKey:null},d={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:c=[o={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},m={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:c,storageKey:null},g={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:c,storageKey:null},b={alias:null,args:null,concreteType:"FeeDetails",kind:"LinkedField",name:"fees",plural:!0,selections:[p={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},d,{alias:null,args:null,concreteType:"Disclosure",kind:"LinkedField",name:"disclosure",plural:!1,selections:[y={alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[k={alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"WaivedDetails",kind:"LinkedField",name:"waivedDetails",plural:!1,selections:[d,{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null}],storageKey:null}],storageKey:null},S={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:c,storageKey:null},F={alias:null,args:null,concreteType:"TaxDetails",kind:"LinkedField",name:"taxDetails",plural:!0,selections:[p,d],storageKey:null},v={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"defaultFee",plural:!1,selections:c,storageKey:null},h={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:c,storageKey:null},{kind:"InlineDataFragmentSpread",name:"simpleTradeBenefit_buy",selections:[S,C={alias:null,args:null,kind:"ScalarField",name:"appliedSubscriptionBenefit",storageKey:null},h,T={alias:null,args:null,concreteType:"SubscriptionInfo",kind:"LinkedField",name:"subscriptionInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasBenefitCap",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"freeTradingResetDate",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"remainingFreeTradingVolume",plural:!1,selections:[o],storageKey:null}],storageKey:null}],args:null,argumentDefinitions:[]},A={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"unitPrice",plural:!1,selections:[d],storageKey:null},K={alias:null,args:null,kind:"ScalarField",name:"holdDays",storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"recurringPayment",storageKey:null},w={alias:null,args:null,concreteType:"InstantAchData",kind:"LinkedField",name:"instantAch",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTotalInstant",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"instantAchAmount",plural:!1,selections:c,storageKey:null}],storageKey:null},B={alias:null,args:null,kind:"ScalarField",name:"resource",storageKey:null},{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[L={alias:null,args:null,kind:"ScalarField",name:"hasBeenApplied",storageKey:null},I={alias:null,args:null,kind:"ScalarField",name:"redemptionStatus",storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"endsAt",storageKey:null},R={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutIncentive",plural:!1,selections:c,storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[M={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},E={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},_={alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[f,k],storageKey:null},V={alias:null,args:null,concreteType:"TransferUserWarningContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"details",storageKey:null},y,{alias:null,args:null,kind:"ScalarField",name:"linkText",storageKey:null}],storageKey:null}],storageKey:null}],args:null,argumentDefinitions:[]}],type:"CreateBuySuccess",abstractKey:null},{kind:"InlineFragment",selections:[j={alias:null,args:null,concreteType:"GenericError",kind:"LinkedField",name:"error",plural:!1,selections:D=[E],storageKey:null},{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[N={alias:null,args:null,concreteType:"TransferCancelReason",kind:"LinkedField",name:"cancelReason",plural:!1,selections:[E,M,{alias:null,args:null,kind:"ScalarField",name:"cta",storageKey:null}],storageKey:null}],storageKey:null}],type:"CreateBuyPartialError",abstractKey:null},O={kind:"InlineFragment",selections:D,type:"GenericError",abstractKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:t,kind:"Operation",name:"useBuyQuoteSubmitterMutation",selections:[{alias:null,args:r,concreteType:null,kind:"LinkedField",name:"createBuy",plural:!1,selections:[s,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[i,u,d,m,g,b,S,F,v,h,C,T,A,K,x,w,B,{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[L,I,P,R,Z={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null},Z],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[M,E,_,V,Z],storageKey:null}],type:"CreateBuySuccess",abstractKey:null},{kind:"InlineFragment",selections:[j,{alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[N,Z],storageKey:null}],type:"CreateBuyPartialError",abstractKey:null},O],storageKey:null}]},params:{id:"04b66277463e8b706a59de122f4b365ae369c6e3f83f9ffdce868fea88bed545",metadata:{},name:"useBuyQuoteSubmitterMutation",operationKind:"mutation",text:null}};var t,r,s,i,u,o,c,d,m,g,p,y,k,f,b,S,F,v,h,C,T,A,K,x,w,B,L,I,P,R,M,E,_,V,D,j,N,O,Z;l.hash="0e8e0e926bc204d59b8a7154aec2b988";const U=l,q={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyQuoteSubmitterViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useSharedQuoteParamsViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"fb22afcb4a132fd77c94f4bd2a0feb14"},Q=q,H={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyQuoteSubmitterFragment",selections:[{args:null,kind:"FragmentSpread",name:"useSharedQuoteParamsFragment"}],type:"Account",abstractKey:null,hash:"3842c556f00e1bfc2b871ca80e3d3ba1"},W=H;var z=n(0),G=n(9),J=n(53),$=n(29),Y=n(15),X=n(7),ee=n(3),ae=n(1431),ne=n(523),le=n(3592),te=n(107),re=n(11),se=n(96);const ie=()=>{const e=(0,X.ld)("3ds2_ddc_attempt",{componentType:X.re.button,action:X.Us.click}),a=(0,z.useCallback)(((e,a,n)=>{(0,X.Kz)("3ds2_ddc_finished",{componentType:X.re.unknown,action:X.Us.unknown,state:e,errorCode:n,...a?{error:{displayError:a}}:{}})}),[]);return(0,z.useMemo)((()=>({logDdcInitiated:e,logDdcFinished:a})),[e,a])},ue=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"token",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useGenerateWorldpayClientTokenMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"generatePaymentMethodClientToken",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{kind:"RequiredField",field:l,action:"NONE",path:"generatePaymentMethodClientToken.token"},{kind:"RequiredField",field:t,action:"NONE",path:"generatePaymentMethodClientToken.url"}],type:"GeneratePaymentMethodClientTokenSuccess",abstractKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useGenerateWorldpayClientTokenMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"generatePaymentMethodClientToken",plural:!1,selections:[n,{kind:"InlineFragment",selections:[l,t],type:"GeneratePaymentMethodClientTokenSuccess",abstractKey:null}],storageKey:null}]},params:{id:"a51a18a7143918a6c5f378318d615c1d150b887316fffe021ef526af1cfa76ff",metadata:{},name:"useGenerateWorldpayClientTokenMutation",operationKind:"mutation",text:null}}}();ue.hash="85b3b28e55ef265febcd7e2f35f64f90";const oe=ue,ce=()=>{const[e]=(0,ee.Db)(oe);return(0,z.useCallback)((({onSuccess:a,onError:n})=>{e({variables:{input:{vendor:"worldpay",brainTreeNetwork:""}},onCompleted:({response:e})=>{try{const l=e?.generatePaymentMethodClientToken;switch(l?.__typename){case"GeneratePaymentMethodClientTokenSuccess":{const e=l.token,n=l.url;a(e,n);break}default:n(!1)}}catch{n(!1)}},onError:()=>{n(!0)}})}),[e])};var de=n(156);const me="ddcIframe",ge=()=>{const{formatMessage:e}=(0,G.Z)(),[a,n]=(0,z.useState)(""),l=(0,z.useCallback)((()=>{document.getElementById(me)?.remove()}),[]);(0,z.useEffect)((()=>()=>{l()}),[]);const t=(0,z.useCallback)(((a,t,r)=>{try{l();const e=document.createElement("iframe");e.srcdoc=`\n <!DOCTYPE html>\n <html>\n <head>\n <meta http-equiv="Content-Security-Policy" content="connect-src 'none'; base-uri 'self'; block-all-mixed-content; frame-ancestors 'self'; plugin-types 'none'; sandbox; object-src 'none'; child-src 'none';">\n </head>\n <body>\n <form id="collectionForm" method="POST" action=${r}>\n <input type="hidden" name="Bin" value=${t} />\n <input type="hidden" name="JWT" value=${a} />\n </form>\n <script>\n window.onload = function() {\n document.getElementById('collectionForm').submit();\n }\n <\/script>\n </body>\n </html>`,e.style="border:none; display: none;",e.sandbox="allow-forms allow-scripts allow-same-origin",e.height="1",e.width="1",e.id=me,document.body.appendChild(e)}catch(a){(0,Y.cB)((0,de.Xv)(a),{owner:"trading",context:"buy_sell"}),n(e(ke.genericError))}}),[e,l]);return(0,z.useMemo)((()=>({loadDDCIframe:t,loadDDCIframeError:a})),[t,a])},pe=12e3,ye="use_3ds_device_data_collection",ke=(0,re.vU)({genericPaymentProcessorError:{id:"useWorldPay3DS2BuyQuoteSubmitter.genericPaymentProcessorError",defaultMessage:"We were unable to authenticate your card through our payment processing provider. Please try again later."},timeoutError:{id:"useWorldPay3DS2BuyQuoteSubmitter.timeoutError",defaultMessage:"Our server took too long to authenticate your card. Please try again later."},genericError:{id:"useWorldPay3DS2BuyQuoteSubmitter.genericError",defaultMessage:"We were unable to authenticate your card. Please try again later."}});var fe=n(224),be=n(745);function Se({accountRef:e,viewerAssetRef:a}){const n=(0,ee.Jc)(W,e),l=(0,ee.Jc)(Q,a),[t,r]=(0,z.useState)(!1),s=(0,z.useRef)(""),i=(0,z.useRef)(void 0),u=(0,fe.Z)(),{formatMessage:o}=(0,G.Z)(),c=(0,$.y)("kill_3ds2"),{getCorrelationId:d}=(0,ae.X)((0,le.iJ)(u.type)),m=u?.pickerData&&"bin"in u.pickerData?u.pickerData.bin:"",{completeDeviceDataCollection:g,deviceDataCollectionLoading:p}=function(e,a=pe){const{formatMessage:n}=(0,G.Z)(),[l,t]=(0,z.useState)(!1),[r,s]=(0,z.useState)(""),i=(0,z.useRef)(""),u=(0,z.useRef)(null),o=(0,z.useRef)(void 0),c=(0,z.useRef)(void 0),d=ce(),{loadDDCIframe:m,loadDDCIframeError:g}=ge(),{logDdcInitiated:p,logDdcFinished:y}=ie(),k=()=>{clearInterval(c.current),c.current=void 0,clearTimeout(o.current),o.current=void 0},f=(0,z.useCallback)((()=>{t(!0),s(""),i.current="",u.current=null,k()}),[]),b=(0,z.useCallback)((()=>{o.current=setTimeout((()=>{(0,Y.cB)(new Error("timeout error when doing 3DS2 DDC authentication"),{owner:"trading",context:ye,timeoutLimitInMilliseconds:a}),u.current={errorMessage:n(ke.timeoutError),errorCode:"DDC_MAX_RETRIES"}}),a)}),[n,a]),S=(0,z.useCallback)(((a,n)=>{s(new URL(n).origin),m(a,e,n)}),[e,m]),F=(0,z.useCallback)((e=>{(0,Y.cB)(new Error("Failed to fetch worldpay client token for 3ds2 DDC authentication"),{owner:"trading",context:ye,mutation:"generatePaymentMethodClientToken",vendor:"worldpay",didEntireMutationFail:e}),u.current={errorMessage:n(ke.genericError)}}),[n]);(0,z.useEffect)((()=>()=>{k()}),[]),(0,z.useEffect)((()=>{g&&(u.current={errorMessage:g})}),[g]),(0,z.useEffect)((()=>{const e=e=>{if(e.origin===r)try{const a=JSON.parse(e.data);if(void 0!==a&&"profile.completed"===a.MessageType){if(!a.Status||!a.SessionId)throw new Error;i.current=a.SessionId}}catch(e){(0,Y.cB)((0,se.Xv)(e),{owner:"trading",context:ye}),u.current={errorMessage:n(ke.genericPaymentProcessorError)}}};return window.addEventListener("message",e,!1),()=>{window.removeEventListener("message",e,!1)}}),[r]);const v=(0,z.useCallback)((async()=>{try{return p(),f(),b(),d({onSuccess:S,onError:F}),new Promise(((e,a)=>{c.current=setInterval((()=>{i.current?(k(),t(!1),y("success"),e(i.current)):u.current&&(k(),t(!1),y("fail",u.current.errorMessage,u.current.errorCode),a(new Error(u.current.errorMessage)))}),1e3)}))}catch(e){(0,Y.cB)((0,se.Xv)(e),{owner:"trading",context:ye}),k(),t(!1);const a=n(ke.genericError);return y("fail",a),Promise.reject(new Error(a))}}),[n,F,y,p,d,f,S,b]);return(0,z.useMemo)((()=>({completeDeviceDataCollection:v,deviceDataCollectionLoading:l})),[v,l])}(m),[y,k]=(0,ee.Db)(U),{recurringPeriod:f}=(0,J.jf)(te.cr),b=(0,be.Z)({accountRef:n,viewerAssetRef:l}),S=(0,z.useCallback)((async({variables:e,onSuccess:a,onError:n})=>{if(["apple_pay","google_pay"].includes(u.type)&&!s.current){r(!0);const e=await d();s.current=e,r(!1)}let l;if("paypal_account"===u.type&&(r(!0),l=await d(),r(!1)),u.is3DS2&&!c)try{(0,X.KQ)("card_3ds2_ddc_start"),i.current=await g(),(0,X.KQ)("card_3ds2_ddc_end")}catch(e){return n(e),void(0,X.KQ)("card_3ds2_ddc_end")}const t={...b,recurringPeriod:f.value,braintreeCorrelationId:s.current,paypalCorrelationId:l,pmsvcId:u.pmsvcId,ddc3dsId:i.current,...e};(0,X.Kz)("buy_quote_submitted",{componentType:X.re.modal,action:X.Us.click,paymentMethodType:u.type,hasPaypalCorrelationId:!!t.paypalCorrelationId,hasBraintreeCorrelationId:!!t.braintreeCorrelationId,hasPmsvcId:!!t.pmsvcId,hasDdc3dsId:!!t.ddc3dsId}),y({variables:{input:t},onCompleted:({response:e})=>{const l=e.createBuy;switch(l?.__typename){case"CreateBuyPartialError":return n(new Error(l.error.message));case"CreateBuySuccess":return a(l,t);case"GenericError":return n(new Error(l.message??ne.s.genericError));default:(0,Y.cB)(new Error(`${l?.__typename} __typename received`),{owner:"trading",context:"buy_sell"})}},onError:()=>{n(new Error(o(ne.s.genericError)))}})}),[u.type,u.is3DS2,u.pmsvcId,c,b,f.value,y,d,g,o]);return(0,z.useMemo)((()=>({submitBuy:S,isSubmittingBuy:k||t||p})),[S,k,t,p])}},1306:(e,a,n)=>{n.d(a,{Z:()=>$});const l={fragment:{argumentDefinitions:t=[{defaultValue:null,kind:"LocalArgument",name:"input"}],kind:"Fragment",metadata:null,name:"useSellQuoteSubmitterMutation",selections:[{alias:null,args:r=[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"createSell",plural:!1,selections:[s={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{kind:"InlineDataFragmentSpread",name:"createSellFragment",selections:[{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[i={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"spreadPercentage",storageKey:null},d={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:c=[o={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},m={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:c,storageKey:null},g={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:c,storageKey:null},b={alias:null,args:null,concreteType:"FeeDetails",kind:"LinkedField",name:"fees",plural:!0,selections:[p={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},d,{alias:null,args:null,concreteType:"Disclosure",kind:"LinkedField",name:"disclosure",plural:!1,selections:[y={alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[k={alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"WaivedDetails",kind:"LinkedField",name:"waivedDetails",plural:!1,selections:[d,{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null}],storageKey:null}],storageKey:null},S={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:c,storageKey:null},F={alias:null,args:null,concreteType:"TaxDetails",kind:"LinkedField",name:"taxDetails",plural:!0,selections:[p,d],storageKey:null},v={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"defaultFee",plural:!1,selections:c,storageKey:null},h={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:c,storageKey:null},{kind:"InlineDataFragmentSpread",name:"simpleTradeBenefit_sell",selections:[S,C={alias:null,args:null,kind:"ScalarField",name:"appliedSubscriptionBenefit",storageKey:null},h,T={alias:null,args:null,concreteType:"SubscriptionInfo",kind:"LinkedField",name:"subscriptionInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasBenefitCap",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"freeTradingResetDate",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"remainingFreeTradingVolume",plural:!1,selections:[o],storageKey:null}],storageKey:null}],args:null,argumentDefinitions:[]},A={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"unitPrice",plural:!1,selections:[d],storageKey:null},K={alias:null,args:null,kind:"ScalarField",name:"resource",storageKey:null},{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[x={alias:null,args:null,kind:"ScalarField",name:"hasBeenApplied",storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"redemptionStatus",storageKey:null},B={alias:null,args:null,kind:"ScalarField",name:"endsAt",storageKey:null},L={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutIncentive",plural:!1,selections:c,storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[I={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},R={alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[f,k],storageKey:null},M={alias:null,args:null,concreteType:"TransferUserWarningContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"details",storageKey:null},y,{alias:null,args:null,kind:"ScalarField",name:"linkText",storageKey:null}],storageKey:null}],storageKey:null}],args:null,argumentDefinitions:[]}],type:"CreateSellSuccess",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"error",plural:!1,selections:[_={kind:"InlineFragment",selections:E=[P],type:"GenericError",abstractKey:null},V={kind:"InlineFragment",selections:E,type:"CreateSellBadRequestError",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[D={alias:null,args:null,concreteType:"TransferCancelReason",kind:"LinkedField",name:"cancelReason",plural:!1,selections:[P,I,{alias:null,args:null,kind:"ScalarField",name:"cta",storageKey:null}],storageKey:null}],storageKey:null}],type:"CreateSellPartialError",abstractKey:null},_],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:t,kind:"Operation",name:"useSellQuoteSubmitterMutation",selections:[{alias:null,args:r,concreteType:null,kind:"LinkedField",name:"createSell",plural:!1,selections:[s,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[i,u,d,m,g,b,S,F,v,h,C,T,A,K,{alias:null,args:null,concreteType:"TradeIncentiveInfo",kind:"LinkedField",name:"tradeIncentiveInfo",plural:!1,selections:[x,w,B,L,j={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null},j],storageKey:null},{alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[I,P,R,M,j],storageKey:null}],type:"CreateSellSuccess",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"error",plural:!1,selections:[s,_,V],storageKey:null},{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[D,j],storageKey:null}],type:"CreateSellPartialError",abstractKey:null},_],storageKey:null}]},params:{id:"43f9bd23923740e50929c4dc8ac5e77f7e39d5071f2eaab32e8f50b4267dbdc1",metadata:{},name:"useSellQuoteSubmitterMutation",operationKind:"mutation",text:null}};var t,r,s,i,u,o,c,d,m,g,p,y,k,f,b,S,F,v,h,C,T,A,K,x,w,B,L,I,P,R,M,E,_,V,D,j;l.hash="d095eff198a6c57226e89ac98e305c71";const N=l,O={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSellQuoteSubmitterViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useSharedQuoteParamsViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"a83527eaef66e781ec5da1d334bc444e"},Z=O,U={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSellQuoteSubmitterFragment",selections:[{args:null,kind:"FragmentSpread",name:"useSharedQuoteParamsFragment"}],type:"Account",abstractKey:null,hash:"69c42084e4116bfb01cb0912e8335c2d"},q=U;var Q=n(0),H=n(9),W=n(15),z=n(3),G=n(523),J=n(745);function $({accountRef:e,viewerAssetRef:a}){const n=(0,z.Jc)(q,e),l=(0,z.Jc)(Z,a),{formatMessage:t}=(0,H.Z)(),[r,s]=(0,z.Db)(N),i=(0,J.Z)({accountRef:n,viewerAssetRef:l}),u=(0,Q.useCallback)((({variables:e,onSuccess:a,onError:n})=>{const l={...i,...e};r({variables:{input:l},onCompleted:({response:e})=>{const t=e.createSell;switch(t?.__typename){case"CreateSellPartialError":return n(new Error(t.error.message));case"CreateSellSuccess":return a(t,l);case"GenericError":return n(new Error(t.message??G.s.genericError));default:(0,W.cB)(new Error(`${t?.__typename} __typename received`),{owner:"trading",context:"buy_sell"})}},onError:()=>n(new Error(t(G.s.genericError)))})}),[r,t,i]);return(0,Q.useMemo)((()=>({submitSell:u,isSubmittingSell:s})),[s,u])}},1606:(e,a,n)=>{n.d(a,{Z:()=>l.Z});var l=n(1521)},1548:(e,a,n)=>{n.d(a,{Z:()=>l});const l=(0,n(11).vU)({invalidInputWarning:{id:"BuySell.invalidInputWarning",defaultMessage:"Please enter a valid input amount."}})},948:(e,a,n)=>{n.d(a,{$:()=>r});const l={kind:"InlineDataFragment",name:"createBuyFragment",hash:"a682e71fb7acc3025eb629b3272f30d5"},t=l;n(3);const r=t},949:(e,a,n)=>{n.d(a,{P:()=>r});const l={kind:"InlineDataFragment",name:"createSellFragment",hash:"e3f9856892a2a9a5cf07ee39777ea23a"},t=l;n(3);const r=t},1608:(e,a,n)=>{n.d(a,{Z:()=>t});var l=n(0);const t=function({recurringBuyPolicyRestrictionCount:e,recurringPayment:a,hasRecurringOptions:n}){const t="WEEKLY"===a,[r,s]=(0,l.useState)(t),i=null===(0,l.useRef)(a).current,u=(0,l.useMemo)((()=>e>0),[e]);return{hasConvertTradeToRecurringSwitch:(0,l.useMemo)((()=>i&&!u&&n),[i,u,n]),isToggled:r,setIsToggled:s}}},550:(e,a,n)=>{n.d(a,{ZP:()=>h,hS:()=>S,oT:()=>v,sY:()=>F});var l=n(0),t=n(8),r=n.n(t),s=n(11),i=n(9),u=n(53),o=n(285),c=n(15),d=n(105),m=n(1466),g=n(3647),p=n(125),y=n(107),k=n(374),f=n(188),b=n(2);const S=(0,s.vU)({previewHeader:{id:"BuySellStepper.PreviewStep.previewHeader",defaultMessage:"Order preview"},previewHeaderAddCash:{id:"BuySellStepper.PreviewStep.previewHeaderAddCash",defaultMessage:"Add cash preview"},priceLabel:{id:"BuySellStepper.PreviewStep.priceLabel",defaultMessage:"Price"},seeMore:{id:"BuySellStepper.PreviewStep.seeMore",defaultMessage:"See more"},totalLabel:{id:"BuySellStepper.PreviewStep.totalLabel",defaultMessage:"Total"},free:{id:"BuySellStepper.PreviewStep.free",defaultMessage:"Free"},buySellPreviewHeaderLabel:{id:"BuySellStepper.PreviewStep.buySellPreviewHeaderLabel",defaultMessage:"amount of asset to {buyOrSell} {orderAmount}"},buyLabel:{id:"BuySellStepper.PreviewStep.buyLabel",defaultMessage:"buy"},sellLabel:{id:"BuySellStepper.PreviewStep.sellLabel",defaultMessage:"sell"}}),F=(0,s.vU)({buyButton:{id:"BuySellStepper.PreviewStep.buyButton",defaultMessage:"Buy now"},recurringLabel:{id:"BuySellStepper.PreviewStep.recurringLabel",defaultMessage:"Recurring"},buyActionLabel:{id:"BuySellStepper.PreviewStep.buyActionLabel",defaultMessage:"Purchase"},addCashActionLabel:{id:"BuySellStepper.PreviewStep.addCashActionLabel",defaultMessage:"Amount"},buyTotalLabel:{id:"BuySellStepper.PreviewStep.buyTotalLabel",defaultMessage:"Total"},wblNoticeText:{id:"BuySellStepper.PreviewStep.wblNoticeText",defaultMessage:"Trade instantly on Coinbase, available to send in {holdDays} days."},wblNoticeTextInHeader:{id:"BuySellStepper.PreviewStep.wblNoticeTextInHeader",defaultMessage:"Trade instantly, available to send in {holdDays} days"},wblNoticeLink:{id:"BuySellStepper.PreviewStep.wblNoticeLink",defaultMessage:"Need to send instantly?"},wblNoticeTextNew:{id:"BuySellStepper.PreviewStep.wblNoticeTextNew",defaultMessage:"Trade your {assetCode} <now>now</now> while we wait for your funds. You can send your {assetCode} in up to {holdDays}."},wblNoticeTextNewHoldDays:{id:"BuySellStepper.PreviewStep.wblNoticeTextNewHoldDays",defaultMessage:"{holdDays} days"},instantAchEntireText:{id:"BuySellStepper.PreviewStep.instantAchEntireText",defaultMessage:"Want to send your {assetCode}? You can send the full amount <b>instantly</b>."},instantAchPartialText:{id:"BuySellStepper.PreviewStep.instantAchPartialText",defaultMessage:"Want to send your {assetCode}? You can send {amount} in {assetCode} <b>instantly</b>. The rest of your purchase will be available to send in <b>{x} days</b>, after your funds arrive."},processedByText:{id:"BuySellStepper.PreviewStep.processedByText",defaultMessage:"Processed by"},processedByLink:{id:"BuySellStepper.PreviewStep.processedByLink",defaultMessage:"Coinbase UK, Ltd."},promoDescription:{id:"BuySellStepper.PreviewStep.promoDescription",defaultMessage:"Until June 30th, enjoy flat 1.49% fees on all recurring buys. After that, fees return to normal."},promoLink:{id:"BuySellStepper.PreviewStep.promoLink",defaultMessage:"Learn more about our fees."},recurringReward:{id:"BuySellStepper.PreviewStep.recurringReward",defaultMessage:"You'll earn {reward} {assetSymbol} after your {nth} buy"},recurringRewardMultiplePayouts:{id:"BuySellStepper.PreviewStep.recurringRewardMultiplePayouts",defaultMessage:"You'll earn {reward} {assetSymbol} after both your {nth} buys"},recurringRewardNudge:{id:"BuySellStepper.PreviewStep.recurringRewardNudge",defaultMessage:"Add {amount} and get {reward} {assetSymbol} after your {nth} recurring buy"},recurringRewardNudgeMultiplePayouts:{id:"BuySellStepper.PreviewStep.recurringRewardNudgeMultiplePayouts",defaultMessage:"Add {amount} and get {reward} {assetSymbol} after both your {nth} buys"},recurringRewardAdd:{id:"BuySellStepper.PreviewStep.recurringRewardAdd",defaultMessage:"Add {amount}"},recurringTransactionRewardTerms:{id:"BuySellStepper.PreviewStep.recurringTransactionRewardTerms",defaultMessage:"See terms for this recurring buy offer."},feeWaived:{id:"BuySellStepper.PreviewStep.feeWaived",defaultMessage:"We've waived the fee on your first Coinbase purchase. <b>Enjoy your crypto!</b>"},upsellRecurringBuyTitle:{id:"BuySellStepper.PreviewStep.upsellRecurringBuyTitle",defaultMessage:"Make this a weekly buy?"},upsellRecurringBuyDescription:{id:"BuySellStepper.PreviewStep.upsellRecurringBuyDescription",defaultMessage:"You can cancel any time"},upsellRecurringBuyButton:{id:"BuySellStepper.PreviewStep.upsellRecurringBuyButton",defaultMessage:"Yes"},tdsLabel:{id:"BuySellStepper.PreviewStep.tdsLabel",defaultMessage:"TDS"},gstLabel:{id:"BuySellStepper.PreviewStep.gstLabel",defaultMessage:"GST"},addCashBuyButton:{id:"BuySellStepper.PreviewStep.addCashBuyButton",defaultMessage:"Add cash now"},transferCashButton:{id:"BuySellStepper.PreviewStep.transferCashButton",defaultMessage:"Place order"}}),v=e=>{const a=(0,i.Z)(),{formatMessage:n}=a,t=(0,c.$T)(),{selectedAsset:s}=(0,p.f)(),v=(0,d.Z)(),{isFiatInput:h,buyQuoteResponse:C}=(0,u.jf)(y.cr),T=(0,f.m)("buy"),A=C.value?.transferBuy;r()(A,"There should be a quote response");const K=(0,k.Z)(),{subtotal:x,amount:w,total:B,unitPrice:L,holdDays:I=0,recurringPayment:P,instantAch:R}=A,M=t({amount:w,isFiat:!1}),E=t({amount:B,isFiat:!0}),_=t({amount:L.amount,isFiat:!0,exponent:(0,o.Z)(parseFloat(L.amount.value))}),V=t({amount:x,isFiat:!0}),D=P??"never",j="never"!==D?(0,g._)({formatMessage:n,period:D,amount:h.value?E:M}):void 0,N="never"!==D?(0,g.U)({formatMessage:n,period:D}):void 0,O=n(F.feeWaived,{b:e=>[(0,b.jsx)("b",{children:e},"feeWaived")]}),Z=0===I?void 0:n(F.wblNoticeText,{holdDays:I}),U=0===I?void 0:n(F.wblNoticeTextInHeader,{holdDays:I}),q=0===I||R?void 0:n(F.wblNoticeTextNew,{holdDays:(0,b.jsx)("b",{children:n(F.wblNoticeTextNewHoldDays,{holdDays:I})}),assetCode:s.displaySymbol,now:e=>[(0,b.jsx)("b",{children:e})]}),Q=R?R.isTotalInstant||0===I?n(F.instantAchEntireText,{assetCode:s.displaySymbol,b:e=>[(0,b.jsx)("b",{children:e},"limitPeriod")]}):n(F.instantAchPartialText,{assetCode:s.displaySymbol,b:e=>[(0,b.jsx)("b",{children:e},"limitPeriod")],x:I,amount:t({amount:R.instantAchAmount,isFiat:!0,exponent:0})}):void 0,H=(0,l.useMemo)((()=>n(S.buySellPreviewHeaderLabel,{buyOrSell:n(S.buyLabel),orderAmount:M})),[M,n]);let W=n(F.buyButton),z=n(S.previewHeader),G=n(F.buyActionLabel);return"cashIn"===e&&(W=n(F.addCashBuyButton),z=n(S.previewHeaderAddCash),G=n(F.addCashActionLabel)),"cashTransfer"===e&&(W=n(F.transferCashButton)),{header:z,cryptoAmount:M,paymentLabel:T.selectPaymentLabel,paymentValue:K.label,recurringLabel:n(F.recurringLabel),recurringValue:j,recurringValueDetails:N,priceLabel:n(S.priceLabel),priceValue:`${_} / ${s.displaySymbol}`,priceValueShort:`${_}`,actionLabel:G,actionValue:V,totalLabel:n(F.buyTotalLabel),totalValue:E,button:W,wblNoticeText:Z,wblNoticeTextInHeader:U,wblNoticeTextNew:q,instantAchText:Q,wblNoticeLink:n(F.wblNoticeLink),processedByText:n(F.processedByText),processedByLink:n(F.processedByLink),promoDescription:n(F.promoDescription),promoLink:n(F.promoLink),recurringReward:(e,a)=>n(1===a.length?F.recurringReward:F.recurringRewardMultiplePayouts,{reward:t({amount:{amount:e.value,currency:e.currency},isFiat:!0,exponent:0}),assetSymbol:"BTC",nth:(0,m.z)(a,n)}),recurringRewardNudge:(e,a,l)=>n(1===l.length?F.recurringRewardNudge:F.recurringRewardNudgeMultiplePayouts,{amount:t({amount:{value:e,currency:K?.currency??v},isFiat:!0}),reward:t({amount:a,isFiat:!0,exponent:0}),assetSymbol:"BTC",nth:(0,m.z)(l,n)}),recurringRewardAdd:e=>n(F.recurringRewardAdd,{amount:t({amount:{amount:e,currency:K?.currency??v},isFiat:!0})}),recurringTransactionRewardTerms:n(F.recurringTransactionRewardTerms),feeWaived:O,free:n(S.free),seeMore:n(S.seeMore),upsellRecurringBuyTitle:n(F.upsellRecurringBuyTitle),upsellRecurringBuyDescription:n(F.upsellRecurringBuyDescription),upsellRecurringBuyButton:n(F.upsellRecurringBuyButton),tdsLabel:n(F.tdsLabel),gstLabel:n(F.gstLabel),accessibilityLabel:H}},h=v},3895:(e,a,n)=>{n.d(a,{Z:()=>k});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"CardUpsellBannerFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"RecurringTransaction",kind:"LinkedField",name:"recurringTransactions",plural:!0,selections:[{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"account",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"3f38ef0be17c79f9c61109c2f93748fb"},t=l;var r=n(0),s=n(53),i=n(3),u=n(84),o=n(73),c=n(3896),d=n(107),m=n(572),g=n(2);function p({queryRef:e,commitData:a}){const{viewer:{recurringTransactions:n}}=(0,i.Jc)(t,e),{goToStep:l}=(0,o.tC)(d.Ex),{recurringPeriod:u}=(0,s.jf)(d.cr),p=(0,m.Z)(),y=(0,r.useMemo)((()=>{const e=n?.some((e=>e.account?.assetOrFiatCurrency?.asset?.platformName===a.amount.currency)),l=!!a.recurringPayment;return e||l}),[n,a.recurringPayment,a.amount.currency]),k=(0,r.useCallback)((()=>{u.onChange("weekly"),l("entry")}),[l,u]);return p&&!y?(0,g.jsx)(c.Z,{onAddFunds:k,"data-element":"SharedCardUpsellBanner","data-component":"CardUpsellBannerContent"}):null}function y({commitData:e,queryRef:a}){return(0,g.jsx)(u.Z,{owner:"trading",name:"CardUpsellBanner",fallback:null,errorFallback:()=>null,context:"buy_sell","data-element":"Boundary","data-component":"CardUpsellBanner",children:(0,g.jsx)(p,{queryRef:a,commitData:e,"data-element":"CardUpsellBannerContent"})})}const k=(0,r.memo)(y)},3897:(e,a,n)=>{n.d(a,{Z:()=>b});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"StakePromoBannerFragment",selections:[{args:null,kind:"FragmentSpread",name:"useYieldPromotionHandlerFragment"}],type:"Query",abstractKey:null,hash:"126e59bb3490be8b20b2a28ccebe0d1b"},t=l;var r=n(0),s=n(11),i=n(9),u=n(515),o=n(61),c=n(4),d=n(14),m=n(3),g=n(65),p=n(3617),y=n(2);const k=(0,s.vU)({headline:{id:"VerifySSNBanner.headline",defaultMessage:"Stake your ETH to earn 4.50% variable APY"},linkText:{id:"VerifySSNBanner.linkText",defaultMessage:"Stake now"}});function f({queryRef:e}){const a=(0,m.Jc)(t,e),{formatMessage:n}=(0,i.Z)(),l=(0,g._x)(),s=(0,p.Z)({queryRef:a,link:"https://www.coinbase.com/eth2/stake"}),f=(0,r.useCallback)((()=>{l(),s()}),[l,s]);return(0,y.jsx)(c.Box,{width:"100%",spacingTop:4,"data-element":"Box","data-component":"StakePromoBanner",children:(0,y.jsx)(u.Card,{width:"100%","data-element":"Card",children:(0,y.jsxs)(c.HStack,{justifyContent:"space-between",alignItems:"flex-end","data-element":"HStack",children:[(0,y.jsxs)(c.VStack,{spacing:2,alignItems:"flex-start","data-element":"VStack",children:[(0,y.jsx)(d.TextHeadline,{as:"p",spacingBottom:.5,"data-element":"TextHeadline",children:n(k.headline)}),(0,y.jsx)(d.Link,{onPress:f,variant:"label1",color:"primary","data-element":"Link",children:n(k.linkText)})]}),(0,y.jsx)(o.SpotSquare,{name:"ethStaking","data-element":"SpotSquare"})]})})})}const b=(0,r.memo)(f)},950:(e,a,n)=>{n.d(a,{Z:()=>o});var l=n(0),t=n(3),r=n(545),s=n(2);const i=(0,l.memo)((function({tradeType:e,assetId:a,assetSymbol:n}){return(0,r.e)("COMPLETE_ASSET_BUY",e,{uuid:a,symbol:n}),null}));function u(e){return(0,s.jsx)(t.zq,{instrumentationId:"TradeDropOffNotification",fallback:null,"data-element":"InstrumentedSuspense","data-component":"TradeDropOffNotification",children:(0,s.jsx)(i,{...e,"data-element":"TradeDropOffNotificationContent"})})}const o=(0,l.memo)(u)},3898:(e,a,n)=>{n.d(a,{Z:()=>y});var l=n(0),t=n(11),r=n(9),s=n(32),i=n(515),u=n(61),o=n(4),c=n(14),d=n(65),m=n(2);const g=(0,t.vU)({headline:{id:"VerifySSNBanner.headline",defaultMessage:"Ready to earn rewards?"},subtitle:{id:"VerifySSNBanner.subtitle",defaultMessage:"We need to verify your Social Security number."}});function p(){const e=(0,s.k6)(),a=(0,d._x)(),{formatMessage:n}=(0,r.Z)(),t=(0,l.useCallback)((()=>{a(),e.push("/earn/ssn-verify")}),[e,a]);return(0,m.jsx)(i.Card,{spacing:1,spacingStart:2,onPress:t,"data-element":"Card","data-component":"VerifySSNBanner",children:(0,m.jsxs)(o.HStack,{"data-element":"HStack",children:[(0,m.jsxs)(o.VStack,{justifyContent:"center","data-element":"VStack",children:[(0,m.jsx)(c.TextHeadline,{as:"h4",color:"foreground","data-element":"TextHeadline",children:n(g.headline)}),(0,m.jsx)(o.Spacer,{vertical:.5,"data-element":"Spacer"}),(0,m.jsx)(c.TextBody,{as:"p",color:"foregroundMuted","data-element":"TextBody",children:n(g.subtitle)})]}),(0,m.jsx)(u.SpotSquare,{name:"yieldCenter",scaleMultiplier:.75,"data-element":"SpotSquare"})]})})}const y=(0,l.memo)(p)},3690:(e,a,n)=>{n.d(a,{N:()=>t});var l=n(7);function t(e){return(0,l.Kz)("trade_card_banner_card",{action:l.Us.click,componentType:l.re.card,name:e})}},1546:(e,a,n)=>{n.d(a,{Z:()=>m});var l=n(0),t=n(11),r=n(9),s=n(4),i=n(14),u=n(136),o=n(2);const c=(0,t.vU)({timeRemaining:{id:"TimeRemaining.timeRemaining",defaultMessage:"time remaining"}});function d({timeRemaining:e,testID:a,showTitle:n=!0}){const{formatMessage:l}=(0,r.Z)(),t=new Date(e);return(0,o.jsxs)(s.VStack,{alignContent:"center",alignItems:"center","data-element":"VStack","data-component":"TimeRemaining",children:[(0,o.jsxs)(s.HStack,{testID:a,"data-element":"HStack",children:[(0,o.jsx)(s.Box,{background:"backgroundAlternate",borderRadius:"rounded",spacing:1,"data-element":"Box",children:(0,o.jsx)(u.TextHeadline,{as:"p",mono:!0,align:"center",testID:"minutes-remaining","data-element":"TextHeadline",children:String(t.getUTCMinutes()).padStart(2,"0")})}),(0,o.jsx)(s.Box,{spacing:1,"data-element":"Box",children:(0,o.jsx)(u.TextHeadline,{as:"p","data-element":"TextHeadline",children:":"})}),(0,o.jsx)(s.Box,{background:"backgroundAlternate",borderRadius:"rounded",spacing:1,"data-element":"Box",children:(0,o.jsx)(u.TextHeadline,{as:"p",mono:!0,align:"center",testID:"seconds-remaining","data-element":"TextHeadline",children:String(t.getUTCSeconds()).padStart(2,"0")})})]}),n?(0,o.jsx)(i.TextBody,{as:"p",spacingTop:1,align:"center",children:l(c.timeRemaining)}):null]})}const m=(0,l.memo)(d)},2409:(e,a,n)=>{n.d(a,{$5:()=>s,Ah:()=>i,Pc:()=>t,gj:()=>r,kI:()=>o,uY:()=>c,xq:()=>u});var l=n(15);const t="SECURE3D_ACCOUNT_ID",r="SECURE3D_TRANSFER_DATA",s="SECURE3D_PAYMENT_METHOD_ID",i="SECURE3D_ORIGIN_ROUTE",u="SECURE3D_PARES",o=()=>{const e=localStorage.getItem(t),a=localStorage.getItem(r),n=localStorage.getItem(s),i=localStorage.getItem(u);if(e&&a&&n&&i)return{accountId:e,transferData:JSON.parse(a),paymentMethodId:n,pares:i};{const t=Object.fromEntries(Object.entries({accountId:e,transferData:a,paymentMethodId:n,pares:i}).filter((([e,a])=>null!==a)));(0,l.cB)(new Error("Missing secure3d data"),{owner:"trading",context:"buy_sell",localStorageKeys:Object.keys(localStorage),...t})}},c=()=>{localStorage.removeItem(t),localStorage.removeItem(r),localStorage.removeItem(s),localStorage.removeItem(u),localStorage.removeItem(i)}},748:(e,a,n)=>{n.d(a,{Z:()=>y});var l=n(0),t=n(53),r=n(3645),s=n(125),i=n(573),u=n(73),o=n(107),c=n(140),d=n(572),m=n(951),g=n(188),p=n(2);function y({onPressMax:e,disabled:a,showOrderTypeSelector:n}){const{recurringPeriod:y,transferType:k,orderType:f}=(0,t.jf)(o.cr),{goToStep:b}=(0,u.tC)(o.Ex),{variant:S}=(0,s.f)(),F=(0,d.Z)(),v=(0,m.Z)({variant:S}),h=(0,i.Z)(),C=(0,g.m)(k.value),{trackEvent:T}=(0,c.Z)(),A=(0,l.useCallback)((()=>{T("_tapped_select_order_type",{step:"order_input"}),b("recurringSelect")}),[b,T]),K=(0,l.useCallback)((()=>{T("_tapped_select_order_type",{step:"order_input"}),b("orderTypeSelect")}),[b,T]);return"cashTransfer"===S&&e?(0,p.jsx)(r.Z,{disabled:a,onPress:e,testID:"transfer-all",children:C.sellAll}):n?(0,p.jsx)(r.Z,{onPress:K,endIcon:"caretDown",testID:"order-type-selector",children:"never"!==y.value?v(y.value).title:h(f.value).title}):"sell"===k.value&&e?(0,p.jsx)(r.Z,{disabled:a,onPress:e,testID:"sell-all",children:C.sellAll}):F?(0,p.jsx)(r.Z,{disabled:a,onPress:A,endIcon:"caretDown",testID:"recurring-period",children:v(y.value).title}):null}},1610:(e,a,n)=>{n.d(a,{Z:()=>g});var l=n(0),t=n(9),r=n(10),s=n(35),i=n(4),u=n(7),o=n(105),c=n(2);function d({amounts:e,onPressAmount:a,disabled:n,testID:r}){const[d,g]=(0,l.useState)(),{formatNumber:p}=(0,t.Z)(),y=(0,o.Z)(),k=(0,l.useCallback)((e=>{g(e),a(e),(0,u.Kz)("buy_preset_increment_cta_button",{componentType:u.re.button,action:u.Us.click,amount:e})}),[a]),f=(0,l.useMemo)((()=>{const a=e.map((e=>(0,c.jsx)(s.Button,{compact:!0,variant:"secondary",disabled:n,loading:d===e,onPress:()=>k(e),testID:`buy-preset-amount-${e}`,children:p(Number.parseInt(e),{notation:"compact",style:"currency",currency:y,currencyDisplay:"narrowSymbol"})},e)));return(0,c.jsx)(i.VStack,{children:(0,c.jsx)(m,{children:a})})}),[e,n,d,p,y,k]);return(0,c.jsx)(c.Fragment,{children:(0,c.jsxs)(i.VStack,{testID:r,children:[f,(0,c.jsx)(i.Spacer,{vertical:2})]})})}const m=r.ZP.div.withConfig({displayName:"PresetAmountsPanel__ButtonGrid",componentId:"sc-55uzj-0"})(["display:flex;justify-content:space-between;"]),g=(0,l.memo)(d)},1549:(e,a,n)=>{n.d(a,{y:()=>d});n(0);var l=n(11),t=n(9),r=n(4),s=n(7),i=n(3604),u=n(2);const o=(0,l.vU)({buyPowerText:{id:"BuySellStepper.TradeInputHelper.buyPowerText",defaultMessage:"You can {intent} up to {limit}"},sellPowerText:{id:"BuySellStepper.TradeInputHelper.sellPowerText",defaultMessage:"You can sell up to {limit}"},intentPurchase:{id:"BuySellStepper.TradeInputHelper.buyPowerActionPurchase",defaultMessage:"buy"},intentDeposit:{id:"BuySellStepper.TradeInputHelper.buyPowerActionDeposit",defaultMessage:"deposit"}});function c({children:e}){return(0,s.bH)("trading_ex_buy_power_viewed",{componentType:s.re.page}),(0,u.jsx)(u.Fragment,{children:e})}function d({transferType:e,amount:a,fiatLimit:n,fiatCode:l,variant:s}){const{formatMessage:d,formatNumber:m}=(0,t.Z)();if(!(!a&&n&&!("cashTransfer"===s)&&!("cashOut"===s&&"sell"===e)))return(0,u.jsx)(r.HStack,{spacingTop:2,spacingBottom:.5});let g;switch(e){case"buy":return g=o.intentPurchase,"cashIn"===s&&(g=o.intentDeposit),(0,u.jsx)(c,{children:d(o.buyPowerText,{intent:d(g),limit:m(Number((0,i.h)(n.toString(),2))||0,{style:"currency",currency:l})})});case"sell":return(0,u.jsx)(u.Fragment,{children:d(o.sellPowerText,{limit:m(n||0,{style:"currency",currency:l})})});default:return null}}},188:(e,a,n)=>{n.d(a,{m:()=>c,s:()=>o});var l=n(0),t=n(11),r=n(9),s=n(1544),i=n(125),u=n(1499);const o=(0,t.vU)({buyAssetHeader:{id:"BuySellStepper.EntryStep.buyAssetHeader",defaultMessage:"Buy {assetName}"},buyDefaultButton:{id:"BuySellStepper.EntryStep.buyDefaultButton",defaultMessage:"Buy {assetName}"},sellDefaultButton:{id:"BuySellStepper.EntryStep.sellDefaultButton",defaultMessage:"Sell {assetName}"},buyPreviewButton:{id:"BuySellStepper.EntryStep.buyPreviewButton",defaultMessage:"Preview Buy"},sellPreviewButton:{id:"BuySellStepper.EntryStep.sellPreviewButton",defaultMessage:"Preview Sell"},buySelectAssetLabel:{id:"BuySellStepper.EntryStep.buySelectAssetLabel",defaultMessage:"Buy"},sellSelectAssetLabel:{id:"BuySellStepper.EntryStep.sellSelectAssetLabel",defaultMessage:"Sell"},buySelectPaymentLabel:{id:"BuySellStepper.EntryStep.buySelectPaymentLabel",defaultMessage:"Pay with"},sellSelectPaymentLabel:{id:"BuySellStepper.EntryStep.sellSelectPaymentLabel",defaultMessage:"Add to"},sellEmptyError:{id:"BuySellStepper.EntryStep.sellEmptyError",defaultMessage:"You don’t have any {assetName} to sell. Try buying some to get started."},sellAll:{id:"BuySellStepper.EntryStep.sellAll",defaultMessage:"Sell all"},achBuyDisabled:{id:"BuySellStepper.EntryStep.achBuyDisabled",defaultMessage:"Buying crypto with a bank account is temporarily unavailable. Please use a different payment method."},addCashDefaultButton:{id:"BuySellStepper.EntryStep.addCashDefaultButton",defaultMessage:"Add cash"},addCashPreviewButton:{id:"BuySellStepper.EntryStep.addCashPreviewButton",defaultMessage:"Preview"},addCashSelectAssetLabel:{id:"BuySellStepper.EntryStep.addCashSelectAssetLabel",defaultMessage:"Add"},cashOutDefaultButton:{id:"BuySellStepper.EntryStep.cashOutDefaultButton",defaultMessage:"Cash out"},cashOutPreviewButton:{id:"BuySellStepper.EntryStep.cashOutPreviewButton",defaultMessage:"Preview"},cashOutSelectAssetLabel:{id:"BuySellStepper.EntryStep.cashOutSelectAssetLabel",defaultMessage:"Cash out"},cashOutSelectPaymentLabel:{id:"BuySellStepper.EntryStep.cashOutSelectPaymentLabel",defaultMessage:"Deposit to"},amountMax:{id:"BuySellStepper.EntryStep.amountMax",defaultMessage:"Max"},transferCashDefaultButton:{id:"BuySellStepper.EntryStep.transferCashDefaultButton",defaultMessage:"Convert"},transferCashPreviewButton:{id:"BuySellStepper.EntryStep.transferCashPreviewButton",defaultMessage:"Preview convert"},transferCashTargetLabel:{id:"BuySellStepper.EntryStep.transferCashTargetLabel",defaultMessage:"From"},transferCashDestinationLabel:{id:"BuySellStepper.EntryStep.transferCashDestinationLabel",defaultMessage:"To"},transferCashEmptyError:{id:"BuySellStepper.EntryStep.transferCashEmptyError",defaultMessage:"You don’t have any {name} to convert. Try adding some to get started."},price:{id:"BuySellStepper.EntryStep.price",defaultMessage:"Price"},available:{id:"BuySellStepper.EntryStep.available",defaultMessage:"Available"},limit:{id:"BuySellStepper.EntryStep.limit",defaultMessage:"Limit"},balance:{id:"BuySellStepper.EntryStep.balance",defaultMessage:"Balance"},earnReward:{id:"BuySellStepper.EntryStep.earnReward",defaultMessage:"Earns {percent} {apy}"}});function c(e){const{selectedAsset:a,entryPoint:n,variant:t}=(0,i.f)(),c=(0,u.Z)(a.name),{formatMessage:d}=(0,r.Z)(),m="advanced-trade-convert-modal"===n,{buyAssetHeader:g,defaultButton:p,previewButton:y,selectAssetLabel:k,selectPaymentLabel:f,sellAll:b,achBuyDisabled:S,sellEmptyError:F,price:v,limit:h,available:C,balance:T}=(0,l.useMemo)((()=>{const a=d(o.buyAssetHeader,{assetName:c}),n=d(o.price),l=d(o.limit),r=d(o.available),i=d(o.balance);let u=d(o[`${e}DefaultButton`],{assetName:c}),g=d(o[`${e}PreviewButton`]),p=d(o[`${e}SelectAssetLabel`]),y=d(o[`${e}SelectPaymentLabel`]),k=d(o.sellAll);const f=d(o.achBuyDisabled);let b=d(o.sellEmptyError,{assetName:c});return"cashIn"===t&&(u=d(o.addCashDefaultButton),g=d(o.addCashPreviewButton),p=d(o.addCashSelectAssetLabel)),"cashOut"===t&&(u=d(o.cashOutDefaultButton),g=d(o.cashOutPreviewButton),p=d(o.cashOutSelectAssetLabel),y=d(o.cashOutSelectPaymentLabel),k=d(o.amountMax)),"cashTransfer"===t&&(u=d(o.transferCashDefaultButton),g=d(o.transferCashPreviewButton),k=d(o.amountMax),b=d(o.transferCashEmptyError,{name:c}),"buy"===e&&(p=d(o.transferCashDestinationLabel),y=d(o.transferCashTargetLabel)),"sell"===e&&(p=d(o.transferCashTargetLabel),y=d(o.transferCashDestinationLabel))),m&&(k=d(s.H.sellAll),b=d(s.H.sellEmptyError,{assetName:c}),u=d(s.H.sellDefaultButton,{assetName:c}),g=d(s.H.sellPreviewButton),p=d(s.H.sellSelectAssetLabel),y=d(s.H.sellSelectPaymentLabel)),{buyAssetHeader:a,defaultButton:u,previewButton:g,selectAssetLabel:p,selectPaymentLabel:y,sellAll:k,achBuyDisabled:f,sellEmptyError:b,price:n,limit:l,available:r,balance:i}}),[d,c,e,t,m]);return(0,l.useMemo)((()=>({buyAssetHeader:g,defaultButton:p,previewButton:y,selectAssetLabel:k,selectPaymentLabel:f,sellAll:b,sellEmptyError:F,achBuyDisabled:S,price:v,limit:h,available:C,balance:T})),[S,g,p,y,v,k,f,b,F,h,C,T])}},1307:(e,a,n)=>{n.d(a,{Z:()=>ya});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EntryStepBuySellAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,fragment:{args:null,kind:"FragmentSpread",name:"AssetIsStablecoinFragment"},kind:"RelayResolver",name:"isStablecoin",resolverModule:n(280).W,path:"asset.isStablecoin"}],storageKey:null},{args:null,kind:"FragmentSpread",name:"EntryInputFragment"},{args:null,kind:"FragmentSpread",name:"EntryInputV2Fragment"},{args:null,kind:"FragmentSpread",name:"RewardApyLabelFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAssetOrCurrencyFragment"},{args:null,kind:"FragmentSpread",name:"useAssetSelectorViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useTransferQuoteSubmitterViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useTransferQuoterViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useIsInputDisabledFragment"}],type:"ViewerAsset",abstractKey:null,hash:"5f65f76dc209c9918de484e0d175d900"},t=l,r={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EntryStepBuySellAccountFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useAssetBalanceInfoAccountFragment"},{args:null,kind:"FragmentSpread",name:"useTransferQuoterFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterAccountFragment"},{args:null,kind:"FragmentSpread",name:"useTransferQuoteSubmitterFragment"},{args:null,kind:"FragmentSpread",name:"SimpleTradeFixedAmountsAccountFragment"}],type:"Account",abstractKey:null,hash:"374458b2e9462261eca5019f906a5fdd"},s=r,i={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EntryStepBuySellFragment",selections:[{args:null,kind:"FragmentSpread",name:"useLimitGetterForTransferType"},{args:null,kind:"FragmentSpread",name:"useCurrencyConverterFragment"},{args:null,kind:"FragmentSpread",name:"useAssetBalanceInfoFragment"},{args:null,kind:"FragmentSpread",name:"BuySellFooterQueryFragment"},{args:null,kind:"FragmentSpread",name:"BuySellEntrySelectorFragment"},{args:null,kind:"FragmentSpread",name:"useTransferQuoterQueryFragment"},{args:null,kind:"FragmentSpread",name:"SimpleTradeFixedAmountsFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"BalanceData",kind:"LinkedField",name:"balanceData",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"balanceInWbl",plural:!1,selections:u=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"fiatAccounts",plural:!0,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:u,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],type:"TiersCurrency",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useBuyPresetAmountsFragment"}],type:"Query",abstractKey:null};var u;i.hash="3933a528a169c4f64751297cca02534d";const o=i;var c=n(0),d=n(33),m=n(11),g=n(9),p=n(60),y=n(506),k=n(35),f=n(19),b=n(179),S=n(52),F=n(7),v=n(15),h=n(3),C=n(350),T=n(3587),A=n(1607),K=n(1432),x=n(271),w=n(273),B=n(107);const L={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuySellEntrySelectorFragment",selections:[{args:null,kind:"FragmentSpread",name:"useGetFormattedCurrentFiatPriceOfOneAssetFragment"}],type:"Query",abstractKey:null,hash:"bf58553170847cc3a2e8c589fac6cac7"},I=L;var P=n(285),R=n(188),M=n(746),E=n(105),_=n(747),V=n(2);function D({row1:e,row2:a,onClickSwitcher:n,switcherIcon:l="arrowsVertical",transferType:t,selectedViewerAssetDisplaySymbol:r="",activePaymentMethodFiatCode:s,activePaymentMethodType:i,activePaymentConciseDescription:u,assetBalanceInFiat:o,fiatLimit:d,queryRef:m,variant:p,isNewDesign:y}){const k=(0,h.Jc)(I,m),f=(0,v.$T)(),{formatNumber:b}=(0,g.Z)(),S=(0,R.m)(t),F="buy"===t,C=(0,E.Z)(),T=(0,M.X)({assetDisplaySymbol:r,fiatCode:C,queryRef:k}),A=(0,c.useMemo)((()=>F?y?void 0:T:f({amount:{value:o.amount??"",currency:C??""},isFiat:!0,exponent:(0,P.Z)(Number(o.amount)||0)})),[o.amount,T,f,F,y,C]),K=(0,c.useMemo)((()=>{if(A&&A.trim())return F?S.price:S.available}),[F,S.available,S.price,A]),x=(0,c.useMemo)((()=>"sell"===t?u:d?b(d,{style:"currency",currency:s,maximumFractionDigits:2,minimumFractionDigits:2}):void 0),[u,s,d,b,t]),w=(0,c.useMemo)((()=>{if(x&&x.trim()&&"cashOut"!==p)return F?"fiat_account"===i?S.available:S.limit:S.balance}),[x,p,F,i,S.available,S.limit,S.balance]),B=(0,c.useMemo)((()=>({...e,detail:A,subdetail:K})),[e,A,K]),L=(0,c.useMemo)((()=>({...a,detail:x,subdetail:w})),[a,x,w]);return(0,V.jsx)(_.r,{row1:B,row2:L,onClickSwitcher:n,switcherIcon:l,isNewDesign:y,"data-element":"EntrySelector","data-component":"BuySellEntrySelector"})}var j=n(1308),N=n(110),O=n(268),Z=n(287),U=n(1309),q=n(1310),Q=n(799),H=n(545),W=n(1434),z=n(838),G=n(115),J=n(23),$=n(65),Y=n(839),X=n(125),ee=n(187),ae=n(224),ne=n(1303),le=n(1311),te=n(911),re=n(140),se=n(374);const ie={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useTransferQuoterQueryFragment",selections:[{args:null,kind:"FragmentSpread",name:"useBuyQuoterFragment"},{args:null,kind:"FragmentSpread",name:"useSellQuoterFragment"}],type:"Query",abstractKey:null,hash:"217f8ddcd2d4f862431dc3ed3061445f"},ue=ie,oe={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useTransferQuoterViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useSharedQuoteParamsViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"5913f220dfde16b12b1117f8e14ee028"},ce=oe,de={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useTransferQuoterFragment",selections:[{args:null,kind:"FragmentSpread",name:"useSharedQuoteParamsFragment"}],type:"Account",abstractKey:null,hash:"199562f815ec3a3f9ad6ca8da86576fb"},me=de;var ge=n(2423),pe=n(745);const ye=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],t={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:l,storageKey:null},r={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:l,storageKey:null},s={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:l,storageKey:null},i={alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[t,r,s],storageKey:null},u=[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null}],o={alias:null,args:null,concreteType:"GenericError",kind:"LinkedField",name:"error",plural:!1,selections:u,storageKey:null},c={kind:"InlineFragment",selections:u,type:"GenericError",abstractKey:null},d={alias:null,args:null,concreteType:"TransferBuy",kind:"LinkedField",name:"transferBuy",plural:!1,selections:[t,r,s,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useBuyQuoterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[i],type:"CreateBuySuccess",abstractKey:null},{kind:"InlineFragment",selections:[i,o],type:"CreateBuyPartialError",abstractKey:null},c],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useBuyQuoterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createBuy",plural:!1,selections:[n,{kind:"InlineFragment",selections:[d],type:"CreateBuySuccess",abstractKey:null},{kind:"InlineFragment",selections:[d,o],type:"CreateBuyPartialError",abstractKey:null},c],storageKey:null}]},params:{id:"4b9ec4ded92084c179b771031962d7921014aa41d052fa4f0e8a8e94144feff3",metadata:{},name:"useBuyQuoterMutation",operationKind:"mutation",text:null}}}();ye.hash="d019749ad7ef61030b92facff1255730";const ke=ye,fe={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useBuyQuoterFragment",selections:[{args:null,kind:"FragmentSpread",name:"useTransferQuoteErrorHandlerFragment"}],type:"Query",abstractKey:null,hash:"d2c6034710afa6ca0e07d66ccc8eae50"},be=fe;var Se=n(1503);const Fe={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useTransferQuoteErrorHandlerFragment",selections:[{args:null,kind:"FragmentSpread",name:"useIsJumboEnabledFragment"}],type:"Query",abstractKey:null,hash:"776cd3093d6f51d3bcf8480b8fda0c2c"},ve=Fe;var he=n(53),Ce=n(3605),Te=n(3899),Ae=n(3900),Ke=n(378),xe=n(3648);function we(e){const a=(0,h.Jc)(ve,e),{showModal:n}=(0,G.Z)(),{amount:l,transferType:t}=(0,he.jf)(B.cr),r=(0,R.m)(t.value),{formatMessage:s}=(0,g.Z)(),i=(0,xe.O)(a);return(0,c.useCallback)((e=>{switch(e.apiError?.id){case"limit_error_increase_eligible":return l.onErrors([{message:i?(0,V.jsx)(Te.Z,{}):(0,V.jsx)(Ce.g,{errorText:e.message,eventNameOnView:Ce.J.viewBuyEntry,eventNameOnClick:Ce.J.clickBuyEntry}),data:{apiError:e.apiError}}]);case"ach_buy_unavailable":return l.onErrors([{message:r.achBuyDisabled,data:{apiError:e.apiError}}]);case"personal_details_required":return n((0,V.jsx)(Ae.Z,{}));case"UPSTREAM_GENERIC_ERROR":return l.onErrors([{message:s(Ke.s.genericErrorMessage),data:{apiError:e.apiError}}]);default:l.onErrors([{message:e.message,data:{apiError:e.apiError}}])}}),[l,i,r.achBuyDisabled,n,s])}const Be=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{kind:"Variable",name:"input",variableName:"input"}],n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],t={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:l,storageKey:null},r={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:l,storageKey:null},s={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:l,storageKey:null},i=[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null}],u={kind:"InlineFragment",selections:i,type:"GenericError",abstractKey:null},o={alias:null,args:null,concreteType:null,kind:"LinkedField",name:"error",plural:!1,selections:[n,u,{kind:"InlineFragment",selections:i,type:"CreateSellBadRequestError",abstractKey:null}],storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useSellQuoterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createSell",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[t,r,s],storageKey:null}],type:"CreateSellSuccess",abstractKey:null},{kind:"InlineFragment",selections:[o,{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[t,r],storageKey:null}],type:"CreateSellPartialError",abstractKey:null},u],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useSellQuoterMutation",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"createSell",plural:!1,selections:[n,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[t,r,s,c],storageKey:null}],type:"CreateSellSuccess",abstractKey:null},{kind:"InlineFragment",selections:[o,{alias:null,args:null,concreteType:"TransferSell",kind:"LinkedField",name:"transferSell",plural:!1,selections:[t,r,c],storageKey:null}],type:"CreateSellPartialError",abstractKey:null},u],storageKey:null}]},params:{id:"a5ba967640d2e797373fa9634e3853d6dc4d9f9936da3f42892424207ddaf1cf",metadata:{},name:"useSellQuoterMutation",operationKind:"mutation",text:null}}}();Be.hash="687162fcda19336b4d7adceb60be9834";const Le=Be,Ie={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSellQuoterFragment",selections:[{args:null,kind:"FragmentSpread",name:"useTransferQuoteErrorHandlerFragment"}],type:"Query",abstractKey:null,hash:"55e3eaaaa94d587d41bd9bdcd8f46896"},Pe=Ie;function Re({accountRef:e,viewerAssetRef:a,queryRef:n}){const l=(0,h.Jc)(me,e),t=(0,h.Jc)(ce,a),r=(0,h.Jc)(ue,n),{amount:s,isFiatInput:i,recurringPeriod:u,transferType:o}=(0,N.Z)(),d=function(e){const a=we((0,h.Jc)(be,e)),n=(0,h.Db)(ke),l=(0,c.useCallback)((({createBuy:e})=>{const a=e;switch(a?.__typename){case"CreateBuySuccess":return{quoteAmounts:{fiatAmount:a.transferBuy.total.value,cryptoAmount:a.transferBuy.amount.value}};case"CreateBuyPartialError":return{quoteAmounts:{fiatAmount:a.transferBuy.total.value,cryptoAmount:a.transferBuy.amount.value},error:{id:a.error.code,message:a.error.message}};case"GenericError":return{error:{id:a.code,message:a.message}};default:return(0,v.cB)(new Error("Unexpected typename returned"),{owner:"trading",context:"buy_sell",typename:a?.__typename}),{}}}),[]);return(0,Se.Z)({mutationHandler:n,parseResponse:l,onError:a})}(r),m=function(e){const a=we((0,h.Jc)(Pe,e)),n=(0,h.Db)(Le),l=(0,c.useCallback)((({createSell:e})=>{const a=e;switch(a?.__typename){case"CreateSellSuccess":return{quoteAmounts:{fiatAmount:a.transferSell.subtotal.value,cryptoAmount:a.transferSell.amount.value}};case"CreateSellPartialError":{const e={quoteAmounts:{fiatAmount:a.transferSell.subtotal.value,cryptoAmount:a.transferSell.amount.value}};switch(a.error.__typename){case"GenericError":case"CreateSellBadRequestError":e.error={id:a.error.code,message:a.error.message}}return e}case"GenericError":return{error:{id:a.code,message:a.message}};default:return(0,v.cB)(new Error("Unexpected typename returned"),{owner:"trading",context:"buy_sell",typename:a?.__typename}),{}}}),[]);return(0,Se.Z)({mutationHandler:n,parseResponse:l,onError:a})}(r),g=(0,ae.Z)(),p=(0,pe.Z)({accountRef:l,viewerAssetRef:t}),y="buy"===o.value,k=(0,c.useMemo)((()=>y&&i.value?"total":"amount"),[i.value,y]),f=(0,c.useCallback)(((e=s.value)=>{const a={...p,[k]:e};"buy"===o.value?d.fetchQuote({input:{...a,recurringPeriod:u.value,pmsvcId:g.pmsvcId}}):m.fetchQuote({input:a})}),[k,s.value,d,u.value,m,p,o.value,g.pmsvcId]),b=(0,ge.Z)(f,250);return(0,c.useMemo)((()=>{const e={fetchQuote:f,debouncedFetchQuote:b};return"buy"===o.value?{...d,...e}:{...m,...e}}),[d,b,m,o.value,f])}const Me={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useTransferQuoteSubmitterViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useBuyQuoteSubmitterViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"useSellQuoteSubmitterViewerAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"4bc33c0a58150beb6a04e09adf8a13b1"},Ee=Me,_e={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useTransferQuoteSubmitterFragment",selections:[{args:null,kind:"FragmentSpread",name:"useBuyQuoteSubmitterFragment"},{args:null,kind:"FragmentSpread",name:"useSellQuoteSubmitterFragment"}],type:"Account",abstractKey:null,hash:"22ef67372b0052e8a7c88de9efaa28ef"},Ve=_e;var De=n(29),je=n(549),Ne=n(3649),Oe=n(1547),Ze=n(229),Ue=n(1438),qe=n(523),Qe=n(948),He=n(949),We=n(1305),ze=n(1306);var Ge=n(1548),Je=n(748),$e=n(499),Ye=n(848),Xe=n(212),ea=n(14),aa=n(156);const na="seen-limit-order-call-out";async function la(){const e=(0,v.ad)();try{const a=await e.get(na);if(!a){const a={exposures:1,lastSeen:Date.now()};return void await e.set(na,a)}const n={exposures:a.exposures+1,lastSeen:Date.now()};await e.set(na,n)}catch(e){(0,v.cB)((0,aa.Xv)(e),{owner:"simple-trade",context:"limit-order-tooltip"})}}const ta=(0,m.vU)({copy:{id:"LimitOrderCalloutToolTip.copyV2",defaultMessage:"New: Limit orders let you buy or sell crypto at a target price"}}),ra=(0,c.memo)((function(){const[e,{toggleOff:a,toggleOn:n}]=(0,Xe.useToggler)(!1),{formatMessage:l}=(0,g.Z)(),t=(0,Xe.useSpectrum)(),r=(0,p.Z)(),s=(0,v.ad)(),{activeTab:i}=(0,c.useContext)(w.xk),u=(({activeTab:e,pageKey:a})=>{const n=(0,p.Z)(),l=(0,$.RA)();return!(0,De.y)("kill_limit_order_callout_tooltip_web")&&"buy"===e&&(!!n||!l||"asset"!==a&&"trade"!==a)})({activeTab:i,pageKey:F.xh.pageKey}),o=(0,$.RA)()&&!r,d=(0,c.useCallback)((async()=>{o||await la(),a()}),[o,a]);return(0,c.useEffect)((()=>{u&&async function(){try{const t=await s.get(na),r=(l=t?.lastSeen,!l||Date.now()-l>864e5);(e=t?.exposures,void 0!==e&&e>=3)||!r?a():(n(),o&&await la())}catch(e){a(),(0,v.cB)((0,aa.Xv)(e),{owner:"simple-trade",context:"limit-order-tooltip"})}var e,l}()}),[]),u&&e?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(f.Box,{dangerouslySetBackground:(0,Ye.J)("gray90",t),position:"absolute",top:r?208:146,right:22,spacingVertical:1,spacingHorizontal:2,maxWidth:260,borderRadius:"rounded",alignSelf:"flex-end",zIndex:$e.Z.extraHigh,testID:"limit-order-callout-tooltip",children:[(0,V.jsx)(f.Box,{position:"absolute",height:20,width:20,dangerouslySetBackground:(0,Ye.J)("gray90",t),dangerouslySetStyle:{transform:"rotate(45deg)",top:"-10px",left:"210px"}}),(0,V.jsx)(ea.TextLabel2,{as:"p",color:"primaryForeground",children:l(ta.copy)})]}),(0,V.jsx)(f.Box,{position:"absolute",width:r?"100%":378,height:r?"100%":600,top:0,left:0,zIndex:$e.Z.extraHigh,onClick:d})]}):null}));var sa=n(1610),ia=n(1549),ua=n(44);const oa=["AU","SG","BR","CA","GB"];var ca=n(55),da=n(186);const ma=(0,m.vU)({previewButtonLabel:{id:"BuySellStepper.EntryStep.previewButtonLabel",defaultMessage:"Preview {type}"},depositButtonLabel:{id:"BuySellStepper.EntryStep.depositButtonLabel",defaultMessage:"Top up {currency} wallet"},accessibilityLabel:{id:"BuySellStepper.EntryStep.accessibilityLabel",defaultMessage:"{asset} amount"}});function ga(){}function pa({queryRef:e,accountRef:a,viewerAssetRef:n,closeModal:l,disableAssetSelectors:r,disableSourceAssetSelection:i,totalNativeBalance:u,assetSelectorLabelOverride:m,entryStepModalHeaderTitle:L,onEntrySelectorSwitch:I}){const P=(0,h.Jc)(o,e),M=(0,h.Jc)(s,a),_=(0,h.Jc)(t,n),{viewer:ie}=P,{fiatAccounts:ue}=ie,oe=(0,O.Z)(),ce=parseFloat(ie.balanceData?.balanceInWbl?.value||"0"),{renderTabs:de}=(0,c.useContext)(w.xk),{fiatInput:me,cryptoInput:ge,isFiatInputValue:pe,recurringOption:ye,setFiatInput:ke,setIsFiatInput:fe}=(0,ee.D)(),be=(0,p.Z)(),{amount:Se,isFiatInput:Fe,showPresetAmountsIfAvailable:ve,transferType:he,recurringPeriod:Ce,shouldBuyAndStake:Te}=(0,N.Z)();let Ae=Se.errors[0]?.message;const Ke=(0,R.m)(he.value),{assetBalance:xe,assetBalanceInFiat:we}=(0,ne.Z)({queryRef:P,accountRef:M}),{trackEvent:Be}=(0,re.Z)(),Le=(0,le.Z)({viewerAssetRef:_}),Ie=function(){const{goToStep:e}=(0,Ze.Z)(),{transferType:a}=(0,N.Z)(),{trackEvent:n}=(0,re.Z)(),{startTradePerfMark:l}=(0,da.Z)(),{rejected:t,isRevoked:r,disableBuyReason:s}=(0,ae.Z)(),{label:i,icon:u}=(0,se.Z)(),o=(0,R.m)(a.value),d=(0,c.useCallback)((()=>{l("load_payment_method",a.value),n("tapped_select_payment_method",{step:"order_input"}),e("selectPayment")}),[l,a.value,n,e]),m=(0,c.useMemo)((()=>r||t?(0,V.jsx)(ca.Icon,{name:"error",color:t?"negative":"foreground",size:"s"}):null),[r,t]);return(0,c.useMemo)((()=>({icon:u,hasError:t,primaryLabel:o.selectPaymentLabel,secondaryLabel:i,pmDisabled:"wbl"===s,rightIcon:m,onPress:d,testID:`${a.value}-payment-method-selector`})),[s,d,u,i,o.selectPaymentLabel,t,m,a.value])}(),Pe=(0,v.uJ)({queryRef:P}),{variant:Me}=(0,X.f)(),_e=(0,$.RA)(),$e=(0,j.x)(_,he.value),{formatMessage:Ye,formatNumber:Xe}=(0,g.Z)(),{showModal:ea}=(0,G.Z)(),aa="buy"===he.value,na=(0,c.useMemo)((()=>aa&&Fe.value?"total":"amount"),[Fe.value,aa]),la=(0,z.U)({queryRef:P,totalHoldBalance:ce,totalNativeBalance:u}),ta=(0,ae.Z)(),{conciseDescription:pa}=(0,se.Z)(),ya=(0,c.useMemo)((()=>{if("fiat_account"===ta.type)return(ue||[]).find((e=>("ViewerAsset"===e?.assetOrFiatCurrency?.__typename?e.assetOrFiatCurrency.asset.platformName:"TiersCurrency"===e?.assetOrFiatCurrency?.__typename?e.assetOrFiatCurrency.code:void 0)===ta.currency))}),[ue,ta]),ka=function(e,a){const n=(0,J.Z)(),l=(0,De.y)("kill_deposit_flow_in_simple_trade_buy_web"),t="fiat_account"===e.type,r=(0,c.useMemo)((()=>n.isInEurope||oa.some((e=>e===n.country?.code))),[n.isInEurope,n.country]),s=(0,c.useMemo)((()=>l||!a||!r||!t),[l,a,r,t]),i=(0,ua.Q)("feb_2023_nudge_bank_transfer_low_balance",{skipTracking:s});return!s&&i}(ta,aa),fa=(0,c.useMemo)((()=>{if(!ka)return!1;return ya&&0===Number(ya.availableBalance.value)||"ERROR_CODES_INSUFFICIENT_BALANCE"===Se.errors[0]?.data?.apiError?.id}),[ya,ka,Se.errors]),ba=la({paymentMethod:ta,transferType:he.value}),Sa=(0,te.Z)({queryRef:P,fiatLimit:ba??0}),Fa=(0,E.Z)()===ta.currency,va=ve.value&&!!Sa&&Fa&&"cashTransfer"!==Me,ha=be&&!!l,Ca=(0,c.useMemo)((()=>ha?l:void 0),[ha,l]),Ta=""===Se.value?Ke.defaultButton:Ke.previewButton,Aa=Boolean("sell"===he.value&&0===parseFloat(xe.amount)),Ka=ta.currency,xa=_.asset.platformName??"",wa=_.asset.displaySymbol??"",{cancelQuote:Ba,fetchQuote:La,debouncedFetchQuote:Ia,isLoaded:Pa,isFetching:Ra,fiatAmount:Ma,cryptoAmount:Ea}=Re({accountRef:M,viewerAssetRef:_,queryRef:P}),{submitQuote:_a,isSubmitting:Va}=function({accountRef:e,viewerAssetRef:a}){const{amount:n,transferType:l,buyQuoteResponse:t,sellQuoteResponse:r,activePaymentMethodId:s,buyInputParams:i,sellInputParams:u}=(0,N.Z)(),o=(0,h.Jc)(Ve,e),d=(0,h.Jc)(Ee,a),{goToStep:m}=(0,Ze.Z)(),{showModal:p}=(0,G.Z)(),{formatMessage:y}=(0,g.Z)(),k=(0,Ue.Z)(),f=(0,ae.Z)(),b=(0,se.Z)(),{submitBuy:S,isSubmittingBuy:F}=(0,We.Z)({accountRef:o,viewerAssetRef:d}),{submitSell:v,isSubmittingSell:C}=(0,ze.Z)({accountRef:o,viewerAssetRef:d}),T=(0,c.useCallback)((e=>{n.onErrors([{message:e?.message}])}),[n]),A=(0,je.wr)({assetId:d.asset.uuid,isExperimental:d.asset.experimental}),K=(0,c.useCallback)(((e,a)=>{r.onChange((0,h.fR)(He.P,e)),u.onChange(a),m("sellPreview")}),[m,u,r]),x=(0,c.useCallback)(((e,a)=>{t.onChange((0,h.fR)(Qe.$,e)),i.onChange(a),m(A?"experimentalAssetConfirmation":"buyPreview")}),[i,t,m,A]),w="buy"===l.value,B=(0,c.useCallback)((async e=>{try{const a=await k({graphqlParams:{type:"PAYPAL_ACCOUNT",paypalDetails:{paypalPayInDetails:{paymentMethodNonce:e.payment_method_nonce,payerId:e.payer_id,postalCode:e.postal_code,country:e.country,line1:e.line_1,ownerName:e.owner_name,email:e.email,state:e.state,city:e.city}}},resthookParams:e});a&&(s.onChange(a.id),m("entry"))}catch(e){if(T(e),"invalid_request"===e.id)throw e}}),[s,k,m,T]),L=(0,c.useCallback)((e=>{throw T(e),e}),[T]),I=(0,De.y)("kill_paypal_braintree_reauth_web"),P="paypal_account"===f.type,R=P&&f?.pickerData?.payoutOnly,M=P&&f?.pickerData?.reauth,E=!I&&M&&f?.pickerData?.isBraintreeReauth,_=f?.pickerData&&"payoutOnly"in f.pickerData?f?.pickerData?.payoutOnly:void 0,D=(0,Oe.l)({payPalPaymentMethod:{uuid:f?.id,payoutOnly:_},onSignInComplete:B,onError:L,onSubmit:()=>Promise.resolve(),reauthOptions:{isReauth:M,isBraintreeReauth:E}}),j=(0,c.useCallback)((async e=>{if(b.paypalReauthRequired&&!E)return p((0,V.jsx)(Ne.w,{}));if(f.rejected)return m("paymentError");if(f.isRevoked)return m("plaidRelink");const a=new Error(y(qe.s.genericError));if(w)if(P&&R)try{await D(),S({onSuccess:x,onError:e=>T(e||a),variables:e})}catch(e){}else S({onSuccess:x,onError:e=>T(e||a),variables:e});else E&&await D(),v({onSuccess:K,onError:e=>T(e||a),variables:e})}),[w,E,b.paypalReauthRequired,f.rejected,f.isRevoked,y,m,p,P,R,D,S,x,T,v,K]);return(0,c.useMemo)((()=>({submitQuote:j,isSubmitting:F||C})),[F,C,j])}({accountRef:M,viewerAssetRef:_}),Da=(0,T.q)({form:Z.cr,quoteFiatAmount:Ma,quoteCryptoAmount:Ea}),ja=(0,T.q)({form:B.cr,quoteFiatAmount:Ma,quoteCryptoAmount:Ea});(0,c.useEffect)((()=>{void 0!==pe&&Fe.onChange(pe),aa&&ye&&(Ce.onChange(ye),"never"!==ye&&Te.onChange(!1))}),[]),(0,c.useEffect)((()=>{let e=Se.value;!Fe.value&&ge?e=ge:Fe.value&&me&&(e=me),Se.onChange(e)}),[Fe.value]),(0,c.useEffect)((()=>{if(Aa)return Se.onErrors([{message:Ke.sellEmptyError}]),void Be("viewed_validation_error",{error:`You don't have any ${_.asset.name} to sell. Try buying some to get started.`});parseFloat(Se.value)&&La()}),[Se.value,Aa]),(0,y.Z)((()=>{Se.errors[0]&&!Aa&&Be("viewed_error",{error:Se.errors[0].message})}),[Se.errors]);const Na=(0,c.useCallback)((()=>{Be("tapped_switch"),oe?Da():ja()}),[Da,Be,oe,ja]),Oa=(0,c.useCallback)((e=>{if(Se.onChange(e),Fe.value&&ke?.(e),!parseFloat(e))return Ba();Ia(e),Be("viewed_updated_amount")}),[Se,Ba,Ia,Be,ke,Fe.value]),Za=(0,c.useCallback)((e=>{Ba(),Se.onChange(e),ke?.(e),_a({total:e})}),[Ba,Se,_a,ke]),Ua=(0,H._)(),qa=(0,c.useCallback)((()=>{if(aa?(0,F.$Y)("trigger_buy_order_preview_button"):(0,F.$Y)("trigger_sell_order_preview_button"),Ba(),Be("tapped_preview"),Ua("CLICK_BUY_BUTTON_PREVIEW_BUY_BUTTON_WEB",he.value,{uuid:_.asset.uuid,symbol:_.asset.platformName}),!parseFloat(Se.value))return Se.onErrors([{message:Ye(Ge.Z.invalidInputWarning)}]);_a({[na]:Se.value})}),[aa,Ba,Be,Ua,he.value,_.asset.uuid,_.asset.platformName,Se,_a,na,Ye]),Qa=(0,c.useCallback)((()=>{Be("tapped_deposit_insufficient_balance_buy"),(0,x.Or)({transferType:"deposit",entryPoint:he.value}),ea((0,V.jsx)(K.e,{accountId:ta.fiatAccount?.id||"",allowRedirect:!1,onSuccess:()=>La(),close:()=>La(),entryPoint:he.value}))}),[ta,ea,Be,La,he.value]),Ha=(0,c.useCallback)((()=>{if("buy"===he.value)return Be("tapped_buy_max"),Za(String(ba));Be("tapped_sell_all");const e=la({paymentMethod:ta,transferType:"sell"});function a(e){e&&(Se.onChange(e),ke?.(e))}if(e){const n=Pe({currency:_.asset.platformName||"",amount:M?.availableBalance.value??"0"},Ka),l=(0,d.min)((0,d.compact)([e,n]))?.toString();a(l),_a({amount:l,currency:Ka})}else a(xe.amount),_a({amount:xe.amount,currency:xe.currency})}),[M?.availableBalance.value,ta,Se,xe.amount,xe.currency,Pe,Ka,ba,la,Za,_.asset.platformName,ke,_a,Be,he.value]),Wa=(0,c.useMemo)((()=>Fe.value?wa:Ka),[Ka,wa,Fe.value]),za=(0,c.useMemo)((()=>Fe.value?Ea:Ma),[Ea,Ma,Fe.value]),Ga=ta.rejected||"wbl"===ta.disableBuyReason,Ja=aa?"BUY":"SELL",$a="cashIn"===Me||"cashOut"===Me||"cashTransfer"===Me,Ya=(0,c.useMemo)((()=>ha?{goBack:Ca}:_e&&$a?{title:L,hasDefaultCloseModal:!0,borderBottom:!0}:null),[$a,Ca,L,ha,_e]),Xa=(0,c.useMemo)((()=>de?.()??null),[de]),en="cashTransfer"===Me,an=en&&"buy"===he.value,nn=an?Ie:Le,ln=an?Le:Ie,tn=an&&!ba;tn&&ta?.currency&&(Ae=Ye(R.s.transferCashEmptyError,{name:ta.currency}));const rn=(0,c.useMemo)((()=>{if(!en)return{onPress:Na,inactiveSymbol:Wa||"",inactiveAmount:za||"",disabled:Va||!!Se.errors[0],hideAmount:!parseFloat(Se.value)}}),[Se.errors,Se.value,za,Wa,Va,en,Na]),sn=(0,c.useMemo)((()=>{if(en&&I)return()=>{const e="buy"===he.value?"sell":"buy";return I(e)}}),[en,I,he.value]),un=(0,c.useMemo)((()=>({...nn,...m&&{primaryLabel:m},disabled:Va||r,disableSelection:!Va&&$a||i,hideCaret:r||$a||i})),[m,r,i,$a,Va,nn]),on=(0,c.useMemo)((()=>({...ln,disabled:Va||r,disableSelection:!Va&&en,hideCaret:r||en})),[r,Va,en,ln]),cn=(0,c.useMemo)((()=>Ye(ma.accessibilityLabel,{asset:_.asset.name})),[Ye,_.asset.name]),dn="buy"===he.value,mn=(0,W.q)(!1),gn=_.asset.isStablecoin,{isInUS:pn}=(0,J.Z)(),yn=(mn||!pn&&dn)&&!gn,kn=mn&&!gn,fn=(0,c.useCallback)((e=>{e&&(Se.onChange(e),ke?.(e))}),[Se,ke]),bn=(0,c.useCallback)((e=>{Fe.onChange(e),fe?.(e)}),[Fe,fe]),Sn=(0,c.useMemo)((()=>(0,V.jsx)(q.$,{queryRef:P,accountRef:M,setInputValue:fn,setInputCurrency:bn,tradeTypeUI:he.value,disabled:!Fe||Ra||Va,target:{paymentMethod:ta},triggerSubmit:ga})),[P,M,fn,bn,he.value,Fe,Ra,Va,ta]),Fn=(0,c.useMemo)((()=>oe?Sn:yn&&dn&&"cashTransfer"!==Me?null:(0,V.jsx)(Je.Z,{onPressMax:Ha,disabled:Va||!!Se.errors[0]||$e||tn})),[Se.errors,tn,Sn,Ha,oe,$e,Va,yn,dn,Me]),vn=(0,c.useMemo)((()=>(0,V.jsx)(h.zq,{instrumentationId:"EntryInput",fallback:null,children:(0,V.jsx)(C.qb,{isNewDesign:oe,autoFocus:!0,error:Ae,input:{symbol:Fe.value?Ka:xa,displaySymbol:Fe.value?void 0:wa,value:Se.value,onChange:Oa,onEnter:qa,readOnly:Aa||Va||$e||tn},helperText:(0,V.jsx)(ia.y,{transferType:he.value,amount:Se.value,fiatCode:Ka,fiatLimit:ba,variant:Me}),secondaryButton:Fn,switchActiveInput:rn,transferType:he.value,isCryptoCurrency:!Fe.value,viewerAssetRef:_,ariaLabel:cn})})),[Se.value,cn,Aa,tn,wa,Ae,Ka,ba,Oa,qa,oe,$e,Fe.value,Va,xa,Fn,_,rn,he.value,Me]),hn=(0,c.useMemo)((()=>{const e=!!Se.errors[0]||Va||$e||""===Se.value;return oe?(0,V.jsx)(U.r,{block:!0,loading:Va,disabled:e,handleSubmit:qa,testID:`${he.value}-preview-button`,"data-testid":`${he.value}-preview-button`,"aria-label":Ye(ma.previewButtonLabel,{type:he.value}),label:Ta,endIcon:"forwardArrow"}):(0,V.jsx)(k.Button,{block:!0,disabled:e,loading:Va,onPress:qa,testID:`${he.value}-preview-button`,"data-testid":`${he.value}-preview-button`,"aria-label":Ye(ma.previewButtonLabel,{type:he.value}),children:Ta})}),[Se.errors,Se.value,Ta,Ye,qa,oe,$e,Va,he.value]),Cn=(0,c.useMemo)((()=>(0,V.jsx)(Je.Z,{showOrderTypeSelector:mn,disabled:Va||!!Se.errors[0]||$e||tn})),[Se.errors,tn,mn,$e,Va]);return(0,c.useMemo)((()=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Q.Z,{view:Ja,currencies:[_.asset.platformName??""]}),!oe&&Xa,Ya&&(0,V.jsx)(C.h4,{...Ya}),kn&&(0,V.jsx)(ra,{}),(0,V.jsxs)(C.RF,{paddingTopDesktop:C.bM,paddingTopMobile:C.bM,children:[yn&&!oe?(0,V.jsx)(f.Box,{alignSelf:"flex-end",spacingBottom:1,children:Cn}):oe?null:(0,V.jsx)(b.Spacer,{vertical:6}),aa?(0,V.jsx)(h.zq,{instrumentationId:"RewardApyLabel",fallback:null,children:(0,V.jsx)(A.Z,{viewerAssetRef:_})}):(0,V.jsx)(b.Spacer,{vertical:4}),vn,va&&Sa&&!oe?(0,V.jsx)(sa.Z,{amounts:Sa,onPressAmount:Za,disabled:Va||!Fe.value||$e,testID:"preset-amounts-panel"}):null,(0,V.jsxs)(S.VStack,{children:[(0,V.jsx)(D,{row1:un,row2:on,onClickSwitcher:sn,transferType:he.value,selectedViewerAssetDisplaySymbol:_.asset.displaySymbol??"",activePaymentMethodFiatCode:Ka,assetBalanceInFiat:we,activePaymentConciseDescription:pa,activePaymentMethodType:ta.type,fiatLimit:ba,variant:Me,queryRef:P,isNewDesign:oe}),(0,V.jsx)(f.Box,{opacity:Ga?.5:1,testID:Ra||Va?`${he.value}-quote-loading`:Pa?`${he.value}-quote-loaded`:"",children:fa?(0,V.jsx)(k.Button,{block:!0,onPress:Qa,testID:`${he.value}-deposit-button`,"data-testid":`${he.value}-deposit-button`,"aria-label":Ye(ma.depositButtonLabel,{currency:ta.currency}),children:Ye(ma.depositButtonLabel,{currency:ta.currency})}):hn})]})]}),an?(0,V.jsx)(Y.I,{amount:Xe(ba||0,{style:"currency",currency:Ka}),currency:ta.currency}):(0,V.jsx)(b.Spacer,{vertical:2})]})),[ta.currency,ta.type,Ja,we,Ga,Sa,pa,Ka,ba,Ye,Xe,sn,Qa,Za,oe,Ya,vn,aa,$e,Ra,Fe.value,Pa,Va,an,Cn,hn,P,_,yn,fa,va,kn,un,Xa,on,he.value,Me])}const ya=(0,c.memo)(pa)},952:(e,a,n)=>{n.d(a,{Z:()=>S,s:()=>f});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"FeesInfoStepViewerAssetsFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"c815d86e3da3683967f03824d35b4cad"},t=l;var r=n(0),s=n(11),i=n(9),u=n(53),o=n(3),c=n(521),d=n(785),m=n(787),g=n(73),p=n(1611),y=n(107),k=n(2);const f=(0,s.vU)({titleBuy:{id:"BuySellFeesInfo.titleBuy",defaultMessage:"Fees on crypto purchases"},titleSell:{id:"BuySellFeesInfo.titleSell",defaultMessage:"Fees on cryptocurrency sales"},priceCanChangeDescription:{id:"BuySellFeesInfo.priceCanChangeDescription",defaultMessage:"Coinbase charges a fee at the time you place your order based on a combination of factors such as market conditions, payment method, and size of order. Your quoted price at the time of purchase also includes spread, which allows us to temporarily lock in your price while your order is processed. Learn more about our fees, including our use of spread,"},priceCanChangeWithFeeDisclosureDescriptionV2:{id:"BuySellFeesInfo.priceCanChangeWithFeeDisclosureDescriptionV2",defaultMessage:"Coinbase charges a fee at the time you place your order based on a combination of factors such as market conditions, payment method, and size of order. Learn more about our fees"},contentUSDCNoCommissionV2:{id:"BuySellFeesInfo.contentUSDCNoCommissionV2",defaultMessage:"No commission fees attributed to Coinbase will be charged. However, processing fees charged by third party processors will continue to apply. Learn more about our fees"},here:{id:"BuySellFeesInfo.here",defaultMessage:"here."},titleRecurring:{id:"BuySellFeesInfo.titleRecurring",defaultMessage:"Fees on Recurring Purchases"},contentRecurringV2:{id:"BuySellFeesInfo.contentRecurringV2",defaultMessage:"Coinbase charges a fee at the time you place your order based on a combination of factors such as market conditions, payment method, and size of order. Learn more about our fees"},contentRecurringUSDCNoCommissionV2:{id:"BuySellFeesInfo.contentRecurringUSDCNoCommissionV2",defaultMessage:"No commission fees attributed to Coinbase will be charged. However, processing fees charged by third party processors will continue to apply. Learn more about our fees"}});function b({cb1TradeBenefitData:e,viewerAssetRef:a}){const n=(0,o.Jc)(t,a),{goBack:l}=(0,g.tC)(y.Ex),{formatMessage:s,locale:b}=(0,i.Z)(),{recurringPeriod:S,transferType:F,previewFeeDisclosure:v,showCbOneBannerOnInfoStep:h}=(0,u.jf)(y.cr),C=(0,d.h)(),T=v.value,A=T?.link?.url&&T?.link?.text,K="never"!==S.value,x="USDC"===n.asset.platformName,w=C&&A?T.link?.url:`https://help.coinbase.com/${b}/coinbase/trading-and-funding/pricing-and-fees/fees`,B=(0,r.useMemo)((()=>{let e;return e=C?T?.title??"":K?s(f.titleRecurring):"buy"===F.value?s(f.titleBuy):s(f.titleSell),e}),[T?.title,s,C,K,F.value]),L=(0,m.d)(),I=(0,r.useMemo)((()=>{let e;return e=C?T?.description??"":s(K?x?f.contentRecurringUSDCNoCommissionV2:f.contentRecurringV2:x?f.contentUSDCNoCommissionV2:L?f.priceCanChangeWithFeeDisclosureDescriptionV2:f.priceCanChangeDescription),e}),[C,T?.description,K,x,s,L]),P=(0,r.useMemo)((()=>!e?.isEligible||C&&!h.value?null:(0,k.jsx)(p.P,{tradeBenefitData:e})),[e,C,h.value]),R=(0,r.useMemo)((()=>C?A?T?.link?.text:"":s(f.here)),[T?.link?.text,s,C,A]);return(0,k.jsx)(c.Z,{onBackPress:l,headerTitle:B,message:I,ctaUrl:w,ctaText:R,postMessage:P,"data-element":"InfoStep","data-component":"FeesInfoStep"})}const S=(0,r.memo)(b)},1612:(e,a,n)=>{n.d(a,{f:()=>o});var l=n(0),t=n(486),r=n(4),s=n(264),i=n(14),u=n(2);const o=(0,l.memo)((function({title:e,spacingTop:a}){const n=(0,t.usePaletteValueToRgbaString)("blue80");return(0,u.jsx)(r.Box,{spacingTop:a,display:"block",children:(0,u.jsxs)(r.Box,{flexDirection:"row",alignItems:"center",justifyContent:"center",spacing:2,borderRadius:"roundedFull",dangerouslySetBackground:n,width:"100%",children:[(0,u.jsx)(i.TextHeadline,{color:"primaryForeground",as:"p",children:e}),(0,u.jsx)(r.Spacer,{horizontal:2,children:" "}),(0,u.jsx)(s.Spinner,{size:2,color:"foregroundMuted"})]})})}))},946:(e,a,n)=>{n.d(a,{z:()=>l});const l={inputFiatAmount:"",inputCryptoAmount:"",currentFocus:"amount",targetPrice:"",depositRequirements:void 0,createLimitOrderResponse:void 0}},870:(e,a,n)=>{n.d(a,{h:()=>u});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useConvertIncrementToPrecisionFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"filter",value:{quoteCurrency:"USD"}}],concreteType:"RetailBrokerageProduct",kind:"LinkedField",name:"brokerageProduct",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"baseIncrement",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"quoteIncrement",storageKey:null}],storageKey:'brokerageProduct(filter:{"quoteCurrency":"USD"})'}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"117cf62a2ec56c151cb4546dc3cca108"},t=l;var r=n(0),s=n(2424),i=n(3);function u(e){const{asset:a}=(0,i.Jc)(t,e);return(0,r.useMemo)((()=>({fiatPrecision:(0,s.y)(a?.brokerageProduct?.quoteIncrement??"0.01"),cryptoPrecision:(0,s.y)(a?.brokerageProduct?.baseIncrement??"0.01")})),[a?.brokerageProduct?.baseIncrement,a?.brokerageProduct?.quoteIncrement])}},873:(e,a,n)=>{n.d(a,{z:()=>i});const l={argumentDefinitions:[{kind:"RootArgument",name:"nativeCurrency"}],kind:"Fragment",metadata:null,name:"useLatestQuoteViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null}],storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"9c6bb68990b9af1b63a39cad265946a9"},t=l;var r=n(0),s=n(3);function i(e){const a=(0,s.Jc)(t,e);return(0,r.useMemo)((()=>a?.asset?.latestQuoteV2?.price??"0"),[a?.asset?.latestQuoteV2?.price])}},1613:(e,a,n)=>{n.d(a,{Z:()=>d});var l=n(0),t=n(64),r=n(4),s=n(98),i=n(2);function u({step:e}){return(0,i.jsx)(r.Box,{bordered:!0,borderRadius:"roundedFull",background:"primary",width:25,height:25,justifyContent:"center",alignItems:"center",alignContent:"center","data-element":"Box","data-component":"StepNumber",children:(0,i.jsx)(t.Icon,{name:`step${e}`,size:"xs",color:"primaryForeground","data-element":"Icon"})})}function o({item:e,itemIndex:a,isLastStep:n}){return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(r.HStack,{alignItems:"flex-start",justifyContent:"flex-start",children:[(0,i.jsxs)(r.VStack,{children:[(0,i.jsx)(u,{step:a+1}),n?null:(0,i.jsx)(r.Box,{width:25,height:50,justifyContent:"center",alignItems:"center",children:(0,i.jsx)(r.VStack,{height:50,width:1,background:"backgroundOverlay"})})]}),(0,i.jsx)(s.TextLabel2,{as:"span",spacingStart:2,children:e.title})]})})}function c({timelineItems:e}){const a=(0,l.useMemo)((()=>e.map(((a,n)=>(0,i.jsx)(o,{item:a,itemIndex:n,isLastStep:n===e.length-1},a.title?.toString())))),[e]);return(0,i.jsx)(r.VStack,{"data-element":"VStack","data-component":"Timeline",children:a})}const d=(0,l.memo)(c)},1312:(e,a,n)=>{n.d(a,{Z:()=>m});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"PriceInfoStepFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"091e54bb7f8ab4080a92670326868d46"},t=l;var r=n(11),s=n(9),i=n(3),u=n(521),o=n(787),c=n(2);const d=(0,r.vU)({assetPriceIsLive:{id:"PriceInfoStep.assetPriceIsLive",defaultMessage:"{asset} price is live"},message:{id:"PriceInfoStep.message",defaultMessage:"The price of cryptocurrency changes frequently based on market conditions. The price quoted includes a spread that allows us to temporarily lock in your price while your order is processed. Learn more about spread"},messageWithFeeDisclosure:{id:"PriceInfoStep.messageWithFeeDisclosure",defaultMessage:"The price of cryptocurrency changes frequently based on market conditions. The price quoted includes a {spreadPercentage}% spread. Learn more about spread"},here:{id:"PriceInfoStep.here",defaultMessage:"here."}});const m=function({spreadPercentage:e,viewerAssetRef:a,onBack:n}){const l=(0,i.Jc)(t,a),{asset:r}=l,{formatMessage:m,locale:g}=(0,s.Z)(),p=`https://help.coinbase.com/${g}/coinbase/trading-and-funding/pricing-and-fees/fees`,y=(0,o.d)();return(0,c.jsx)(u.Z,{onBackPress:n,headerTitle:m(d.assetPriceIsLive,{asset:r.name}),message:m(y&&e?d.messageWithFeeDisclosure:d.message,{spreadPercentage:e}),ctaUrl:p,ctaText:m(d.here),postMessage,"data-element":"InfoStep","data-component":"FeesInfoStep"})}},951:(e,a,n)=>{n.d(a,{Z:()=>d});var l=n(0),t=n(9),r=n(1466),s=n(3623);const i=(0,n(11).vU)({neverTitle:{id:"BuySell.RecurrenceSelect.neverTitle",defaultMessage:"One time {intent}"},intentPurchase:{id:"BuySell.RecurrenceSelect.recurrenceActionPurchase",defaultMessage:"purchase"},intentDeposit:{id:"BuySell.RecurrenceSelect.recurrenceActionDeposit",defaultMessage:"deposit"},dailyTitle:{id:"BuySell.RecurrenceSelect.dailyTitle",defaultMessage:"Daily"},dailyText:{id:"BuySell.RecurrenceSelect.dailyText",defaultMessage:"Every day starting today"},weeklyTitle:{id:"BuySell.RecurrenceSelect.weeklyTitle",defaultMessage:"Weekly"},weeklyText:{id:"BuySell.RecurrenceSelect.weeklyText",defaultMessage:"Every {weekday} starting today"},firstAndFifteenthTitle:{id:"BuySell.RecurrenceSelect.firstAndFifteenthTitle",defaultMessage:"1st and 15th of the month"},firstAndFifteenthText:{id:"BuySell.RecurrenceSelect.firstAndFifteenthText",defaultMessage:"Twice a month, including today"},monthlyTitle:{id:"BuySell.RecurrenceSelect.monthlyTitle",defaultMessage:"Monthly"},monthlyText:{id:"BuySell.RecurrenceSelect.monthlyText",defaultMessage:"Every month on the {dayOfMonth}"}}),u={never:i.neverTitle,daily:i.dailyTitle,weekly:i.weeklyTitle,first_and_fifteenth:i.firstAndFifteenthTitle,monthly:i.monthlyTitle},o={daily:i.dailyText,weekly:i.weeklyText,first_and_fifteenth:i.firstAndFifteenthText,monthly:i.monthlyText},c={intentPurchase:i.intentPurchase,intentDeposit:i.intentDeposit},d=({variant:e})=>{const{formatMessage:a}=(0,t.Z)(),n=(0,l.useMemo)((()=>{const e=new Date;return{weekday:(0,s.Z)(e.getDay(),a),dayOfMonth:(0,r.Z)(e.getDate(),a)}}),[a]),i=(0,l.useMemo)((()=>({intent:a("cashIn"===e?c.intentDeposit:c.intentPurchase)})),[a,e]);return(0,l.useCallback)((e=>({title:a(u[e],i),text:o[e]?a(o[e],n):void 0})),[n,a,i])}},1313:(e,a,n)=>{n.d(a,{Z:()=>S});var l=n(0),t=n(11),r=n(9),s=n(10),i=n(162),u=n(791),o=n(792),c=n(1434),d=n(187),m=n(2411),g=n(951),p=n(2);const y=(0,t.vU)({title:{id:"RecurrenceSelectStep.title",defaultMessage:"Repeat this purchase?"}}),k=["never","daily","weekly","first_and_fifteenth","monthly"];function f(e){const{recurringPeriod:a,orderType:n,variant:t,trackEvent:s,onDone:f,onBack:S,isStablecoin:F}=e,{formatMessage:v}=(0,r.Z)(),{setRecurringOption:h}=(0,d.D)(),C=(0,c.q)(!!F),T=(0,m.Z)(),A=(0,l.useCallback)((e=>{s?.("_recurring_period_selected",{recurringPeriod:e}),a.onChange(e),h(e),n&&(T||C)?(n.onChange("RECURRING"),f?.()):S?.()}),[S,f,C,T,n,a,h,s]),K=(0,g.Z)({variant:t}),x=(0,l.useMemo)((()=>T||C?k.filter((e=>"never"!==e)):k),[C,T]);return(0,p.jsxs)(o.V8,{"data-element":"StepWrapper","data-component":"RecurrenceSelectStep",children:[(0,p.jsx)(u.Z,{goBack:S,title:v(y.title),testID:"recurrence-select-step","data-element":"Header"}),(0,p.jsx)(b,{"data-element":"StyledInnerStepContent",children:x.map((e=>{const n=e===a.value,l=K(e);return(0,p.jsx)(i.ListCell,{as:"li",selected:n,variant:"foregroundMuted",onPress:()=>A(e),title:l.title,description:l.text,testID:`${e}-option`},e)}))})]})}const b=(0,s.ZP)(o.Nq).withConfig({displayName:"RecurrenceSelectStep__StyledInnerStepContent",componentId:"sc-1ftg7vd-0"})(["padding:0 ",";"],(e=>e.theme.size.medium)),S=(0,l.memo)(f)},1314:(e,a,n)=>{n.d(a,{Z:()=>h});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SelectAssetStepViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useSelectedAssetHandlerViewerAssetFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"7173e1f9cf2d0f38061683d4df0afafb"},t=l;const r={argumentDefinitions:[],kind:"Fragment",metadata:{plural:!0},name:"SelectAssetStepFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,fragment:{args:null,kind:"FragmentSpread",name:"AssetIsStablecoinFragment"},kind:"RelayResolver",name:"isStablecoin",resolverModule:n(280).W,path:"asset.isStablecoin"}],storageKey:null},{args:null,kind:"FragmentSpread",name:"SelectTradableAccountStepFragment"},{args:null,kind:"FragmentSpread",name:"SelectAssetStepSharedFragment"},{args:null,kind:"FragmentSpread",name:"useSelectedAssetHandlerFragment"}],type:"ViewerAsset",abstractKey:null,hash:"7e5b558fe930691e74c5eae2578ece5b"},s=r;var i=n(0),u=n(3),o=n(1553),c=n(3663),d=n(110),m=n(229),g=n(187);const p={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSelectedAssetHandlerViewerAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"08a7a9b3dee3f1fd52840b4f13158a52"},y=p,k={argumentDefinitions:[{kind:"RootArgument",name:"includeAutoStakingCheck"}],kind:"Fragment",metadata:{plural:!0},name:"useSelectedAssetHandlerFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null},{condition:"includeAutoStakingCheck",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,concreteType:"EarnAsset",kind:"LinkedField",name:"earnAsset",plural:!1,selections:[{alias:null,args:null,concreteType:"EarnAutoStakingEnrollment",kind:"LinkedField",name:"autoStaking",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEnrolled",storageKey:null}],storageKey:null}],storageKey:null}]}],type:"ViewerAsset",abstractKey:null,hash:"d8f24d544dc4b1de6a8777858629041f"},f=k;var b=n(7),S=n(140);var F=n(186),v=n(2);function h({viewerAssetRefs:e,viewerAssetRef:a,isNewDesign:n}){const l=(0,u.Jc)(s,e),r=(0,u.Jc)(t,a),{goBack:p}=(0,m.Z)(),{transferType:k,orderType:h}=(0,d.Z)(),C=function({viewerAssetRefs:e,viewerAssetRef:a}){const n=(0,u.Jc)(f,e),l=(0,u.Jc)(y,a),{goBack:t}=(0,m.Z)(),{assetId:r,shouldBuyAndStake:s}=(0,d.Z)(),{trackEvent:o}=(0,S.Z)();return(0,i.useCallback)((e=>{if(e!==l.asset.uuid){r.onChange(e);const a=n.find((a=>a.asset.uuid===e)),l=Boolean(a?.earnAsset?.autoStaking?.isEnrolled);s.onChange(l),o("_asset_selected",{action:b.Us.click,componentType:b.re.dropdown,currency:a?.asset.platformName})}t()}),[l,t,r,s,n,o])}({viewerAssetRefs:l,viewerAssetRef:r}),{setSelectedCryptoId:T}=(0,g.D)(),A="LIMIT"===h.value,K=l.filter((e=>!e.asset.isStablecoin)),{endTradePerfMark:x}=(0,F.Z)();(0,i.useEffect)((()=>{x("load_assets",k.value)}),[]);const w=e=>{C(e),T(e)};return"buy"!==k.value?(0,v.jsx)(o.Z,{viewerAssetRefs:A?K:l,onBack:p,activeAssetId:r.asset.uuid,onAssetSelect:w,showBalance:!0,sortByBalance:!0,filterZeroBalance:!0,dataHandlePrefix:k.value,transferType:k.value,isLimitOrder:A,isNewDesign:n}):(0,v.jsx)(c.Z,{onBack:p,transferType:k.value,activeAssetId:r.asset.uuid,viewerAssetRefs:A?K:l,onAssetSelect:w,dataHandlePrefix:k.value,isNewDesign:n})}},954:(e,a,n)=>{n.d(a,{Z:()=>o});var l=n(140),t=n(0),r=n(110),s=n(229);var i=n(1316),u=n(2);function o({paymentMethod:e,selected:a,onPress:n,onAddAccount:o}){const{transferType:c}=(0,r.Z)(),d=function(){const{goToStep:e}=(0,s.Z)(),{activePaymentMethodId:a}=(0,r.Z)();return(0,t.useCallback)((n=>{a.value!==n&&(a.onChange(n),e("entry"))}),[a,e])}(),{trackEvent:m}=(0,l.Z)();return(0,u.jsx)(i.Z,{paymentMethod:e,transferType:c.value,onPress:()=>{m("_flow_payment_method_loaded",{paymentMethod:e.id,paymentMethodType:e.type}),n?.(e.id),d(e.id)},onAddAccount:o,selected:a,"data-element":"PaymentMethodCell","data-component":"BuySellPaymentMethodCell"})}},749:(e,a,n)=>{n.d(a,{Z:()=>W});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SelectPaymentStepPaymentMethodFragment",selections:[{args:null,kind:"FragmentSpread",name:"CryptoPaymentMethodsFragment"}],type:"Query",abstractKey:null,hash:"5bd24f55981dc1336fcfef60b85c6f79"},t=l,r={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SelectPaymentStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"useFormattedPaymentMethodsFragment"},{args:null,kind:"FragmentSpread",name:"SelectPaymentStepPaymentMethodFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"BalanceData",kind:"LinkedField",name:"balanceData",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"balanceInWbl",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useUserCefiTotalBalanceFragment"},{args:null,kind:"FragmentSpread",name:"useAddAccountButtonFragment"}],type:"Query",abstractKey:null,hash:"53e4436eb33f01f9f9f2019cf480fcb0"},s=r;var i=n(0),u=n(9),o=n(44),c=n(3),d=n(3608),m=n(188),g=n(229),p=n(3914),y=n(522),k=n(1441),f=n(1500),b=n(1394),S=n(23),F=n(187),v=n(557),h=n(186),C=n(11),T=n(162),A=n(3915),K=n(904),x=n(115),w=n(2);const B=(0,C.vU)({title:{id:"BuyFedwireInstructions.title",defaultMessage:"Wire transfer"},description:{id:"BuyFedwireInstructions.description",defaultMessage:"Wire funds from your bank into Coinbase. Recommended for amounts greater than $25,000."}});function L({transferType:e}){const{formatMessage:a}=(0,u.Z)(),{showModal:n}=(0,x.Z)(),l=(0,i.useCallback)((()=>{n((0,w.jsx)(K.G,{entryPoint:e}))}),[n,e]);return(0,w.jsx)(T.ContentCell,{as:"li",title:a(B.title),description:a(B.description),media:(0,w.jsx)(A.r,{"aria-hidden":"true"}),onPress:l,"data-element":"ContentCell","data-component":"FedwireInstructionsRow"})}const I={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useAddAccountButtonFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"fiatAccounts",plural:!0,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"5f51daeed6d15cc5240ff95953428902"},P=I;var R=n(53),M=n(7),E=n(517),_=n(140),V=n(73),D=n(276),j=n(217),N=n(796),O=n(107),Z=n(1315);const U=["AU","BR"];function q(e){const{isInUS:a}=(0,S.Z)(),n=(0,D.Z)(),l=(0,j.Z)(),{goToStep:t}=(0,V.tC)(O.Ex),{transferType:r,assetId:s}=(0,R.jf)(O.cr),{showModal:o}=(0,x.Z)(),{formatMessage:d}=(0,u.Z)(),m=function({transferType:e,entryPoint:a}){const{countryCode:n}=(0,S.Z)(),l="buy"===e||"buy"===a||"advanced_trade"===a;return(0,i.useMemo)((()=>!!l&&U.includes(n??"")),[n,l])}({transferType:r.value}),{viewer:{fiatAccounts:g}}=(0,c.Jc)(P,e),p=(0,i.useMemo)((()=>{const e=g?.find((e=>"EUR"===e?.availableBalance.currency));return"sell"===r.value&&(e||a)}),[g,a,r.value]),y=(0,i.useCallback)((()=>{n(),l(),t("entry")}),[n,l,t]),{trackEvent:k}=(0,_.Z)(),f=(0,i.useCallback)((()=>{const e=m?["buys","deposits"]:[`${r.value}s`];k("tapped_add_new_payment_method",{action:M.Us.click,componentType:M.re.button}),o((0,w.jsx)(E.v,{selectedAssetId:s.value,transferTypes:e,onSuccess:y,entryPoint:"buy"===r.value?N.M.BUY:N.M.SELL}))}),[m,r.value,o,y,k,s.value]);return(0,i.useMemo)((()=>{if(!p)return{variant:"secondary",value:d(Z.Z.addPaymentMethod),onPress:f}}),[d,f,p])}function Q(e){const{activePaymentMethodId:a,paymentMethods:n=[],transferType:l,isRecurring:t,selectedAssetId:r,queryRef:p,children:F,trackEvent:C,onBack:T}=e,{formatMessage:A}=(0,u.Z)(),{isInUS:K}=(0,S.Z)(),x=(0,c.Jc)(s,p),{viewer:B}=x,{previousStep:I}=(0,g.Z)(),{isSupportedWithActiveCard:P}=(0,k.F)(),{isGooglePaySupportedWithActiveCard:R}=(0,f.Z)(n),M=(0,o.Q)("feb_2024_helper_text_google_pay"),E=q(x),{endTradePerfMark:_}=(0,h.Z)();(0,i.useEffect)((()=>{_("load_payment_method",l)}),[]);const V="buy"===l,{balanceInFiat:D}=(0,y.Z)({queryRef:x}),j=(0,v.Z)({queryRef:x,paymentMethods:n,totalHoldBalance:parseFloat(B.balanceData?.balanceInWbl?.value||"0"),totalNativeBalance:D??0,transferType:l}),N=(0,b.j)(),O=(0,i.useMemo)((()=>j.filter((e=>"apple_pay"===e.type?P:"google_pay"===e.type?!M&&R:V&&t?e.hasRecurringOptions:!V||"uk_bank_account"!==e.type||e.allowBuy&&N))),[j,V,t,P,M,R,N]);return(0,w.jsx)(d.Z,{header:{title:A(m.s[`${l}SelectPaymentLabel`]),goBack:T},cta:E,"data-element":"ScrollableCellList","data-component":"SelectPaymentStep",children:(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(H,{selectedAssetId:r,paymentMethods:O,activeId:a,transferType:l,onSelect:e=>{e&&C?.("tapped_select_payment_method",{paymentMethodType:e,step:"entry"===I?.toString()?"order_input":"order_preview"}),T?.()},queryRef:x,"data-element":"PaymentMethods",children:e=>F(e)}),K&&"buy"===l&&(0,w.jsx)(L,{transferType:l})]})})}function H(e){const{selectedAssetId:a,paymentMethods:n,activeId:l,transferType:r,children:s,onSelect:u,queryRef:o}=e,d=(0,c.Jc)(t,o),{cryptoAssetId:m,setCryptoAssetId:g,setPaymentMethodId:y}=(0,F.D)(),k=(0,i.useCallback)((e=>{e&&(g?.(""),y?.(e)),u?.()}),[u,g,y]),f=(0,i.useCallback)((e=>{g?.(e),u?.(e)}),[u,g]);return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p.T,{selectedAssetId:a,transferType:r,queryRef:d,onPress:f}),n.map((e=>{const a={key:e.id,paymentMethod:e,transferType:r,selected:e.id===l&&!m,onPress:k};return s(a)}))]})}const W=(0,i.memo)(Q)},1315:(e,a,n)=>{n.d(a,{Z:()=>l});const l=(0,n(11).vU)({addPaymentMethod:{id:"SelectPaymentStep.addPaymentMethod",defaultMessage:"Add a payment method"},blocked:{id:"SelectPaymentStep.blocked",defaultMessage:"Blocked. <link>Add again</link>"},temporarilyDisabled:{id:"SelectPaymentStep.temporarilyDisabled",defaultMessage:"Temporarily disabled"}})},1609:(e,a,n)=>{n.d(a,{Z:()=>f,s:()=>k});var l=n(8),t=n.n(l),r=n(11),s=n(9),i=n(53),u=n(285),o=n(15),c=n(1544),d=n(125),m=n(107),g=n(374),p=n(550),y=n(188);const k=(0,r.vU)({previewHeaderCashOut:{id:"BuySellStepper.PreviewStep.previewHeaderCashOut",defaultMessage:"Cash out preview"},sellButton:{id:"BuySellStepper.PreviewStep.sellButton",defaultMessage:"Sell now"},transferCashButton:{id:"BuySellStepper.PreviewStep.transferCashButton",defaultMessage:"Place order"},cashOutButton:{id:"BuySellStepper.PreviewStep.cashOutButton",defaultMessage:"Cash out now"},sellActionLabel:{id:"BuySellStepper.PreviewStep.sellActionLabel",defaultMessage:"Sale"},sellTotalLabel:{id:"BuySellStepper.PreviewStep.sellTotalLabel",defaultMessage:"Total payout"},sellsUnsupportedText:{id:"BuySellStepper.PreviewStep.sellsUnsupportedText",defaultMessage:"Selling is not yet supported in your country. You will have to hold or send."},sellsUnsupportedLink:{id:"BuySellStepper.PreviewStep.sellsUnsupportedLink",defaultMessage:"Learn more."},tdsLabel:{id:"BuySellStepper.PreviewStep.labels.tdsLabel",defaultMessage:"TDS"},gstLabel:{id:"BuySellStepper.PreviewStep.labels.gstLabel",defaultMessage:"GST"}}),f=e=>{const{formatMessage:a}=(0,s.Z)(),n=(0,o.$T)(),{selectedAsset:l}=(0,d.f)(),{sellQuoteResponse:r}=(0,i.jf)(m.cr),f=(0,y.m)("sell"),{entryPoint:b}=(0,d.f)(),S="advanced-trade-convert-modal"===b,F=r.value?.transferSell;t()(F,"There should be a sell quote response");const v=(0,g.Z)(),{subtotal:h,amount:C,total:T,unitPrice:A}=F,K=n({amount:C,isFiat:!1}),x=n({amount:T,isFiat:!0}),w=n({amount:A.amount,isFiat:!0,exponent:(0,u.Z)(parseFloat(A.amount.value))});let B=a(p.hS.priceLabel),L=a(k.sellActionLabel),I=a(k.sellButton),P=a(p.hS.previewHeader);return S&&(B=a(c.H.priceLabel),L=a(c.H.sellActionLabel),I=a(c.H.sellButton)),"cashTransfer"===e&&(I=a(k.transferCashButton)),"cashOut"===e&&(I=a(k.cashOutButton),P=a(k.previewHeaderCashOut)),{header:P,cryptoAmount:K,paymentLabel:f.selectPaymentLabel,paymentValue:v.label,priceLabel:B,priceValue:`${w} / ${l.displaySymbol}`,priceValueShort:`${w}`,actionLabel:L,actionValue:n({amount:h,isFiat:!0}),totalLabel:a(k.sellTotalLabel),totalValue:x,button:I,sellsUnsupportedText:a(k.sellsUnsupportedText),sellsUnsupportedLink:a(k.sellsUnsupportedLink),free:a(p.hS.free),seeMore:a(p.hS.seeMore),tdsLabel:a(k.tdsLabel),gstLabel:a(k.gstLabel)}}},1502:(e,a,n)=>{n.d(a,{Z:()=>o});var l=n(0),t=n(276),r=n(3624),s=n(217),i=n(795),u=n(3688);function o(){const e=(0,t.Z)(),a=(0,r.Z)(),n=(0,s.Z)(),o=(0,i.Z)(),c=(0,u.Z)();return(0,l.useCallback)((()=>{e(),a(),n(),o({type:"buys"}),o({type:"sells"}),c()}),[e,a,n,o,c])}},874:(e,a,n)=>{n.d(a,{Z:()=>t});var l=n(33);function t(e,a,n=!1,t,r){const s=(r?[r,...e]:e).filter((e=>{if("buy"===a&&"uk_bank_account"===e.type)return e.allowBuy&&n;return!("sell"!==a||"cashOut"!==t||"ach_bank_account"!==e.type)||e[`allow${(0,l.capitalize)(a)}`]&&e.verified}));return(0,l.sortBy)(s,(e=>"sell"===a&&"cashOut"===t&&"ach_bank_account"===e.type?-1:Object.keys(e.limits).includes(a)?-(0,l.toNumber)(e.limits[a][0]?.remaining.amount):0))}},558:(e,a,n)=>{n.d(a,{l:()=>t});var l=n(215);function t(e){return(0,l.c2)(e)?"cashTransfer":(0,l.Hq)(e)?"cashIn":(0,l._Y)(e)?"cashOut":void 0}},1554:(e,a,n)=>{n.d(a,{Z:()=>kn});var l=n(280);const t=(r={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},u=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],{argumentDefinitions:[{defaultValue:!1,kind:"LocalArgument",name:"includeApy"},{defaultValue:!1,kind:"LocalArgument",name:"includeBalance"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"}],kind:"Fragment",metadata:{plural:!0},name:"ConvertViewerAssetsFragment",selections:[{args:[{kind:"Variable",name:"includeApy",variableName:"includeApy"},{kind:"Variable",name:"includeBalance",variableName:"includeBalance"}],kind:"FragmentSpread",name:"ConvertStepperViewerAssetFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,fragment:{args:null,kind:"FragmentSpread",name:"AssetIsStablecoinFragment"},kind:"RelayResolver",name:"isStablecoin",resolverModule:l.W,path:"asset.isStablecoin"},r,s,i,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null},{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"}],kind:"ScalarField",name:"marketCapV2",storageKey:null},{args:null,kind:"FragmentSpread",name:"AssetCurrencyIconFragment"}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r,{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[r,s,i],storageKey:null}],type:"ViewerAsset",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:u,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:u,storageKey:null}],storageKey:null},{condition:"includeApy",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null}]}],type:"ViewerAsset",abstractKey:null});var r,s,i,u;t.hash="db6cf9a5bd6725c4b1399be387e64090";const o=t,c=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"},{defaultValue:null,kind:"LocalArgument",name:"shouldIncludeBalanceSummaryInfo"}],a={kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"},n=[{kind:"Variable",name:"after",variableName:"cursor"},{kind:"Variable",name:"first",variableName:"paginationCount"}],l={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},o={name:"isStablecoin",args:null,fragment:{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"AssetCategory",kind:"LinkedField",name:"categories",plural:!0,selections:[u,t],storageKey:null}],type:"Asset",abstractKey:null},kind:"RelayResolver",storageKey:null,isOutputType:!0},c={alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null},m=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],g={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},p=[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],y={alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},k={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},d],type:"TiersCurrency",abstractKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"ConvertPaginationRefetchable",selections:[{args:[{kind:"Variable",name:"cursor",variableName:"cursor"},{kind:"Variable",name:"paginationCount",variableName:"paginationCount"},a],kind:"FragmentSpread",name:"ConvertPaginationFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"ConvertPaginationRefetchable",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"convertibleAssets",args:n,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"convertibleAssetsV2",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,t,r,s,i,u,o,c,d,{alias:null,args:[{kind:"Literal",name:"filter",value:{quoteCurrency:"USD"}}],concreteType:"RetailBrokerageProduct",kind:"LinkedField",name:"brokerageProduct",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"baseIncrement",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"quoteIncrement",storageKey:null},t],storageKey:'brokerageProduct(filter:{"quoteCurrency":"USD"})'},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null},{alias:null,args:[a],kind:"ScalarField",name:"marketCapV2",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SupportedContextsV2",kind:"LinkedField",name:"supportedContextsV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTradable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isConvertible",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:m,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:m,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[g,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,o,t,i,r,s,u,d,c,{alias:null,args:null,concreteType:"DestinationTag",kind:"LinkedField",name:"destinationTag",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"regex",storageKey:null}],storageKey:null},o,{alias:null,args:p,kind:"ScalarField",name:"unitPriceScaleV2",storageKey:null},{alias:null,args:p,concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},{alias:null,args:null,concreteType:"PercentChanges",kind:"LinkedField",name:"percentChanges",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"day",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AssetBalanceBreakdown",kind:"LinkedField",name:"assetBalanceBreakdown",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalanceFiat",plural:!1,selections:m,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalance",plural:!1,selections:m,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:[t],type:"Node",abstractKey:"__isNode"},k],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},i,t],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[y],storageKey:null},t,g,{kind:"InlineFragment",selections:[k,{condition:"shouldIncludeBalanceSummaryInfo",kind:"Condition",passingValue:!0,selections:[{kind:"InlineFragment",selections:[i],type:"TiersCurrency",abstractKey:null}]}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"convertibleAssets",args:n,filters:null,handle:"connection",key:"Query_viewer_convertibleAssets",kind:"LinkedHandle",name:"convertibleAssetsV2"},t],storageKey:null}]},params:{id:"ceacef876d3688d25f7d9ed5295a97a2a632fb47e28aaa075dc34eb63dadb308",metadata:{},name:"ConvertPaginationRefetchable",operationKind:"query",text:null}}}();c.hash="72ddf4deb8ca8e6e999caad594a3c4bf";const d=c,m=function(){var e=["viewer","convertibleAssets"];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{kind:"RootArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"},{kind:"RootArgument",name:"shouldIncludeBalanceSummaryInfo"}],kind:"Fragment",metadata:{connection:[{count:"paginationCount",cursor:"cursor",direction:"forward",path:e}],refetch:{connection:{forward:{count:"paginationCount",cursor:"cursor"},backward:null,path:e},fragmentPathInResult:[],operation:d}},name:"ConvertPaginationFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{kind:"RequiredField",field:{alias:"convertibleAssets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"__Query_viewer_convertibleAssets_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},{args:[{kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"}],kind:"FragmentSpread",name:"ConvertViewerAssetsFragment"},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},action:"THROW",path:"viewer.convertibleAssets"}],storageKey:null}],type:"Query",abstractKey:null}}();m.hash="72ddf4deb8ca8e6e999caad594a3c4bf";const g=m,p=function(){var e={alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},a={kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"},n=[a],l=[e,{args:n,kind:"FragmentSpread",name:"ConvertViewerAssetsFragment"}],t=[{kind:"Variable",name:"productKey",variableName:"productKey"}];return{argumentDefinitions:[{kind:"RootArgument",name:"assetSlug"},{kind:"RootArgument",name:"assetSymbol"},{kind:"RootArgument",name:"assetUuid"},{kind:"RootArgument",name:"productKey"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"},{kind:"RootArgument",name:"skipAssetSlug"},{kind:"RootArgument",name:"skipAssetSymbol"},{kind:"RootArgument",name:"skipAssetUuid"},{kind:"RootArgument",name:"skipTargetAssetSlug"},{kind:"RootArgument",name:"targetAssetSlug"}],kind:"Fragment",metadata:null,name:"ConvertFragment",selections:[{args:null,kind:"FragmentSpread",name:"ConvertStepperFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"tradeRestrictions",args:[{kind:"Literal",name:"action",value:"trades"}],concreteType:"PolicyRestriction",kind:"LinkedField",name:"policyRestrictions",plural:!0,selections:[{args:null,kind:"FragmentSpread",name:"PolicyRestrictionEnforcerFragment"}],storageKey:'policyRestrictions(action:"trades")'},{condition:"skipAssetUuid",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"uuid",variableName:"assetUuid"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetByUuid",plural:!1,selections:l,storageKey:null}]},{condition:"skipAssetSymbol",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"symbol",variableName:"assetSymbol"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:l,storageKey:null}]},{condition:"skipAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"slug",variableName:"assetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:l,storageKey:null}]},{alias:"usdcViewerAsset",args:[{kind:"Literal",name:"symbol",value:"USDC"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:[e,{args:[{kind:"Literal",name:"includeApy",value:!0},{kind:"Literal",name:"includeBalance",value:!0},a],kind:"FragmentSpread",name:"ConvertViewerAssetsFragment"}],storageKey:'assetBySymbol(symbol:"USDC")'},{alias:null,args:t,concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null},{condition:"skipTargetAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:"targetAssetBySlug",args:[{kind:"Variable",name:"slug",variableName:"targetAssetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:l,storageKey:null}]}],storageKey:null},{args:t,kind:"FragmentSpread",name:"useSubscriberStatusFragment"},{args:n,kind:"FragmentSpread",name:"ConvertPaginationFragment"}],type:"Query",abstractKey:null}}();p.hash="a4a399174e17f4fabf1c076fe60fa016";const y=p;var k=n(0),f=n(33),b=n(3),S=n(366),F=n(801),v=n(871),h=n(860),C=n(123),T=n(220);const A=function(){var e=[{kind:"Variable",name:"includeApy",variableName:"includeApy"},{kind:"Variable",name:"includeBalance",variableName:"includeBalance"}];return{argumentDefinitions:[{defaultValue:!1,kind:"LocalArgument",name:"includeApy"},{defaultValue:!1,kind:"LocalArgument",name:"includeBalance"}],kind:"Fragment",metadata:{plural:!0},name:"ConvertStepperViewerAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"SelectSourceStepFragment"},{args:null,kind:"FragmentSpread",name:"SelectTargetStepFragment"},{args:e,kind:"FragmentSpread",name:"UsdcEntryStepSourceAssetFragment"},{args:e,kind:"FragmentSpread",name:"UsdcEntryStepTargetAssetFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepConvertSourceAssetFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepConvertTargetAssetFragment"},{args:null,kind:"FragmentSpread",name:"ConvertFooterFragment"},{args:null,kind:"FragmentSpread",name:"PriceInfoStepFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null}}();A.hash="cd2b3622502c3825f704eae002b23816";const K=A,x={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ConvertStepperFragment",selections:[{args:null,kind:"FragmentSpread",name:"SelectPaymentStepFragment"},{args:null,kind:"FragmentSpread",name:"ConvertStatusStepFragment"},{args:null,kind:"FragmentSpread",name:"UsdcEntryStepQueryFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepConvertQueryFragment"},{args:null,kind:"FragmentSpread",name:"StatusStepConvertFragment"},{args:[{kind:"Literal",name:"skip",value:!1}],kind:"FragmentSpread",name:"useTradeBenefitDataFragment"},{args:[{kind:"Literal",name:"action",value:"recurring_buys"}],kind:"FragmentSpread",name:"PreviewStepUsdcInfoFragment"}],type:"Query",abstractKey:null,hash:"5c74a7cd0aef9d5503d88c3a0111c33b"},w=x;var B=n(10),L=n(53),I=n(782),P=n(1398),R=n(350),M=n(549),E=n(73),_=n(3922),V=n(215),D=n(187),j=n(1312),N=n(1313),O=n(749),Z=n(558),U=n(1316),q=n(1390);const Q={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ConvertFooterFragment",selections:[{args:null,kind:"FragmentSpread",name:"FooterFragment"}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency",hash:"6f24d5f5e95a98456bf1fb473a826867"},H=Q;var W=n(105),z=n(2);function G({account:e,assetOrCurrencyRef:a}){const n=(0,b.Jc)(H,a),l=(0,W.Z)(),{fiatBalance:t,nativeBalance:r}=(0,k.useMemo)((()=>({fiatBalance:{amount:e.availableBalanceInNativeCurrency?.value||"0",currency:e.availableBalanceInNativeCurrency?.currency||l},nativeBalance:{amount:e.availableBalance.value,currency:e.availableBalance.currency}})),[l,e.availableBalance.currency,e.availableBalance.value,e.availableBalanceInNativeCurrency?.currency,e.availableBalanceInNativeCurrency?.value]);return(0,z.jsx)(R.$_,{balance:r,fiatBalance:t,entryPoint:"convert",assetOrCurrencyRef:n,"data-element":"Footer","data-component":"ConvertFooter"})}var J=n(158),$=n(811),Y=n(955),X=n(60),ee=n(65),ae=n(229);const ne={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EntryStepConvertQueryFragment",selections:[{args:null,kind:"FragmentSpread",name:"ConvertEntrySelectorFragment"},{args:null,kind:"FragmentSpread",name:"SimpleTradeFixedAmountsFragment"}],type:"Query",abstractKey:null,hash:"7cba0b1c2826704a13e681a4cf8d38f4"},le=ne,te={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EntryStepConvertTargetAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"EntryInputFragment"}],type:"ViewerAsset",abstractKey:null,hash:"d82ecb897e723772e4298ed5109ec1d0"},re=te,se={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EntryStepConvertSourceAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{args:null,kind:"FragmentSpread",name:"SimpleTradeFixedAmountsAccountFragment"}],storageKey:null},{args:null,kind:"FragmentSpread",name:"EntryInputFragment"},{args:null,kind:"FragmentSpread",name:"EntryInputV2Fragment"},{args:null,kind:"FragmentSpread",name:"useIsInputDisabledFragment"}],type:"ViewerAsset",abstractKey:null,hash:"16e2826269a212915d7350d25b630797"},ie=se;var ue=n(9),oe=n(506),ce=n(35),de=n(179),me=n(7),ge=n(3630),pe=n(273),ye=n(744);const ke={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ConvertEntrySelectorFragment",selections:[{args:null,kind:"FragmentSpread",name:"useGetFormattedCurrentFiatPriceOfOneAssetFragment"}],type:"Query",abstractKey:null,hash:"a319e77f3993328e4de2fb9fd3e2c3da"},fe=ke;var be=n(285),Se=n(15),Fe=n(11);const ve=(0,Fe.vU)({invalidInputError:{id:"Convert.EntryStep.invalidInputError",defaultMessage:"Please enter a valid input amount."},previewButtonLabel:{id:"Convert.EntryStep.previewButtonLabel",defaultMessage:"Convert preview"},available:{id:"Convert.EntryStep.available",defaultMessage:"Available"},price:{id:"Convert.EntryStep.price",defaultMessage:"Price"}});var he=n(746),Ce=n(747);function Te({row1:e,row2:a,onClickSwitcher:n,switcherIcon:l="arrowsVertical",transferType:t,queryRef:r}){const s=(0,b.Jc)(fe,r),i=(0,Se.$T)(),{sourceAccount:u,targetAsset:o}=(0,T.E)(),{formatMessage:c}=(0,ue.Z)(),d=(0,k.useMemo)((()=>{const e=i({amount:u.availableBalanceInNativeCurrency,isFiat:!0,exponent:(0,be.Z)(Number(u.availableBalanceInNativeCurrency?.value)||0)});return e===Se.ob?"":e}),[i,u.availableBalanceInNativeCurrency]),m=(0,k.useMemo)((()=>{if(d&&d.trim()&&d!==Se.ob)return c(ve.available)}),[c,d]),g=(0,he.X)({assetDisplaySymbol:o.displaySymbol??"",queryRef:s}),p=g&&g.trim()?c(ve.price):void 0,y=(0,k.useMemo)((()=>({...e,detail:d,subdetail:m})),[e,d,m]),f=(0,k.useMemo)((()=>({...a,detail:g,subdetail:p})),[a,g,p]);return(0,z.jsx)(Ce.r,{row1:y,row2:f,onClickSwitcher:n,switcherIcon:l,transferType:t,"data-element":"EntrySelector","data-component":"ConvertEntrySelector"})}var Ae=n(1308),Ke=n(110),xe=n(268),we=n(287),Be=n(1309),Le=n(1310),Ie=n(799),Pe=n(2414),Re=n(545);var Me=n(1615),Ee=n(1555),_e=n(23),Ve=n(1499);const De=(0,Fe.vU)({convertHeader:{id:"ConvertCrypto.EntryStep.convertHeader",defaultMessage:"Convert"},tradeHeader:{id:"ConvertCrypto.EntryStep.tradeHeader",defaultMessage:"Trade"},convertDefaultButton:{id:"ConvertCrypto.EntryStep.convertDefaultButton",defaultMessage:"Convert {assetName}"},tradeDefaultButton:{id:"ConvertCrypto.EntryStep.tradeDefaultButton",defaultMessage:"Trade"},convertPreviewButton:{id:"ConvertCrypto.EntryStep.convertPreviewButton",defaultMessage:"Preview Convert"},tradePreviewButton:{id:"ConvertCrypto.EntryStep.tradePreviewButton",defaultMessage:"Preview trade"},tradeSecondaryInputButton:{id:"ConvertCrypto.EntryStep.tradeSecondaryInputButton",defaultMessage:"Trade all"},convertSecondaryInputButton:{id:"ConvertCrypto.EntryStep.convertSecondaryInputButton",defaultMessage:"Convert all"},convertZeroBalance:{id:"ConvertCrypto.EntryStep.convertZeroBalance",defaultMessage:"You don't have any {assetName} to convert. Try buying some to get started."},tradeZeroBalance:{id:"ConvertCrypto.EntryStep.tradeZeroBalance",defaultMessage:"You don't have any {assetName} to trade. Fund your account to get started."},from:{id:"ConvertCrypto.EntryStep.from",defaultMessage:"From"},to:{id:"ConvertCrypto.EntryStep.to",defaultMessage:"To"}});var je=n(186);const Ne=()=>{const{formatMessage:e}=(0,ue.Z)(),{goToStep:a}=(0,E.tC)(J.Ex),n=(0,$.Z)(),{sourceAsset:l}=(0,T.E)(),{startTradePerfMark:t}=(0,je.Z)(),r=(0,k.useCallback)((()=>{n("tapped_select_source_asset"),a("selectSource"),t("load_assets_from","convert")}),[n,a,t]);return(0,k.useMemo)((()=>({secondaryLabel:l.name,primaryLabel:e(De.from),image:l.imageUrl,onPress:r,testID:"convert-from-selector"})),[e,r,l.imageUrl,l.name])},Oe=()=>{const{formatMessage:e}=(0,ue.Z)(),{goToStep:a}=(0,E.tC)(J.Ex),n=(0,$.Z)(),{targetAsset:l}=(0,T.E)(),{startTradePerfMark:t}=(0,je.Z)(),r=(0,k.useCallback)((()=>{n("tapped_select_target_asset"),a("selectTarget"),t("load_assets_to","convert")}),[n,a,t]);return(0,k.useMemo)((()=>({secondaryLabel:l.name,primaryLabel:e(De.to),image:l.imageUrl,onPress:r,testID:"convert-to-selector"})),[e,r,l.imageUrl,l.name])};function Ze(){}const Ue=(0,B.ZP)(Pe.Nq).attrs({noBottomPadding:!0}).withConfig({displayName:"EntryStep__StyledInnerStepContent",componentId:"j7rbgl-0"})(["padding-top:48px;"]),qe=function({closeModal:e,sourceViewerAssetRef:a,targetViewerAssetRef:n,queryRef:l}){const t=(0,b.Jc)(ie,a),r=(0,b.Jc)(re,n),s=(0,b.Jc)(le,l),i=(0,ye.M)(t),u=(0,xe.Z)(),{renderTabs:o}=(0,k.useContext)(pe.xk),c=(0,X.Z)(),d=(0,W.Z)(),{amount:m,sourceAssetId:g,targetAssetId:p,isFiatInput:y}=(0,Ke.Z)(!0),{formatMessage:f}=(0,ue.Z)(),S=function(){const{sourceAssetId:e,targetAssetId:a}=(0,L.jf)(J.cr),n=(0,$.Z)();return(0,k.useCallback)((()=>{const l=a.value,t=e.value;l&&t?(e.onChange(l),a.onChange(t),n("convert_tapped_switch")):(0,Se.cB)(new Error("Missing an asset when swapping in convert flow"),{owner:"trading",context:"convert",sourceAsset:e.value,targetAsset:a.value})}),[a,e,n])}(),F=(0,$.Z)(),{fetchQuote:v,debouncedFetchQuote:h,fiatAmount:C,cryptoAmount:A,isLoaded:K,isFetching:x,cancelQuote:w}=(0,Me.Z)(u?{buySellProxy:"sell"}:void 0),B=t.asset.displaySymbol??"",I=t.asset.platformName??"",{submitQuote:P,isSubmitting:M}=(0,Ee.Z)(),{sourceAccount:E}=(0,T.E)(),_=Ne(),V=Oe(),D=(0,Ae.x)(t,"convert"),{buttonText:j,secondaryButtonText:N,errorText:O,headerText:Z}=function(){const{formatMessage:e}=(0,ue.Z)(),{amount:a}=(0,L.jf)(J.cr),{isCryptoOnlyTrader:n}=(0,_e.Z)(),{sourceAsset:l,sourceAccount:t}=(0,T.E)(),r=0===parseFloat(t.availableBalance.value),s=n?"trade":"convert",i=a.errors[0],u=e(De[`${s}DefaultButton`],{assetName:(0,Ve.Z)(l.name)}),o=e(De[`${s}PreviewButton`]),c=e(De[`${s}ZeroBalance`],{assetName:(0,Ve.Z)(l.name)}),d=""===a.value?u:o,m=e(De[`${s}SecondaryInputButton`]),g=r?i||c:i,p=n?e(De.tradeHeader):void 0;return(0,k.useMemo)((()=>({buttonText:d,secondaryButtonText:m,errorText:g,headerText:p})),[d,g,p,m])}(),U=(0,Re._)(),q=(0,k.useCallback)((async()=>{w(),F("tapped_preview"),U("CLICK_BUY_BUTTON_PREVIEW_BUY_BUTTON_WEB","swap",{uuid:r.asset.uuid,symbol:r.asset.platformName},{uuid:t.asset.uuid,symbol:t.asset.platformName}),(0,me.$Y)("trigger_convert_order_preview_button"),parseFloat(m.value)?P({variables:{amount:{value:m.value,currency:d}}}):m.onErrors([f(ve.invalidInputError)])}),[w,F,U,r,m,f,P,d,t]);(0,oe.Z)((()=>{m.errors[0]&&F("viewed_error",{error:m.errors[0]})}),[m.errors]),(0,k.useEffect)((()=>{m.onChange(m.value),parseFloat(E.availableBalance.value)?parseFloat(m.value)&&v({input:{amount:{value:m.value,currency:d},sourceAssetUuid:g.value,targetAssetUuid:p.value}}):F("viewed_validation_error",{error:`You don't have any ${t.asset.name} to convert. Try buying some to get started.`})}),[g.value,p.value]);const Q=(0,k.useCallback)((()=>{w(),F("tapped_convert_all"),P({variables:{amount:E.availableBalance}})}),[w,E.availableBalance,P,F]),H=(0,k.useCallback)((e=>{if(m.onChange(e),!parseFloat(e))return w();h({input:{amount:{value:e,currency:d},sourceAssetUuid:g.value,targetAssetUuid:p.value}}),F("viewed_updated_amount")}),[m,w,h,d,g.value,p.value,F]),G=c&&e?e:void 0,Y=Z||G,ee=[t.asset.platformName??"",r.asset.platformName??""],ae=(0,k.useMemo)((()=>y.value?B:d),[y.value,B,d]),ne=(0,k.useMemo)((()=>y.value?A:C),[A,C,y.value]),te=(0,ge.Z)({form:we.cr,quoteFiatAmount:C,quoteCryptoAmount:A}),se=(0,ge.Z)({form:J.cr,quoteFiatAmount:C,quoteCryptoAmount:A}),ke=(0,k.useMemo)((()=>({onPress:u?te:se,inactiveSymbol:ae||"",inactiveAmount:ne||"",disabled:M||!!m.errors[0],hideAmount:!parseFloat(m.value)})),[m.errors,m.value,ne,ae,M,te,u,se]),fe=(0,k.useCallback)((e=>{y.onChange(e)}),[y]),be=(0,k.useMemo)((()=>(0,z.jsx)(Le.$,{queryRef:s,accountRef:i,setInputValue:H,setInputCurrency:fe,tradeTypeUI:"swap",disabled:!y||x||M,target:{assetId:p.value},triggerSubmit:Ze})),[s,i,H,fe,y,x,M,p.value]),Fe=(0,k.useMemo)((()=>({..._,disabled:M,testID:"convert-source-selector"})),[M,_]),he=(0,k.useMemo)((()=>({...V,disabled:M,testID:"convert-target-selector"})),[M,V]),Ce=(0,k.useMemo)((()=>{const e=!!m.errors[0]||M||D||""===m.value;return u?(0,z.jsx)(Be.r,{block:!0,loading:M,disabled:e,handleSubmit:q,testID:"convert-preview-button","aria-label":f(ve.previewButtonLabel),label:j,endIcon:"forwardArrow"}):(0,z.jsx)(ce.Button,{block:!0,disabled:!!m.errors[0]||D||""===m.value,loading:M,onPress:q,testID:"convert-preview-button","aria-label":f(ve.previewButtonLabel),children:j})}),[m.errors,m.value,j,f,q,u,D,M]);return(0,z.jsxs)(Pe.V8,{"data-element":"StepWrapper","data-component":"EntryStep",children:[(0,z.jsx)(Ie.Z,{view:"CONVERT",currencies:ee,"data-element":"SystemAlert"}),o&&o(),Y&&(0,z.jsx)(R.h4,{goBack:G,title:Z}),(0,z.jsx)(Ue,{noTopPadding:!0,"data-element":"StyledInnerStepContent",children:(0,z.jsx)(b.zq,{instrumentationId:"EntryInput",fallback:null,"data-element":"InstrumentedSuspense",children:(0,z.jsx)(R.qb,{input:{symbol:y.value?d:I,displaySymbol:y.value?void 0:B,value:m.value,onChange:H,onEnter:q,readOnly:M||D},secondaryButton:u?be:(0,z.jsx)(R.VH,{onPress:Q,testID:"convert-all",disabled:M||!!O||D,children:N}),viewerAssetRef:t??r??null,error:O,transferType:"convert",isNewDesign:u,switchActiveInput:u?ke:void 0,"data-element":"EntryInput"})})}),(0,z.jsxs)(Pe.Sr,{"data-testid":x||M?"convert-quote-loading":K?"convert-quote-loaded":"",hasFooter:!0,noPaddingTop:!0,"data-element":"StickyButtonContainer",children:[(0,z.jsx)(Te,{row1:Fe,row2:he,onClickSwitcher:M?void 0:S,transferType:"convert",queryRef:s,"data-element":"ConvertEntrySelector"}),Ce]}),(0,z.jsx)(de.Spacer,{vertical:2,"data-element":"Spacer"})]})};var Qe=n(521),He=n(785),We=n(787),ze=n(1611),Ge=n(952);const Je=(0,Fe.vU)({title:{id:"ConvertFeesInfo.title",defaultMessage:"Fees on cryptocurrency Conversions"},priceCanChangeDescription:{id:"ConvertFeesInfo.priceCanChangeDescription",defaultMessage:"Coinbase charges a fee at the time you place your order based on a combination of factors such as market conditions, payment method, and size of order. Your quoted price at the time of purchase also includes spread, which allows us to temporarily lock in your price while your order is processed. Learn more about our fees, including our use of spread,"},priceCanChangeDescriptionWithoutSpreadV2:{id:"ConvertFeesInfo.priceCanChangeDescriptionWithoutSpreadV2",defaultMessage:"Coinbase charges a fee at the time you place your order based on a combination of factors such as market conditions, payment method, and size of order. Learn more about our fees"},frequentPriceChangeAndQuoteSpread:{id:"ConvertFeesInfo.frequentPriceChangeAndQuoteSpread",defaultMessage:"The price of cryptocurrency changes frequently based on market conditions. The exchange rate quoted includes a spread that allows us to temporarily lock in your price while your order is processed. Learn more about spread"},frequentPriceChangeAndQuoteSpreadV3:{id:"ConvertFeesInfo.frequentPriceChangeAndQuoteSpreadV3",defaultMessage:"The price of cryptocurrency changes frequently based on market conditions. The exchange rate quoted includes a {spreadPercentage}% spread. Learn more about spread"},here:{id:"ConvertFeesInfo.here",defaultMessage:"here."}});function $e({cb1TradeBenefitData:e,spreadPercentage:a,transferType:n}){const{goBack:l,currentStep:t}=(0,E.tC)(J.Ex),{formatMessage:r,locale:s}=(0,ue.Z)(),{previewFeeDisclosure:i,showCbOneBannerOnInfoStep:u}=(0,L.jf)(J.cr),o=(0,He.h)(),c=i.value,d=o&&(c?.link?.url&&c?.link?.text)?c.link?.url:`https://help.coinbase.com/${s}/coinbase/trading-and-funding/pricing-and-fees/fees`,m=(0,We.d)(),g=(0,k.useMemo)((()=>"exchangeInfo"===t?r(m&&a?Je.frequentPriceChangeAndQuoteSpreadV3:Je.frequentPriceChangeAndQuoteSpread,{spreadPercentage:a}):r(m?Je.priceCanChangeDescriptionWithoutSpreadV2:Je.priceCanChangeDescription)),[m,t,r,a]),p=(0,k.useMemo)((()=>!e?.isEligible||o&&!u.value?null:(0,z.jsx)(ze.P,{tradeBenefitData:e})),[e,o,u.value]),y=(0,k.useMemo)((()=>{if(o)return c?.title??"";const e="buy"===n?Ge.s.titleBuy:"sell"===n?Ge.s.titleSell:Je.title;return r(e)}),[c?.title,r,o,n]);return(0,z.jsx)(Qe.Z,{onBackPress:l,headerTitle:y,message:g,ctaUrl:d,ctaText:r(Je.here),postMessage:p,"data-element":"InfoStep","data-component":"FeesInfoStep"})}const Ye=(0,k.memo)($e);var Xe=n(162),ea=n(791),aa=n(573),na=n(792);const la=(0,Fe.vU)({title:{id:"ConvertOrderTypeSelectStep.title",defaultMessage:"Order types"}}),ta=["MARKET","RECURRING"];function ra(){const{formatMessage:e}=(0,ue.Z)(),{goToStep:a,goBack:n}=(0,E.tC)(J.Ex),{orderType:l}=(0,L.jf)(J.cr),{setRecurringOption:t}=(0,D.D)(),r=(0,$.Z)(),s=(0,k.useCallback)((e=>{r("_order_type_selected",{orderType:e}),l.onChange(e),"RECURRING"===e?a("proxyRecurringSelect"):(t("never"),a("entry"))}),[a,l,t,r]),i=(0,aa.Z)();return(0,z.jsxs)(na.V8,{"data-element":"StepWrapper","data-component":"OrderTypeSelectStep",children:[(0,z.jsx)(ea.Z,{goBack:n,title:e(la.title),"data-element":"Header"}),(0,z.jsx)(sa,{"data-element":"StyledInnerStepContent",children:ta.map((e=>{const a=e===l.value,n=i(e);return(0,z.jsx)(Xe.ListCell,{as:"li",selected:a,variant:"foregroundMuted",onPress:()=>s(e),title:n?.title,description:n?.message,testID:`${e}-option`,multiline:!0},e)}))})]})}const sa=(0,B.ZP)(na.Nq).withConfig({displayName:"OrderTypeSelectStep__StyledInnerStepContent",componentId:"aeo47e-0"})(["padding:0 ",";"],(e=>e.theme.size.medium)),ia=(0,k.memo)(ra),ua={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"action"}],kind:"Fragment",metadata:null,name:"PreviewStepUsdcInfoFragment",selections:[{args:[{kind:"Variable",name:"action",variableName:"action"}],kind:"FragmentSpread",name:"ProxyPreviewStepFragment"}],type:"Query",abstractKey:null,hash:"6bd0aa2dccf7ff62d9d2ae5696276474"},oa=ua;var ca=n(8),da=n.n(ca),ma=n(947),ga=n(786),pa=n(544),ya=n(3924),ka=n(520);function fa(){const{goBack:e,currentStep:a,previousStep:n}=(0,E.tC)(J.Ex),l=(0,$.Z)();return(0,k.useCallback)((()=>{l("tapped_back",{previous_step:n,active_step:a}),e()}),[l,n,a,e])}var ba=n(1393),Sa=n(1617);const Fa=(0,Fe.vU)({previewHeader:{id:"ConvertCrypto.PreviewStep.convertPreviewHeader",defaultMessage:"Order preview"},sourceQuote:{id:"ConvertCrypto.PreviewStep.to",defaultMessage:"From {source} ({fiat}) to"},summaryValue:{id:"ConvertCrypto.PreviewStep.summaryValue",defaultMessage:"{inputAmountInFiat} of {sourceSymbol} to {targetSymbol}"},convertButton:{id:"ConvertCrypto.PreviewStep.button",defaultMessage:"Convert now"},tradeButton:{id:"ConvertCrypto.PreviewStep.tradeButton",defaultMessage:"Trade now"},exchangeRateLabel:{id:"ConvertCrypto.PreviewStep.exchangeRateLabel",defaultMessage:"Exchange rate"},exchangeRateValue:{id:"ConvertCrypto.PreviewStep.exchangeRateValue",defaultMessage:"1 {sourceSymbol} = {exchangeRateAmount} {exchangeRateCurrency}"},payWithLabel:{id:"ConvertCrypto.PreviewStep.payWithLabel",defaultMessage:"Pay with"},priceLabel:{id:"ConvertCrypto.PreviewStep.priceLabel",defaultMessage:"{fromSymbol} price"},totalLabel:{id:"ConvertCrypto.PreviewStep.totalLabel",defaultMessage:"Total"},tdsLabel:{id:"ConvertCrypto.PreviewStep.labels.tdsLabel",defaultMessage:"TDS"},gstLabel:{id:"ConvertCrypto.PreviewStep.labels.gstLabel",defaultMessage:"GST"}});function va(){const{formatMessage:e}=(0,ue.Z)(),{isCryptoOnlyTrader:a}=(0,_e.Z)(),{quoteResponse:n}=(0,L.jf)(J.cr),{sourceAsset:l,targetAsset:t}=(0,T.E)(),r=n.value?.convert?.exchangeRate;da()(r,"Quote data should be defined");const s=a?"trade":"convert",i=e(Fa.previewHeader),u=e(Fa.payWithLabel),o=e(Fa.exchangeRateLabel),c=e(Fa.exchangeRateValue,{sourceSymbol:l.displaySymbol,exchangeRateAmount:r.value,exchangeRateCurrency:t.displaySymbol}),d=e(Fa.totalLabel),m=e(Fa[`${s}Button`]),g=e(Fa.tdsLabel),p=e(Fa.gstLabel);return(0,k.useMemo)((()=>({headerText:i,payWithLabel:u,exchangeRateLabel:o,exchangeRateValue:c,totalLabel:d,buttonText:m,tdsLabel:g,gstLabel:p})),[m,o,c,i,u,d,g,p])}var ha=n(1399),Ca=n(2421),Ta=n(885),Aa=n(872),Ka=n(1616);var xa=n(96),wa=n(1501),Ba=n(750);const La=(0,Fe.vU)({confirmButtonLabel:{id:"Convert.PreviewStep.confirmButtonLabel",defaultMessage:"Convert now"}});const Ia=function({handleTaxInfoClicked:e,footer:a,transferType:n,queryRef:l}){const t=(0,b.Jc)(oa,l),{quoteResponse:r,quoteResponseInputAmount:s,acceptDisclosureForAllExperimentalAssets:i}=(0,L.jf)(J.cr),u=r.value?.userWarnings??[],{headerText:o,buttonText:c}=va(),{formatMessage:d}=(0,ue.Z)(),m=function(e){const{quoteResponse:a}=(0,L.jf)(J.cr),n=a.value?.convert,{sourceAsset:l,targetAsset:t,isCoinbaseOneSubscriber:r}=(0,T.E)(),s=(0,He.h)();da()(n,"Quote data should be defined");const{displayInputAmount:i,inputAmount:u,outputAmount:o,fee:c,taxDetails:d,fees:m}=n,{exchangeRateLabel:g,exchangeRateValue:p,payWithLabel:y,totalLabel:f,tdsLabel:b,gstLabel:S}=va(),F=(0,$.Z)(),v=(0,Se.$T)(),{isInSingapore:h}=(0,_e.Z)(),{goToStep:C}=(0,E.tC)(J.Ex),A=(0,k.useCallback)(((e,a)=>()=>{F("tapped_convert_fee_explanation_button",{content:a}),C(e)}),[C,F]),K=v({amount:{amount:o.value,currency:t.displaySymbol??""},isFiat:!1}),x=(0,k.useMemo)((()=>({INDIA_WITHHOLDING:b,AUSTRALIA_GST:S,SINGAPORE_GST:S})),[b,S]),w=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(R.mG,{text:K,useTicker:!0}),(0,z.jsx)(R.LZ,{size:"enormous"})]}),B=(0,k.useMemo)((()=>(0,ha.xx)(n,"convert")),[n]),I=(0,z.jsx)(R.aR,{label:y,rightContent:l.displaySymbol,rightIcon:(0,z.jsxs)(z.Fragment,{children:[" ",(0,z.jsx)(Ca.Z,{size:24,assetRef:l})]})}),P=(0,z.jsx)(R.hc,{label:g,rightContent:p,onClick:A("exchangeInfo","price"),testID:"exchange-rate"}),M=s?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(R.hc,{includesTaxes:h&&!(d?.length&&d?.length>=0),rightContent:c?r?(0,z.jsx)(Ta.F,{subscriptionFeeBenefit:B}):v({amount:c,isFiat:!0}):null,onClick:A("feesInfo","coinbase_fees"),testID:"fee"}),r&&(0,z.jsx)(Aa.c,{subscriptionFeeBenefit:B})]}),_=s?(0,z.jsx)(Ka.Z,{fees:m,subscriptionFeeBenefit:B,isCoinbaseOneSubscriber:r}):null,V=(0,z.jsx)(R.aR,{label:f,rightContent:(0,z.jsxs)(z.Fragment,{children:[v({amount:{amount:u.value,currency:l.displaySymbol??""},isFiat:!1}),(0,z.jsx)("br",{}),v({amount:i,isFiat:!0})]})});return[w,I,P,M,s?null:(0,z.jsx)(z.Fragment,{children:d?.map(((a,n)=>a?(0,z.jsx)(R.oO,{label:x[a.name],rightContent:v({amount:a.amount,isFiat:!0}),isInfo:!0,onClick:()=>e(a.name),testID:"tax"},n):null))}),_,V]}(e),{commitConvert:g,isCommitting:p}=(0,Sa.Z)(),y=fa(),f=(0,$.Z)({transferType:n}),{sourceAsset:S,targetAsset:F}=(0,T.E)(),v=(0,ba.B)(),h=(0,ga.S)(),C=r.value?.convert,A=(0,k.useMemo)((()=>(da()(s.value,"quote input response input amount should be set"),{input:{amount:s.value,sourceAssetUuid:S.uuid,targetAssetUuid:F.uuid,recurringPeriod:C?.recurringPeriod?.toLowerCase()||void 0}})),[s.value,S.uuid,F.uuid,C?.recurringPeriod]),{showModal:K}=(0,ka.Z)();da()(C,"Quote data should be defined");const{stopPolling:x,isSignificantChange:w}=(({params:e,exchangeRate:a})=>{const n=(0,k.useRef)(),[l]=(0,Ba.Z)(),{quoteResponse:t}=(0,L.jf)(J.cr),[r,s]=(0,k.useState)(!1),{startTimeout:i,stopTimeout:u}=(0,wa.Z)(),o=(0,k.useRef)(a),c=(0,k.useCallback)((()=>l({variables:e,onCompleted:({response:e})=>{const a=e.createConvertV2;switch(a?.__typename){case"GenericError":case"CreateConvertV2BadRequestError":{const e=new Error("Convert quote refresh failed");return e.cause=a.message,void(0,Se.cB)(e,{owner:"trading",context:"convert"})}case"CreateConvertSuccess":return t.onChange(a),parseFloat(a.convert.exchangeRate.value)/parseFloat(o.current)<.98&&s(!0),void i((()=>{n.current=c()}),4e3);default:(0,Se.cB)(new Error(`${a?.__typename} __typename received`),{owner:"trading",context:"convert"})}},onError:e=>{(0,Se.cB)((0,xa.Xv)(e),{owner:"trading",context:"convert"})}})),[l,e,t,i]),d=(0,k.useCallback)((()=>{n.current?.dispose(),u()}),[u]);return(0,k.useEffect)((()=>(i((()=>{n.current=c()}),4e3),()=>{d()})),[]),{isSignificantChange:r,stopPolling:d}})({params:A,exchangeRate:C.exchangeRate.value});(0,k.useEffect)((()=>{w&&K((0,z.jsx)(ma.D,{asset:F.displaySymbol??"",displayInputCurrency:C.displayInputAmount.currency,onConfirm:x,onBack:y}))}),[w]),(0,k.useEffect)((()=>{f("viewed_preview"),n?(0,me.$Y)(`loaded_${n}_order_preview_usdc`):(0,me.$Y)("loaded_convert_order_preview")}),[]);const B=(0,M.zC)({assetId:F.uuid}),{setWalletTxnTimestamp:I}=(0,pa.W)(),P=(0,k.useCallback)((()=>{f("tapped_confirm_button"),n?((0,me.$Y)(`trigger_${n}_order_confirm_button_usdc`),I({pmType:"asset",assetId:"buy"===n?S.uuid:F.uuid,trackType:"buy"===n?"buy":"sell-or-add-cash"})):(0,me.$Y)("trigger_convert_order_confirm_button"),F.experimental&&B(i.value),x(),g()}),[f,n,F,S,x,g,I,B,i.value]),_=(0,k.useCallback)((()=>{x(),y()}),[y,x]);return n?(0,z.jsx)(ya.Y,{tradeType:n,convertQuote:C,userWarnings:u,footer:a,onCommitClick:P,goBack:_,stopPolling:x,queryRef:t}):(0,z.jsxs)(Pe.V8,{"data-element":"StepWrapper","data-component":"PreviewStep",children:[(0,z.jsx)(R.h4,{goBack:p?void 0:_,title:o,testID:"preview-header","data-element":"Header"}),(0,z.jsx)(Pe.Nq,{noBottomPadding:!0,"data-element":"InnerStepContent",children:m}),u.length>0&&(0,z.jsx)(R.vl,{children:u.map((e=>(0,z.jsx)(R.ab,{text:e.message},e.id)))}),(0,z.jsx)(Pe.Sr,{hasFooter:!0,noPaddingTop:!0,"data-element":"StickyButtonContainer",children:(0,z.jsx)(ce.Button,{block:!0,loading:p,disabled:p||v||h,onPress:P,testID:"convert-commit-button","aria-label":d(La.confirmButtonLabel),"data-element":"Button",children:c})}),a]})},Pa={argumentDefinitions:[],kind:"Fragment",metadata:{plural:!0},name:"SelectSourceStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"SelectAssetStepSharedFragment"}],type:"ViewerAsset",abstractKey:null,hash:"7dcc0e66a7da2ece73832e48fbcbc716"},Ra=Pa;var Ma=n(1553),Ea=n(777);const _a=function({viewerAssetRefs:e,excludedAssetIds:a,onAssetSelect:n}){const l=(0,b.Jc)(Ra,e),{sourceAssetId:t,targetAssetId:r}=(0,L.jf)(J.cr),s=fa(),i=(0,$.Z)(),u=function(){const{convertibleAssets:e}=(0,T.E)(),a=(0,k.useMemo)((()=>e.map((({asset:e})=>e.uuid))),[e]);return(0,Ea.Z)(a)}(),{endTradePerfMark:o}=(0,je.Z)();return(0,k.useEffect)((()=>{o("load_assets_from","convert")}),[o]),(0,z.jsx)(Ma.Z,{viewerAssetRefs:l,activeAssetId:t.value,dataHandlePrefix:"convert-from",filterZeroBalance:!0,onAssetSelect:e=>{if(t.value===e||!e)return n();t.onChange(e),i("tapped_source_asset");if(e===r.value){const a=u.filter((a=>a!==e)).find((e=>e!==r.value));da()(a,"There should always be a new target asset"),r.onChange(a)}n(e)},onBack:s,showBalance:!0,sortByBalance:!0,transferType:"convert",excludedAssetIds:a,"data-element":"SelectAssetStep","data-component":"SelectSourceStep"})},Va={argumentDefinitions:[],kind:"Fragment",metadata:{plural:!0},name:"SelectTargetStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"SelectTradableAccountStepFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"440072e53a625b4598cfcd5b420bae69"},Da=Va;function ja({viewerAssetRefs:e,onAssetSelect:a}){const n=(0,b.Jc)(Da,e),{sourceAssetId:l,targetAssetId:t}=(0,L.jf)(J.cr),r=fa(),s=(0,$.Z)(),{endTradePerfMark:i}=(0,je.Z)(),u=(0,k.useMemo)((()=>n.filter((({asset:{uuid:e}})=>e!==l.value))),[n,l.value]),o=(0,k.useCallback)((e=>{t.value!==e?(t.onChange(e),s("tapped_target_asset"),a(e)):a()}),[t,s,a]);return(0,k.useEffect)((()=>{i("load_assets_to","convert")}),[i]),(0,z.jsx)(Ma.w,{viewerAssetRefs:u,transferType:"convert",dataHandlePrefix:"convert-to",onBack:r,activeAssetId:t.value,onAssetSelect:o,showBalance:!0,"data-element":"SelectTradableAccountStep","data-component":"SelectTargetStep"})}const Na=(0,k.memo)(ja),Oa={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ConvertStatusStepFragment",selections:[{args:null,kind:"FragmentSpread",name:"StatusStepFragment"}],type:"Query",abstractKey:null,hash:"c87cf4f57dff3567908f93f7b7833a9d"},Za=Oa;var Ua=n(32),qa=n(950),Qa=n(276),Ha=n(505);const Wa=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"uuid",variableName:"id"}],n={alias:null,args:null,kind:"ScalarField",name:"status",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"useConvertStatusQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Convert",kind:"LinkedField",name:"convertByUuid",plural:!1,selections:[n],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"useConvertStatusQuery",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:a,concreteType:"Convert",kind:"LinkedField",name:"convertByUuid",plural:!1,selections:[n,l],storageKey:null},l],storageKey:null}]},params:{id:"537977fde781bca5b8e9895c5bcf7b1c361944c7fea9126f72d880f6305e231a",metadata:{},name:"useConvertStatusQuery",operationKind:"query",text:null}}}();Wa.hash="9798b3b4ae0ec8622af3bc5356d487e5";const za=Wa;var Ga=n(1465),Ja=n(3579),$a=n(155);function Ya(e){const[a,n]=(0,k.useState)(),l=(0,Ga.Z)(),t=(0,$a.Z)(),r=(0,Ja.Z)(),s=(0,k.useCallback)((()=>{l({maxPollAttempts:6,resource:async()=>t(za,{id:e}),onResponse:e=>{const a=e.viewer.convertByUuid?.status;switch(a){case"COMPLETED":return{type:"Result",result:"completed"};case"CANCELED":return{type:"Result",result:"canceled"};default:return{type:"ContinuePolling"}}},onComplete:e=>{if(r())switch(e.type){case"Success":n(e.result);break;case"MaxRetries":n("created");break;default:n("canceled")}}})}),[t,r,l,e]);return(0,k.useEffect)((()=>{s()}),[]),(0,k.useMemo)((()=>a),[a])}function Xa({queryRef:e,closeModal:a,footer:n,transferType:l,recurringPeriod:t}){const r=(0,b.Jc)(Za,e),s=(0,X.Z)(),i=(0,Ua.k6)(),u=(0,Qa.Z)(),{goToStep:o}=(0,E.tC)(J.Ex),{tradeComplete:c,eventContext:d,commitResponse:m}=(0,L.jf)(J.cr),{isCryptoOnlyTrader:g}=(0,_e.Z)(),p=(0,$.Z)({transferType:l}),{sourceAsset:y,targetAccount:f}=(0,T.E)(),S=m.value;da()(S,"Commit data should be defined");const F=Ya(S.uuid),{displayInputAmount:v,inputAmount:h,outputAmount:C}=S,{endTradePerfMark:A}=(0,je.Z)(),K=(0,Se.$T)();(0,k.useEffect)((()=>{A("status","convert")}),[]);const x=(0,k.useCallback)((e=>{c.onChange(!0),"success"===e&&u()}),[c,u]),w=(0,k.useCallback)((()=>{a&&a()}),[a]),B=(0,k.useCallback)((()=>{s&&"assetPage"===d.value?i.push((0,Ha.pW)(y.slug)):l&&a?a():o("entry")}),[s,d.value,i,y.slug,l,a,o]),I=(0,k.useCallback)((()=>{(0,me.$Y)("loaded_convert_order_confirmation_temp_eitri_exp")}),[]),P=(0,k.useMemo)((()=>({type:g?"trade":"convert",sourceAmount:K({amount:h,isFiat:!1}),sourceCurrency:h.currency,sourceAmountInFiat:K({amount:v,isFiat:!0}),targetAmount:K({amount:C,isFiat:!1}),targetCurrency:C.currency,status:F,accountId:f.uuid})),[v,K,h,g,C,F,f.uuid]),M=(0,k.useCallback)((()=>o("entry")),[o]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(R._,{tradeData:P,buySellProxy:l,onRetry:M,onViewTransaction:w,onClose:B,trackEvent:p,onAnimationEnd:x,onViewedStatus:I,footer:n,queryRef:r,recurringPeriod:t}),(0,z.jsx)(qa.Z,{tradeType:"swap",assetId:f.assetOrFiatCurrency?.asset?.uuid,assetSymbol:f.assetOrFiatCurrency?.asset?.platformName})]})}const en=(0,k.memo)(Xa),an={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"StatusStepConvertFragment",selections:[{args:null,kind:"FragmentSpread",name:"StatusStepDeprecatedFragment"},{args:null,kind:"FragmentSpread",name:"useFirstStakeIncentiveEligibleFragment"}],type:"Query",abstractKey:null,hash:"bb426dda1e8be0c89a25f99580cf4e84"},nn=an;var ln=n(533);function tn({closeModal:e,footer:a,queryRef:n,transferType:l,recurringPeriod:t}){const r=(0,b.Jc)(nn,n),s=(0,X.Z)(),i=(0,Ua.k6)(),u=(0,Qa.Z)(),{goToStep:o}=(0,E.tC)(J.Ex),{tradeComplete:c,eventContext:d,commitResponse:m}=(0,L.jf)(J.cr),{isCryptoOnlyTrader:g}=(0,_e.Z)(),p=(0,$.Z)({transferType:l}),{sourceAsset:y,targetAccount:f}=(0,T.E)(),S=m.value;da()(S,"Commit data should be defined");const F=Ya(S.uuid),{displayInputAmount:v,inputAmount:h,outputAmount:C}=S,{endTradePerfMark:A}=(0,je.Z)(),K=(0,Se.$T)(),x="buy"===l,w=(0,ln.p)({queryRef:r,assetCode:m.value?.outputAmount.currency??"",transferType:l,status:F})&&x;(0,k.useEffect)((()=>{A("status","convert")}),[]);const B=(0,k.useCallback)((e=>{c.onChange(!0),"success"===e&&u()}),[c,u]),I=(0,k.useCallback)((()=>{e&&e()}),[e]),P=(0,k.useCallback)((()=>{s&&"assetPage"===d.value?i.push((0,Ha.pW)(y.slug)):x&&e?e():o("entry")}),[s,d.value,i,y.slug,o,x,e]);(0,Re.e)("COMPLETE_ASSET_BUY","swap",{uuid:f.assetOrFiatCurrency?.asset?.uuid,symbol:f.assetOrFiatCurrency?.asset?.platformName});const M=(0,k.useCallback)((()=>{l?(0,me.$Y)(`loaded_${l}_order_confirmation_usdc`):(0,me.$Y)("loaded_convert_order_confirmation")}),[l]);return(0,z.jsx)(R.kU,{tradeData:{type:g?"trade":"convert",sourceAmount:K({amount:h,isFiat:!1}),sourceCurrency:h.currency,sourceAmountInFiat:K({amount:v,isFiat:!0}),targetAmount:K({amount:C,isFiat:!1}),targetCurrency:C.currency,status:F,accountId:f.uuid},buySellProxy:l,onRetry:()=>o("entry"),onViewTransaction:I,onClose:P,trackEvent:p,onAnimationEnd:B,onViewedStatus:M,footer:a,isFirstStakeIncentiveEligible:w,queryRef:r,recurringPeriod:t,"data-element":"SharedStatusStep","data-component":"StatusStep"})}const rn=(0,k.memo)(tn);var sn=n(95),un=n(1614);const on=(0,Fe.vU)({tdsTitle:{id:"ConvertTaxInfo.tdsTitle",defaultMessage:"About TDS"},tdsContent:{id:"ConvertTaxInfo.tdsContent",defaultMessage:"The government of India mandates you pay TDS (tax deducted at source) on all conversions and sales of crypto."},learnMore:{id:"ConvertTaxInfo.learnMore",defaultMessage:"Learn more"},gstTitle:{id:"ConvertTaxInfo.gstTitle",defaultMessage:"About GST"},auGstContent:{id:"ConvertTaxInfo.auGstContent",defaultMessage:"The government of Australia mandates a 10% GST (Goods & Services Tax) on all transfers and sales of crypto."},sgGstContent:{id:"ConvertTaxInfo.sgGstContent",defaultMessage:"The government of Singapore mandates a GST (Goods and Services Tax) on crypto transactions."}});function cn({taxType:e}){const{goBack:a}=(0,E.tC)(J.Ex),{formatMessage:n}=(0,ue.Z)(),l=(0,k.useMemo)((()=>{switch(e){case"INDIA_WITHHOLDING":return{title:n(on.tdsTitle),content:n(on.tdsContent),helpUrl:un.gJ};case"AUSTRALIA_GST":return{title:n(on.gstTitle),content:n(on.auGstContent),helpUrl:un.B7};case"SINGAPORE_GST":return{title:n(on.gstTitle),content:n(on.sgGstContent),helpUrl:un.VT};default:return{}}}),[n,e]);return e?(0,z.jsx)(Qe.Z,{onBackPress:a,headerTitle:(0,z.jsx)(dn,{goBack:a,title:l?.title}),message:(0,z.jsxs)(sn.TextBody,{as:"p",color:"foregroundMuted",overflow:"clip",children:[l?.content,"\n"]}),ctaUrl:l.helpUrl,ctaText:n(on.learnMore),"data-element":"InfoStep","data-component":"TaxInfoStep"},"taxInfo"):null}const dn=(0,B.ZP)(R.h4).withConfig({displayName:"TaxInfoStep__StyledHeader",componentId:"sc-10vzkn3-0"})(["h3{text-align:center;}"]),mn=(0,k.memo)(cn);function gn({queryRef:e,viewerAssetRefs:a,allowedPaymentMethods:n,isVisible:l=!0,closeModal:t=f.noop,buySellProxy:r,entryPoint:s,eventContext:i}){const u=(0,q.T)(),{setSelectedCryptoId:o}=(0,D.D)(),{amount:c,sourceAssetId:d,targetAssetId:m,tradeComplete:g,acceptDisclosureForAllExperimentalAssets:p,recurringPeriod:y,quoteResponse:S,orderType:F}=(0,L.jf)(J.cr),v=(0,b.Jc)(w,e),h=(0,b.Jc)(K,a),{sourceViewerAsset:C,targetViewerAsset:A}=(0,Y.Z)({sourceId:d.value,targetId:m.value,convertibleAssets:h}),x=(0,P.v)(v),{goToStep:B,currentStep:Q,goBack:H,replaceStep:W}=(0,E.tC)(J.Ex),ne=function(){const{currentStep:e}=(0,ae.Z)(!0),a=(0,ee.RA)(),n=(0,X.Z)();return(0,k.useMemo)((()=>!["entry"].includes(e)&&!a&&!n),[e,n,a])}(),le=(0,$.Z)({transferType:r}),[te,re]=(0,k.useState)(""),se=(0,k.useCallback)((()=>{B("entry")}),[B]),ie=(0,k.useMemo)((()=>"modal"===i||"convertModal"===i),[i]);(0,k.useEffect)((()=>{l&&le("viewed",{autoDisplayed:!ie})}),[l]);const ue=(0,k.useCallback)((()=>{"status"!==Q?se():g.value&&(c.onChange(""),se())}),[c,Q,se,g.value]),oe=(0,k.useCallback)((e=>{p.onChange(e),W("preview")}),[W,p]),ce=(0,k.useCallback)((e=>{re(e),B("taxInfo")}),[B]),de=e=>{r&&e&&o(e),se()},{sourceAccount:me,targetAccount:ge}=(0,T.E)(),pe=(0,z.jsx)(G,{account:"buy"===r?ge:me,assetOrCurrencyRef:"buy"===r?A:C}),ye=(0,k.useMemo)((()=>r?(0,Z.l)({entryPoint:s,type:r}):void 0),[r,s]);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(pn,{showOverlay:ne,children:(0,z.jsxs)(J.Ex.Steps,{children:[(0,z.jsx)(R.zA,{children:r?(0,z.jsx)(_.Z,{queryRef:v,sourceViewerAssetRef:C,targetViewerAssetRef:A,transferType:r,closeModal:t}):(0,z.jsx)(qe,{sourceViewerAssetRef:C,targetViewerAssetRef:A,closeModal:t,queryRef:v})},"entry"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(N.Z,{recurringPeriod:y,onBack:H,variant:ye,onDone:se,orderType:F})},"proxyRecurringSelect"),(0,z.jsx)(R.zA,{children:"buy"===r?(0,z.jsx)(O.Z,{transferType:"buy",paymentMethods:n,selectedAssetId:m.value,queryRef:v,trackEvent:le,onBack:H,children:e=>(0,z.jsx)(U.Z,{...e})}):(0,z.jsx)(_a,{viewerAssetRefs:h,excludedAssetIds:["sell"===r?V.Rm:""],onAssetSelect:de})},"selectSource"),(0,z.jsx)(R.zA,{children:"sell"===r?(0,z.jsx)(O.Z,{transferType:"sell",paymentMethods:n,selectedAssetId:d.value,queryRef:v,trackEvent:le,onBack:H,children:e=>(0,z.jsx)(U.Z,{...e})}):(0,z.jsx)(Na,{viewerAssetRefs:h,onAssetSelect:de})},"selectTarget"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(Ia,{handleTaxInfoClicked:ce,footer:pe,transferType:r,queryRef:v})},"preview"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(M.ZP,{onBack:H,assetId:m.value,onContinue:oe})},"experimentalAssetConfirmation"),(0,z.jsx)(R.zA,{children:u?(0,z.jsx)(en,{queryRef:v,transferType:r,closeModal:t,footer:pe,recurringPeriod:y.value}):(0,z.jsx)(rn,{closeModal:t,footer:pe,queryRef:v,transferType:r,recurringPeriod:y.value})},"status"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(Ye,{transferType:r,cb1TradeBenefitData:x})},"feesInfo"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(j.Z,{viewerAssetRef:A,spreadPercentage:S.value?.convert.spreadPercentage,onBack:H})},"priceInfo"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(Ye,{cb1TradeBenefitData:x,spreadPercentage:S.value?.convert.spreadPercentage})},"exchangeInfo"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(mn,{taxType:te})},"taxInfo"),(0,z.jsx)(R.zA,{children:(0,z.jsx)(ia,{})},"orderTypeSelect")]})}),(0,z.jsx)(I.Z,{show:ne,onClick:ue})]})}const pn=B.ZP.div.withConfig({displayName:"ConvertStepper__Container",componentId:"sc-2gq700-0"})(["display:flex;flex:1;z-index:",";transition:z-index ",";"],(e=>e.showOverlay?e.theme.zIndex.overlay:e.theme.zIndex.normal),(e=>e.showOverlay?"0ms":"0ms ease-out 1000ms")),yn=90;function kn(e){return(0,z.jsx)(S.Z,{"data-element":"BuySellBoundary","data-component":"Convert",children:(0,z.jsx)(fn,{...e,"data-element":"ConvertContent"})})}function fn({sourceAssetId:e,targetAssetId:a,eventContext:n="assetPage",queryRef:l,...t}){const r=(0,b.Jc)(y,l),{viewer:s}=r,{data:{viewer:i},loadNext:u,hasNext:c,isLoadingNext:d}=(0,b.nu)(g,r),{assetByUuid:m,assetBySymbol:p,assetBySlug:S,usdcViewerAsset:A,targetAssetBySlug:K}=s,x=(0,k.useMemo)((()=>(0,C.D)(s.tradeRestrictions||[])),[s.tradeRestrictions]),w=m||p||S,B=(0,k.useMemo)((()=>{const e=(0,C.D)(i.convertibleAssets.edges.map((({node:e})=>e))),a=!!w&&e.every((e=>e.asset.uuid!==w.asset.uuid)),n=!!K&&e.every((e=>e.asset.uuid!==K.asset.uuid)),l=A?[A]:[],t=l.map((e=>e?.asset.uuid));return[...e.filter((e=>!t.includes(e.asset.uuid))),...a?[w]:[],...l,...n?[K]:[]]}),[i.convertibleAssets.edges,w,K,A]),L=(0,b.Jc)(o,B),I=(0,k.useMemo)((()=>(0,f.orderBy)(L,(e=>Number(e.asset.marketCapV2)),["desc"])),[L]);(0,v.Z)({loadNext:u,hasNext:c,isLoadingNext:d},yn);const{isSubscribed:P}=(0,h.x)(r),{sourceViewerAsset:R,targetViewerAsset:M}=(0,Y.Z)({sourceId:e,targetId:a,convertibleAssets:I}),E=(0,k.useMemo)((()=>({...J.Sc,eventContext:n,sourceAssetId:R.asset.uuid,targetAssetId:M.asset.uuid})),[n,R,M]);return(0,z.jsx)(F.Z,{action:"trades",policyRestrictionRefs:x,"data-element":"PolicyRestrictionEnforcer","data-component":"ConvertContent",children:(0,z.jsx)(J.cr.Provider,{onSubmit:f.noop,initialValues:E,"data-element":"unknown",children:(0,z.jsx)(J.Ex.Provider,{"data-element":"unknown",children:(0,z.jsx)(T.Z,{isCoinbaseOneSubscriber:P&&"PAUSE_PLAN"!==s.coinbaseSubscription?.subscriptionPlan?.type,convertibleAssets:I,"data-element":"ConvertProvider",children:(0,z.jsx)(gn,{...t,queryRef:r,viewerAssetRefs:I,eventContext:n,"data-element":"ConvertStepper"})})})})})}},220:(e,a,n)=>{n.d(a,{E:()=>c,Z:()=>o});var l=n(0),t=n(8),r=n.n(t),s=n(110),i=n(2);const u=(0,l.createContext)({sourceAsset:{},targetAsset:{},sourceAccount:{},targetAccount:{},convertibleAssets:[],isCoinbaseOneSubscriber:!1});function o({children:e,convertibleAssets:a,isCoinbaseOneSubscriber:n,sourceAssetIdV2:t,targetAssetIdV2:o}){const{sourceAssetId:c,targetAssetId:d}=(0,s.Z)(!0),m=t??c.value,g=o??d.value,p=(0,l.useMemo)((()=>a.find((({asset:e})=>e.uuid===m))),[a,m]);r()(p,"There should always be a source asset");const y=(0,l.useMemo)((()=>a.find((({asset:e})=>e.uuid===g))),[a,g]);r()(y,"There should always be a target asset"),r()(m!==g,"Source and target assets should be different");const k=(0,l.useMemo)((()=>p.accounts?.find((e=>e?.primary))),[p.accounts]);r()(k,"There should always be a source account");const f=(0,l.useMemo)((()=>y.accounts?.find((e=>e?.primary))),[y.accounts]);r()(f,"There should always be a target account");const b=(0,l.useMemo)((()=>({sourceAsset:p.asset,targetAsset:y.asset,sourceAccount:k,targetAccount:f,convertibleAssets:a,isCoinbaseOneSubscriber:n})),[p.asset,y.asset,k,f,a,n]);return(0,i.jsx)(u.Provider,{value:b,"data-element":"unknown","data-component":"ConvertProvider",children:e})}function c(){return(0,l.useContext)(u)}},1616:(e,a,n)=>{n.d(a,{Z:()=>d});var l=n(0),t=n(53),r=n(1304),s=n(140),i=n(73),u=n(158),o=n(811),c=n(2);const d=(0,l.memo)((function({onGoToFeesInfoStep:e,...a}){const{goToStep:n}=(0,i.tC)(u.Ex),{previewFeeDisclosure:d,showCbOneBannerOnInfoStep:m}=(0,t.jf)(u.cr),g=(0,o.Z)(),p=(0,l.useCallback)((e=>{g(e,{content:"coinbase_fees"})}),[g]),y=(0,l.useCallback)(((a,l)=>{p(s.N[a?.name??""]),a?.disclosure&&d.onChange(a.disclosure),m.onChange(l),e?.(),n("feesInfo")}),[n,e,d,m,p]);return(0,c.jsx)(r.Z,{...a,onGoToFeesInfoStep:y})}))},158:(e,a,n)=>{n.d(a,{Ex:()=>t,Sc:()=>r,cr:()=>s});var l=n(53);const t=(0,n(73).vj)({steps:["entry","proxyRecurringSelect","selectSource","selectTarget","feeDetails","additionalInfo","preview","status","feesInfo","priceInfo","exchangeInfo","taxInfo","experimentalAssetConfirmation","orderTypeSelect"],defaultStep:"entry"}),r={amount:"",isFiatInput:!0,recurringPeriod:"never",eventContext:"assetPage",sourceAssetId:"",targetAssetId:"",quoteResponse:void 0,commitResponse:void 0,tradeComplete:!1,quoteResponseInputAmount:void 0,acceptDisclosureForAllExperimentalAssets:!1,orderType:"MARKET",previewFeeDisclosure:null,showCbOneBannerOnInfoStep:!1},s=(0,l.Np)({initialValues:r})},811:(e,a,n)=>{n.d(a,{Z:()=>c});var l=n(0),t=n(33),r=n(53),s=n(7),i=n(220),u=n(158);n(2418);const o="convert";function c(e){const{eventContext:a}=(0,r.jf)(u.cr),{sourceAsset:n,targetAsset:c}=(0,i.E)(),d=(0,l.useMemo)((()=>({source:n.platformName,target:c.platformName,context:a.value})),[a.value,n.platformName,c.platformName]),{transferType:m}=e||{},g={currencyType:"fiat",context:a.value,sourceCurrencyCode:n.platformName||"",targetCurrencyCode:c.platformName||""},p=m||o,y=m?g:d;return(0,l.useCallback)(((e,a={})=>{const n=(0,t.snakeCase)(`${p}_${e}`);(0,s.Kz)(n,{componentType:s.re.button,action:s.Us.click,...y,...a}),(0,s.HR)({metricName:n,metricType:s.t0.count,value:1})}),[p,y])}},1393:(e,a,n)=>{n.d(a,{B:()=>t});var l=n(29);const t=()=>(0,l.y)("kill_simple_trade_swap_web")},955:(e,a,n)=>{n.d(a,{Z:()=>i});var l=n(0),t=n(8),r=n.n(t),s=n(15);function i({sourceId:e,targetId:a,convertibleAssets:n}){const t=(0,l.useMemo)((()=>{const a=n.find((({asset:a})=>e&&a.uuid===e));return a||((0,s.cB)(new Error("Invalid source asset id"),{owner:"trading",context:"convert",assetId:e}),n[0])}),[e,n]),i=(0,l.useMemo)((()=>{const e=n.filter((({asset:e})=>e.uuid!==t.asset.uuid));if(a){const n=e.find((({asset:e})=>a&&e.uuid===a));if(n)return n;(0,s.cB)(new Error("Invalid target asset id"),{owner:"trading",context:"convert",assetId:a})}return e[0]}),[n,a,t]);return r()(t&&i,"Source and target assets should be defined"),(0,l.useMemo)((()=>({sourceViewerAsset:t,targetViewerAsset:i})),[t,i])}},1555:(e,a,n)=>{n.d(a,{Z:()=>g});var l=n(0),t=n(9),r=n(53),s=n(15),i=n(549),u=n(158),o=n(73),c=n(523),d=n(220),m=n(750);function g(){const[e,a]=(0,l.useState)(null),{goToStep:n,currentStep:g}=(0,o.tC)(u.Ex),{amount:p,quoteResponse:y,quoteResponseInputAmount:k}=(0,r.jf)(u.cr),{sourceAsset:f,targetAsset:b}=(0,d.E)(),{formatMessage:S}=(0,t.Z)(),F=(0,i.wr)({assetId:b.uuid,isExperimental:b.experimental}),[v,h]=(0,m.Z)(),C=(0,l.useCallback)((({variables:e})=>{f.uuid===b.uuid?p.onErrors([S(c.s.sameSourceAndTargetError)]):v({variables:{input:{amount:e.amount??{currency:"",value:""},sourceAssetUuid:f.uuid,targetAssetUuid:b.uuid,recurringPeriod:e.recurringPeriod}},onCompleted:({response:l})=>{const t=l.createConvertV2;switch(t?.__typename){case"GenericError":case"CreateConvertV2BadRequestError":return p.onErrors([t.message]);case"CreateConvertSuccess":return k.onChange(e.amount),y.onChange(t),a(t),void("preview"!==g&&n(F?"experimentalAssetConfirmation":"preview"));default:(0,s.cB)(new Error(`${t?.__typename} __typename received`),{owner:"trading",context:"convert"})}},onError:()=>{p.onErrors([S(c.s.genericError)])}})}),[v,f.uuid,b.uuid,p,k,y,g,n,F,S]);return(0,l.useMemo)((()=>({submitQuote:C,isSubmitting:h,newTransfer:e})),[C,h,e])}},1615:(e,a,n)=>{n.d(a,{Z:()=>c});var l=n(0),t=n(9),r=n(53),s=n(378),i=n(1503),u=n(158),o=n(750);function c(e){const{amount:a}=(0,r.jf)(u.cr),{formatMessage:n}=(0,t.Z)(),c=(0,o.Z)(),d=(0,l.useCallback)((({createConvertV2:a})=>{const l=a;if(!l||"GenericError"===l.__typename){if(!l||"UPSTREAM_GENERIC_ERROR"===l?.code){return{error:{message:n(s.s.genericErrorMessage)}}}return{error:{message:l.message}}}if("CreateConvertV2BadRequestError"===l.__typename)return{error:{message:l.message}};if(e?.buySellProxy&&"CreateConvertSuccess"===l.__typename){const a="buy"===e?.buySellProxy,n=l.convert;return{quoteAmounts:{fiatAmount:n.displayInputAmount.value,cryptoAmount:a?n.outputAmount.value:n.inputAmount.value}}}return{}}),[n,e?.buySellProxy]);return(0,i.Z)({mutationHandler:c,parseResponse:d,onError:(0,l.useCallback)((e=>{a.onErrors([e.message])}),[a])})}},750:(e,a,n)=>{n.d(a,{Z:()=>N});const l={fragment:{argumentDefinitions:t=[{defaultValue:null,kind:"LocalArgument",name:"input"}],kind:"Fragment",metadata:null,name:"useCreateConvertMutation",selections:[{alias:null,args:r=[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"createConvertV2",plural:!1,selections:[s={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Convert",kind:"LinkedField",name:"convert",plural:!1,selections:[i={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"spreadPercentage",storageKey:null},d={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"displayInputAmount",plural:!1,selections:c=[o={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},m={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"inputAmount",plural:!1,selections:c,storageKey:null},g={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"outputAmount",plural:!1,selections:c,storageKey:null},p={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"exchangeRate",plural:!1,selections:c,storageKey:null},y={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"fee",plural:!1,selections:c,storageKey:null},F={alias:null,args:null,concreteType:"FeeDetails",kind:"LinkedField",name:"fees",plural:!0,selections:[k={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},f={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"amount",plural:!1,selections:c,storageKey:null},{alias:null,args:null,concreteType:"Disclosure",kind:"LinkedField",name:"disclosure",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"title",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[b={alias:null,args:null,kind:"ScalarField",name:"text",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"url",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"WaivedDetails",kind:"LinkedField",name:"waivedDetails",plural:!1,selections:[f,{alias:null,args:null,kind:"ScalarField",name:"source",storageKey:null}],storageKey:null}],storageKey:null},v={alias:null,args:null,concreteType:"TaxDetails",kind:"LinkedField",name:"taxDetails",plural:!0,selections:[k,f],storageKey:null},h={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"total",plural:!1,selections:c,storageKey:null},C={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"subtotal",plural:!1,selections:c,storageKey:null},A={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"sourceToTarget",plural:!1,selections:T=[f],storageKey:null},K={alias:null,args:null,concreteType:"UnitPrice",kind:"LinkedField",name:"targetToSource",plural:!1,selections:T,storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"recurringPeriod",storageKey:null},{kind:"InlineDataFragmentSpread",name:"simpleTradeBenefit_convert",selections:[y,w={alias:null,args:null,kind:"ScalarField",name:"appliedSubscriptionBenefit",storageKey:null},B={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"feeWithoutSubscriptionBenefit",plural:!1,selections:c,storageKey:null},L={alias:null,args:null,concreteType:"SubscriptionInfo",kind:"LinkedField",name:"subscriptionInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"hasBenefitCap",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"freeTradingResetDate",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"remainingFreeTradingVolume",plural:!1,selections:[o],storageKey:null}],storageKey:null}],args:null,argumentDefinitions:[]}],storageKey:null},M={alias:null,args:null,concreteType:"TransferUserWarning",kind:"LinkedField",name:"userWarnings",plural:!0,selections:[I={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},P={alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},R={alias:null,args:null,concreteType:"Link",kind:"LinkedField",name:"link",plural:!1,selections:[S,b],storageKey:null}],storageKey:null}],type:"CreateConvertSuccess",abstractKey:null},_={kind:"InlineFragment",selections:[P,E={alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],type:"GenericError",abstractKey:null},V={kind:"InlineFragment",selections:[P,E,R],type:"CreateConvertV2BadRequestError",abstractKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:t,kind:"Operation",name:"useCreateConvertMutation",selections:[{alias:null,args:r,concreteType:null,kind:"LinkedField",name:"createConvertV2",plural:!1,selections:[s,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Convert",kind:"LinkedField",name:"convert",plural:!1,selections:[i,u,d,m,g,p,y,F,v,h,C,A,K,x,w,B,L,I],storageKey:null},M],type:"CreateConvertSuccess",abstractKey:null},_,V],storageKey:null}]},params:{id:"e4ea1b2ddd4e100e8c670078338b07a6dc2a38bbbd00d062706cd33fb76fe614",metadata:{},name:"useCreateConvertMutation",operationKind:"mutation",text:null}};var t,r,s,i,u,o,c,d,m,g,p,y,k,f,b,S,F,v,h,C,T,A,K,x,w,B,L,I,P,R,M,E,_,V;l.hash="588aa85960945998bf2db855bf2881f0";const D=l;var j=n(3);function N(){return(0,j.Db)(D)}},1617:(e,a,n)=>{n.d(a,{Z:()=>w});const l={fragment:{argumentDefinitions:t=[{defaultValue:null,kind:"LocalArgument",name:"input"}],kind:"Fragment",metadata:null,name:"useConvertCommitterMutation",selections:[{alias:null,args:r=[{kind:"Variable",name:"input",variableName:"input"}],concreteType:null,kind:"LinkedField",name:"commitConvert",plural:!1,selections:[s={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Convert",kind:"LinkedField",name:"convert",plural:!1,selections:[i={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},o={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"inputAmount",plural:!1,selections:u=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},c={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"displayInputAmount",plural:!1,selections:u,storageKey:null},d={alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"outputAmount",plural:!1,selections:u,storageKey:null}],storageKey:null}],type:"CommitConvertSuccess",abstractKey:null},m={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null}],type:"GenericError",abstractKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:t,kind:"Operation",name:"useConvertCommitterMutation",selections:[{alias:null,args:r,concreteType:null,kind:"LinkedField",name:"commitConvert",plural:!1,selections:[s,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Convert",kind:"LinkedField",name:"convert",plural:!1,selections:[i,o,c,d,{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}],type:"CommitConvertSuccess",abstractKey:null},m],storageKey:null}]},params:{id:"3270e507d33e3b77ff9ee2ebdffdbb2a714d74cd28bc67f5aeba7656393a5059",metadata:{},name:"useConvertCommitterMutation",operationKind:"mutation",text:null}};var t,r,s,i,u,o,c,d,m;l.hash="3b4130e3d059b0891186e93f3b4931a8";const g=l;var p=n(0),y=n(8),k=n.n(y),f=n(9),b=n(53),S=n(840),F=n(15),v=n(3),h=n(378),C=n(73),T=n(2410),A=n(124),K=n(220),x=n(158);function w(){const{quoteResponse:e,commitResponse:a}=(0,b.jf)(x.cr),{goToStep:n}=(0,C.tC)(x.Ex),{showErrorToast:l}=(0,A.Z)(),{formatMessage:t}=(0,f.Z)(),{logSardineAnalyticsEvent:r}=(0,S.g)(),{sourceAccount:s,targetAccount:i}=(0,K.E)(),u=(0,T.K)(),[o,c]=(0,v.Db)(g),d=(0,p.useCallback)((()=>{const c=e.value?.convert?.uuid;k()(c,"There should be a quote id to commit`"),o({variables:{input:{convertUuid:c}},updater:e=>{u||(e.get(s?.id??"")?.invalidateRecord(),e.get(i?.id??"")?.invalidateRecord())},onCompleted:({response:e})=>{const s=e.commitConvert;switch(s?.__typename){case"CommitConvertSuccess":return r("c2c"),a.onChange(s.convert),n("status");case"GenericError":{let e=s.message;return"UPSTREAM_GENERIC_ERROR"===s.code&&(e=t(h.s.genericErrorMessage)),l(e)}default:(0,F.cB)(new Error("Unexpected typename returned"),{owner:"trading",context:"convert",typename:s?.__typename})}},onError:({alreadyReportedError:e})=>{(0,F.cB)((0,F.Xv)(e),{owner:"trading",context:"convert"}),l(t(h.s.commitError))}})}),[o,a,t,n,r,e.value?.convert?.uuid,l,u,s?.id,i?.id]);return(0,p.useMemo)((()=>({commitConvert:d,isCommitting:c})),[d,c])}},287:(e,a,n)=>{n.d(a,{Ex:()=>r,Sc:()=>s,cr:()=>i});var l=n(53),t=n(946);const r=(0,n(73).vj)({steps:["entry","recurringSelect","feesInfo","taxInfo","experimentalAssetConfirmation","orderTypeSelect","buyPreview","buyStatus","confirmBuy","buyPresetAmounts","buyDisclosures","buyWaitTimer","sellPreview","sellStatus","convertPreview","convertStatus","exchangeInfo","additionalInfo","feeDetails","selectTarget","selectSource","preview","status","limitOrderEntry","limitOrderPreview","limitOrderDeposit","limitOrderConfirmation","freeTradePromoCodeInfo","paymentError","wbl","selectAsset","selectPayment","recurringRewardTerms","plaidRelink","paymentMethodInfo","priceInfo","unstakingInfo","confirm3ds","openBankingQrcode","obRiskFailure","processingPayout","coinbaseOneSignup","coinbaseOneChangePlan"],defaultStep:"entry"}),s={orderType:"MARKET",amount:"",activePaymentMethodId:void 0,recurringPeriod:"never",isFiatInput:!0,tradeComplete:!1,showPresetAmountsIfAvailable:!1,eventContext:"assetPage",transferType:"buy",assetId:"",sourceAssetId:"",targetAssetId:"",freeTradePromoCode:"",shouldBuyAndStake:!1,buyQuoteResponse:void 0,sellQuoteResponse:void 0,buyCommitResponse:void 0,sellCommitResponse:void 0,cardStatus:void 0,buyInputParams:void 0,sellInputParams:void 0,acceptDisclosureForAllExperimentalAssets:!1,buyWaitTimerResponse:void 0,quoteResponse:void 0,commitResponse:void 0,quoteResponseInputAmount:void 0,openBankingRedirectUrl:"",activeAccountUuid:"",previewFeeDisclosure:null,showCbOneBannerOnInfoStep:!1,...t.z},i=(0,l.Np)({initialValues:s})},3695:(e,a,n)=>{n.d(a,{Z:()=>f});var l=n(280);const t=(i=[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],{argumentDefinitions:[{kind:"RootArgument",name:"nativeCurrency"}],kind:"Fragment",metadata:null,name:"AssetSelectorCellFragment",selections:[r={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:s=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:s,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null},{alias:null,args:null,fragment:{args:null,kind:"FragmentSpread",name:"AssetIsStablecoinFragment"},kind:"RelayResolver",name:"isStablecoin",resolverModule:l.W,path:"assetOrFiatCurrency.asset.isStablecoin"},{alias:null,args:i,kind:"ScalarField",name:"unitPriceScaleV2",storageKey:null},{alias:null,args:i,concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},{alias:null,args:null,concreteType:"PercentChanges",kind:"LinkedField",name:"percentChanges",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"day",storageKey:null}],storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"AssetSelectRowFragment"}],storageKey:null}],type:"ViewerAsset",abstractKey:null}],storageKey:null}],type:"Account",abstractKey:null});var r,s,i;t.hash="7cb806248b92b40c89de62f00bebeda1";const u=t;var o=n(0),c=n(9),d=n(15),m=n(3),g=n(3607),p=n(9608),y=n(3638),k=n(2);const f=(0,o.memo)((function({accountRef:e,isActive:a,showBalance:n,onAssetSelect:l,testID:t}){const r=(0,m.Jc)(u,e),s="ViewerAsset"===r.assetOrFiatCurrency?.__typename?r.assetOrFiatCurrency:null,i=s?.asset,f=(0,d.$T)(),{percent:b,sign:S,variant:F}=(0,y.Z)(i?.latestQuoteV2?.percentChanges?.day??0),{formatMessage:v}=(0,c.Z)(),h=(0,o.useCallback)((()=>{i&&l(i.uuid)}),[i,l]);if(!i||!r)return null;const C=i?.displaySymbol??"",T=s.rewardApy?"· "+v(p.Z.earns,{annualPercentageYield:s.rewardApy?.formattedValue,label:s.rewardApy?.label}):"",A=f({amount:r.availableBalance,exponent:"ViewerAsset"===r?.assetOrFiatCurrency?.__typename?r.assetOrFiatCurrency.asset.exponent:0,isFiat:!1}),K=f({amount:r.availableBalanceInNativeCurrency,isFiat:!0}),x=f({amount:{value:i.latestQuoteV2?.price??"",currency:r.availableBalanceInNativeCurrency?.currency??""},exponent:i.unitPriceScaleV2??2,isFiat:!0}),w=i.isStablecoin?"":`${S}${b}`;return(0,k.jsx)(g.Z,{onSelect:h,isActive:a,title:i.name,showDetail:!0,detail:n?A:x,subdetail:n?K:w,displaySymbol:C,testID:t,yieldCopy:T,assetRef:i,variant:F})}))},3662:(e,a,n)=>{n.d(a,{J:()=>s});var l=n(0),t=n(152),r=n(2);const s=(0,l.memo)((function({children:e,onPress:a,isSelected:n,isDisabled:s}){const i=(0,l.useMemo)((()=>({spacingVertical:0,spacingHorizontal:0})),[]),u=(0,l.useMemo)((()=>({spacingVertical:0})),[]);return(0,r.jsx)(t.Cell,{maxHeight:96,onPress:a,selected:n,innerSpacing:i,alignItems:"center",outerSpacing:u,disabled:s,children:e})}))},3679:(e,a,n)=>{n.d(a,{t:()=>o});var l=n(0),t=n(1484),r=n(55),s=n(54),i=n(67),u=n(2);const o=(0,l.memo)((function({onPress:e,disabled:a=!1,testID:n="BaseSwapCurrenciesButton",accessibilityLabel:l="switch conversion direction",accessibilityHint:o="",swapAmount:c,swapCode:d,isSwapEnabled:m=!0,color:g,hideAmount:p=!1}){return(0,u.jsx)(i.Pressable,{onPress:e,backgroundColor:"transparent",testID:n,accessibilityLabel:l,accessibilityHint:o,disabled:a,children:(0,u.jsxs)(s.HStack,{gap:1,alignItems:"center",children:[m&&(0,u.jsx)(r.Icon,{color:"currentColor",name:"arrowsVertical",size:"xs",testID:"swap-icon"}),(0,u.jsx)(t.Z,{value:p?`${d}`:`${c} ${d}`,color:g})]})})}))},1309:(e,a,n)=>{n.d(a,{r:()=>o});var l=n(0),t=n(11),r=n(9),s=n(82),i=n(2);const u=(0,t.vU)({reviewOrder:{id:"InputSubmitButton.reviewOrder",defaultMessage:"Review order"}}),o=(0,l.memo)((function({label:e,handleSubmit:a,...n}){const{formatMessage:t}=(0,r.Z)(),o=(0,l.useCallback)((()=>{a()}),[a]);return(0,i.jsx)(s.Button,{...n,onPress:o,children:e??t(u.reviewOrder)})}))},1310:(e,a,n)=>{n.d(a,{$:()=>G});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SimpleTradeFixedAmountsAccountFragment",selections:[{args:null,kind:"FragmentSpread",name:"SellMaxAmountAccountFragment"}],type:"Account",abstractKey:null,hash:"0deed50dcbcf18e8d04632bbb46b68f1"},t=l,r={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SimpleTradeFixedAmountsFragment",selections:[{args:null,kind:"FragmentSpread",name:"BuyMaxAmountFragment"},{args:null,kind:"FragmentSpread",name:"SellMaxAmountFragment"}],type:"Query",abstractKey:null,hash:"03534aba2e2f92340a2904d57be5669c"},s=r;var i=n(0),u=n(3);const o={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"BuyMaxAmountFragment",selections:[{args:null,kind:"FragmentSpread",name:"MaxBuyButtonFragment"}],type:"Query",abstractKey:null,hash:"bcf0eb376afc977fe975e30019488a46"},c=o,d={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"MaxBuyButtonFragment",selections:[{args:null,kind:"FragmentSpread",name:"useMaxBuyAmountFragment"}],type:"Query",abstractKey:null,hash:"ea096663b892d817cda7e59cb6f37124"},m=d;var g=n(11),p=n(9),y=n(82),k=n(2);const f=(0,g.vU)({max:{id:"MaxAmount.max",defaultMessage:"Max"}}),b=(0,i.memo)((function({label:e,...a}){const{formatMessage:n}=(0,p.Z)();return(0,k.jsx)(y.Button,{...a,variant:"secondary",compact:!0,children:e??n(f.max)})})),S=(0,i.memo)((function({label:e}){const{formatMessage:a}=(0,p.Z)();return(0,k.jsx)(y.Button,{disabled:!0,variant:"secondary",compact:!0,testID:"max-amount-fallback",children:e??a(f.max)})})),F={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useMaxBuyAmountFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"usdcAccount",args:[{kind:"Literal",name:"uuid",value:"USDC"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:'accountByUuidV2(uuid:"USDC")'}],storageKey:null}],type:"Query",abstractKey:null,hash:"cadd79efd72f78f1537c9de6a8d14c69"},v=F;var h=n(215);const C=(0,i.memo)((({handleNumpadInput:e,isLoading:a,disabled:n,queryRef:l,target:t,label:r})=>{const s=function(e,a){const{viewer:n}=(0,u.Jc)(v,e);let l="0";if(a?.paymentMethod){const e=a?.paymentMethod.limits?.buy?a?.paymentMethod.limits?.buy[0]:null;l=e?.remaining.amount??"0"}else a?.assetId===h.Rm&&n?.usdcAccount&&(l=Number(n?.usdcAccount?.availableBalanceInNativeCurrency?.value??"0").toFixed(2));return String(l)}((0,u.Jc)(m,l),t),o=(0,i.useCallback)((()=>{e(s,!0)}),[e,s]);return(0,k.jsx)(b,{onPress:o,name:"PresetMaxAmountButton",loading:a,disabled:n,label:r})})),T=(0,i.memo)((function(e){return(0,k.jsx)(u.zq,{fallback:(0,k.jsx)(S,{}),instrumentationId:"MaxBuyButton",children:(0,k.jsx)(C,{...e})})})),A=(0,i.memo)((function({queryRef:e,setInputValue:a,disabled:n,target:l}){const t=(0,u.Jc)(c,e),r=(0,i.useCallback)((e=>{a(e)}),[a]);return(0,k.jsx)(T,{target:l,isLoading:!1,disabled:n??!1,handleNumpadInput:r,queryRef:t})})),K=(0,i.memo)((function(e){return(0,k.jsx)(u.zq,{fallback:null,instrumentationId:"BuyMaxAmount",children:(0,k.jsx)(A,{...e})})})),x={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellMaxAmountAccountFragment",selections:[{args:null,kind:"FragmentSpread",name:"MaxSellButtonAccountFragment"}],type:"Account",abstractKey:null,hash:"c7f3d410cf873c026aaab47d1ee44faa"},w=x,B={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SellMaxAmountFragment",selections:[{args:null,kind:"FragmentSpread",name:"MaxSellButtonFragment"}],type:"Query",abstractKey:null,hash:"8ce69e1a21e0cea038783cfc999082d3"},L=B,I={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"MaxSellButtonAccountFragment",selections:[{args:null,kind:"FragmentSpread",name:"useMaxSellAmountAccountFragment"}],type:"Account",abstractKey:null,hash:"1100c8b0019d5fa09655fb5a1cdd9a8c"},P=I,R={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"MaxSellButtonFragment",selections:[{args:null,kind:"FragmentSpread",name:"useMaxSellAmountFragment"}],type:"Query",abstractKey:null,hash:"5073966dbcec4bcc4790ceb19ac5c4e7"},M=R,E={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useMaxSellAmountAccountFragment",selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},_={alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},_],type:"TiersCurrency",abstractKey:null}],storageKey:null}],type:"Account",abstractKey:null};var _;E.hash="9424b44314421f0efee8ce1d7dea07e7";const V=E,D={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useMaxSellAmountFragment",selections:[{args:null,kind:"FragmentSpread",name:"useCurrencyConverterFragment"}],type:"Query",abstractKey:null,hash:"1c405367ed49714385f9c8d005467a5c"},j=D;var N=n(547),O=n(817);function Z(e,a){const{limits:n}=e;switch(a){case"buy":return n?.buy;case"sell":return n?.sell;case"deposit":return n?.deposit;default:return}}function U(e,a){const n=Z(e,a);return n&&function(e,a){const n=Z(e,a);return n&&n.length>0}(e,a)?parseFloat(n[0].remaining.amount):void 0}const q=(0,i.memo)((({handleMaxButtonPressed:e,isLoading:a,disabled:n,queryRef:l,accountRef:t,target:r,label:s})=>{const o=(0,u.Jc)(M,l),c=function({accountRef:e,paymentMethodId:a,queryRef:n}){const l=(0,u.Jc)(j,n),t=(0,u.Jc)(V,e),r=t.assetOrFiatCurrency?.asset?.platformName??t.assetOrFiatCurrency?.code??"",s=t.assetOrFiatCurrency?.exponent??t.assetOrFiatCurrency?.asset?.exponent??0,o=(0,O.Z)(a??"",{transferType:"sell"}),c=(0,N.u)({queryRef:l}),d=Number(t.availableBalance.value),m=(0,i.useCallback)((()=>{if(!o)return Number.POSITIVE_INFINITY;const e=U(o,"sell");return e?c({amount:e.toString(),currency:o.currency},r):Number.POSITIVE_INFINITY}),[r,c,o]);return(0,i.useCallback)((e=>{const a=Math.min(d,m());if(1===e&&d<=a)return t.availableBalance.value;const n=d*e;return Math.min(a,n).toFixed(s).toString()}),[t.availableBalance.value,s,m,d])}({accountRef:(0,u.Jc)(P,t),queryRef:o,paymentMethodId:r?.paymentMethod?.id}),d=c(1),m=(0,i.useCallback)((()=>{e(d,!0)}),[e,d]);return(0,k.jsx)(b,{onPress:m,name:"PresetMaxAmountButton",loading:a,disabled:n,label:s})})),Q=(0,i.memo)((function(e){return(0,k.jsx)(u.zq,{fallback:(0,k.jsx)(S,{}),instrumentationId:"MaxSellButton",children:(0,k.jsx)(q,{...e})})})),H=(0,i.memo)((function({queryRef:e,accountRef:a,setInputValue:n,setInputCurrency:l,disabled:t,target:r}){const s=(0,u.Jc)(L,e),o=(0,u.Jc)(w,a),c=(0,i.useCallback)((e=>{n(e),l(!1)}),[l,n]);return(0,k.jsx)(Q,{target:r,isLoading:!1,disabled:t??!1,handleMaxButtonPressed:c,queryRef:s,accountRef:o})})),W=(0,i.memo)((function(e){return(0,k.jsx)(u.zq,{fallback:null,instrumentationId:"SellMaxAmount",children:(0,k.jsx)(H,{...e})})})),z=(0,i.memo)((function({queryRef:e,accountRef:a,tradeTypeUI:n,target:l,...r}){const i=(0,u.Jc)(s,e),o=(0,u.Jc)(t,a);return"buy"===n?(0,k.jsx)(K,{...r,queryRef:i,target:l}):"sell"===n?(0,k.jsx)(W,{...r,queryRef:i,target:l,accountRef:o}):null})),G=(0,i.memo)((function(e){return(0,k.jsx)(u.zq,{fallback:null,instrumentationId:"SimpleTradeFixedAmounts",children:(0,k.jsx)(z,{...e})})}))},1316:(e,a,n)=>{n.d(a,{Z:()=>g});var l=n(0),t=n(9),r=n(162),s=n(14),i=n(812),u=n(1315),o=n(276),c=n(217),d=n(115),m=n(2);function g({paymentMethod:e,transferType:a,selected:n,onPress:g,onAddAccount:p}){const{showModal:y}=(0,d.Z)(),{formatMessage:k}=(0,t.Z)(),f=(0,o.Z)(),b=(0,c.Z)(),S=(0,l.useCallback)((()=>{f(),b(),p?.()}),[f,b,p]),F=(0,l.useMemo)((()=>e.rejected?(0,m.jsx)(s.TextBody,{as:"div",color:"negative",children:k(u.Z.blocked,{link:e=>[e?(0,m.jsx)(s.Link,{variant:"body",children:e}):null]})}):"wbl"===e.disableBuyReason?(0,m.jsx)(s.TextBody,{as:"div",color:"negative",children:k(u.Z.temporarilyDisabled)}):e.description),[k,e.description,e.disableBuyReason,e.rejected]),v=(0,l.useMemo)((()=>{const n=e.type.replace(/_/g,"-");return`${a}-select-${n}-${e.currency}`}),[e.currency,e.type,a]);return(0,m.jsx)(r.ContentCell,{as:"li",title:e.label,meta:e.conciseDescription,description:F,onPress:()=>{e.rejected&&y((0,m.jsx)(i.P,{reauthCardData:{last4:e.conciseDescription,paymentMethodId:e.id},onSuccess:S,entryPoint:"buy_sell_add_card_again"})),g?.(e.id)},selected:n,media:e.icon,testID:v,"data-testid":v,"data-element":"ContentCell","data-component":"PaymentMethodCell"})}},947:(e,a,n)=>{n.d(a,{D:()=>y});var l=n(0),t=n(11),r=n(9),s=n(35),i=n(19),u=n(337),o=n(95),c=n(489),d=n(177),m=n(65),g=n(2);const p=(0,t.vU)({priceHasChangedTitle:{id:"SignificantChangeConfirmationModal.verifyId",defaultMessage:"{asset} price has changed"},priceCanChangeDescription:{id:"SignificantChangeConfirmationModal.priceCanChangeDescription",defaultMessage:"The price of cryptocurrency changes frequently based on market conditions. The price quoted includes a spread that allows us to temporarily lock in your price while your order is processed. Learn more about spread <link>here</link>."},understand:{id:"SignificantChangeConfirmationModal.understand",defaultMessage:"I understand"},back:{id:"SignificantChangeConfirmationModal.back",defaultMessage:"Back"},buttonGroup:{id:"SignificantChangeConfirmationModal.buttonGroup",defaultMessage:"Modal actions"}});function y(e){return(0,g.jsx)(m.ZP,{width:.8*d.c6,style:{top:"25%"},shouldCloseOnOverlayClick:!1,"data-element":"Modal","data-component":"SignificantChangeConfirmationModal",children:(0,g.jsx)(k,{...e,"data-element":"SignificantChangeConfirmationModalContent"})})}function k({onBack:e,onConfirm:a,asset:n,displayInputCurrency:t}){const d=(0,m._x)(),{formatMessage:y}=(0,r.Z)(),k=(0,l.useCallback)((()=>{d(),e()}),[d,e]),f=(0,l.useCallback)((()=>{d(),a()}),[d,a]);return(0,g.jsxs)(i.Box,{width:"100%",flexDirection:"column",height:"100%",spacing:2,alignContent:"center",alignItems:"center","data-element":"Box","data-component":"SignificantChangeConfirmationModalContent",children:[(0,g.jsx)(c.TextTitle1,{as:"h3",spacingBottom:2,align:"center","data-element":"TextTitle1",children:y(p.priceHasChangedTitle,{asset:n,displayInputCurrency:t})}),(0,g.jsx)(o.TextBody,{as:"p",spacingBottom:2,align:"center","data-element":"TextBody",children:y(p.priceCanChangeDescription,{link:e=>[(0,g.jsx)(u.Link,{color:"primary",to:"https://help.coinbase.com/coinbase/trading-and-funding/pricing-and-fees/fees",children:e||""})]})}),(0,g.jsxs)(s.ButtonGroup,{accessibilityLabel:y(p.buttonGroup),"data-element":"ButtonGroup",children:[(0,g.jsx)(s.Button,{onPress:k,block:!0,variant:"secondary","data-element":"Button",children:y(p.back)}),(0,g.jsx)(s.Button,{onPress:f,block:!0,variant:"primary","data-element":"Button",children:y(p.understand)})]})]})}},747:(e,a,n)=>{n.d(a,{r:()=>F});var l=n(11),t=n(9),r=n(10),s=n(55),i=n(4),u=n(491),o=n(52),c=n(16),d=n(0),m=n(106),g=n(228),p=n(1330),y=n(341),k=n(19),f=n(2);function b({primaryLabel:e,secondaryLabel:a,image:n,icon:l,detail:t,subdetail:r,onPress:s,testID:i,hasError:u,disableSelection:o,disabled:c}){const b=(0,m.useScaleConditional)(g.mediaSize),S=(0,d.useMemo)((()=>n?(0,f.jsx)(p.CellMedia,{type:"asset",source:n}):l?(0,f.jsx)(k.Box,{width:b,height:b,spacingStart:.5,children:l}):void 0),[b,l,n]);return(0,f.jsx)(k.Box,{borderRadius:"rounded",borderColor:u?"negative":void 0,background:"background","data-element":"Box","data-component":"SelectorRow",children:(0,f.jsx)(y.ListCell,{title:e,description:a,detail:t,subdetail:r,testID:i,disabled:c,media:S,outerSpacing:{spacingHorizontal:0,spacingVertical:0},accessory:o?void 0:"arrow",onPress:o?void 0:s,priority:"end","data-element":"ListCell"})})}const S=(0,l.vU)({switcherWrapperLabel:{id:"EntrySelector.switcherWrapperLabel",defaultMessage:"Switch the active input"}});function F({row1:e,row2:a,onClickSwitcher:n,switcherIcon:l="arrowsVertical",transferType:r,isNewDesign:d}){const{formatMessage:m}=(0,t.Z)();return(0,f.jsxs)(o.VStack,{spacingVertical:2,"data-element":"VStack","data-component":"EntrySelector",children:[!d&&(0,f.jsx)(u.Divider,{offsetHorizontal:4}),(0,f.jsxs)(o.VStack,{spacingTop:1,position:"relative","data-element":"VStack",children:[(0,f.jsx)(b,{...e,"data-element":"SelectorRow"}),(0,f.jsx)(i.Box,{position:"relative",left:c.spacing[2],spacingVertical:1,width:"50%",borderedStart:!n,"data-element":"Box"}),(0,f.jsx)(b,{...a,"data-element":"SelectorRow"}),n&&(0,f.jsx)(v,{onClick:n,role:"button","aria-label":m(S.switcherWrapperLabel),"data-testid":r?`${r}-switch-active-input`:"switch-active-input",children:(0,f.jsx)(s.Icon,{name:l,size:"s",color:"foreground",spacingStart:1,spacing:.5})})]})]})}const v=r.ZP.div.withConfig({displayName:"EntrySelector__SwitcherWrapper",componentId:"d15ok1-0"})(["position:absolute;top:50%;transform:translateY(-50%);cursor:pointer;"])},3923:(e,a,n)=>{n.d(a,{$:()=>y});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"USDCEntrySelectorFragment",selections:[{args:null,kind:"FragmentSpread",name:"useGetFormattedCurrentFiatPriceOfOneAssetFragment"}],type:"Query",abstractKey:null,hash:"3c88665b83841fcf125e845865c379e4"},t=l;var r=n(0),s=n(9),i=n(285),u=n(15),o=n(3),c=n(188),d=n(220),m=n(746),g=n(747),p=n(2);function y({row1:e,row2:a,onClickSwitcher:n,switcherIcon:l="arrowsVertical",transferType:y,targetAssetDisplaySymbol:k,queryRef:f}){const b=(0,o.Jc)(t,f),S=(0,u.$T)(),{sourceAccount:F,targetAccount:v}=(0,d.E)(),{formatMessage:h}=(0,s.Z)(),C="buy"===y,T=(0,r.useMemo)((()=>{const e=S({amount:F.availableBalanceInNativeCurrency,isFiat:!0,exponent:(0,i.Z)(Number(F.availableBalanceInNativeCurrency?.value)||0)});return e===u.ob?"":e}),[S,F.availableBalanceInNativeCurrency]),A=(0,r.useMemo)((()=>{if(T&&T.trim())return h(c.s.available)}),[h,T]),K=(0,r.useMemo)((()=>({detail:T,subdetail:A})),[T,A]),x=(0,m.X)({assetDisplaySymbol:k,queryRef:b}),w=(0,r.useMemo)((()=>{if(x&&x.trim())return h(c.s.price)}),[x,h]),B=(0,r.useMemo)((()=>{const e=S({amount:v.availableBalanceInNativeCurrency,isFiat:!0,exponent:(0,i.Z)(Number(v.availableBalanceInNativeCurrency?.value)||0)});return e===u.ob?"":e}),[S,v.availableBalanceInNativeCurrency]),L=(0,r.useMemo)((()=>{if(B&&B.trim())return h(c.s.balance)}),[h,B]),I=(0,r.useMemo)((()=>C?{detail:x,subdetail:w}:{detail:B,subdetail:L}),[w,x,C,B,L]),P=(0,r.useMemo)((()=>({...e,...C?I:K})),[C,K,e,I]),R=(0,r.useMemo)((()=>({...a,...C?K:I})),[C,K,a,I]);return(0,p.jsx)(g.r,{row1:P,row2:R,onClickSwitcher:n,switcherIcon:l,transferType:y,"data-element":"EntrySelector","data-component":"USDCEntrySelector"})}},3581:(e,a,n)=>{n.d(a,{L4:()=>y,LZ:()=>F,jQ:()=>v,mG:()=>A,wc:()=>S,zA:()=>p});var l=n(0),t=n(10),r=n(48),s=n(1484),i=n(83),u=n(72),o=n(4),c=n(14),d=n(177),m=n(3635),g=n(2);const p=t.ZP.div.withConfig({displayName:"styles__StyledStep",componentId:"sc-171rpve-0"})(["display:flex;user-select:none;background-color:",";align-self:stretch;flex-direction:column;flex:1;justify-content:space-between;width:100%;border-radius:",";max-width:100%;@media not all and (","){min-height:","px;}"],(e=>e.theme.color.background),(e=>e.theme.border.borderRadius),i.Z.phone,d.gn),y=t.ZP.div.withConfig({displayName:"styles__ListInner",componentId:"sc-171rpve-1"})(["flex-direction:column;justify-content:flex-start;padding:0px 12px;flex:1 0 auto;svg{flex-shrink:0;}"]),k=({theme:e})=>`\n color: ${e.color.textAccent};\n background-color: ${e.color.backgroundHoverAlt};\n cursor: default;\n`,f=({theme:e})=>`\n color: ${e.color.textLight};\n cursor: pointer;\n &:hover {\n background-color: ${e.color.backgroundHoverAlt};\n }\n`,b=()=>"\n opacity: 0.5;\n pointer-events: none;\n",S=(0,t.ZP)(r.Z).attrs((({align:e="flex-start"})=>({align:e,justify:"flex-start"}))).withConfig({displayName:"styles__ListRow",componentId:"sc-171rpve-2"})(["position:relative;user-select:none;border-radius:",";padding:12px;transition:background-color 0.25s;min-height:80px;",";",";"],(e=>e.theme.border.borderRadius),(e=>e.active?k:f),(e=>e.disabled&&b)),F=t.ZP.div.withConfig({displayName:"styles__Spacer",componentId:"sc-171rpve-3"})(["height:",";"],(e=>e.theme.size[e.size]||`${(0,u.Z)(e.size)}px`)),v=(0,t.ZP)(o.Box).attrs((()=>({flexDirection:"column",spacingHorizontal:`${d.Tb}`,alignItems:"center"}))).withConfig({displayName:"styles__HorizontalPadding",componentId:"sc-171rpve-4"})([""]),h=({scale:e,spaceBottom:a,theme:n})=>`\n text-align: center;\n white-space: nowrap;\n margin-bottom: ${a?n.size.medium:0};\n transform: scale(${e});\n`,C=(0,t.ZP)(c.TextTitle3).attrs((()=>({as:"h3"}))).withConfig({displayName:"styles__TradeAmountLarge",componentId:"sc-171rpve-5"})(["font-size:40px;font-weight:400;color:",";",";"],(e=>e.theme.color.textAccent),h),T=(0,t.ZP)(c.TextTitle3).attrs((()=>({as:"h3"}))).withConfig({displayName:"styles__TradeAmountSmall",componentId:"sc-171rpve-6"})(["font-size:18px;font-weight:500;color:",";",";"],(e=>e.theme.color.textLight),h);function A({text:e,spaceBottom:a,size:n="large",useTicker:t=!1,accessibilityLabel:r}){const i=(0,m.Z)({text:e,size:n}),u=(0,l.useMemo)((()=>t?(0,g.jsx)(s.Z,{value:e,fontSize:"small"===n?"small":"super"}):e),[n,e,t]);return e?"small"===n?(0,g.jsx)(T,{"aria-label":r??e,scale:i,spaceBottom:a,children:u}):(0,g.jsx)(C,{"aria-label":r??e,scale:i,spaceBottom:a,children:u}):null}},746:(e,a,n)=>{n.d(a,{X:()=>d});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useGetFormattedCurrentFiatPriceOfOneAssetFragment",selections:[{args:null,kind:"FragmentSpread",name:"useCurrencyConverterFragment"}],type:"Query",abstractKey:null,hash:"3a210bc57e97ddb0700c297172a5a790"},t=l;var r=n(0),s=n(9),i=n(285),u=n(15),o=n(3),c=n(105);const d=({assetDisplaySymbol:e,fiatCode:a,queryRef:n})=>{const l=(0,o.Jc)(t,n),{formatNumber:d}=(0,s.Z)(),m=(0,c.Z)(),g=(0,u.uJ)({queryRef:l});return(0,r.useMemo)((()=>{const n=g({amount:"1",currency:e});return d(n,{style:"currency",currency:a??m,minimumFractionDigits:(0,i.Z)(n)})}),[e,g,a,d,m])}},787:(e,a,n)=>{n.d(a,{d:()=>t});var l=n(29);function t(){return!(0,l.y)("kill_simple_trade_fee_disclosure_web")}},1308:(e,a,n)=>{n.d(a,{x:()=>d});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useIsInputDisabledFragment",selections:[{alias:null,args:null,concreteType:"SupportedContextsV2",kind:"LinkedField",name:"supportedContextsV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTradable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isConvertible",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"ff27e00b3cc1edf820090bfa416111a1"},t=l;var r=n(0),s=n(3),i=n(1391),u=n(1392),o=n(1393),c=n(786);function d(e,a){const n=(0,s.Jc)(t,e),l=n.supportedContextsV2?.isTradable,d=n.supportedContextsV2?.isConvertible,m=(0,i.R)(),g=(0,u.p)(),p=(0,o.B)(),y=(0,c.S)(),k="convert"===a&&!1===d||"convert"!==a&&!1===l,f="buy"===a&&m||"sell"===a&&g||"convert"===a&&p;return(0,r.useMemo)((()=>k||f||y),[k,f,y])}},786:(e,a,n)=>{n.d(a,{S:()=>t});var l=n(29);const t=()=>(0,l.y)("kill_simple_trade_web")},1390:(e,a,n)=>{n.d(a,{T:()=>r});var l=n(44),t=n(29);function r(){const e=(0,t.y)("kill_simple_trade_eitri_web"),a=(0,l.Q)("jun_2023_www_simple_trade_eitri_confirmation_2",{skipTracking:e});return!e&&a}},3941:(e,a,n)=>{n.d(a,{K:()=>i});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"useSimpleTradeFinPromFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:null,args:null,concreteType:"UserProperties",kind:"LinkedField",name:"userProperties",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"featureFlags",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null,hash:"1a57606d8480d4694864e049a4a9af64"},t=l;var r=n(0),s=n(3);function i({queryRef:e}){const{viewer:a}=(0,s.Jc)(t,e);return(0,r.useMemo)((()=>Boolean(a?.userProperties?.featureFlags?.includes("2023.september.finprom"))),[a?.userProperties?.featureFlags])}},110:(e,a,n)=>{n.d(a,{Z:()=>o});var l=n(0),t=n(53),r=n(107),s=n(158),i=n(287),u=n(268);function o(e=!1){const a=(0,u.Z)(),n=(0,t.jf)(i.cr),o=(0,t.jf)(r.cr),c=(0,t.jf)(s.cr);return(0,l.useMemo)((()=>a?n:e?c:o),[n,o,c,a,e])}},229:(e,a,n)=>{n.d(a,{Z:()=>o});var l=n(0),t=n(107),r=n(158),s=n(287),i=n(73),u=n(268);function o(e=!1){const a=(0,u.Z)(),n=(0,i.tC)(s.Ex),o=(0,i.tC)(t.Ex),c=(0,i.tC)(r.Ex);return(0,l.useMemo)((()=>a?n:e?c:o),[n,o,a,e,c])}},268:(e,a,n)=>{n.d(a,{Z:()=>t});var l=n(44);function t(){return(0,l.Q)("jan_2024_simple_trade_web_refresh")}},3650:(e,a,n)=>{n.d(a,{Z:()=>$e});const l={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SimpleTradeQueryFragment",selections:[{args:null,kind:"FragmentSpread",name:"SimpleTradeContentQueryFragment"},{args:null,kind:"FragmentSpread",name:"SimpleTradeContentV2QueryFragment"}],type:"Query",abstractKey:null,hash:"96cd6f12009cd12a800e49f6a8360478"},t=l,r={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SimpleTradeFragment",selections:[{alias:null,args:null,concreteType:"SupportedContextsV2",kind:"LinkedField",name:"supportedContextsV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTradable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isConvertible",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"b6e1d9abccac15881d386657cceb4ac9"},s=r,i={argumentDefinitions:[{kind:"RootArgument",name:"accountUuid"},{kind:"RootArgument",name:"assetSlug"},{kind:"RootArgument",name:"assetSymbol"},{kind:"RootArgument",name:"assetUuid"},{kind:"RootArgument",name:"nativeCurrency"},{kind:"RootArgument",name:"productKey"},{kind:"RootArgument",name:"skipAccountUuid"},{kind:"RootArgument",name:"skipAssetSlug"},{kind:"RootArgument",name:"skipAssetSymbol"},{kind:"RootArgument",name:"skipAssetUuid"},{kind:"RootArgument",name:"skipTargetAssetSlug"},{kind:"RootArgument",name:"targetAssetSlug"}],kind:"Fragment",metadata:null,name:"SimpleTradeContentQueryFragment",selections:[{args:[{kind:"Variable",name:"productKey",variableName:"productKey"}],kind:"FragmentSpread",name:"BuySellFragment"},{args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],kind:"FragmentSpread",name:"ConvertFragment"},{args:null,kind:"FragmentSpread",name:"useIsUsdcConvertibleOrTradableFragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"btcViewerAsset",args:[{kind:"Literal",name:"symbol",value:"BTC"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:u=[{args:null,kind:"FragmentSpread",name:"SimpleTradeFragment"}],storageKey:'assetBySymbol(symbol:"BTC")'},{condition:"skipAssetUuid",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"uuid",variableName:"assetUuid"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetByUuid",plural:!1,selections:u,storageKey:null}]},{condition:"skipAssetSymbol",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"symbol",variableName:"assetSymbol"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:u,storageKey:null}]},{condition:"skipAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"slug",variableName:"assetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:u,storageKey:null}]},{condition:"skipTargetAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:"targetAssetBySlug",args:[{kind:"Variable",name:"slug",variableName:"targetAssetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null}],storageKey:null}]},{condition:"skipAccountUuid",kind:"Condition",passingValue:!1,selections:[{alias:"accountByUuid",args:[{kind:"Variable",name:"uuid",variableName:"accountUuid"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:u,type:"ViewerAsset",abstractKey:null}],storageKey:null}],storageKey:null}]}],storageKey:null},{args:null,kind:"FragmentSpread",name:"useUserCefiTotalBalanceFragment"}],type:"Query",abstractKey:null};var u;i.hash="6628ac3bbf347dbc060ae63977f7c1e0";const o=i;var c=n(0),d=n(11),m=n(9),g=n(1352),p=n(7),y=n(3),k=n(366),f=n(273),b=n(3921),S=n(3664),F=n(544),v=n(1550),h=n(539),C=n(522),T=n(277),A=n(1441),K=n(1394),x=n(23),w=n(215),B=n(3651),L=n(1606),I=n(125),P=n(187),R=n(874),M=n(1554),E=n(268);const _={argumentDefinitions:[{kind:"RootArgument",name:"nativeCurrency"}],kind:"Fragment",metadata:{plural:!0},name:"SimpleTradeContentV2ViewerAssetsFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],kind:"ScalarField",name:"marketCapV2",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"BuySellProviderFragment"},{args:null,kind:"FragmentSpread",name:"SimpleTradeStepperTradableAssetsFragment"}],type:"ViewerAsset",abstractKey:null,hash:"ef4e2067573db6324d953d64f04dd31f"},V=_,D={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SimpleTradeContentV2Fragment",selections:[{alias:null,args:null,concreteType:"SupportedContextsV2",kind:"LinkedField",name:"supportedContextsV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTradable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isConvertible",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null,hash:"89a7b13c515587118d0ac7b0095cd37b"},j=D,N=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{defaultValue:null,kind:"LocalArgument",name:"includeAutoStakingCheck"},{defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{defaultValue:null,kind:"LocalArgument",name:"shouldIncludeBalanceSummaryInfo"}],a=[{kind:"Variable",name:"after",variableName:"cursor"},{kind:"Variable",name:"first",variableName:"paginationCount"}],n={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},o={name:"isStablecoin",args:null,fragment:{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"AssetCategory",kind:"LinkedField",name:"categories",plural:!0,selections:[u,l],storageKey:null}],type:"Asset",abstractKey:null},kind:"RelayResolver",storageKey:null,isOutputType:!0},c={alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},p=[g,{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],y={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},f={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},c],type:"TiersCurrency",abstractKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"SimpleTradeContentV2AssetsRefetchable",selections:[{args:[{kind:"Variable",name:"cursor",variableName:"cursor"},{kind:"Variable",name:"paginationCount",variableName:"paginationCount"}],kind:"FragmentSpread",name:"SimpleTradeContentV2PaginationFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"SimpleTradeContentV2AssetsRefetchable",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"tradableAssets",args:a,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"tradableAssetsV2",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[n,l,{alias:null,args:t,kind:"ScalarField",name:"marketCapV2",storageKey:null},r,s,i,o,u,c,{alias:null,args:[{kind:"Literal",name:"filter",value:{quoteCurrency:"USD"}}],concreteType:"RetailBrokerageProduct",kind:"LinkedField",name:"brokerageProduct",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"baseIncrement",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"quoteIncrement",storageKey:null},l],storageKey:'brokerageProduct(filter:{"quoteCurrency":"USD"})'},d,{alias:null,args:t,concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[m],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SupportedContextsV2",kind:"LinkedField",name:"supportedContextsV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTradable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isConvertible",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:p,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:p,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[y,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[n,o,l,r,i,s,u,c,d,{alias:null,args:null,concreteType:"DestinationTag",kind:"LinkedField",name:"destinationTag",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"regex",storageKey:null}],storageKey:null},o,{alias:null,args:t,kind:"ScalarField",name:"unitPriceScaleV2",storageKey:null},{alias:null,args:t,concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[m,{alias:null,args:null,concreteType:"PercentChanges",kind:"LinkedField",name:"percentChanges",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"day",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AssetBalanceBreakdown",kind:"LinkedField",name:"assetBalanceBreakdown",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalanceFiat",plural:!1,selections:p,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalance",plural:!1,selections:p,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[k,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:[l],type:"Node",abstractKey:"__isNode"},f],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},r,l],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[k,{alias:null,args:null,kind:"ScalarField",name:"statsLabel",storageKey:null},g],storageKey:null},l,y,{condition:"includeAutoStakingCheck",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,concreteType:"EarnAsset",kind:"LinkedField",name:"earnAsset",plural:!1,selections:[{alias:null,args:null,concreteType:"EarnAutoStakingEnrollment",kind:"LinkedField",name:"autoStaking",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isEnrolled",storageKey:null},l],storageKey:null},l],storageKey:null}]},{kind:"InlineFragment",selections:[f,{condition:"shouldIncludeBalanceSummaryInfo",kind:"Condition",passingValue:!0,selections:[{kind:"InlineFragment",selections:[r],type:"TiersCurrency",abstractKey:null}]}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"tradableAssets",args:a,filters:null,handle:"connection",key:"Query_viewer_tradableAssets",kind:"LinkedHandle",name:"tradableAssetsV2"},l],storageKey:null}]},params:{id:"1339b51d3a4cbaf04920aa9f9cd3e45caa0a72f946775bff42b2f29c389f9b36",metadata:{},name:"SimpleTradeContentV2AssetsRefetchable",operationKind:"query",text:null}}}();N.hash="526923a0a3154d8449588594a82d10eb";const O=N,Z=function(){var e=["viewer","tradableAssets"];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{kind:"RootArgument",name:"includeAutoStakingCheck"},{kind:"RootArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{kind:"RootArgument",name:"shouldIncludeBalanceSummaryInfo"}],kind:"Fragment",metadata:{connection:[{count:"paginationCount",cursor:"cursor",direction:"forward",path:e}],refetch:{connection:{forward:{count:"paginationCount",cursor:"cursor"},backward:null,path:e},fragmentPathInResult:[],operation:O}},name:"SimpleTradeContentV2PaginationFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{kind:"RequiredField",field:{alias:"tradableAssets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"__Query_viewer_tradableAssets_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"SimpleTradeContentV2ViewerAssetsFragment"},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},action:"THROW",path:"viewer.tradableAssets"}],storageKey:null}],type:"Query",abstractKey:null}}();Z.hash="526923a0a3154d8449588594a82d10eb";const U=Z,q=function(){var e=[{kind:"Variable",name:"productKey",variableName:"productKey"}],a={alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},n=[a,{args:null,kind:"FragmentSpread",name:"SimpleTradeContentV2Fragment"},{args:null,kind:"FragmentSpread",name:"SimpleTradeContentV2ViewerAssetsFragment"}];return{argumentDefinitions:[{kind:"RootArgument",name:"accountUuid"},{kind:"RootArgument",name:"assetSlug"},{kind:"RootArgument",name:"assetSymbol"},{kind:"RootArgument",name:"assetUuid"},{kind:"RootArgument",name:"nativeCurrency"},{kind:"RootArgument",name:"productKey"},{kind:"RootArgument",name:"skipAccountUuid"},{kind:"RootArgument",name:"skipAssetSlug"},{kind:"RootArgument",name:"skipAssetSymbol"},{kind:"RootArgument",name:"skipAssetUuid"},{kind:"RootArgument",name:"skipTargetAssetSlug"},{kind:"RootArgument",name:"targetAssetSlug"}],kind:"Fragment",metadata:null,name:"SimpleTradeContentV2QueryFragment",selections:[{args:null,kind:"FragmentSpread",name:"SimpleTradeStepperQueryFragment"},{args:null,kind:"FragmentSpread",name:"SimpleTradeContentV2PaginationFragment"},{args:e,kind:"FragmentSpread",name:"useSubscriberStatusFragment"},{args:null,kind:"FragmentSpread",name:"useUserCefiTotalBalanceFragment"},{args:null,kind:"FragmentSpread",name:"useIsUsdcConvertibleOrTradableFragment"},{args:null,kind:"FragmentSpread",name:"useFormattedPaymentMethodsFragment"},{args:[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],kind:"FragmentSpread",name:"ConvertV2Fragment"},{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"btcViewerAsset",args:[{kind:"Literal",name:"symbol",value:"BTC"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:n,storageKey:'assetBySymbol(symbol:"BTC")'},{condition:"skipAssetUuid",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"uuid",variableName:"assetUuid"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetByUuid",plural:!1,selections:n,storageKey:null}]},{condition:"skipAssetSymbol",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"symbol",variableName:"assetSymbol"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:n,storageKey:null}]},{condition:"skipAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"slug",variableName:"assetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:n,storageKey:null}]},{condition:"skipTargetAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:"targetAssetBySlug",args:[{kind:"Variable",name:"slug",variableName:"targetAssetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:[a],storageKey:null}]},{condition:"skipAccountUuid",kind:"Condition",passingValue:!1,selections:[{alias:"accountByUuid",args:[{kind:"Variable",name:"uuid",variableName:"accountUuid"}],concreteType:"Account",kind:"LinkedField",name:"accountByUuidV2",plural:!1,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:n,type:"ViewerAsset",abstractKey:null}],storageKey:null}],storageKey:null}]},{alias:null,args:null,concreteType:"BalanceData",kind:"LinkedField",name:"balanceData",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"balanceInWbl",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:e,concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null}}();q.hash="ac0b3a64994c30e9bca068b85bc8061b";const Q=q;var H=n(33),W=n(216),z=n.n(W),G=n(557),J=n(558),$=n(871),Y=n(860),X=n(123),ee=n(280);const ae=function(){var e={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},a={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},n={alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},l=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}];return{argumentDefinitions:[{defaultValue:!1,kind:"LocalArgument",name:"includeApy"},{defaultValue:!1,kind:"LocalArgument",name:"includeBalance"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"}],kind:"Fragment",metadata:{plural:!0},name:"ConvertV2ViewerAssetsFragment",selections:[{args:[{kind:"Variable",name:"includeApy",variableName:"includeApy"},{kind:"Variable",name:"includeBalance",variableName:"includeBalance"}],kind:"FragmentSpread",name:"ConvertStepperViewerAssetFragment"},{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,fragment:{args:null,kind:"FragmentSpread",name:"AssetIsStablecoinFragment"},kind:"RelayResolver",name:"isStablecoin",resolverModule:ee.W,path:"asset.isStablecoin"},e,a,n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null},{alias:null,args:[{kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"}],kind:"ScalarField",name:"marketCapV2",storageKey:null},{args:null,kind:"FragmentSpread",name:"AssetCurrencyIconFragment"}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},e,{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[e,a,n],storageKey:null}],type:"ViewerAsset",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:l,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:l,storageKey:null}],storageKey:null},{condition:"includeApy",kind:"Condition",passingValue:!0,selections:[{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null}]}],type:"ViewerAsset",abstractKey:null}}();ae.hash="ffdd8054c5fd2ad84e9e1f92bda86ec2";const ne=ae,le=function(){var e=[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{defaultValue:null,kind:"LocalArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"},{defaultValue:null,kind:"LocalArgument",name:"shouldIncludeBalanceSummaryInfo"}],a={kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"},n=[{kind:"Variable",name:"after",variableName:"cursor"},{kind:"Variable",name:"first",variableName:"paginationCount"}],l={alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"displaySymbol",storageKey:null},s={alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},u={alias:null,args:null,kind:"ScalarField",name:"slug",storageKey:null},o={name:"isStablecoin",args:null,fragment:{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"AssetCategory",kind:"LinkedField",name:"categories",plural:!0,selections:[u,t],storageKey:null}],type:"Asset",abstractKey:null},kind:"RelayResolver",storageKey:null,isOutputType:!0},c={alias:null,args:null,kind:"ScalarField",name:"imageUrl",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"exponent",storageKey:null},m=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"currency",storageKey:null}],g={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},p=[{kind:"Variable",name:"quoteCurrency",variableName:"nativeCurrency"}],y={alias:null,args:null,kind:"ScalarField",name:"formattedValue",storageKey:null},k={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"code",storageKey:null},d],type:"TiersCurrency",abstractKey:null};return{fragment:{argumentDefinitions:e,kind:"Fragment",metadata:null,name:"ConvertV2PaginationRefetchable",selections:[{args:[{kind:"Variable",name:"cursor",variableName:"cursor"},{kind:"Variable",name:"paginationCount",variableName:"paginationCount"},a],kind:"FragmentSpread",name:"ConvertV2PaginationFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:e,kind:"Operation",name:"ConvertV2PaginationRefetchable",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"convertibleAssets",args:n,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"convertibleAssetsV2",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,t,r,s,i,u,o,c,d,{alias:null,args:[{kind:"Literal",name:"filter",value:{quoteCurrency:"USD"}}],concreteType:"RetailBrokerageProduct",kind:"LinkedField",name:"brokerageProduct",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"baseIncrement",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"quoteIncrement",storageKey:null},t],storageKey:'brokerageProduct(filter:{"quoteCurrency":"USD"})'},{alias:null,args:null,kind:"ScalarField",name:"experimental",storageKey:null},{alias:null,args:[a],kind:"ScalarField",name:"marketCapV2",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SupportedContextsV2",kind:"LinkedField",name:"supportedContextsV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isTradable",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"isConvertible",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalance",plural:!1,selections:m,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableBalanceInNativeCurrency",plural:!1,selections:m,storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"assetOrFiatCurrency",plural:!1,selections:[g,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[l,o,t,i,r,s,u,d,c,{alias:null,args:null,concreteType:"DestinationTag",kind:"LinkedField",name:"destinationTag",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"regex",storageKey:null}],storageKey:null},o,{alias:null,args:p,kind:"ScalarField",name:"unitPriceScaleV2",storageKey:null},{alias:null,args:p,concreteType:"CurrencyQuote",kind:"LinkedField",name:"latestQuoteV2",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"price",storageKey:null},{alias:null,args:null,concreteType:"PercentChanges",kind:"LinkedField",name:"percentChanges",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"day",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"AssetBalanceBreakdown",kind:"LinkedField",name:"assetBalanceBreakdown",plural:!1,selections:[{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalanceFiat",plural:!1,selections:m,storageKey:null},{alias:null,args:null,concreteType:"Amount",kind:"LinkedField",name:"availableToSendBalance",plural:!1,selections:m,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null}],storageKey:null}],type:"ViewerAsset",abstractKey:null},{kind:"InlineFragment",selections:[t],type:"Node",abstractKey:"__isNode"},k],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},i,t],storageKey:null},{alias:null,args:null,concreteType:"RewardApy",kind:"LinkedField",name:"rewardApy",plural:!1,selections:[y],storageKey:null},t,g,{kind:"InlineFragment",selections:[k,{condition:"shouldIncludeBalanceSummaryInfo",kind:"Condition",passingValue:!0,selections:[{kind:"InlineFragment",selections:[i],type:"TiersCurrency",abstractKey:null}]}],type:"AssetOrCurrency",abstractKey:"__isAssetOrCurrency"}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"convertibleAssets",args:n,filters:null,handle:"connection",key:"Query_viewer_convertibleAssets",kind:"LinkedHandle",name:"convertibleAssetsV2"},t],storageKey:null}]},params:{id:"cdf21946b44f8eace2d673c66265f08cc97c9c9b97d5716a645a457b25f4bdbd",metadata:{},name:"ConvertV2PaginationRefetchable",operationKind:"query",text:null}}}();le.hash="aec3ed06304aa1128f57a50dd49c7970";const te=le,re=function(){var e=["viewer","convertibleAssets"];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"cursor"},{kind:"RootArgument",name:"nativeCurrency"},{defaultValue:25,kind:"LocalArgument",name:"paginationCount"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"},{kind:"RootArgument",name:"shouldIncludeBalanceSummaryInfo"}],kind:"Fragment",metadata:{connection:[{count:"paginationCount",cursor:"cursor",direction:"forward",path:e}],refetch:{connection:{forward:{count:"paginationCount",cursor:"cursor"},backward:null,path:e},fragmentPathInResult:[],operation:te}},name:"ConvertV2PaginationFragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{kind:"RequiredField",field:{alias:"convertibleAssets",args:null,concreteType:"ViewerAssetConnection",kind:"LinkedField",name:"__Query_viewer_convertibleAssets_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"ViewerAssetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"ViewerAsset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},{args:[{kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"}],kind:"FragmentSpread",name:"ConvertV2ViewerAssetsFragment"},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},action:"THROW",path:"viewer.convertibleAssets"}],storageKey:null}],type:"Query",abstractKey:null}}();re.hash="aec3ed06304aa1128f57a50dd49c7970";const se=re,ie=function(){var e={alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},a={kind:"Variable",name:"quoteCurrency",variableName:"quoteCurrency"},n=[a],l=[e,{args:n,kind:"FragmentSpread",name:"ConvertV2ViewerAssetsFragment"}],t=[{kind:"Variable",name:"productKey",variableName:"productKey"}];return{argumentDefinitions:[{kind:"RootArgument",name:"assetSlug"},{kind:"RootArgument",name:"assetSymbol"},{kind:"RootArgument",name:"assetUuid"},{kind:"RootArgument",name:"productKey"},{defaultValue:null,kind:"LocalArgument",name:"quoteCurrency"},{kind:"RootArgument",name:"skipAssetSlug"},{kind:"RootArgument",name:"skipAssetSymbol"},{kind:"RootArgument",name:"skipAssetUuid"},{kind:"RootArgument",name:"skipTargetAssetSlug"},{kind:"RootArgument",name:"targetAssetSlug"}],kind:"Fragment",metadata:null,name:"ConvertV2Fragment",selections:[{alias:null,args:null,concreteType:"Viewer",kind:"LinkedField",name:"viewer",plural:!1,selections:[{alias:"tradeRestrictions",args:[{kind:"Literal",name:"action",value:"trades"}],concreteType:"PolicyRestriction",kind:"LinkedField",name:"policyRestrictions",plural:!0,selections:[{args:null,kind:"FragmentSpread",name:"PolicyRestrictionEnforcerFragment"}],storageKey:'policyRestrictions(action:"trades")'},{condition:"skipAssetUuid",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"uuid",variableName:"assetUuid"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetByUuid",plural:!1,selections:l,storageKey:null}]},{condition:"skipAssetSymbol",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"symbol",variableName:"assetSymbol"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:l,storageKey:null}]},{condition:"skipAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:null,args:[{kind:"Variable",name:"slug",variableName:"assetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:l,storageKey:null}]},{alias:"usdcViewerAsset",args:[{kind:"Literal",name:"symbol",value:"USDC"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySymbol",plural:!1,selections:[e,{args:[{kind:"Literal",name:"includeApy",value:!0},{kind:"Literal",name:"includeBalance",value:!0},a],kind:"FragmentSpread",name:"ConvertV2ViewerAssetsFragment"}],storageKey:'assetBySymbol(symbol:"USDC")'},{alias:null,args:t,concreteType:"CoinbaseSubscription",kind:"LinkedField",name:"coinbaseSubscription",plural:!1,selections:[{alias:null,args:null,concreteType:"CoinbaseSubscriptionPlan",kind:"LinkedField",name:"subscriptionPlan",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null},{condition:"skipTargetAssetSlug",kind:"Condition",passingValue:!1,selections:[{alias:"targetAssetBySlug",args:[{kind:"Variable",name:"slug",variableName:"targetAssetSlug"}],concreteType:"ViewerAsset",kind:"LinkedField",name:"assetBySlug",plural:!1,selections:l,storageKey:null}]}],storageKey:null},{args:t,kind:"FragmentSpread",name:"useSubscriberStatusFragment"},{args:n,kind:"FragmentSpread",name:"ConvertV2PaginationFragment"}],type:"Query",abstractKey:null}}();ie.hash="a6ec71eb3484c9be4b5950f7193fb709";const ue=ie;var oe=n(801),ce=n(110),de=n(220),me=n(955),ge=n(2);const pe=90;function ye(e){return(0,ge.jsx)(k.Z,{"data-element":"BuySellBoundary","data-component":"ConvertV2",children:(0,ge.jsx)(ke,{...e,"data-element":"ConvertV2Content"})})}function ke({sourceAssetId:e,targetAssetId:a,queryRef:n}){const l=(0,y.Jc)(ue,n),{viewer:t}=l,{data:{viewer:r},loadNext:s,hasNext:i,isLoadingNext:u}=(0,y.nu)(se,l),{assetByUuid:o,assetBySymbol:d,assetBySlug:m,usdcViewerAsset:g,targetAssetBySlug:p}=t,k=(0,c.useMemo)((()=>(0,X.D)(t.tradeRestrictions||[])),[t.tradeRestrictions]),f=o||d||m,b=(0,c.useMemo)((()=>{const e=(0,X.D)(r.convertibleAssets.edges.map((({node:e})=>e))),a=!!f&&e.every((e=>e.asset.uuid!==f.asset.uuid)),n=!!p&&e.every((e=>e.asset.uuid!==p.asset.uuid)),l=g?[g]:[],t=l.map((e=>e?.asset.uuid));return[...e.filter((e=>!t.includes(e.asset.uuid))),...a?[f]:[],...l,...n?[p]:[]]}),[r.convertibleAssets.edges,f,p,g]),S=(0,y.Jc)(ne,b),F=(0,c.useMemo)((()=>(0,H.orderBy)(S,(e=>Number(e.asset.marketCapV2)),["desc"])),[S]),{sourceAssetId:v,targetAssetId:h}=(0,ce.Z)(!0);(0,$.Z)({loadNext:s,hasNext:i,isLoadingNext:u},pe);const{isSubscribed:C}=(0,Y.x)(l),{sourceViewerAsset:T,targetViewerAsset:A}=(0,me.Z)({sourceId:e,targetId:a,convertibleAssets:F});return(0,c.useEffect)((()=>{T&&v.onChange(T.asset.uuid),A&&h.onChange(A.asset.uuid)}),[]),(0,ge.jsx)(oe.Z,{action:"trades",policyRestrictionRefs:k,"data-element":"PolicyRestrictionEnforcer","data-component":"ConvertV2Content",children:(0,ge.jsx)(de.Z,{isCoinbaseOneSubscriber:C&&"PAUSE_PLAN"!==t.coinbaseSubscription?.subscriptionPlan?.type,sourceAssetIdV2:T.asset.uuid,targetAssetIdV2:A.asset.uuid,convertibleAssets:F,"data-element":"ConvertProvider",children:(0,ge.jsx)(ge.Fragment,{children:"Convert V2 stepper placeholder"})})})}var fe=n(287);const be={argumentDefinitions:[],kind:"Fragment",metadata:{plural:!0},name:"SimpleTradeStepperTradableAssetsFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null}],storageKey:null},{args:null,kind:"FragmentSpread",name:"SelectAssetStepViewerAssetFragment"},{args:null,kind:"FragmentSpread",name:"SelectAssetStepFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepTradableAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"38dacd9982708f3241f71eed9a12ada6"},Se=be,Fe={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SimpleTradeStepperQueryFragment",selections:[{args:null,kind:"FragmentSpread",name:"EntryStepQueryFragment"},{args:null,kind:"FragmentSpread",name:"SelectPaymentStepFragment"}],type:"Query",abstractKey:null,hash:"906d131185682ecec78be5553bd3a51b"},ve=Fe;var he=n(8),Ce=n.n(he),Te=n(53),Ae=n(15),Ke=n(350),xe=n(140),we=n(1314),Be=n(749),Le=n(954);const Ie={argumentDefinitions:[],kind:"Fragment",metadata:{plural:!0},name:"EntryStepTradableAssetFragment",selections:[{alias:null,args:null,concreteType:"Asset",kind:"LinkedField",name:"asset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"uuid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"platformName",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Account",kind:"LinkedField",name:"accounts",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primary",storageKey:null},{args:null,kind:"FragmentSpread",name:"EntryStepBuySellAccountFragment"}],storageKey:null},{args:null,kind:"FragmentSpread",name:"EntryStepBuySellAssetFragment"}],type:"ViewerAsset",abstractKey:null,hash:"368e29e51adfb13127560e0a5fca8d3d"},Pe=Ie,Re={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EntryStepQueryFragment",selections:[{args:null,kind:"FragmentSpread",name:"useUserCefiTotalBalanceFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepConvertQueryFragment"},{args:null,kind:"FragmentSpread",name:"EntryStepBuySellFragment"}],type:"Query",abstractKey:null,hash:"543ea096b18a45ef1aac89832f389cb7"},Me=Re;var Ee=n(19),_e=n(3667),Ve=n(3640),De=n(744),je=n(1307),Ne=n(748);const Oe=(0,d.vU)({buyTab:{id:"BuySell.EntryStep.buyTab",defaultMessage:"Buy"},sellTab:{id:"BuySell.EntryStep.sellTab",defaultMessage:"Sell"},convertTab:{id:"BuySell.EntryStep.convertTab",defaultMessage:"Convert"}});function Ze({queryRef:e,viewerAssetRefs:a,setTradeTypeUI:n}){const l=(0,y.Jc)(Me,e),t=(0,y.Jc)(Pe,a),{formatMessage:r}=(0,m.Z)(),{assetId:s,transferType:i}=(0,Te.jf)(fe.cr),u=(0,c.useMemo)((()=>{const e=t.find((({asset:e})=>e.uuid===s.value));return e||((0,Ae.cB)(new Error("Failed to find initial asset in tradableAssets"),{owner:"trading",transferType:i.value,assetId:s.value,context:"buy_sell"}),t[0])}),[s,t,i.value]);Ce()(u,"There should always be a selected asset");const o=(0,De.M)(u),{balanceInFiat:d}=(0,C.Z)({queryRef:l}),g=(0,c.useMemo)((()=>[{transferType:"buy"},{transferType:"sell"},{transferType:"convert"}]),[]),p=(0,c.useCallback)((e=>{0!==e&&1!==e||i.onChange(g[e].transferType),n(g[e].transferType)}),[g,i,n]),k=(0,c.useMemo)((()=>(0,ge.jsx)(Ne.Z,{showOrderTypeSelector:!0,disabled:!1})),[]);return(0,ge.jsx)(Ve.Z,{defaultIndex:"buy"===i.value?0:"sell"===i.value?1:2,"data-element":"RetailRedesignTabProvider","data-component":"EntryStep",children:(0,ge.jsxs)(ge.Fragment,{children:[(0,ge.jsxs)(Ee.Box,{flexWrap:"wrap-reverse",justifyContent:"space-between","data-element":"Box",children:[(0,ge.jsx)(_e.h,{hideTabs:!1,tabs:[{index:0,label:r(Oe.buyTab)},{index:1,label:r(Oe.sellTab)},{index:2,label:r(Oe.convertTab)}].filter((e=>0===e.index||1===e.index||2===e.index)),onChange:p,"data-element":"RetailRedesignTabs"}),(0,ge.jsx)(Ee.Box,{spacingVertical:2,spacingHorizontal:3,"data-element":"Box",children:k})]}),(0,ge.jsx)(je.Z,{queryRef:l,accountRef:o,viewerAssetRef:u,totalNativeBalance:d??0,closeModal:()=>{},"data-element":"BuySellEntryStep"})]})})}const Ue=(0,c.memo)(Ze);var qe=n(73);function Qe({queryRef:e,viewerAssetRefs:a,setTradeTypeUI:n}){const l=(0,y.Jc)(ve,e),t=(0,y.Jc)(Se,a),{transferType:r,assetId:s,activePaymentMethodId:i,recurringPeriod:u}=(0,Te.jf)(fe.cr),{allowedPaymentMethods:o}=(0,I.f)(),{trackEvent:d}=(0,xe.Z)(),{goBack:m}=(0,qe.tC)(fe.Ex),g=(0,c.useMemo)((()=>{const e=t.find((({asset:e})=>e.uuid===s.value));return e||((0,Ae.cB)(new Error("Failed to find initial asset in tradableAssets"),{owner:"trading",transferType:r.value,assetId:s.value,context:"buy_sell"}),t[0])}),[s,t,r.value]);return Ce()(g,"There should always be a selected asset"),(0,ge.jsxs)(fe.Ex.Steps,{speed:"extraFast","data-element":"unknown","data-component":"SimpleTradeStepper",children:[(0,ge.jsx)(Ke.zA,{"data-element":"StyledStep",children:(0,ge.jsx)(Ue,{queryRef:l,viewerAssetRefs:t,setTradeTypeUI:n,"data-element":"EntryStep"})},"entry"),(0,ge.jsx)(Ke.zA,{"data-element":"StyledStep",children:(0,ge.jsx)(we.Z,{viewerAssetRefs:t,viewerAssetRef:g,isNewDesign:!0,"data-element":"SelectAssetStep"})},"selectAsset"),(0,ge.jsx)(Ke.zA,{"data-element":"StyledStep",children:(0,ge.jsx)(Be.Z,{transferType:r.value??"buy",paymentMethods:o,activePaymentMethodId:i.value,isRecurring:"never"!==u.value,selectedAssetId:g.asset.uuid,queryRef:l,trackEvent:d,onBack:m,"data-element":"SelectPaymentStep",children:e=>(0,ge.jsx)(Le.Z,{...e})})},"selectPayment"),(0,ge.jsx)(Ke.zA,{"data-element":"StyledStep",children:(0,ge.jsx)(ge.Fragment,{children:"buy preview placeholder"})},"buyPreview"),(0,ge.jsx)(Ke.zA,{"data-element":"StyledStep",children:(0,ge.jsx)(ge.Fragment,{children:"sell preview placeholder"})},"sellPreview")]})}const He=(0,c.memo)(Qe),We=90;function ze({queryRef:e,eventContext:a,entryPoint:n,unverifiedSelectedPaymentMethod:l}){const{assetSlug:t,accountUuid:r,assetSymbol:s}=(0,T.Z)(),i=(0,y.Jc)(Q,e),{data:u,loadNext:o,hasNext:d,isLoadingNext:m}=(0,y.nu)(U,i),{viewer:k}=i,{assetByUuid:f,assetBySymbol:b,assetBySlug:F,accountByUuid:v,targetAssetBySlug:x,btcViewerAsset:w}=k,L=(0,c.useMemo)((()=>f||(b||(F||("ViewerAsset"===v?.assetOrFiatCurrency?.__typename?v?.assetOrFiatCurrency:w)))),[f,b,F,v?.assetOrFiatCurrency,w]),M=(0,y.Jc)(j,L||null);if(!M?.supportedContextsV2)throw new g.Z(`No asset found for assetSlug: ${t}, assetSymbol: ${s}, accountUuid: ${r}`);const{asset:E,supportedContextsV2:_}=M;if(!_.isTradable&&!_.isConvertible)throw new Error(`Tried to load SimpleTrade with non-tradable asset ${s||t}`);const D=(0,c.useMemo)((()=>{const e=(0,X.D)(u.viewer.tradableAssets.edges.map((({node:e})=>e))),a=!!L&&e.every((e=>e.asset.uuid!==L.asset.uuid));return[...e,...a?[L]:[]]}),[u.viewer.tradableAssets.edges,L]),N=(0,y.Jc)(V,D);(0,$.Z)({loadNext:o,hasNext:d,isLoadingNext:m},We);const{isSubscribed:O,refetchSubscriberStatus:Z}=(0,Y.x)(i),[q,W]=(0,c.useState)("buy"),ee=(0,h.ZP)(),{balanceInFiat:ae}=(0,C.Z)({queryRef:i}),ne=(0,c.useMemo)((()=>"buy"===q?(0,H.orderBy)(N,(e=>Number(e.asset.marketCapV2)),["desc"]):[...N]),[N,q]);(0,p.bH)("trade_modal",{action:p.Us.render,componentType:p.re.modal,platform:"web",page:a??""});const{isConvertible:le}=(0,S.Z)(i),te=x?.asset?.uuid,{getInitialValues:re}=(0,B.e)({isUsdcInConvertibleAssets:le,paymentMethods:ee,assetId:E.uuid,targetAssetId:te}),se=(0,c.useMemo)((()=>(0,J.l)({entryPoint:n,type:q})),[n,q]),ie=(0,K.j)(),ue="convert"===q?[]:(0,R.Z)(ee,q,ie,se,l),oe=parseFloat(k.balanceData?.balanceInWbl?.value||"0"),ce=(0,G.Z)({queryRef:i,paymentMethods:ue,totalHoldBalance:oe,totalNativeBalance:ae??0,transferType:"convert"!==q?q:"buy",unverifiedSelectedPaymentMethod:l}),de=re(q,n),me=(0,c.useMemo)((()=>{const e=ne.find((({asset:e})=>e.uuid==e.uuid));return e?E.uuid:ne[0]?.asset.uuid}),[ne,E.uuid]),pe=ue[0],ke=(0,c.useMemo)((()=>({...fe.Sc,eventContext:a,assetId:me,showPresetAmountsIfAvailable:!1,orderType:"MARKET",shouldBuyAndStake:!1,activePaymentMethodId:pe?.id})),[a,me,pe?.id]);return(0,ge.jsx)(fe.cr.Provider,{onSubmit:z(),initialValues:ke,"data-element":"unknown","data-component":"SimpleTradeContentV2",children:(0,ge.jsxs)(fe.Ex.Provider,{"data-element":"unknown",children:["convert"===q?(0,ge.jsx)(ye,{queryRef:i,sourceAssetId:E.uuid,eventContext:a,closeModal:()=>{},targetAssetId:te}):null,"buy"===q||"sell"===q?(0,ge.jsx)(A.R,{paymentMethods:ue,children:(0,ge.jsx)(P.Z,{initialValue:de?.initialProxyValue,disableInitialCryptoValue:"more-menu-section-item-recurring-purchases"===n,children:e=>e?(0,ge.jsx)(ge.Fragment,{children:"temp convert placeholder"}):(0,ge.jsx)(I.Z,{allowedPaymentMethods:ue,viewerAssetRefs:ne,formattedPaymentMethods:ce,entryPoint:n,isCoinbaseOneSubscriber:O&&"PAUSE_PLAN"!==k.coinbaseSubscription?.subscriptionPlan?.type,refetchSubscriberStatus:Z,variant:se,children:(0,ge.jsx)(He,{queryRef:i,viewerAssetRefs:ne,setTradeTypeUI:W})})})}):null]})})}const Ge=(0,d.vU)({buy:{id:"SimpleTrade.buy",defaultMessage:"Buy"},addCash:{id:"SimpleTrade.addCash",defaultMessage:"Add cash"},sell:{id:"SimpleTrade.sell",defaultMessage:"Sell"},cashOut:{id:"SimpleTrade.cashOut",defaultMessage:"Cash out"},convert:{id:"SimpleTrade.convert",defaultMessage:"Convert"},convertCash:{id:"SimpleTrade.convertCash",defaultMessage:"Convert cash"}});function Je({closeModal:e,onComplete:a,hideTabs:n,initialActiveTab:l="buy",eventContext:t="assetPage",openRecurrence:r,recurringPeriod:i,initialInputAmount:u,confirm3ds:d,skipToBuyStatus:k,entryPoint:E,isBuyAndStakePreselected:_,queryRef:V,tradeActions:D=["buy","sell","convert"],shouldUseNativeFiatWallet:j=!1,disableSourceAssetSelection:N,unverifiedSelectedPaymentMethod:O,isDefaultPaymentMethodEnabled:Z}){const{assetSlug:U,accountUuid:q,assetSymbol:Q}=(0,T.Z)(),{formatMessage:H}=(0,m.Z)(),W=(0,y.Jc)(o,V),{viewer:z}=W,{assetByUuid:G,assetBySymbol:J,assetBySlug:$,accountByUuid:Y,btcViewerAsset:X,targetAssetBySlug:ee}=z,ae=(0,c.useMemo)((()=>G||(J||($||("ViewerAsset"===Y?.assetOrFiatCurrency?.__typename?Y?.assetOrFiatCurrency:X)))),[G,J,$,Y?.assetOrFiatCurrency,X]),ne=(0,y.Jc)(s,ae||null);if(!ne?.supportedContextsV2)throw new g.Z(`No asset found for assetSlug: ${U}, assetSymbol: ${Q}, accountUuid: ${q}`);const{asset:le,supportedContextsV2:te}=ne,{isConvertible:re,isTradable:se}=te,ie=(0,h.ZP)(),{selectedAsset:ue}=(0,I.f)(),{balanceInFiat:oe}=(0,C.Z)({queryRef:W}),ce=(0,c.useMemo)((()=>{const e=[];return se&&(e.push("buy"),e.push("sell")),re&&e.push("convert"),e.length>0&&!e.includes(l)?e[0]??"buy":l}),[l,re,se]),[de,me]=(0,c.useState)(ce),{isCryptoOnlyTrader:pe}=(0,x.Z)();(0,p.bH)("trade_modal",{action:p.Us.render,componentType:p.re.modal,platform:"web",page:t??""});const{isConvertible:ye}=(0,S.Z)(W),{doneLoading:ke,stickyTxns:fe}=(0,F.W)(),be=ee?.asset?.uuid,{getInitialValues:Se}=(0,B.e)({isUsdcInConvertibleAssets:ye,paymentMethods:ie,stickyTxns:fe,assetId:le.uuid,targetAssetId:be}),Fe=(0,v.VR)({paymentMethods:ie,skipQuery:!Z}),ve=(0,K.j)(),he=(0,c.useCallback)((n=>{const l=de===n,s=H(function({transferType:e,entryPoint:a}){let n=Ge[e];const l={entryPoint:a,type:e};return(0,w.Hq)(l)&&(n=Ge.addCash),(0,w._Y)(l)&&(n=Ge.cashOut),(0,w.c2)(l)&&(n=Ge.convertCash),n}({transferType:n,entryPoint:E})),o="convert"!==n?(0,R.Z)(ie,n,ve):[],c={type:n,entryPoint:E},m=Z&&"convert"!==n?Fe(n,(0,w.Ll)(c),ve):Se(n,E);return(0,ge.jsx)(f.U0,{value:n,label:s,children:l&&(0,ge.jsxs)(ge.Fragment,{children:["convert"===n&&(0,ge.jsx)(M.Z,{queryRef:W,sourceAssetId:le.uuid,isVisible:l,eventContext:t,closeModal:e,targetAssetId:be}),("buy"===n||"sell"===n)&&(0,ge.jsx)(A.R,{paymentMethods:o,children:(0,ge.jsx)(P.Z,{initialValue:m?.initialProxyValue,disableInitialCryptoValue:"more-menu-section-item-recurring-purchases"===E,children:c=>c?(0,ge.jsx)(b.E,{queryRef:W,transferType:n,assetId:le.uuid,cryptoAssetId:c,allowedPaymentMethods:o,eventContext:t,entryPoint:E,closeModal:e}):(0,ge.jsx)(L.Z,{entryPoint:E,disableSourceAssetSelection:N,queryRef:W,transferType:n,isVisible:l,closeModal:e,entryStepModalHeaderTitle:s,onComplete:a,eventContext:t,assetId:le.uuid,openRecurrence:r,recurringPeriod:i,initialInputAmount:u,onTransferTypeChange:me,confirm3ds:d,skipToBuyStatus:k,isBuyAndStakePreselected:_,assetName:le.name,paymentMethods:ie,totalNativeBalance:oe??0,initialPaymentMethodProxyId:m?.paymentMethodId,shouldUseNativeFiatWallet:j,unverifiedSelectedPaymentMethod:O})})})]})})}),[de,H,E,ie,ve,Fe,Z,Se,W,le.uuid,le.name,t,e,be,N,a,r,i,u,d,k,_,oe,j,O]);if(!te.isTradable&&!te.isConvertible)throw new Error(`Tried to load SimpleTrade with non-tradable asset ${Q||U}`);const Ce=(0,c.useCallback)((e=>{me(e),(0,p.Kz)(`${de}_switched_trade_type`,{componentType:p.re.button,action:p.Us.click,switchToType:e,currency:ue.platformName??""})}),[de,ue.platformName]);return(0,c.useEffect)((()=>{pe&&me("convert")})),ke?(0,ge.jsxs)(f.ZP,{onClickTab:Ce,activeTab:de,hideTabs:n||pe,"data-element":"FolderTabs","data-component":"SimpleTradeContent",children:[te?.isTradable&&D.includes("buy")&&he("buy"),te?.isTradable&&D.includes("sell")&&he("sell"),te?.isConvertible&&D.includes("convert")&&he("convert")]},le.uuid):null}function $e({queryRef:e,...a}){const n=(0,E.Z)(),l=(0,y.Jc)(t,e),r=(0,c.useMemo)((()=>n?(0,ge.jsx)(ze,{queryRef:l,...a}):(0,ge.jsx)(Je,{queryRef:l,...a})),[n,l,a]);return(0,ge.jsx)(k.Z,{"data-element":"BuySellBoundary","data-component":"SimpleTrade",children:r})}},378:(e,a,n)=>{n.d(a,{s:()=>l});const l=(0,n(11).vU)({commitError:{id:"SimpleTrade.commitError",defaultMessage:"Something went wrong. Please check your email to see if your trade was successful."},genericErrorMessage:{id:"SimpleTrade.genericErrorMessage",defaultMessage:"Trading unavailable due to connection issues. Your funds are safe, please try again later."}})}}]);
//# sourceMappingURL=simpletrade-9038e1c93efb0857.js.map