From 6bfddb09e8cc0d2c76ee51e476b4f380791b270e Mon Sep 17 00:00:00 2001 From: Jaco Date: Thu, 9 Mar 2023 11:04:13 +0200 Subject: [PATCH] Use .js imports in src (#1224) * Use .js imports in src * Bump dev * Add WP extension aliases --- package.json | 2 +- .../src/background/RequestBytesSign.ts | 2 +- .../src/background/RequestExtrinsicSign.ts | 2 +- .../src/background/handlers/Extension.spec.ts | 8 +- .../src/background/handlers/Extension.ts | 8 +- .../src/background/handlers/State.ts | 6 +- .../src/background/handlers/Tabs.ts | 12 +- .../src/background/handlers/index.ts | 10 +- .../src/background/handlers/subscriptions.ts | 2 +- .../extension-base/src/background/types.ts | 4 +- packages/extension-base/src/bundle.ts | 2 +- packages/extension-base/src/detectPackage.ts | 4 +- packages/extension-base/src/index.ts | 2 +- packages/extension-base/src/page/Accounts.ts | 2 +- packages/extension-base/src/page/Injected.ts | 10 +- packages/extension-base/src/page/Metadata.ts | 2 +- .../src/page/PostMessageProvider.ts | 2 +- packages/extension-base/src/page/Signer.ts | 2 +- packages/extension-base/src/page/index.ts | 6 +- .../extension-base/src/stores/Accounts.ts | 4 +- .../extension-base/src/stores/Metadata.ts | 4 +- packages/extension-base/src/stores/index.ts | 4 +- packages/extension-base/src/utils/getId.ts | 2 +- packages/extension-base/src/utils/index.ts | 2 +- packages/extension-chains/src/bundle.ts | 4 +- .../extension-chains/src/detectPackage.ts | 4 +- packages/extension-chains/src/index.ts | 2 +- .../extension-compat-metamask/src/bundle.ts | 2 +- .../src/detectPackage.ts | 4 +- .../extension-compat-metamask/src/index.ts | 2 +- packages/extension-dapp/src/bundle.ts | 6 +- packages/extension-dapp/src/detectPackage.ts | 4 +- packages/extension-dapp/src/index.ts | 2 +- packages/extension-dapp/src/wrapBytes.spec.ts | 2 +- packages/extension-inject/src/bundle.ts | 6 +- .../extension-inject/src/detectPackage.ts | 4 +- packages/extension-inject/src/index.ts | 2 +- .../src/Popup/Accounts/Account.spec.tsx | 8 +- .../src/Popup/Accounts/Account.tsx | 12 +- .../src/Popup/Accounts/AccountsTree.tsx | 4 +- .../src/Popup/Accounts/AddAccount.tsx | 12 +- .../src/Popup/Accounts/AddAccountImage.tsx | 4 +- .../extension-ui/src/Popup/Accounts/index.tsx | 14 +-- .../AuthManagement/AccountManagement.tsx | 14 +-- .../src/Popup/AuthManagement/WebsiteEntry.tsx | 4 +- .../src/Popup/AuthManagement/index.tsx | 12 +- .../src/Popup/Authorize/Authorize.spec.tsx | 12 +- .../src/Popup/Authorize/NoAccount.tsx | 4 +- .../src/Popup/Authorize/Request.tsx | 14 +-- .../src/Popup/Authorize/index.tsx | 12 +- .../CreateAccount/CreateAccount.spec.tsx | 10 +- .../src/Popup/CreateAccount/Mnemonic.tsx | 6 +- .../src/Popup/CreateAccount/index.tsx | 20 ++-- .../src/Popup/Derive/AddressDropdown.tsx | 8 +- .../src/Popup/Derive/DerivationPath.tsx | 8 +- .../src/Popup/Derive/Derive.spec.tsx | 12 +- .../src/Popup/Derive/SelectParent.tsx | 12 +- .../extension-ui/src/Popup/Derive/index.tsx | 10 +- .../extension-ui/src/Popup/Export.spec.tsx | 8 +- packages/extension-ui/src/Popup/Export.tsx | 12 +- packages/extension-ui/src/Popup/ExportAll.tsx | 12 +- packages/extension-ui/src/Popup/Forget.tsx | 12 +- .../extension-ui/src/Popup/ImportLedger.tsx | 16 +-- .../extension-ui/src/Popup/ImportQr.spec.tsx | 8 +- packages/extension-ui/src/Popup/ImportQr.tsx | 10 +- .../src/Popup/ImportSeed/ImportSeed.spec.tsx | 8 +- .../src/Popup/ImportSeed/SeedAndPath.tsx | 12 +- .../src/Popup/ImportSeed/index.tsx | 16 +-- .../src/Popup/Metadata/Request.tsx | 12 +- .../extension-ui/src/Popup/Metadata/index.tsx | 8 +- .../src/Popup/PhishingDetected.tsx | 8 +- .../extension-ui/src/Popup/RestoreJson.tsx | 14 +-- .../extension-ui/src/Popup/Signing/Bytes.tsx | 6 +- .../src/Popup/Signing/Extrinsic.tsx | 6 +- .../src/Popup/Signing/LedgerSign.tsx | 8 +- .../extension-ui/src/Popup/Signing/Qr.tsx | 8 +- .../src/Popup/Signing/Request/SignArea.tsx | 10 +- .../src/Popup/Signing/Request/index.tsx | 16 +-- .../src/Popup/Signing/Signing.spec.tsx | 20 ++-- .../src/Popup/Signing/TransactionIndex.tsx | 4 +- .../extension-ui/src/Popup/Signing/Unlock.tsx | 4 +- .../extension-ui/src/Popup/Signing/index.tsx | 10 +- packages/extension-ui/src/Popup/Welcome.tsx | 10 +- packages/extension-ui/src/Popup/index.tsx | 46 +++---- .../AccountNamePasswordCreation.spec.tsx | 6 +- .../AccountNamePasswordCreation.tsx | 4 +- .../extension-ui/src/components/ActionBar.tsx | 2 +- .../src/components/ActionText.tsx | 4 +- .../src/components/Address.spec.tsx | 16 +-- .../extension-ui/src/components/Address.tsx | 26 ++-- .../src/components/BackButton.tsx | 6 +- packages/extension-ui/src/components/Box.tsx | 4 +- .../extension-ui/src/components/Button.tsx | 6 +- .../src/components/ButtonArea.tsx | 4 +- .../src/components/ButtonWithSubtitle.tsx | 4 +- .../extension-ui/src/components/Checkbox.tsx | 4 +- .../extension-ui/src/components/Dropdown.tsx | 6 +- .../src/components/ErrorBoundary.tsx | 10 +- packages/extension-ui/src/components/Icon.tsx | 2 +- .../extension-ui/src/components/Identicon.tsx | 4 +- .../src/components/InputFileWithLabel.tsx | 8 +- .../src/components/InputFilter.tsx | 6 +- .../src/components/InputWithLabel.tsx | 10 +- .../extension-ui/src/components/Label.tsx | 4 +- packages/extension-ui/src/components/Link.tsx | 4 +- packages/extension-ui/src/components/List.tsx | 4 +- .../extension-ui/src/components/Loading.tsx | 2 +- packages/extension-ui/src/components/Main.tsx | 4 +- packages/extension-ui/src/components/Menu.tsx | 4 +- .../src/components/MenuDivider.tsx | 4 +- .../extension-ui/src/components/MenuItem.tsx | 4 +- .../src/components/MnemonicSeed.tsx | 10 +- .../src/components/NextStepButton.tsx | 6 +- .../src/components/RemoveAuth.tsx | 4 +- .../extension-ui/src/components/Spinner.tsx | 4 +- packages/extension-ui/src/components/Svg.tsx | 4 +- .../extension-ui/src/components/Switch.tsx | 4 +- .../extension-ui/src/components/Table.tsx | 4 +- .../src/components/TextAreaWithLabel.tsx | 4 +- .../extension-ui/src/components/TextInputs.ts | 4 +- .../src/components/Toast/Toast.tsx | 4 +- .../src/components/Toast/ToastProvider.tsx | 4 +- .../src/components/ValidatedInput.tsx | 6 +- .../src/components/VerticalSpace.tsx | 2 +- packages/extension-ui/src/components/View.tsx | 4 +- .../extension-ui/src/components/Warning.tsx | 4 +- packages/extension-ui/src/components/index.ts | 80 ++++++------- packages/extension-ui/src/createView.tsx | 4 +- .../src/hooks/useGenesisHashOptions.ts | 6 +- packages/extension-ui/src/hooks/useLedger.ts | 4 +- .../extension-ui/src/hooks/useMetadata.ts | 2 +- packages/extension-ui/src/hooks/useToast.tsx | 2 +- packages/extension-ui/src/i18n/Backend.ts | 2 +- packages/extension-ui/src/i18n/i18n.ts | 2 +- packages/extension-ui/src/index.ts | 4 +- packages/extension-ui/src/messaging.spec.ts | 2 +- packages/extension-ui/src/messaging.ts | 4 +- .../src/partials/AccountSelection.tsx | 10 +- .../extension-ui/src/partials/Header.spec.tsx | 6 +- packages/extension-ui/src/partials/Header.tsx | 22 ++-- .../src/partials/HeaderWithSteps.tsx | 8 +- .../extension-ui/src/partials/MenuAdd.tsx | 14 +-- .../src/partials/MenuSettings.tsx | 14 +-- packages/extension-ui/src/partials/Name.tsx | 6 +- .../extension-ui/src/partials/Password.tsx | 6 +- packages/extension-ui/src/partials/index.ts | 12 +- packages/extension-ui/src/styled.ts | 8 +- packages/extension-ui/src/types.ts | 2 +- .../src/util/buildHierarchy.spec.ts | 2 +- .../extension-ui/src/util/buildHierarchy.ts | 2 +- .../extension-ui/src/util/getNetworkMap.ts | 2 +- .../src/util/nextDerivationPath.spec.ts | 2 +- packages/extension/package.json | 2 +- packages/extension/src/detectPackage.ts | 4 +- packages/extension/src/page.ts | 2 +- packages/extension/webpack.shared.cjs | 3 + yarn.lock | 112 +++++++++--------- 157 files changed, 624 insertions(+), 621 deletions(-) diff --git a/package.json b/package.json index 76e7211934..4536444b10 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "devDependencies": { "@babel/core": "^7.21.0", - "@polkadot/dev": "^0.70.4", + "@polkadot/dev": "^0.71.1", "@types/node": "^18.14.5", "i18next-scanner": "^4.1.1", "sinon-chrome": "^3.0.1" diff --git a/packages/extension-base/src/background/RequestBytesSign.ts b/packages/extension-base/src/background/RequestBytesSign.ts index ab306b0b95..b9860fdf8a 100644 --- a/packages/extension-base/src/background/RequestBytesSign.ts +++ b/packages/extension-base/src/background/RequestBytesSign.ts @@ -4,7 +4,7 @@ import type { KeyringPair } from '@polkadot/keyring/types'; import type { SignerPayloadRaw } from '@polkadot/types/types'; import type { HexString } from '@polkadot/util/types'; -import type { RequestSign } from './types'; +import type { RequestSign } from './types.js'; import { wrapBytes } from '@polkadot/extension-dapp/wrapBytes'; import { TypeRegistry } from '@polkadot/types'; diff --git a/packages/extension-base/src/background/RequestExtrinsicSign.ts b/packages/extension-base/src/background/RequestExtrinsicSign.ts index 86fe8ad524..188cfff0c1 100644 --- a/packages/extension-base/src/background/RequestExtrinsicSign.ts +++ b/packages/extension-base/src/background/RequestExtrinsicSign.ts @@ -4,7 +4,7 @@ import type { KeyringPair } from '@polkadot/keyring/types'; import type { SignerPayloadJSON } from '@polkadot/types/types'; import type { HexString } from '@polkadot/util/types'; -import type { RequestSign } from './types'; +import type { RequestSign } from './types.js'; import { TypeRegistry } from '@polkadot/types'; diff --git a/packages/extension-base/src/background/handlers/Extension.spec.ts b/packages/extension-base/src/background/handlers/Extension.spec.ts index 9b78402dc6..1cff0968ce 100644 --- a/packages/extension-base/src/background/handlers/Extension.spec.ts +++ b/packages/extension-base/src/background/handlers/Extension.spec.ts @@ -16,10 +16,10 @@ import { TypeRegistry } from '@polkadot/types'; import keyring from '@polkadot/ui-keyring'; import { cryptoWaitReady } from '@polkadot/util-crypto'; -import { AccountsStore } from '../../stores'; -import Extension from './Extension'; -import State, { AuthUrls } from './State'; -import Tabs from './Tabs'; +import { AccountsStore } from '../../stores/index.js'; +import Extension from './Extension.js'; +import State, { AuthUrls } from './State.js'; +import Tabs from './Tabs.js'; describe('Extension', () => { let extension: Extension; diff --git a/packages/extension-base/src/background/handlers/Extension.ts b/packages/extension-base/src/background/handlers/Extension.ts index 8ed11042b4..801f428f7a 100644 --- a/packages/extension-base/src/background/handlers/Extension.ts +++ b/packages/extension-base/src/background/handlers/Extension.ts @@ -6,7 +6,7 @@ import type { KeyringPair, KeyringPair$Json, KeyringPair$Meta } from '@polkadot/ import type { Registry, SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types'; import type { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; import type { KeypairType } from '@polkadot/util-crypto/types'; -import type { AccountJson, AllowedPath, AuthorizeRequest, MessageTypes, MetadataRequest, RequestAccountBatchExport, RequestAccountChangePassword, RequestAccountCreateExternal, RequestAccountCreateHardware, RequestAccountCreateSuri, RequestAccountEdit, RequestAccountExport, RequestAccountForget, RequestAccountShow, RequestAccountTie, RequestAccountValidate, RequestActiveTabsUrlUpdate, RequestAuthorizeApprove, RequestBatchRestore, RequestDeriveCreate, RequestDeriveValidate, RequestJsonRestore, RequestMetadataApprove, RequestMetadataReject, RequestSeedCreate, RequestSeedValidate, RequestSigningApprovePassword, RequestSigningApproveSignature, RequestSigningCancel, RequestSigningIsLocked, RequestTypes, RequestUpdateAuthorizedAccounts, ResponseAccountExport, ResponseAccountsExport, ResponseAuthorizeList, ResponseDeriveValidate, ResponseJsonGetAccountInfo, ResponseSeedCreate, ResponseSeedValidate, ResponseSigningIsLocked, ResponseType, SigningRequest } from '../types'; +import type { AccountJson, AllowedPath, AuthorizeRequest, MessageTypes, MetadataRequest, RequestAccountBatchExport, RequestAccountChangePassword, RequestAccountCreateExternal, RequestAccountCreateHardware, RequestAccountCreateSuri, RequestAccountEdit, RequestAccountExport, RequestAccountForget, RequestAccountShow, RequestAccountTie, RequestAccountValidate, RequestActiveTabsUrlUpdate, RequestAuthorizeApprove, RequestBatchRestore, RequestDeriveCreate, RequestDeriveValidate, RequestJsonRestore, RequestMetadataApprove, RequestMetadataReject, RequestSeedCreate, RequestSeedValidate, RequestSigningApprovePassword, RequestSigningApproveSignature, RequestSigningCancel, RequestSigningIsLocked, RequestTypes, RequestUpdateAuthorizedAccounts, ResponseAccountExport, ResponseAccountsExport, ResponseAuthorizeList, ResponseDeriveValidate, ResponseJsonGetAccountInfo, ResponseSeedCreate, ResponseSeedValidate, ResponseSigningIsLocked, ResponseType, SigningRequest } from '../types.js'; import { ALLOWED_PATH, PASSWORD_EXPIRY_MS } from '@polkadot/extension-base/defaults'; import { metadataExpand } from '@polkadot/extension-chains'; @@ -16,9 +16,9 @@ import { accounts as accountsObservable } from '@polkadot/ui-keyring/observable/ import { assert, isHex } from '@polkadot/util'; import { keyExtractSuri, mnemonicGenerate, mnemonicValidate } from '@polkadot/util-crypto'; -import { withErrorLog } from './helpers'; -import State, { AuthorizedAccountsDiff } from './State'; -import { createSubscription, unsubscribe } from './subscriptions'; +import { withErrorLog } from './helpers.js'; +import State, { AuthorizedAccountsDiff } from './State.js'; +import { createSubscription, unsubscribe } from './subscriptions.js'; type CachedUnlocks = Record; diff --git a/packages/extension-base/src/background/handlers/State.ts b/packages/extension-base/src/background/handlers/State.ts index 0ae140dfd7..29486486ff 100644 --- a/packages/extension-base/src/background/handlers/State.ts +++ b/packages/extension-base/src/background/handlers/State.ts @@ -3,7 +3,7 @@ import type { MetadataDef, ProviderMeta } from '@polkadot/extension-inject/types'; import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types'; -import type { AccountJson, AuthorizeRequest, MetadataRequest, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestSign, ResponseRpcListProviders, ResponseSigning, SigningRequest } from '../types'; +import type { AccountJson, AuthorizeRequest, MetadataRequest, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestSign, ResponseRpcListProviders, ResponseSigning, SigningRequest } from '../types.js'; import { BehaviorSubject } from 'rxjs'; @@ -13,8 +13,8 @@ import { knownGenesis } from '@polkadot/networks/defaults'; import settings from '@polkadot/ui-settings'; import { assert } from '@polkadot/util'; -import { MetadataStore } from '../../stores'; -import { withErrorLog } from './helpers'; +import { MetadataStore } from '../../stores/index.js'; +import { withErrorLog } from './helpers.js'; interface Resolver { reject: (error: Error) => void; diff --git a/packages/extension-base/src/background/handlers/Tabs.ts b/packages/extension-base/src/background/handlers/Tabs.ts index df1b285983..20657c0247 100644 --- a/packages/extension-base/src/background/handlers/Tabs.ts +++ b/packages/extension-base/src/background/handlers/Tabs.ts @@ -7,7 +7,7 @@ import type { KeyringPair } from '@polkadot/keyring/types'; import type { JsonRpcResponse } from '@polkadot/rpc-provider/types'; import type { SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types'; import type { SubjectInfo } from '@polkadot/ui-keyring/observable/types'; -import type { MessageTypes, RequestAccountList, RequestAccountUnsubscribe, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestTypes, ResponseRpcListProviders, ResponseSigning, ResponseTypes, SubscriptionMessageTypes } from '../types'; +import type { MessageTypes, RequestAccountList, RequestAccountUnsubscribe, RequestAuthorizeTab, RequestRpcSend, RequestRpcSubscribe, RequestRpcUnsubscribe, RequestTypes, ResponseRpcListProviders, ResponseSigning, ResponseTypes, SubscriptionMessageTypes } from '../types.js'; import { PHISHING_PAGE_REDIRECT } from '@polkadot/extension-base/defaults'; import { canDerive } from '@polkadot/extension-base/utils'; @@ -16,11 +16,11 @@ import keyring from '@polkadot/ui-keyring'; import { accounts as accountsObservable } from '@polkadot/ui-keyring/observable/accounts'; import { assert, isNumber } from '@polkadot/util'; -import RequestBytesSign from '../RequestBytesSign'; -import RequestExtrinsicSign from '../RequestExtrinsicSign'; -import { withErrorLog } from './helpers'; -import State, { AuthResponse } from './State'; -import { createSubscription, unsubscribe } from './subscriptions'; +import RequestBytesSign from '../RequestBytesSign.js'; +import RequestExtrinsicSign from '../RequestExtrinsicSign.js'; +import { withErrorLog } from './helpers.js'; +import State, { AuthResponse } from './State.js'; +import { createSubscription, unsubscribe } from './subscriptions.js'; interface AccountSub { subscription: Subscription; diff --git a/packages/extension-base/src/background/handlers/index.ts b/packages/extension-base/src/background/handlers/index.ts index 916f92bf4c..43adc5ebac 100644 --- a/packages/extension-base/src/background/handlers/index.ts +++ b/packages/extension-base/src/background/handlers/index.ts @@ -1,14 +1,14 @@ // Copyright 2019-2023 @polkadot/extension authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { MessageTypes, TransportRequestMessage } from '../types'; +import type { MessageTypes, TransportRequestMessage } from '../types.js'; import { assert } from '@polkadot/util'; -import { PORT_EXTENSION } from '../../defaults'; -import Extension from './Extension'; -import State from './State'; -import Tabs from './Tabs'; +import { PORT_EXTENSION } from '../../defaults.js'; +import Extension from './Extension.js'; +import State from './State.js'; +import Tabs from './Tabs.js'; const state = new State(); const extension = new Extension(state); diff --git a/packages/extension-base/src/background/handlers/subscriptions.ts b/packages/extension-base/src/background/handlers/subscriptions.ts index 70c136a5a6..cd0447ca9a 100644 --- a/packages/extension-base/src/background/handlers/subscriptions.ts +++ b/packages/extension-base/src/background/handlers/subscriptions.ts @@ -1,7 +1,7 @@ // Copyright 2019-2023 @polkadot/extension authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { MessageTypesWithSubscriptions, SubscriptionMessageTypes } from '../types'; +import type { MessageTypesWithSubscriptions, SubscriptionMessageTypes } from '../types.js'; type Subscriptions = Record; diff --git a/packages/extension-base/src/background/types.ts b/packages/extension-base/src/background/types.ts index 4ba513ef0f..9146c018bc 100644 --- a/packages/extension-base/src/background/types.ts +++ b/packages/extension-base/src/background/types.ts @@ -11,8 +11,8 @@ import type { KeyringPairs$Json } from '@polkadot/ui-keyring/types'; import type { HexString } from '@polkadot/util/types'; import type { KeypairType } from '@polkadot/util-crypto/types'; -import { ALLOWED_PATH } from '../defaults'; -import { AuthResponse, AuthUrls } from './handlers/State'; +import { ALLOWED_PATH } from '../defaults.js'; +import { AuthResponse, AuthUrls } from './handlers/State.js'; type KeysWithDefinedValues = { [K in keyof T]: T[K] extends undefined ? never : K diff --git a/packages/extension-base/src/bundle.ts b/packages/extension-base/src/bundle.ts index ca4f058de1..3a9b81900d 100644 --- a/packages/extension-base/src/bundle.ts +++ b/packages/extension-base/src/bundle.ts @@ -1,4 +1,4 @@ // Copyright 2019-2023 @polkadot/extension-base authors & contributors // SPDX-License-Identifier: Apache-2.0 -export { packageInfo } from './packageInfo'; +export { packageInfo } from './packageInfo.js'; diff --git a/packages/extension-base/src/detectPackage.ts b/packages/extension-base/src/detectPackage.ts index cb79842ee2..55d0e1d390 100644 --- a/packages/extension-base/src/detectPackage.ts +++ b/packages/extension-base/src/detectPackage.ts @@ -5,7 +5,7 @@ import { detectPackage } from '@polkadot/util'; -import others from './detectOther'; -import { packageInfo } from './packageInfo'; +import others from './detectOther.js'; +import { packageInfo } from './packageInfo.js'; detectPackage(packageInfo, null, others); diff --git a/packages/extension-base/src/index.ts b/packages/extension-base/src/index.ts index 21557967e6..036a92c81d 100644 --- a/packages/extension-base/src/index.ts +++ b/packages/extension-base/src/index.ts @@ -4,4 +4,4 @@ // Since we inject into pages, we skip this // import './detectPackage'; -export * from './bundle'; +export * from './bundle.js'; diff --git a/packages/extension-base/src/page/Accounts.ts b/packages/extension-base/src/page/Accounts.ts index fa29331b27..3302e72608 100644 --- a/packages/extension-base/src/page/Accounts.ts +++ b/packages/extension-base/src/page/Accounts.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { InjectedAccount, InjectedAccounts, Unsubcall } from '@polkadot/extension-inject/types'; -import type { SendRequest } from './types'; +import type { SendRequest } from './types.js'; // External to class, this.# is not private enough (yet) let sendRequest: SendRequest; diff --git a/packages/extension-base/src/page/Injected.ts b/packages/extension-base/src/page/Injected.ts index 29e6dd209d..81806a86c5 100644 --- a/packages/extension-base/src/page/Injected.ts +++ b/packages/extension-base/src/page/Injected.ts @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 import type { Injected } from '@polkadot/extension-inject/types'; -import type { SendRequest } from './types'; +import type { SendRequest } from './types.js'; -import Accounts from './Accounts'; -import Metadata from './Metadata'; -import PostMessageProvider from './PostMessageProvider'; -import Signer from './Signer'; +import Accounts from './Accounts.js'; +import Metadata from './Metadata.js'; +import PostMessageProvider from './PostMessageProvider.js'; +import Signer from './Signer.js'; export default class implements Injected { public readonly accounts: Accounts; diff --git a/packages/extension-base/src/page/Metadata.ts b/packages/extension-base/src/page/Metadata.ts index 78016476da..f7752031ea 100644 --- a/packages/extension-base/src/page/Metadata.ts +++ b/packages/extension-base/src/page/Metadata.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { InjectedMetadata, InjectedMetadataKnown, MetadataDef } from '@polkadot/extension-inject/types'; -import type { SendRequest } from './types'; +import type { SendRequest } from './types.js'; // External to class, this.# is not private enough (yet) let sendRequest: SendRequest; diff --git a/packages/extension-base/src/page/PostMessageProvider.ts b/packages/extension-base/src/page/PostMessageProvider.ts index 24cc54d5bc..09c0bcd046 100644 --- a/packages/extension-base/src/page/PostMessageProvider.ts +++ b/packages/extension-base/src/page/PostMessageProvider.ts @@ -4,7 +4,7 @@ import type { InjectedProvider, ProviderList, ProviderMeta } from '@polkadot/extension-inject/types'; import type { ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '@polkadot/rpc-provider/types'; import type { AnyFunction } from '@polkadot/types/types'; -import type { SendRequest } from './types'; +import type { SendRequest } from './types.js'; import EventEmitter from 'eventemitter3'; diff --git a/packages/extension-base/src/page/Signer.ts b/packages/extension-base/src/page/Signer.ts index ed8556933b..511d3df9a8 100644 --- a/packages/extension-base/src/page/Signer.ts +++ b/packages/extension-base/src/page/Signer.ts @@ -3,7 +3,7 @@ import type { Signer as SignerInterface, SignerResult } from '@polkadot/api/types'; import type { SignerPayloadJSON, SignerPayloadRaw } from '@polkadot/types/types'; -import type { SendRequest } from './types'; +import type { SendRequest } from './types.js'; // External to class, this.# is not private enough (yet) let sendRequest: SendRequest; diff --git a/packages/extension-base/src/page/index.ts b/packages/extension-base/src/page/index.ts index 3c07c6329d..e1647859af 100644 --- a/packages/extension-base/src/page/index.ts +++ b/packages/extension-base/src/page/index.ts @@ -3,9 +3,9 @@ import type { MessageTypes, MessageTypesWithNoSubscriptions, MessageTypesWithNullRequest, MessageTypesWithSubscriptions, RequestTypes, ResponseTypes, SubscriptionMessageTypes, TransportRequestMessage, TransportResponseMessage } from '../background/types'; -import { MESSAGE_ORIGIN_PAGE } from '../defaults'; -import { getId } from '../utils/getId'; -import Injected from './Injected'; +import { MESSAGE_ORIGIN_PAGE } from '../defaults.js'; +import { getId } from '../utils/getId.js'; +import Injected from './Injected.js'; // when sending a message from the injector to the extension, we // - create an event - this we send to the loader diff --git a/packages/extension-base/src/stores/Accounts.ts b/packages/extension-base/src/stores/Accounts.ts index 0924fa0e6b..4181a03c4c 100644 --- a/packages/extension-base/src/stores/Accounts.ts +++ b/packages/extension-base/src/stores/Accounts.ts @@ -3,8 +3,8 @@ import type { KeyringJson, KeyringStore } from '@polkadot/ui-keyring/types'; -import { EXTENSION_PREFIX } from '../defaults'; -import BaseStore from './Base'; +import { EXTENSION_PREFIX } from '../defaults.js'; +import BaseStore from './Base.js'; export default class AccountsStore extends BaseStore implements KeyringStore { constructor () { diff --git a/packages/extension-base/src/stores/Metadata.ts b/packages/extension-base/src/stores/Metadata.ts index 0c0a61f8db..c98890bbf8 100644 --- a/packages/extension-base/src/stores/Metadata.ts +++ b/packages/extension-base/src/stores/Metadata.ts @@ -3,8 +3,8 @@ import type { MetadataDef } from '@polkadot/extension-inject/types'; -import { EXTENSION_PREFIX } from '../defaults'; -import BaseStore from './Base'; +import { EXTENSION_PREFIX } from '../defaults.js'; +import BaseStore from './Base.js'; export default class MetadataStore extends BaseStore { constructor () { diff --git a/packages/extension-base/src/stores/index.ts b/packages/extension-base/src/stores/index.ts index 86f9a82335..5c1f1d2d49 100644 --- a/packages/extension-base/src/stores/index.ts +++ b/packages/extension-base/src/stores/index.ts @@ -1,5 +1,5 @@ // Copyright 2019-2023 @polkadot/extension-base authors & contributors // SPDX-License-Identifier: Apache-2.0 -export { default as AccountsStore } from './Accounts'; -export { default as MetadataStore } from './Metadata'; +export { default as AccountsStore } from './Accounts.js'; +export { default as MetadataStore } from './Metadata.js'; diff --git a/packages/extension-base/src/utils/getId.ts b/packages/extension-base/src/utils/getId.ts index bb5847cae0..1a0a3cc063 100644 --- a/packages/extension-base/src/utils/getId.ts +++ b/packages/extension-base/src/utils/getId.ts @@ -1,7 +1,7 @@ // Copyright 2019-2023 @polkadot/extension authors & contributors // SPDX-License-Identifier: Apache-2.0 -import { EXTENSION_PREFIX } from '../defaults'; +import { EXTENSION_PREFIX } from '../defaults.js'; let counter = 0; diff --git a/packages/extension-base/src/utils/index.ts b/packages/extension-base/src/utils/index.ts index dc06df2aa5..6ddc36dd7e 100644 --- a/packages/extension-base/src/utils/index.ts +++ b/packages/extension-base/src/utils/index.ts @@ -1,4 +1,4 @@ // Copyright 2019-2023 @polkadot/extension authors & contributors // SPDX-License-Identifier: Apache-2.0 -export { canDerive } from './canDerive'; +export { canDerive } from './canDerive.js'; diff --git a/packages/extension-chains/src/bundle.ts b/packages/extension-chains/src/bundle.ts index 8ae56c060f..23c42b118b 100644 --- a/packages/extension-chains/src/bundle.ts +++ b/packages/extension-chains/src/bundle.ts @@ -3,12 +3,12 @@ import type { MetadataDef } from '@polkadot/extension-inject/types'; import type { ChainProperties } from '@polkadot/types/interfaces'; -import type { Chain } from './types'; +import type { Chain } from './types.js'; import { Metadata, TypeRegistry } from '@polkadot/types'; import { base64Decode } from '@polkadot/util-crypto'; -export { packageInfo } from './packageInfo'; +export { packageInfo } from './packageInfo.js'; // imports chain details, generally metadata. For the generation of these, // inside the api, run `yarn chain:info --ws ` diff --git a/packages/extension-chains/src/detectPackage.ts b/packages/extension-chains/src/detectPackage.ts index a9a755200f..79daf66aba 100644 --- a/packages/extension-chains/src/detectPackage.ts +++ b/packages/extension-chains/src/detectPackage.ts @@ -5,7 +5,7 @@ import { detectPackage } from '@polkadot/util'; -import others from './detectOther'; -import { packageInfo } from './packageInfo'; +import others from './detectOther.js'; +import { packageInfo } from './packageInfo.js'; detectPackage(packageInfo, null, others); diff --git a/packages/extension-chains/src/index.ts b/packages/extension-chains/src/index.ts index fac724a7b8..6bbe1aac7e 100644 --- a/packages/extension-chains/src/index.ts +++ b/packages/extension-chains/src/index.ts @@ -4,4 +4,4 @@ // Since we inject into pages, we skip this // import './detectPackage'; -export * from './bundle'; +export * from './bundle.js'; diff --git a/packages/extension-compat-metamask/src/bundle.ts b/packages/extension-compat-metamask/src/bundle.ts index b3c3ac0467..f2837e698d 100644 --- a/packages/extension-compat-metamask/src/bundle.ts +++ b/packages/extension-compat-metamask/src/bundle.ts @@ -10,7 +10,7 @@ import Web3 from 'web3'; import { assert } from '@polkadot/util'; -export { packageInfo } from './packageInfo'; +export { packageInfo } from './packageInfo.js'; interface RequestArguments { method: string; diff --git a/packages/extension-compat-metamask/src/detectPackage.ts b/packages/extension-compat-metamask/src/detectPackage.ts index ac260dabba..967580b6c9 100644 --- a/packages/extension-compat-metamask/src/detectPackage.ts +++ b/packages/extension-compat-metamask/src/detectPackage.ts @@ -5,7 +5,7 @@ import { detectPackage } from '@polkadot/util'; -import others from './detectOther'; -import { packageInfo } from './packageInfo'; +import others from './detectOther.js'; +import { packageInfo } from './packageInfo.js'; detectPackage(packageInfo, null, others); diff --git a/packages/extension-compat-metamask/src/index.ts b/packages/extension-compat-metamask/src/index.ts index 76c354d75e..c538c324be 100644 --- a/packages/extension-compat-metamask/src/index.ts +++ b/packages/extension-compat-metamask/src/index.ts @@ -4,4 +4,4 @@ // Since we inject into pages, we skip this // import './detectPackage'; -export * from './bundle'; +export * from './bundle.js'; diff --git a/packages/extension-dapp/src/bundle.ts b/packages/extension-dapp/src/bundle.ts index e7f16c453e..789dac348f 100644 --- a/packages/extension-dapp/src/bundle.ts +++ b/packages/extension-dapp/src/bundle.ts @@ -6,11 +6,11 @@ import type { InjectedAccount, InjectedAccountWithMeta, InjectedExtension, Injec import { isPromise, objectSpread, u8aEq } from '@polkadot/util'; import { decodeAddress, encodeAddress } from '@polkadot/util-crypto'; -import { documentReadyPromise } from './util'; +import { documentReadyPromise } from './util.js'; // expose utility functions -export { packageInfo } from './packageInfo'; -export { unwrapBytes, wrapBytes } from './wrapBytes'; +export { packageInfo } from './packageInfo.js'; +export { unwrapBytes, wrapBytes } from './wrapBytes.js'; // just a helper (otherwise we cast all-over, so shorter and more readable) const win = window as Window & InjectedWindow; diff --git a/packages/extension-dapp/src/detectPackage.ts b/packages/extension-dapp/src/detectPackage.ts index 78dccd504d..1939c15bd6 100644 --- a/packages/extension-dapp/src/detectPackage.ts +++ b/packages/extension-dapp/src/detectPackage.ts @@ -5,7 +5,7 @@ import { detectPackage } from '@polkadot/util'; -import others from './detectOther'; -import { packageInfo } from './packageInfo'; +import others from './detectOther.js'; +import { packageInfo } from './packageInfo.js'; detectPackage(packageInfo, null, others); diff --git a/packages/extension-dapp/src/index.ts b/packages/extension-dapp/src/index.ts index ca33ddc74e..6b247cee99 100644 --- a/packages/extension-dapp/src/index.ts +++ b/packages/extension-dapp/src/index.ts @@ -4,4 +4,4 @@ // Since we inject into pages, we skip this // import './detectPackage'; -export * from './bundle'; +export * from './bundle.js'; diff --git a/packages/extension-dapp/src/wrapBytes.spec.ts b/packages/extension-dapp/src/wrapBytes.spec.ts index b789f03f31..765f794823 100644 --- a/packages/extension-dapp/src/wrapBytes.spec.ts +++ b/packages/extension-dapp/src/wrapBytes.spec.ts @@ -5,7 +5,7 @@ import { u8aConcat, u8aEq, u8aToString } from '@polkadot/util'; -import { ETHEREUM, POSTFIX, PREFIX, unwrapBytes, wrapBytes } from './wrapBytes'; +import { ETHEREUM, POSTFIX, PREFIX, unwrapBytes, wrapBytes } from './wrapBytes.js'; const TEST_DATA = 'this is just some random message that we expect to be wrapped along the way'; const TEST_ETH = u8aConcat(ETHEREUM, TEST_DATA); diff --git a/packages/extension-inject/src/bundle.ts b/packages/extension-inject/src/bundle.ts index f1cdbd4868..8c5002ec29 100644 --- a/packages/extension-inject/src/bundle.ts +++ b/packages/extension-inject/src/bundle.ts @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-inject authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { Injected, InjectedExtension, InjectedWindow, InjectOptions } from './types'; +import type { Injected, InjectedExtension, InjectedWindow, InjectOptions } from './types.js'; -import { cyrb53 } from './cyrb53'; +import { cyrb53 } from './cyrb53.js'; -export { packageInfo } from './packageInfo'; +export { packageInfo } from './packageInfo.js'; // setting for new-style connect (more-secure with no details exposed without // user acknowledgement, however slightly less-compatible with all dapps, some diff --git a/packages/extension-inject/src/detectPackage.ts b/packages/extension-inject/src/detectPackage.ts index 50805f54bb..cbfbf810b1 100644 --- a/packages/extension-inject/src/detectPackage.ts +++ b/packages/extension-inject/src/detectPackage.ts @@ -5,7 +5,7 @@ import { detectPackage } from '@polkadot/util'; -import others from './detectOther'; -import { packageInfo } from './packageInfo'; +import others from './detectOther.js'; +import { packageInfo } from './packageInfo.js'; detectPackage(packageInfo, null, others); diff --git a/packages/extension-inject/src/index.ts b/packages/extension-inject/src/index.ts index 6fdfea20e9..9810cd8d5d 100644 --- a/packages/extension-inject/src/index.ts +++ b/packages/extension-inject/src/index.ts @@ -4,4 +4,4 @@ // Since we inject into pages, we skip this // import './detectPackage'; -export * from './bundle'; +export * from './bundle.js'; diff --git a/packages/extension-ui/src/Popup/Accounts/Account.spec.tsx b/packages/extension-ui/src/Popup/Accounts/Account.spec.tsx index 179bc0ae7b..c33697ebf0 100644 --- a/packages/extension-ui/src/Popup/Accounts/Account.spec.tsx +++ b/packages/extension-ui/src/Popup/Accounts/Account.spec.tsx @@ -14,10 +14,10 @@ import { act } from 'react-dom/test-utils'; import { MemoryRouter } from 'react-router'; import { ThemeProvider } from 'styled-components'; -import { Theme, themes } from '../../components'; -import * as messaging from '../../messaging'; -import { flushAllPromises } from '../../testHelpers'; -import Account from './Account'; +import { Theme, themes } from '../../components/index.js'; +import * as messaging from '../../messaging.js'; +import { flushAllPromises } from '../../testHelpers.js'; +import Account from './Account.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/Accounts/Account.tsx b/packages/extension-ui/src/Popup/Accounts/Account.tsx index 37fafd9611..bb1a299a5b 100644 --- a/packages/extension-ui/src/Popup/Accounts/Account.tsx +++ b/packages/extension-ui/src/Popup/Accounts/Account.tsx @@ -8,12 +8,12 @@ import React, { useCallback, useContext, useEffect, useMemo, useState } from 're import { canDerive } from '@polkadot/extension-base/utils'; import { ThemeProps } from '@polkadot/extension-ui/types'; -import { AccountContext, Address, Checkbox, Dropdown, Link, MenuDivider } from '../../components'; -import useGenesisHashOptions from '../../hooks/useGenesisHashOptions'; -import useTranslation from '../../hooks/useTranslation'; -import { editAccount, tieAccount } from '../../messaging'; -import { Name } from '../../partials'; -import { styled } from '../../styled'; +import { AccountContext, Address, Checkbox, Dropdown, Link, MenuDivider } from '../../components/index.js'; +import useGenesisHashOptions from '../../hooks/useGenesisHashOptions.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { editAccount, tieAccount } from '../../messaging.js'; +import { Name } from '../../partials/index.js'; +import { styled } from '../../styled.js'; interface Props extends AccountJson { className?: string; diff --git a/packages/extension-ui/src/Popup/Accounts/AccountsTree.tsx b/packages/extension-ui/src/Popup/Accounts/AccountsTree.tsx index 9fdb536740..32d3e5a51e 100644 --- a/packages/extension-ui/src/Popup/Accounts/AccountsTree.tsx +++ b/packages/extension-ui/src/Popup/Accounts/AccountsTree.tsx @@ -5,8 +5,8 @@ import type { AccountWithChildren } from '@polkadot/extension-base/background/ty import React from 'react'; -import { styled } from '../../styled'; -import Account from './Account'; +import { styled } from '../../styled.js'; +import Account from './Account.js'; interface Props extends AccountWithChildren { className?: string diff --git a/packages/extension-ui/src/Popup/Accounts/AddAccount.tsx b/packages/extension-ui/src/Popup/Accounts/AddAccount.tsx index 9f97822779..0484384f3e 100644 --- a/packages/extension-ui/src/Popup/Accounts/AddAccount.tsx +++ b/packages/extension-ui/src/Popup/Accounts/AddAccount.tsx @@ -1,15 +1,15 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback, useContext } from 'react'; -import { ActionContext } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import Header from '../../partials/Header'; -import { styled } from '../../styled'; -import AddAccountImage from './AddAccountImage'; +import { ActionContext } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import Header from '../../partials/Header.js'; +import { styled } from '../../styled.js'; +import AddAccountImage from './AddAccountImage.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/Accounts/AddAccountImage.tsx b/packages/extension-ui/src/Popup/Accounts/AddAccountImage.tsx index a83ab0b952..93197971f6 100644 --- a/packages/extension-ui/src/Popup/Accounts/AddAccountImage.tsx +++ b/packages/extension-ui/src/Popup/Accounts/AddAccountImage.tsx @@ -7,11 +7,11 @@ /* eslint-disable react/jsx-sort-props */ /* eslint-disable react/jsx-max-props-per-line */ -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React from 'react'; -import { styled } from '../../styled'; +import { styled } from '../../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/Accounts/index.tsx b/packages/extension-ui/src/Popup/Accounts/index.tsx index 1a42d00a49..aef3978667 100644 --- a/packages/extension-ui/src/Popup/Accounts/index.tsx +++ b/packages/extension-ui/src/Popup/Accounts/index.tsx @@ -1,19 +1,19 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { AccountWithChildren } from '@polkadot/extension-base/background/types'; import getNetworkMap from '@polkadot/extension-ui/util/getNetworkMap'; -import { AccountContext } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { Header } from '../../partials'; -import { styled } from '../../styled'; -import AccountsTree from './AccountsTree'; -import AddAccount from './AddAccount'; +import { AccountContext } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { Header } from '../../partials/index.js'; +import { styled } from '../../styled.js'; +import AccountsTree from './AccountsTree.js'; +import AddAccount from './AddAccount.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/AuthManagement/AccountManagement.tsx b/packages/extension-ui/src/Popup/AuthManagement/AccountManagement.tsx index fddfa1441e..9cd0666b0b 100644 --- a/packages/extension-ui/src/Popup/AuthManagement/AccountManagement.tsx +++ b/packages/extension-ui/src/Popup/AuthManagement/AccountManagement.tsx @@ -1,16 +1,16 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback, useContext, useEffect } from 'react'; import { useParams } from 'react-router'; -import { AccountContext, ActionContext, Button } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { getAuthList, updateAuthorization } from '../../messaging'; -import { AccountSelection, Header } from '../../partials'; -import { styled } from '../../styled'; +import { AccountContext, ActionContext, Button } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { getAuthList, updateAuthorization } from '../../messaging.js'; +import { AccountSelection, Header } from '../../partials/index.js'; +import { styled } from '../../styled.js'; interface Props extends ThemeProps { className?: string; @@ -37,7 +37,7 @@ function AccountManagement ({ className }: Props): React.ReactElement { const _onApprove = useCallback( (): void => { updateAuthorization(selectedAccounts, url) - .then(() => onAction('..')) + .then(() => onAction('../index.js')) .catch(console.error); }, [onAction, selectedAccounts, url] diff --git a/packages/extension-ui/src/Popup/AuthManagement/WebsiteEntry.tsx b/packages/extension-ui/src/Popup/AuthManagement/WebsiteEntry.tsx index 6b95fa21dd..d80644627c 100644 --- a/packages/extension-ui/src/Popup/AuthManagement/WebsiteEntry.tsx +++ b/packages/extension-ui/src/Popup/AuthManagement/WebsiteEntry.tsx @@ -1,7 +1,7 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback } from 'react'; import { Link } from 'react-router-dom'; @@ -10,7 +10,7 @@ import { AuthUrlInfo } from '@polkadot/extension-base/background/handlers/State' import { RemoveAuth } from '@polkadot/extension-ui/components'; import { useTranslation } from '@polkadot/extension-ui/components/translate'; -import { styled } from '../../styled'; +import { styled } from '../../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/AuthManagement/index.tsx b/packages/extension-ui/src/Popup/AuthManagement/index.tsx index b850c14364..0bf6d3453e 100644 --- a/packages/extension-ui/src/Popup/AuthManagement/index.tsx +++ b/packages/extension-ui/src/Popup/AuthManagement/index.tsx @@ -1,18 +1,18 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { AuthUrlInfo, AuthUrls } from '@polkadot/extension-base/background/handlers/State'; import { InputFilter } from '@polkadot/extension-ui/components'; -import useTranslation from '../../hooks/useTranslation'; -import { getAuthList, removeAuthorization } from '../../messaging'; -import { Header } from '../../partials'; -import { styled } from '../../styled'; -import WebsiteEntry from './WebsiteEntry'; +import useTranslation from '../../hooks/useTranslation.js'; +import { getAuthList, removeAuthorization } from '../../messaging.js'; +import { Header } from '../../partials/index.js'; +import { styled } from '../../styled.js'; +import WebsiteEntry from './WebsiteEntry.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/Authorize/Authorize.spec.tsx b/packages/extension-ui/src/Popup/Authorize/Authorize.spec.tsx index 392a3c1c29..daa8ecfa74 100644 --- a/packages/extension-ui/src/Popup/Authorize/Authorize.spec.tsx +++ b/packages/extension-ui/src/Popup/Authorize/Authorize.spec.tsx @@ -13,12 +13,12 @@ import enzyme from 'enzyme'; import React from 'react'; import { ThemeProvider } from 'styled-components'; -import { AccountContext, AuthorizeReqContext, themes, Warning } from '../../components'; -import { Header } from '../../partials'; -import { buildHierarchy } from '../../util/buildHierarchy'; -import Account from '../Accounts/Account'; -import Request from './Request'; -import Authorize from '.'; +import { AccountContext, AuthorizeReqContext, themes, Warning } from '../../components/index.js'; +import { Header } from '../../partials/index.js'; +import { buildHierarchy } from '../../util/buildHierarchy.js'; +import Account from '../Accounts/Account.js'; +import Authorize from './index.js'; +import Request from './Request.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/Authorize/NoAccount.tsx b/packages/extension-ui/src/Popup/Authorize/NoAccount.tsx index 49b566a0d7..e9e528b8b6 100644 --- a/packages/extension-ui/src/Popup/Authorize/NoAccount.tsx +++ b/packages/extension-ui/src/Popup/Authorize/NoAccount.tsx @@ -1,7 +1,7 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import { t } from 'i18next'; import React, { useCallback } from 'react'; @@ -10,7 +10,7 @@ import { Trans } from 'react-i18next'; import { Button, Warning } from '@polkadot/extension-ui/components'; import { deleteAuthRequest } from '@polkadot/extension-ui/messaging'; -import { styled } from '../../styled'; +import { styled } from '../../styled.js'; interface Props extends ThemeProps { authId: string; diff --git a/packages/extension-ui/src/Popup/Authorize/Request.tsx b/packages/extension-ui/src/Popup/Authorize/Request.tsx index 36e28b9e26..2c3620d482 100644 --- a/packages/extension-ui/src/Popup/Authorize/Request.tsx +++ b/packages/extension-ui/src/Popup/Authorize/Request.tsx @@ -2,16 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 import type { RequestAuthorizeTab } from '@polkadot/extension-base/background/types'; -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback, useContext, useEffect } from 'react'; -import { AccountContext, ActionBar, ActionContext, Button, Link } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { approveAuthRequest, deleteAuthRequest } from '../../messaging'; -import { AccountSelection } from '../../partials'; -import { styled } from '../../styled'; -import NoAccount from './NoAccount'; +import { AccountContext, ActionBar, ActionContext, Button, Link } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { approveAuthRequest, deleteAuthRequest } from '../../messaging.js'; +import { AccountSelection } from '../../partials/index.js'; +import { styled } from '../../styled.js'; +import NoAccount from './NoAccount.js'; interface Props extends ThemeProps { authId: string; diff --git a/packages/extension-ui/src/Popup/Authorize/index.tsx b/packages/extension-ui/src/Popup/Authorize/index.tsx index 9866bf7c69..d2598b66ee 100644 --- a/packages/extension-ui/src/Popup/Authorize/index.tsx +++ b/packages/extension-ui/src/Popup/Authorize/index.tsx @@ -1,15 +1,15 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useContext } from 'react'; -import { AuthorizeReqContext } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { Header } from '../../partials'; -import { styled } from '../../styled'; -import Request from './Request'; +import { AuthorizeReqContext } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { Header } from '../../partials/index.js'; +import { styled } from '../../styled.js'; +import Request from './Request.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/CreateAccount/CreateAccount.spec.tsx b/packages/extension-ui/src/Popup/CreateAccount/CreateAccount.spec.tsx index dc32e7ed71..6957cf0e21 100644 --- a/packages/extension-ui/src/Popup/CreateAccount/CreateAccount.spec.tsx +++ b/packages/extension-ui/src/Popup/CreateAccount/CreateAccount.spec.tsx @@ -13,11 +13,11 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { ThemeProvider } from 'styled-components'; -import { ActionContext, ActionText, Button, themes } from '../../components'; -import * as messaging from '../../messaging'; -import { Header } from '../../partials'; -import { flushAllPromises } from '../../testHelpers'; -import CreateAccount from '.'; +import { ActionContext, ActionText, Button, themes } from '../../components/index.js'; +import * as messaging from '../../messaging.js'; +import { Header } from '../../partials/index.js'; +import { flushAllPromises } from '../../testHelpers.js'; +import CreateAccount from './index.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/CreateAccount/Mnemonic.tsx b/packages/extension-ui/src/Popup/CreateAccount/Mnemonic.tsx index 55034c0de7..3afc959052 100644 --- a/packages/extension-ui/src/Popup/CreateAccount/Mnemonic.tsx +++ b/packages/extension-ui/src/Popup/CreateAccount/Mnemonic.tsx @@ -3,9 +3,9 @@ import React, { useCallback, useState } from 'react'; -import { ButtonArea, Checkbox, MnemonicSeed, NextStepButton, VerticalSpace, Warning } from '../../components'; -import useToast from '../../hooks/useToast'; -import useTranslation from '../../hooks/useTranslation'; +import { ButtonArea, Checkbox, MnemonicSeed, NextStepButton, VerticalSpace, Warning } from '../../components/index.js'; +import useToast from '../../hooks/useToast.js'; +import useTranslation from '../../hooks/useTranslation.js'; interface Props { onNextStep: () => void; diff --git a/packages/extension-ui/src/Popup/CreateAccount/index.tsx b/packages/extension-ui/src/Popup/CreateAccount/index.tsx index 9f20432f62..1c31cde7e1 100644 --- a/packages/extension-ui/src/Popup/CreateAccount/index.tsx +++ b/packages/extension-ui/src/Popup/CreateAccount/index.tsx @@ -3,16 +3,16 @@ import React, { useCallback, useContext, useEffect, useState } from 'react'; -import { ActionContext, Address, Dropdown, Loading } from '../../components'; -import AccountNamePasswordCreation from '../../components/AccountNamePasswordCreation'; -import useGenesisHashOptions from '../../hooks/useGenesisHashOptions'; -import useMetadata from '../../hooks/useMetadata'; -import useTranslation from '../../hooks/useTranslation'; -import { createAccountSuri, createSeed, validateSeed } from '../../messaging'; -import { HeaderWithSteps } from '../../partials'; -import { styled } from '../../styled'; -import { DEFAULT_TYPE } from '../../util/defaultType'; -import Mnemonic from './Mnemonic'; +import AccountNamePasswordCreation from '../../components/AccountNamePasswordCreation.js'; +import { ActionContext, Address, Dropdown, Loading } from '../../components/index.js'; +import useGenesisHashOptions from '../../hooks/useGenesisHashOptions.js'; +import useMetadata from '../../hooks/useMetadata.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { createAccountSuri, createSeed, validateSeed } from '../../messaging.js'; +import { HeaderWithSteps } from '../../partials/index.js'; +import { styled } from '../../styled.js'; +import { DEFAULT_TYPE } from '../../util/defaultType.js'; +import Mnemonic from './Mnemonic.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/Popup/Derive/AddressDropdown.tsx b/packages/extension-ui/src/Popup/Derive/AddressDropdown.tsx index 7d6d06b1bb..fe166c4521 100644 --- a/packages/extension-ui/src/Popup/Derive/AddressDropdown.tsx +++ b/packages/extension-ui/src/Popup/Derive/AddressDropdown.tsx @@ -1,14 +1,14 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback, useRef, useState } from 'react'; import arrow from '../../assets/arrow-down.svg'; -import { Address } from '../../components'; -import useOutsideClick from '../../hooks/useOutsideClick'; -import { styled } from '../../styled'; +import { Address } from '../../components/index.js'; +import useOutsideClick from '../../hooks/useOutsideClick.js'; +import { styled } from '../../styled.js'; interface Props { allAddresses: [string, string | null][]; diff --git a/packages/extension-ui/src/Popup/Derive/DerivationPath.tsx b/packages/extension-ui/src/Popup/Derive/DerivationPath.tsx index 07690281a8..2e4a259a8f 100644 --- a/packages/extension-ui/src/Popup/Derive/DerivationPath.tsx +++ b/packages/extension-ui/src/Popup/Derive/DerivationPath.tsx @@ -1,15 +1,15 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import { faLock, faLockOpen } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useCallback, useEffect, useState } from 'react'; -import { Button, InputWithLabel } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { styled } from '../../styled'; +import { Button, InputWithLabel } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { styled } from '../../styled.js'; interface Props extends ThemeProps{ className?: string; diff --git a/packages/extension-ui/src/Popup/Derive/Derive.spec.tsx b/packages/extension-ui/src/Popup/Derive/Derive.spec.tsx index d4ceacd215..349e7a8cf8 100644 --- a/packages/extension-ui/src/Popup/Derive/Derive.spec.tsx +++ b/packages/extension-ui/src/Popup/Derive/Derive.spec.tsx @@ -15,12 +15,12 @@ import { act } from 'react-dom/test-utils'; import { MemoryRouter, Route } from 'react-router'; import { ThemeProvider } from 'styled-components'; -import { AccountContext, ActionContext, themes } from '../../components'; -import * as messaging from '../../messaging'; -import { flushAllPromises } from '../../testHelpers'; -import { buildHierarchy } from '../../util/buildHierarchy'; -import AddressDropdown from './AddressDropdown'; -import Derive from '.'; +import { AccountContext, ActionContext, themes } from '../../components/index.js'; +import * as messaging from '../../messaging.js'; +import { flushAllPromises } from '../../testHelpers.js'; +import { buildHierarchy } from '../../util/buildHierarchy.js'; +import AddressDropdown from './AddressDropdown.js'; +import Derive from './index.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/Derive/SelectParent.tsx b/packages/extension-ui/src/Popup/Derive/SelectParent.tsx index cf4a7ad52c..0c98add39a 100644 --- a/packages/extension-ui/src/Popup/Derive/SelectParent.tsx +++ b/packages/extension-ui/src/Popup/Derive/SelectParent.tsx @@ -5,12 +5,12 @@ import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } import { canDerive } from '@polkadot/extension-base/utils'; -import { AccountContext, ActionContext, Address, ButtonArea, InputWithLabel, Label, NextStepButton, VerticalSpace, Warning } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { validateAccount, validateDerivationPath } from '../../messaging'; -import { nextDerivationPath } from '../../util/nextDerivationPath'; -import AddressDropdown from './AddressDropdown'; -import DerivationPath from './DerivationPath'; +import { AccountContext, ActionContext, Address, ButtonArea, InputWithLabel, Label, NextStepButton, VerticalSpace, Warning } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { validateAccount, validateDerivationPath } from '../../messaging.js'; +import { nextDerivationPath } from '../../util/nextDerivationPath.js'; +import AddressDropdown from './AddressDropdown.js'; +import DerivationPath from './DerivationPath.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/Popup/Derive/index.tsx b/packages/extension-ui/src/Popup/Derive/index.tsx index 391c0ca05f..fe7574d792 100644 --- a/packages/extension-ui/src/Popup/Derive/index.tsx +++ b/packages/extension-ui/src/Popup/Derive/index.tsx @@ -4,11 +4,11 @@ import React, { useCallback, useContext, useMemo, useState } from 'react'; import { useParams } from 'react-router'; -import { AccountContext, AccountNamePasswordCreation, ActionContext, Address } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { deriveAccount } from '../../messaging'; -import { HeaderWithSteps } from '../../partials'; -import SelectParent from './SelectParent'; +import { AccountContext, AccountNamePasswordCreation, ActionContext, Address } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { deriveAccount } from '../../messaging.js'; +import { HeaderWithSteps } from '../../partials/index.js'; +import SelectParent from './SelectParent.js'; interface Props { isLocked?: boolean; diff --git a/packages/extension-ui/src/Popup/Export.spec.tsx b/packages/extension-ui/src/Popup/Export.spec.tsx index 5f25cb6174..c65530c730 100644 --- a/packages/extension-ui/src/Popup/Export.spec.tsx +++ b/packages/extension-ui/src/Popup/Export.spec.tsx @@ -15,10 +15,10 @@ import { act } from 'react-dom/test-utils'; import { MemoryRouter, Route } from 'react-router'; import { ThemeProvider } from 'styled-components'; -import { Button, themes } from '../components'; -import * as messaging from '../messaging'; -import { flushAllPromises } from '../testHelpers'; -import Export from './Export'; +import { Button, themes } from '../components/index.js'; +import * as messaging from '../messaging.js'; +import { flushAllPromises } from '../testHelpers.js'; +import Export from './Export.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/Export.tsx b/packages/extension-ui/src/Popup/Export.tsx index db90add512..67020419ee 100644 --- a/packages/extension-ui/src/Popup/Export.tsx +++ b/packages/extension-ui/src/Popup/Export.tsx @@ -1,17 +1,17 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import fileSaver from 'file-saver'; import React, { useCallback, useContext, useState } from 'react'; import { RouteComponentProps, withRouter } from 'react-router'; -import { ActionBar, ActionContext, ActionText, Address, Button, InputWithLabel, Warning } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import { exportAccount } from '../messaging'; -import { Header } from '../partials'; -import { styled } from '../styled'; +import { ActionBar, ActionContext, ActionText, Address, Button, InputWithLabel, Warning } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { exportAccount } from '../messaging.js'; +import { Header } from '../partials/index.js'; +import { styled } from '../styled.js'; const MIN_LENGTH = 6; diff --git a/packages/extension-ui/src/Popup/ExportAll.tsx b/packages/extension-ui/src/Popup/ExportAll.tsx index 6d2ff72731..7a58c4a46d 100644 --- a/packages/extension-ui/src/Popup/ExportAll.tsx +++ b/packages/extension-ui/src/Popup/ExportAll.tsx @@ -1,17 +1,17 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import fileSaver from 'file-saver'; import React, { useCallback, useContext, useState } from 'react'; import { RouteComponentProps, withRouter } from 'react-router'; -import { AccountContext, ActionBar, ActionContext, ActionText, Button, InputWithLabel, Warning } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import { exportAccounts } from '../messaging'; -import { Header } from '../partials'; -import { styled } from '../styled'; +import { AccountContext, ActionBar, ActionContext, ActionText, Button, InputWithLabel, Warning } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { exportAccounts } from '../messaging.js'; +import { Header } from '../partials/index.js'; +import { styled } from '../styled.js'; const MIN_LENGTH = 6; diff --git a/packages/extension-ui/src/Popup/Forget.tsx b/packages/extension-ui/src/Popup/Forget.tsx index 42437995e7..4633802447 100644 --- a/packages/extension-ui/src/Popup/Forget.tsx +++ b/packages/extension-ui/src/Popup/Forget.tsx @@ -1,16 +1,16 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback, useContext, useState } from 'react'; import { RouteComponentProps, withRouter } from 'react-router'; -import { ActionBar, ActionContext, ActionText, Address, Button, Warning } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import { forgetAccount } from '../messaging'; -import { Header } from '../partials'; -import { styled } from '../styled'; +import { ActionBar, ActionContext, ActionText, Address, Button, Warning } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { forgetAccount } from '../messaging.js'; +import { Header } from '../partials/index.js'; +import { styled } from '../styled.js'; interface Props extends RouteComponentProps<{ address: string }>, ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/ImportLedger.tsx b/packages/extension-ui/src/Popup/ImportLedger.tsx index b56d0804c9..e4d2098d8c 100644 --- a/packages/extension-ui/src/Popup/ImportLedger.tsx +++ b/packages/extension-ui/src/Popup/ImportLedger.tsx @@ -7,14 +7,14 @@ import React, { useCallback, useContext, useEffect, useRef, useState } from 'rea import settings from '@polkadot/ui-settings'; -import { ActionContext, Address, Button, ButtonArea, Dropdown, VerticalSpace, Warning } from '../components'; -import { useLedger } from '../hooks/useLedger'; -import useTranslation from '../hooks/useTranslation'; -import { createAccountHardware } from '../messaging'; -import { Header, Name } from '../partials'; -import { styled } from '../styled'; -import { ThemeProps } from '../types'; -import ledgerChains from '../util/legerChains'; +import { ActionContext, Address, Button, ButtonArea, Dropdown, VerticalSpace, Warning } from '../components/index.js'; +import { useLedger } from '../hooks/useLedger.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { createAccountHardware } from '../messaging.js'; +import { Header, Name } from '../partials/index.js'; +import { styled } from '../styled.js'; +import { ThemeProps } from '../types.js'; +import ledgerChains from '../util/legerChains.js'; interface AccOption { text: string; diff --git a/packages/extension-ui/src/Popup/ImportQr.spec.tsx b/packages/extension-ui/src/Popup/ImportQr.spec.tsx index f50bca6d6f..07b50aba8d 100644 --- a/packages/extension-ui/src/Popup/ImportQr.spec.tsx +++ b/packages/extension-ui/src/Popup/ImportQr.spec.tsx @@ -13,10 +13,10 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { MemoryRouter } from 'react-router'; -import { Button } from '../components'; -import * as messaging from '../messaging'; -import { flushAllPromises } from '../testHelpers'; -import ImportQr from './ImportQr'; +import { Button } from '../components/index.js'; +import * as messaging from '../messaging.js'; +import { flushAllPromises } from '../testHelpers.js'; +import ImportQr from './ImportQr.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/ImportQr.tsx b/packages/extension-ui/src/Popup/ImportQr.tsx index 937c350e05..2ef9c375a5 100644 --- a/packages/extension-ui/src/Popup/ImportQr.tsx +++ b/packages/extension-ui/src/Popup/ImportQr.tsx @@ -5,11 +5,11 @@ import React, { useCallback, useContext, useState } from 'react'; import { QrScanAddress } from '@polkadot/react-qr'; -import { ActionContext, Address, ButtonArea, NextStepButton, VerticalSpace } from '../components'; -import AccountNamePasswordCreation from '../components/AccountNamePasswordCreation'; -import useTranslation from '../hooks/useTranslation'; -import { createAccountExternal, createAccountSuri, createSeed } from '../messaging'; -import { Header, Name } from '../partials'; +import AccountNamePasswordCreation from '../components/AccountNamePasswordCreation.js'; +import { ActionContext, Address, ButtonArea, NextStepButton, VerticalSpace } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { createAccountExternal, createAccountSuri, createSeed } from '../messaging.js'; +import { Header, Name } from '../partials/index.js'; interface QrAccount { content: string; diff --git a/packages/extension-ui/src/Popup/ImportSeed/ImportSeed.spec.tsx b/packages/extension-ui/src/Popup/ImportSeed/ImportSeed.spec.tsx index 6cb4c3ff5d..6d36f08838 100644 --- a/packages/extension-ui/src/Popup/ImportSeed/ImportSeed.spec.tsx +++ b/packages/extension-ui/src/Popup/ImportSeed/ImportSeed.spec.tsx @@ -13,10 +13,10 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; import { MemoryRouter } from 'react-router'; -import { ActionContext, Button, Warning } from '../../components'; -import * as messaging from '../../messaging'; -import { flushAllPromises } from '../../testHelpers'; -import ImportSeed from './'; +import { ActionContext, Button, Warning } from '../../components/index.js'; +import * as messaging from '../../messaging.js'; +import { flushAllPromises } from '../../testHelpers.js'; +import ImportSeed from './index.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/ImportSeed/SeedAndPath.tsx b/packages/extension-ui/src/Popup/ImportSeed/SeedAndPath.tsx index 25b354e68f..75f399d0cd 100644 --- a/packages/extension-ui/src/Popup/ImportSeed/SeedAndPath.tsx +++ b/packages/extension-ui/src/Popup/ImportSeed/SeedAndPath.tsx @@ -2,8 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 import type { KeypairType } from '@polkadot/util-crypto/types'; -import type { ThemeProps } from '../../types'; -import type { AccountInfo } from '.'; +import type { ThemeProps } from '../../types.js'; +import type { AccountInfo } from './index.js'; import { faCaretDown, faCaretRight } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; @@ -12,10 +12,10 @@ import React, { useCallback, useEffect, useState } from 'react'; import { validateSeed } from '@polkadot/extension-ui/messaging'; import { objectSpread } from '@polkadot/util'; -import { ButtonArea, Dropdown, InputWithLabel, NextStepButton, TextAreaWithLabel, VerticalSpace, Warning } from '../../components'; -import useGenesisHashOptions from '../../hooks/useGenesisHashOptions'; -import useTranslation from '../../hooks/useTranslation'; -import { styled } from '../../styled'; +import { ButtonArea, Dropdown, InputWithLabel, NextStepButton, TextAreaWithLabel, VerticalSpace, Warning } from '../../components/index.js'; +import useGenesisHashOptions from '../../hooks/useGenesisHashOptions.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { styled } from '../../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/Popup/ImportSeed/index.tsx b/packages/extension-ui/src/Popup/ImportSeed/index.tsx index e21a1428e0..bd19319f36 100644 --- a/packages/extension-ui/src/Popup/ImportSeed/index.tsx +++ b/packages/extension-ui/src/Popup/ImportSeed/index.tsx @@ -3,14 +3,14 @@ import React, { useCallback, useContext, useEffect, useState } from 'react'; -import { AccountContext, ActionContext, Address } from '../../components'; -import AccountNamePasswordCreation from '../../components/AccountNamePasswordCreation'; -import useMetadata from '../../hooks/useMetadata'; -import useTranslation from '../../hooks/useTranslation'; -import { createAccountSuri } from '../../messaging'; -import { HeaderWithSteps } from '../../partials'; -import { DEFAULT_TYPE } from '../../util/defaultType'; -import SeedAndPath from './SeedAndPath'; +import AccountNamePasswordCreation from '../../components/AccountNamePasswordCreation.js'; +import { AccountContext, ActionContext, Address } from '../../components/index.js'; +import useMetadata from '../../hooks/useMetadata.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { createAccountSuri } from '../../messaging.js'; +import { HeaderWithSteps } from '../../partials/index.js'; +import { DEFAULT_TYPE } from '../../util/defaultType.js'; +import SeedAndPath from './SeedAndPath.js'; export interface AccountInfo { address: string; diff --git a/packages/extension-ui/src/Popup/Metadata/Request.tsx b/packages/extension-ui/src/Popup/Metadata/Request.tsx index 57ba14878f..e2f650e083 100644 --- a/packages/extension-ui/src/Popup/Metadata/Request.tsx +++ b/packages/extension-ui/src/Popup/Metadata/Request.tsx @@ -2,15 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 import type { MetadataDef } from '@polkadot/extension-inject/types'; -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useCallback, useContext } from 'react'; -import { ActionBar, ActionContext, Button, Link, Table, Warning } from '../../components'; -import useMetadata from '../../hooks/useMetadata'; -import useTranslation from '../../hooks/useTranslation'; -import { approveMetaRequest, rejectMetaRequest } from '../../messaging'; -import { styled } from '../../styled'; +import { ActionBar, ActionContext, Button, Link, Table, Warning } from '../../components/index.js'; +import useMetadata from '../../hooks/useMetadata.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { approveMetaRequest, rejectMetaRequest } from '../../messaging.js'; +import { styled } from '../../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/Popup/Metadata/index.tsx b/packages/extension-ui/src/Popup/Metadata/index.tsx index 41271a038e..3bb794b8da 100644 --- a/packages/extension-ui/src/Popup/Metadata/index.tsx +++ b/packages/extension-ui/src/Popup/Metadata/index.tsx @@ -3,10 +3,10 @@ import React, { useContext } from 'react'; -import { Loading, MetadataReqContext } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { Header } from '../../partials'; -import Request from './Request'; +import { Loading, MetadataReqContext } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { Header } from '../../partials/index.js'; +import Request from './Request.js'; export default function Metadata (): React.ReactElement { const { t } = useTranslation(); diff --git a/packages/extension-ui/src/Popup/PhishingDetected.tsx b/packages/extension-ui/src/Popup/PhishingDetected.tsx index ecb52605b3..b8f6367352 100644 --- a/packages/extension-ui/src/Popup/PhishingDetected.tsx +++ b/packages/extension-ui/src/Popup/PhishingDetected.tsx @@ -1,15 +1,15 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; import { Trans } from 'react-i18next'; import { useParams } from 'react-router'; -import useTranslation from '../hooks/useTranslation'; -import { Header } from '../partials'; -import { styled } from '../styled'; +import useTranslation from '../hooks/useTranslation.js'; +import { Header } from '../partials/index.js'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/RestoreJson.tsx b/packages/extension-ui/src/Popup/RestoreJson.tsx index c0f05f1cf8..a600a17b29 100644 --- a/packages/extension-ui/src/Popup/RestoreJson.tsx +++ b/packages/extension-ui/src/Popup/RestoreJson.tsx @@ -9,13 +9,13 @@ import React, { useCallback, useContext, useEffect, useState } from 'react'; import { u8aToString } from '@polkadot/util'; -import { AccountContext, ActionContext, Address, Button, InputFileWithLabel, InputWithLabel, Warning } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import { batchRestore, jsonGetAccountInfo, jsonRestore } from '../messaging'; -import { Header } from '../partials'; -import { styled } from '../styled'; -import { DEFAULT_TYPE } from '../util/defaultType'; -import { isKeyringPairs$Json } from '../util/typeGuards'; +import { AccountContext, ActionContext, Address, Button, InputFileWithLabel, InputWithLabel, Warning } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { batchRestore, jsonGetAccountInfo, jsonRestore } from '../messaging.js'; +import { Header } from '../partials/index.js'; +import { styled } from '../styled.js'; +import { DEFAULT_TYPE } from '../util/defaultType.js'; +import { isKeyringPairs$Json } from '../util/typeGuards.js'; const acceptedFormats = ['application/json', 'text/plain'].join(', '); diff --git a/packages/extension-ui/src/Popup/Signing/Bytes.tsx b/packages/extension-ui/src/Popup/Signing/Bytes.tsx index 1fac46cb27..d4f0294a6e 100644 --- a/packages/extension-ui/src/Popup/Signing/Bytes.tsx +++ b/packages/extension-ui/src/Popup/Signing/Bytes.tsx @@ -1,14 +1,14 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React, { useMemo } from 'react'; import { isAscii, u8aToString, u8aUnwrapBytes } from '@polkadot/util'; -import useTranslation from '../../hooks/useTranslation'; -import { styled } from '../../styled'; +import useTranslation from '../../hooks/useTranslation.js'; +import { styled } from '../../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/Popup/Signing/Extrinsic.tsx b/packages/extension-ui/src/Popup/Signing/Extrinsic.tsx index d97515b5ec..7101a9aa4b 100644 --- a/packages/extension-ui/src/Popup/Signing/Extrinsic.tsx +++ b/packages/extension-ui/src/Popup/Signing/Extrinsic.tsx @@ -10,9 +10,9 @@ import React, { useMemo, useRef } from 'react'; import { BN, bnToBn, formatNumber } from '@polkadot/util'; -import { Table } from '../../components'; -import useMetadata from '../../hooks/useMetadata'; -import useTranslation from '../../hooks/useTranslation'; +import { Table } from '../../components/index.js'; +import useMetadata from '../../hooks/useMetadata.js'; +import useTranslation from '../../hooks/useTranslation.js'; interface Decoded { args: AnyJson | null; diff --git a/packages/extension-ui/src/Popup/Signing/LedgerSign.tsx b/packages/extension-ui/src/Popup/Signing/LedgerSign.tsx index 6fbc24afc2..5ed8bc9a16 100644 --- a/packages/extension-ui/src/Popup/Signing/LedgerSign.tsx +++ b/packages/extension-ui/src/Popup/Signing/LedgerSign.tsx @@ -8,10 +8,10 @@ import { faSync } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useCallback, useEffect, useState } from 'react'; -import { Button, Warning } from '../../components'; -import { useLedger } from '../../hooks/useLedger'; -import useTranslation from '../../hooks/useTranslation'; -import { styled } from '../../styled'; +import { Button, Warning } from '../../components/index.js'; +import { useLedger } from '../../hooks/useLedger.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { styled } from '../../styled.js'; interface Props { accountIndex?: number; diff --git a/packages/extension-ui/src/Popup/Signing/Qr.tsx b/packages/extension-ui/src/Popup/Signing/Qr.tsx index 81a8dcdd46..976e774c94 100644 --- a/packages/extension-ui/src/Popup/Signing/Qr.tsx +++ b/packages/extension-ui/src/Popup/Signing/Qr.tsx @@ -9,10 +9,10 @@ import React, { useCallback, useMemo, useState } from 'react'; import { wrapBytes } from '@polkadot/extension-dapp/wrapBytes'; import { QrDisplayPayload, QrScanSignature } from '@polkadot/react-qr'; -import { Button } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { styled } from '../../styled'; -import { CMD_MORTAL, CMD_SIGN_MESSAGE } from './Request'; +import { Button } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { styled } from '../../styled.js'; +import { CMD_MORTAL, CMD_SIGN_MESSAGE } from './Request/index.js'; interface Props { address: string; diff --git a/packages/extension-ui/src/Popup/Signing/Request/SignArea.tsx b/packages/extension-ui/src/Popup/Signing/Request/SignArea.tsx index 67eee4865c..3ee276d37e 100644 --- a/packages/extension-ui/src/Popup/Signing/Request/SignArea.tsx +++ b/packages/extension-ui/src/Popup/Signing/Request/SignArea.tsx @@ -5,11 +5,11 @@ import React, { useCallback, useContext, useEffect, useState } from 'react'; import { PASSWORD_EXPIRY_MIN } from '@polkadot/extension-base/defaults'; -import { ActionBar, ActionContext, Button, ButtonArea, Checkbox, Link } from '../../../components'; -import useTranslation from '../../../hooks/useTranslation'; -import { approveSignPassword, cancelSignRequest, isSignLocked } from '../../../messaging'; -import { styled } from '../../../styled'; -import Unlock from '../Unlock'; +import { ActionBar, ActionContext, Button, ButtonArea, Checkbox, Link } from '../../../components/index.js'; +import useTranslation from '../../../hooks/useTranslation.js'; +import { approveSignPassword, cancelSignRequest, isSignLocked } from '../../../messaging.js'; +import { styled } from '../../../styled.js'; +import Unlock from '../Unlock.js'; interface Props { buttonText: string; diff --git a/packages/extension-ui/src/Popup/Signing/Request/index.tsx b/packages/extension-ui/src/Popup/Signing/Request/index.tsx index 2acfe7ead4..b859a3dd0a 100644 --- a/packages/extension-ui/src/Popup/Signing/Request/index.tsx +++ b/packages/extension-ui/src/Popup/Signing/Request/index.tsx @@ -10,14 +10,14 @@ import React, { useCallback, useContext, useEffect, useState } from 'react'; import { TypeRegistry } from '@polkadot/types'; -import { ActionContext, Address, VerticalSpace, Warning } from '../../../components'; -import { useTranslation } from '../../../components/translate'; -import { approveSignSignature } from '../../../messaging'; -import Bytes from '../Bytes'; -import Extrinsic from '../Extrinsic'; -import LedgerSign from '../LedgerSign'; -import Qr from '../Qr'; -import SignArea from './SignArea'; +import { ActionContext, Address, VerticalSpace, Warning } from '../../../components/index.js'; +import { useTranslation } from '../../../components/translate.js'; +import { approveSignSignature } from '../../../messaging.js'; +import Bytes from '../Bytes.js'; +import Extrinsic from '../Extrinsic.js'; +import LedgerSign from '../LedgerSign.js'; +import Qr from '../Qr.js'; +import SignArea from './SignArea.js'; interface Props { account: AccountJson; diff --git a/packages/extension-ui/src/Popup/Signing/Signing.spec.tsx b/packages/extension-ui/src/Popup/Signing/Signing.spec.tsx index c0f698b927..5c27265957 100644 --- a/packages/extension-ui/src/Popup/Signing/Signing.spec.tsx +++ b/packages/extension-ui/src/Popup/Signing/Signing.spec.tsx @@ -15,16 +15,16 @@ import React, { useState } from 'react'; import { act } from 'react-dom/test-utils'; import { ThemeProvider } from 'styled-components'; -import { ActionContext, Address, Button, Input, SigningReqContext, themes } from '../../components'; -import * as messaging from '../../messaging'; -import * as MetadataCache from '../../MetadataCache'; -import { flushAllPromises } from '../../testHelpers'; -import Extrinsic from './Extrinsic'; -import { westendMetadata } from './metadataMock'; -import Qr from './Qr'; -import Request from './Request'; -import TransactionIndex from './TransactionIndex'; -import Signing from '.'; +import { ActionContext, Address, Button, Input, SigningReqContext, themes } from '../../components/index.js'; +import * as messaging from '../../messaging.js'; +import * as MetadataCache from '../../MetadataCache.js'; +import { flushAllPromises } from '../../testHelpers.js'; +import Request from './Request/index.js'; +import Extrinsic from './Extrinsic.js'; +import Signing from './index.js'; +import { westendMetadata } from './metadataMock.js'; +import Qr from './Qr.js'; +import TransactionIndex from './TransactionIndex.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/Popup/Signing/TransactionIndex.tsx b/packages/extension-ui/src/Popup/Signing/TransactionIndex.tsx index 69671156f4..5b1de6bbb4 100644 --- a/packages/extension-ui/src/Popup/Signing/TransactionIndex.tsx +++ b/packages/extension-ui/src/Popup/Signing/TransactionIndex.tsx @@ -1,13 +1,13 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import { faArrowLeft, faArrowRight } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useCallback } from 'react'; -import { styled } from '../../styled'; +import { styled } from '../../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/Popup/Signing/Unlock.tsx b/packages/extension-ui/src/Popup/Signing/Unlock.tsx index 6e4052fcd0..bd5539b9ce 100644 --- a/packages/extension-ui/src/Popup/Signing/Unlock.tsx +++ b/packages/extension-ui/src/Popup/Signing/Unlock.tsx @@ -3,8 +3,8 @@ import React, { useCallback } from 'react'; -import { InputWithLabel, Warning } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; +import { InputWithLabel, Warning } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/Popup/Signing/index.tsx b/packages/extension-ui/src/Popup/Signing/index.tsx index 6d8a8aca48..846fd67b2a 100644 --- a/packages/extension-ui/src/Popup/Signing/index.tsx +++ b/packages/extension-ui/src/Popup/Signing/index.tsx @@ -5,11 +5,11 @@ import type { SignerPayloadJSON } from '@polkadot/types/types'; import React, { useCallback, useContext, useEffect, useState } from 'react'; -import { Loading, SigningReqContext } from '../../components'; -import useTranslation from '../../hooks/useTranslation'; -import { Header } from '../../partials'; -import Request from './Request'; -import TransactionIndex from './TransactionIndex'; +import { Loading, SigningReqContext } from '../../components/index.js'; +import useTranslation from '../../hooks/useTranslation.js'; +import { Header } from '../../partials/index.js'; +import Request from './Request/index.js'; +import TransactionIndex from './TransactionIndex.js'; export default function Signing (): React.ReactElement { const { t } = useTranslation(); diff --git a/packages/extension-ui/src/Popup/Welcome.tsx b/packages/extension-ui/src/Popup/Welcome.tsx index 3c375fec05..1386824520 100644 --- a/packages/extension-ui/src/Popup/Welcome.tsx +++ b/packages/extension-ui/src/Popup/Welcome.tsx @@ -1,14 +1,14 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback, useContext } from 'react'; -import { ActionContext, Box, Button, ButtonArea, List, VerticalSpace } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import { Header } from '../partials'; -import { styled } from '../styled'; +import { ActionContext, Box, Button, ButtonArea, List, VerticalSpace } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { Header } from '../partials/index.js'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/Popup/index.tsx b/packages/extension-ui/src/Popup/index.tsx index d588448b69..d6a2e802cb 100644 --- a/packages/extension-ui/src/Popup/index.tsx +++ b/packages/extension-ui/src/Popup/index.tsx @@ -11,28 +11,28 @@ import { PHISHING_PAGE_REDIRECT } from '@polkadot/extension-base/defaults'; import { canDerive } from '@polkadot/extension-base/utils'; import uiSettings from '@polkadot/ui-settings'; -import { ErrorBoundary, Loading } from '../components'; -import { AccountContext, ActionContext, AuthorizeReqContext, MediaContext, MetadataReqContext, SettingsContext, SigningReqContext } from '../components/contexts'; -import ToastProvider from '../components/Toast/ToastProvider'; -import { subscribeAccounts, subscribeAuthorizeRequests, subscribeMetadataRequests, subscribeSigningRequests } from '../messaging'; -import { buildHierarchy } from '../util/buildHierarchy'; -import AccountManagement from './AuthManagement/AccountManagement'; -import Accounts from './Accounts'; -import AuthList from './AuthManagement'; -import Authorize from './Authorize'; -import CreateAccount from './CreateAccount'; -import Derive from './Derive'; -import Export from './Export'; -import ExportAll from './ExportAll'; -import Forget from './Forget'; -import ImportLedger from './ImportLedger'; -import ImportQr from './ImportQr'; -import ImportSeed from './ImportSeed'; -import Metadata from './Metadata'; -import PhishingDetected from './PhishingDetected'; -import RestoreJson from './RestoreJson'; -import Signing from './Signing'; -import Welcome from './Welcome'; +import { AccountContext, ActionContext, AuthorizeReqContext, MediaContext, MetadataReqContext, SettingsContext, SigningReqContext } from '../components/contexts.js'; +import { ErrorBoundary, Loading } from '../components/index.js'; +import ToastProvider from '../components/Toast/ToastProvider.js'; +import { subscribeAccounts, subscribeAuthorizeRequests, subscribeMetadataRequests, subscribeSigningRequests } from '../messaging.js'; +import { buildHierarchy } from '../util/buildHierarchy.js'; +import Accounts from './Accounts/index.js'; +import AccountManagement from './AuthManagement/AccountManagement.js'; +import AuthList from './AuthManagement/index.js'; +import Authorize from './Authorize/index.js'; +import CreateAccount from './CreateAccount/index.js'; +import Derive from './Derive/index.js'; +import ImportSeed from './ImportSeed/index.js'; +import Metadata from './Metadata/index.js'; +import Signing from './Signing/index.js'; +import Export from './Export.js'; +import ExportAll from './ExportAll.js'; +import Forget from './Forget.js'; +import ImportLedger from './ImportLedger.js'; +import ImportQr from './ImportQr.js'; +import PhishingDetected from './PhishingDetected.js'; +import RestoreJson from './RestoreJson.js'; +import Welcome from './Welcome.js'; const startSettings = uiSettings.get(); @@ -87,7 +87,7 @@ export default function Popup (): React.ReactElement { return; } - to === '..' + to === '../index.js' // if we can't go gack from there, go to the home ? history.length === 1 ? history.push('/') diff --git a/packages/extension-ui/src/components/AccountNamePasswordCreation.spec.tsx b/packages/extension-ui/src/components/AccountNamePasswordCreation.spec.tsx index 2ce65a2469..fff3a9d06d 100644 --- a/packages/extension-ui/src/components/AccountNamePasswordCreation.spec.tsx +++ b/packages/extension-ui/src/components/AccountNamePasswordCreation.spec.tsx @@ -12,9 +12,9 @@ import enzyme from 'enzyme'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import { flushAllPromises } from '../testHelpers'; -import BackButton from './BackButton'; -import { AccountNamePasswordCreation, Input, InputWithLabel, NextStepButton } from '.'; +import { flushAllPromises } from '../testHelpers.js'; +import BackButton from './BackButton.js'; +import { AccountNamePasswordCreation, Input, InputWithLabel, NextStepButton } from './index.js'; // For this file, there are a lot of them /* eslint-disable @typescript-eslint/no-unsafe-argument */ diff --git a/packages/extension-ui/src/components/AccountNamePasswordCreation.tsx b/packages/extension-ui/src/components/AccountNamePasswordCreation.tsx index 1ce2db7bfc..bd51ba8b8b 100644 --- a/packages/extension-ui/src/components/AccountNamePasswordCreation.tsx +++ b/packages/extension-ui/src/components/AccountNamePasswordCreation.tsx @@ -3,8 +3,8 @@ import React, { useCallback, useState } from 'react'; -import { Name, Password } from '../partials'; -import { BackButton, ButtonArea, NextStepButton, VerticalSpace } from '.'; +import { Name, Password } from '../partials/index.js'; +import { BackButton, ButtonArea, NextStepButton, VerticalSpace } from './index.js'; interface Props { buttonLabel?: string; diff --git a/packages/extension-ui/src/components/ActionBar.tsx b/packages/extension-ui/src/components/ActionBar.tsx index 3c88e25372..eb45574d93 100644 --- a/packages/extension-ui/src/components/ActionBar.tsx +++ b/packages/extension-ui/src/components/ActionBar.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/ActionText.tsx b/packages/extension-ui/src/components/ActionText.tsx index 12d57eb8e8..6da1256b4b 100644 --- a/packages/extension-ui/src/components/ActionText.tsx +++ b/packages/extension-ui/src/components/ActionText.tsx @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 import type { IconDefinition } from '@fortawesome/fontawesome-svg-core'; -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { MouseEventHandler } from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/components/Address.spec.tsx b/packages/extension-ui/src/components/Address.spec.tsx index 32c9362fd4..6c9ae5e5ff 100644 --- a/packages/extension-ui/src/components/Address.spec.tsx +++ b/packages/extension-ui/src/components/Address.spec.tsx @@ -15,14 +15,14 @@ import enzyme from 'enzyme'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import * as messaging from '../messaging'; -import * as MetadataCache from '../MetadataCache'; -import { westendMetadata } from '../Popup/Signing/metadataMock'; -import { flushAllPromises } from '../testHelpers'; -import { buildHierarchy } from '../util/buildHierarchy'; -import { DEFAULT_TYPE } from '../util/defaultType'; -import getParentNameSuri from '../util/getParentNameSuri'; -import { AccountContext, Address } from '.'; +import * as messaging from '../messaging.js'; +import * as MetadataCache from '../MetadataCache.js'; +import { westendMetadata } from '../Popup/Signing/metadataMock.js'; +import { flushAllPromises } from '../testHelpers.js'; +import { buildHierarchy } from '../util/buildHierarchy.js'; +import { DEFAULT_TYPE } from '../util/defaultType.js'; +import getParentNameSuri from '../util/getParentNameSuri.js'; +import { AccountContext, Address } from './index.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/components/Address.tsx b/packages/extension-ui/src/components/Address.tsx index e940110e3e..f0e075e394 100644 --- a/packages/extension-ui/src/components/Address.tsx +++ b/packages/extension-ui/src/components/Address.tsx @@ -6,7 +6,7 @@ import type { Chain } from '@polkadot/extension-chains/types'; import type { IconTheme } from '@polkadot/react-identicon/types'; import type { SettingsStruct } from '@polkadot/ui-settings/types'; import type { KeypairType } from '@polkadot/util-crypto/types'; -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faUsb } from '@fortawesome/free-brands-svg-icons'; import { faCopy, faEye, faEyeSlash } from '@fortawesome/free-regular-svg-icons'; @@ -18,18 +18,18 @@ import CopyToClipboard from 'react-copy-to-clipboard'; import { decodeAddress, encodeAddress } from '@polkadot/util-crypto'; import details from '../assets/details.svg'; -import useMetadata from '../hooks/useMetadata'; -import useOutsideClick from '../hooks/useOutsideClick'; -import useToast from '../hooks/useToast'; -import useTranslation from '../hooks/useTranslation'; -import { showAccount } from '../messaging'; -import { styled } from '../styled'; -import { DEFAULT_TYPE } from '../util/defaultType'; -import getParentNameSuri from '../util/getParentNameSuri'; -import { AccountContext, SettingsContext } from './contexts'; -import Identicon from './Identicon'; -import Menu from './Menu'; -import Svg from './Svg'; +import useMetadata from '../hooks/useMetadata.js'; +import useOutsideClick from '../hooks/useOutsideClick.js'; +import useToast from '../hooks/useToast.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { showAccount } from '../messaging.js'; +import { styled } from '../styled.js'; +import { DEFAULT_TYPE } from '../util/defaultType.js'; +import getParentNameSuri from '../util/getParentNameSuri.js'; +import { AccountContext, SettingsContext } from './contexts.js'; +import Identicon from './Identicon.js'; +import Menu from './Menu.js'; +import Svg from './Svg.js'; export interface Props { actions?: React.ReactNode; diff --git a/packages/extension-ui/src/components/BackButton.tsx b/packages/extension-ui/src/components/BackButton.tsx index d9b4f3e05d..11cbff7d65 100644 --- a/packages/extension-ui/src/components/BackButton.tsx +++ b/packages/extension-ui/src/components/BackButton.tsx @@ -1,14 +1,14 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faArrowLeft } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; -import { styled } from '../styled'; -import Button from './Button'; +import { styled } from '../styled.js'; +import Button from './Button.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/components/Box.tsx b/packages/extension-ui/src/components/Box.tsx index 04da17c35d..31eda4ac7d 100644 --- a/packages/extension-ui/src/components/Box.tsx +++ b/packages/extension-ui/src/components/Box.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { banner?: React.ReactNode; diff --git a/packages/extension-ui/src/components/Button.tsx b/packages/extension-ui/src/components/Button.tsx index 7ccf105a20..99b624647e 100644 --- a/packages/extension-ui/src/components/Button.tsx +++ b/packages/extension-ui/src/components/Button.tsx @@ -1,12 +1,12 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback } from 'react'; -import { styled } from '../styled'; -import Spinner from './Spinner'; +import { styled } from '../styled.js'; +import Spinner from './Spinner.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/components/ButtonArea.tsx b/packages/extension-ui/src/components/ButtonArea.tsx index be3b63236e..e63459f9e1 100644 --- a/packages/extension-ui/src/components/ButtonArea.tsx +++ b/packages/extension-ui/src/components/ButtonArea.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/components/ButtonWithSubtitle.tsx b/packages/extension-ui/src/components/ButtonWithSubtitle.tsx index 88a1229a57..68022776c6 100644 --- a/packages/extension-ui/src/components/ButtonWithSubtitle.tsx +++ b/packages/extension-ui/src/components/ButtonWithSubtitle.tsx @@ -3,8 +3,8 @@ import React from 'react'; -import { styled } from '../styled'; -import { Button } from '.'; +import { styled } from '../styled.js'; +import { Button } from './index.js'; interface ButtonWithSubtitleProps { title: string; diff --git a/packages/extension-ui/src/components/Checkbox.tsx b/packages/extension-ui/src/components/Checkbox.tsx index 795ac0dda7..aa21fca689 100644 --- a/packages/extension-ui/src/components/Checkbox.tsx +++ b/packages/extension-ui/src/components/Checkbox.tsx @@ -1,12 +1,12 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback, useEffect } from 'react'; import Checkmark from '../assets/checkmark.svg'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { checked: boolean; diff --git a/packages/extension-ui/src/components/Dropdown.tsx b/packages/extension-ui/src/components/Dropdown.tsx index 57d41b7d79..18276df30f 100644 --- a/packages/extension-ui/src/components/Dropdown.tsx +++ b/packages/extension-ui/src/components/Dropdown.tsx @@ -1,13 +1,13 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback } from 'react'; import arrow from '../assets/arrow-down.svg'; -import { styled } from '../styled'; -import Label from './Label'; +import { styled } from '../styled.js'; +import Label from './Label.js'; interface DropdownOption { text: string; diff --git a/packages/extension-ui/src/components/ErrorBoundary.tsx b/packages/extension-ui/src/components/ErrorBoundary.tsx index 1e8dc231ad..e98a774b3c 100644 --- a/packages/extension-ui/src/components/ErrorBoundary.tsx +++ b/packages/extension-ui/src/components/ErrorBoundary.tsx @@ -4,11 +4,11 @@ import React from 'react'; import { WithTranslation } from 'react-i18next'; -import Header from '../partials/Header'; -import Button from './Button'; -import ButtonArea from './ButtonArea'; -import translate from './translate'; -import VerticalSpace from './VerticalSpace'; +import Header from '../partials/Header.js'; +import Button from './Button.js'; +import ButtonArea from './ButtonArea.js'; +import translate from './translate.js'; +import VerticalSpace from './VerticalSpace.js'; interface Props extends WithTranslation { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/Icon.tsx b/packages/extension-ui/src/components/Icon.tsx index 2be0bfd91b..d69fd236d3 100644 --- a/packages/extension-ui/src/components/Icon.tsx +++ b/packages/extension-ui/src/components/Icon.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/components/Identicon.tsx b/packages/extension-ui/src/components/Identicon.tsx index 227340a0db..9721c6dc75 100644 --- a/packages/extension-ui/src/components/Identicon.tsx +++ b/packages/extension-ui/src/components/Identicon.tsx @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 import type { IconTheme } from '@polkadot/react-identicon/types'; -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; import Icon from '@polkadot/react-identicon'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/components/InputFileWithLabel.tsx b/packages/extension-ui/src/components/InputFileWithLabel.tsx index 00f63840b6..6fe4e00dc6 100644 --- a/packages/extension-ui/src/components/InputFileWithLabel.tsx +++ b/packages/extension-ui/src/components/InputFileWithLabel.tsx @@ -1,16 +1,16 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { createRef, useCallback, useState } from 'react'; import Dropzone, { DropzoneRef } from 'react-dropzone'; import { formatNumber, hexToU8a, isHex, u8aToString } from '@polkadot/util'; -import useTranslation from '../hooks/useTranslation'; -import { styled } from '../styled'; -import Label from './Label'; +import useTranslation from '../hooks/useTranslation.js'; +import { styled } from '../styled.js'; +import Label from './Label.js'; function classes (...classNames: (boolean | null | string | undefined)[]): string { return classNames diff --git a/packages/extension-ui/src/components/InputFilter.tsx b/packages/extension-ui/src/components/InputFilter.tsx index edea345a0b..442a5516c4 100644 --- a/packages/extension-ui/src/components/InputFilter.tsx +++ b/packages/extension-ui/src/components/InputFilter.tsx @@ -5,9 +5,9 @@ import { faTimes } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useCallback, useRef } from 'react'; -import { styled } from '../styled'; -import { ThemeProps } from '../types'; -import { Input } from './TextInputs'; +import { styled } from '../styled.js'; +import { ThemeProps } from '../types.js'; +import { Input } from './TextInputs.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/components/InputWithLabel.tsx b/packages/extension-ui/src/components/InputWithLabel.tsx index 8a23d14c58..6cde6db1e5 100644 --- a/packages/extension-ui/src/components/InputWithLabel.tsx +++ b/packages/extension-ui/src/components/InputWithLabel.tsx @@ -3,11 +3,11 @@ import React, { useCallback, useState } from 'react'; -import useTranslation from '../hooks/useTranslation'; -import { styled } from '../styled'; -import Label from './Label'; -import { Input } from './TextInputs'; -import Warning from './Warning'; +import useTranslation from '../hooks/useTranslation.js'; +import { styled } from '../styled.js'; +import Label from './Label.js'; +import { Input } from './TextInputs.js'; +import Warning from './Warning.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/components/Label.tsx b/packages/extension-ui/src/components/Label.tsx index 8db38bf922..c120099393 100644 --- a/packages/extension-ui/src/components/Label.tsx +++ b/packages/extension-ui/src/components/Label.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/Link.tsx b/packages/extension-ui/src/components/Link.tsx index 2467fd6f56..eab348aa42 100644 --- a/packages/extension-ui/src/components/Link.tsx +++ b/packages/extension-ui/src/components/Link.tsx @@ -1,12 +1,12 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; import { Link as RouterLink } from 'react-router-dom'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { children?: React.ReactNode; diff --git a/packages/extension-ui/src/components/List.tsx b/packages/extension-ui/src/components/List.tsx index 0d70038a27..4be4c70b43 100644 --- a/packages/extension-ui/src/components/List.tsx +++ b/packages/extension-ui/src/components/List.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/components/Loading.tsx b/packages/extension-ui/src/components/Loading.tsx index ba1fdc2ca8..2b4b8b58e2 100644 --- a/packages/extension-ui/src/components/Loading.tsx +++ b/packages/extension-ui/src/components/Loading.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import useTranslation from '../hooks/useTranslation'; +import useTranslation from '../hooks/useTranslation.js'; interface Props { children?: React.ReactNode; diff --git a/packages/extension-ui/src/components/Main.tsx b/packages/extension-ui/src/components/Main.tsx index e9070a557a..a3dc1f25c7 100644 --- a/packages/extension-ui/src/components/Main.tsx +++ b/packages/extension-ui/src/components/Main.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/Menu.tsx b/packages/extension-ui/src/components/Menu.tsx index ebf37353c2..2c506ee0a3 100644 --- a/packages/extension-ui/src/components/Menu.tsx +++ b/packages/extension-ui/src/components/Menu.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/MenuDivider.tsx b/packages/extension-ui/src/components/MenuDivider.tsx index 4fa014696f..3bc4541335 100644 --- a/packages/extension-ui/src/components/MenuDivider.tsx +++ b/packages/extension-ui/src/components/MenuDivider.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/components/MenuItem.tsx b/packages/extension-ui/src/components/MenuItem.tsx index 014e7a728b..ec9369ebce 100644 --- a/packages/extension-ui/src/components/MenuItem.tsx +++ b/packages/extension-ui/src/components/MenuItem.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/MnemonicSeed.tsx b/packages/extension-ui/src/components/MnemonicSeed.tsx index 0a6b565562..225de7afcf 100644 --- a/packages/extension-ui/src/components/MnemonicSeed.tsx +++ b/packages/extension-ui/src/components/MnemonicSeed.tsx @@ -1,15 +1,15 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faCopy } from '@fortawesome/free-regular-svg-icons'; import React, { MouseEventHandler } from 'react'; -import useTranslation from '../hooks/useTranslation'; -import { styled } from '../styled'; -import ActionText from './ActionText'; -import TextAreaWithLabel from './TextAreaWithLabel'; +import useTranslation from '../hooks/useTranslation.js'; +import { styled } from '../styled.js'; +import ActionText from './ActionText.js'; +import TextAreaWithLabel from './TextAreaWithLabel.js'; interface Props { seed: string; diff --git a/packages/extension-ui/src/components/NextStepButton.tsx b/packages/extension-ui/src/components/NextStepButton.tsx index dad370c40e..c1d05076f5 100644 --- a/packages/extension-ui/src/components/NextStepButton.tsx +++ b/packages/extension-ui/src/components/NextStepButton.tsx @@ -1,14 +1,14 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faArrowRight } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; -import { styled } from '../styled'; -import Button from './Button'; +import { styled } from '../styled.js'; +import Button from './Button.js'; type Props = React.ComponentProps; diff --git a/packages/extension-ui/src/components/RemoveAuth.tsx b/packages/extension-ui/src/components/RemoveAuth.tsx index d68e0d80c1..dcd038c51b 100644 --- a/packages/extension-ui/src/components/RemoveAuth.tsx +++ b/packages/extension-ui/src/components/RemoveAuth.tsx @@ -1,13 +1,13 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faTrash } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props{ className?: string diff --git a/packages/extension-ui/src/components/Spinner.tsx b/packages/extension-ui/src/components/Spinner.tsx index c354b48c4d..9154a81e85 100644 --- a/packages/extension-ui/src/components/Spinner.tsx +++ b/packages/extension-ui/src/components/Spinner.tsx @@ -1,12 +1,12 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; import spinnerSrc from '../assets/spinner.png'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/components/Svg.tsx b/packages/extension-ui/src/components/Svg.tsx index 50e926b04b..cd1f22ee2b 100644 --- a/packages/extension-ui/src/components/Svg.tsx +++ b/packages/extension-ui/src/components/Svg.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/components/Switch.tsx b/packages/extension-ui/src/components/Switch.tsx index 4e70e30201..4ba507c28a 100644 --- a/packages/extension-ui/src/components/Switch.tsx +++ b/packages/extension-ui/src/components/Switch.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback } from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { checked: boolean; diff --git a/packages/extension-ui/src/components/Table.tsx b/packages/extension-ui/src/components/Table.tsx index 1d712b4c35..fe8309eddc 100644 --- a/packages/extension-ui/src/components/Table.tsx +++ b/packages/extension-ui/src/components/Table.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/TextAreaWithLabel.tsx b/packages/extension-ui/src/components/TextAreaWithLabel.tsx index 013a3d50e7..21a0725557 100644 --- a/packages/extension-ui/src/components/TextAreaWithLabel.tsx +++ b/packages/extension-ui/src/components/TextAreaWithLabel.tsx @@ -3,8 +3,8 @@ import React, { useCallback } from 'react'; -import Label from './Label'; -import { TextArea } from './TextInputs'; +import Label from './Label.js'; +import { TextArea } from './TextInputs.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/components/TextInputs.ts b/packages/extension-ui/src/components/TextInputs.ts index b0c2b5583c..6f43b5ad73 100644 --- a/packages/extension-ui/src/components/TextInputs.ts +++ b/packages/extension-ui/src/components/TextInputs.ts @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { css } from 'styled-components'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { withError?: boolean; diff --git a/packages/extension-ui/src/components/Toast/Toast.tsx b/packages/extension-ui/src/components/Toast/Toast.tsx index ba1b8ef885..1621521dcb 100644 --- a/packages/extension-ui/src/components/Toast/Toast.tsx +++ b/packages/extension-ui/src/components/Toast/Toast.tsx @@ -1,11 +1,11 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../../types'; +import type { ThemeProps } from '../../types.js'; import React from 'react'; -import { styled } from '../../styled'; +import { styled } from '../../styled.js'; interface Props { content: React.ReactChild; diff --git a/packages/extension-ui/src/components/Toast/ToastProvider.tsx b/packages/extension-ui/src/components/Toast/ToastProvider.tsx index e2a8a7b4b1..c7d7ef2d94 100644 --- a/packages/extension-ui/src/components/Toast/ToastProvider.tsx +++ b/packages/extension-ui/src/components/Toast/ToastProvider.tsx @@ -3,8 +3,8 @@ import React, { useCallback, useState } from 'react'; -import { ToastContext } from '..'; -import Toast from './Toast'; +import { ToastContext } from '../index.js'; +import Toast from './Toast.js'; interface ToastProviderProps { children?: React.ReactNode; diff --git a/packages/extension-ui/src/components/ValidatedInput.tsx b/packages/extension-ui/src/components/ValidatedInput.tsx index 60062649ce..1fc6b6234a 100644 --- a/packages/extension-ui/src/components/ValidatedInput.tsx +++ b/packages/extension-ui/src/components/ValidatedInput.tsx @@ -3,9 +3,9 @@ import React, { useEffect, useState } from 'react'; -import useIsMounted from '../hooks/useIsMounted'; -import { Result, Validator } from '../util/validators'; -import Warning from './Warning'; +import useIsMounted from '../hooks/useIsMounted.js'; +import { Result, Validator } from '../util/validators.js'; +import Warning from './Warning.js'; interface BasicProps { isError?: boolean; diff --git a/packages/extension-ui/src/components/VerticalSpace.tsx b/packages/extension-ui/src/components/VerticalSpace.tsx index f1d217ca36..548b85cdb0 100644 --- a/packages/extension-ui/src/components/VerticalSpace.tsx +++ b/packages/extension-ui/src/components/VerticalSpace.tsx @@ -3,7 +3,7 @@ import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props { className?: string; diff --git a/packages/extension-ui/src/components/View.tsx b/packages/extension-ui/src/components/View.tsx index f219a964a1..e59a55e0c9 100644 --- a/packages/extension-ui/src/components/View.tsx +++ b/packages/extension-ui/src/components/View.tsx @@ -1,13 +1,13 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback, useState } from 'react'; import { createGlobalStyle, ThemeProvider } from 'styled-components'; // FIXME We should not import from index when this one is imported there as well -import { AvailableThemes, chooseTheme, Main, themes, ThemeSwitchContext } from '.'; +import { AvailableThemes, chooseTheme, Main, themes, ThemeSwitchContext } from './index.js'; interface Props { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/Warning.tsx b/packages/extension-ui/src/components/Warning.tsx index 1d7d9d2a6b..dc5cddcaed 100644 --- a/packages/extension-ui/src/components/Warning.tsx +++ b/packages/extension-ui/src/components/Warning.tsx @@ -1,13 +1,13 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; -import { styled } from '../styled'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { children: React.ReactNode; diff --git a/packages/extension-ui/src/components/index.ts b/packages/extension-ui/src/components/index.ts index 208d9d8bf2..e19f9d3533 100644 --- a/packages/extension-ui/src/components/index.ts +++ b/packages/extension-ui/src/components/index.ts @@ -1,45 +1,45 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -export { default as AccountNamePasswordCreation } from './AccountNamePasswordCreation'; -export { default as ActionBar } from './ActionBar'; -export { default as ActionText } from './ActionText'; -export { default as Address } from './Address'; -export { default as BackButton } from './BackButton'; -export { default as Box } from './Box'; -export { default as Button } from './Button'; -export { default as ButtonArea } from './ButtonArea'; -export { default as ButtonWithSubtitle } from './ButtonWithSubtitle'; -export { default as Checkbox } from './Checkbox'; -export { default as Dropdown } from './Dropdown'; -export { default as ErrorBoundary } from './ErrorBoundary'; -export { default as Icon } from './Icon'; -export { default as Identicon } from './Identicon'; -export { default as InputFilter } from './InputFilter'; -export { default as InputWithLabel } from './InputWithLabel'; -export { default as InputFileWithLabel } from './InputFileWithLabel'; -export { default as Label } from './Label'; -export { default as Link } from './Link'; -export { default as List } from './List'; -export { default as Loading } from './Loading'; -export { default as Main } from './Main'; -export { default as Menu } from './Menu'; -export { default as MenuDivider } from './MenuDivider'; -export { default as MenuItem } from './MenuItem'; -export { default as MnemonicSeed } from './MnemonicSeed'; -export { default as NextStepButton } from './NextStepButton'; -export { default as RemoveAuth } from './RemoveAuth'; -export { default as Spinner } from './Spinner'; -export { default as Svg } from './Svg'; -export { default as Switch } from './Switch'; -export { default as Table } from './Table'; -export { default as TextAreaWithLabel } from './TextAreaWithLabel'; -export { default as ValidatedInput } from './ValidatedInput'; -export { default as VerticalSpace } from './VerticalSpace'; -export { default as View } from './View'; -export { default as Warning } from './Warning'; +export { default as AccountNamePasswordCreation } from './AccountNamePasswordCreation.js'; +export { default as ActionBar } from './ActionBar.js'; +export { default as ActionText } from './ActionText.js'; +export { default as Address } from './Address.js'; +export { default as BackButton } from './BackButton.js'; +export { default as Box } from './Box.js'; +export { default as Button } from './Button.js'; +export { default as ButtonArea } from './ButtonArea.js'; +export { default as ButtonWithSubtitle } from './ButtonWithSubtitle.js'; +export { default as Checkbox } from './Checkbox.js'; +export { default as Dropdown } from './Dropdown.js'; +export { default as ErrorBoundary } from './ErrorBoundary.js'; +export { default as Icon } from './Icon.js'; +export { default as Identicon } from './Identicon.js'; +export { default as InputFilter } from './InputFilter.js'; +export { default as InputWithLabel } from './InputWithLabel.js'; +export { default as InputFileWithLabel } from './InputFileWithLabel.js'; +export { default as Label } from './Label.js'; +export { default as Link } from './Link.js'; +export { default as List } from './List.js'; +export { default as Loading } from './Loading.js'; +export { default as Main } from './Main.js'; +export { default as Menu } from './Menu.js'; +export { default as MenuDivider } from './MenuDivider.js'; +export { default as MenuItem } from './MenuItem.js'; +export { default as MnemonicSeed } from './MnemonicSeed.js'; +export { default as NextStepButton } from './NextStepButton.js'; +export { default as RemoveAuth } from './RemoveAuth.js'; +export { default as Spinner } from './Spinner.js'; +export { default as Svg } from './Svg.js'; +export { default as Switch } from './Switch.js'; +export { default as Table } from './Table.js'; +export { default as TextAreaWithLabel } from './TextAreaWithLabel.js'; +export { default as ValidatedInput } from './ValidatedInput.js'; +export { default as VerticalSpace } from './VerticalSpace.js'; +export { default as View } from './View.js'; +export { default as Warning } from './Warning.js'; -export { Input, TextArea } from './TextInputs'; +export { Input, TextArea } from './TextInputs.js'; -export * from './contexts'; -export * from './themes'; +export * from './contexts.js'; +export * from './themes.js'; diff --git a/packages/extension-ui/src/createView.tsx b/packages/extension-ui/src/createView.tsx index 57cfdef0c9..1851529003 100644 --- a/packages/extension-ui/src/createView.tsx +++ b/packages/extension-ui/src/createView.tsx @@ -1,13 +1,13 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import './i18n/i18n'; +import './i18n/i18n.js'; import React, { Suspense } from 'react'; import { createRoot } from 'react-dom/client'; import { HashRouter } from 'react-router-dom'; -import { View } from './components'; +import { View } from './components/index.js'; export default function createView (Entry: React.ComponentType, rootId = 'root'): void { const rootElement = document.getElementById(rootId); diff --git a/packages/extension-ui/src/hooks/useGenesisHashOptions.ts b/packages/extension-ui/src/hooks/useGenesisHashOptions.ts index 7e11369ad4..f4970008df 100644 --- a/packages/extension-ui/src/hooks/useGenesisHashOptions.ts +++ b/packages/extension-ui/src/hooks/useGenesisHashOptions.ts @@ -3,9 +3,9 @@ import { useEffect, useMemo, useState } from 'react'; -import { getAllMetadata } from '../messaging'; -import chains from '../util/chains'; -import useTranslation from './useTranslation'; +import { getAllMetadata } from '../messaging.js'; +import chains from '../util/chains.js'; +import useTranslation from './useTranslation.js'; interface Option { text: string; diff --git a/packages/extension-ui/src/hooks/useLedger.ts b/packages/extension-ui/src/hooks/useLedger.ts index 127a49074b..7a731aa688 100644 --- a/packages/extension-ui/src/hooks/useLedger.ts +++ b/packages/extension-ui/src/hooks/useLedger.ts @@ -8,8 +8,8 @@ import { Network } from '@polkadot/networks/types'; import uiSettings from '@polkadot/ui-settings'; import { assert } from '@polkadot/util'; -import ledgerChains from '../util/legerChains'; -import useTranslation from './useTranslation'; +import ledgerChains from '../util/legerChains.js'; +import useTranslation from './useTranslation.js'; interface StateBase { isLedgerCapable: boolean; diff --git a/packages/extension-ui/src/hooks/useMetadata.ts b/packages/extension-ui/src/hooks/useMetadata.ts index a30de71626..1266b99bb0 100644 --- a/packages/extension-ui/src/hooks/useMetadata.ts +++ b/packages/extension-ui/src/hooks/useMetadata.ts @@ -5,7 +5,7 @@ import type { Chain } from '@polkadot/extension-chains/types'; import { useEffect, useState } from 'react'; -import { getMetadata } from '../messaging'; +import { getMetadata } from '../messaging.js'; export default function useMetadata (genesisHash?: string | null, isPartial?: boolean): Chain | null { const [chain, setChain] = useState(null); diff --git a/packages/extension-ui/src/hooks/useToast.tsx b/packages/extension-ui/src/hooks/useToast.tsx index f0017b3cad..3c6515a4a2 100644 --- a/packages/extension-ui/src/hooks/useToast.tsx +++ b/packages/extension-ui/src/hooks/useToast.tsx @@ -3,7 +3,7 @@ import { useContext } from 'react'; -import { ToastContext } from '../components/contexts'; +import { ToastContext } from '../components/contexts.js'; export default function useToast (): {show: (message: string) => void} { return useContext(ToastContext); diff --git a/packages/extension-ui/src/i18n/Backend.ts b/packages/extension-ui/src/i18n/Backend.ts index f0e0d37558..e85ac8aad6 100644 --- a/packages/extension-ui/src/i18n/Backend.ts +++ b/packages/extension-ui/src/i18n/Backend.ts @@ -1,7 +1,7 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 -import languageCache from './cache'; +import languageCache from './cache.js'; type Callback = (error: string | null, data: unknown) => void; diff --git a/packages/extension-ui/src/i18n/i18n.ts b/packages/extension-ui/src/i18n/i18n.ts index ef34b94bfe..96ddf5dcc9 100644 --- a/packages/extension-ui/src/i18n/i18n.ts +++ b/packages/extension-ui/src/i18n/i18n.ts @@ -6,7 +6,7 @@ import { initReactI18next } from 'react-i18next'; import uiSettings from '@polkadot/ui-settings'; -import Backend from './Backend'; +import Backend from './Backend.js'; i18next .use(initReactI18next) diff --git a/packages/extension-ui/src/index.ts b/packages/extension-ui/src/index.ts index 6a09759dd4..c7531a6523 100644 --- a/packages/extension-ui/src/index.ts +++ b/packages/extension-ui/src/index.ts @@ -3,5 +3,5 @@ import '@polkadot/types-augment'; -export { default as createView } from './createView'; -export { default as Popup } from './Popup'; +export { default as createView } from './createView.js'; +export { default as Popup } from './Popup/index.js'; diff --git a/packages/extension-ui/src/messaging.spec.ts b/packages/extension-ui/src/messaging.spec.ts index 887648bde4..8c22f93767 100644 --- a/packages/extension-ui/src/messaging.spec.ts +++ b/packages/extension-ui/src/messaging.spec.ts @@ -8,7 +8,7 @@ import '@polkadot/extension-mocks/chrome'; import Adapter from '@wojtekmaj/enzyme-adapter-react-17'; import enzyme from 'enzyme'; -import { exportAccount } from './messaging'; +import { exportAccount } from './messaging.js'; // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call enzyme.configure({ adapter: new Adapter() }); diff --git a/packages/extension-ui/src/messaging.ts b/packages/extension-ui/src/messaging.ts index 7bfe96d140..e75b31d512 100644 --- a/packages/extension-ui/src/messaging.ts +++ b/packages/extension-ui/src/messaging.ts @@ -14,8 +14,8 @@ import { getId } from '@polkadot/extension-base/utils/getId'; import { metadataExpand } from '@polkadot/extension-chains'; import { MetadataDef } from '@polkadot/extension-inject/types'; -import allChains from './util/chains'; -import { getSavedMeta, setSavedMeta } from './MetadataCache'; +import allChains from './util/chains.js'; +import { getSavedMeta, setSavedMeta } from './MetadataCache.js'; interface Handler { // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/packages/extension-ui/src/partials/AccountSelection.tsx b/packages/extension-ui/src/partials/AccountSelection.tsx index 1cb2033155..bb7095da69 100644 --- a/packages/extension-ui/src/partials/AccountSelection.tsx +++ b/packages/extension-ui/src/partials/AccountSelection.tsx @@ -1,15 +1,15 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { Trans } from 'react-i18next'; -import { AccountContext, Checkbox, Warning } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import AccountsTree from '../Popup/Accounts/AccountsTree'; -import { styled } from '../styled'; +import { AccountContext, Checkbox, Warning } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import AccountsTree from '../Popup/Accounts/AccountsTree.js'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/partials/Header.spec.tsx b/packages/extension-ui/src/partials/Header.spec.tsx index 504323c817..62757812c0 100644 --- a/packages/extension-ui/src/partials/Header.spec.tsx +++ b/packages/extension-ui/src/partials/Header.spec.tsx @@ -13,9 +13,9 @@ import React from 'react'; import { MemoryRouter } from 'react-router'; import { ThemeProvider } from 'styled-components'; -import { themes } from '../components'; -import Header from './Header'; -import Settings from './MenuSettings'; +import { themes } from '../components/index.js'; +import Header from './Header.js'; +import Settings from './MenuSettings.js'; const { configure, mount } = enzyme; diff --git a/packages/extension-ui/src/partials/Header.tsx b/packages/extension-ui/src/partials/Header.tsx index 991ef96ab2..a54cbd3cd1 100644 --- a/packages/extension-ui/src/partials/Header.tsx +++ b/packages/extension-ui/src/partials/Header.tsx @@ -1,22 +1,22 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faArrowLeft, faCog, faPlusCircle, faSearch } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'; import logo from '../assets/pjs.svg'; -import { ActionContext } from '../components'; -import InputFilter from '../components/InputFilter'; -import Link from '../components/Link'; -import useOutsideClick from '../hooks/useOutsideClick'; -import useTranslation from '../hooks/useTranslation'; -import { getConnectedTabsUrl } from '../messaging'; -import { styled } from '../styled'; -import MenuAdd from './MenuAdd'; -import MenuSettings from './MenuSettings'; +import { ActionContext } from '../components/index.js'; +import InputFilter from '../components/InputFilter.js'; +import Link from '../components/Link.js'; +import useOutsideClick from '../hooks/useOutsideClick.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { getConnectedTabsUrl } from '../messaging.js'; +import { styled } from '../styled.js'; +import MenuAdd from './MenuAdd.js'; +import MenuSettings from './MenuSettings.js'; interface Props extends ThemeProps { children?: React.ReactNode; @@ -94,7 +94,7 @@ function Header ({ children, className = '', onFilter, showAdd, showBackArrow, s ); const _onBackArrowClick = useCallback( - () => onAction('..') + () => onAction('../index.js') , [onAction]); return ( diff --git a/packages/extension-ui/src/partials/HeaderWithSteps.tsx b/packages/extension-ui/src/partials/HeaderWithSteps.tsx index 8addffd79c..89d4d695aa 100644 --- a/packages/extension-ui/src/partials/HeaderWithSteps.tsx +++ b/packages/extension-ui/src/partials/HeaderWithSteps.tsx @@ -1,13 +1,13 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import React, { useCallback, useContext } from 'react'; -import { ActionContext, ActionText } from '../components'; -import { styled } from '../styled'; -import Header from './Header'; +import { ActionContext, ActionText } from '../components/index.js'; +import { styled } from '../styled.js'; +import Header from './Header.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/partials/MenuAdd.tsx b/packages/extension-ui/src/partials/MenuAdd.tsx index d3b682dde8..4121a5fa32 100644 --- a/packages/extension-ui/src/partials/MenuAdd.tsx +++ b/packages/extension-ui/src/partials/MenuAdd.tsx @@ -1,19 +1,19 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { ThemeProps } from '../types'; +import type { ThemeProps } from '../types.js'; import { faUsb } from '@fortawesome/free-brands-svg-icons'; import { faCodeBranch, faFileExport, faFileUpload, faKey, faPlusCircle, faQrcode } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React, { useCallback, useContext } from 'react'; -import { AccountContext, Link, MediaContext, Menu, MenuDivider, MenuItem } from '../components'; -import useIsPopup from '../hooks/useIsPopup'; -import { useLedger } from '../hooks/useLedger'; -import useTranslation from '../hooks/useTranslation'; -import { windowOpen } from '../messaging'; -import { styled } from '../styled'; +import { AccountContext, Link, MediaContext, Menu, MenuDivider, MenuItem } from '../components/index.js'; +import useIsPopup from '../hooks/useIsPopup.js'; +import { useLedger } from '../hooks/useLedger.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { windowOpen } from '../messaging.js'; +import { styled } from '../styled.js'; interface Props extends ThemeProps { className?: string; diff --git a/packages/extension-ui/src/partials/MenuSettings.tsx b/packages/extension-ui/src/partials/MenuSettings.tsx index ddedca8adb..bc6eba4f95 100644 --- a/packages/extension-ui/src/partials/MenuSettings.tsx +++ b/packages/extension-ui/src/partials/MenuSettings.tsx @@ -1,7 +1,7 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { Theme, ThemeProps } from '../types'; +import type { Theme, ThemeProps } from '../types.js'; import { faExpand, faTasks } from '@fortawesome/free-solid-svg-icons'; import React, { useCallback, useContext, useEffect, useMemo, useState } from 'react'; @@ -9,12 +9,12 @@ import { ThemeContext } from 'styled-components'; import settings from '@polkadot/ui-settings'; -import { ActionContext, ActionText, Checkbox, Dropdown, Menu, MenuDivider, MenuItem, Svg, Switch, themes, ThemeSwitchContext } from '../components'; -import useIsPopup from '../hooks/useIsPopup'; -import useTranslation from '../hooks/useTranslation'; -import { setNotification, windowOpen } from '../messaging'; -import { styled } from '../styled'; -import getLanguageOptions from '../util/getLanguageOptions'; +import { ActionContext, ActionText, Checkbox, Dropdown, Menu, MenuDivider, MenuItem, Svg, Switch, themes, ThemeSwitchContext } from '../components/index.js'; +import useIsPopup from '../hooks/useIsPopup.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { setNotification, windowOpen } from '../messaging.js'; +import { styled } from '../styled.js'; +import getLanguageOptions from '../util/getLanguageOptions.js'; interface Option { text: string; diff --git a/packages/extension-ui/src/partials/Name.tsx b/packages/extension-ui/src/partials/Name.tsx index 1917fd40c1..817263e637 100644 --- a/packages/extension-ui/src/partials/Name.tsx +++ b/packages/extension-ui/src/partials/Name.tsx @@ -3,9 +3,9 @@ import React, { useContext, useMemo } from 'react'; -import { AccountContext, InputWithLabel, ValidatedInput } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import { isNotShorterThan } from '../util/validators'; +import { AccountContext, InputWithLabel, ValidatedInput } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { isNotShorterThan } from '../util/validators.js'; interface Props { address?: string; diff --git a/packages/extension-ui/src/partials/Password.tsx b/packages/extension-ui/src/partials/Password.tsx index add2d89ac0..af96e6eeeb 100644 --- a/packages/extension-ui/src/partials/Password.tsx +++ b/packages/extension-ui/src/partials/Password.tsx @@ -3,9 +3,9 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { InputWithLabel, ValidatedInput } from '../components'; -import useTranslation from '../hooks/useTranslation'; -import { allOf, isNotShorterThan, isSameAs, Validator } from '../util/validators'; +import { InputWithLabel, ValidatedInput } from '../components/index.js'; +import useTranslation from '../hooks/useTranslation.js'; +import { allOf, isNotShorterThan, isSameAs, Validator } from '../util/validators.js'; interface Props { isFocussed?: boolean; diff --git a/packages/extension-ui/src/partials/index.ts b/packages/extension-ui/src/partials/index.ts index e760130de1..1fdae6dccf 100644 --- a/packages/extension-ui/src/partials/index.ts +++ b/packages/extension-ui/src/partials/index.ts @@ -1,9 +1,9 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -export { default as Header } from './Header'; -export { default as MenuSettings } from './MenuSettings'; -export { default as Name } from './Name'; -export { default as Password } from './Password'; -export { default as HeaderWithSteps } from './HeaderWithSteps'; -export { default as AccountSelection } from './AccountSelection'; +export { default as Header } from './Header.js'; +export { default as MenuSettings } from './MenuSettings.js'; +export { default as Name } from './Name.js'; +export { default as Password } from './Password.js'; +export { default as HeaderWithSteps } from './HeaderWithSteps.js'; +export { default as AccountSelection } from './AccountSelection.js'; diff --git a/packages/extension-ui/src/styled.ts b/packages/extension-ui/src/styled.ts index 90d41ae939..a0e4a7d100 100644 --- a/packages/extension-ui/src/styled.ts +++ b/packages/extension-ui/src/styled.ts @@ -1,14 +1,14 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import styledComponents from 'styled-components'; +import styledComponents, { StyledInterface } from 'styled-components'; // In styled-components v6, there is a named export which can be used // directly, i.e. "import { styled } from ..." with no more magic. Until // such time the cjs vs esm import here is problematic, so we hack around // the various shapes below export const styled = ( - (styledComponents as unknown as { styled: typeof styledComponents }).styled || - (styledComponents as unknown as { default: typeof styledComponents }).default || - styledComponents + (styledComponents as unknown as { styled: StyledInterface }).styled || + (styledComponents as unknown as { default: StyledInterface }).default || + styledComponents as unknown as StyledInterface ); diff --git a/packages/extension-ui/src/types.ts b/packages/extension-ui/src/types.ts index 924b49474f..61f76a9562 100644 --- a/packages/extension-ui/src/types.ts +++ b/packages/extension-ui/src/types.ts @@ -1,7 +1,7 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import type { Theme } from './components/themes'; +import type { Theme } from './components/themes.js'; export type { Theme }; diff --git a/packages/extension-ui/src/util/buildHierarchy.spec.ts b/packages/extension-ui/src/util/buildHierarchy.spec.ts index 124c86235d..f6506bee4b 100644 --- a/packages/extension-ui/src/util/buildHierarchy.spec.ts +++ b/packages/extension-ui/src/util/buildHierarchy.spec.ts @@ -5,7 +5,7 @@ import type { AccountJson, AccountWithChildren } from '@polkadot/extension-base/background/types'; -import { buildHierarchy } from './buildHierarchy'; +import { buildHierarchy } from './buildHierarchy.js'; const genesisExample = { KUSAMA: '0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe', diff --git a/packages/extension-ui/src/util/buildHierarchy.ts b/packages/extension-ui/src/util/buildHierarchy.ts index c59ce85cb9..8f3d52c734 100644 --- a/packages/extension-ui/src/util/buildHierarchy.ts +++ b/packages/extension-ui/src/util/buildHierarchy.ts @@ -3,7 +3,7 @@ import type { AccountJson, AccountWithChildren } from '@polkadot/extension-base/background/types'; -import getNetworkMap from './getNetworkMap'; +import getNetworkMap from './getNetworkMap.js'; type ChildFilter = (account: AccountJson) => AccountWithChildren; diff --git a/packages/extension-ui/src/util/getNetworkMap.ts b/packages/extension-ui/src/util/getNetworkMap.ts index 5ebb0ed857..f476e875e1 100644 --- a/packages/extension-ui/src/util/getNetworkMap.ts +++ b/packages/extension-ui/src/util/getNetworkMap.ts @@ -1,7 +1,7 @@ // Copyright 2019-2023 @polkadot/extension-ui authors & contributors // SPDX-License-Identifier: Apache-2.0 -import chains from './chains'; +import chains from './chains.js'; export default function getNetworkMap (): Map { const res = new Map(); diff --git a/packages/extension-ui/src/util/nextDerivationPath.spec.ts b/packages/extension-ui/src/util/nextDerivationPath.spec.ts index 4e4ef44474..656025ce49 100644 --- a/packages/extension-ui/src/util/nextDerivationPath.spec.ts +++ b/packages/extension-ui/src/util/nextDerivationPath.spec.ts @@ -3,7 +3,7 @@ /// -import { nextDerivationPath } from './nextDerivationPath'; +import { nextDerivationPath } from './nextDerivationPath.js'; describe('Generate Derivation Path', () => { const acc = (address: string, parentAddress?: string): { diff --git a/packages/extension/package.json b/packages/extension/package.json index c736dbca7d..848eaab9c2 100644 --- a/packages/extension/package.json +++ b/packages/extension/package.json @@ -22,7 +22,7 @@ "tslib": "^2.5.0" }, "devDependencies": { - "@polkadot/dev": "^0.70.4", + "@polkadot/dev": "^0.71.1", "browser-resolve": "^2.0.0", "buffer": "^6.0.3", "copy-webpack-plugin": "^11.0.0", diff --git a/packages/extension/src/detectPackage.ts b/packages/extension/src/detectPackage.ts index bf21f5650b..c1ed4c3cd5 100644 --- a/packages/extension/src/detectPackage.ts +++ b/packages/extension/src/detectPackage.ts @@ -5,7 +5,7 @@ import { detectPackage } from '@polkadot/util'; -import others from './detectOther'; -import { packageInfo } from './packageInfo'; +import others from './detectOther.js'; +import { packageInfo } from './packageInfo.js'; detectPackage(packageInfo, null, others); diff --git a/packages/extension/src/page.ts b/packages/extension/src/page.ts index 8554353ae4..4957d38d36 100644 --- a/packages/extension/src/page.ts +++ b/packages/extension/src/page.ts @@ -8,7 +8,7 @@ import { MESSAGE_ORIGIN_CONTENT } from '@polkadot/extension-base/defaults'; import { enable, handleResponse, redirectIfPhishing } from '@polkadot/extension-base/page'; import { injectExtension } from '@polkadot/extension-inject'; -import { packageInfo } from './packageInfo'; +import { packageInfo } from './packageInfo.js'; function inject () { injectExtension(enable, { diff --git a/packages/extension/webpack.shared.cjs b/packages/extension/webpack.shared.cjs index ae128baacc..aa87405b92 100644 --- a/packages/extension/webpack.shared.cjs +++ b/packages/extension/webpack.shared.cjs @@ -96,6 +96,9 @@ module.exports = (entry, alias = {}) => ({ ...alias, [`@polkadot/${p}`]: path.resolve(__dirname, `../${p}/src`) }), alias), + extensionAlias: { + '.js': ['.ts', '.tsx', '.js'] + }, extensions: ['.js', '.jsx', '.ts', '.tsx'], fallback: { crypto: require.resolve('crypto-browserify'), diff --git a/yarn.lock b/yarn.lock index d481608dec..b62145525f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1102,9 +1102,9 @@ __metadata: languageName: node linkType: hard -"@polkadot/dev@npm:^0.70.4": - version: 0.70.4 - resolution: "@polkadot/dev@npm:0.70.4" +"@polkadot/dev@npm:^0.71.1": + version: 0.71.1 + resolution: "@polkadot/dev@npm:0.71.1" dependencies: "@eslint/js": ^8.35.0 "@rollup/plugin-alias": ^4.0.3 @@ -1114,8 +1114,8 @@ __metadata: "@rollup/plugin-json": ^6.0.0 "@rollup/plugin-node-resolve": ^15.0.1 "@rushstack/eslint-patch": ^1.2.0 - "@typescript-eslint/eslint-plugin": ^5.54.0 - "@typescript-eslint/parser": ^5.54.0 + "@typescript-eslint/eslint-plugin": ^5.54.1 + "@typescript-eslint/parser": ^5.54.1 eslint: ^8.35.0 eslint-config-standard: ^17.0.0 eslint-import-resolver-node: ^0.3.7 @@ -1169,7 +1169,7 @@ __metadata: polkadot-exec-rollup: scripts/polkadot-exec-rollup.mjs polkadot-exec-tsc: scripts/polkadot-exec-tsc.mjs polkadot-exec-webpack: scripts/polkadot-exec-webpack.mjs - checksum: 446bc7a0637a91d30829d5fccb2b6c74d9f54bc7e67290c11cfca56a0f528a33b5ee1b066ed9bde6b669d866c89e3895ff7a44b79210bb549dd406afccc0ca9d + checksum: 18505f604cd99a6fa858fe0dd6f9f09f6ae46bc3428616dd8df6f4533b4854de1c517f1c0ede5f7c11a881ffea2175ffd48c8526ea16f7da3320595d0ae67cf8 languageName: node linkType: hard @@ -1324,7 +1324,7 @@ __metadata: version: 0.0.0-use.local resolution: "@polkadot/extension@workspace:packages/extension" dependencies: - "@polkadot/dev": ^0.70.4 + "@polkadot/dev": ^0.71.1 "@polkadot/extension-base": ^0.45.2-2-x "@polkadot/extension-inject": ^0.45.2-2-x "@polkadot/extension-ui": ^0.45.2-2-x @@ -2554,13 +2554,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.54.0": - version: 5.54.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.54.0" +"@typescript-eslint/eslint-plugin@npm:^5.54.1": + version: 5.54.1 + resolution: "@typescript-eslint/eslint-plugin@npm:5.54.1" dependencies: - "@typescript-eslint/scope-manager": 5.54.0 - "@typescript-eslint/type-utils": 5.54.0 - "@typescript-eslint/utils": 5.54.0 + "@typescript-eslint/scope-manager": 5.54.1 + "@typescript-eslint/type-utils": 5.54.1 + "@typescript-eslint/utils": 5.54.1 debug: ^4.3.4 grapheme-splitter: ^1.0.4 ignore: ^5.2.0 @@ -2574,7 +2574,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 4fdb520b8e0f6b9eb878206ddfa4212522f170d1507d7aba8a975159a198efa37af6d2d17982dd560317452d0748f2e2da5dd7347b172bc4446d1c5562ce2e94 + checksum: 76476c08ca0142a9bf6e2381f5cd1c037d86fbafa9c0dded4a97bd3b23b5962dd2c3943bade11b21d674195674f0e36dbf80faa15a1906f5a2ca1f699baf1dd5 languageName: node linkType: hard @@ -2589,20 +2589,20 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.54.0": - version: 5.54.0 - resolution: "@typescript-eslint/parser@npm:5.54.0" +"@typescript-eslint/parser@npm:^5.54.1": + version: 5.54.1 + resolution: "@typescript-eslint/parser@npm:5.54.1" dependencies: - "@typescript-eslint/scope-manager": 5.54.0 - "@typescript-eslint/types": 5.54.0 - "@typescript-eslint/typescript-estree": 5.54.0 + "@typescript-eslint/scope-manager": 5.54.1 + "@typescript-eslint/types": 5.54.1 + "@typescript-eslint/typescript-estree": 5.54.1 debug: ^4.3.4 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 368d6dd85be42c3f518f0ddeed23ecd1d3c9484a77ae291ee4e08e2703ed379bed613bde014cd8ab2a3e06e85dd8aef201112ae5e3d2a07deba29ae80bb1fe06 + checksum: f466513d306ca926b97c2cec1eebaf2cd15d45bd5633a4358f23ba9a4de1b0ec4630b1c20abc395943934ed1d2ef65f545fd6737c317a7abe579612101e8a83f languageName: node linkType: hard @@ -2616,22 +2616,22 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.54.0": - version: 5.54.0 - resolution: "@typescript-eslint/scope-manager@npm:5.54.0" +"@typescript-eslint/scope-manager@npm:5.54.1": + version: 5.54.1 + resolution: "@typescript-eslint/scope-manager@npm:5.54.1" dependencies: - "@typescript-eslint/types": 5.54.0 - "@typescript-eslint/visitor-keys": 5.54.0 - checksum: e50f12396de0ddb94aab119bdd5f4769b80dd2c273e137fd25e5811e25114d7a3d3668cdb3c454aca9537e940744881d62a1fed2ec86f07f60533dc7382ae15c + "@typescript-eslint/types": 5.54.1 + "@typescript-eslint/visitor-keys": 5.54.1 + checksum: 9add24cf3a7852634ad0680a827646860ac4698a6ac8aae31e8b781e29f59e84b51f0cdaacffd0747811012647f01b51969d988da9b302ead374ceebffbe204b languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.54.0": - version: 5.54.0 - resolution: "@typescript-eslint/type-utils@npm:5.54.0" +"@typescript-eslint/type-utils@npm:5.54.1": + version: 5.54.1 + resolution: "@typescript-eslint/type-utils@npm:5.54.1" dependencies: - "@typescript-eslint/typescript-estree": 5.54.0 - "@typescript-eslint/utils": 5.54.0 + "@typescript-eslint/typescript-estree": 5.54.1 + "@typescript-eslint/utils": 5.54.1 debug: ^4.3.4 tsutils: ^3.21.0 peerDependencies: @@ -2639,7 +2639,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 9cb5b52c7277bdf74b9ea3282fc40f41fda90ea4b1d33039044476e43cf05a766b1294e7d45f429594f2776828f7d17729cfa4ea027315f3df883e748ba57514 + checksum: 0073838b782b7f4619775be124ca6643fec43a2d56043eaf3ceb100960a5193f14ac747b28ce17a5c9ac643fdee8abda82a7d905c81521358de7b27a2dcbc9af languageName: node linkType: hard @@ -2657,10 +2657,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:5.54.0": - version: 5.54.0 - resolution: "@typescript-eslint/types@npm:5.54.0" - checksum: 0f66b1b93078f3afea6dfcd3d4e2f0abea4f60cd0c613c2cf13f85098e5bf786185484c9846ed80b6c4272de2c31a70c5a8aacb91314cf1b6da7dcb8855cb7ac +"@typescript-eslint/types@npm:5.54.1": + version: 5.54.1 + resolution: "@typescript-eslint/types@npm:5.54.1" + checksum: 84a8f725cfa10646af389659e09c510c38d82c65960c7b613f844a264acc0e197471cba03f3e8f4b6411bc35dca28922c8352a7bd44621411c73fd6dd4096da2 languageName: node linkType: hard @@ -2682,12 +2682,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.54.0, @typescript-eslint/typescript-estree@npm:^5.13.0": - version: 5.54.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.54.0" +"@typescript-eslint/typescript-estree@npm:5.54.1, @typescript-eslint/typescript-estree@npm:^5.13.0": + version: 5.54.1 + resolution: "@typescript-eslint/typescript-estree@npm:5.54.1" dependencies: - "@typescript-eslint/types": 5.54.0 - "@typescript-eslint/visitor-keys": 5.54.0 + "@typescript-eslint/types": 5.54.1 + "@typescript-eslint/visitor-keys": 5.54.1 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -2696,7 +2696,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 377c75c34c4f95b7ab6218c1d96a6db3ea6ed6727711b6a09354582fe0157861dc1b6fb9e3f7113cd09741f713735d59d5ab5845457f5733a4ebad7470bf600a + checksum: ea42bdb4832fa96fa1121237c9b664ac4506e2836646651e08a8542c8601d78af6c288779707f893ca4c884221829bb7d7b4b43c4a9c3ed959519266d03a139b languageName: node linkType: hard @@ -2736,21 +2736,21 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.54.0, @typescript-eslint/utils@npm:^5.10.0": - version: 5.54.0 - resolution: "@typescript-eslint/utils@npm:5.54.0" +"@typescript-eslint/utils@npm:5.54.1, @typescript-eslint/utils@npm:^5.10.0": + version: 5.54.1 + resolution: "@typescript-eslint/utils@npm:5.54.1" dependencies: "@types/json-schema": ^7.0.9 "@types/semver": ^7.3.12 - "@typescript-eslint/scope-manager": 5.54.0 - "@typescript-eslint/types": 5.54.0 - "@typescript-eslint/typescript-estree": 5.54.0 + "@typescript-eslint/scope-manager": 5.54.1 + "@typescript-eslint/types": 5.54.1 + "@typescript-eslint/typescript-estree": 5.54.1 eslint-scope: ^5.1.1 eslint-utils: ^3.0.0 semver: ^7.3.7 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: b8f344fc2961c7af530b93e53d5a17b5084cdf550b381082e3fb7f349ef16e718d9eebde1b9fc2d8fc4ecf8d60d334b004359977247554265c1afc87323bed37 + checksum: 8f428ea4d338ce85d55fd0c9ae2b217b323f29f51b7c9f8077fef7001ca21d28b032c5e5165b67ae6057aef69edb0e7a164c3c483703be6f3e4e574248bbc399 languageName: node linkType: hard @@ -2774,13 +2774,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.54.0": - version: 5.54.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.54.0" +"@typescript-eslint/visitor-keys@npm:5.54.1": + version: 5.54.1 + resolution: "@typescript-eslint/visitor-keys@npm:5.54.1" dependencies: - "@typescript-eslint/types": 5.54.0 + "@typescript-eslint/types": 5.54.1 eslint-visitor-keys: ^3.3.0 - checksum: 17fc323c09e6272b603cdaec30a99916600fbbb737e1fbc8c1727a487753b4363cea112277fa43e0562bff34bdd1de9ad73ff9433118b1fd469b112fad0313ca + checksum: 3a691abd2a43b86a0c41526d14a2afcc93a2e0512b5f8b9ec43f6029c493870808036eae5ee4fc655d26e1999017c4a4dffb241f47c36c2a1238ec9fbd08719c languageName: node linkType: hard @@ -12777,7 +12777,7 @@ fsevents@~2.3.2: resolution: "root-workspace-0b6124@workspace:." dependencies: "@babel/core": ^7.21.0 - "@polkadot/dev": ^0.70.4 + "@polkadot/dev": ^0.71.1 "@types/node": ^18.14.5 i18next-scanner: ^4.1.1 sinon-chrome: ^3.0.1