@lifi/widget 4.7.0 → 4.8.0

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 (144) hide show
  1. package/dist/esm/components/AmountInput/AmountInput.style.d.ts.map +1 -1
  2. package/dist/esm/components/Card/Card.d.ts.map +1 -1
  3. package/dist/esm/components/Card/CardIconButton.d.ts.map +1 -1
  4. package/dist/esm/components/ContractComponent/ItemPrice.d.ts.map +1 -1
  5. package/dist/esm/components/ListItem/ListItemButton.d.ts.map +1 -1
  6. package/dist/esm/components/ListItemButton.d.ts.map +1 -1
  7. package/dist/esm/components/Token/Token.d.ts.map +1 -1
  8. package/dist/esm/components/TokenList/types.d.ts.map +1 -1
  9. package/dist/esm/config/version.d.ts +1 -1
  10. package/dist/esm/config/version.js +1 -1
  11. package/dist/esm/config/version.js.map +1 -1
  12. package/dist/esm/hooks/useAvailableChains.d.ts.map +1 -1
  13. package/dist/esm/hooks/useAvailableChains.js +21 -38
  14. package/dist/esm/hooks/useAvailableChains.js.map +1 -1
  15. package/dist/esm/hooks/useExplorer.d.ts +1 -1
  16. package/dist/esm/hooks/useExplorer.d.ts.map +1 -1
  17. package/dist/esm/hooks/useExplorer.js +7 -3
  18. package/dist/esm/hooks/useExplorer.js.map +1 -1
  19. package/dist/esm/hooks/useFromTokenSufficiency.js +3 -3
  20. package/dist/esm/hooks/useFromTokenSufficiency.js.map +1 -1
  21. package/dist/esm/hooks/useGasRecommendation.js +3 -3
  22. package/dist/esm/hooks/useGasRecommendation.js.map +1 -1
  23. package/dist/esm/hooks/useGasSufficiency.js +3 -3
  24. package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
  25. package/dist/esm/hooks/useIsBatchingSupported.js +2 -2
  26. package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
  27. package/dist/esm/hooks/useRouteExecution.js +6 -6
  28. package/dist/esm/hooks/useRouteExecution.js.map +1 -1
  29. package/dist/esm/hooks/useRoutes.js +7 -7
  30. package/dist/esm/hooks/useRoutes.js.map +1 -1
  31. package/dist/esm/hooks/useTokenBalance.js +4 -4
  32. package/dist/esm/hooks/useTokenBalance.js.map +1 -1
  33. package/dist/esm/hooks/useTokenBalancesQueries.js +3 -3
  34. package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
  35. package/dist/esm/hooks/useTokenSearch.js +3 -3
  36. package/dist/esm/hooks/useTokenSearch.js.map +1 -1
  37. package/dist/esm/hooks/useTokens.js +14 -14
  38. package/dist/esm/hooks/useTokens.js.map +1 -1
  39. package/dist/esm/hooks/useTools.d.ts.map +1 -1
  40. package/dist/esm/hooks/useTools.js +26 -27
  41. package/dist/esm/hooks/useTools.js.map +1 -1
  42. package/dist/esm/hooks/useTransactionDetails.js +2 -2
  43. package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
  44. package/dist/esm/hooks/useTransactionHistory.js +3 -3
  45. package/dist/esm/hooks/useTransactionHistory.js.map +1 -1
  46. package/dist/esm/index.d.ts +5 -1
  47. package/dist/esm/index.js +3 -1
  48. package/dist/esm/pages/RoutesPage/RoutesPage.style.d.ts.map +1 -1
  49. package/dist/esm/pages/SendToWallet/BookmarksPage.js +2 -1
  50. package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
  51. package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js +2 -1
  52. package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
  53. package/dist/esm/pages/SendToWallet/RecentWalletsPage.js +2 -1
  54. package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
  55. package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js +2 -1
  56. package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
  57. package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +2 -1
  58. package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
  59. package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js +2 -1
  60. package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js.map +1 -1
  61. package/dist/esm/providers/I18nProvider/types.d.ts.map +1 -1
  62. package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
  63. package/dist/esm/providers/WidgetProvider/WidgetProvider.js +9 -1
  64. package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  65. package/dist/esm/providers/WidgetProvider/types.d.ts +2 -0
  66. package/dist/esm/providers/WidgetProvider/types.d.ts.map +1 -1
  67. package/dist/esm/queries/getChains.d.ts +38 -0
  68. package/dist/esm/queries/getChains.d.ts.map +1 -0
  69. package/dist/esm/queries/getChains.js +51 -0
  70. package/dist/esm/queries/getChains.js.map +1 -0
  71. package/dist/esm/queries/getTools.d.ts +26 -0
  72. package/dist/esm/queries/getTools.d.ts.map +1 -0
  73. package/dist/esm/queries/getTools.js +30 -0
  74. package/dist/esm/queries/getTools.js.map +1 -0
  75. package/dist/esm/queries/index.d.ts +4 -0
  76. package/dist/esm/queries/index.js +3 -0
  77. package/dist/esm/queries/types.d.ts +25 -0
  78. package/dist/esm/queries/types.d.ts.map +1 -0
  79. package/dist/esm/shared.d.ts +3 -1
  80. package/dist/esm/shared.js +3 -1
  81. package/dist/esm/stores/StoreProvider.d.ts.map +1 -1
  82. package/dist/esm/stores/StoreProvider.js +16 -17
  83. package/dist/esm/stores/StoreProvider.js.map +1 -1
  84. package/dist/esm/stores/header/useHeaderStore.d.ts +1 -1
  85. package/dist/esm/stores/header/useHeaderStore.d.ts.map +1 -1
  86. package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
  87. package/dist/esm/themes/createTheme.d.ts.map +1 -1
  88. package/dist/esm/types/events.d.ts.map +1 -1
  89. package/dist/esm/types/token.d.ts.map +1 -1
  90. package/dist/esm/types/widget.d.ts +30 -0
  91. package/dist/esm/types/widget.d.ts.map +1 -1
  92. package/dist/esm/types/widget.js.map +1 -1
  93. package/dist/esm/utils/queries.js.map +1 -1
  94. package/dist/esm/utils/scopeKeys.d.ts +6 -0
  95. package/dist/esm/utils/scopeKeys.d.ts.map +1 -0
  96. package/dist/esm/utils/scopeKeys.js +8 -0
  97. package/dist/esm/utils/scopeKeys.js.map +1 -0
  98. package/dist/esm/utils/url.d.ts +5 -0
  99. package/dist/esm/utils/url.d.ts.map +1 -0
  100. package/dist/esm/utils/url.js +17 -0
  101. package/dist/esm/utils/url.js.map +1 -0
  102. package/package.json +12 -4
  103. package/src/config/version.ts +1 -1
  104. package/src/hooks/useAvailableChains.test.tsx +170 -0
  105. package/src/hooks/useAvailableChains.ts +29 -47
  106. package/src/hooks/useExplorer.test.tsx +106 -0
  107. package/src/hooks/useExplorer.ts +11 -5
  108. package/src/hooks/useFromTokenSufficiency.ts +2 -2
  109. package/src/hooks/useGasRecommendation.ts +2 -2
  110. package/src/hooks/useGasSufficiency.ts +2 -2
  111. package/src/hooks/useIsBatchingSupported.ts +2 -2
  112. package/src/hooks/useRouteExecution.ts +5 -5
  113. package/src/hooks/useRoutes.ts +6 -6
  114. package/src/hooks/useTokenBalance.ts +4 -4
  115. package/src/hooks/useTokenBalancesQueries.ts +3 -3
  116. package/src/hooks/useTokenSearch.ts +7 -3
  117. package/src/hooks/useTokens.ts +13 -14
  118. package/src/hooks/useTools.sharedEntry.test.tsx +155 -0
  119. package/src/hooks/useTools.ts +42 -37
  120. package/src/hooks/useTransactionDetails.ts +3 -3
  121. package/src/hooks/useTransactionHistory.ts +2 -2
  122. package/src/index.ts +2 -1
  123. package/src/pages/SendToWallet/BookmarksPage.tsx +3 -3
  124. package/src/pages/SendToWallet/ConnectedWalletsPage.tsx +3 -3
  125. package/src/pages/SendToWallet/RecentWalletsPage.tsx +3 -3
  126. package/src/pages/SendToWallet/SendToConfiguredWalletPage.tsx +3 -3
  127. package/src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +5 -5
  128. package/src/pages/TransactionDetailsPage/TransferIdCard.tsx +2 -1
  129. package/src/providers/WidgetProvider/WidgetProvider.test.tsx +73 -0
  130. package/src/providers/WidgetProvider/WidgetProvider.tsx +13 -0
  131. package/src/providers/WidgetProvider/types.ts +2 -0
  132. package/src/queries/getChains.ts +93 -0
  133. package/src/queries/getTools.ts +62 -0
  134. package/src/queries/index.ts +30 -0
  135. package/src/queries/sharedCache.test.tsx +223 -0
  136. package/src/queries/types.ts +38 -0
  137. package/src/shared.ts +2 -0
  138. package/src/stores/StoreProvider.test.tsx +107 -0
  139. package/src/stores/StoreProvider.tsx +8 -6
  140. package/src/stores/header/useHeaderStore.tsx +3 -4
  141. package/src/types/widget.ts +30 -0
  142. package/src/utils/queries.ts +1 -0
  143. package/src/utils/scopeKeys.ts +18 -0
  144. package/src/utils/url.ts +17 -0
@@ -0,0 +1,51 @@
1
+ import { ChainType, getChains } from "@lifi/sdk";
2
+ //#region src/queries/getChains.ts
3
+ /** Every chain type the widget supports, in the order keys are built in. */
4
+ const supportedChainTypes = [
5
+ ChainType.EVM,
6
+ ChainType.SVM,
7
+ ChainType.UTXO,
8
+ ChainType.MVM,
9
+ ChainType.TVM,
10
+ ChainType.STL
11
+ ];
12
+ const rank = (type) => {
13
+ const index = supportedChainTypes.indexOf(type);
14
+ return index === -1 ? supportedChainTypes.length : index;
15
+ };
16
+ /** The key alone — to read, set or invalidate the entry. */
17
+ function getChainsQueryKey(parameters) {
18
+ const chainTypes = [...new Set(parameters.chainTypes)].sort((a, b) => rank(a) - rank(b) || a.localeCompare(b));
19
+ return ["chains", {
20
+ apiUrl: parameters.apiUrl,
21
+ chainTypes,
22
+ ...parameters.scopeKey === void 0 ? {} : { scopeKey: parameters.scopeKey }
23
+ }];
24
+ }
25
+ /**
26
+ * Query options for the chain list of one API base.
27
+ *
28
+ * The key is `['chains', { apiUrl, chainTypes, scopeKey }]`: the API base and
29
+ * the requested types decide the response, the scope isolates integrations.
30
+ * The widget and a host app that build their options here, with the same
31
+ * scope, therefore share one cache entry and one request.
32
+ *
33
+ * The query has no side effects. A caller that needs the chains in its SDK
34
+ * client's storage calls `client.setChains` on the data — the entry may have
35
+ * been filled by another caller, so a `queryFn` cannot be relied on to run.
36
+ */
37
+ function getChainsQueryOptions(client, options = {}) {
38
+ return {
39
+ ...options.query,
40
+ queryKey: getChainsQueryKey({
41
+ apiUrl: client.config.apiUrl,
42
+ chainTypes: options.chainTypes ?? supportedChainTypes,
43
+ scopeKey: options.scopeKey
44
+ }),
45
+ queryFn: ({ queryKey: [, { chainTypes }] }) => getChains(client, { chainTypes })
46
+ };
47
+ }
48
+ //#endregion
49
+ export { getChainsQueryKey, getChainsQueryOptions, supportedChainTypes };
50
+
51
+ //# sourceMappingURL=getChains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getChains.js","names":[],"sources":["../../../src/queries/getChains.ts"],"sourcesContent":["import type { ExtendedChain, SDKClient } from '@lifi/sdk'\nimport { ChainType, getChains } from '@lifi/sdk'\nimport type {\n FactoryQueryOptions,\n QueryParameter,\n ScopeKeyParameter,\n} from './types.js'\n\n/** Every chain type the widget supports, in the order keys are built in. */\nexport const supportedChainTypes: readonly ChainType[] = [\n ChainType.EVM,\n ChainType.SVM,\n ChainType.UTXO,\n ChainType.MVM,\n ChainType.TVM,\n ChainType.STL,\n]\n\nexport type GetChainsQueryFnData = ExtendedChain[]\n\nexport type GetChainsQueryKeyParameters = {\n /** API base the client talks to. Different bases return different chains. */\n apiUrl: string\n chainTypes: readonly ChainType[]\n} & ScopeKeyParameter\n\nexport type GetChainsQueryKey = readonly [\n 'chains',\n { apiUrl: string; chainTypes: ChainType[]; scopeKey?: string },\n]\n\nconst rank = (type: ChainType): number => {\n const index = supportedChainTypes.indexOf(type)\n return index === -1 ? supportedChainTypes.length : index\n}\n\n/** The key alone — to read, set or invalidate the entry. */\nexport function getChainsQueryKey(\n parameters: GetChainsQueryKeyParameters\n): GetChainsQueryKey {\n // Array order is part of the query hash, so sort into one canonical order.\n const chainTypes = [...new Set(parameters.chainTypes)].sort(\n (a, b) => rank(a) - rank(b) || a.localeCompare(b)\n )\n return [\n 'chains',\n {\n apiUrl: parameters.apiUrl,\n chainTypes,\n ...(parameters.scopeKey === undefined\n ? {}\n : { scopeKey: parameters.scopeKey }),\n },\n ]\n}\n\nexport type GetChainsOptions<selectData = GetChainsQueryFnData> = {\n /** Chain types to request, in any order. Defaults to every supported type. */\n chainTypes?: readonly ChainType[] | undefined\n} & ScopeKeyParameter &\n QueryParameter<GetChainsQueryFnData, selectData, GetChainsQueryKey>\n\nexport type GetChainsQueryOptions<selectData = GetChainsQueryFnData> =\n FactoryQueryOptions<GetChainsQueryFnData, selectData, GetChainsQueryKey>\n\n/**\n * Query options for the chain list of one API base.\n *\n * The key is `['chains', { apiUrl, chainTypes, scopeKey }]`: the API base and\n * the requested types decide the response, the scope isolates integrations.\n * The widget and a host app that build their options here, with the same\n * scope, therefore share one cache entry and one request.\n *\n * The query has no side effects. A caller that needs the chains in its SDK\n * client's storage calls `client.setChains` on the data — the entry may have\n * been filled by another caller, so a `queryFn` cannot be relied on to run.\n */\nexport function getChainsQueryOptions<selectData = GetChainsQueryFnData>(\n client: SDKClient,\n options: GetChainsOptions<selectData> = {}\n): GetChainsQueryOptions<selectData> {\n return {\n ...options.query,\n queryKey: getChainsQueryKey({\n apiUrl: client.config.apiUrl,\n chainTypes: options.chainTypes ?? supportedChainTypes,\n scopeKey: options.scopeKey,\n }),\n // No signal: the data still fills the cache if all observers leave.\n queryFn: ({ queryKey: [, { chainTypes }] }) =>\n getChains(client, { chainTypes }),\n }\n}\n"],"mappings":";;;AASA,MAAa,sBAA4C;CACvD,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;AACZ;AAeA,MAAM,QAAQ,SAA4B;CACxC,MAAM,QAAQ,oBAAoB,QAAQ,IAAI;CAC9C,OAAO,UAAU,KAAK,oBAAoB,SAAS;AACrD;;AAGA,SAAgB,kBACd,YACmB;CAEnB,MAAM,aAAa,CAAC,GAAG,IAAI,IAAI,WAAW,UAAU,CAAC,CAAC,CAAC,MACpD,GAAG,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,CAClD;CACA,OAAO,CACL,UACA;EACE,QAAQ,WAAW;EACnB;EACA,GAAI,WAAW,aAAa,KAAA,IACxB,CAAC,IACD,EAAE,UAAU,WAAW,SAAS;CACtC,CACF;AACF;;;;;;;;;;;;;AAuBA,SAAgB,sBACd,QACA,UAAwC,CAAC,GACN;CACnC,OAAO;EACL,GAAG,QAAQ;EACX,UAAU,kBAAkB;GAC1B,QAAQ,OAAO,OAAO;GACtB,YAAY,QAAQ,cAAc;GAClC,UAAU,QAAQ;EACpB,CAAC;EAED,UAAU,EAAE,UAAU,GAAG,EAAE,oBACzB,UAAU,QAAQ,EAAE,WAAW,CAAC;CACpC;AACF"}
@@ -0,0 +1,26 @@
1
+ import { FactoryQueryOptions, QueryParameter, ScopeKeyParameter } from "./types.js";
2
+ import { SDKClient, ToolsResponse } from "@lifi/sdk";
3
+ //#region src/queries/getTools.d.ts
4
+ export type GetToolsQueryFnData = ToolsResponse;
5
+ export type GetToolsQueryKeyParameters = {
6
+ /** API base the client talks to. Different bases return different tools. */
7
+ apiUrl: string;
8
+ } & ScopeKeyParameter;
9
+ export type GetToolsQueryKey = readonly ["tools", {
10
+ apiUrl: string;
11
+ scopeKey?: string;
12
+ }];
13
+ /** The key alone — to read, set or invalidate the entry. */
14
+ export declare function getToolsQueryKey(parameters: GetToolsQueryKeyParameters): GetToolsQueryKey;
15
+ export type GetToolsOptions<selectData = GetToolsQueryFnData> = ScopeKeyParameter & QueryParameter<GetToolsQueryFnData, selectData, GetToolsQueryKey>;
16
+ export type GetToolsQueryOptions<selectData = GetToolsQueryFnData> = FactoryQueryOptions<GetToolsQueryFnData, selectData, GetToolsQueryKey>;
17
+ /**
18
+ * Query options for the bridges and exchanges of one API base.
19
+ *
20
+ * The key is `['tools', { apiUrl, scopeKey }]`. The cache holds the raw,
21
+ * unfiltered response so every caller can share it; narrow it per caller with
22
+ * `query.select`, never in the `queryFn`.
23
+ */
24
+ export declare function getToolsQueryOptions<selectData = GetToolsQueryFnData>(client: SDKClient, options?: GetToolsOptions<selectData>): GetToolsQueryOptions<selectData>;
25
+ //#endregion
26
+ //# sourceMappingURL=getTools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTools.d.ts","names":[],"sources":["../../../src/queries/getTools.ts"],"mappings":";;;YAQY,sBAAsB;YAEtB;;EAEV;IACE;YAEQ;EAER;EAAgB;;;wBAIJ,iBACd,YAAY,6BACX;YAYS,gBAAgB,aAAa,uBACvC,oBACE,eAAe,qBAAqB,YAAY;YAExC,qBAAqB,aAAa,uBAC5C,oBAAoB,qBAAqB,YAAY;;;;;;;;wBASvC,qBAAqB,aAAa,qBAChD,QAAQ,WACR,UAAS,gBAAgB,cACxB,qBAAqB"}
@@ -0,0 +1,30 @@
1
+ import { getTools } from "@lifi/sdk";
2
+ //#region src/queries/getTools.ts
3
+ /** The key alone — to read, set or invalidate the entry. */
4
+ function getToolsQueryKey(parameters) {
5
+ return ["tools", {
6
+ apiUrl: parameters.apiUrl,
7
+ ...parameters.scopeKey === void 0 ? {} : { scopeKey: parameters.scopeKey }
8
+ }];
9
+ }
10
+ /**
11
+ * Query options for the bridges and exchanges of one API base.
12
+ *
13
+ * The key is `['tools', { apiUrl, scopeKey }]`. The cache holds the raw,
14
+ * unfiltered response so every caller can share it; narrow it per caller with
15
+ * `query.select`, never in the `queryFn`.
16
+ */
17
+ function getToolsQueryOptions(client, options = {}) {
18
+ return {
19
+ ...options.query,
20
+ queryKey: getToolsQueryKey({
21
+ apiUrl: client.config.apiUrl,
22
+ scopeKey: options.scopeKey
23
+ }),
24
+ queryFn: ({ signal }) => getTools(client, void 0, { signal })
25
+ };
26
+ }
27
+ //#endregion
28
+ export { getToolsQueryKey, getToolsQueryOptions };
29
+
30
+ //# sourceMappingURL=getTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTools.js","names":[],"sources":["../../../src/queries/getTools.ts"],"sourcesContent":["import type { SDKClient, ToolsResponse } from '@lifi/sdk'\nimport { getTools } from '@lifi/sdk'\nimport type {\n FactoryQueryOptions,\n QueryParameter,\n ScopeKeyParameter,\n} from './types.js'\n\nexport type GetToolsQueryFnData = ToolsResponse\n\nexport type GetToolsQueryKeyParameters = {\n /** API base the client talks to. Different bases return different tools. */\n apiUrl: string\n} & ScopeKeyParameter\n\nexport type GetToolsQueryKey = readonly [\n 'tools',\n { apiUrl: string; scopeKey?: string },\n]\n\n/** The key alone — to read, set or invalidate the entry. */\nexport function getToolsQueryKey(\n parameters: GetToolsQueryKeyParameters\n): GetToolsQueryKey {\n return [\n 'tools',\n {\n apiUrl: parameters.apiUrl,\n ...(parameters.scopeKey === undefined\n ? {}\n : { scopeKey: parameters.scopeKey }),\n },\n ]\n}\n\nexport type GetToolsOptions<selectData = GetToolsQueryFnData> =\n ScopeKeyParameter &\n QueryParameter<GetToolsQueryFnData, selectData, GetToolsQueryKey>\n\nexport type GetToolsQueryOptions<selectData = GetToolsQueryFnData> =\n FactoryQueryOptions<GetToolsQueryFnData, selectData, GetToolsQueryKey>\n\n/**\n * Query options for the bridges and exchanges of one API base.\n *\n * The key is `['tools', { apiUrl, scopeKey }]`. The cache holds the raw,\n * unfiltered response so every caller can share it; narrow it per caller with\n * `query.select`, never in the `queryFn`.\n */\nexport function getToolsQueryOptions<selectData = GetToolsQueryFnData>(\n client: SDKClient,\n options: GetToolsOptions<selectData> = {}\n): GetToolsQueryOptions<selectData> {\n return {\n ...options.query,\n queryKey: getToolsQueryKey({\n apiUrl: client.config.apiUrl,\n scopeKey: options.scopeKey,\n }),\n queryFn: ({ signal }) => getTools(client, undefined, { signal }),\n }\n}\n"],"mappings":";;;AAqBA,SAAgB,iBACd,YACkB;CAClB,OAAO,CACL,SACA;EACE,QAAQ,WAAW;EACnB,GAAI,WAAW,aAAa,KAAA,IACxB,CAAC,IACD,EAAE,UAAU,WAAW,SAAS;CACtC,CACF;AACF;;;;;;;;AAgBA,SAAgB,qBACd,QACA,UAAuC,CAAC,GACN;CAClC,OAAO;EACL,GAAG,QAAQ;EACX,UAAU,iBAAiB;GACzB,QAAQ,OAAO,OAAO;GACtB,UAAU,QAAQ;EACpB,CAAC;EACD,UAAU,EAAE,aAAa,SAAS,QAAQ,KAAA,GAAW,EAAE,OAAO,CAAC;CACjE;AACF"}
@@ -0,0 +1,4 @@
1
+ import { QueryParameter, ScopeKeyParameter } from "./types.js";
2
+ import { GetChainsOptions, GetChainsQueryFnData, GetChainsQueryKey, GetChainsQueryKeyParameters, GetChainsQueryOptions, getChainsQueryKey, getChainsQueryOptions, supportedChainTypes } from "./getChains.js";
3
+ import { GetToolsOptions, GetToolsQueryFnData, GetToolsQueryKey, GetToolsQueryKeyParameters, GetToolsQueryOptions, getToolsQueryKey, getToolsQueryOptions } from "./getTools.js";
4
+ export { type GetChainsOptions, type GetChainsQueryFnData, type GetChainsQueryKey, type GetChainsQueryKeyParameters, type GetChainsQueryOptions, type GetToolsOptions, type GetToolsQueryFnData, type GetToolsQueryKey, type GetToolsQueryKeyParameters, type GetToolsQueryOptions, type QueryParameter, type ScopeKeyParameter, getChainsQueryKey, getChainsQueryOptions, getToolsQueryKey, getToolsQueryOptions, supportedChainTypes };
@@ -0,0 +1,3 @@
1
+ import { getChainsQueryKey, getChainsQueryOptions, supportedChainTypes } from "./getChains.js";
2
+ import { getToolsQueryKey, getToolsQueryOptions } from "./getTools.js";
3
+ export { getChainsQueryKey, getChainsQueryOptions, getToolsQueryKey, getToolsQueryOptions, supportedChainTypes };
@@ -0,0 +1,25 @@
1
+ import { QueryFunction, QueryKey, UseQueryOptions } from "@tanstack/react-query";
2
+ //#region src/queries/types.d.ts
3
+ export type ScopeKeyParameter = {
4
+ /**
5
+ * Scopes the entry inside a shared `QueryClient`, like wagmi's `scopeKey`.
6
+ * Callers that pass the same value share the cached data; a widget passes
7
+ * its `queryScopeKey`.
8
+ */
9
+ scopeKey?: string | undefined;
10
+ };
11
+ /**
12
+ * Behaviour the caller owns — `staleTime`, `refetchInterval`, `select`,
13
+ * `enabled`, … It is spread into the options and never becomes part of the
14
+ * key, so callers with different behaviour still share one entry.
15
+ */
16
+ export type QueryParameter<queryFnData, data, queryKey extends QueryKey> = {
17
+ query?: Omit<UseQueryOptions<queryFnData, Error, data, queryKey>, "queryKey" | "queryFn"> | undefined;
18
+ };
19
+ /** Options ready for `useQuery`, `fetchQuery` or `prefetchQuery`. */
20
+ export type FactoryQueryOptions<queryFnData, data, queryKey extends QueryKey> = UseQueryOptions<queryFnData, Error, data, queryKey> & {
21
+ queryKey: queryKey;
22
+ queryFn: QueryFunction<queryFnData, queryKey>;
23
+ };
24
+ //#endregion
25
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/queries/types.ts"],"mappings":";;YAMY;;;;;;EAMV;;;;;;;YAQU,eAAe,aAAa,MAAM,iBAAiB;EAC7D,QACI,KACE,gBAAgB,aAAa,OAAO,MAAM;;;YAOtC,oBACV,aACA,MACA,iBAAiB,YACf,gBAAgB,aAAa,OAAO,MAAM;EAC5C,UAAU;EACV,SAAS,cAAc,aAAa"}
@@ -103,5 +103,7 @@ import { buildRouteFromTxHistory } from "./utils/converters.js";
103
103
  import { ElementId, createElementId } from "./utils/elements.js";
104
104
  import { hasEnumFlag } from "./utils/enum.js";
105
105
  import { fitInputText } from "./utils/input.js";
106
+ import { resolveStorageScopeKey } from "./utils/scopeKeys.js";
107
+ import { isHttpUrl, openInNewTab } from "./utils/url.js";
106
108
  import { shortenAddress } from "./utils/wallet.js";
107
- export { ActionRow, AddressType, AmountInputEndAdornment, AvatarBadgedDefault, BaseTransactionButton, BookmarkStoreProvider, type BottomSheetBase, ButtonTertiary, Card, CardIconButton, CardTitle, ChainAvatar, ChainSelect, ConfirmToAddressSheet, ContactSupportButton, ContractComponent, DateLabelContainer, DateLabelText, DetailInfoIcon, DetailLabel, DetailLabelContainer, DetailRow, DetailValue, ElementId, ExchangeRateBottomSheet, type ExchangeRateBottomSheetBase, ExecutionDoneCard, type ExecutionRow, ExecutionStatusCard, ExternalLink, FeeBreakdownTooltip, FormControl, FormKeyHelper, type FormRef, type FormType, type FormTypeProps, I18nProvider, IconCircle, IconTypography, Input, InputCard, InputPriceButton, ListItemButton, MainWarningMessages, PageContainer, PoweredBy, ProgressToNextUpdate, QueryClientProvider, RouteCard, RouteCardSkeleton, RouteDetails, RouteExecutionStatus, RouteNotFoundCard, RouteTokens, RouteTracker, SDKClientProvider, SearchInput, SearchTokenInput, SelectChainPage, SendToWalletButton, SentToWalletRow, SettingsStoreProvider, Stack, StartTransactionButton, StatusIcon, StepActionsList, StoreProvider, Token, TokenAvatar, TokenNotFound, TokenRate, TokenValueBottomSheet, TransactionDoneButtons, VirtualizedTokenList, WalletProvider, WarningMessages, type WidgetConfig, WidgetEvent, WidgetProvider, type WidgetTheme, buildRouteFromTxHistory, calculateValueLossPercentage, createElementId, createTheme, fitInputText, formatDuration, formatInputAmount, formatTokenAmount, formatTokenPrice, getAccumulatedFeeCostsBreakdown, getPriceImpact, getSourceTxHash, getTokenValueLossThreshold, hasEnumFlag, isRouteActive, isRouteDone, isRouteFailed, navigationRoutes, priceToTokenAmount, shortenAddress, usdDecimals, useAddressActivity, useAddressValidation, useAvailableChains, useChain, useChainOrderStore, useContactSupport, useDebouncedWatch, useExecutionRows, useExplorer, useFieldActions, useFieldValues, useHeader, useHeaderStore, useInputModeStore, useListHeight, useNavigateBack, useRouteExecution, useRouteExecutionMessage, useRouteExecutionStore, useRouteExecutionStoreContext, useRoutes, useSDKClient, useSetHeaderHeight, useSettingsStoreContext, useToAddressRequirements, useToken, useTokenAddressBalance, useTokenBalances, useTokenList, useTokenSelect, useTools, useWidgetConfig, useWidgetEvents };
109
+ export { ActionRow, AddressType, AmountInputEndAdornment, AvatarBadgedDefault, BaseTransactionButton, BookmarkStoreProvider, type BottomSheetBase, ButtonTertiary, Card, CardIconButton, CardTitle, ChainAvatar, ChainSelect, ConfirmToAddressSheet, ContactSupportButton, ContractComponent, DateLabelContainer, DateLabelText, DetailInfoIcon, DetailLabel, DetailLabelContainer, DetailRow, DetailValue, ElementId, ExchangeRateBottomSheet, type ExchangeRateBottomSheetBase, ExecutionDoneCard, type ExecutionRow, ExecutionStatusCard, ExternalLink, FeeBreakdownTooltip, FormControl, FormKeyHelper, type FormRef, type FormType, type FormTypeProps, I18nProvider, IconCircle, IconTypography, Input, InputCard, InputPriceButton, ListItemButton, MainWarningMessages, PageContainer, PoweredBy, ProgressToNextUpdate, QueryClientProvider, RouteCard, RouteCardSkeleton, RouteDetails, RouteExecutionStatus, RouteNotFoundCard, RouteTokens, RouteTracker, SDKClientProvider, SearchInput, SearchTokenInput, SelectChainPage, SendToWalletButton, SentToWalletRow, SettingsStoreProvider, Stack, StartTransactionButton, StatusIcon, StepActionsList, StoreProvider, Token, TokenAvatar, TokenNotFound, TokenRate, TokenValueBottomSheet, TransactionDoneButtons, VirtualizedTokenList, WalletProvider, WarningMessages, type WidgetConfig, WidgetEvent, WidgetProvider, type WidgetTheme, buildRouteFromTxHistory, calculateValueLossPercentage, createElementId, createTheme, fitInputText, formatDuration, formatInputAmount, formatTokenAmount, formatTokenPrice, getAccumulatedFeeCostsBreakdown, getPriceImpact, getSourceTxHash, getTokenValueLossThreshold, hasEnumFlag, isHttpUrl, isRouteActive, isRouteDone, isRouteFailed, navigationRoutes, openInNewTab, priceToTokenAmount, resolveStorageScopeKey, shortenAddress, usdDecimals, useAddressActivity, useAddressValidation, useAvailableChains, useChain, useChainOrderStore, useContactSupport, useDebouncedWatch, useExecutionRows, useExplorer, useFieldActions, useFieldValues, useHeader, useHeaderStore, useInputModeStore, useListHeight, useNavigateBack, useRouteExecution, useRouteExecutionMessage, useRouteExecutionStore, useRouteExecutionStoreContext, useRoutes, useSDKClient, useSetHeaderHeight, useSettingsStoreContext, useToAddressRequirements, useToken, useTokenAddressBalance, useTokenBalances, useTokenList, useTokenSelect, useTools, useWidgetConfig, useWidgetEvents };
@@ -1,6 +1,7 @@
1
1
  import { useWidgetEvents } from "./hooks/useWidgetEvents.js";
2
2
  import { WidgetEvent } from "./types/events.js";
3
3
  import { SettingsStoreProvider, useSettingsStoreContext } from "./stores/settings/SettingsStore.js";
4
+ import { resolveStorageScopeKey } from "./utils/scopeKeys.js";
4
5
  import { WidgetProvider, useWidgetConfig } from "./providers/WidgetProvider/WidgetProvider.js";
5
6
  import { useHeaderStore, useSetHeaderHeight } from "./stores/header/useHeaderStore.js";
6
7
  import { ElementId, createElementId } from "./utils/elements.js";
@@ -44,6 +45,7 @@ import { RouteNotFoundCard } from "./components/RouteCard/RouteNotFoundCard.js";
44
45
  import { useNavigateBack } from "./hooks/useNavigateBack.js";
45
46
  import { useTools } from "./hooks/useTools.js";
46
47
  import { shortenAddress } from "./utils/wallet.js";
48
+ import { isHttpUrl, openInNewTab } from "./utils/url.js";
47
49
  import { useExplorer } from "./hooks/useExplorer.js";
48
50
  import { AddressType, useAddressValidation } from "./hooks/useAddressValidation.js";
49
51
  import { useHeader } from "./hooks/useHeader.js";
@@ -102,4 +104,4 @@ import { createTheme } from "./themes/createTheme.js";
102
104
  import { WalletProvider } from "./providers/WalletProvider/WalletProvider.js";
103
105
  import { StoreProvider } from "./stores/StoreProvider.js";
104
106
  import { useTokenList } from "./hooks/useTokenList.js";
105
- export { ActionRow, AddressType, AmountInputEndAdornment, AvatarBadgedDefault, BaseTransactionButton, BookmarkStoreProvider, ButtonTertiary, Card, CardIconButton, CardTitle, ChainAvatar, ChainSelect, ConfirmToAddressSheet, ContactSupportButton, ContractComponent, DateLabelContainer, DateLabelText, DetailInfoIcon, DetailLabel, DetailLabelContainer, DetailRow, DetailValue, ElementId, ExchangeRateBottomSheet, ExecutionDoneCard, ExecutionStatusCard, ExternalLink, FeeBreakdownTooltip, FormControl, FormKeyHelper, I18nProvider, IconCircle, IconTypography, Input, InputCard, InputPriceButton, ListItemButton, MainWarningMessages, PageContainer, PoweredBy, ProgressToNextUpdate, QueryClientProvider, RouteCard, RouteCardSkeleton, RouteDetails, RouteExecutionStatus, RouteNotFoundCard, RouteTokens, RouteTracker, SDKClientProvider, SearchInput, SearchTokenInput, SelectChainPage, SendToWalletButton, SentToWalletRow, SettingsStoreProvider, Stack, StartTransactionButton, StatusIcon, StepActionsList, StoreProvider, Token, TokenAvatar, TokenNotFound, TokenRate, TokenValueBottomSheet, TransactionDoneButtons, VirtualizedTokenList, WalletProvider, WarningMessages, WidgetEvent, WidgetProvider, buildRouteFromTxHistory, calculateValueLossPercentage, createElementId, createTheme, fitInputText, formatDuration, formatInputAmount, formatTokenAmount, formatTokenPrice, getAccumulatedFeeCostsBreakdown, getPriceImpact, getSourceTxHash, getTokenValueLossThreshold, hasEnumFlag, isRouteActive, isRouteDone, isRouteFailed, navigationRoutes, priceToTokenAmount, shortenAddress, usdDecimals, useAddressActivity, useAddressValidation, useAvailableChains, useChain, useChainOrderStore, useContactSupport, useDebouncedWatch, useExecutionRows, useExplorer, useFieldActions, useFieldValues, useHeader, useHeaderStore, useInputModeStore, useListHeight, useNavigateBack, useRouteExecution, useRouteExecutionMessage, useRouteExecutionStore, useRouteExecutionStoreContext, useRoutes, useSDKClient, useSetHeaderHeight, useSettingsStoreContext, useToAddressRequirements, useToken, useTokenAddressBalance, useTokenBalances, useTokenList, useTokenSelect, useTools, useWidgetConfig, useWidgetEvents };
107
+ export { ActionRow, AddressType, AmountInputEndAdornment, AvatarBadgedDefault, BaseTransactionButton, BookmarkStoreProvider, ButtonTertiary, Card, CardIconButton, CardTitle, ChainAvatar, ChainSelect, ConfirmToAddressSheet, ContactSupportButton, ContractComponent, DateLabelContainer, DateLabelText, DetailInfoIcon, DetailLabel, DetailLabelContainer, DetailRow, DetailValue, ElementId, ExchangeRateBottomSheet, ExecutionDoneCard, ExecutionStatusCard, ExternalLink, FeeBreakdownTooltip, FormControl, FormKeyHelper, I18nProvider, IconCircle, IconTypography, Input, InputCard, InputPriceButton, ListItemButton, MainWarningMessages, PageContainer, PoweredBy, ProgressToNextUpdate, QueryClientProvider, RouteCard, RouteCardSkeleton, RouteDetails, RouteExecutionStatus, RouteNotFoundCard, RouteTokens, RouteTracker, SDKClientProvider, SearchInput, SearchTokenInput, SelectChainPage, SendToWalletButton, SentToWalletRow, SettingsStoreProvider, Stack, StartTransactionButton, StatusIcon, StepActionsList, StoreProvider, Token, TokenAvatar, TokenNotFound, TokenRate, TokenValueBottomSheet, TransactionDoneButtons, VirtualizedTokenList, WalletProvider, WarningMessages, WidgetEvent, WidgetProvider, buildRouteFromTxHistory, calculateValueLossPercentage, createElementId, createTheme, fitInputText, formatDuration, formatInputAmount, formatTokenAmount, formatTokenPrice, getAccumulatedFeeCostsBreakdown, getPriceImpact, getSourceTxHash, getTokenValueLossThreshold, hasEnumFlag, isHttpUrl, isRouteActive, isRouteDone, isRouteFailed, navigationRoutes, openInNewTab, priceToTokenAmount, resolveStorageScopeKey, shortenAddress, usdDecimals, useAddressActivity, useAddressValidation, useAvailableChains, useChain, useChainOrderStore, useContactSupport, useDebouncedWatch, useExecutionRows, useExplorer, useFieldActions, useFieldValues, useHeader, useHeaderStore, useInputModeStore, useListHeight, useNavigateBack, useRouteExecution, useRouteExecutionMessage, useRouteExecutionStore, useRouteExecutionStoreContext, useRoutes, useSDKClient, useSetHeaderHeight, useSettingsStoreContext, useToAddressRequirements, useToken, useTokenAddressBalance, useTokenBalances, useTokenList, useTokenSelect, useTools, useWidgetConfig, useWidgetEvents };
@@ -1 +1 @@
1
- {"version":3,"file":"StoreProvider.d.ts","names":[],"sources":["../../../src/stores/StoreProvider.tsx"],"mappings":";;;qBAWa,eAAe,MAAM,GAAG,kBAAkB"}
1
+ {"version":3,"file":"StoreProvider.d.ts","names":[],"sources":["../../../src/stores/StoreProvider.tsx"],"mappings":";;;qBAYa,eAAe,MAAM,GAAG,kBAAkB"}
@@ -1,3 +1,4 @@
1
+ import { resolveStorageScopeKey } from "../utils/scopeKeys.js";
1
2
  import { HeaderStoreProvider } from "./header/useHeaderStore.js";
2
3
  import { NavigationTabsStoreProvider } from "./navigationTabs/useNavigationTabsStore.js";
3
4
  import { BookmarkStoreProvider } from "./bookmarks/BookmarkStore.js";
@@ -9,30 +10,28 @@ import { FormStoreProvider } from "./form/FormStore.js";
9
10
  import { jsx } from "react/jsx-runtime";
10
11
  //#region src/stores/StoreProvider.tsx
11
12
  const StoreProvider = ({ children, config, formRef }) => {
13
+ const storageScopeKey = resolveStorageScopeKey(config);
12
14
  return /* @__PURE__ */ jsx(NavigationTabsStoreProvider, {
13
15
  config,
14
- children: /* @__PURE__ */ jsx(HeaderStoreProvider, {
15
- namePrefix: config?.keyPrefix,
16
- children: /* @__PURE__ */ jsx(BookmarkStoreProvider, {
17
- namePrefix: config?.keyPrefix,
18
- children: /* @__PURE__ */ jsx(PinnedTokensStoreProvider, {
19
- namePrefix: config?.keyPrefix,
20
- children: /* @__PURE__ */ jsx(RecentTokensStoreProvider, {
21
- namePrefix: config?.keyPrefix,
22
- children: /* @__PURE__ */ jsx(FormStoreProvider, {
23
- formRef,
24
- children: /* @__PURE__ */ jsx(ChainOrderStoreProvider, {
25
- namePrefix: config?.keyPrefix,
26
- children: /* @__PURE__ */ jsx(RouteExecutionStoreProvider, {
27
- namePrefix: config?.keyPrefix,
28
- children
29
- })
16
+ children: /* @__PURE__ */ jsx(HeaderStoreProvider, { children: /* @__PURE__ */ jsx(BookmarkStoreProvider, {
17
+ namePrefix: storageScopeKey,
18
+ children: /* @__PURE__ */ jsx(PinnedTokensStoreProvider, {
19
+ namePrefix: storageScopeKey,
20
+ children: /* @__PURE__ */ jsx(RecentTokensStoreProvider, {
21
+ namePrefix: storageScopeKey,
22
+ children: /* @__PURE__ */ jsx(FormStoreProvider, {
23
+ formRef,
24
+ children: /* @__PURE__ */ jsx(ChainOrderStoreProvider, {
25
+ namePrefix: storageScopeKey,
26
+ children: /* @__PURE__ */ jsx(RouteExecutionStoreProvider, {
27
+ namePrefix: storageScopeKey,
28
+ children
30
29
  })
31
30
  })
32
31
  })
33
32
  })
34
33
  })
35
- })
34
+ }) })
36
35
  });
37
36
  };
38
37
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"StoreProvider.js","names":[],"sources":["../../../src/stores/StoreProvider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport type { WidgetConfigProps } from '../types/widget.js'\nimport { BookmarkStoreProvider } from './bookmarks/BookmarkStore.js'\nimport { ChainOrderStoreProvider } from './chains/ChainOrderStore.js'\nimport { FormStoreProvider } from './form/FormStore.js'\nimport { HeaderStoreProvider } from './header/useHeaderStore.js'\nimport { NavigationTabsStoreProvider } from './navigationTabs/useNavigationTabsStore.js'\nimport { PinnedTokensStoreProvider } from './pinnedTokens/PinnedTokensStore.js'\nimport { RecentTokensStoreProvider } from './recentTokens/RecentTokensStore.js'\nimport { RouteExecutionStoreProvider } from './routes/RouteExecutionStore.js'\n\nexport const StoreProvider: React.FC<PropsWithChildren<WidgetConfigProps>> = ({\n children,\n config,\n formRef,\n}) => {\n return (\n <NavigationTabsStoreProvider config={config}>\n <HeaderStoreProvider namePrefix={config?.keyPrefix}>\n <BookmarkStoreProvider namePrefix={config?.keyPrefix}>\n <PinnedTokensStoreProvider namePrefix={config?.keyPrefix}>\n <RecentTokensStoreProvider namePrefix={config?.keyPrefix}>\n <FormStoreProvider formRef={formRef}>\n <ChainOrderStoreProvider namePrefix={config?.keyPrefix}>\n <RouteExecutionStoreProvider namePrefix={config?.keyPrefix}>\n {children}\n </RouteExecutionStoreProvider>\n </ChainOrderStoreProvider>\n </FormStoreProvider>\n </RecentTokensStoreProvider>\n </PinnedTokensStoreProvider>\n </BookmarkStoreProvider>\n </HeaderStoreProvider>\n </NavigationTabsStoreProvider>\n )\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAa,iBAAiE,EAC5E,UACA,QACA,cACI;CACJ,OACE,oBAAC,6BAAD;EAAqC;EACnC,UAAA,oBAAC,qBAAD;GAAqB,YAAY,QAAQ;GACvC,UAAA,oBAAC,uBAAD;IAAuB,YAAY,QAAQ;IACzC,UAAA,oBAAC,2BAAD;KAA2B,YAAY,QAAQ;KAC7C,UAAA,oBAAC,2BAAD;MAA2B,YAAY,QAAQ;MAC7C,UAAA,oBAAC,mBAAD;OAA4B;OAC1B,UAAA,oBAAC,yBAAD;QAAyB,YAAY,QAAQ;QAC3C,UAAA,oBAAC,6BAAD;SAA6B,YAAY,QAAQ;SAC9C;QAC0B,CAAA;OACN,CAAA;MACR,CAAA;KACM,CAAA;IACF,CAAA;GACN,CAAA;EACJ,CAAA;CACM,CAAA;AAEjC"}
1
+ {"version":3,"file":"StoreProvider.js","names":[],"sources":["../../../src/stores/StoreProvider.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport type { WidgetConfigProps } from '../types/widget.js'\nimport { resolveStorageScopeKey } from '../utils/scopeKeys.js'\nimport { BookmarkStoreProvider } from './bookmarks/BookmarkStore.js'\nimport { ChainOrderStoreProvider } from './chains/ChainOrderStore.js'\nimport { FormStoreProvider } from './form/FormStore.js'\nimport { HeaderStoreProvider } from './header/useHeaderStore.js'\nimport { NavigationTabsStoreProvider } from './navigationTabs/useNavigationTabsStore.js'\nimport { PinnedTokensStoreProvider } from './pinnedTokens/PinnedTokensStore.js'\nimport { RecentTokensStoreProvider } from './recentTokens/RecentTokensStore.js'\nimport { RouteExecutionStoreProvider } from './routes/RouteExecutionStore.js'\n\nexport const StoreProvider: React.FC<PropsWithChildren<WidgetConfigProps>> = ({\n children,\n config,\n formRef,\n}) => {\n const storageScopeKey = resolveStorageScopeKey(config)\n return (\n <NavigationTabsStoreProvider config={config}>\n <HeaderStoreProvider>\n <BookmarkStoreProvider namePrefix={storageScopeKey}>\n <PinnedTokensStoreProvider namePrefix={storageScopeKey}>\n <RecentTokensStoreProvider namePrefix={storageScopeKey}>\n <FormStoreProvider formRef={formRef}>\n <ChainOrderStoreProvider namePrefix={storageScopeKey}>\n <RouteExecutionStoreProvider namePrefix={storageScopeKey}>\n {children}\n </RouteExecutionStoreProvider>\n </ChainOrderStoreProvider>\n </FormStoreProvider>\n </RecentTokensStoreProvider>\n </PinnedTokensStoreProvider>\n </BookmarkStoreProvider>\n </HeaderStoreProvider>\n </NavigationTabsStoreProvider>\n )\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,iBAAiE,EAC5E,UACA,QACA,cACI;CACJ,MAAM,kBAAkB,uBAAuB,MAAM;CACrD,OACE,oBAAC,6BAAD;EAAqC;EACnC,UAAA,oBAAC,qBAAD,EAAA,UACE,oBAAC,uBAAD;GAAuB,YAAY;GACjC,UAAA,oBAAC,2BAAD;IAA2B,YAAY;IACrC,UAAA,oBAAC,2BAAD;KAA2B,YAAY;KACrC,UAAA,oBAAC,mBAAD;MAA4B;MAC1B,UAAA,oBAAC,yBAAD;OAAyB,YAAY;OACnC,UAAA,oBAAC,6BAAD;QAA6B,YAAY;QACtC;OAC0B,CAAA;MACN,CAAA;KACR,CAAA;IACM,CAAA;GACF,CAAA;EACN,CAAA,EACJ,CAAA;CACM,CAAA;AAEjC"}
@@ -1,5 +1,5 @@
1
- import "../types.js";
2
1
  import { HeaderState } from "./types.js";
2
+ import { PropsWithChildren } from "react";
3
3
  //#region src/stores/header/useHeaderStore.d.ts
4
4
  export declare function useHeaderStore<T>(selector: (state: HeaderState) => T): T;
5
5
  export declare function useSetHeaderHeight(): any;
@@ -1 +1 @@
1
- {"version":3,"file":"useHeaderStore.d.ts","names":[],"sources":["../../../../src/stores/header/useHeaderStore.tsx"],"mappings":";;;wBA8BgB,eAAe,GAAG,WAAW,OAAO,gBAAgB,IAAI;wBAkBxD"}
1
+ {"version":3,"file":"useHeaderStore.d.ts","names":[],"sources":["../../../../src/stores/header/useHeaderStore.tsx"],"mappings":";;;wBA6BgB,eAAe,GAAG,WAAW,OAAO,gBAAgB,IAAI;wBAkBxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"useHeaderStore.js","names":[],"sources":["../../../../src/stores/header/useHeaderStore.tsx"],"sourcesContent":["import { createContext, use, useRef } from 'react'\nimport { create } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport type { PersistStoreProviderProps } from '../types.js'\nimport type { HeaderState, HeaderStore } from './types.js'\n\nconst HeaderStoreContext = createContext<HeaderStore | null>(null)\n\nexport function HeaderStoreProvider({\n children,\n}: PersistStoreProviderProps): any {\n const storeRef = useRef<HeaderStore>(null)\n if (!storeRef.current) {\n storeRef.current = createHeaderStore()\n }\n return (\n <HeaderStoreContext value={storeRef.current}>{children}</HeaderStoreContext>\n )\n}\n\nfunction useHeaderStoreContext() {\n const useStore = use(HeaderStoreContext)\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${HeaderStoreProvider.name}>.`\n )\n }\n return useStore\n}\n\nexport function useHeaderStore<T>(selector: (state: HeaderState) => T): T {\n const useStore = useHeaderStoreContext()\n return useStore(useShallow(selector))\n}\n\n// We use fixed position on the header when Widget is in Full Height layout.\n// We do this to get it to work like the sticky header does in the other layout modes.\n// As the header is position fixed its not in the document flow anymore.\n// To prevent the remaining page content from appearing behind the header we need to\n// pass the headers height so that the position of the page content can be adjusted\nexport function useHeaderHeight(): any {\n const headerHeight = useHeaderStore((state) => state.headerHeight)\n\n return {\n headerHeight,\n }\n}\n\nexport function useSetHeaderHeight(): any {\n const setHeaderHeight = useHeaderStore((state) => state.setHeaderHeight)\n\n return {\n setHeaderHeight,\n }\n}\n\nconst createHeaderStore = () =>\n create<HeaderState>((set, get) => ({\n headerHeight: 108, // default header height\n setAction: (element) => {\n set(() => ({\n element,\n }))\n return get().removeAction\n },\n setTitle: (title) => {\n set(() => ({\n title,\n }))\n return get().removeTitle\n },\n removeAction: () => {\n set(() => ({\n element: null,\n }))\n },\n removeTitle: () => {\n set(() => ({\n title: undefined,\n }))\n },\n setHeaderHeight: (headerHeight) => {\n set(() => ({\n headerHeight,\n }))\n },\n setBackAction: (action) => {\n set(() => ({\n backAction: action,\n }))\n },\n executeBackAction: () => {\n const { backAction } = get()\n if (backAction) {\n backAction()\n set(() => ({\n backAction: undefined,\n }))\n }\n },\n }))\n"],"mappings":";;;;;AAMA,MAAM,qBAAqB,cAAkC,IAAI;AAEjE,SAAgB,oBAAoB,EAClC,YACiC;CACjC,MAAM,WAAW,OAAoB,IAAI;CACzC,IAAI,CAAC,SAAS,SACZ,SAAS,UAAU,kBAAkB;CAEvC,OACE,oBAAC,oBAAD;EAAoB,OAAO,SAAS;EAAU;CAA6B,CAAA;AAE/E;AAEA,SAAS,wBAAwB;CAC/B,MAAM,WAAW,IAAI,kBAAkB;CACvC,IAAI,CAAC,UACH,MAAM,IAAI,MACR,yCAAyC,oBAAoB,KAAK,GACpE;CAEF,OAAO;AACT;AAEA,SAAgB,eAAkB,UAAwC;CAExE,OADiB,sBACH,CAAC,CAAC,WAAW,QAAQ,CAAC;AACtC;AAOA,SAAgB,kBAAuB;CAGrC,OAAO,EACL,cAHmB,gBAAgB,UAAU,MAAM,YAGxC,EACb;AACF;AAEA,SAAgB,qBAA0B;CAGxC,OAAO,EACL,iBAHsB,gBAAgB,UAAU,MAAM,eAGxC,EAChB;AACF;AAEA,MAAM,0BACJ,QAAqB,KAAK,SAAS;CACjC,cAAc;CACd,YAAY,YAAY;EACtB,WAAW,EACT,QACF,EAAE;EACF,OAAO,IAAI,CAAC,CAAC;CACf;CACA,WAAW,UAAU;EACnB,WAAW,EACT,MACF,EAAE;EACF,OAAO,IAAI,CAAC,CAAC;CACf;CACA,oBAAoB;EAClB,WAAW,EACT,SAAS,KACX,EAAE;CACJ;CACA,mBAAmB;EACjB,WAAW,EACT,OAAO,KAAA,EACT,EAAE;CACJ;CACA,kBAAkB,iBAAiB;EACjC,WAAW,EACT,aACF,EAAE;CACJ;CACA,gBAAgB,WAAW;EACzB,WAAW,EACT,YAAY,OACd,EAAE;CACJ;CACA,yBAAyB;EACvB,MAAM,EAAE,eAAe,IAAI;EAC3B,IAAI,YAAY;GACd,WAAW;GACX,WAAW,EACT,YAAY,KAAA,EACd,EAAE;EACJ;CACF;AACF,EAAE"}
1
+ {"version":3,"file":"useHeaderStore.js","names":[],"sources":["../../../../src/stores/header/useHeaderStore.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react'\nimport { createContext, use, useRef } from 'react'\nimport { create } from 'zustand'\nimport { useShallow } from 'zustand/shallow'\nimport type { HeaderState, HeaderStore } from './types.js'\n\nconst HeaderStoreContext = createContext<HeaderStore | null>(null)\n\n// Not persisted, so it takes no storage scope.\nexport function HeaderStoreProvider({ children }: PropsWithChildren): any {\n const storeRef = useRef<HeaderStore>(null)\n if (!storeRef.current) {\n storeRef.current = createHeaderStore()\n }\n return (\n <HeaderStoreContext value={storeRef.current}>{children}</HeaderStoreContext>\n )\n}\n\nfunction useHeaderStoreContext() {\n const useStore = use(HeaderStoreContext)\n if (!useStore) {\n throw new Error(\n `You forgot to wrap your component in <${HeaderStoreProvider.name}>.`\n )\n }\n return useStore\n}\n\nexport function useHeaderStore<T>(selector: (state: HeaderState) => T): T {\n const useStore = useHeaderStoreContext()\n return useStore(useShallow(selector))\n}\n\n// We use fixed position on the header when Widget is in Full Height layout.\n// We do this to get it to work like the sticky header does in the other layout modes.\n// As the header is position fixed its not in the document flow anymore.\n// To prevent the remaining page content from appearing behind the header we need to\n// pass the headers height so that the position of the page content can be adjusted\nexport function useHeaderHeight(): any {\n const headerHeight = useHeaderStore((state) => state.headerHeight)\n\n return {\n headerHeight,\n }\n}\n\nexport function useSetHeaderHeight(): any {\n const setHeaderHeight = useHeaderStore((state) => state.setHeaderHeight)\n\n return {\n setHeaderHeight,\n }\n}\n\nconst createHeaderStore = () =>\n create<HeaderState>((set, get) => ({\n headerHeight: 108, // default header height\n setAction: (element) => {\n set(() => ({\n element,\n }))\n return get().removeAction\n },\n setTitle: (title) => {\n set(() => ({\n title,\n }))\n return get().removeTitle\n },\n removeAction: () => {\n set(() => ({\n element: null,\n }))\n },\n removeTitle: () => {\n set(() => ({\n title: undefined,\n }))\n },\n setHeaderHeight: (headerHeight) => {\n set(() => ({\n headerHeight,\n }))\n },\n setBackAction: (action) => {\n set(() => ({\n backAction: action,\n }))\n },\n executeBackAction: () => {\n const { backAction } = get()\n if (backAction) {\n backAction()\n set(() => ({\n backAction: undefined,\n }))\n }\n },\n }))\n"],"mappings":";;;;;AAMA,MAAM,qBAAqB,cAAkC,IAAI;AAGjE,SAAgB,oBAAoB,EAAE,YAAoC;CACxE,MAAM,WAAW,OAAoB,IAAI;CACzC,IAAI,CAAC,SAAS,SACZ,SAAS,UAAU,kBAAkB;CAEvC,OACE,oBAAC,oBAAD;EAAoB,OAAO,SAAS;EAAU;CAA6B,CAAA;AAE/E;AAEA,SAAS,wBAAwB;CAC/B,MAAM,WAAW,IAAI,kBAAkB;CACvC,IAAI,CAAC,UACH,MAAM,IAAI,MACR,yCAAyC,oBAAoB,KAAK,GACpE;CAEF,OAAO;AACT;AAEA,SAAgB,eAAkB,UAAwC;CAExE,OADiB,sBACH,CAAC,CAAC,WAAW,QAAQ,CAAC;AACtC;AAOA,SAAgB,kBAAuB;CAGrC,OAAO,EACL,cAHmB,gBAAgB,UAAU,MAAM,YAGxC,EACb;AACF;AAEA,SAAgB,qBAA0B;CAGxC,OAAO,EACL,iBAHsB,gBAAgB,UAAU,MAAM,eAGxC,EAChB;AACF;AAEA,MAAM,0BACJ,QAAqB,KAAK,SAAS;CACjC,cAAc;CACd,YAAY,YAAY;EACtB,WAAW,EACT,QACF,EAAE;EACF,OAAO,IAAI,CAAC,CAAC;CACf;CACA,WAAW,UAAU;EACnB,WAAW,EACT,MACF,EAAE;EACF,OAAO,IAAI,CAAC,CAAC;CACf;CACA,oBAAoB;EAClB,WAAW,EACT,SAAS,KACX,EAAE;CACJ;CACA,mBAAmB;EACjB,WAAW,EACT,OAAO,KAAA,EACT,EAAE;CACJ;CACA,kBAAkB,iBAAiB;EACjC,WAAW,EACT,aACF,EAAE;CACJ;CACA,gBAAgB,WAAW;EACzB,WAAW,EACT,YAAY,OACd,EAAE;CACJ;CACA,yBAAyB;EACvB,MAAM,EAAE,eAAe,IAAI;EAC3B,IAAI,YAAY;GACd,WAAW;GACX,WAAW,EACT,YAAY,KAAA,EACd,EAAE;EACJ;CACF;AACF,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"createTheme.d.ts","names":[],"sources":["../../../src/themes/createTheme.ts"],"mappings":";;;cAuCa,gBAAe,cAAa,gBAAmB"}
1
+ {"version":3,"file":"createTheme.d.ts","names":["createTheme"],"sources":["../../../src/themes/createTheme.ts"],"mappings":";;;cAuCaA,gBAAe,cAAa,gBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","names":[],"sources":["../../../src/types/events.ts"],"mappings":";;;;;;;oBAOY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;EACV,oBAAoB,MAAM;EAC1B,kBAAkB,MAAM;EACxB,cAAc,MAAM;EACpB,iBAAiB,MAAM;EACvB,gCAAgC,MAAM;EACtC,mBAAmB,MAAM;EACzB,8BAA8B,MAAM;EACpC,uBAAuB,MAAM;EAC7B,cAAc,MAAM;EACpB,0BAA0B,MAAM;EAChC,uBAAuB,MAAM;EAC7B,wBAAwB,MAAM;EAC9B,wBAAwB,MAAM;EAC9B,qBAAqB,MAAM;EAC3B,gBAAgB,MAAM;EACtB,sBAAsB;EACtB,iBAAiB,MAAM;EACvB,2BAA2B,MAAM;EACjC,cAAc,MAAM;EACpB,iBAAiB;;YAUP;EACV;;YAGU;EACV;EACA;EACA;EACA;EACA;;YAGU;EACV,OAAO;EACP,QAAQ;;YAGE;EACV,OAAO;EACP,QAAQ;;YAGE;EACV;EACA,QAAQ;;YAGE;EACV,SAAS;EACT;;YAGU,sBACT,WAAW;EACV,WAAW;EACX,UAAU,cAAc;EACxB,UAAU,cAAc;WAEpB;YAEI,eACV,gBAAgB,sBAAsB;EAEtC,SAAS;EACT,UAAU,cAAc;EACxB,UAAU,cAAc;EACxB,aAAa;EACb,aAAa;;YAGH;EACV;EACA;;YAGU;EACV;EACA;;YAGU;;EAEV,KAAK;;EAEL,cAAc"}
1
+ {"version":3,"file":"events.d.ts","names":["TokenAmount"],"sources":["../../../src/types/events.ts"],"mappings":";;;;;;;oBAOY;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;YAGU;EACV,oBAAoB,MAAM;EAC1B,kBAAkB,MAAM;EACxB,cAAc,MAAM;EACpB,iBAAiB,MAAM;EACvB,gCAAgC,MAAM;EACtC,mBAAmB,MAAM;EACzB,8BAA8B,MAAM;EACpC,uBAAuB,MAAM;EAC7B,cAAc,MAAM;EACpB,0BAA0B,MAAM;EAChC,uBAAuB,MAAM;EAC7B,wBAAwB,MAAM;EAC9B,wBAAwB,MAAM;EAC9B,qBAAqB,MAAM;EAC3B,gBAAgB,MAAM;EACtB,sBAAsB;EACtB,iBAAiB,MAAM;EACvB,2BAA2B,MAAM;EACjC,cAAc,MAAM;EACpB,iBAAiB;;YAUP;EACV;;YAGU;EACV;EACA;EACA;EACA;EACA;;YAGU;EACV,OAAO;EACP,QAAQ;;YAGE;EACV,OAAO;EACP,QAAQ;;YAGE;EACV;EACA,QAAQA;;YAGE;EACV,SAAS;EACT;;YAGU,sBACT,WAAW;EACV,WAAW;EACX,UAAU,cAAc;EACxB,UAAU,cAAc;WAEpB;YAEI,eACV,gBAAgB,sBAAsB;EAEtC,SAAS;EACT,UAAU,cAAc;EACxB,UAAU,cAAc;EACxB,aAAa;EACb,aAAa;;YAGH;EACV;EACA;;YAGU;EACV;EACA;;YAGU;;EAEV,KAAK;;EAEL,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"token.d.ts","names":[],"sources":["../../../src/types/token.ts"],"mappings":";;iBAMiB;EACf;EACA;EACA;;EAEA;EACA;EACA;;EAEA;;UAGe,sBAAoB,aAAgB"}
1
+ {"version":3,"file":"token.d.ts","names":["TokenAmount","SDKTokenAmount"],"sources":["../../../src/types/token.ts"],"mappings":";;iBAMiB;EACf;EACA;EACA;;EAEA;EACA;EACA;;EAEA;;UAGeA,sBAAoBC,aAAgB"}
@@ -307,7 +307,37 @@ export interface WidgetConfig {
307
307
  walletConfig?: WidgetWalletConfig;
308
308
  sdkConfig?: WidgetSDKConfig;
309
309
  buildUrl?: boolean;
310
+ /**
311
+ * @deprecated Use `storageScopeKey` for persisted state and `queryScopeKey`
312
+ * for the query cache. Still honoured as the fallback for both.
313
+ */
310
314
  keyPrefix?: string;
315
+ /**
316
+ * Namespaces the widget's persisted state in `localStorage`: bookmarks,
317
+ * pinned tokens, recent tokens, chain order and route history, as
318
+ * `keyPrefix` does. Use a different value per widget instance that should
319
+ * keep its own state. Settings keep one shared name.
320
+ *
321
+ * It also scopes the widget's other queries (routes, tokens, balances, …),
322
+ * so instances with different values keep their data apart.
323
+ *
324
+ * Falls back to `keyPrefix`, then to the historical `li.fi-*` names.
325
+ */
326
+ storageScopeKey?: string;
327
+ /**
328
+ * Scopes the widget's chains and tools queries inside the host's react-query
329
+ * `QueryClient`. Widget instances - and a host app using the
330
+ * `@lifi/widget/queries` factories - that pass the same value
331
+ * share those entries. The other widget queries are scoped by
332
+ * `storageScopeKey`.
333
+ *
334
+ * The keys start with a plain `'chains'` / `'tools'`, as in wagmi, so a host
335
+ * that matches on those roots (for example `setQueriesData({ queryKey:
336
+ * ['chains'] })`) also reaches the widget's entries.
337
+ *
338
+ * Falls back to `keyPrefix`, then to `'li.fi'`.
339
+ */
340
+ queryScopeKey?: string;
311
341
  bridges?: AllowDeny<string>;
312
342
  exchanges?: AllowDeny<string>;
313
343
  chains?: WidgetChains;
@@ -1 +1 @@
1
- {"version":3,"file":"widget.d.ts","names":[],"sources":["../../../src/types/widget.ts"],"mappings":"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"}
1
+ {"version":3,"file":"widget.d.ts","names":[],"sources":["../../../src/types/widget.ts"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"widget.js","names":[],"sources":["../../../src/types/widget.ts"],"sourcesContent":["import type {\n BaseToken,\n ChainType,\n ContractCall,\n ExecutionOptions,\n ExtendedChain,\n Order,\n Route,\n RouteOptions,\n SDKConfig,\n StaticToken,\n Token,\n} from '@lifi/sdk'\nimport type { WalletMenuOpenArgs } from '@lifi/wallet-management'\nimport type { WidgetProviderProps } from '@lifi/widget-provider'\nimport type {\n Components,\n PaletteMode,\n PaletteOptions,\n Shape,\n SxProps,\n Theme,\n} from '@mui/material'\nimport type { TypographyVariantsOptions } from '@mui/material/styles'\nimport type {\n CSSProperties,\n PropsWithChildren,\n ReactNode,\n RefObject,\n} from 'react'\nimport type {\n LanguageKey,\n LanguageResources,\n} from '../providers/I18nProvider/types.js'\nimport type { DefaultFieldValues } from '../stores/form/types.js'\n\nexport type WidgetVariant = 'compact' | 'wide' | 'drawer'\n\n/** @internal Not part of the public API. */\nexport type InternalWidgetMode = 'limit'\nexport type WidgetMode =\n | 'default'\n | 'split'\n | 'custom'\n | 'refuel'\n | InternalWidgetMode\nexport type SplitMode = 'bridge' | 'swap'\nexport type SplitModeOptions = {\n defaultTab: SplitMode\n}\nexport type CustomMode = 'checkout' | 'deposit'\nexport interface ModeOptions {\n /**\n * Configure split mode behavior:\n * - 'bridge' | 'swap': Single mode without tabs\n * - { defaultTab: 'bridge' | 'swap' }: Tabs mode with configurable default tab\n */\n split?: SplitMode | SplitModeOptions\n custom?: { type: CustomMode }\n}\n\n/**\n * Identity of a header navigation tab. Each key maps to a widget variant, mode and\n * (optionally) mode options; labels are resolved from the key.\n */\nexport type SplitNavigationTabKey = SplitMode\n/** @internal Not part of the public API. */\nexport type InternalNavigationTabKey =\n | 'default'\n | 'private'\n | 'refuel'\n | 'swap-advanced'\n | 'bridge-advanced'\n | 'limit'\nexport type NavigationTabKey = InternalNavigationTabKey | SplitNavigationTabKey\n\nexport type Appearance = PaletteMode | 'system'\nexport interface NavigationProps {\n /**\n * If given, uses a negative margin to counteract the padding on sides for navigation elements like icon buttons.\n * @default true\n */\n edge?: boolean\n}\nexport type WidgetThemeComponents = Partial<\n Pick<\n Components<Theme>,\n | 'MuiAppBar'\n | 'MuiAvatar'\n | 'MuiButton'\n | 'MuiCard'\n | 'MuiDrawer'\n | 'MuiIconButton'\n | 'MuiInputCard'\n | 'MuiNavigationTabs'\n | 'MuiNavigationTab'\n | 'MuiTabs'\n | 'MuiCheckbox'\n >\n>\n\nexport type WidgetTheme = {\n colorSchemes?: {\n light?: {\n palette: PaletteOptions\n }\n dark?: {\n palette: PaletteOptions\n }\n }\n shape?: Partial<Shape>\n typography?: TypographyVariantsOptions\n components?: WidgetThemeComponents\n container?: CSSProperties\n routesContainer?: CSSProperties\n chainSidebarContainer?: CSSProperties\n header?: CSSProperties\n navigation?: NavigationProps\n}\n\nexport interface DisabledUIConfig {\n fromAmount?: boolean\n fromToken?: boolean\n toAddress?: boolean\n toToken?: boolean\n}\n\nexport interface HiddenUIConfig {\n addressBookConnectedWallets?: boolean\n allNetworks?: boolean\n appearance?: boolean\n bridgesSettings?: boolean\n chainSelect?: boolean\n /**\n * Hide the chain sidebar in the `wide` variant. No effect in other variants.\n * @default false\n */\n chainSidebar?: boolean\n contactSupport?: boolean\n /**\n * Hide the drawer close button. Only meaningful when `variant === 'drawer'`.\n * @default false\n */\n drawerCloseButton?: boolean\n fromToken?: boolean\n gasRefuelMessage?: boolean\n hideSmallBalances?: boolean\n history?: boolean\n insufficientGasMessage?: boolean\n integratorStepDetails?: boolean\n language?: boolean\n /**\n * Hide the warning shown when sending to an address with low historical\n * on-chain activity (low transaction count or contract-like behavior).\n * @default false\n */\n lowAddressActivityConfirmation?: boolean\n poweredBy?: boolean\n /**\n * Hide the \"Recent searches\" section in the token select view.\n * @default false\n */\n recentSearches?: boolean\n reverseTokensButton?: boolean\n routeCardPriceImpact?: boolean\n routeTokenDescription?: boolean\n searchTokenInput?: boolean\n toAddress?: boolean\n toToken?: boolean\n walletMenu?: boolean\n}\n\nexport interface RequiredUIConfig {\n accountDeployedMessage?: boolean\n toAddress?: boolean\n}\n\nexport type DefaultUI = {\n transactionDetailsExpanded?: boolean\n navigationHeaderTitleNoWrap?: boolean\n /**\n * Layout for the main form.\n * - `'default'`: the chain/token selectors plus single amount input.\n * - `'cards'`: the redesigned card-based layout — stacked Send/Receive amount\n * cards (`AmountInputCardPair`) with inline token pill selectors and a swap\n * button.\n * @default 'default'\n */\n layout?: 'default' | 'cards'\n}\n\nexport interface WidgetWalletConfig {\n walletEcosystemsOrder?: Record<string, ChainType[]>\n onConnect?(args?: WalletMenuOpenArgs): void\n /**\n * Determines whether the widget should provide partial wallet management functionality.\n *\n * In partial mode, external wallet management will be used for \"opt-out\" providers,\n * while the internal management is applied for any remaining providers that do not opt out.\n * This allows a flexible balance between the integrator's custom wallet menu and the widget's native wallet menu.\n * @default false\n */\n usePartialWalletManagement?: boolean\n /**\n * This option forces the widget to always use internal wallet management ignoring external wallet management contexts\n * @default false\n */\n forceInternalWalletManagement?: boolean\n}\n\nexport interface WidgetSDKConfig\n extends Omit<\n SDKConfig,\n | 'apiKey'\n | 'disableVersionCheck'\n | 'integrator'\n | 'providers'\n | 'routeOptions'\n | 'widgetVersion'\n > {\n routeOptions?: Omit<\n RouteOptions,\n 'bridges' | 'exchanges' | 'fee' | 'referrer' | 'order' | 'slippage'\n >\n executionOptions?: Pick<ExecutionOptions, 'updateTransactionRequestHook'>\n}\n\nexport interface WidgetContractTool {\n name: string\n logoURI: string\n}\n\nexport interface CalculateFeeParams {\n fromChain: ExtendedChain\n toChain: ExtendedChain\n fromToken: Token\n toToken: Token\n fromAddress?: string\n toAddress?: string\n fromAmount?: bigint\n toAmount?: bigint\n slippage?: number\n}\n\nexport interface WidgetFeeConfig {\n name?: string\n logoURI?: string\n fee?: number\n /**\n * Whether to show the fee percentage in the fee details.\n * @default false\n */\n showFeePercentage?: boolean\n /**\n * Whether to show a tooltip with the fee details. Requires `name` or `feeTooltipComponent` to be set.\n * @default false\n */\n showFeeTooltip?: boolean\n /**\n * Custom tooltip component to show with the fee details.\n */\n feeTooltipComponent?: ReactNode\n /**\n * Function to calculate fees before fetching quotes.\n * If provided, this function will be used instead of the `fee` parameter.\n * Only one of `fee` or `calculateFee` should be used.\n *\n * @param params Object containing the fee calculation parameters\n * @returns A promise that resolves to the calculated fee as a number (e.g., 0.03 represents a 3% fee)\n */\n calculateFee?(params: CalculateFeeParams): Promise<number | undefined>\n}\n\nexport interface ToAddress {\n name?: string\n address: string\n chainType: ChainType\n logoURI?: string\n}\n\nexport interface AllowDeny<T> {\n allow?: T[]\n deny?: T[]\n}\n\nexport type AllowDenySetItem = string | number\nexport interface AllowDenySet {\n allow?: Set<AllowDenySetItem>\n deny?: Set<AllowDenySetItem>\n}\n\nexport type AllowDenySets = {\n from?: AllowDenySet\n to?: AllowDenySet\n} & AllowDenySet\n\nexport type AllowDenyItems<T> = {\n from?: AllowDeny<T>\n to?: AllowDeny<T>\n} & AllowDeny<T>\n\nexport type WidgetChains = {\n types?: AllowDeny<ChainType>\n} & AllowDenyItems<number>\n\nexport type WidgetTokens = {\n featured?: StaticToken[]\n include?: Token[]\n popular?: StaticToken[]\n verified?: BaseToken[]\n} & AllowDenyItems<BaseToken>\n\nexport type WidgetLanguages = {\n default?: LanguageKey\n} & AllowDeny<LanguageKey>\n\nexport type PoweredByType = 'default' | 'jumper'\n\nexport interface RouteLabel {\n text: string\n sx?: SxProps<Theme>\n}\n\nexport interface RouteLabelRule {\n label: RouteLabel\n // Matching criteria\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n fromChainId?: number[]\n toChainId?: number[]\n fromTokenAddress?: string[]\n toTokenAddress?: string[]\n /**\n * Custom match function evaluated against the route. When provided, its\n * result is AND'd with the other matching criteria — all specified\n * conditions must pass for the label to apply. Use this for matching logic\n * that the built-in fields cannot express (gas costs, step count, route\n * tags, etc.).\n */\n match?: (route: Route) => boolean\n}\n\nexport type ExplorerUrl =\n | string\n | {\n url: string\n txPath?: string\n addressPath?: string\n }\n\nexport type WidgetProvider = (\n props: PropsWithChildren<WidgetProviderProps>\n) => ReactNode\n\nexport interface WidgetConfig {\n fromChain?: number\n toChain?: number\n fromToken?: string\n toToken?: string\n toAddress?: ToAddress\n toAddresses?: ToAddress[]\n fromAmount?: number | string\n minFromAmountUSD?: number\n toAmount?: number | string\n formUpdateKey?: string\n\n providers?: WidgetProvider[]\n\n contractCalls?: ContractCall[]\n contractComponent?: ReactNode\n contractSecondaryComponent?: ReactNode\n contractCompactComponent?: ReactNode\n contractTool?: WidgetContractTool\n integrator: string\n apiKey?: string\n feeConfig?: WidgetFeeConfig\n referrer?: string\n\n routePriority?: Order\n slippage?: number\n\n variant?: WidgetVariant\n mode?: WidgetMode\n modeOptions?: ModeOptions\n /**\n * Header navigation tabs, in order. When set, the widget renders a tab bar\n * and the active tab drives the displayed flow. Each entry is a tab key.\n *\n * @internal Not part of the public API.\n */\n _navigationTabs?: NavigationTabKey[]\n\n appearance?: Appearance\n theme?: WidgetTheme\n\n disabledUI?: DisabledUIConfig\n hiddenUI?: HiddenUIConfig\n requiredUI?: RequiredUIConfig\n defaultUI?: DefaultUI\n /**\n * When true, shows only the recommended route and hides the route\n * selector UI. Distinct from `routePriority`, which sets the SDK\n * ranking order across multiple displayed routes.\n * @default false\n */\n showSingleRoute?: boolean\n useRelayerRoutes?: boolean\n\n walletConfig?: WidgetWalletConfig\n sdkConfig?: WidgetSDKConfig\n\n buildUrl?: boolean\n keyPrefix?: string\n\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n chains?: WidgetChains\n tokens?: WidgetTokens\n languages?: WidgetLanguages\n languageResources?: LanguageResources\n explorerUrls?: Record<number, ExplorerUrl[]> &\n Partial<Record<'internal', ExplorerUrl[]>>\n poweredBy?: PoweredByType\n\n /**\n * Custom labels/badges to show on routes based on specified rules\n */\n routeLabels?: RouteLabelRule[]\n}\n\nexport interface FormFieldOptions {\n setUrlSearchParam: boolean\n}\n\nexport interface FieldValues\n extends Omit<DefaultFieldValues, 'fromAmount' | 'toAmount' | 'toAddress'> {\n fromAmount?: number | string\n toAmount?: number | string\n toAddress?: ToAddress | string\n}\n\nexport type FieldNames = keyof FieldValues\n\nexport type SetFieldValueFunction = <K extends FieldNames>(\n key: K,\n value: FieldValues[K],\n options?: FormFieldOptions\n) => void\n\nexport type FormState = {\n setFieldValue: SetFieldValueFunction\n}\n\nexport type FormRef = RefObject<FormState | null>\n\nexport interface FormRefProps {\n formRef?: FormRef\n}\n\nexport interface WidgetConfigProps extends FormRefProps {\n config: WidgetConfig\n}\n\nexport interface WidgetConfigPartialProps {\n config?: Partial<WidgetConfig>\n}\n\nexport type WidgetProps = WidgetDrawerProps &\n WidgetConfig &\n WidgetConfigPartialProps &\n FormRefProps\n\nexport interface WidgetDrawerProps extends WidgetConfigPartialProps {\n elementRef?: RefObject<HTMLDivElement>\n open?: boolean\n /**\n * Make sure to make the onClose callback stable (e.g. using useCallback) to avoid causing re-renders of the entire widget\n */\n onClose?(): void\n}\n\nexport enum ExpansionType {\n Routes = 'routes',\n FromChain = 'fromChain',\n ToChain = 'toChain',\n}\n"],"mappings":";AAieA,IAAY,gBAAL,yBAAA,eAAA;CACL,cAAA,YAAA;CACA,cAAA,eAAA;CACA,cAAA,aAAA;;AACF,EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"widget.js","names":[],"sources":["../../../src/types/widget.ts"],"sourcesContent":["import type {\n BaseToken,\n ChainType,\n ContractCall,\n ExecutionOptions,\n ExtendedChain,\n Order,\n Route,\n RouteOptions,\n SDKConfig,\n StaticToken,\n Token,\n} from '@lifi/sdk'\nimport type { WalletMenuOpenArgs } from '@lifi/wallet-management'\nimport type { WidgetProviderProps } from '@lifi/widget-provider'\nimport type {\n Components,\n PaletteMode,\n PaletteOptions,\n Shape,\n SxProps,\n Theme,\n} from '@mui/material'\nimport type { TypographyVariantsOptions } from '@mui/material/styles'\nimport type {\n CSSProperties,\n PropsWithChildren,\n ReactNode,\n RefObject,\n} from 'react'\nimport type {\n LanguageKey,\n LanguageResources,\n} from '../providers/I18nProvider/types.js'\nimport type { DefaultFieldValues } from '../stores/form/types.js'\n\nexport type WidgetVariant = 'compact' | 'wide' | 'drawer'\n\n/** @internal Not part of the public API. */\nexport type InternalWidgetMode = 'limit'\nexport type WidgetMode =\n | 'default'\n | 'split'\n | 'custom'\n | 'refuel'\n | InternalWidgetMode\nexport type SplitMode = 'bridge' | 'swap'\nexport type SplitModeOptions = {\n defaultTab: SplitMode\n}\nexport type CustomMode = 'checkout' | 'deposit'\nexport interface ModeOptions {\n /**\n * Configure split mode behavior:\n * - 'bridge' | 'swap': Single mode without tabs\n * - { defaultTab: 'bridge' | 'swap' }: Tabs mode with configurable default tab\n */\n split?: SplitMode | SplitModeOptions\n custom?: { type: CustomMode }\n}\n\n/**\n * Identity of a header navigation tab. Each key maps to a widget variant, mode and\n * (optionally) mode options; labels are resolved from the key.\n */\nexport type SplitNavigationTabKey = SplitMode\n/** @internal Not part of the public API. */\nexport type InternalNavigationTabKey =\n | 'default'\n | 'private'\n | 'refuel'\n | 'swap-advanced'\n | 'bridge-advanced'\n | 'limit'\nexport type NavigationTabKey = InternalNavigationTabKey | SplitNavigationTabKey\n\nexport type Appearance = PaletteMode | 'system'\nexport interface NavigationProps {\n /**\n * If given, uses a negative margin to counteract the padding on sides for navigation elements like icon buttons.\n * @default true\n */\n edge?: boolean\n}\nexport type WidgetThemeComponents = Partial<\n Pick<\n Components<Theme>,\n | 'MuiAppBar'\n | 'MuiAvatar'\n | 'MuiButton'\n | 'MuiCard'\n | 'MuiDrawer'\n | 'MuiIconButton'\n | 'MuiInputCard'\n | 'MuiNavigationTabs'\n | 'MuiNavigationTab'\n | 'MuiTabs'\n | 'MuiCheckbox'\n >\n>\n\nexport type WidgetTheme = {\n colorSchemes?: {\n light?: {\n palette: PaletteOptions\n }\n dark?: {\n palette: PaletteOptions\n }\n }\n shape?: Partial<Shape>\n typography?: TypographyVariantsOptions\n components?: WidgetThemeComponents\n container?: CSSProperties\n routesContainer?: CSSProperties\n chainSidebarContainer?: CSSProperties\n header?: CSSProperties\n navigation?: NavigationProps\n}\n\nexport interface DisabledUIConfig {\n fromAmount?: boolean\n fromToken?: boolean\n toAddress?: boolean\n toToken?: boolean\n}\n\nexport interface HiddenUIConfig {\n addressBookConnectedWallets?: boolean\n allNetworks?: boolean\n appearance?: boolean\n bridgesSettings?: boolean\n chainSelect?: boolean\n /**\n * Hide the chain sidebar in the `wide` variant. No effect in other variants.\n * @default false\n */\n chainSidebar?: boolean\n contactSupport?: boolean\n /**\n * Hide the drawer close button. Only meaningful when `variant === 'drawer'`.\n * @default false\n */\n drawerCloseButton?: boolean\n fromToken?: boolean\n gasRefuelMessage?: boolean\n hideSmallBalances?: boolean\n history?: boolean\n insufficientGasMessage?: boolean\n integratorStepDetails?: boolean\n language?: boolean\n /**\n * Hide the warning shown when sending to an address with low historical\n * on-chain activity (low transaction count or contract-like behavior).\n * @default false\n */\n lowAddressActivityConfirmation?: boolean\n poweredBy?: boolean\n /**\n * Hide the \"Recent searches\" section in the token select view.\n * @default false\n */\n recentSearches?: boolean\n reverseTokensButton?: boolean\n routeCardPriceImpact?: boolean\n routeTokenDescription?: boolean\n searchTokenInput?: boolean\n toAddress?: boolean\n toToken?: boolean\n walletMenu?: boolean\n}\n\nexport interface RequiredUIConfig {\n accountDeployedMessage?: boolean\n toAddress?: boolean\n}\n\nexport type DefaultUI = {\n transactionDetailsExpanded?: boolean\n navigationHeaderTitleNoWrap?: boolean\n /**\n * Layout for the main form.\n * - `'default'`: the chain/token selectors plus single amount input.\n * - `'cards'`: the redesigned card-based layout — stacked Send/Receive amount\n * cards (`AmountInputCardPair`) with inline token pill selectors and a swap\n * button.\n * @default 'default'\n */\n layout?: 'default' | 'cards'\n}\n\nexport interface WidgetWalletConfig {\n walletEcosystemsOrder?: Record<string, ChainType[]>\n onConnect?(args?: WalletMenuOpenArgs): void\n /**\n * Determines whether the widget should provide partial wallet management functionality.\n *\n * In partial mode, external wallet management will be used for \"opt-out\" providers,\n * while the internal management is applied for any remaining providers that do not opt out.\n * This allows a flexible balance between the integrator's custom wallet menu and the widget's native wallet menu.\n * @default false\n */\n usePartialWalletManagement?: boolean\n /**\n * This option forces the widget to always use internal wallet management ignoring external wallet management contexts\n * @default false\n */\n forceInternalWalletManagement?: boolean\n}\n\nexport interface WidgetSDKConfig\n extends Omit<\n SDKConfig,\n | 'apiKey'\n | 'disableVersionCheck'\n | 'integrator'\n | 'providers'\n | 'routeOptions'\n | 'widgetVersion'\n > {\n routeOptions?: Omit<\n RouteOptions,\n 'bridges' | 'exchanges' | 'fee' | 'referrer' | 'order' | 'slippage'\n >\n executionOptions?: Pick<ExecutionOptions, 'updateTransactionRequestHook'>\n}\n\nexport interface WidgetContractTool {\n name: string\n logoURI: string\n}\n\nexport interface CalculateFeeParams {\n fromChain: ExtendedChain\n toChain: ExtendedChain\n fromToken: Token\n toToken: Token\n fromAddress?: string\n toAddress?: string\n fromAmount?: bigint\n toAmount?: bigint\n slippage?: number\n}\n\nexport interface WidgetFeeConfig {\n name?: string\n logoURI?: string\n fee?: number\n /**\n * Whether to show the fee percentage in the fee details.\n * @default false\n */\n showFeePercentage?: boolean\n /**\n * Whether to show a tooltip with the fee details. Requires `name` or `feeTooltipComponent` to be set.\n * @default false\n */\n showFeeTooltip?: boolean\n /**\n * Custom tooltip component to show with the fee details.\n */\n feeTooltipComponent?: ReactNode\n /**\n * Function to calculate fees before fetching quotes.\n * If provided, this function will be used instead of the `fee` parameter.\n * Only one of `fee` or `calculateFee` should be used.\n *\n * @param params Object containing the fee calculation parameters\n * @returns A promise that resolves to the calculated fee as a number (e.g., 0.03 represents a 3% fee)\n */\n calculateFee?(params: CalculateFeeParams): Promise<number | undefined>\n}\n\nexport interface ToAddress {\n name?: string\n address: string\n chainType: ChainType\n logoURI?: string\n}\n\nexport interface AllowDeny<T> {\n allow?: T[]\n deny?: T[]\n}\n\nexport type AllowDenySetItem = string | number\nexport interface AllowDenySet {\n allow?: Set<AllowDenySetItem>\n deny?: Set<AllowDenySetItem>\n}\n\nexport type AllowDenySets = {\n from?: AllowDenySet\n to?: AllowDenySet\n} & AllowDenySet\n\nexport type AllowDenyItems<T> = {\n from?: AllowDeny<T>\n to?: AllowDeny<T>\n} & AllowDeny<T>\n\nexport type WidgetChains = {\n types?: AllowDeny<ChainType>\n} & AllowDenyItems<number>\n\nexport type WidgetTokens = {\n featured?: StaticToken[]\n include?: Token[]\n popular?: StaticToken[]\n verified?: BaseToken[]\n} & AllowDenyItems<BaseToken>\n\nexport type WidgetLanguages = {\n default?: LanguageKey\n} & AllowDeny<LanguageKey>\n\nexport type PoweredByType = 'default' | 'jumper'\n\nexport interface RouteLabel {\n text: string\n sx?: SxProps<Theme>\n}\n\nexport interface RouteLabelRule {\n label: RouteLabel\n // Matching criteria\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n fromChainId?: number[]\n toChainId?: number[]\n fromTokenAddress?: string[]\n toTokenAddress?: string[]\n /**\n * Custom match function evaluated against the route. When provided, its\n * result is AND'd with the other matching criteria — all specified\n * conditions must pass for the label to apply. Use this for matching logic\n * that the built-in fields cannot express (gas costs, step count, route\n * tags, etc.).\n */\n match?: (route: Route) => boolean\n}\n\nexport type ExplorerUrl =\n | string\n | {\n url: string\n txPath?: string\n addressPath?: string\n }\n\nexport type WidgetProvider = (\n props: PropsWithChildren<WidgetProviderProps>\n) => ReactNode\n\nexport interface WidgetConfig {\n fromChain?: number\n toChain?: number\n fromToken?: string\n toToken?: string\n toAddress?: ToAddress\n toAddresses?: ToAddress[]\n fromAmount?: number | string\n minFromAmountUSD?: number\n toAmount?: number | string\n formUpdateKey?: string\n\n providers?: WidgetProvider[]\n\n contractCalls?: ContractCall[]\n contractComponent?: ReactNode\n contractSecondaryComponent?: ReactNode\n contractCompactComponent?: ReactNode\n contractTool?: WidgetContractTool\n integrator: string\n apiKey?: string\n feeConfig?: WidgetFeeConfig\n referrer?: string\n\n routePriority?: Order\n slippage?: number\n\n variant?: WidgetVariant\n mode?: WidgetMode\n modeOptions?: ModeOptions\n /**\n * Header navigation tabs, in order. When set, the widget renders a tab bar\n * and the active tab drives the displayed flow. Each entry is a tab key.\n *\n * @internal Not part of the public API.\n */\n _navigationTabs?: NavigationTabKey[]\n\n appearance?: Appearance\n theme?: WidgetTheme\n\n disabledUI?: DisabledUIConfig\n hiddenUI?: HiddenUIConfig\n requiredUI?: RequiredUIConfig\n defaultUI?: DefaultUI\n /**\n * When true, shows only the recommended route and hides the route\n * selector UI. Distinct from `routePriority`, which sets the SDK\n * ranking order across multiple displayed routes.\n * @default false\n */\n showSingleRoute?: boolean\n useRelayerRoutes?: boolean\n\n walletConfig?: WidgetWalletConfig\n sdkConfig?: WidgetSDKConfig\n\n buildUrl?: boolean\n /**\n * @deprecated Use `storageScopeKey` for persisted state and `queryScopeKey`\n * for the query cache. Still honoured as the fallback for both.\n */\n keyPrefix?: string\n /**\n * Namespaces the widget's persisted state in `localStorage`: bookmarks,\n * pinned tokens, recent tokens, chain order and route history, as\n * `keyPrefix` does. Use a different value per widget instance that should\n * keep its own state. Settings keep one shared name.\n *\n * It also scopes the widget's other queries (routes, tokens, balances, …),\n * so instances with different values keep their data apart.\n *\n * Falls back to `keyPrefix`, then to the historical `li.fi-*` names.\n */\n storageScopeKey?: string\n /**\n * Scopes the widget's chains and tools queries inside the host's react-query\n * `QueryClient`. Widget instances - and a host app using the\n * `@lifi/widget/queries` factories - that pass the same value\n * share those entries. The other widget queries are scoped by\n * `storageScopeKey`.\n *\n * The keys start with a plain `'chains'` / `'tools'`, as in wagmi, so a host\n * that matches on those roots (for example `setQueriesData({ queryKey:\n * ['chains'] })`) also reaches the widget's entries.\n *\n * Falls back to `keyPrefix`, then to `'li.fi'`.\n */\n queryScopeKey?: string\n\n bridges?: AllowDeny<string>\n exchanges?: AllowDeny<string>\n chains?: WidgetChains\n tokens?: WidgetTokens\n languages?: WidgetLanguages\n languageResources?: LanguageResources\n explorerUrls?: Record<number, ExplorerUrl[]> &\n Partial<Record<'internal', ExplorerUrl[]>>\n poweredBy?: PoweredByType\n\n /**\n * Custom labels/badges to show on routes based on specified rules\n */\n routeLabels?: RouteLabelRule[]\n}\n\nexport interface FormFieldOptions {\n setUrlSearchParam: boolean\n}\n\nexport interface FieldValues\n extends Omit<DefaultFieldValues, 'fromAmount' | 'toAmount' | 'toAddress'> {\n fromAmount?: number | string\n toAmount?: number | string\n toAddress?: ToAddress | string\n}\n\nexport type FieldNames = keyof FieldValues\n\nexport type SetFieldValueFunction = <K extends FieldNames>(\n key: K,\n value: FieldValues[K],\n options?: FormFieldOptions\n) => void\n\nexport type FormState = {\n setFieldValue: SetFieldValueFunction\n}\n\nexport type FormRef = RefObject<FormState | null>\n\nexport interface FormRefProps {\n formRef?: FormRef\n}\n\nexport interface WidgetConfigProps extends FormRefProps {\n config: WidgetConfig\n}\n\nexport interface WidgetConfigPartialProps {\n config?: Partial<WidgetConfig>\n}\n\nexport type WidgetProps = WidgetDrawerProps &\n WidgetConfig &\n WidgetConfigPartialProps &\n FormRefProps\n\nexport interface WidgetDrawerProps extends WidgetConfigPartialProps {\n elementRef?: RefObject<HTMLDivElement>\n open?: boolean\n /**\n * Make sure to make the onClose callback stable (e.g. using useCallback) to avoid causing re-renders of the entire widget\n */\n onClose?(): void\n}\n\nexport enum ExpansionType {\n Routes = 'routes',\n FromChain = 'fromChain',\n ToChain = 'toChain',\n}\n"],"mappings":";AA+fA,IAAY,gBAAL,yBAAA,eAAA;CACL,cAAA,YAAA;CACA,cAAA,eAAA;CACA,cAAA,aAAA;;AACF,EAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"queries.js","names":[],"sources":["../../../src/utils/queries.ts"],"sourcesContent":["export const getQueryKey = (key: string, prefix?: string) =>\n `${prefix || 'li.fi'}-widget-${key}`\n"],"mappings":";AAAA,MAAa,eAAe,KAAa,WACvC,GAAG,UAAU,QAAQ,UAAU"}
1
+ {"version":3,"file":"queries.js","names":[],"sources":["../../../src/utils/queries.ts"],"sourcesContent":["// Legacy keys: callers pass the storage scope, so instances stay apart.\nexport const getQueryKey = (key: string, prefix?: string) =>\n `${prefix || 'li.fi'}-widget-${key}`\n"],"mappings":";AACA,MAAa,eAAe,KAAa,WACvC,GAAG,UAAU,QAAQ,UAAU"}
@@ -0,0 +1,6 @@
1
+ import { WidgetConfig } from "../types/widget.js";
2
+ //#region src/utils/scopeKeys.d.ts
3
+ type ScopeKeyConfig = Pick<WidgetConfig, "storageScopeKey" | "queryScopeKey" | "keyPrefix">;
4
+ export declare const resolveStorageScopeKey: (config: Partial<ScopeKeyConfig> | undefined) => string | undefined;
5
+ //#endregion
6
+ //# sourceMappingURL=scopeKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeKeys.d.ts","names":[],"sources":["../../../src/utils/scopeKeys.ts"],"mappings":";;KAKK,iBAAiB,KACpB;qBAKW,yBACX,QAAQ,QAAQ"}
@@ -0,0 +1,8 @@
1
+ //#region src/utils/scopeKeys.ts
2
+ const defaultQueryScopeKey = "li.fi";
3
+ const resolveStorageScopeKey = (config) => config?.storageScopeKey ?? config?.keyPrefix;
4
+ const resolveQueryScopeKey = (config) => config?.queryScopeKey ?? config?.keyPrefix ?? "li.fi";
5
+ //#endregion
6
+ export { defaultQueryScopeKey, resolveQueryScopeKey, resolveStorageScopeKey };
7
+
8
+ //# sourceMappingURL=scopeKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeKeys.js","names":[],"sources":["../../../src/utils/scopeKeys.ts"],"sourcesContent":["import type { WidgetConfig } from '../types/widget.js'\n\n// Non-empty, so an unconfigured widget never shares a host's unscoped entries.\nexport const defaultQueryScopeKey = 'li.fi'\n\ntype ScopeKeyConfig = Pick<\n WidgetConfig,\n 'storageScopeKey' | 'queryScopeKey' | 'keyPrefix'\n>\n\n// `undefined` keeps the historical `li.fi-*` store names.\nexport const resolveStorageScopeKey = (\n config: Partial<ScopeKeyConfig> | undefined\n): string | undefined => config?.storageScopeKey ?? config?.keyPrefix\n\nexport const resolveQueryScopeKey = (\n config: Partial<ScopeKeyConfig> | undefined\n): string => config?.queryScopeKey ?? config?.keyPrefix ?? defaultQueryScopeKey\n"],"mappings":";AAGA,MAAa,uBAAuB;AAQpC,MAAa,0BACX,WACuB,QAAQ,mBAAmB,QAAQ;AAE5D,MAAa,wBACX,WACW,QAAQ,iBAAiB,QAAQ,aAAA"}
@@ -0,0 +1,5 @@
1
+ //#region src/utils/url.d.ts
2
+ export declare const isHttpUrl: (url: string | undefined) => url is string;
3
+ export declare const openInNewTab: (url: string | undefined) => void;
4
+ //#endregion
5
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","names":[],"sources":["../../../src/utils/url.ts"],"mappings":";qBAAa,YAAa,4BAA0B;qBAYvC,eAAgB"}
@@ -0,0 +1,17 @@
1
+ //#region src/utils/url.ts
2
+ const isHttpUrl = (url) => {
3
+ if (!url) return false;
4
+ try {
5
+ const { protocol } = new URL(url);
6
+ return protocol === "https:" || protocol === "http:";
7
+ } catch {
8
+ return false;
9
+ }
10
+ };
11
+ const openInNewTab = (url) => {
12
+ if (isHttpUrl(url)) window.open(url, "_blank", "noopener,noreferrer");
13
+ };
14
+ //#endregion
15
+ export { isHttpUrl, openInNewTab };
16
+
17
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","names":[],"sources":["../../../src/utils/url.ts"],"sourcesContent":["export const isHttpUrl = (url: string | undefined): url is string => {\n if (!url) {\n return false\n }\n try {\n const { protocol } = new URL(url)\n return protocol === 'https:' || protocol === 'http:'\n } catch {\n return false\n }\n}\n\nexport const openInNewTab = (url: string | undefined): void => {\n if (isHttpUrl(url)) {\n window.open(url, '_blank', 'noopener,noreferrer')\n }\n}\n"],"mappings":";AAAA,MAAa,aAAa,QAA2C;CACnE,IAAI,CAAC,KACH,OAAO;CAET,IAAI;EACF,MAAM,EAAE,aAAa,IAAI,IAAI,GAAG;EAChC,OAAO,aAAa,YAAY,aAAa;CAC/C,QAAQ;EACN,OAAO;CACT;AACF;AAEA,MAAa,gBAAgB,QAAkC;CAC7D,IAAI,UAAU,GAAG,GACf,OAAO,KAAK,KAAK,UAAU,qBAAqB;AAEpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "type": "module",
6
6
  "main": "./dist/esm/index.js",
@@ -21,6 +21,11 @@
21
21
  "import": "./dist/esm/shared.js",
22
22
  "default": "./dist/esm/shared.js"
23
23
  },
24
+ "./queries": {
25
+ "types": "./dist/esm/queries/index.d.ts",
26
+ "import": "./dist/esm/queries/index.js",
27
+ "default": "./dist/esm/queries/index.js"
28
+ },
24
29
  "./package.json": "./package.json"
25
30
  },
26
31
  "sideEffects": false,
@@ -52,9 +57,9 @@
52
57
  "dependencies": {
53
58
  "@emotion/react": "^11.14.0",
54
59
  "@emotion/styled": "^11.14.1",
55
- "@lifi/sdk": "^4.8.0",
56
- "@lifi/wallet-management": "4.3.0",
57
- "@lifi/widget-provider": "4.5.0",
60
+ "@lifi/sdk": "^4.10.0",
61
+ "@lifi/wallet-management": "4.3.1",
62
+ "@lifi/widget-provider": "4.5.1",
58
63
  "@mui/icons-material": "^9.4.0",
59
64
  "@mui/material": "^9.4.0",
60
65
  "@mui/system": "^9.4.0",
@@ -82,6 +87,9 @@
82
87
  ],
83
88
  "shared": [
84
89
  "./dist/esm/shared.d.ts"
90
+ ],
91
+ "queries": [
92
+ "./dist/esm/queries/index.d.ts"
85
93
  ]
86
94
  }
87
95
  },
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget'
2
- export const version = '4.7.0'
2
+ export const version = '4.8.0'