@rango-dev/widget-embedded 0.36.1-next.13 → 0.36.1-next.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.36.1-next.13",
3
+ "version": "0.36.1-next.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -12,6 +12,7 @@ import React from 'react';
12
12
  import { useNavigate } from 'react-router-dom';
13
13
 
14
14
  import { WIDGET_UI_ID } from '../../constants';
15
+ import { useUiStore } from '../../store/ui';
15
16
  import { getContainer } from '../../utils/common';
16
17
  import { WatermarkedModal } from '../common/WatermarkedModal';
17
18
 
@@ -31,6 +32,7 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
31
32
  diagnosisUrl,
32
33
  } = props;
33
34
  const navigate = useNavigate();
35
+ const { showProfileBanner } = useUiStore();
34
36
 
35
37
  return (
36
38
  <WatermarkedModal
@@ -72,21 +74,32 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
72
74
  description={description}
73
75
  />
74
76
  )}
75
- <Divider size={32} />
77
+ <Divider size={30} />
76
78
  {status === 'success' && (
77
- <Button
78
- id="widget-swap-details-modal-done-btn"
79
- variant="contained"
80
- type="primary"
81
- size="large"
82
- onClick={() => {
83
- const home = '../../';
84
- navigate(home);
85
- }}>
86
- <Typography variant="title" size="medium" color="neutral100">
79
+ <>
80
+ {showProfileBanner && (
81
+ <>
82
+ <img
83
+ src={
84
+ 'https://raw.githubusercontent.com/rango-exchange/assets/main/banners/widget/profile.png'
85
+ }
86
+ alt="Profile Banner"
87
+ />
88
+ <Divider size={30} />
89
+ </>
90
+ )}
91
+ <Button
92
+ id="widget-swap-details-modal-done-btn"
93
+ variant="contained"
94
+ type="primary"
95
+ size="large"
96
+ onClick={() => {
97
+ const home = '../../';
98
+ navigate(home);
99
+ }}>
87
100
  {i18n.t('Done')}
88
- </Typography>
89
- </Button>
101
+ </Button>
102
+ </>
90
103
  )}
91
104
  <Divider size={12} />
92
105
  {diagnosisUrl && (
@@ -6,6 +6,9 @@ export type Watermark = 'NONE' | 'FULL';
6
6
  type ConfigResponse = {
7
7
  config: {
8
8
  watermark: Watermark;
9
+ banners: {
10
+ profile: boolean;
11
+ };
9
12
  };
10
13
  };
11
14
 
@@ -14,7 +17,7 @@ interface UseFetchApiConfig {
14
17
  }
15
18
 
16
19
  export function useFetchApiConfig(): UseFetchApiConfig {
17
- const { setWatermark } = useUiStore();
20
+ const { setWatermark, setShowProfileBanner } = useUiStore();
18
21
 
19
22
  const fetchApiConfig: UseFetchApiConfig['fetchApiConfig'] = async () => {
20
23
  const response = await fetch(
@@ -28,6 +31,7 @@ export function useFetchApiConfig(): UseFetchApiConfig {
28
31
  const data: ConfigResponse = await response.json();
29
32
 
30
33
  setWatermark(data.config.watermark);
34
+ setShowProfileBanner(data.config.banners.profile);
31
35
  };
32
36
  return { fetchApiConfig };
33
37
  }
package/src/store/ui.ts CHANGED
@@ -12,12 +12,14 @@ interface UiState {
12
12
  tabManagerInitiated: boolean;
13
13
  showActivateTabModal: boolean;
14
14
  watermark: Watermark;
15
+ showProfileBanner: boolean;
15
16
  activateCurrentTab: (
16
17
  setCurrentTabAsActive: () => void,
17
18
  hasRunningSwaps: boolean
18
19
  ) => void;
19
20
  setShowActivateTabModal: (flag: boolean) => void;
20
21
  setWatermark: (watermark: Watermark) => void;
22
+ setShowProfileBanner: (showProfileBanner: boolean) => void;
21
23
  }
22
24
 
23
25
  export const useUiStore = createSelectors(
@@ -26,6 +28,7 @@ export const useUiStore = createSelectors(
26
28
  tabManagerInitiated: false,
27
29
  showActivateTabModal: false,
28
30
  watermark: 'NONE',
31
+ showProfileBanner: false,
29
32
  fetchingApiConfig: false,
30
33
  activateCurrentTab: (setCurrentTabAsActive, hasRunningSwaps) => {
31
34
  const { showActivateTabModal } = get();
@@ -42,6 +45,9 @@ export const useUiStore = createSelectors(
42
45
  setWatermark: (watermark) => {
43
46
  set({ watermark });
44
47
  },
48
+ setShowProfileBanner: (showProfileBanner) => {
49
+ set({ showProfileBanner });
50
+ },
45
51
  }))
46
52
  );
47
53