-
Notifications
You must be signed in to change notification settings - Fork 31
/
56239.733f5890.iframe.bundle.js
1 lines (1 loc) · 30 KB
/
56239.733f5890.iframe.bundle.js
1
"use strict";(globalThis.webpackChunkmetamask_crx=globalThis.webpackChunkmetamask_crx||[]).push([[56239],{"./ui/components/multichain/account-list-item-menu/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{S:()=>AccountListItemMenu});var react=__webpack_require__("./node_modules/react/index.js"),es=__webpack_require__("./node_modules/react-redux/es/index.js"),prop_types=__webpack_require__("./node_modules/prop-types/index.js"),prop_types_default=__webpack_require__.n(prop_types),institution_background=__webpack_require__("./ui/store/institutional/institution-background.ts"),metametrics=__webpack_require__("./ui/contexts/metametrics.js"),useI18nContext=__webpack_require__("./ui/hooks/useI18nContext.js"),networks=__webpack_require__("./shared/modules/selectors/networks.ts"),selectors=__webpack_require__("./ui/selectors/index.js"),hexstring_utils=__webpack_require__("./shared/modules/hexstring-utils.ts"),menu=__webpack_require__("./ui/components/ui/menu/index.js"),component_library=__webpack_require__("./ui/components/component-library/index.ts"),constants_metametrics=__webpack_require__("./shared/constants/metametrics.ts"),actions=__webpack_require__("./ui/__mocks__/actions.js"),design_system=__webpack_require__("./ui/helpers/constants/design-system.ts"),metrics=__webpack_require__("./ui/helpers/utils/metrics.js"),menu_items=__webpack_require__("./ui/components/multichain/menu-items/index.js");function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){reject(error);return}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _iterable_to_array(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _non_iterable_spread(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function _unsupported_iterable_to_array(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if("Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}}function _ts_generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}}var METRICS_LOCATION="Account Options",AccountListItemMenu=function(param){var anchorElement=param.anchorElement,onClose=param.onClose,closeMenu=param.closeMenu,isRemovable=param.isRemovable,account=param.account,isOpen=param.isOpen,isPinned=param.isPinned,isHidden=param.isHidden,t=(0,useI18nContext.P)(),trackEvent=(0,react.useContext)(metametrics.O2),dispatch=(0,es.wA)(),chainId=(0,es.d4)(networks.gr),deviceName=(0,es.d4)(selectors.ks6),keyring=account.metadata.keyring,accountType=(0,metrics.lU)((0,selectors.cgi)(keyring)),pinnedAccountList=(0,es.d4)(selectors.DRO),hiddenAccountList=(0,es.d4)(selectors.Znp),isCustodial=null!=keyring&&!!keyring.type&&/Custody/u.test(keyring.type),accounts=(0,es.d4)(selectors.zi3),mmiActions=(0,institution_background.bB)(),lastItemRef=(0,react.useRef)(null),accountDetailsItemRef=(0,react.useRef)(null),removeAccountItemRef=(0,react.useRef)(null),removeJWTItemRef=(0,react.useRef)(null);(0,react.useEffect)(function(){removeJWTItemRef.current?lastItemRef.current=removeJWTItemRef.current:removeAccountItemRef.current?lastItemRef.current=removeAccountItemRef.current:lastItemRef.current=accountDetailsItemRef.current},[removeJWTItemRef.current,removeAccountItemRef.current,accountDetailsItemRef.current]);var handleKeyDown=(0,react.useCallback)(function(event){"Tab"===event.key&&event.target===lastItemRef.current&&onClose()},[onClose]),popoverDialogRef=(0,react.useRef)(null),handleClickOutside=(0,react.useCallback)(function(event){(null==popoverDialogRef?void 0:popoverDialogRef.current)&&!popoverDialogRef.current.contains(event.target)&&onClose()},[onClose]);(0,react.useEffect)(function(){return document.addEventListener("mousedown",handleClickOutside),function(){document.removeEventListener("mousedown",handleClickOutside)}},[handleClickOutside]);var handlePinning=function(address){var updatedPinnedAccountList=_to_consumable_array(pinnedAccountList).concat([address]);dispatch((0,actions.updateAccountsList)(updatedPinnedAccountList))},handleUnpinning=function(address){var updatedPinnedAccountList=pinnedAccountList.filter(function(item){return item!==address});dispatch((0,actions.updateAccountsList)(updatedPinnedAccountList))},handleHidding=function(address){var updatedHiddenAccountList=_to_consumable_array(hiddenAccountList).concat([address]);pinnedAccountList.includes(address)&&handleUnpinning(address),dispatch((0,actions.updateHiddenAccountsList)(updatedHiddenAccountList))},handleUnhidding=function(address){var updatedHiddenAccountList=hiddenAccountList.filter(function(item){return item!==address});dispatch((0,actions.updateHiddenAccountsList)(updatedHiddenAccountList))};return react.createElement(component_library.AM,{className:"multichain-account-list-item-menu__popover",referenceElement:anchorElement,role:component_library.c6.Dialog,position:component_library.$x.Bottom,offset:[0,0],padding:0,isOpen:isOpen,isPortal:!0,preventOverflow:!0,flip:!0},react.createElement(component_library.Qc,{restoreFocus:!0,initialFocusRef:anchorElement},react.createElement("div",{onKeyDown:handleKeyDown,ref:popoverDialogRef},react.createElement(menu_items.Y,{metricsLocation:METRICS_LOCATION,closeMenu:closeMenu,address:account.address,textProps:{variant:design_system.J3.bodySm}}),react.createElement(menu_items.r,{metricsLocation:METRICS_LOCATION,closeMenu:closeMenu,textProps:{variant:design_system.J3.bodySm},account:account}),isHidden?null:react.createElement(menu.D,{"data-testid":"account-list-menu-pin",onClick:function(){isPinned?handleUnpinning(account.address):handlePinning(account.address),onClose()},iconName:isPinned?component_library.$M.Unpin:component_library.$M.Pin},react.createElement(component_library.EY,{variant:design_system.J3.bodySm},t(isPinned?"unpin":"pinToTop"))),react.createElement(menu.D,{"data-testid":"account-list-menu-hide",onClick:function(){isHidden?handleUnhidding(account.address):handleHidding(account.address),onClose()},iconName:isHidden?component_library.$M.Eye:component_library.$M.EyeSlash},react.createElement(component_library.EY,{variant:design_system.J3.bodySm},t(isHidden?"showAccount":"hideAccount"))),isRemovable?react.createElement(menu.D,{ref:removeAccountItemRef,"data-testid":"account-list-menu-remove",onClick:function(){dispatch((0,actions.showModal)({name:"CONFIRM_REMOVE_ACCOUNT",account:account})),trackEvent({event:constants_metametrics.gP.AccountRemoved,category:constants_metametrics.FZ.Accounts,properties:{account_hardware_type:deviceName,chain_id:chainId,account_type:accountType}}),onClose(),null==closeMenu||closeMenu()},iconName:component_library.$M.Trash},react.createElement(component_library.EY,{variant:design_system.J3.bodySm},t("removeAccount"))):null,isCustodial?react.createElement(menu.D,{ref:removeJWTItemRef,"data-testid":"account-options-menu__remove-jwt",onClick:_async_to_generator(function(){var token,custodyAccountDetails;return _ts_generator(this,function(_state){switch(_state.label){case 0:return[4,dispatch(mmiActions.getCustodianToken(account.address))];case 1:return token=_state.sent(),[4,dispatch(mmiActions.getAllCustodianAccountsWithToken(keyring.type.split(" - ")[1],token))];case 2:return custodyAccountDetails=_state.sent(),dispatch((0,actions.showModal)({name:"CONFIRM_REMOVE_JWT",token:token,custodyAccountDetails:custodyAccountDetails,accounts:accounts,selectedAddress:(0,hexstring_utils.sX)(account.address)})),onClose(),null==closeMenu||closeMenu(),[2]}})}),iconName:component_library.$M.Trash},react.createElement(component_library.EY,{variant:design_system.J3.bodySm},t("removeJWT"))):null)))};AccountListItemMenu.propTypes={anchorElement:prop_types_default().instanceOf(window.Element),onClose:prop_types_default().func.isRequired,isOpen:prop_types_default().bool.isRequired,closeMenu:prop_types_default().func,isRemovable:prop_types_default().bool.isRequired,isPinned:prop_types_default().bool,isHidden:prop_types_default().bool,account:prop_types_default().shape({id:prop_types_default().string.isRequired,address:prop_types_default().string.isRequired,balance:prop_types_default().string.isRequired,metadata:prop_types_default().shape({name:prop_types_default().string.isRequired,snap:prop_types_default().shape({id:prop_types_default().string.isRequired,name:prop_types_default().string,enabled:prop_types_default().bool}),keyring:prop_types_default().shape({type:prop_types_default().string.isRequired}).isRequired}).isRequired}).isRequired},AccountListItemMenu.__docgenInfo={description:"",methods:[],displayName:"AccountListItemMenu",props:{anchorElement:{description:"Element that the menu should display next to",type:{name:"instanceOf",value:"window.Element"},required:!1},onClose:{description:"Function that executes when the menu is closed",type:{name:"func"},required:!0},isOpen:{description:"Represents if the menu is open or not\n\n@type {boolean}",type:{name:"bool"},required:!0},closeMenu:{description:"Function that closes the menu",type:{name:"func"},required:!1},isRemovable:{description:"Represents if the account should be removable",type:{name:"bool"},required:!0},isPinned:{description:"Represents pinned accounts",type:{name:"bool"},required:!1},isHidden:{description:"Represents hidden accounts",type:{name:"bool"},required:!1},account:{description:"An account object that has name, address, and balance data",type:{name:"shape",value:{id:{name:"string",required:!0},address:{name:"string",required:!0},balance:{name:"string",required:!0},metadata:{name:"shape",value:{name:{name:"string",required:!0},snap:{name:"shape",value:{id:{name:"string",required:!0},name:{name:"string",required:!1},enabled:{name:"bool",required:!1}},required:!1},keyring:{name:"shape",value:{type:{name:"string",required:!0}},required:!0}},required:!0}}},required:!0}}}},"./ui/components/multichain/menu-items/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Y:()=>AccountDetailsMenuItem,r:()=>view_explorer_menu_item.r});var react=__webpack_require__("./node_modules/react/index.js"),prop_types=__webpack_require__("./node_modules/prop-types/index.js"),prop_types_default=__webpack_require__.n(prop_types),es=__webpack_require__("./node_modules/react-redux/es/index.js"),actions=__webpack_require__("./ui/__mocks__/actions.js"),menu=__webpack_require__("./ui/components/ui/menu/index.js"),useI18nContext=__webpack_require__("./ui/hooks/useI18nContext.js"),metametrics=__webpack_require__("./ui/contexts/metametrics.js"),constants_metametrics=__webpack_require__("./shared/constants/metametrics.ts"),component_library=__webpack_require__("./ui/components/component-library/index.ts"),AccountDetailsMenuItem=function(param){var metricsLocation=param.metricsLocation,closeMenu=param.closeMenu,address=param.address,textProps=param.textProps,t=(0,useI18nContext.P)(),dispatch=(0,es.wA)(),trackEvent=(0,react.useContext)(metametrics.O2),LABEL=t("accountDetails");return react.createElement(menu.D,{onClick:function(){dispatch((0,actions.setAccountDetailsAddress)(address)),trackEvent({event:constants_metametrics.gP.AccountDetailsOpened,category:constants_metametrics.FZ.Navigation,properties:{location:metricsLocation}}),null==closeMenu||closeMenu()},iconName:component_library.$M.ScanBarcode,"data-testid":"account-list-menu-details"},textProps?react.createElement(component_library.EY,textProps,LABEL):LABEL)};AccountDetailsMenuItem.propTypes={metricsLocation:prop_types_default().string.isRequired,closeMenu:prop_types_default().func,address:prop_types_default().string.isRequired,textProps:prop_types_default().object},AccountDetailsMenuItem.__docgenInfo={description:"",methods:[],displayName:"AccountDetailsMenuItem",props:{metricsLocation:{description:'Represents the "location" property of the metrics event',type:{name:"string"},required:!0},closeMenu:{description:"Closes the menu",type:{name:"func"},required:!1},address:{description:"Address to show account details for",type:{name:"string"},required:!0},textProps:{description:"Custom properties for the menu item text",type:{name:"object"},required:!1}}};var view_explorer_menu_item=__webpack_require__("./ui/components/multichain/menu-items/view-explorer-menu-item.tsx")},"./ui/helpers/utils/metrics.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function getMethodName(camelCase){return camelCase&&"string"==typeof camelCase?camelCase.replace(/([a-z])([A-Z])/gu,"$1 $2").replace(/([A-Z])([a-z])/gu," $1$2").replace(RegExp(" +","gu")," "):""}function formatAccountType(accountType){return"default"===accountType?"metamask":accountType}function generateSignatureUniqueId(requestId){return"signature-".concat(requestId)}__webpack_require__.d(__webpack_exports__,{IU:()=>generateSignatureUniqueId,lU:()=>formatAccountType,zD:()=>getMethodName}),__webpack_require__("./shared/constants/security-provider.ts"),__webpack_require__("./shared/constants/metametrics.ts"),__webpack_require__("./shared/lib/transactions-controller-utils.js")},"./ui/components/multichain/menu-items/view-explorer-menu-item.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{N:()=>openBlockExplorer,r:()=>ViewExplorerMenuItem});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/react/index.js"),react_redux__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./node_modules/react-redux/es/index.js"),react_router_dom__WEBPACK_IMPORTED_MODULE_13__=__webpack_require__("./node_modules/react-router-dom/node_modules/react-router/esm/react-router.js"),_metamask_utils__WEBPACK_IMPORTED_MODULE_14__=__webpack_require__("./node_modules/@metamask/utils/dist/caip-types.mjs"),_helpers_utils_multichain_blockExplorer__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./ui/helpers/utils/multichain/blockExplorer.ts"),_ui_menu__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./ui/components/ui/menu/index.js"),_hooks_useI18nContext__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("./ui/hooks/useI18nContext.js"),_contexts_metametrics__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("./ui/contexts/metametrics.js"),_shared_constants_metametrics__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("./shared/constants/metametrics.ts"),_component_library__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("./ui/components/component-library/index.ts"),_selectors__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("./ui/selectors/index.js"),_helpers_utils_util__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("./ui/helpers/utils/util.js"),_helpers_constants_routes__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("./ui/helpers/constants/routes.ts"),_selectors_multichain__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("./ui/selectors/multichain.ts"),_hooks_useMultichainSelector__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__("./ui/hooks/useMultichainSelector.ts"),openBlockExplorer=function(addressLink,metricsLocation,trackEvent,closeMenu){trackEvent({event:_shared_constants_metametrics__WEBPACK_IMPORTED_MODULE_6__.gP.ExternalLinkClicked,category:_shared_constants_metametrics__WEBPACK_IMPORTED_MODULE_6__.FZ.Navigation,properties:{link_type:_shared_constants_metametrics__WEBPACK_IMPORTED_MODULE_6__.BD.AccountTracker,location:metricsLocation,url_domain:(0,_helpers_utils_util__WEBPACK_IMPORTED_MODULE_9__.PB)(addressLink)}}),__webpack_require__.g.platform.openTab({url:addressLink}),null==closeMenu||closeMenu()},ViewExplorerMenuItem=function(param){var metricsLocation=param.metricsLocation,closeMenu=param.closeMenu,textProps=param.textProps,account=param.account,t=(0,_hooks_useI18nContext__WEBPACK_IMPORTED_MODULE_4__.P)(),trackEvent=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(_contexts_metametrics__WEBPACK_IMPORTED_MODULE_5__.O2),history=(0,react_router_dom__WEBPACK_IMPORTED_MODULE_13__.W6)(),multichainNetwork=(0,_hooks_useMultichainSelector__WEBPACK_IMPORTED_MODULE_12__.t)(_selectors_multichain__WEBPACK_IMPORTED_MODULE_11__.X3,account),addressLink=(0,_helpers_utils_multichain_blockExplorer__WEBPACK_IMPORTED_MODULE_2__.L)(account.address,multichainNetwork),chainId=(0,_metamask_utils__WEBPACK_IMPORTED_MODULE_14__.rW)(multichainNetwork.chainId).reference,blockExplorerUrl=(0,_helpers_utils_multichain_blockExplorer__WEBPACK_IMPORTED_MODULE_2__.A)(multichainNetwork),blockExplorerUrlSubTitle=(0,_helpers_utils_util__WEBPACK_IMPORTED_MODULE_9__.PB)(blockExplorerUrl),blockExplorerLinkText=(0,react_redux__WEBPACK_IMPORTED_MODULE_1__.d4)(_selectors__WEBPACK_IMPORTED_MODULE_8__.kZk),routeToAddBlockExplorerUrl=function(){history.push("".concat(_helpers_constants_routes__WEBPACK_IMPORTED_MODULE_10__.Go,"#blockExplorerUrl"))},LABEL=t("viewOnExplorer");return react__WEBPACK_IMPORTED_MODULE_0__.createElement(_ui_menu__WEBPACK_IMPORTED_MODULE_3__.D,{onClick:function(){"addBlockExplorer"===blockExplorerLinkText.firstPart?routeToAddBlockExplorerUrl():openBlockExplorer(addressLink,metricsLocation,trackEvent,closeMenu),trackEvent({event:_shared_constants_metametrics__WEBPACK_IMPORTED_MODULE_6__.gP.BlockExplorerLinkClicked,category:_shared_constants_metametrics__WEBPACK_IMPORTED_MODULE_6__.FZ.Accounts,properties:{location:metricsLocation,chain_id:chainId}}),null==closeMenu||closeMenu()},subtitle:blockExplorerUrlSubTitle||null,iconName:_component_library__WEBPACK_IMPORTED_MODULE_7__.$M.Export,"data-testid":"account-list-menu-open-explorer"},textProps?react__WEBPACK_IMPORTED_MODULE_0__.createElement(_component_library__WEBPACK_IMPORTED_MODULE_7__.EY,textProps,LABEL):LABEL)};try{ViewExplorerMenuItem.displayName="ViewExplorerMenuItem",ViewExplorerMenuItem.__docgenInfo={description:"",displayName:"ViewExplorerMenuItem",props:{metricsLocation:{defaultValue:null,description:'Represents the "location" property of the metrics event',name:"metricsLocation",required:!0,type:{name:"string"}},closeMenu:{defaultValue:null,description:"Closes the menu",name:"closeMenu",required:!1,type:{name:"(() => void)"}},textProps:{defaultValue:null,description:"Custom properties for the menu item text",name:"textProps",required:!1,type:{name:"object"}},account:{defaultValue:null,description:"Account to show account details for",name:"account",required:!0,type:{name:'{ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" | "solana:data-account"; id: string; options: Record<string, Json>; metadata: { name: string; importTime: number; keyring: { ...; }; nameLastUpdatedAt?: number | undefined; snap?: { ...; } | undefined; lastSelected?: number | undefined; }; address: string; me...'}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["ui/components/multichain/menu-items/view-explorer-menu-item.tsx#ViewExplorerMenuItem"]={docgenInfo:ViewExplorerMenuItem.__docgenInfo,name:"ViewExplorerMenuItem",path:"ui/components/multichain/menu-items/view-explorer-menu-item.tsx#ViewExplorerMenuItem"})}catch(__react_docgen_typescript_loader_error){}},"./ui/store/institutional/institution-background.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Hq:()=>showInteractiveReplacementTokenBanner,bB:()=>mmiActionsFactory,c:()=>setPersonalMessageInProgress,vn:()=>setNoteToTraderMessage});var loglevel__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("./node_modules/loglevel/lib/loglevel.js"),loglevel__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(loglevel__WEBPACK_IMPORTED_MODULE_0__),_actions__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("./ui/store/actions.ts"),_background_connection__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("./ui/store/background-connection.ts"),_shared_modules_error__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("./shared/modules/error.ts");function _array_like_to_array(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_without_holes(arr){if(Array.isArray(arr))return _array_like_to_array(arr)}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){reject(error);return}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)})}}function _iterable_to_array(iter){if("undefined"!=typeof Symbol&&null!=iter[Symbol.iterator]||null!=iter["@@iterator"])return Array.from(iter)}function _non_iterable_spread(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _to_consumable_array(arr){return _array_without_holes(arr)||_iterable_to_array(arr)||_unsupported_iterable_to_array(arr)||_non_iterable_spread()}function _unsupported_iterable_to_array(o,minLen){if(o){if("string"==typeof o)return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if("Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}}function _ts_generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}}function showInteractiveReplacementTokenBanner(param){var _ref,url=param.url,oldRefreshToken=param.oldRefreshToken;return _ref=_async_to_generator(function(dispatch){var err;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),[4,(0,_background_connection__WEBPACK_IMPORTED_MODULE_2__.Rb)("showInteractiveReplacementTokenBanner",[{url:url,oldRefreshToken:oldRefreshToken}])];case 1:return _state.sent(),[3,3];case 2:if(err=_state.sent())throw dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.displayWarning)(err)),Error((0,_shared_modules_error__WEBPACK_IMPORTED_MODULE_3__.u1)(err));return[3,3];case 3:return[2]}})}),function(dispatch){return _ref.apply(this,arguments)}}function setNoteToTraderMessage(message){var _ref;return _ref=_async_to_generator(function(dispatch){var error;return _ts_generator(this,function(_state){switch(_state.label){case 0:return _state.trys.push([0,2,,3]),[4,(0,_background_connection__WEBPACK_IMPORTED_MODULE_2__.Rb)("setNoteToTraderMessage",[message])];case 1:return _state.sent(),[3,3];case 2:if(error=_state.sent())throw dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.displayWarning)(error.message)),Error(error.message);return[3,3];case 3:return[2]}})}),function(dispatch){return _ref.apply(this,arguments)}}function setPersonalMessageInProgress(msgId){var _ref;return _ref=_async_to_generator(function(dispatch){var error;return _ts_generator(this,function(_state){switch(_state.label){case 0:dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.showLoadingIndication)()),_state.label=1;case 1:return _state.trys.push([1,3,4,6]),[4,(0,_background_connection__WEBPACK_IMPORTED_MODULE_2__.Rb)("setPersonalMessageInProgress",[msgId])];case 2:return _state.sent(),[3,6];case 3:return error=_state.sent(),loglevel__WEBPACK_IMPORTED_MODULE_0___default().error(error),dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.displayWarning)(error)),[3,6];case 4:return[4,(0,_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState)(dispatch)];case 5:return _state.sent(),dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.hideLoadingIndication)()),[7];case 6:return[2]}})}),function(dispatch){return _ref.apply(this,arguments)}}function mmiActionsFactory(){function createAsyncAction(name,params,useForceUpdateMetamaskState,loadingText){var _ref;return loglevel__WEBPACK_IMPORTED_MODULE_0___default().debug("background.".concat(name)),_ref=_async_to_generator(function(dispatch){var result,error;return _ts_generator(this,function(_state){switch(_state.label){case 0:loadingText&&dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.showLoadingIndication)(loadingText)),_state.label=1;case 1:return _state.trys.push([1,3,,4]),[4,(0,_background_connection__WEBPACK_IMPORTED_MODULE_2__.Rb)(name,_to_consumable_array(params))];case 2:return result=_state.sent(),[3,4];case 3:if(error=_state.sent(),dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.displayWarning)(error)),(0,_shared_modules_error__WEBPACK_IMPORTED_MODULE_3__.Ef)(error))throw Error((0,_shared_modules_error__WEBPACK_IMPORTED_MODULE_3__.u1)(error));throw error;case 4:if(loadingText&&dispatch((0,_actions__WEBPACK_IMPORTED_MODULE_1__.hideLoadingIndication)()),!useForceUpdateMetamaskState)return[3,6];return[4,(0,_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState)(dispatch)];case 5:_state.sent(),_state.label=6;case 6:return[2,result]}})}),function(dispatch){return _ref.apply(this,arguments)}}function createAction(name,payload){return function(){(0,_background_connection__WEBPACK_IMPORTED_MODULE_2__.AN)(name,[payload],function(err){if((0,_shared_modules_error__WEBPACK_IMPORTED_MODULE_3__.Ef)(err))throw Error((0,_shared_modules_error__WEBPACK_IMPORTED_MODULE_3__.u1)(err))})}}return{connectCustodyAddresses:function(custodianType,custodianName,newAccounts){return createAsyncAction("connectCustodyAddresses",[custodianType,custodianName,newAccounts],_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState,"Looking for your custodian account...")},getCustodianAccounts:function(token,envName,custody,getNonImportedAccounts){return createAsyncAction("getCustodianAccounts",[token,envName,custody,getNonImportedAccounts],_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState,"Getting custodian accounts...")},getCustodianTransactionDeepLink:function(address,txId){return createAsyncAction("getCustodianTransactionDeepLink",[address,txId],_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState)},getCustodianConfirmDeepLink:function(txId){return createAsyncAction("getCustodianConfirmDeepLink",[txId],_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState)},getCustodianSignMessageDeepLink:function(from,custodyTxId){return createAsyncAction("getCustodianSignMessageDeepLink",[from,custodyTxId],_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState)},getCustodianToken:function(custody){return createAsyncAction("getCustodianToken",[custody],_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState)},getCustodianJWTList:function(custody){return createAsyncAction("getCustodianJWTList",[custody],_actions__WEBPACK_IMPORTED_MODULE_1__.forceUpdateMetamaskState)},setWaitForConfirmDeepLinkDialog:function(waitForConfirmDeepLinkDialog){return createAction("setWaitForConfirmDeepLinkDialog",waitForConfirmDeepLinkDialog)},removeAddTokenConnectRequest:function(param){return createAction("removeAddTokenConnectRequest",{origin:param.origin,environment:param.environment,token:param.token})},getMmiConfiguration:function(){return createAsyncAction("getMmiConfiguration",[])},getAllCustodianAccountsWithToken:function(custodyType,token){return createAsyncAction("getAllCustodianAccountsWithToken",[custodyType,token])},setCustodianNewRefreshToken:function(param){return createAsyncAction("setCustodianNewRefreshToken",[{address:param.address,refreshToken:param.refreshToken}])},setConnectionRequest:function(payload){return createAsyncAction("setConnectionRequest",[payload])}}}}}]);