@rango-dev/widget-embedded 0.21.1-next.1 → 0.21.1-next.10

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 (130) hide show
  1. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
  2. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  3. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  4. package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -1
  5. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  6. package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts +4 -0
  7. package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts.map +1 -0
  8. package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts +2 -0
  9. package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts.map +1 -0
  10. package/dist/components/{SwapsGroup/SwapsGroup.styles.d.ts → HistoryGroupedList/HistoryGroupedList.styles.d.ts} +162 -1
  11. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -0
  12. package/dist/components/{SwapsGroup/SwapsGroup.types.d.ts → HistoryGroupedList/HistoryGroupedList.types.d.ts} +5 -4
  13. package/dist/components/HistoryGroupedList/HistoryGroupedList.types.d.ts.map +1 -0
  14. package/dist/components/HistoryGroupedList/index.d.ts +2 -0
  15. package/dist/components/HistoryGroupedList/index.d.ts.map +1 -0
  16. package/dist/components/Layout/Layout.d.ts.map +1 -1
  17. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  18. package/dist/components/Layout/Layout.types.d.ts +0 -1
  19. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  20. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  21. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  22. package/dist/components/Quote/Quote.d.ts.map +1 -1
  23. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
  24. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
  25. package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -1
  26. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
  27. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  28. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
  29. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  30. package/dist/components/WalletModal/WalletModal.d.ts.map +1 -1
  31. package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts.map +1 -1
  32. package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts +5 -0
  33. package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts.map +1 -0
  34. package/dist/components/common/WatermarkedModal/index.d.ts +2 -0
  35. package/dist/components/common/WatermarkedModal/index.d.ts.map +1 -0
  36. package/dist/constants/index.d.ts +7 -1
  37. package/dist/constants/index.d.ts.map +1 -1
  38. package/dist/constants/searchParams.d.ts +2 -1
  39. package/dist/constants/searchParams.d.ts.map +1 -1
  40. package/dist/containers/App/App.d.ts.map +1 -1
  41. package/dist/hooks/useFetchApiConfig.d.ts +7 -0
  42. package/dist/hooks/useFetchApiConfig.d.ts.map +1 -0
  43. package/dist/hooks/useIframe/index.d.ts +2 -0
  44. package/dist/hooks/useIframe/index.d.ts.map +1 -0
  45. package/dist/hooks/useIframe/useIframe.d.ts +9 -0
  46. package/dist/hooks/useIframe/useIframe.d.ts.map +1 -0
  47. package/dist/hooks/useIframe/useIframe.helpers.d.ts +2 -0
  48. package/dist/hooks/useIframe/useIframe.helpers.d.ts.map +1 -0
  49. package/dist/hooks/useIframe/useIframe.types.d.ts +10 -0
  50. package/dist/hooks/useIframe/useIframe.types.d.ts.map +1 -0
  51. package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -1
  52. package/dist/index.d.ts +2 -1
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +2 -2
  55. package/dist/index.js.map +4 -4
  56. package/dist/pages/Home.d.ts.map +1 -1
  57. package/dist/store/slices/config.d.ts +8 -0
  58. package/dist/store/slices/config.d.ts.map +1 -1
  59. package/dist/store/ui.d.ts +5 -0
  60. package/dist/store/ui.d.ts.map +1 -1
  61. package/dist/types/config.d.ts +1 -0
  62. package/dist/types/config.d.ts.map +1 -1
  63. package/dist/types/notification.d.ts +4 -4
  64. package/dist/types/notification.d.ts.map +1 -1
  65. package/dist/utils/common.d.ts.map +1 -1
  66. package/dist/utils/date.d.ts +1 -1
  67. package/dist/utils/date.d.ts.map +1 -1
  68. package/dist/utils/wallets.d.ts +1 -1
  69. package/package.json +3 -3
  70. package/readme.md +1 -0
  71. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +9 -7
  72. package/src/components/ConfirmWalletsModal/WalletList.tsx +11 -9
  73. package/src/components/CustomCollapsible/CustomCollapsible.tsx +1 -10
  74. package/src/components/HeaderButtons/HomeButtons.tsx +2 -1
  75. package/src/components/HistoryGroupedList/HistoryGroupedList.helpers.ts +17 -0
  76. package/src/components/{SwapsGroup/SwapsGroup.styles.ts → HistoryGroupedList/HistoryGroupedList.styles.ts} +9 -0
  77. package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +162 -0
  78. package/src/components/{SwapsGroup/SwapsGroup.types.ts → HistoryGroupedList/HistoryGroupedList.types.ts} +4 -3
  79. package/src/components/HistoryGroupedList/index.ts +1 -0
  80. package/src/components/Layout/Layout.styles.ts +12 -6
  81. package/src/components/Layout/Layout.tsx +47 -22
  82. package/src/components/Layout/Layout.types.ts +0 -1
  83. package/src/components/NotificationContent/NotificationContent.styles.ts +1 -0
  84. package/src/components/NotificationContent/NotificationContent.tsx +13 -22
  85. package/src/components/NotificationContent/NotificationNotFound.tsx +1 -1
  86. package/src/components/Quote/Quote.tsx +2 -12
  87. package/src/components/Quote/QuoteCostDetails.tsx +3 -3
  88. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +4 -3
  89. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +5 -3
  90. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +4 -4
  91. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +7 -5
  92. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +7 -5
  93. package/src/components/TokenList/TokenList.tsx +4 -24
  94. package/src/components/WalletModal/WalletModal.tsx +8 -5
  95. package/src/components/common/ActivateTabModal/ActivateTabModal.tsx +9 -3
  96. package/src/components/common/WatermarkedModal/WatermarkedModal.tsx +18 -0
  97. package/src/components/common/WatermarkedModal/index.ts +1 -0
  98. package/src/constants/index.ts +7 -1
  99. package/src/constants/searchParams.ts +2 -0
  100. package/src/containers/App/App.tsx +3 -1
  101. package/src/hooks/useFetchApiConfig.ts +33 -0
  102. package/src/hooks/useIframe/index.ts +1 -0
  103. package/src/hooks/useIframe/useIframe.helpers.ts +3 -0
  104. package/src/hooks/useIframe/useIframe.ts +55 -0
  105. package/src/hooks/useIframe/useIframe.types.ts +13 -0
  106. package/src/hooks/useSwapInput.ts +2 -2
  107. package/src/hooks/useSyncStoresWithConfig.ts +3 -3
  108. package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +11 -1
  109. package/src/index.ts +2 -0
  110. package/src/pages/HistoryPage.tsx +6 -6
  111. package/src/pages/Home.tsx +2 -3
  112. package/src/store/notification.ts +4 -4
  113. package/src/store/slices/config.ts +29 -1
  114. package/src/store/slices/data.ts +2 -2
  115. package/src/store/ui.ts +8 -0
  116. package/src/types/config.ts +1 -0
  117. package/src/types/notification.ts +4 -4
  118. package/src/utils/common.ts +2 -2
  119. package/src/utils/configs.ts +3 -3
  120. package/src/utils/date.ts +9 -2
  121. package/src/utils/meta.ts +2 -2
  122. package/src/utils/wallets.ts +1 -1
  123. package/dist/components/SwapsGroup/SwapsGroup.d.ts +0 -4
  124. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +0 -1
  125. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +0 -1
  126. package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +0 -1
  127. package/dist/components/SwapsGroup/index.d.ts +0 -2
  128. package/dist/components/SwapsGroup/index.d.ts.map +0 -1
  129. package/src/components/SwapsGroup/SwapsGroup.tsx +0 -141
  130. package/src/components/SwapsGroup/index.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuCnD,wBAAgB,IAAI,sBAyPnB"}
1
+ {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuCnD,wBAAgB,IAAI,sBAwPnB"}
@@ -1,9 +1,17 @@
1
1
  import type { WidgetConfig } from '../../types';
2
2
  import type { StateCreatorWithInitialData } from '../app';
3
3
  export declare const DEFAULT_CONFIG: WidgetConfig;
4
+ interface IframeConfigs {
5
+ clientUrl?: string;
6
+ }
4
7
  export type ConfigSlice = {
5
8
  config: WidgetConfig;
6
9
  updateConfig: (config: WidgetConfig) => void;
10
+ iframe: {
11
+ clientUrl?: string;
12
+ };
13
+ updateIframe: <K extends keyof IframeConfigs>(name: K, value: IframeConfigs[K]) => void;
7
14
  };
8
15
  export declare const createConfigSlice: StateCreatorWithInitialData<WidgetConfig, ConfigSlice, ConfigSlice>;
16
+ export {};
9
17
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/store/slices/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAE1D,eAAO,MAAM,cAAc,EAAE,YAK5B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,YAAY,CAAC;IAErB,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,2BAA2B,CACzD,YAAY,EACZ,WAAW,EACX,WAAW,CAiBZ,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/store/slices/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,QAAQ,CAAC;AAE1D,eAAO,MAAM,cAAc,EAAE,YAM5B,CAAC;AAEF,UAAU,aAAa;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,MAAM,MAAM,WAAW,GAAG;IAExB,MAAM,EAAE,YAAY,CAAC;IACrB,YAAY,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAG7C,MAAM,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,YAAY,EAAE,CAAC,CAAC,SAAS,MAAM,aAAa,EAC1C,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KACpB,IAAI,CAAC;CACX,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,2BAA2B,CACzD,YAAY,EACZ,WAAW,EACX,WAAW,CA6BZ,CAAC"}
@@ -1,9 +1,12 @@
1
+ import type { Watermark } from '../hooks/useFetchApiConfig';
1
2
  interface UiState {
2
3
  isActiveTab: boolean;
3
4
  tabManagerInitiated: boolean;
4
5
  showActivateTabModal: boolean;
6
+ watermark: Watermark;
5
7
  activateCurrentTab: (setCurrentTabAsActive: () => void, hasRunningSwaps: boolean) => void;
6
8
  setShowActivateTabModal: (flag: boolean) => void;
9
+ setWatermark: (watermark: Watermark) => void;
7
10
  }
8
11
  export declare const useUiStore: {
9
12
  (): UiState;
@@ -14,8 +17,10 @@ export declare const useUiStore: {
14
17
  isActiveTab: () => boolean;
15
18
  tabManagerInitiated: () => boolean;
16
19
  showActivateTabModal: () => boolean;
20
+ watermark: () => Watermark;
17
21
  activateCurrentTab: () => (setCurrentTabAsActive: () => void, hasRunningSwaps: boolean) => void;
18
22
  setShowActivateTabModal: () => (flag: boolean) => void;
23
+ setWatermark: () => (watermark: Watermark) => void;
19
24
  };
20
25
  };
21
26
  export declare const setCurrentTabAsActive: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/store/ui.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,kBAAkB,EAAE,CAClB,qBAAqB,EAAE,MAAM,IAAI,EACjC,eAAe,EAAE,OAAO,KACrB,IAAI,CAAC;IACV,uBAAuB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AAED,eAAO,MAAM,UAAU;;;;;;;;;0DANI,MAAM,IAAI,mBAChB,OAAO,KACrB,IAAI;8CACuB,OAAO,KAAK,IAAI;;CAqBjD,CAAC;AASF,eAAO,MAAM,qBAAqB,YAAwB,CAAC;AAE3D,eAAO,MAAM,iBAAiB,YAAqB,CAAC"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/store/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAS5D,UAAU,OAAO;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE,SAAS,CAAC;IACrB,kBAAkB,EAAE,CAClB,qBAAqB,EAAE,MAAM,IAAI,EACjC,eAAe,EAAE,OAAO,KACrB,IAAI,CAAC;IACV,uBAAuB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,UAAU;;;;;;;;;;0DAPI,MAAM,IAAI,mBAChB,OAAO,KACrB,IAAI;8CACuB,OAAO,KAAK,IAAI;wCACtB,SAAS,KAAK,IAAI;;CA0B7C,CAAC;AASF,eAAO,MAAM,qBAAqB,YAAwB,CAAC;AAE3D,eAAO,MAAM,iBAAiB,YAAqB,CAAC"}
@@ -172,6 +172,7 @@ export type Features = Partial<Record<'theme' | 'language' | 'connectWalletButto
172
172
  export type WidgetConfig = {
173
173
  apiKey: string;
174
174
  apiUrl?: string;
175
+ title?: string;
175
176
  walletConnectProjectId?: string;
176
177
  affiliate?: WidgetAffiliate;
177
178
  amount?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC;AAClD,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB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C;IACpC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC"}
@@ -2,13 +2,13 @@ import { type Route, type RouteEvent, type Step, type StepEvent } from '@rango-d
2
2
  type NotificationRoute = {
3
3
  from: {
4
4
  blockchain: Step['fromBlockchain'];
5
- tokenSymbol: Step['fromSymbol'];
6
- tokenAddress: Step['fromSymbolAddress'];
5
+ symbol: Step['fromSymbol'];
6
+ address: Step['fromSymbolAddress'];
7
7
  };
8
8
  to: {
9
9
  blockchain: Step['toBlockchain'];
10
- tokenSymbol: Step['toSymbol'];
11
- tokenAddress: Step['toSymbolAddress'];
10
+ symbol: Step['toSymbol'];
11
+ address: Step['toSymbolAddress'];
12
12
  };
13
13
  };
14
14
  export type Notification = Pick<Route, 'requestId'> & {
@@ -1 +1 @@
1
- {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/types/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,SAAS,EACf,MAAM,uCAAuC,CAAC;AAE/C,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE;QACJ,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnC,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAChC,YAAY,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;KACzC,CAAC;IACF,EAAE,EAAE;QACF,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACjC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9B,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;KACvC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG;IACpD,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,iBAAiB,CAAC;CAC1B,CAAC"}
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/types/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,KAAK,EACV,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,SAAS,EACf,MAAM,uCAAuC,CAAC;AAE/C,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE;QACJ,UAAU,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3B,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;KACpC,CAAC;IACF,EAAE,EAAE;QACF,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACjC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzB,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;KAClC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,GAAG;IACpD,KAAK,EAAE,UAAU,GAAG,SAAS,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,iBAAiB,CAAC;CAC1B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,eAAO,MAAM,YAAY,mBACkC,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,eAAO,MAAM,YAAY,mBACyC,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { GroupBy } from '../components/SwapsGroup/SwapsGroup.types';
1
+ import type { GroupBy } from '../components/HistoryGroupedList/HistoryGroupedList.types';
2
2
  export declare const groupSwapsByDate: GroupBy;
3
3
  //# sourceMappingURL=date.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAMzE,eAAO,MAAM,gBAAgB,EAAE,OAmE9B,CAAC"}
1
+ {"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../src/utils/date.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2DAA2D,CAAC;AAMzF,eAAO,MAAM,gBAAgB,EAAE,OA0E9B,CAAC"}
@@ -18,7 +18,7 @@ export declare const isExperimentalChain: (blockchains: BlockchainMeta[], wallet
18
18
  export declare const getKeplrCompatibleConnectedWallets: (selectableWallets: Wallet[]) => WalletType[];
19
19
  export declare function formatBalance(balance: Balance | null): Balance | null;
20
20
  export declare function sortTokens(tokens: Token[], getBalanceFor: (token: Token) => Balance | null, isTokenPinned: (token: Token) => boolean): Token[];
21
- export declare function tokensAreEqual(tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null, tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null): boolean;
21
+ export declare function areTokensEqual(tokenA: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null, tokenB: Pick<Token, 'blockchain' | 'symbol' | 'address'> | null): boolean;
22
22
  export declare function sortWalletsBasedOnConnectionState(wallets: ModalWalletInfo[]): ModalWalletInfo[];
23
23
  export declare function getConciseAddress(address: string, maxChars?: number, ellipsisLength?: number): string;
24
24
  export declare function getAddress({ chain, connectedWallets, walletType, }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.21.1-next.1",
3
+ "version": "0.21.1-next.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -25,7 +25,7 @@
25
25
  "@rango-dev/queue-manager-core": "^0.25.0",
26
26
  "@rango-dev/queue-manager-rango-preset": "^0.26.0",
27
27
  "@rango-dev/queue-manager-react": "^0.25.0",
28
- "@rango-dev/ui": "^0.27.1-next.0",
28
+ "@rango-dev/ui": "^0.27.1-next.6",
29
29
  "@rango-dev/wallets-react": "^0.12.0",
30
30
  "@rango-dev/wallets-shared": "^0.26.0",
31
31
  "bignumber.js": "^9.1.1",
@@ -47,4 +47,4 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  }
50
- }
50
+ }
package/readme.md CHANGED
@@ -1,3 +1,4 @@
1
1
  # @rango-dev/widget-embedded
2
2
 
3
3
  Rango Embedded Widget
4
+
@@ -11,14 +11,13 @@ import {
11
11
  ChevronLeftIcon,
12
12
  Divider,
13
13
  MessageBox,
14
- Modal,
15
14
  Typography,
16
15
  WalletIcon,
17
16
  } from '@rango-dev/ui';
18
17
  import React, { useEffect, useState } from 'react';
19
18
  import { useNavigate } from 'react-router-dom';
20
19
 
21
- import { RANGO_SWAP_BOX_ID } from '../../constants';
20
+ import { WIDGET_UI_ID } from '../../constants';
22
21
  import { getQuoteErrorMessage } from '../../constants/errors';
23
22
  import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
24
23
  import { useAppStore } from '../../store/AppStore';
@@ -26,6 +25,7 @@ import { useQuoteStore } from '../../store/quote';
26
25
  import { useWalletsStore } from '../../store/wallets';
27
26
  import { getBlockchainShortNameFor } from '../../utils/meta';
28
27
  import { confirmSwapDisabled } from '../../utils/swap';
28
+ import { WatermarkedModal } from '../common/WatermarkedModal';
29
29
  import { CustomCollapsible } from '../CustomCollapsible/CustomCollapsible';
30
30
  import { ExpandedIcon } from '../CustomCollapsible/CustomCollapsible.styles';
31
31
 
@@ -52,6 +52,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
52
52
  //TODO: move component's logics to a custom hook
53
53
  const { open, onClose, onCancel, onCheckBalance, loading } = props;
54
54
  const config = useAppStore().config;
55
+
55
56
  const blockchains = useAppStore().blockchains();
56
57
  const {
57
58
  quote,
@@ -228,12 +229,13 @@ export function ConfirmWalletsModal(props: PropTypes) {
228
229
  }, [connectedWallets.length]);
229
230
 
230
231
  const modalContainer = document.getElementById(
231
- RANGO_SWAP_BOX_ID
232
+ WIDGET_UI_ID.SWAP_BOX_ID
232
233
  ) as HTMLDivElement;
233
234
 
234
235
  const navigate = useNavigate();
236
+
235
237
  return (
236
- <Modal
238
+ <WatermarkedModal
237
239
  open={open}
238
240
  onClose={() => {
239
241
  if (!quoteWalletsConfirmed) {
@@ -291,7 +293,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
291
293
  ),
292
294
  })}
293
295
  anchor="center">
294
- <Modal
296
+ <WatermarkedModal
295
297
  open={balanceWarnings.length > 0}
296
298
  onClose={setBalanceWarnings.bind(null, [])}
297
299
  container={modalContainer}>
@@ -308,7 +310,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
308
310
  {i18n.t('Proceed anyway')}
309
311
  </Button>
310
312
  </MessageBox>
311
- </Modal>
313
+ </WatermarkedModal>
312
314
  {showMoreWalletFor && (
313
315
  <WalletsContainer>
314
316
  <div className={walletsListStyles()}>
@@ -467,6 +469,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
467
469
  </Wallets>
468
470
  </>
469
471
  )}
470
- </Modal>
472
+ </WatermarkedModal>
471
473
  );
472
474
  }
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-magic-numbers */
2
1
  import type { PropTypes } from './WalletList.type';
3
2
  import type { Wallet } from '../../types';
4
3
  import type { WalletInfo } from '@rango-dev/ui';
@@ -10,7 +9,6 @@ import {
10
9
  Divider,
11
10
  Image,
12
11
  MessageBox,
13
- Modal,
14
12
  SelectableWallet,
15
13
  Typography,
16
14
  WalletState,
@@ -18,7 +16,7 @@ import {
18
16
  import React, { useEffect, useState } from 'react';
19
17
 
20
18
  import { useWallets } from '../..';
21
- import { RANGO_SWAP_BOX_ID } from '../../constants';
19
+ import { WIDGET_UI_ID } from '../../constants';
22
20
  import { useWalletList } from '../../hooks/useWalletList';
23
21
  import {
24
22
  TIME_TO_CLOSE_MODAL,
@@ -33,6 +31,7 @@ import {
33
31
  getConciseAddress,
34
32
  isExperimentalChain,
35
33
  } from '../../utils/wallets';
34
+ import { WatermarkedModal } from '../common/WatermarkedModal';
36
35
  import { WalletModal } from '../WalletModal';
37
36
 
38
37
  import { ShowMoreWallets } from './ConfirmWallets.styles';
@@ -42,6 +41,7 @@ import {
42
41
  WalletImageContainer,
43
42
  } from './WalletList.styles';
44
43
 
44
+ const ACCOUNT_ADDRESS_MAX_CHARACTERS = 7;
45
45
  export function WalletList(props: PropTypes) {
46
46
  const { chain, isSelected, selectWallet, limit, onShowMore } = props;
47
47
  const { config } = useAppStore();
@@ -112,7 +112,7 @@ export function WalletList(props: PropTypes) {
112
112
  }, [JSON.stringify(list)]);
113
113
 
114
114
  const modalContainer = document.getElementById(
115
- RANGO_SWAP_BOX_ID
115
+ WIDGET_UI_ID.SWAP_BOX_ID
116
116
  ) as HTMLDivElement;
117
117
 
118
118
  useEffect(() => {
@@ -147,7 +147,9 @@ export function WalletList(props: PropTypes) {
147
147
  walletType: wallet.type,
148
148
  chain,
149
149
  });
150
- const conciseAddress = address ? getConciseAddress(address) : '';
150
+ const conciseAddress = address
151
+ ? getConciseAddress(address, ACCOUNT_ADDRESS_MAX_CHARACTERS)
152
+ : '';
151
153
 
152
154
  const experimentalChain = isExperimentalChain(blockchains(), chain);
153
155
 
@@ -205,7 +207,7 @@ export function WalletList(props: PropTypes) {
205
207
  error={error}
206
208
  />
207
209
  {!!experimentalChainWallet && (
208
- <Modal
210
+ <WatermarkedModal
209
211
  open={!!experimentalChainWallet && showExperimentalChainModal}
210
212
  container={modalContainer}
211
213
  onClose={() => {
@@ -235,10 +237,10 @@ export function WalletList(props: PropTypes) {
235
237
  {i18n.t('Confirm')}
236
238
  </Button>
237
239
  </MessageBox>
238
- </Modal>
240
+ </WatermarkedModal>
239
241
  )}
240
242
  {addingExperimentalChainStatus && (
241
- <Modal
243
+ <WatermarkedModal
242
244
  open={!!addingExperimentalChainStatus}
243
245
  onClose={setAddingExperimentalChainStatus.bind(null, null)}
244
246
  container={modalContainer}>
@@ -290,7 +292,7 @@ export function WalletList(props: PropTypes) {
290
292
  )}
291
293
 
292
294
  <Divider direction="vertical" size={32} />
293
- </Modal>
295
+ </WatermarkedModal>
294
296
  )}
295
297
  <SelectableWallet
296
298
  key={wallet.type}
@@ -1,12 +1,11 @@
1
1
  import type { PropTypes } from './CustomCollapsible.types';
2
2
  import type { PropsWithChildren } from 'react';
3
3
 
4
- import React, { useLayoutEffect, useRef } from 'react';
4
+ import React, { useRef } from 'react';
5
5
 
6
6
  import {
7
7
  CollapsibleContent,
8
8
  CollapsibleRoot,
9
- EXPANDABLE_TRANSITION_DURATION,
10
9
  Trigger,
11
10
  } from './CustomCollapsible.styles';
12
11
 
@@ -22,14 +21,6 @@ export function CustomCollapsible(props: PropsWithChildren<PropTypes>) {
22
21
  } = props;
23
22
  const ref = useRef<HTMLDivElement | null>(null);
24
23
 
25
- useLayoutEffect(() => {
26
- if (open && ref.current) {
27
- setTimeout(() => {
28
- ref?.current?.scrollIntoView({ behavior: 'smooth' });
29
- }, EXPANDABLE_TRANSITION_DURATION);
30
- }
31
- }, [open]);
32
-
33
24
  return (
34
25
  <CollapsibleRoot
35
26
  ref={ref}
@@ -39,7 +39,8 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
39
39
 
40
40
  {!isNotificationsHidden && (
41
41
  <Popover
42
- align="center"
42
+ align="end"
43
+ alignOffset={-88}
43
44
  collisionPadding={{ right: 20, left: 20 }}
44
45
  container={getContainer()}
45
46
  content={<NotificationContent />}>
@@ -0,0 +1,17 @@
1
+ /*
2
+ * The calculateGroupsSoFar Slices the total groups into the groups which contain the items so far.
3
+ * For example, if you have [10, 10, 10, 10] groups in total,
4
+ * slicing them to 23 will result in [10, 10, 3] :
5
+ * https://virtuoso.dev/grouped-with-load-on-demand/
6
+ */
7
+ export function calculateGroupsSoFar(totalGroups: number[], count: number) {
8
+ const groups: number[] = [];
9
+ let index = 0;
10
+ do {
11
+ const group = totalGroups[index];
12
+ groups.push(Math.min(group, count));
13
+ count -= group;
14
+ index++;
15
+ } while (count > 0 && index <= totalGroups.length);
16
+ return groups;
17
+ }
@@ -2,10 +2,19 @@ import { css, darkTheme, styled } from '@rango-dev/ui';
2
2
 
3
3
  export const groupStyles = css();
4
4
 
5
+ export const SwapItemContainer = styled('div', {
6
+ display: 'flex',
7
+ justifyContent: 'center',
8
+ alignItems: 'center',
9
+ padding: '$5',
10
+ });
11
+
5
12
  export const Group = styled('div', {
6
13
  width: '100%',
7
14
  display: 'flex',
8
15
  flexDirection: 'column',
16
+ backgroundColor: '$background',
17
+ padding: '$10 $5 0 $5',
9
18
  [`& .${groupStyles}`]: {
10
19
  $$color: '$colors$neutral600',
11
20
  [`.${darkTheme} &`]: {
@@ -0,0 +1,162 @@
1
+ import type { PropTypes } from './HistoryGroupedList.types';
2
+
3
+ import { i18n } from '@lingui/core';
4
+ import {
5
+ Divider,
6
+ GroupedVirtualizedList,
7
+ Skeleton,
8
+ SwapListItem,
9
+ Typography,
10
+ } from '@rango-dev/ui';
11
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
12
+
13
+ import {
14
+ TOKEN_AMOUNT_MAX_DECIMALS,
15
+ TOKEN_AMOUNT_MIN_DECIMALS,
16
+ } from '../../constants/routing';
17
+ import { getContainer } from '../../utils/common';
18
+ import { formatTooltipNumbers, numberToString } from '../../utils/numbers';
19
+
20
+ import { calculateGroupsSoFar } from './HistoryGroupedList.helpers';
21
+ import {
22
+ Group,
23
+ groupStyles,
24
+ SwapItemContainer,
25
+ SwapList,
26
+ Time,
27
+ } from './HistoryGroupedList.styles';
28
+
29
+ const ITEMS_PER_PAGE = 10;
30
+
31
+ export function HistoryGroupedList(props: PropTypes) {
32
+ const { list, onSwapClick, groupBy, isLoading } = props;
33
+ const [currentGroupCounts, setCurrentGroupCounts] = useState<number[]>([]);
34
+ const loadedItems = useRef(0);
35
+ const { swaps, groupCounts, groups } = groupBy(list);
36
+
37
+ const calculateGroups = useCallback(calculateGroupsSoFar, []);
38
+
39
+ const loadMore = useCallback(() => {
40
+ const remainedItems = list.length - loadedItems.current;
41
+ if (remainedItems) {
42
+ loadedItems.current += Math.min(remainedItems, ITEMS_PER_PAGE);
43
+ setCurrentGroupCounts(calculateGroups(groupCounts, loadedItems.current));
44
+ }
45
+ }, [list.length]);
46
+
47
+ useEffect(() => {
48
+ if (!isLoading) {
49
+ loadMore();
50
+ }
51
+ }, [isLoading, loadMore]);
52
+
53
+ if (isLoading) {
54
+ // The number of items presented in each group.
55
+ const swaps = [1, 2];
56
+ const loadingGroups = [swaps, swaps];
57
+ return (
58
+ <>
59
+ {loadingGroups.map((group, index) => {
60
+ const key = index;
61
+ return (
62
+ <Group key={key}>
63
+ <Time>
64
+ <Skeleton variant="text" width={60} size="small" />
65
+ <Divider size={16} />
66
+ </Time>
67
+ <Divider size={4} />
68
+ <SwapList>
69
+ {group.map((_, index) => {
70
+ const key = index;
71
+ return <SwapListItem isLoading={true} key={key} />;
72
+ })}
73
+ </SwapList>
74
+ </Group>
75
+ );
76
+ })}
77
+ </>
78
+ );
79
+ }
80
+
81
+ return (
82
+ <GroupedVirtualizedList
83
+ endReached={() => {
84
+ if (loadedItems.current < list.length) {
85
+ loadMore();
86
+ }
87
+ }}
88
+ groupCounts={currentGroupCounts}
89
+ groupContent={(index) => {
90
+ return (
91
+ <Group>
92
+ <Time>
93
+ <Typography
94
+ variant="label"
95
+ size="medium"
96
+ className={groupStyles()}>
97
+ {groups[index]}
98
+ </Typography>
99
+ </Time>
100
+ </Group>
101
+ );
102
+ }}
103
+ itemContent={(index, groupIndex) => {
104
+ const swap = swaps[index];
105
+ if (!swap) {
106
+ return null;
107
+ }
108
+ const firstStep = swap.steps[0];
109
+ const lastStep = swap.steps[swap.steps.length - 1];
110
+ return (
111
+ <SwapItemContainer key={swap.requestId}>
112
+ <SwapListItem
113
+ requestId={swap.requestId}
114
+ creationTime={swap.creationTime}
115
+ status={swap.status}
116
+ onClick={onSwapClick}
117
+ tooltipContainer={getContainer()}
118
+ onlyShowTime={groups[groupIndex] === i18n.t('Today')}
119
+ swapTokenData={{
120
+ from: {
121
+ token: {
122
+ image: firstStep.fromLogo,
123
+ displayName: firstStep.fromSymbol,
124
+ },
125
+ blockchain: {
126
+ image: firstStep.fromBlockchainLogo || '',
127
+ },
128
+ amount: numberToString(
129
+ swap.inputAmount,
130
+ TOKEN_AMOUNT_MIN_DECIMALS,
131
+ TOKEN_AMOUNT_MAX_DECIMALS
132
+ ),
133
+ realAmount: formatTooltipNumbers(swap.inputAmount),
134
+ },
135
+ to: {
136
+ token: {
137
+ image: lastStep.toLogo,
138
+ displayName: lastStep.toSymbol,
139
+ },
140
+ blockchain: {
141
+ image: lastStep.toBlockchainLogo || '',
142
+ },
143
+ amount: numberToString(
144
+ lastStep.outputAmount ||
145
+ lastStep.expectedOutputAmountHumanReadable ||
146
+ '',
147
+ TOKEN_AMOUNT_MIN_DECIMALS,
148
+ TOKEN_AMOUNT_MAX_DECIMALS
149
+ ),
150
+ realAmount: formatTooltipNumbers(
151
+ lastStep.outputAmount ||
152
+ lastStep.expectedOutputAmountHumanReadable
153
+ ),
154
+ },
155
+ }}
156
+ />
157
+ </SwapItemContainer>
158
+ );
159
+ }}
160
+ />
161
+ );
162
+ }
@@ -1,13 +1,14 @@
1
1
  import type { PendingSwap } from 'rango-types';
2
2
 
3
3
  export type GroupBy = (list: PendingSwap[]) => {
4
- title: string;
5
4
  swaps: PendingSwap[];
6
- }[];
5
+ groups: string[];
6
+ groupCounts: number[];
7
+ };
7
8
 
8
9
  export interface PropTypes {
9
10
  list: PendingSwap[];
10
11
  onSwapClick: (requestId: string) => void;
11
- groupBy?: GroupBy;
12
+ groupBy: GroupBy;
12
13
  isLoading: boolean;
13
14
  }
@@ -0,0 +1 @@
1
+ export { HistoryGroupedList } from './HistoryGroupedList';
@@ -1,12 +1,13 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
3
  const WIDGET_HEIGHT = '700px';
4
+
4
5
  export const Container = styled('div', {
5
6
  position: 'relative',
6
7
  display: 'flex',
7
8
  flexDirection: 'column',
8
9
  borderRadius: '$primary',
9
- width: '100vh',
10
+ width: '100vw',
10
11
  minWidth: '300px',
11
12
  maxWidth: '390px',
12
13
  boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
@@ -35,12 +36,17 @@ export const Content = styled('div', {
35
36
  padding: 0,
36
37
  overflowY: 'auto',
37
38
  });
39
+
38
40
  export const Footer = styled('div', {
39
- backgroundColor: '$background',
40
- '& .footer__content': {
41
- padding: '$0 $20',
42
- },
41
+ padding: '0 $20 $10',
43
42
  '& .footer__logo': {
44
- padding: '$0 $20 $10 $20',
43
+ opacity: 0,
44
+ transition: 'opacity 1s ease-in-out',
45
+ '&.logo__show': {
46
+ opacity: 1,
47
+ },
48
+ '&.logo__hidden': {
49
+ visibility: 'hidden',
50
+ },
45
51
  },
46
52
  });