@exodus/headless 2.0.0-alpha.49 → 2.0.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/CHANGELOG.md +0 -333
  2. package/README.md +4 -133
  3. package/package.json +14 -53
  4. package/src/api.js +21 -22
  5. package/src/application.js +34 -44
  6. package/src/dependencies/atoms.js +4 -47
  7. package/src/dependencies/index.js +1 -8
  8. package/src/dependencies/modules.js +12 -18
  9. package/src/index.js +6 -74
  10. package/src/ioc.js +7 -40
  11. package/src/unlock-encrypted-storage.js +1 -1
  12. package/src/atoms/attach.js +0 -31
  13. package/src/atoms/base-asset-names-to-monitor.js +0 -36
  14. package/src/atoms/non-dust-balance-asset-names-atom.js +0 -10
  15. package/src/constants.js +0 -36
  16. package/src/dependencies/plugins.js +0 -7
  17. package/src/modules/ab-testing/api.js +0 -13
  18. package/src/modules/ab-testing/index.js +0 -26
  19. package/src/modules/ab-testing/plugin.js +0 -21
  20. package/src/modules/address-provider/api.js +0 -14
  21. package/src/modules/address-provider/index.js +0 -15
  22. package/src/modules/apy-rates/index.js +0 -20
  23. package/src/modules/apy-rates/plugin.js +0 -14
  24. package/src/modules/blockchain-metadata/api.js +0 -22
  25. package/src/modules/blockchain-metadata/index.js +0 -20
  26. package/src/modules/blockchain-metadata/plugin.js +0 -30
  27. package/src/modules/blockchain-metadata/utils.js +0 -11
  28. package/src/modules/connected-origins/api.js +0 -23
  29. package/src/modules/connected-origins/index.js +0 -31
  30. package/src/modules/connected-origins/plugin.js +0 -18
  31. package/src/modules/crypto-news/index.js +0 -20
  32. package/src/modules/crypto-news/plugin.js +0 -17
  33. package/src/modules/feature-flags/index.js +0 -35
  34. package/src/modules/feature-flags/plugin.js +0 -18
  35. package/src/modules/fees/index.js +0 -16
  36. package/src/modules/fees/plugin.js +0 -17
  37. package/src/modules/geolocation/index.js +0 -20
  38. package/src/modules/geolocation/plugin.js +0 -14
  39. package/src/modules/kyc/api.js +0 -14
  40. package/src/modules/kyc/index.js +0 -19
  41. package/src/modules/kyc/plugin.js +0 -21
  42. package/src/modules/locale/api.js +0 -13
  43. package/src/modules/locale/index.js +0 -50
  44. package/src/modules/locale/plugin.js +0 -14
  45. package/src/modules/market-history/index.js +0 -66
  46. package/src/modules/market-history/plugin.js +0 -21
  47. package/src/modules/nfts/api.js +0 -13
  48. package/src/modules/nfts/index.js +0 -33
  49. package/src/modules/nfts/plugin.js +0 -23
  50. package/src/modules/personal-notes/api.js +0 -12
  51. package/src/modules/personal-notes/index.js +0 -31
  52. package/src/modules/personal-notes/plugin.js +0 -15
  53. package/src/modules/rates/api.js +0 -12
  54. package/src/modules/rates/index.js +0 -22
  55. package/src/modules/rates/plugin.js +0 -17
  56. package/src/modules/referrals/api.js +0 -13
  57. package/src/modules/referrals/index.js +0 -28
  58. package/src/modules/referrals/plugin.js +0 -21
  59. package/src/modules/remote-config/api.js +0 -13
  60. package/src/modules/remote-config/index.js +0 -28
  61. package/src/modules/remote-config/plugin.js +0 -20
  62. package/src/modules/top-movers/index.js +0 -23
  63. package/src/modules/top-movers/plugin.js +0 -17
  64. package/src/modules/wallet/api.js +0 -34
  65. package/src/modules/wallet/index.js +0 -24
  66. package/src/modules/wallet/locked-atom.js +0 -10
  67. package/src/modules/wallet/restore-atom.js +0 -10
  68. package/src/modules/wallet/restore-plugin.js +0 -17
  69. package/src/modules/wallet-accounts/api.js +0 -16
  70. package/src/modules/wallet-accounts/index.js +0 -29
  71. package/src/modules/wallet-accounts/plugin.js +0 -18
  72. package/src/plugins/attach.js +0 -25
  73. package/src/plugins/index.js +0 -5
  74. package/src/plugins/log-lifecycle.js +0 -25
package/src/constants.js DELETED
@@ -1,36 +0,0 @@
1
- export const atomsToAttach = [
2
- 'abTestingAtom',
3
- 'apyRatesAtom',
4
- 'availableAssetNamesAtom',
5
- 'balancesAtom',
6
- 'connectedOriginsAtom',
7
- 'cryptoNewsAtom',
8
- 'currencyAtom',
9
- 'enabledWalletAccountsAtom',
10
- 'featureFlagsAtom',
11
- 'geolocationAtom',
12
- 'kycAtom',
13
- 'languageAtom',
14
- 'nftsConfigAtom',
15
- 'personalNotesAtom',
16
- 'referralsAtom',
17
- 'topMoversAtom',
18
- 'walletAccountsAtom',
19
- ]
20
-
21
- export const LifecycleHook = Object.freeze({
22
- Lock: 'lock',
23
- Unlock: 'unlock',
24
- Clear: 'clear',
25
- Import: 'import',
26
- Migrate: 'migrate',
27
- Start: 'start',
28
- Load: 'load',
29
- Unload: 'unload',
30
- Create: 'create',
31
- Backup: 'backup',
32
- Restore: 'restore',
33
- RestoreCompleted: 'restore-completed',
34
- AssetsSynced: 'assets-synced',
35
- ChangePassphrase: 'change-passphrase',
36
- })
@@ -1,7 +0,0 @@
1
- import plugins from '../plugins'
2
- import { withType } from './utils'
3
-
4
- const createPluginDependencies = () =>
5
- plugins.map((definition) => ({ definition })).map(withType('plugin'))
6
-
7
- export default createPluginDependencies
@@ -1,13 +0,0 @@
1
- const abTestingApi = ({ abTesting }) => ({
2
- abTesting: {
3
- trackEvent: abTesting.trackEvent,
4
- updateVariant: abTesting.updateVariant,
5
- },
6
- })
7
-
8
- export default {
9
- id: 'abTestingApi',
10
- type: 'api',
11
- factory: abTestingApi,
12
- dependencies: ['abTesting'],
13
- }
@@ -1,26 +0,0 @@
1
- import { abTestingAtomDefinition } from '@exodus/ab-testing/atoms'
2
- import abTestingDefinition from '@exodus/ab-testing/module'
3
-
4
- import abTestingApiDefinition from './api'
5
- import abTestingPluginDefinition from './plugin'
6
-
7
- const abTesting = () => {
8
- return {
9
- id: 'abTesting',
10
- definitions: [
11
- {
12
- definition: abTestingAtomDefinition,
13
- storage: { namespace: 'abTesting' },
14
- aliases: [{ implementationId: 'unsafeStorage', interfaceId: 'storage' }],
15
- },
16
- {
17
- definition: abTestingDefinition,
18
- writesAtoms: ['abTestingAtom'],
19
- },
20
- { definition: abTestingPluginDefinition },
21
- { definition: abTestingApiDefinition },
22
- ],
23
- }
24
- }
25
-
26
- export default abTesting
@@ -1,21 +0,0 @@
1
- const abTestingLifecyclePlugin = ({ abTesting, featureFlagAtoms }) => {
2
- const onStart = async () => {
3
- featureFlagAtoms.abTesting?.get().then(({ isOn }) => {
4
- if (!isOn) return
5
- abTesting.load()
6
- })
7
- }
8
-
9
- const onClear = async () => {
10
- await abTesting.clear()
11
- }
12
-
13
- return { onStart, onClear }
14
- }
15
-
16
- export default {
17
- id: 'abTestingLifecyclePlugin',
18
- type: 'plugin',
19
- factory: abTestingLifecyclePlugin,
20
- dependencies: ['abTesting', 'featureFlagAtoms'],
21
- }
@@ -1,14 +0,0 @@
1
- const createAddressProviderApi = ({ addressProvider }) => ({
2
- addressProvider: {
3
- getAddress: addressProvider.getAddress.bind(addressProvider),
4
- getSupportedPurposes: addressProvider.getSupportedPurposes.bind(addressProvider),
5
- getReceiveAddress: addressProvider.getReceiveAddress.bind(addressProvider),
6
- },
7
- })
8
-
9
- export default {
10
- id: 'addressProviderApi',
11
- type: 'api',
12
- factory: createAddressProviderApi,
13
- dependencies: ['addressProvider'],
14
- }
@@ -1,15 +0,0 @@
1
- import createAddressProviderDependencies from '@exodus/address-provider'
2
-
3
- import { withType } from '../../dependencies/utils'
4
- import addressProviderApi from './api'
5
-
6
- const addressProvider = ({ config }) => {
7
- const dependencies = createAddressProviderDependencies(config).map(withType('module'))
8
-
9
- return {
10
- id: 'addressProvider',
11
- definitions: [...dependencies, { definition: addressProviderApi }],
12
- }
13
- }
14
-
15
- export default addressProvider
@@ -1,20 +0,0 @@
1
- import { apyRatesAtomDefinition } from '@exodus/apy-rates/atoms'
2
- import apyRatesMonitorDefinition from '@exodus/apy-rates/monitor'
3
-
4
- import apyRatesPlugin from './plugin'
5
-
6
- const apyRates = () => {
7
- return {
8
- id: 'apyRates',
9
- definitions: [
10
- {
11
- definition: apyRatesMonitorDefinition,
12
- writesAtoms: ['apyRatesAtom'],
13
- },
14
- { definition: apyRatesAtomDefinition },
15
- { definition: apyRatesPlugin },
16
- ],
17
- }
18
- }
19
-
20
- export default apyRates
@@ -1,14 +0,0 @@
1
- const createApyRatesLifecyclePlugin = ({ apyRatesMonitor }) => {
2
- const onUnlock = () => {
3
- apyRatesMonitor.start()
4
- }
5
-
6
- return { onUnlock }
7
- }
8
-
9
- export default {
10
- id: 'apyRatesLifecyclePlugin',
11
- type: 'plugin',
12
- factory: createApyRatesLifecyclePlugin,
13
- dependencies: ['apyRatesMonitor'],
14
- }
@@ -1,22 +0,0 @@
1
- const createBlockchainMetadataApi = ({ blockchainMetadata }) => ({
2
- blockchainMetadata: {
3
- getTxLog: blockchainMetadata.getTxLog,
4
- getLoadedTxLogs: blockchainMetadata.getLoadedTxLogs,
5
- updateTxs: blockchainMetadata.updateTxs,
6
- overwriteTxs: blockchainMetadata.overwriteTxs,
7
- clearTxs: blockchainMetadata.clearTxs,
8
- removeTxs: blockchainMetadata.removeTxs,
9
- getAccountState: blockchainMetadata.getAccountState,
10
- getLoadedAccountStates: blockchainMetadata.getLoadedAccountStates,
11
- updateAccountState: blockchainMetadata.updateAccountState,
12
- removeAccountState: blockchainMetadata.removeAccountState,
13
- batch: blockchainMetadata.batch,
14
- },
15
- })
16
-
17
- export default {
18
- id: 'createBlockchainMetadataApi',
19
- type: 'api',
20
- factory: createBlockchainMetadataApi,
21
- dependencies: ['blockchainMetadata'],
22
- }
@@ -1,20 +0,0 @@
1
- import blockchainMetadataDefinition from '@exodus/blockchain-metadata/module'
2
-
3
- import blockchainMetadataApiDefinition from './api'
4
- import blockchainMetadataPluginDefinition from './plugin'
5
-
6
- const blockchainMetadata = () => {
7
- return {
8
- id: 'blockchainMetadata',
9
- definitions: [
10
- {
11
- definition: blockchainMetadataDefinition,
12
- storage: { namespace: ['blockchain', 'v1'] },
13
- },
14
- { definition: blockchainMetadataPluginDefinition },
15
- { definition: blockchainMetadataApiDefinition },
16
- ],
17
- }
18
- }
19
-
20
- export default blockchainMetadata
@@ -1,30 +0,0 @@
1
- import { createLoadWalletAccountsHandler } from './utils'
2
-
3
- const blockchainLifecyclePlugin = ({ blockchainMetadata, port }) => {
4
- const handleLoadWalletAccounts = createLoadWalletAccountsHandler({ blockchainMetadata, port })
5
-
6
- blockchainMetadata.on('load-wallet-accounts', handleLoadWalletAccounts)
7
-
8
- blockchainMetadata.on('tx-logs-update', (payload) => port.emit('tx-logs-update', payload))
9
-
10
- blockchainMetadata.on('account-states-update', (payload) =>
11
- port.emit('account-states-update', payload)
12
- )
13
-
14
- const onUnlock = async () => {
15
- await blockchainMetadata.load()
16
- }
17
-
18
- const onClear = async () => {
19
- await blockchainMetadata.clear()
20
- }
21
-
22
- return { onUnlock, onClear }
23
- }
24
-
25
- export default {
26
- id: 'blockchainLifecyclePlugin',
27
- type: 'plugin',
28
- factory: blockchainLifecyclePlugin,
29
- dependencies: ['blockchainMetadata', 'port'],
30
- }
@@ -1,11 +0,0 @@
1
- export function createLoadWalletAccountsHandler({ port, blockchainMetadata }) {
2
- return async () => {
3
- const [txLogs, accountStates] = await Promise.all([
4
- blockchainMetadata.getLoadedTxLogs(),
5
- blockchainMetadata.getLoadedAccountStates(),
6
- ])
7
-
8
- port.emit('tx-logs', txLogs)
9
- port.emit('account-states', accountStates)
10
- }
11
- }
@@ -1,23 +0,0 @@
1
- const connectedOriginsApi = ({ connectedOrigins, connectedOriginsAtom }) => ({
2
- connectedOrigins: {
3
- get: connectedOriginsAtom.get,
4
- add: connectedOrigins.add,
5
- clear: connectedOrigins.clear,
6
- untrust: connectedOrigins.untrust,
7
- isTrusted: connectedOrigins.isTrusted,
8
- isAutoApprove: connectedOrigins.isAutoApprove,
9
- setFavorite: connectedOrigins.setFavorite,
10
- setAutoApprove: connectedOrigins.setAutoApprove,
11
- connect: connectedOrigins.connect,
12
- disconnect: connectedOrigins.disconnect,
13
- updateConnection: connectedOrigins.updateConnection,
14
- clearConnections: connectedOrigins.clearConnections,
15
- },
16
- })
17
-
18
- export default {
19
- id: 'connectedOriginsApi',
20
- type: 'api',
21
- factory: connectedOriginsApi,
22
- dependencies: ['connectedOrigins', 'connectedOriginsAtom'],
23
- }
@@ -1,31 +0,0 @@
1
- import { connectedOriginsAtomDefinition } from '@exodus/connected-origins/atoms'
2
- import connectedOriginsDefinition from '@exodus/connected-origins/module'
3
-
4
- import connectedOriginsApiDefinition from './api'
5
- import connectedOriginsPluginDefinition from './plugin'
6
-
7
- const connectedOrigins = () => {
8
- return {
9
- id: 'connectedOrigins',
10
- definitions: [
11
- {
12
- definition: connectedOriginsAtomDefinition,
13
- storage: { namespace: 'connectedOrigins' },
14
- aliases: [
15
- {
16
- implementationId: 'unsafeStorage',
17
- interfaceId: 'storage',
18
- },
19
- ],
20
- },
21
- {
22
- definition: connectedOriginsDefinition,
23
- writesAtoms: ['connectedOriginsAtom'],
24
- },
25
- { definition: connectedOriginsPluginDefinition },
26
- { definition: connectedOriginsApiDefinition },
27
- ],
28
- }
29
- }
30
-
31
- export default connectedOrigins
@@ -1,18 +0,0 @@
1
- const connectedOriginsPlugin = ({ connectedOrigins }) => {
2
- const onUnlock = async () => {
3
- await connectedOrigins.load()
4
- }
5
-
6
- const onClear = async () => {
7
- await connectedOrigins.clear()
8
- }
9
-
10
- return { onUnlock, onClear }
11
- }
12
-
13
- export default {
14
- id: 'connectedOriginsLifecyclePlugin',
15
- type: 'plugin',
16
- factory: connectedOriginsPlugin,
17
- dependencies: ['connectedOrigins'],
18
- }
@@ -1,20 +0,0 @@
1
- import { cryptoNewsAtomDefinition } from '@exodus/crypto-news-monitor/atoms'
2
- import cryptoNewsMonitorDefinition from '@exodus/crypto-news-monitor/monitor'
3
-
4
- import cryptoNewsPluginDefinition from './plugin'
5
-
6
- const cryptoNews = () => {
7
- return {
8
- id: 'cryptoNews',
9
- definitions: [
10
- { definition: cryptoNewsAtomDefinition },
11
- {
12
- definition: cryptoNewsMonitorDefinition,
13
- writesAtoms: ['cryptoNewsAtom'],
14
- },
15
- { definition: cryptoNewsPluginDefinition },
16
- ],
17
- }
18
- }
19
-
20
- export default cryptoNews
@@ -1,17 +0,0 @@
1
- const cryptoNewsPlugin = ({ cryptoNewsMonitor, featureFlagAtoms }) => {
2
- const onUnlock = () => {
3
- featureFlagAtoms.cryptoNews?.get().then(({ isOn }) => {
4
- if (!isOn) return
5
- cryptoNewsMonitor.start()
6
- })
7
- }
8
-
9
- return { onUnlock }
10
- }
11
-
12
- export default {
13
- id: 'cryptoNewsLifecyclePlugin',
14
- type: 'plugin',
15
- factory: cryptoNewsPlugin,
16
- dependencies: ['cryptoNewsMonitor', 'featureFlagAtoms'],
17
- }
@@ -1,35 +0,0 @@
1
- import {
2
- featureFlagAtomsDefinition,
3
- featureFlagsAtomDefinition,
4
- remoteConfigFeatureFlagAtomsDefinition,
5
- } from '@exodus/feature-flags/atoms'
6
- import featureFlagsDefinition from '@exodus/feature-flags/module'
7
-
8
- import featureFlagsPlugin from './plugin'
9
-
10
- const featureFlags = () => {
11
- return {
12
- id: 'featureFlags',
13
- definitions: [
14
- {
15
- definition: featureFlagsDefinition,
16
- writesAtoms: ['featureFlagAtoms'],
17
- },
18
- {
19
- definition: featureFlagAtomsDefinition,
20
- storage: { namespace: 'featureFlags' },
21
- aliases: [
22
- {
23
- implementationId: 'unsafeStorage',
24
- interfaceId: 'storage',
25
- },
26
- ],
27
- },
28
- { definition: featureFlagsAtomDefinition },
29
- { definition: remoteConfigFeatureFlagAtomsDefinition },
30
- { definition: featureFlagsPlugin },
31
- ],
32
- }
33
- }
34
-
35
- export default featureFlags
@@ -1,18 +0,0 @@
1
- const createFeatureFlagsLifecyclePlugin = ({ featureFlags }) => {
2
- const onStart = () => {
3
- featureFlags.load()
4
- }
5
-
6
- const onClear = async () => {
7
- await featureFlags.clear()
8
- }
9
-
10
- return { onStart, onClear }
11
- }
12
-
13
- export default {
14
- id: 'featureFlagsLifecyclePlugin',
15
- type: 'plugin',
16
- factory: createFeatureFlagsLifecyclePlugin,
17
- dependencies: ['featureFlags'],
18
- }
@@ -1,16 +0,0 @@
1
- import feeMonitorsDefinition from '@exodus/fee-monitors/monitor'
2
-
3
- import feesPlugin from './plugin'
4
-
5
- const fees = () => {
6
- return {
7
- id: 'fees',
8
- definitions: [
9
- // ...
10
- { definition: feeMonitorsDefinition },
11
- { definition: feesPlugin },
12
- ],
13
- }
14
- }
15
-
16
- export default fees
@@ -1,17 +0,0 @@
1
- const createFeesLifecyclePlugin = ({ feeMonitors, port }) => {
2
- feeMonitors.on('fees-load', () => port.emit('fees-load', feeMonitors.getAllFeeData()))
3
- feeMonitors.on('fees-update', (payload) => port.emit('fees-update', payload))
4
-
5
- const onUnlock = () => {
6
- feeMonitors.start()
7
- }
8
-
9
- return { onUnlock }
10
- }
11
-
12
- export default {
13
- id: 'feesLifecyclePlugin',
14
- type: 'plugin',
15
- factory: createFeesLifecyclePlugin,
16
- dependencies: ['feeMonitors', 'port'],
17
- }
@@ -1,20 +0,0 @@
1
- import { geolocationAtomDefinition } from '@exodus/geolocation/atoms'
2
- import geolocationMonitorDefinition from '@exodus/geolocation/monitor'
3
-
4
- import geolocationPluginDefinition from './plugin'
5
-
6
- const geolocation = () => {
7
- return {
8
- id: 'geolocation',
9
- definitions: [
10
- { definition: geolocationAtomDefinition },
11
- {
12
- definition: geolocationMonitorDefinition,
13
- writesAtoms: ['geolocationAtom'],
14
- },
15
- { definition: geolocationPluginDefinition },
16
- ],
17
- }
18
- }
19
-
20
- export default geolocation
@@ -1,14 +0,0 @@
1
- const createGeolocationLifecyclePlugin = ({ geolocationMonitor }) => {
2
- const onStart = async () => {
3
- geolocationMonitor.start()
4
- }
5
-
6
- return { onStart }
7
- }
8
-
9
- export default {
10
- id: 'geolocationLifecyclePlugin',
11
- type: 'plugin',
12
- factory: createGeolocationLifecyclePlugin,
13
- dependencies: ['geolocationMonitor'],
14
- }
@@ -1,14 +0,0 @@
1
- const kycApi = ({ kyc }) => ({
2
- kyc: {
3
- start: kyc.start,
4
- sync: kyc.sync,
5
- requestKycToken: kyc.requestKycToken,
6
- },
7
- })
8
-
9
- export default {
10
- id: 'kycApi',
11
- type: 'api',
12
- factory: kycApi,
13
- dependencies: ['kyc'],
14
- }
@@ -1,19 +0,0 @@
1
- import { kycAtomDefinition } from '@exodus/kyc/atoms'
2
- import kycDefinition from '@exodus/kyc/module'
3
-
4
- import kycApi from './api'
5
- import kycPlugin from './plugin'
6
-
7
- const kyc = () => {
8
- return {
9
- id: 'kyc',
10
- definitions: [
11
- { definition: kycAtomDefinition },
12
- { definition: kycDefinition, writesAtoms: ['kycAtom'] },
13
- { definition: kycPlugin },
14
- { definition: kycApi },
15
- ],
16
- }
17
- }
18
-
19
- export default kyc
@@ -1,21 +0,0 @@
1
- const kycPlugin = ({ kyc, featureFlagAtoms }) => {
2
- const onUnlock = () => {
3
- featureFlagAtoms.referrals?.get().then(({ isOn }) => {
4
- if (!isOn) return
5
- kyc.load()
6
- })
7
- }
8
-
9
- const onUnload = () => {
10
- kyc.stop()
11
- }
12
-
13
- return { onUnlock, onUnload }
14
- }
15
-
16
- export default {
17
- id: 'kycLifecyclePlugin',
18
- type: 'plugin',
19
- factory: kycPlugin,
20
- dependencies: ['kyc', 'featureFlagAtoms'],
21
- }
@@ -1,13 +0,0 @@
1
- const localeApi = ({ languageAtom, currencyAtom }) => ({
2
- locale: {
3
- setLanguage: (value) => languageAtom.set(value),
4
- setCurrency: (value) => currencyAtom.set(value),
5
- },
6
- })
7
-
8
- export default {
9
- id: 'localeApi',
10
- type: 'api',
11
- factory: localeApi,
12
- dependencies: ['languageAtom', 'currencyAtom'],
13
- }
@@ -1,50 +0,0 @@
1
- import { createStorageAtomFactory } from '@exodus/atoms'
2
- import { createFusionAtom } from '@exodus/fusion/atoms'
3
-
4
- import localeApiDefinition from './api'
5
- import localePluginDefinition from './plugin'
6
-
7
- const locale = () => {
8
- return {
9
- id: 'locale',
10
- definitions: [
11
- {
12
- definition: {
13
- id: 'currencyAtom',
14
- type: 'atom',
15
- factory: ({ fusion, config }) =>
16
- createFusionAtom({
17
- fusion,
18
- path: `private.currency`,
19
- defaultValue: config.defaultValue,
20
- }),
21
- dependencies: ['fusion', 'config'],
22
- },
23
- },
24
- {
25
- definition: {
26
- id: 'languageAtom',
27
- type: 'atom',
28
- factory: ({ storage, config }) =>
29
- createStorageAtomFactory({ storage })({
30
- key: 'language',
31
- defaultValue: config.defaultValue,
32
- isSoleWriter: true,
33
- }),
34
- dependencies: ['storage', 'config'],
35
- },
36
- aliases: [
37
- {
38
- implementationId: 'unsafeStorage',
39
- interfaceId: 'storage',
40
- },
41
- ],
42
- storage: { namespace: 'locale' },
43
- },
44
- { definition: localePluginDefinition, writesAtoms: ['languageAtom'] },
45
- { definition: localeApiDefinition, writesAtoms: ['languageAtom', 'currencyAtom'] },
46
- ],
47
- }
48
- }
49
-
50
- export default locale
@@ -1,14 +0,0 @@
1
- const localePlugin = ({ languageAtom }) => {
2
- const onClear = async () => {
3
- await languageAtom.set(undefined)
4
- }
5
-
6
- return { onClear }
7
- }
8
-
9
- export default {
10
- id: 'localeLifecyclePlugin',
11
- type: 'plugin',
12
- factory: localePlugin,
13
- dependencies: ['languageAtom'],
14
- }