@rango-dev/widget-embedded 0.24.2-next.0 → 0.24.2-next.2
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.
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/RefreshModal/RefreshModal.d.ts +4 -0
- package/dist/components/RefreshModal/RefreshModal.d.ts.map +1 -0
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts +446 -0
- package/dist/components/RefreshModal/RefreshModal.styles.d.ts.map +1 -0
- package/dist/components/RefreshModal/RefreshModal.types.d.ts +5 -0
- package/dist/components/RefreshModal/RefreshModal.types.d.ts.map +1 -0
- package/dist/components/RefreshModal/index.d.ts +2 -0
- package/dist/components/RefreshModal/index.d.ts.map +1 -0
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
- package/src/components/Layout/Layout.tsx +12 -1
- package/src/components/RefreshModal/RefreshModal.styles.ts +9 -0
- package/src/components/RefreshModal/RefreshModal.tsx +39 -0
- package/src/components/RefreshModal/RefreshModal.types.ts +4 -0
- package/src/components/RefreshModal/index.ts +1 -0
- package/src/containers/Wallets/Wallets.tsx +6 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@ import type { PropsWithChildren } from 'react';
|
|
|
4
4
|
|
|
5
5
|
import { useManager } from '@rango-dev/queue-manager-react';
|
|
6
6
|
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
7
|
-
import React, { useEffect, useRef } from 'react';
|
|
7
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import { WIDGET_UI_ID } from '../../constants';
|
|
10
10
|
import { useIframe } from '../../hooks/useIframe';
|
|
@@ -20,6 +20,7 @@ import { isFeatureHidden } from '../../utils/settings';
|
|
|
20
20
|
import { ActivateTabAlert } from '../common/ActivateTabAlert';
|
|
21
21
|
import { ActivateTabModal } from '../common/ActivateTabModal';
|
|
22
22
|
import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
|
|
23
|
+
import { RefreshModal } from '../RefreshModal';
|
|
23
24
|
|
|
24
25
|
import { onScrollContentAttachStatusToContainer } from './Layout.helpers';
|
|
25
26
|
import { Container, Content, Footer, LayoutContainer } from './Layout.styles';
|
|
@@ -27,6 +28,8 @@ import { Container, Content, Footer, LayoutContainer } from './Layout.styles';
|
|
|
27
28
|
function Layout(props: PropsWithChildren<PropTypes>) {
|
|
28
29
|
const { connectHeightObserver, disconnectHeightObserver } = useIframe();
|
|
29
30
|
const { children, header, footer, height = 'fixed' } = props;
|
|
31
|
+
const { fetchStatus } = useAppStore();
|
|
32
|
+
const [openRefreshModal, setOpenRefreshModal] = useState(false);
|
|
30
33
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
31
34
|
const {
|
|
32
35
|
config: { features, theme },
|
|
@@ -94,6 +97,10 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
94
97
|
};
|
|
95
98
|
}, []);
|
|
96
99
|
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
setOpenRefreshModal(fetchStatus === 'failed');
|
|
102
|
+
}, [fetchStatus]);
|
|
103
|
+
|
|
97
104
|
return (
|
|
98
105
|
<Container
|
|
99
106
|
height={height}
|
|
@@ -156,6 +163,10 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
156
163
|
<BottomLogo />
|
|
157
164
|
</div>
|
|
158
165
|
</Footer>
|
|
166
|
+
<RefreshModal
|
|
167
|
+
open={openRefreshModal}
|
|
168
|
+
onClose={() => setOpenRefreshModal(false)}
|
|
169
|
+
/>
|
|
159
170
|
</Container>
|
|
160
171
|
);
|
|
161
172
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { PropTypes } from './RefreshModal.types';
|
|
2
|
+
|
|
3
|
+
import { i18n } from '@lingui/core';
|
|
4
|
+
import { Divider, MessageBox, RefreshIcon } from '@rango-dev/ui';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { getContainer } from '../../utils/common';
|
|
8
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
9
|
+
|
|
10
|
+
import { RefreshButton } from './RefreshModal.styles';
|
|
11
|
+
|
|
12
|
+
export function RefreshModal(props: PropTypes) {
|
|
13
|
+
const { open, onClose } = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<WatermarkedModal
|
|
17
|
+
open={open}
|
|
18
|
+
dismissible
|
|
19
|
+
onClose={onClose}
|
|
20
|
+
container={getContainer()}>
|
|
21
|
+
<MessageBox
|
|
22
|
+
title={i18n.t('Something wrong')}
|
|
23
|
+
type="error"
|
|
24
|
+
description={i18n.t('Something Wrong. Please refresh the app')}>
|
|
25
|
+
<Divider size={30} />
|
|
26
|
+
<RefreshButton
|
|
27
|
+
variant="outlined"
|
|
28
|
+
size="large"
|
|
29
|
+
type="primary"
|
|
30
|
+
fullWidth
|
|
31
|
+
onClick={() => location.reload()}>
|
|
32
|
+
<RefreshIcon size={20} color="primary" />
|
|
33
|
+
<Divider size={4} direction="horizontal" />
|
|
34
|
+
{i18n.t('Refresh')}
|
|
35
|
+
</RefreshButton>
|
|
36
|
+
</MessageBox>
|
|
37
|
+
</WatermarkedModal>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RefreshModal } from './RefreshModal';
|
|
@@ -34,6 +34,8 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
34
34
|
const { updateConfig, updateSettings, fetch: fetchMeta } = useAppStore();
|
|
35
35
|
const blockchains = useAppStore().blockchains();
|
|
36
36
|
const tokens = useAppStore().tokens();
|
|
37
|
+
const config = useAppStore().config;
|
|
38
|
+
|
|
37
39
|
const walletOptions: ProvidersOptions = {
|
|
38
40
|
walletConnectProjectId: props.config?.walletConnectProjectId,
|
|
39
41
|
};
|
|
@@ -50,6 +52,10 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
50
52
|
if (props.config) {
|
|
51
53
|
updateConfig(props.config);
|
|
52
54
|
updateSettings(props.config);
|
|
55
|
+
window['__rango'] = {
|
|
56
|
+
config,
|
|
57
|
+
dappConfig: props.config,
|
|
58
|
+
};
|
|
53
59
|
}
|
|
54
60
|
}, [props.config]);
|
|
55
61
|
|