@rango-dev/widget-embedded 0.28.1-next.0 → 0.28.1-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.
Files changed (36) hide show
  1. package/dist/components/BlockchainList/BlockchainList.helpers.d.ts +1 -2
  2. package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
  3. package/dist/constants/fonts.d.ts +5 -0
  4. package/dist/constants/fonts.d.ts.map +1 -1
  5. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
  6. package/dist/globalStyles.d.ts.map +1 -1
  7. package/dist/hooks/useFontLoader.d.ts +5 -0
  8. package/dist/hooks/useFontLoader.d.ts.map +1 -0
  9. package/dist/hooks/useTheme.d.ts.map +1 -1
  10. package/dist/index.d.ts +2 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/index.js.map +4 -4
  14. package/dist/pages/WalletsPage.d.ts.map +1 -1
  15. package/dist/types/config.d.ts +1 -1
  16. package/dist/utils/common.d.ts +3 -0
  17. package/dist/utils/common.d.ts.map +1 -1
  18. package/dist/utils/configs.d.ts +0 -1
  19. package/dist/utils/configs.d.ts.map +1 -1
  20. package/dist/utils/wallets.d.ts +2 -0
  21. package/dist/utils/wallets.d.ts.map +1 -1
  22. package/package.json +3 -3
  23. package/src/components/BlockchainList/BlockchainList.helpers.ts +6 -25
  24. package/src/constants/fonts.ts +84 -0
  25. package/src/containers/WidgetProvider/WidgetProvider.tsx +12 -1
  26. package/src/globalStyles.ts +1 -3
  27. package/src/hooks/useBootstrap/useBootstrap.ts +1 -1
  28. package/src/hooks/useFontLoader.ts +40 -0
  29. package/src/hooks/useTheme.ts +1 -1
  30. package/src/index.ts +2 -0
  31. package/src/pages/SelectBlockchainPage.tsx +3 -3
  32. package/src/pages/WalletsPage.tsx +34 -2
  33. package/src/types/config.ts +1 -1
  34. package/src/utils/common.ts +29 -0
  35. package/src/utils/configs.ts +0 -1
  36. package/src/utils/wallets.ts +53 -2
@@ -1 +1 @@
1
- {"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA8BxC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAqG1B"}
1
+ {"version":3,"file":"WalletsPage.d.ts","sourceRoot":"","sources":["../../src/pages/WalletsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAkCxC,eAAO,MAAM,mBAAmB,OAAQ,CAAC;AACzC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,wBAAgB,WAAW,sBAyH1B"}
@@ -25,7 +25,7 @@ export type WidgetColors = {
25
25
  * radius, width, and height.
26
26
  * @property {'auto' | 'light' | 'dark'} mode - The mode property is used to specify the default theme for
27
27
  * the widget.
28
- * @property {string} fontFamily - The font family to be used in the widget.
28
+ * @property {string} fontFamily - The font family to be used in the widget. If you want to do this, include the font of your choice in your HTML file.
29
29
  * @property {{ light?: WidgetColors; dark?: WidgetColors }} colors - The `colors` property is a sub-property of the `WidgetTheme` object that
30
30
  * defines the color scheme for the widget. It is of type `Colors`, which is likely another object that
31
31
  * contains specific color values for various parts of the widget (e.g. background color, text color,
@@ -1,4 +1,5 @@
1
1
  import type { Token } from 'rango-sdk';
2
+ import { TransactionType } from 'rango-sdk';
2
3
  export declare function removeDuplicateFrom<T>(array: T[]): T[];
3
4
  export declare function areEqual(array1: (number | string)[], array2: (number | string)[]): boolean;
4
5
  export declare function debounce(fn: Function, time: number): (...args: any) => void;
@@ -8,4 +9,6 @@ export declare function startWithText(text: string, searchText: string): boolean
8
9
  export declare const getContainer: () => HTMLElement;
9
10
  export declare const getExpanded: () => HTMLElement;
10
11
  export declare function compareWithSearchFor(tokenA: Token, tokenB: Token, searchFor?: string): number;
12
+ export declare const isBlockchainTypeInCategory: (blockchainType: TransactionType, category: string) => boolean;
13
+ export declare const getFontUrlByName: (fontName: string) => string | undefined;
11
14
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAWvC,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,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED,eAAO,MAAM,YAAY,mBACyC,CAAC;AAEnE,eAAO,MAAM,WAAW,mBAC8C,CAAC;AAsDvE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,KAAK,EACb,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CA0GR"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAY5C,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,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAEvE;AAED,eAAO,MAAM,YAAY,mBACyC,CAAC;AAEnE,eAAO,MAAM,WAAW,mBAC8C,CAAC;AAsDvE,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,KAAK,EACb,MAAM,EAAE,KAAK,EACb,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CA0GR;AAED,eAAO,MAAM,0BAA0B,mBACrB,eAAe,YACrB,MAAM,KACf,OAeF,CAAC;AAEF,eAAO,MAAM,gBAAgB,aAAc,MAAM,uBAGhD,CAAC"}
@@ -15,7 +15,6 @@ export declare function setConfig(name: keyof Configs, value: any): any;
15
15
  export declare function initConfig(nextConfigs: Configs): Configs;
16
16
  export declare const DEFAULT_PRIMARY_RADIUS = 20;
17
17
  export declare const DEFAULT_SECONDARY_RADIUS = 25;
18
- export declare const DEFAULT_FONT_FAMILY = "Roboto";
19
18
  export declare const THEME_CLASS_NAME_PREFIX = "theme-widget";
20
19
  export declare const isTokenExcludedInConfig: (token: Token | null, tokensConfig?: TokensConfig) => boolean;
21
20
  export declare const isBlockchainExcludedInConfig: (blockchain: BlockchainMeta | null, blockchainsConfig?: string[]) => boolean | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/utils/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAM9D,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,YAAY,GACb,KAAK,EAAE,GACP;IACE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B,CAAC;AAMN,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,OAAO,UAE5C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,OAAO,EAAE,KAAK,EAAE,GAAG,OAIxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,OAAO,WAS9C;AAED,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,eAAO,MAAM,uBAAuB,UAC3B,KAAK,GAAG,IAAI,iBACJ,YAAY,YAe5B,CAAC;AAEF,eAAO,MAAM,4BAA4B,eAC3B,cAAc,GAAG,IAAI,sBACb,MAAM,EAAE,+BAO7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACf,OAAO,sBACF,OAAO,YACjB,aAAa,YAMxB,CAAC"}
1
+ {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/utils/configs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAM9D,MAAM,WAAW,OAAO;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,YAAY,GACb,KAAK,EAAE,GACP;IACE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B,CAAC;AAMN,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,OAAO,UAE5C;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,OAAO,EAAE,KAAK,EAAE,GAAG,OAIxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,OAAO,WAS9C;AAED,eAAO,MAAM,sBAAsB,KAAK,CAAC;AACzC,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAE3C,eAAO,MAAM,uBAAuB,iBAAiB,CAAC;AAEtD,eAAO,MAAM,uBAAuB,UAC3B,KAAK,GAAG,IAAI,iBACJ,YAAY,YAe5B,CAAC;AAEF,eAAO,MAAM,4BAA4B,eAC3B,cAAc,GAAG,IAAI,sBACb,MAAM,EAAE,+BAO7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,kBACf,OAAO,sBACF,OAAO,YACjB,aAAa,YAMxB,CAAC"}
@@ -33,4 +33,6 @@ export declare function createTokenHash(token: Asset): TokenHash;
33
33
  export declare function makeTokensBalance(connectedWallets: ConnectedWallet[]): TokensBalance;
34
34
  export declare const isFetchingBalance: (connectedWallets: ConnectedWallet[], blockchain: string) => boolean;
35
35
  export declare function hashWalletsState(walletsInfo: ModalWalletInfo[]): string;
36
+ export declare function filterBlockchainsByWalletTypes(wallets: ModalWalletInfo[], blockchains: BlockchainMeta[]): BlockchainMeta[];
37
+ export declare function filterWalletsByCategory(wallets: WalletInfoWithNamespaces[], category: string): WalletInfoWithNamespaces[];
36
38
  //# sourceMappingURL=wallets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"wallets.d.ts","sour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module",
6
6
  "source": "./src/index.ts",
@@ -29,7 +29,7 @@
29
29
  "@rango-dev/queue-manager-core": "^0.26.0",
30
30
  "@rango-dev/queue-manager-rango-preset": "^0.33.0",
31
31
  "@rango-dev/queue-manager-react": "^0.26.0",
32
- "@rango-dev/ui": "^0.34.1-next.0",
32
+ "@rango-dev/ui": "^0.34.1-next.1",
33
33
  "@rango-dev/wallets-react": "^0.19.0",
34
34
  "@rango-dev/wallets-shared": "^0.33.0",
35
35
  "bignumber.js": "^9.1.1",
@@ -52,4 +52,4 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  }
55
- }
55
+ }
@@ -1,35 +1,16 @@
1
- import { BlockchainCategories } from '@rango-dev/ui';
2
- import { type BlockchainMeta, TransactionType } from 'rango-sdk';
1
+ import { type BlockchainMeta } from 'rango-sdk';
3
2
 
4
- import { containsText } from '../../utils/common';
5
-
6
- export const filterByType = (
7
- blockchain: BlockchainMeta,
8
- type: string
9
- ): boolean => {
10
- switch (type) {
11
- case BlockchainCategories.ALL:
12
- return true;
13
- case BlockchainCategories.UTXO:
14
- return blockchain.type === TransactionType.TRANSFER;
15
- case BlockchainCategories.OTHER:
16
- return (
17
- blockchain.type !== TransactionType.TRANSFER &&
18
- blockchain.type !== TransactionType.COSMOS &&
19
- blockchain.type !== TransactionType.EVM
20
- );
21
- default:
22
- return blockchain.type === type;
23
- }
24
- };
3
+ import { containsText, isBlockchainTypeInCategory } from '../../utils/common';
25
4
 
26
5
  export const filterBlockchains = (
27
6
  list: BlockchainMeta[],
28
7
  searchedFor: string,
29
- blockchainType: string
8
+ blockchainCategory: string
30
9
  ) =>
31
10
  list
32
- .filter((blockchain) => filterByType(blockchain, blockchainType))
11
+ .filter((blockchain) =>
12
+ isBlockchainTypeInCategory(blockchain.type, blockchainCategory)
13
+ )
33
14
  .filter(
34
15
  (blockchain) =>
35
16
  containsText(blockchain.name, searchedFor) ||
@@ -1 +1,85 @@
1
1
  export const DEFAULT_FONT_FAMILY = 'Roboto';
2
+
3
+ export const SUPPORTED_FONTS = [
4
+ {
5
+ name: 'Roboto',
6
+ value: 'Roboto',
7
+ url: '',
8
+ },
9
+ {
10
+ name: 'Times New Roman',
11
+ value: 'Times New Roman',
12
+ url: 'https://fonts.cdnfonts.com/css/times-new-roman',
13
+ },
14
+ {
15
+ name: 'Arial',
16
+ value: 'Arial',
17
+ url: '',
18
+ },
19
+ {
20
+ name: 'Open Sans',
21
+ value: 'Open Sans',
22
+ url: 'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap',
23
+ },
24
+ {
25
+ name: 'Noto Sans',
26
+ value: 'Noto Sans',
27
+ url: 'https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap',
28
+ },
29
+ {
30
+ name: 'Montserrat',
31
+ value: 'Montserrat',
32
+ url: 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&display=swap',
33
+ },
34
+ {
35
+ name: 'Poppins',
36
+ value: 'Poppins',
37
+ url: 'https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap',
38
+ },
39
+ {
40
+ name: 'Roboto Condensed',
41
+ value: 'Roboto Condensed',
42
+ url: 'https://fonts.googleapis.com/css2?family=Roboto+Condensed:ital,wght@0,100..900;1,100..900&display=swap',
43
+ },
44
+
45
+ {
46
+ name: 'Roboto Mono',
47
+ value: 'Roboto Mono',
48
+ url: 'https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap',
49
+ },
50
+ {
51
+ name: 'Oswald',
52
+ value: 'Oswald',
53
+ url: 'https://fonts.googleapis.com/css2?family=Oswald:wght@200..700&display=swap',
54
+ },
55
+ {
56
+ name: 'Raleway',
57
+ value: 'Raleway',
58
+ url: 'https://fonts.googleapis.com/css2?family=Raleway:ital,wght@0,100..900;1,100..900&display=swap',
59
+ },
60
+ {
61
+ name: 'Sedan',
62
+ value: 'Sedan',
63
+ url: 'https://fonts.googleapis.com/css2?family=Sedan:ital@0;1&display=swap',
64
+ },
65
+ {
66
+ name: 'Inter',
67
+ value: 'Inter',
68
+ url: 'https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap',
69
+ },
70
+ {
71
+ name: 'Rubik',
72
+ value: 'Rubik',
73
+ url: 'https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap',
74
+ },
75
+ {
76
+ name: 'Lora',
77
+ value: 'Lora',
78
+ url: 'https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&display=swap',
79
+ },
80
+ {
81
+ name: 'Barlow Condensed',
82
+ value: 'Barlow Condensed',
83
+ url: 'https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap',
84
+ },
85
+ ];
@@ -1,9 +1,10 @@
1
1
  import type { PropTypes } from './WidgetProvider.types';
2
2
  import type { PropsWithChildren } from 'react';
3
3
 
4
- import React, { useMemo } from 'react';
4
+ import React, { useEffect, useMemo } from 'react';
5
5
 
6
6
  import { DEFAULT_BASE_URL, RANGO_PUBLIC_API_KEY } from '../../constants';
7
+ import useFontLoader from '../../hooks/useFontLoader';
7
8
  import QueueManager from '../../QueueManager';
8
9
  import { initConfig } from '../../utils/configs';
9
10
  import { WidgetWallets } from '../Wallets';
@@ -19,6 +20,16 @@ export function WidgetProvider(props: PropsWithChildren<PropTypes>) {
19
20
  });
20
21
  }, [config.apiKey, config.apiUrl]);
21
22
 
23
+ const fontFamily = props.config?.theme?.fontFamily;
24
+
25
+ const { handleLoadCustomFont } = useFontLoader();
26
+
27
+ useEffect(() => {
28
+ if (fontFamily) {
29
+ handleLoadCustomFont(fontFamily);
30
+ }
31
+ }, [fontFamily]);
32
+
22
33
  return (
23
34
  <WidgetWallets config={config} onUpdateState={onUpdateState}>
24
35
  <QueueManager apiKey={config.apiKey}>
@@ -2,8 +2,6 @@ import { globalCss } from '@rango-dev/ui';
2
2
 
3
3
  export const globalFont = () =>
4
4
  globalCss({
5
- '@import': [
5
+ '@import':
6
6
  "url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap')",
7
- "url('https://fonts.cdnfonts.com/css/times-new-roman')",
8
- ],
9
7
  })();
@@ -16,8 +16,8 @@ import { useForceAutoConnect } from '../useForceAutoConnect';
16
16
  import { useSubscribeToWidgetEvents } from '../useSubscribeToWidgetEvents';
17
17
 
18
18
  export function useBootstrap() {
19
- globalFont();
20
19
  useForceAutoConnect();
20
+ globalFont();
21
21
  useSubscribeToWidgetEvents();
22
22
  const blockchains = useAppStore().blockchains();
23
23
  const { canSwitchNetworkTo } = useWallets();
@@ -0,0 +1,40 @@
1
+ import { useState } from 'react';
2
+
3
+ import { getFontUrlByName } from '../utils/common';
4
+ /*
5
+ *TODO:
6
+ * Loading fonts from JS has a downside and it is the bundle needs to be downloaded and executed first which means after sometime font will be added to <head /> and it causes a layoutshift each time.
7
+ * We've added Roboto into <head /> since it's the default font. the downside here is it will load roboto anyway even dApp has set fontFamily other than Roboto which causes an unneccerary downloand (Roboto).
8
+ * We decided to go with the second one and it can be solved in future by split these types of configs into a separate js file and let it to be loaded with a more priority than the main bundle. it should be also cached which imrpove user experience after first load.
9
+ */
10
+ const useFontLoader = () => {
11
+ const [fontLink, setFontLink] = useState<HTMLLinkElement | null>(null);
12
+
13
+ const loadFont = (fontUrl: string) => {
14
+ const link = document.createElement('link');
15
+ link.href = fontUrl;
16
+ link.rel = 'stylesheet';
17
+ document.head.appendChild(link);
18
+ return link;
19
+ };
20
+
21
+ const unloadFont = () => {
22
+ if (fontLink) {
23
+ document.head.removeChild(fontLink);
24
+ setFontLink(null);
25
+ }
26
+ };
27
+
28
+ const handleLoadCustomFont = (fontName: string) => {
29
+ unloadFont(); // Remove previous font
30
+ const fontUrl = getFontUrlByName(fontName);
31
+ if (fontUrl) {
32
+ const newFontLink = loadFont(fontUrl);
33
+ setFontLink(newFontLink);
34
+ }
35
+ };
36
+
37
+ return { handleLoadCustomFont };
38
+ };
39
+
40
+ export default useFontLoader;
@@ -6,10 +6,10 @@ import {
6
6
  } from '@rango-dev/ui';
7
7
  import { useEffect, useState } from 'react';
8
8
 
9
+ import { DEFAULT_FONT_FAMILY } from '../constants/fonts';
9
10
  import { useAppStore } from '../store/AppStore';
10
11
  import { type WidgetTheme } from '../types';
11
12
  import {
12
- DEFAULT_FONT_FAMILY,
13
13
  DEFAULT_PRIMARY_RADIUS,
14
14
  DEFAULT_SECONDARY_RADIUS,
15
15
  } from '../utils/configs';
package/src/index.ts CHANGED
@@ -59,6 +59,7 @@ import { Networks, WalletTypes } from '@rango-dev/wallets-shared';
59
59
  import { PendingSwapNetworkStatus } from 'rango-types';
60
60
 
61
61
  import { WIDGET_UI_ID as UI_ID } from './constants';
62
+ import { SUPPORTED_FONTS } from './constants/fonts';
62
63
  import { WidgetWallets } from './containers/Wallets';
63
64
  import { Widget } from './containers/Widget';
64
65
  import { useWidget } from './containers/WidgetInfo';
@@ -113,6 +114,7 @@ export {
113
114
  StepExecutionEventStatus,
114
115
  StepExecutionBlockedEventStatus,
115
116
  UI_ID,
117
+ SUPPORTED_FONTS,
116
118
  };
117
119
 
118
120
  // Internal type exports for Rango
@@ -1,7 +1,7 @@
1
1
  import { i18n } from '@lingui/core';
2
2
  import {
3
3
  Divider,
4
- getCountCategories,
4
+ getCategoriesCount,
5
5
  SelectableCategoryList,
6
6
  } from '@rango-dev/ui';
7
7
  import React, { useState } from 'react';
@@ -30,9 +30,9 @@ export function SelectBlockchainPage(props: PropTypes) {
30
30
  type,
31
31
  });
32
32
 
33
- const countActiveCategories = getCountCategories(blockchains);
33
+ const activeCategoriesCount = getCategoriesCount(blockchains);
34
34
 
35
- const showCategory = countActiveCategories !== 1;
35
+ const showCategory = activeCategoriesCount !== 1;
36
36
 
37
37
  return (
38
38
  <Layout
@@ -1,7 +1,15 @@
1
1
  import type { Namespace, WalletType } from '@rango-dev/wallets-shared';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
- import { styled, Typography, Wallet, WalletState } from '@rango-dev/ui';
4
+ import {
5
+ Divider,
6
+ getCategoriesCount,
7
+ SelectableCategoryList,
8
+ styled,
9
+ Typography,
10
+ Wallet,
11
+ WalletState,
12
+ } from '@rango-dev/ui';
5
13
  import React, { useState } from 'react';
6
14
 
7
15
  import { Layout, PageContainer } from '../components/Layout';
@@ -11,6 +19,10 @@ import { useWalletList } from '../hooks/useWalletList';
11
19
  import { useAppStore } from '../store/AppStore';
12
20
  import { useUiStore } from '../store/ui';
13
21
  import { getContainer } from '../utils/common';
22
+ import {
23
+ filterBlockchainsByWalletTypes,
24
+ filterWalletsByCategory,
25
+ } from '../utils/wallets';
14
26
 
15
27
  interface NamespacesModalState {
16
28
  providerType: string;
@@ -37,6 +49,9 @@ export const TIME_TO_IGNORE_MODAL = 300;
37
49
 
38
50
  export function WalletsPage() {
39
51
  const { fetchStatus: fetchMetaStatus } = useAppStore();
52
+ const [blockchainCategory, setBlockchainCategory] = useState<string>('ALL');
53
+ const blockchains = useAppStore().blockchains();
54
+
40
55
  const [openModal, setOpenModal] = useState(false);
41
56
  const [namespacesModalState, setNamespacesModalState] =
42
57
  useState<NamespacesModalState | null>(null);
@@ -74,17 +89,34 @@ export function WalletsPage() {
74
89
  const selectedWalletState =
75
90
  selectedWallet?.state || WalletState.NOT_INSTALLED;
76
91
 
92
+ const filteredBlockchains = filterBlockchainsByWalletTypes(list, blockchains);
93
+ const activeCategoriesCount = getCategoriesCount(filteredBlockchains);
94
+ const showCategory = activeCategoriesCount !== 1;
95
+
96
+ const filteredWallets = filterWalletsByCategory(list, blockchainCategory);
97
+
77
98
  return (
78
99
  <Layout
79
100
  header={{
80
101
  title: i18n.t('Connect Wallets'),
81
102
  }}>
82
103
  <Container>
104
+ {showCategory && (
105
+ <>
106
+ <SelectableCategoryList
107
+ setCategory={setBlockchainCategory}
108
+ category={blockchainCategory}
109
+ blockchains={filteredBlockchains}
110
+ isLoading={fetchMetaStatus === 'loading'}
111
+ />
112
+ <Divider size={24} />
113
+ </>
114
+ )}
83
115
  <Typography variant="title" size="xmedium" align="center">
84
116
  {i18n.t('Choose a wallet to connect.')}
85
117
  </Typography>
86
118
  <ListContainer>
87
- {list.map((wallet, index) => {
119
+ {filteredWallets.map((wallet, index) => {
88
120
  const key = `wallet-${index}-${wallet.type}`;
89
121
  return (
90
122
  <Wallet
@@ -28,7 +28,7 @@ export type WidgetColors = {
28
28
  * radius, width, and height.
29
29
  * @property {'auto' | 'light' | 'dark'} mode - The mode property is used to specify the default theme for
30
30
  * the widget.
31
- * @property {string} fontFamily - The font family to be used in the widget.
31
+ * @property {string} fontFamily - The font family to be used in the widget. If you want to do this, include the font of your choice in your HTML file.
32
32
  * @property {{ light?: WidgetColors; dark?: WidgetColors }} colors - The `colors` property is a sub-property of the `WidgetTheme` object that
33
33
  * defines the color scheme for the widget. It is of type `Colors`, which is likely another object that
34
34
  * contains specific color values for various parts of the widget (e.g. background color, text color,
@@ -1,6 +1,10 @@
1
1
  import type { Token } from 'rango-sdk';
2
2
 
3
+ import { BlockchainCategories } from '@rango-dev/ui';
4
+ import { TransactionType } from 'rango-sdk';
5
+
3
6
  import { WIDGET_UI_ID } from '../constants';
7
+ import { SUPPORTED_FONTS } from '../constants/fonts';
4
8
  import {
5
9
  MIN_LENGTH_SYMBOL_CONTAINS,
6
10
  MIN_LENGTH_SYMBOL_START_WITH,
@@ -218,3 +222,28 @@ export function compareWithSearchFor(
218
222
 
219
223
  return 0;
220
224
  }
225
+
226
+ export const isBlockchainTypeInCategory = (
227
+ blockchainType: TransactionType,
228
+ category: string
229
+ ): boolean => {
230
+ switch (category) {
231
+ case BlockchainCategories.ALL:
232
+ return true;
233
+ case BlockchainCategories.UTXO:
234
+ return blockchainType === TransactionType.TRANSFER;
235
+ case BlockchainCategories.OTHER:
236
+ return (
237
+ blockchainType !== TransactionType.TRANSFER &&
238
+ blockchainType !== TransactionType.COSMOS &&
239
+ blockchainType !== TransactionType.EVM
240
+ );
241
+ default:
242
+ return blockchainType === category;
243
+ }
244
+ };
245
+
246
+ export const getFontUrlByName = (fontName: string) => {
247
+ const font = SUPPORTED_FONTS.find((font) => font.value === fontName);
248
+ return font?.url;
249
+ };
@@ -46,7 +46,6 @@ export function initConfig(nextConfigs: Configs) {
46
46
 
47
47
  export const DEFAULT_PRIMARY_RADIUS = 20;
48
48
  export const DEFAULT_SECONDARY_RADIUS = 25;
49
- export const DEFAULT_FONT_FAMILY = 'Roboto';
50
49
 
51
50
  export const THEME_CLASS_NAME_PREFIX = `theme-widget`;
52
51
 
@@ -16,9 +16,17 @@ import type {
16
16
  WalletType,
17
17
  WalletTypes,
18
18
  } from '@rango-dev/wallets-shared';
19
- import type { BlockchainMeta, Token, WalletDetail } from 'rango-sdk';
19
+ import type {
20
+ BlockchainMeta,
21
+ Token,
22
+ TransactionType,
23
+ WalletDetail,
24
+ } from 'rango-sdk';
20
25
 
21
- import { WalletState as WalletStatus } from '@rango-dev/ui';
26
+ import {
27
+ BlockchainCategories,
28
+ WalletState as WalletStatus,
29
+ } from '@rango-dev/ui';
22
30
  import { readAccountAddress } from '@rango-dev/wallets-react';
23
31
  import {
24
32
  detectInstallLink,
@@ -39,6 +47,7 @@ import {
39
47
  } from '../constants/routing';
40
48
  import { EXCLUDED_WALLETS } from '../constants/wallets';
41
49
 
50
+ import { isBlockchainTypeInCategory, removeDuplicateFrom } from './common';
42
51
  import { numberToString } from './numbers';
43
52
 
44
53
  export function mapStatusToWalletState(state: WalletState): WalletStatus {
@@ -64,6 +73,7 @@ export function mapWalletTypesToWalletInfo(
64
73
  .filter((wallet) => !EXCLUDED_WALLETS.includes(wallet as WalletTypes))
65
74
  .filter((wallet) => {
66
75
  const { supportedChains, isContractWallet } = getWalletInfo(wallet);
76
+
67
77
  const { installed, network } = getState(wallet);
68
78
  const filterContractWallets =
69
79
  isContractWallet && (!installed || (!!chain && network !== chain));
@@ -85,7 +95,12 @@ export function mapWalletTypesToWalletInfo(
85
95
  showOnMobile,
86
96
  namespaces,
87
97
  singleNamespace,
98
+ supportedChains,
88
99
  } = getWalletInfo(type);
100
+ const blockchainTypes = removeDuplicateFrom(
101
+ supportedChains.map((item) => item.type)
102
+ );
103
+
89
104
  const state = mapStatusToWalletState(getState(type));
90
105
  return {
91
106
  title: name,
@@ -96,6 +111,7 @@ export function mapWalletTypesToWalletInfo(
96
111
  showOnMobile,
97
112
  namespaces,
98
113
  singleNamespace,
114
+ blockchainTypes,
99
115
  };
100
116
  });
101
117
  }
@@ -538,3 +554,38 @@ export const isFetchingBalance = (
538
554
  export function hashWalletsState(walletsInfo: ModalWalletInfo[]) {
539
555
  return walletsInfo.map((w) => w.state).join('-');
540
556
  }
557
+
558
+ export function filterBlockchainsByWalletTypes(
559
+ wallets: ModalWalletInfo[],
560
+ blockchains: BlockchainMeta[]
561
+ ) {
562
+ const uniqueBlockchainTypes = new Set<TransactionType>();
563
+ wallets.forEach((wallet) => {
564
+ wallet.blockchainTypes.forEach((type) => {
565
+ uniqueBlockchainTypes.add(type);
566
+ });
567
+ });
568
+ const filteredBlockchains = blockchains.filter((blockchain) =>
569
+ uniqueBlockchainTypes.has(blockchain.type)
570
+ );
571
+
572
+ return filteredBlockchains;
573
+ }
574
+
575
+ export function filterWalletsByCategory(
576
+ wallets: WalletInfoWithNamespaces[],
577
+ category: string
578
+ ) {
579
+ if (category === BlockchainCategories.ALL) {
580
+ return wallets;
581
+ }
582
+
583
+ return wallets.filter((wallet) => {
584
+ for (const type of wallet.blockchainTypes) {
585
+ if (isBlockchainTypeInCategory(type, category)) {
586
+ return true;
587
+ }
588
+ }
589
+ return false;
590
+ });
591
+ }