diff --git a/packages/desktop/App.svelte b/packages/desktop/App.svelte index d49694e831a..7629198c129 100644 --- a/packages/desktop/App.svelte +++ b/packages/desktop/App.svelte @@ -27,7 +27,7 @@ setPlatform, } from '@core/app' import { showAppNotification } from '@auxiliary/notification' - import { closePopup, openPopup, popupState } from '@auxiliary/popup' + import { closePopup, openPopup, PopupId, popupState } from '@auxiliary/popup' import { initialiseOnboardingFlow } from '@contexts/onboarding' import { NetworkProtocol, NetworkType } from '@core/network' import { getLocalisedMenuItems } from './lib/helpers' @@ -127,17 +127,17 @@ }) Platform.onEvent('menu-check-for-update', () => { openPopup({ - id: 'version', + id: PopupId.Version, props: { currentVersion: $appVersionDetails.currentVersion, }, }) }) Platform.onEvent('menu-error-log', () => { - openPopup({ id: 'errorLog' }) + openPopup({ id: PopupId.ErrorLog }) }) Platform.onEvent('menu-diagnostics', () => { - openPopup({ id: 'diagnostics' }) + openPopup({ id: PopupId.Diagnostics }) }) Platform.onEvent('menu-create-developer-profile', () => { void initialiseOnboardingFlow({ diff --git a/packages/desktop/components/modals/AccountSwitcherModal.svelte b/packages/desktop/components/modals/AccountSwitcherModal.svelte index 9b98c6c2bca..107c910fd8a 100644 --- a/packages/desktop/components/modals/AccountSwitcherModal.svelte +++ b/packages/desktop/components/modals/AccountSwitcherModal.svelte @@ -8,7 +8,7 @@ import { activeProfile, visibleActiveAccounts } from '@core/profile' import { formatTokenAmountBestMatch } from '@core/wallet' import { Icon as IconEnum } from '@auxiliary/icon' - import { openPopup } from '@auxiliary/popup' + import { openPopup, PopupId } from '@auxiliary/popup' export let modal: Modal = undefined @@ -22,7 +22,7 @@ function handleCreateAccountClick(): void { modal?.close() - openPopup({ id: 'createAccount' }) + openPopup({ id: PopupId.CreateAccount }) } diff --git a/packages/desktop/components/popups/ActivityDetailsPopup.svelte b/packages/desktop/components/popups/ActivityDetailsPopup.svelte index badb8093da1..6b966355cf0 100644 --- a/packages/desktop/components/popups/ActivityDetailsPopup.svelte +++ b/packages/desktop/components/popups/ActivityDetailsPopup.svelte @@ -27,7 +27,7 @@ import { activeProfile, checkActiveProfileAuth } from '@core/profile' import { setClipboard } from '@core/utils' import { truncateString } from '@core/utils' - import { closePopup, openPopup } from '@auxiliary/popup' + import { closePopup, openPopup, PopupId } from '@auxiliary/popup' import { onMount } from 'svelte' import { ExplorerEndpoint } from '@core/network' @@ -96,7 +96,7 @@ async function claim(): Promise { await claimActivity(activity) openPopup({ - id: 'activityDetails', + id: PopupId.ActivityDetails, props: { activityId }, }) } @@ -107,7 +107,7 @@ function reject(): void { openPopup({ - id: 'confirmation', + id: PopupId.Confirmation, props: { title: localize('actions.confirmRejection.title'), description: localize('actions.confirmRejection.description'), @@ -121,7 +121,7 @@ }, onCancel: () => openPopup({ - id: 'activityDetails', + id: PopupId.ActivityDetails, props: { activityId }, }), }, diff --git a/packages/desktop/components/popups/AddProposalPopup.svelte b/packages/desktop/components/popups/AddProposalPopup.svelte index d0979af9270..b2c74e35353 100644 --- a/packages/desktop/components/popups/AddProposalPopup.svelte +++ b/packages/desktop/components/popups/AddProposalPopup.svelte @@ -11,6 +11,7 @@ import { registeredProposalsForSelectedAccount } from '@contexts/governance' import { activeAccounts } from '@core/profile' import { selectedAccount } from '@core/account' + import { PopupId } from '@auxiliary/popup' export let eventId: string export let nodeUrl: string @@ -64,7 +65,7 @@ function openNodeAuthRequiredPopup(): void { openPopup({ - id: 'nodeAuthRequired', + id: PopupId.NodeAuthRequired, props: { onSubmit: registerParticipationWrapper }, }) } diff --git a/packages/desktop/components/popups/BurnNativeTokensConfirmationPopup.svelte b/packages/desktop/components/popups/BurnNativeTokensConfirmationPopup.svelte index 4f5d27e38fe..cda64dd5ac7 100644 --- a/packages/desktop/components/popups/BurnNativeTokensConfirmationPopup.svelte +++ b/packages/desktop/components/popups/BurnNativeTokensConfirmationPopup.svelte @@ -1,7 +1,7 @@ diff --git a/packages/desktop/views/dashboard/settings/views/advanced/ErrorLog.svelte b/packages/desktop/views/dashboard/settings/views/advanced/ErrorLog.svelte index b9f286168fb..7ce3ab5fac3 100644 --- a/packages/desktop/views/dashboard/settings/views/advanced/ErrorLog.svelte +++ b/packages/desktop/views/dashboard/settings/views/advanced/ErrorLog.svelte @@ -1,10 +1,10 @@ diff --git a/packages/desktop/views/dashboard/settings/views/advanced/NetworkConfiguration.svelte b/packages/desktop/views/dashboard/settings/views/advanced/NetworkConfiguration.svelte index 0a79fcc5c83..91ef9d80e35 100644 --- a/packages/desktop/views/dashboard/settings/views/advanced/NetworkConfiguration.svelte +++ b/packages/desktop/views/dashboard/settings/views/advanced/NetworkConfiguration.svelte @@ -11,7 +11,7 @@ toggleLocalPowInClientOptions, } from '@core/network' import { activeProfile } from '@core/profile' - import { closePopup, openPopup } from '@auxiliary/popup' + import { closePopup, openPopup, PopupId } from '@auxiliary/popup' import { Button, Checkbox, HR, Text, NodeListTable, ButtonSize } from 'shared/components' let nodesContainer: HTMLElement @@ -21,7 +21,7 @@ function handleAddNodeClick(): void { openPopup({ - id: 'addNode', + id: PopupId.AddNode, props: { onSuccess: () => { closePopup() diff --git a/packages/desktop/views/dashboard/settings/views/advanced/WalletFinder.svelte b/packages/desktop/views/dashboard/settings/views/advanced/WalletFinder.svelte index 4487c4e1b4f..0fd41dbcba2 100644 --- a/packages/desktop/views/dashboard/settings/views/advanced/WalletFinder.svelte +++ b/packages/desktop/views/dashboard/settings/views/advanced/WalletFinder.svelte @@ -1,10 +1,10 @@ diff --git a/packages/desktop/views/dashboard/settings/views/security/DeleteProfile.svelte b/packages/desktop/views/dashboard/settings/views/security/DeleteProfile.svelte index f4e2523ce26..216b98e605e 100644 --- a/packages/desktop/views/dashboard/settings/views/security/DeleteProfile.svelte +++ b/packages/desktop/views/dashboard/settings/views/security/DeleteProfile.svelte @@ -1,12 +1,12 @@ diff --git a/packages/mobile/views/login/views/EnterPinView.svelte b/packages/mobile/views/login/views/EnterPinView.svelte index b6c6c4d2d99..1b378cf8d17 100644 --- a/packages/mobile/views/login/views/EnterPinView.svelte +++ b/packages/mobile/views/login/views/EnterPinView.svelte @@ -4,7 +4,7 @@ import { NetworkProtocol, NetworkType } from '@core/network' import { activeProfile, login, resetActiveProfile } from '@core/profile' import { loginRouter } from '../../../lib/routers' - import { openPopup, popupState } from '@auxiliary/popup' + import { openPopup, popupState, PopupId } from '@auxiliary/popup' import { isValidPin } from '@core/utils' import { Icon, PinInput, Profile, Text, TextType } from 'shared/components' import { onDestroy } from 'svelte' @@ -25,7 +25,7 @@ $: if (needsToAcceptLatestPrivacyPolicy() || needsToAcceptLatestTermsOfService()) { openPopup({ - type: 'legalUpdate', + id: PopupId.LegalUpdate, hideClose: true, preventClose: true, }) diff --git a/packages/shared/components/ProposalsDetails.svelte b/packages/shared/components/ProposalsDetails.svelte index fb619eec84d..20e921675d0 100644 --- a/packages/shared/components/ProposalsDetails.svelte +++ b/packages/shared/components/ProposalsDetails.svelte @@ -15,7 +15,7 @@ getNumberOfVotedProposals, getNumberOfTotalProposals, } from '@contexts/governance/utils' - import { openPopup } from '@auxiliary/popup' + import { openPopup, PopupId } from '@auxiliary/popup' import { onMount } from 'svelte' import { selectedAccount } from '@core/account' @@ -49,7 +49,7 @@ function onAddProposalClick(): void { openPopup({ - id: 'addProposal', + id: PopupId.AddProposal, overflow: true, }) } diff --git a/packages/shared/components/VotingPower.svelte b/packages/shared/components/VotingPower.svelte index ccbf9b5cbff..bd283ae1a4c 100644 --- a/packages/shared/components/VotingPower.svelte +++ b/packages/shared/components/VotingPower.svelte @@ -4,7 +4,7 @@ import { selectedAccount } from '@core/account' import { localize } from '@core/i18n' import { formatTokenAmountBestMatch, visibleSelectedAccountAssets } from '@core/wallet' - import { openPopup } from '@auxiliary/popup' + import { openPopup, PopupId } from '@auxiliary/popup' import { hasPendingGovernanceTransaction } from '@contexts/governance/stores' const asset = $visibleSelectedAccountAssets?.baseCoin @@ -17,7 +17,7 @@ function handleManageVotingPower(): void { openPopup({ - id: 'manageVotingPower', + id: PopupId.ManageVotingPower, }) } diff --git a/packages/shared/components/atoms/buttons/CreateAliasButton.svelte b/packages/shared/components/atoms/buttons/CreateAliasButton.svelte index c342720d711..effdffe8ad5 100644 --- a/packages/shared/components/atoms/buttons/CreateAliasButton.svelte +++ b/packages/shared/components/atoms/buttons/CreateAliasButton.svelte @@ -1,11 +1,11 @@ diff --git a/packages/shared/components/atoms/buttons/ExportStrongholdButton.svelte b/packages/shared/components/atoms/buttons/ExportStrongholdButton.svelte index 6014d23e5b8..c3421dee5de 100644 --- a/packages/shared/components/atoms/buttons/ExportStrongholdButton.svelte +++ b/packages/shared/components/atoms/buttons/ExportStrongholdButton.svelte @@ -2,7 +2,7 @@ import { exportStronghold } from '@contexts/settings' import { localize } from '@core/i18n' import { showAppNotification } from '@auxiliary/notification' - import { openPopup } from '@auxiliary/popup' + import { openPopup, PopupId } from '@auxiliary/popup' import { Button, ButtonSize } from 'shared/components' export let isBusy = false @@ -42,7 +42,7 @@ message = '' openPopup({ - id: 'unlockStronghold', + id: PopupId.UnlockStronghold, props: { onSuccess: (password: string) => { isBusy = true diff --git a/packages/shared/components/atoms/buttons/FaucetRequestButton.svelte b/packages/shared/components/atoms/buttons/FaucetRequestButton.svelte index 5afdc551dd6..1feec28ca94 100644 --- a/packages/shared/components/atoms/buttons/FaucetRequestButton.svelte +++ b/packages/shared/components/atoms/buttons/FaucetRequestButton.svelte @@ -1,13 +1,13 @@ diff --git a/packages/shared/components/atoms/buttons/MintNativeTokenButton.svelte b/packages/shared/components/atoms/buttons/MintNativeTokenButton.svelte index d075eccf10e..92b00437493 100644 --- a/packages/shared/components/atoms/buttons/MintNativeTokenButton.svelte +++ b/packages/shared/components/atoms/buttons/MintNativeTokenButton.svelte @@ -1,6 +1,6 @@ diff --git a/packages/shared/components/atoms/buttons/ReceiveButton.svelte b/packages/shared/components/atoms/buttons/ReceiveButton.svelte index f6f9c027d25..d6fe7a8c098 100644 --- a/packages/shared/components/atoms/buttons/ReceiveButton.svelte +++ b/packages/shared/components/atoms/buttons/ReceiveButton.svelte @@ -1,13 +1,13 @@ diff --git a/packages/shared/components/atoms/tiles/ActivityTile.svelte b/packages/shared/components/atoms/tiles/ActivityTile.svelte index 71befb6d969..72c13a15eeb 100644 --- a/packages/shared/components/atoms/tiles/ActivityTile.svelte +++ b/packages/shared/components/atoms/tiles/ActivityTile.svelte @@ -9,7 +9,7 @@ NotVerifiedStatus, ActivityAsyncStatus, } from '@core/wallet' - import { openPopup } from '@auxiliary/popup' + import { openPopup, PopupId } from '@auxiliary/popup' import { ClickableTile, TransactionActivityTileContent, @@ -34,7 +34,7 @@ function handleTransactionClick(): void { if (asset?.verification?.status === NotVerifiedStatus.New) { openPopup({ - id: 'tokenInformation', + id: PopupId.TokenInformation, overflow: true, props: { activityId: activity.id, @@ -43,7 +43,7 @@ }) } else { openPopup({ - id: 'activityDetails', + id: PopupId.ActivityDetails, props: { activityId: activity.id }, }) } diff --git a/packages/shared/components/atoms/tiles/tileFooters/AsyncActivityTileFooter.svelte b/packages/shared/components/atoms/tiles/tileFooters/AsyncActivityTileFooter.svelte index eecac271eeb..28caea219ca 100644 --- a/packages/shared/components/atoms/tiles/tileFooters/AsyncActivityTileFooter.svelte +++ b/packages/shared/components/atoms/tiles/tileFooters/AsyncActivityTileFooter.svelte @@ -22,7 +22,7 @@ import { localize } from '@core/i18n' import { showInternalVerificationPopup } from '@core/ledger' import { checkActiveProfileAuth, isActiveLedgerProfile } from '@core/profile' - import { closePopup, openPopup } from '@auxiliary/popup' + import { closePopup, openPopup, PopupId } from '@auxiliary/popup' export let activity: Activity @@ -36,7 +36,7 @@ function handleRejectClick(): void { openPopup({ - id: 'confirmation', + id: PopupId.Confirmation, props: { title: localize('actions.confirmRejection.title'), description: localize('actions.confirmRejection.description'), diff --git a/packages/shared/components/modals/AccountActionsMenu.svelte b/packages/shared/components/modals/AccountActionsMenu.svelte index 952cd265afc..d2cb92b7556 100644 --- a/packages/shared/components/modals/AccountActionsMenu.svelte +++ b/packages/shared/components/modals/AccountActionsMenu.svelte @@ -6,6 +6,7 @@ import { Icon } from '@lib/auxiliary/icon/enums' import { openPopup } from '@auxiliary/popup/actions' import { HR, MenuItem, Modal, ToggleHiddenAccountMenuItem } from 'shared/components' + import { PopupId } from '@auxiliary/popup' export let modal: Modal = undefined @@ -13,18 +14,18 @@ $selectedAccount?.index === $activeAccounts?.length - 1 && $visibleActiveAccounts?.length > 1 function handleCustomiseAccountClick(): void { - openPopup({ id: 'manageAccount' }) + openPopup({ id: PopupId.ManageAccount }) modal.close() } function onViewBalanceClick(): void { - openPopup({ id: 'balanceBreakdown' }) + openPopup({ id: PopupId.BalanceBreakdown }) modal.close() } function handleDeleteAccountClick(): void { openPopup({ - id: 'deleteAccount', + id: PopupId.DeleteAccount, props: { account: selectedAccount, deleteAccount, diff --git a/packages/shared/components/modals/AssetActionsMenu.svelte b/packages/shared/components/modals/AssetActionsMenu.svelte index 28f31969a9a..4b50acead22 100644 --- a/packages/shared/components/modals/AssetActionsMenu.svelte +++ b/packages/shared/components/modals/AssetActionsMenu.svelte @@ -11,7 +11,7 @@ VerifiedStatus, } from '@core/wallet' import { Icon } from '@lib/auxiliary/icon' - import { openPopup, updatePopupProps } from '@auxiliary/popup' + import { openPopup, PopupId, updatePopupProps } from '@auxiliary/popup' import { MenuItem, Modal } from 'shared/components' import features from '@features/features' @@ -54,7 +54,7 @@ function handleBurnToken(): void { modal.close() - openPopup({ id: 'burnNativeTokens', props: { asset } }) + openPopup({ id: PopupId.BurnNativeTokens, props: { asset } }) } diff --git a/packages/shared/components/modals/CollectibleDetailsMenu.svelte b/packages/shared/components/modals/CollectibleDetailsMenu.svelte index feb904ef12e..25b03a23139 100644 --- a/packages/shared/components/modals/CollectibleDetailsMenu.svelte +++ b/packages/shared/components/modals/CollectibleDetailsMenu.svelte @@ -7,6 +7,7 @@ import { INft, rewriteIpfsUri } from '@core/nfts' import { CollectiblesRoute, collectiblesRouter } from '@core/router' import { openUrlInBrowser } from '@core/app' + import { PopupId } from '@auxiliary/popup' export let modal: Modal = undefined export let nft: INft @@ -15,7 +16,7 @@ function openBurnNft(): void { openPopup({ - id: 'confirmation', + id: PopupId.Confirmation, props: { title: localize('actions.confirmNftBurn.title', { values: { diff --git a/packages/shared/components/modals/NodeActionsMenu.svelte b/packages/shared/components/modals/NodeActionsMenu.svelte index 206b5729fe3..7c47041ee8f 100644 --- a/packages/shared/components/modals/NodeActionsMenu.svelte +++ b/packages/shared/components/modals/NodeActionsMenu.svelte @@ -12,6 +12,7 @@ import { getOfficialNodes } from '@core/network/utils' import { activeProfile } from '@core/profile/stores' import { registerProposalsFromPrimaryNode } from '@contexts/governance/actions' + import { PopupId } from '@auxiliary/popup' export let node: INode export let clientOptions: IClientOptions @@ -25,7 +26,7 @@ function handleEditNodeDetailsClick(): void { openPopup({ - id: 'addNode', + id: PopupId.AddNode, props: { node, isEditingNode: true, @@ -40,7 +41,7 @@ async function handleTogglePrimaryNodeClick(): Promise { if (isPrimary) { openPopup({ - id: 'confirmation', + id: PopupId.Confirmation, props: { title: localize('popups.unsetAsPrimaryNode.title'), description: localize('popups.unsetAsPrimaryNode.body', { values: { url: node.url } }), @@ -63,7 +64,7 @@ function handleRemoveNodeClick(): void { openPopup({ - id: 'confirmation', + id: PopupId.Confirmation, props: { title: localize('popups.node.titleRemove'), description: localize('popups.node.removeConfirmation'), @@ -83,7 +84,7 @@ void toggleDisabledNodeInClientOptions(node) } else { openPopup({ - id: 'confirmation', + id: PopupId.Confirmation, props: { title: localize('popups.excludeNode.title'), description: localize('popups.excludeNode.body', { values: { url: node?.url } }), diff --git a/packages/shared/components/modals/ProfileActions.svelte b/packages/shared/components/modals/ProfileActions.svelte index e7cde55b93c..5e978ae31e0 100644 --- a/packages/shared/components/modals/ProfileActions.svelte +++ b/packages/shared/components/modals/ProfileActions.svelte @@ -3,7 +3,7 @@ import { Button, ButtonSize, DeveloperIndicatorPill, HR, Icon, Modal, Text, Toggle } from 'shared/components' import { localize } from '@core/i18n' import { LedgerConnectionState, ledgerConnectionState } from '@core/ledger' - import { closePopup, openPopup, popupState } from '@auxiliary/popup' + import { closePopup, openPopup, PopupId, popupState } from '@auxiliary/popup' import { routerManager } from '@core/router' import { diffDates, getBackupWarningColor, getInitials, isRecentDate } from '@core/utils' import { appVersionDetails } from '@core/app' @@ -58,13 +58,13 @@ function handleBackupClick(): void { modal?.close() openPopup({ - id: 'backupStronghold', + id: PopupId.BackupStronghold, }) } function handleVersionUpdateClick(): void { modal?.close() - openPopup({ id: 'version' }) + openPopup({ id: PopupId.Version }) } diff --git a/packages/shared/components/modals/ProposalDetailsMenu.svelte b/packages/shared/components/modals/ProposalDetailsMenu.svelte index 0e5bfdf92ec..70579daf14a 100644 --- a/packages/shared/components/modals/ProposalDetailsMenu.svelte +++ b/packages/shared/components/modals/ProposalDetailsMenu.svelte @@ -11,6 +11,7 @@ import { selectedAccount } from '@core/account/stores' // TODO: https://github.com/iotaledger/firefly/issues/5801 import features from '../../../desktop/features/features' + import { PopupId } from '@auxiliary/popup' export let modal: Modal = undefined @@ -25,7 +26,7 @@ function onRemoveProposalClick(): void { openPopup({ - id: 'removeProposal', + id: PopupId.RemoveProposal, }) modal.close() } diff --git a/packages/shared/components/molecules/AssetList.svelte b/packages/shared/components/molecules/AssetList.svelte index 31fa7e2fdc1..b296c728765 100644 --- a/packages/shared/components/molecules/AssetList.svelte +++ b/packages/shared/components/molecules/AssetList.svelte @@ -5,7 +5,7 @@ import { localize } from '@core/i18n' import { assetFilter, IAccountAssets, IAsset } from '@core/wallet' import { isVisibleAsset } from '@core/wallet/utils/isVisibleAsset' - import { openPopup } from '@auxiliary/popup' + import { openPopup, PopupId } from '@auxiliary/popup' export let assets: IAccountAssets @@ -32,7 +32,7 @@ function handleAssetTileClick(asset: IAsset): void { openPopup({ - id: 'tokenInformation', + id: PopupId.TokenInformation, overflow: true, props: { asset, diff --git a/packages/shared/components/organisms/NodeListTable.svelte b/packages/shared/components/organisms/NodeListTable.svelte index 9c20101cdf8..0593f1d9ce3 100644 --- a/packages/shared/components/organisms/NodeListTable.svelte +++ b/packages/shared/components/organisms/NodeListTable.svelte @@ -2,7 +2,7 @@ import { localize } from '@core/i18n' import { getOfficialNodes, INode, isOfficialNetwork } from '@core/network' import { activeProfile } from '@core/profile' - import { openPopup } from '@auxiliary/popup' + import { openPopup, PopupId } from '@auxiliary/popup' import { Text, NodeActionsButton, Pill } from 'shared/components' export let nodesContainer: HTMLElement = undefined @@ -15,7 +15,7 @@ function handleViewNodeInfoClick(node: INode): void { openPopup({ - id: 'nodeInfo', + id: PopupId.NodeInfo, props: { node, }, diff --git a/packages/shared/lib/auxiliary/deep-link/handlers/governance/handleDeepLinkGovernanceContext.ts b/packages/shared/lib/auxiliary/deep-link/handlers/governance/handleDeepLinkGovernanceContext.ts index f93cdd363cf..dffd68540b1 100644 --- a/packages/shared/lib/auxiliary/deep-link/handlers/governance/handleDeepLinkGovernanceContext.ts +++ b/packages/shared/lib/auxiliary/deep-link/handlers/governance/handleDeepLinkGovernanceContext.ts @@ -1,3 +1,4 @@ +import { PopupId } from '@auxiliary/popup' import { openPopup } from '@auxiliary/popup/actions' import { addError } from '@core/error/stores' import { localize } from '@core/i18n' @@ -26,7 +27,7 @@ export function handleDeepLinkGovernanceContext(url: URL): void { } } catch (err) { openPopup({ - id: 'deepLinkError', + id: PopupId.DeepLinkError, props: { error: err, url }, }) addError({ time: Date.now(), type: 'deepLink', message: `Error handling deep link. ${err.message}` }) diff --git a/packages/shared/lib/auxiliary/deep-link/handlers/governance/operations/handleDeepLinkAddProposalOperation.ts b/packages/shared/lib/auxiliary/deep-link/handlers/governance/operations/handleDeepLinkAddProposalOperation.ts index 4d33450a6c4..9775b26ea5c 100644 --- a/packages/shared/lib/auxiliary/deep-link/handlers/governance/operations/handleDeepLinkAddProposalOperation.ts +++ b/packages/shared/lib/auxiliary/deep-link/handlers/governance/operations/handleDeepLinkAddProposalOperation.ts @@ -6,6 +6,7 @@ import { AddProposalOperationParameter } from '../../../enums' import { registeredProposalsForSelectedAccount, selectedProposal } from '@contexts/governance/stores' import { GovernanceRoute, governanceRouter } from '@core/router' import { get } from 'svelte/store' +import { PopupId } from '@auxiliary/popup' /** * NOTE: If we throw an error as normal, it will be handled and displayed in the "failed link" @@ -39,7 +40,7 @@ export function handleDeepLinkAddProposalOperation(searchParams: URLSearchParams } openPopup({ - id: 'addProposal', + id: PopupId.AddProposal, props: { eventId, nodeUrl }, }) } diff --git a/packages/shared/lib/auxiliary/deep-link/handlers/handleDeepLink.ts b/packages/shared/lib/auxiliary/deep-link/handlers/handleDeepLink.ts index d4017e965b1..61893b5b6a9 100644 --- a/packages/shared/lib/auxiliary/deep-link/handlers/handleDeepLink.ts +++ b/packages/shared/lib/auxiliary/deep-link/handlers/handleDeepLink.ts @@ -12,6 +12,7 @@ import { isDeepLinkRequestActive } from '../stores' import { handleDeepLinkGovernanceContext } from './governance/handleDeepLinkGovernanceContext' import { handleDeepLinkWalletContext } from './wallet/handleDeepLinkWalletContext' import { handleError } from '@core/error/handlers' +import { PopupId } from '@auxiliary/popup' /** * Parses an IOTA deep link, i.e. a URL that begins with the app protocol i.e "firefly://". @@ -34,7 +35,7 @@ export function handleDeepLink(input: string): void { if (get(visibleActiveAccounts).length > 1) { openPopup({ - id: 'accountSwitcher', + id: PopupId.AccountSwitcher, overflow: true, props: { onConfirm: () => { diff --git a/packages/shared/lib/auxiliary/deep-link/handlers/wallet/handleDeepLinkWalletContext.ts b/packages/shared/lib/auxiliary/deep-link/handlers/wallet/handleDeepLinkWalletContext.ts index b3c83f0e37a..410e56d2614 100644 --- a/packages/shared/lib/auxiliary/deep-link/handlers/wallet/handleDeepLinkWalletContext.ts +++ b/packages/shared/lib/auxiliary/deep-link/handlers/wallet/handleDeepLinkWalletContext.ts @@ -1,3 +1,4 @@ +import { PopupId } from '@auxiliary/popup' import { openPopup } from '@auxiliary/popup/actions' import { addError } from '@core/error/stores' import { localize } from '@core/i18n' @@ -39,7 +40,7 @@ export function handleDeepLinkWalletContext(url: URL): void { } } catch (err) { openPopup({ - id: 'deepLinkError', + id: PopupId.DeepLinkError, props: { error: err, url }, }) addError({ time: Date.now(), type: 'deepLink', message: `Error handling deep link. ${err.message}` }) diff --git a/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendConfirmationOperation.ts b/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendConfirmationOperation.ts index 72e911f1a02..9bb95fad9e0 100644 --- a/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendConfirmationOperation.ts +++ b/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendConfirmationOperation.ts @@ -10,7 +10,7 @@ import { setNewTransactionDetails, Subject, } from '@core/wallet' -import { openPopup } from '@auxiliary/popup' +import { openPopup, PopupId } from '@auxiliary/popup' import { SendOperationParameter } from '../../../enums' import { @@ -29,7 +29,7 @@ export function handleDeepLinkSendConfirmationOperation(searchParams: URLSearchP if (transactionDetails) { setNewTransactionDetails(transactionDetails) openPopup({ - id: 'sendConfirmation', + id: PopupId.SendConfirmation, overflow: true, props: { disableBack: true, diff --git a/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendFormOperation.ts b/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendFormOperation.ts index 9fd84edfbf4..81a2c89810b 100644 --- a/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendFormOperation.ts +++ b/packages/shared/lib/auxiliary/deep-link/handlers/wallet/operations/handleDeepLinkSendFormOperation.ts @@ -6,7 +6,7 @@ import { getAssetById, NewTransactionType, } from '@core/wallet' -import { openPopup } from '@auxiliary/popup' +import { openPopup, PopupId } from '@auxiliary/popup' import { get } from 'svelte/store' import { SendOperationParameter } from '../../../enums' @@ -19,7 +19,7 @@ export function handleDeepLinkSendFormOperation(searchParams: URLSearchParams): if (transactionDetails) { setNewTransactionDetails(transactionDetails) openPopup({ - id: 'sendForm', + id: PopupId.SendForm, overflow: true, }) } diff --git a/packages/shared/lib/auxiliary/popup/interfaces/popup-state.interface.ts b/packages/shared/lib/auxiliary/popup/interfaces/popup-state.interface.ts index 570ca465cd1..44db7fc1a02 100644 --- a/packages/shared/lib/auxiliary/popup/interfaces/popup-state.interface.ts +++ b/packages/shared/lib/auxiliary/popup/interfaces/popup-state.interface.ts @@ -3,7 +3,7 @@ import { PopupProps } from '../types' export interface IPopupState { active: boolean - id: PopupId | string + id: PopupId hideClose?: boolean preventClose?: boolean fullScreen?: boolean diff --git a/packages/shared/lib/core/app/utils/openUrlInBrowser.ts b/packages/shared/lib/core/app/utils/openUrlInBrowser.ts index 14367098aaf..4195abfbd10 100644 --- a/packages/shared/lib/core/app/utils/openUrlInBrowser.ts +++ b/packages/shared/lib/core/app/utils/openUrlInBrowser.ts @@ -1,4 +1,4 @@ -import { closePopup, openPopup } from '@auxiliary/popup' +import { closePopup, openPopup, PopupId } from '@auxiliary/popup' import { localize } from '@core/i18n' import { Platform } from '../classes/platform.class' import { externalAllowedLinks } from '../constants' @@ -20,7 +20,7 @@ export function openUrlInBrowser(targetUrl: string): void { openHttpsUrlsOnly(url.protocol, targetUrl) } else { openPopup({ - id: 'confirmation', + id: PopupId.Confirmation, props: { title: localize('popups.externalUrl.title'), description: localize('popups.externalUrl.body', { values: { url: targetUrl } }), diff --git a/packages/shared/lib/core/ledger/actions/checkOrConnectLedger.ts b/packages/shared/lib/core/ledger/actions/checkOrConnectLedger.ts index c1e067b1c02..d00727e50c3 100644 --- a/packages/shared/lib/core/ledger/actions/checkOrConnectLedger.ts +++ b/packages/shared/lib/core/ledger/actions/checkOrConnectLedger.ts @@ -1,4 +1,4 @@ -import { openPopup, popupState } from '@auxiliary/popup' +import { openPopup, PopupId, popupState } from '@auxiliary/popup' import { get } from 'svelte/store' import { LedgerConnectionState } from '../interfaces' import { ledgerConnectionState } from '../stores' @@ -22,7 +22,7 @@ export function checkOrConnectLedger( return callback() } else { openPopup({ - id: 'connectLedger', + id: PopupId.ConnectLedger, hideClose: true, props: { onContinue: _callback, diff --git a/packages/shared/lib/core/ledger/utils/handleLedgerError.ts b/packages/shared/lib/core/ledger/utils/handleLedgerError.ts index 826382af109..53193b07eb9 100644 --- a/packages/shared/lib/core/ledger/utils/handleLedgerError.ts +++ b/packages/shared/lib/core/ledger/utils/handleLedgerError.ts @@ -5,7 +5,7 @@ import { resetNewTokenTransactionDetails, resetMintTokenDetails, resetMintNftDet import { IError } from '@core/error/interfaces' import { handleGenericError } from '@core/error/handlers' import { showAppNotification } from '@auxiliary/notification' -import { closePopup, openPopup, popupState } from '@auxiliary/popup' +import { closePopup, openPopup, PopupId, popupState } from '@auxiliary/popup' import { LEDGER_ERROR_LOCALES } from '../constants' import { LedgerError } from '../enums' @@ -39,7 +39,7 @@ export function handleLedgerError(error: IError, resetConfirmationPropsOnDenial const hadToEnableBlindSinging = popupType === 'enableLedgerBlindSigning' && wasDeniedByUser if (hadToEnableBlindSinging) { openPopup({ - id: 'enableLedgerBlindSigning', + id: PopupId.EnableLedgerBlindSigning, }) } else { showAppNotification({ diff --git a/packages/shared/lib/core/ledger/utils/openLedgerNotConnectedPopup.ts b/packages/shared/lib/core/ledger/utils/openLedgerNotConnectedPopup.ts index c70339cd2ad..33c90c6fd7b 100644 --- a/packages/shared/lib/core/ledger/utils/openLedgerNotConnectedPopup.ts +++ b/packages/shared/lib/core/ledger/utils/openLedgerNotConnectedPopup.ts @@ -1,5 +1,5 @@ import { get } from 'svelte/store' -import { openPopup, popupState } from '@auxiliary/popup' +import { openPopup, PopupId, popupState } from '@auxiliary/popup' export function openLedgerNotConnectedPopup( cancel: () => void = () => {}, @@ -8,7 +8,7 @@ export function openLedgerNotConnectedPopup( ): void { if (!get(popupState).active || overridePopup) { openPopup({ - id: 'connectLedger', + id: PopupId.ConnectLedger, props: { onClose: () => cancel(), onPoll: () => poll(), diff --git a/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionInclusionEvent.ts b/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionInclusionEvent.ts index 502a1590a50..5b0dbd036ba 100644 --- a/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionInclusionEvent.ts +++ b/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionInclusionEvent.ts @@ -18,6 +18,7 @@ import { WalletApiEvent } from '../../enums' import { ITransactionInclusionEventPayload } from '../../interfaces' import { validateWalletApiEvent } from '../../utils' import { closePopup, openPopup } from '@auxiliary/popup/actions' +import { PopupId } from '@auxiliary/popup' export function handleTransactionInclusionEvent(error: Error, rawEvent: string): void { const { accountIndex, payload } = validateWalletApiEvent(error, rawEvent, WalletApiEvent.TransactionInclusion) @@ -49,7 +50,7 @@ export function handleTransactionInclusionEventInternal( if (get(hasToRevote)) { openPopup({ - id: 'revote', + id: PopupId.Revote, preventClose: true, hideClose: true, }) diff --git a/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionProgressEvent.ts b/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionProgressEvent.ts index 23575677644..29f50948209 100644 --- a/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionProgressEvent.ts +++ b/packages/shared/lib/core/profile-manager/actions/events-handlers/handleTransactionProgressEvent.ts @@ -3,7 +3,7 @@ import { selectedAccountIndex } from '@core/account' import { ledgerNanoStatus } from '@core/ledger' import { isActiveLedgerProfile } from '@core/profile' import { isOnboardingLedgerProfile } from '@contexts/onboarding' -import { closePopup, openPopup } from '@auxiliary/popup' +import { closePopup, openPopup, PopupId } from '@auxiliary/popup' import { deconstructLedgerVerificationProps } from '@core/ledger/helpers' import { WalletApiEvent } from '../../enums' @@ -37,7 +37,7 @@ function openPopupIfVerificationNeeded(payload: TransactionProgressEventPayload) if (payload) { if (isPreparedTransaction(payload)) { openPopup({ - id: 'verifyLedgerTransaction', + id: PopupId.VerifyLedgerTransaction, hideClose: true, preventClose: true, props: { @@ -47,7 +47,7 @@ function openPopupIfVerificationNeeded(payload: TransactionProgressEventPayload) } else if (isPreparedTransactionEssenceHash(payload)) { if (get(ledgerNanoStatus)?.blindSigningEnabled) { openPopup({ - id: 'verifyLedgerTransaction', + id: PopupId.VerifyLedgerTransaction, hideClose: true, preventClose: true, props: { @@ -56,7 +56,7 @@ function openPopupIfVerificationNeeded(payload: TransactionProgressEventPayload) }) } else { openPopup({ - id: 'enableLedgerBlindSigning', + id: PopupId.EnableLedgerBlindSigning, hideClose: true, preventClose: true, }) diff --git a/packages/shared/lib/core/stronghold/actions/checkOrUnlockStronghold.ts b/packages/shared/lib/core/stronghold/actions/checkOrUnlockStronghold.ts index 17329ce0fc5..c0b12984eaa 100644 --- a/packages/shared/lib/core/stronghold/actions/checkOrUnlockStronghold.ts +++ b/packages/shared/lib/core/stronghold/actions/checkOrUnlockStronghold.ts @@ -1,5 +1,5 @@ import { isStrongholdUnlocked } from '@core/profile-manager' -import { closePopup, openPopup, popupState } from '@auxiliary/popup' +import { closePopup, openPopup, PopupId, popupState } from '@auxiliary/popup' import { get } from 'svelte/store' import { handleError } from '@core/error/handlers/handleError' @@ -22,7 +22,7 @@ export async function checkOrUnlockStronghold( } else { closePopup(true) openPopup({ - id: 'unlockStronghold', + id: PopupId.UnlockStronghold, props: { onSuccess: _callback, },