@rango-dev/widget-embedded 0.14.1-next.14 → 0.14.1-next.16

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 (57) hide show
  1. package/dist/Widget.d.ts.map +1 -1
  2. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  3. package/dist/constants/configs.d.ts +2 -0
  4. package/dist/constants/configs.d.ts.map +1 -0
  5. package/dist/constants/errors.d.ts +1 -1
  6. package/dist/constants/errors.d.ts.map +1 -1
  7. package/dist/constants/languages.d.ts +11 -0
  8. package/dist/constants/languages.d.ts.map +1 -0
  9. package/dist/constants/messages.d.ts +1 -1
  10. package/dist/constants/messages.d.ts.map +1 -1
  11. package/dist/hooks/useLanguage.d.ts +11 -0
  12. package/dist/hooks/useLanguage.d.ts.map +1 -0
  13. package/dist/hooks/usePrepareBlockchainList/index.d.ts +2 -0
  14. package/dist/hooks/usePrepareBlockchainList/index.d.ts.map +1 -0
  15. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +2 -0
  16. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts.map +1 -0
  17. package/dist/hooks/{usePrepareBlockchainList.d.ts → usePrepareBlockchainList/usePrepareBlockchainList.d.ts} +1 -9
  18. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -0
  19. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +10 -0
  20. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -0
  21. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +3 -0
  22. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -0
  23. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.d.ts +2 -0
  24. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.d.ts.map +1 -0
  25. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +11 -0
  26. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -0
  27. package/dist/index.js +1 -1
  28. package/dist/index.js.map +4 -4
  29. package/dist/pages/LanguagePage.d.ts.map +1 -1
  30. package/dist/store/settings.d.ts +15 -6
  31. package/dist/store/settings.d.ts.map +1 -1
  32. package/package.json +2 -2
  33. package/src/Widget.tsx +10 -1
  34. package/src/components/BlockchainsSection/BlockchainsSection.tsx +21 -6
  35. package/src/components/NoRoutes/NoRoutes.helper.ts +4 -4
  36. package/src/components/NoRoutes/NoRoutes.tsx +1 -1
  37. package/src/components/RouteErrors/RouteErrors.tsx +2 -2
  38. package/src/components/RouteErrors/RouteErrorsModal.tsx +6 -6
  39. package/src/constants/configs.ts +1 -0
  40. package/src/constants/errors.ts +43 -41
  41. package/src/constants/languages.ts +19 -0
  42. package/src/constants/messages.ts +7 -5
  43. package/src/hooks/useConfirmSwap.ts +1 -1
  44. package/src/hooks/useLanguage.ts +27 -0
  45. package/src/hooks/usePrepareBlockchainList/index.ts +1 -0
  46. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -0
  47. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +108 -0
  48. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +3101 -0
  49. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +273 -0
  50. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +38 -0
  51. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +12 -0
  52. package/src/pages/Home.tsx +2 -2
  53. package/src/pages/LanguagePage.tsx +16 -39
  54. package/src/store/settings.ts +46 -4
  55. package/src/utils/swap.ts +10 -10
  56. package/dist/hooks/usePrepareBlockchainList.d.ts.map +0 -1
  57. package/src/hooks/usePrepareBlockchainList.ts +0 -125
@@ -1 +1 @@
1
- {"version":3,"file":"Widget.d.ts","sourceRoot":"","sources":["../src/Widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAmD,MAAM,OAAO,CAAC;AAgCxE,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,wBAAgB,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,qBA4CzD;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,qBAsB3D"}
1
+ {"version":3,"file":"Widget.d.ts","sourceRoot":"","sources":["../src/Widget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG/C,OAAO,KAAmD,MAAM,OAAO,CAAC;AAiCxE,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,CAAC;AAEF,wBAAgB,IAAI,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,qBAoDzD;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,WAAW,CAAC,qBAsB3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"BlockchainsSection.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsSection/BlockchainsSection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAU5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,qBA+DlD"}
1
+ {"version":3,"file":"BlockchainsSection.d.ts","sourceRoot":"","sources":["../../../src/components/BlockchainsSection/BlockchainsSection.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAU5D,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,qBA+ElD"}
@@ -0,0 +1,2 @@
1
+ export declare const BLOCKCHAIN_LIST_SIZE = 10;
2
+ //# sourceMappingURL=configs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../../src/constants/configs.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,KAAK,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ConfirmSwapError } from '../types';
2
- export declare const errorMessages: {
2
+ export declare const errorMessages: () => {
3
3
  genericServerError: string;
4
4
  liquiditySourcesError: {
5
5
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/constants/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMjD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCzB,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,UAWjE"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/constants/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAMjD,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCzB,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,UAWjE"}
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { FlagPropTypes, Language } from '@rango-dev/ui';
3
+ export type LanguageItem = {
4
+ title: string;
5
+ label: string;
6
+ local: Language;
7
+ SVGFlag: React.ComponentType<FlagPropTypes>;
8
+ };
9
+ export declare const LANGUAGES: LanguageItem[];
10
+ export declare const DEFAULT_LANGUAGE = "en";
11
+ //# sourceMappingURL=languages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"languages.d.ts","sourceRoot":"","sources":["../../src/constants/languages.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI7D,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,CAAC;IAChB,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,YAAY,EAKnC,CAAC;AAEF,eAAO,MAAM,gBAAgB,OAAO,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare const swapButtonTitles: {
1
+ export declare const swapButtonTitles: () => {
2
2
  connectWallet: string;
3
3
  swap: string;
4
4
  swapAnyway: string;
@@ -1 +1 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/constants/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC"}
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/constants/messages.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB;;;;;CAO5B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { LanguageItem } from '../constants/languages';
2
+ import { type Language } from '@rango-dev/ui';
3
+ interface UseLanguage {
4
+ languages: LanguageItem[];
5
+ defaultLanguage: Language;
6
+ activeLanguage: Language;
7
+ changeLanguage: (language: Language) => void;
8
+ }
9
+ export declare function useLanguage(): UseLanguage;
10
+ export {};
11
+ //# sourceMappingURL=useLanguage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLanguage.d.ts","sourceRoot":"","sources":["../../src/hooks/useLanguage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAK9C,UAAU,WAAW;IACnB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,eAAe,EAAE,QAAQ,CAAC;IAC1B,cAAc,EAAE,QAAQ,CAAC;IACzB,cAAc,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;CAC9C;AAED,wBAAgB,WAAW,IAAI,WAAW,CAYzC"}
@@ -0,0 +1,2 @@
1
+ export { usePrepareBlockchainList } from './usePrepareBlockchainList';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrepareBlockchainList/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const MOST_USED_BLOCKChAINS: string[];
2
+ //# sourceMappingURL=usePrepareBlockchainList.constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrepareBlockchainList.constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAA+B,CAAC"}
@@ -1,12 +1,5 @@
1
+ import type { PrepareListOptions, PrepareListOutput } from './usePrepareBlockchainList.types';
1
2
  import type { BlockchainMeta } from 'rango-sdk';
2
- interface PrepareListOptions {
3
- limit?: number;
4
- selected?: string;
5
- }
6
- interface PrepareListOutput {
7
- list: BlockchainMeta[];
8
- more: BlockchainMeta[];
9
- }
10
3
  /**
11
4
  *
12
5
  * UI needs some specific logics like limiting the list and sorting,
@@ -14,5 +7,4 @@ interface PrepareListOutput {
14
7
  *
15
8
  */
16
9
  export declare function usePrepareBlockchainList(blockchains: BlockchainMeta[], options?: PrepareListOptions): PrepareListOutput;
17
- export {};
18
10
  //# sourceMappingURL=usePrepareBlockchainList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrepareBlockchainList.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAQhD;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,cAAc,EAAE,EAC7B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,iBAAiB,CAgBnB"}
@@ -0,0 +1,10 @@
1
+ import type { PrepareListOptions } from './usePrepareBlockchainList.types';
2
+ import type { BlockchainMeta } from 'rango-sdk';
3
+ export declare function prepare(blockchains: BlockchainMeta[], preferredBlockchains: string[], options?: PrepareListOptions): {
4
+ list: BlockchainMeta[];
5
+ more: BlockchainMeta[];
6
+ };
7
+ /** There is a hardcoded list of blockchains that we want to show them first in the list. */
8
+ export declare function sortByMostUsedBlockchains(a: BlockchainMeta, b: BlockchainMeta): 0 | 1 | -1;
9
+ export declare function generateSortByPreferredBlockchainsFor(preferredBlockchains: string[]): (a: BlockchainMeta, b: BlockchainMeta) => 0 | 1 | -1;
10
+ //# sourceMappingURL=usePrepareBlockchainList.helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrepareBlockchainList.helpers.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,wBAAgB,OAAO,CACrB,WAAW,EAAE,cAAc,EAAE,EAC7B,oBAAoB,EAAE,MAAM,EAAE,EAC9B,OAAO,CAAC,EAAE,kBAAkB;;;EA4C7B;AAED,4FAA4F;AAC5F,wBAAgB,yBAAyB,CACvC,CAAC,EAAE,cAAc,EACjB,CAAC,EAAE,cAAc,cAqBlB;AAED,wBAAgB,qCAAqC,CACnD,oBAAoB,EAAE,MAAM,EAAE,OAEK,cAAc,KAAK,cAAc,gBAwBrE"}
@@ -0,0 +1,3 @@
1
+ import type { BlockchainMeta } from 'rango-sdk';
2
+ export declare const sampleBlockchains: BlockchainMeta[];
3
+ //# sourceMappingURL=usePrepareBlockchainList.mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrepareBlockchainList.mock.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIhD,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAwhG7C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=usePrepareBlockchainList.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrepareBlockchainList.test.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { BlockchainMeta } from 'rango-sdk';
2
+ export interface PrepareListOptions {
3
+ limit?: number;
4
+ selected?: string;
5
+ }
6
+ export interface PrepareListOutput {
7
+ list: BlockchainMeta[];
8
+ more: BlockchainMeta[];
9
+ history: string[];
10
+ }
11
+ //# sourceMappingURL=usePrepareBlockchainList.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePrepareBlockchainList.types.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,IAAI,EAAE,cAAc,EAAE,CAAC;IACvB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB"}