@rango-dev/widget-embedded 0.17.1-next.26 → 0.17.1-next.27

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 (52) hide show
  1. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  2. package/dist/components/Layout/Layout.d.ts.map +1 -1
  3. package/dist/components/NoResult/NoResult.d.ts.map +1 -1
  4. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  5. package/dist/containers/App/App.d.ts.map +1 -1
  6. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  7. package/dist/hooks/useLanguage.d.ts.map +1 -1
  8. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  9. package/dist/hooks/useTheme.d.ts +1 -1
  10. package/dist/hooks/useTheme.d.ts.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +4 -4
  13. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  14. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  15. package/dist/pages/SettingsPage.d.ts.map +1 -1
  16. package/dist/pages/ThemePage.d.ts.map +1 -1
  17. package/dist/store/AppStore.d.ts +37 -1
  18. package/dist/store/AppStore.d.ts.map +1 -1
  19. package/dist/store/app.d.ts +39 -2
  20. package/dist/store/app.d.ts.map +1 -1
  21. package/dist/store/slices/settings.d.ts +39 -0
  22. package/dist/store/slices/settings.d.ts.map +1 -0
  23. package/dist/types/config.d.ts +28 -9
  24. package/dist/types/config.d.ts.map +1 -1
  25. package/dist/utils/settings.d.ts +4 -1
  26. package/dist/utils/settings.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
  29. package/src/components/Layout/Layout.tsx +11 -1
  30. package/src/components/NoResult/NoResult.tsx +2 -5
  31. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +2 -2
  32. package/src/components/Slippage/Slippage.tsx +3 -5
  33. package/src/containers/App/App.tsx +0 -2
  34. package/src/containers/Wallets/Wallets.tsx +2 -1
  35. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +4 -4
  36. package/src/hooks/useLanguage.ts +2 -3
  37. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +2 -2
  38. package/src/hooks/useSwapInput.ts +4 -4
  39. package/src/hooks/useSyncStoresWithConfig.ts +1 -2
  40. package/src/hooks/useTheme.ts +4 -5
  41. package/src/pages/ConfirmSwapPage.tsx +2 -3
  42. package/src/pages/LiquiditySourcePage.tsx +3 -3
  43. package/src/pages/SettingsPage.tsx +22 -11
  44. package/src/pages/ThemePage.tsx +2 -3
  45. package/src/store/AppStore.tsx +7 -1
  46. package/src/store/app.ts +31 -5
  47. package/src/store/slices/settings.ts +168 -0
  48. package/src/types/config.ts +38 -8
  49. package/src/utils/settings.ts +11 -5
  50. package/dist/store/settings.d.ts +0 -83
  51. package/dist/store/settings.d.ts.map +0 -1
  52. package/src/store/settings.ts +0 -161
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAqD5E,wBAAgB,eAAe,sBA4S9B"}
1
+ {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAqD5E,wBAAgB,eAAe,sBA2S9B"}
@@ -1 +1 @@
1
- {"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgBxC,UAAU,SAAS;IACjB,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,qBAoH5D"}
1
+ {"version":3,"file":"LiquiditySourcePage.d.ts","sourceRoot":"","sources":["../../src/pages/LiquiditySourcePage.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAexC,UAAU,SAAS;IACjB,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;CACrC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,qBAqH5D"}
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,wBAAgB,YAAY,sBA+J3B"}
1
+ {"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,wBAAgB,YAAY,sBA2K3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePage.d.ts","sourceRoot":"","sources":["../../src/pages/ThemePage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,wBAAgB,SAAS,sBAkExB"}
1
+ {"version":3,"file":"ThemePage.d.ts","sourceRoot":"","sources":["../../src/pages/ThemePage.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,wBAAgB,SAAS,sBAiExB"}
@@ -4,7 +4,43 @@ import React from 'react';
4
4
  type AppStoreProviderProps = PropsWithChildren<{
5
5
  config?: WidgetConfig;
6
6
  }>;
7
- export declare const AppStoreContext: React.Context<import("zustand").UseBoundStore<import("zustand").StoreApi<import("./app").AppStoreState>> | null>;
7
+ export declare const AppStoreContext: React.Context<import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<import("./app").AppStoreState>, "persist"> & {
8
+ persist: {
9
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<import("./app").AppStoreState, {
10
+ theme: import("./slices/settings").ThemeMode;
11
+ language: "en" | "es" | "ja" | "fr";
12
+ affiliatePercent: number | null;
13
+ affiliateRef: string | null;
14
+ affiliateWallets: {
15
+ [key: string]: string;
16
+ } | null;
17
+ slippage: number;
18
+ customSlippage: number | null;
19
+ infiniteApprove: boolean;
20
+ preferredBlockchains: string[];
21
+ disabledLiquiditySources: string[];
22
+ }>>) => void;
23
+ clearStorage: () => void;
24
+ rehydrate: () => void | Promise<void>;
25
+ hasHydrated: () => boolean;
26
+ onHydrate: (fn: (state: import("./app").AppStoreState) => void) => () => void;
27
+ onFinishHydration: (fn: (state: import("./app").AppStoreState) => void) => () => void;
28
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<import("./app").AppStoreState, {
29
+ theme: import("./slices/settings").ThemeMode;
30
+ language: "en" | "es" | "ja" | "fr";
31
+ affiliatePercent: number | null;
32
+ affiliateRef: string | null;
33
+ affiliateWallets: {
34
+ [key: string]: string;
35
+ } | null;
36
+ slippage: number;
37
+ customSlippage: number | null;
38
+ infiniteApprove: boolean;
39
+ preferredBlockchains: string[];
40
+ disabledLiquiditySources: string[];
41
+ }>>;
42
+ };
43
+ }> | null>;
8
44
  export declare function useAppStore(): import("./app").AppStoreState;
9
45
  export declare function AppStoreProvider(props: AppStoreProviderProps): React.JSX.Element;
10
46
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"AppStore.d.ts","sourceRoot":"","sources":["../../src/store/AppStore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAA4C,MAAM,OAAO,CAAC;AAKjE,KAAK,qBAAqB,GAAG,iBAAiB,CAAC;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;AAE1E,eAAO,MAAM,eAAe,kHAAuC,CAAC;AAEpE,wBAAgB,WAAW,kCAQ1B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAY5D"}
1
+ {"version":3,"file":"AppStore.d.ts","sourceRoot":"","sources":["../../src/store/AppStore.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,OAAO,KAAuD,MAAM,OAAO,CAAC;AAK5E,KAAK,qBAAqB,GAAG,iBAAiB,CAAC;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC,CAAC;AAE1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAAuC,CAAC;AAEpE,wBAAgB,WAAW,kCAc1B;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAY5D"}
@@ -1,8 +1,45 @@
1
1
  import type { ConfigSlice } from './slices/config';
2
2
  import type { DataSlice } from './slices/data';
3
+ import type { SettingsSlice } from './slices/settings';
3
4
  import type { WidgetConfig } from '../types';
4
5
  import type { StateCreator } from 'zustand';
5
6
  export type StateCreatorWithInitialData<T extends Partial<WidgetConfig>, R extends Record<string, unknown>, V extends Record<string, unknown>> = (initialData: T | undefined, ...rest: Parameters<StateCreator<R, [], [], V>>) => ReturnType<StateCreator<R, [], [], V>>;
6
- export type AppStoreState = DataSlice & ConfigSlice;
7
- export declare function createAppStore(initialData?: WidgetConfig): import("zustand").UseBoundStore<import("zustand").StoreApi<AppStoreState>>;
7
+ export type AppStoreState = DataSlice & ConfigSlice & SettingsSlice;
8
+ export declare function createAppStore(initialData?: WidgetConfig): import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<AppStoreState>, "persist"> & {
9
+ persist: {
10
+ setOptions: (options: Partial<import("zustand/middleware").PersistOptions<AppStoreState, {
11
+ theme: import("./slices/settings").ThemeMode;
12
+ language: "en" | "es" | "ja" | "fr";
13
+ affiliatePercent: number | null;
14
+ affiliateRef: string | null;
15
+ affiliateWallets: {
16
+ [key: string]: string;
17
+ } | null;
18
+ slippage: number;
19
+ customSlippage: number | null;
20
+ infiniteApprove: boolean;
21
+ preferredBlockchains: string[];
22
+ disabledLiquiditySources: string[];
23
+ }>>) => void;
24
+ clearStorage: () => void;
25
+ rehydrate: () => void | Promise<void>;
26
+ hasHydrated: () => boolean;
27
+ onHydrate: (fn: (state: AppStoreState) => void) => () => void;
28
+ onFinishHydration: (fn: (state: AppStoreState) => void) => () => void;
29
+ getOptions: () => Partial<import("zustand/middleware").PersistOptions<AppStoreState, {
30
+ theme: import("./slices/settings").ThemeMode;
31
+ language: "en" | "es" | "ja" | "fr";
32
+ affiliatePercent: number | null;
33
+ affiliateRef: string | null;
34
+ affiliateWallets: {
35
+ [key: string]: string;
36
+ } | null;
37
+ slippage: number;
38
+ customSlippage: number | null;
39
+ infiniteApprove: boolean;
40
+ preferredBlockchains: string[];
41
+ disabledLiquiditySources: string[];
42
+ }>>;
43
+ };
44
+ }>;
8
45
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../src/store/app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAO5C,MAAM,MAAM,2BAA2B,CACrC,CAAC,SAAS,OAAO,CAAC,YAAY,CAAC,EAC/B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAC/B,CACF,WAAW,EAAE,CAAC,GAAG,SAAS,EAC1B,GAAG,IAAI,EAAE,UAAU,CAAC,Y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 import type { ConfigSlice } from './config';
2
+ import type { WidgetConfig } from '../../types';
3
+ import type { SwapperMeta } from 'rango-sdk';
4
+ import type { StateCreator } from 'zustand';
5
+ import { type Language } from '@rango-dev/ui';
6
+ export type ThemeMode = 'auto' | 'dark' | 'light';
7
+ export interface SettingsSlice {
8
+ theme: ThemeMode;
9
+ language: Language;
10
+ disabledLiquiditySources: string[];
11
+ /** Keeping a history of blockchains that user has selected (in Swap process) */
12
+ preferredBlockchains: string[];
13
+ slippage: number;
14
+ customSlippage: number | null;
15
+ infiniteApprove: boolean;
16
+ affiliateRef: string | null;
17
+ affiliatePercent: number | null;
18
+ affiliateWallets: {
19
+ [key: string]: string;
20
+ } | null;
21
+ setSlippage: (slippage: number) => void;
22
+ setCustomSlippage: (customSlippage: number | null) => void;
23
+ toggleInfiniteApprove: () => void;
24
+ toggleLiquiditySource: (name: string) => void;
25
+ setTheme: (theme: ThemeMode) => void;
26
+ setLanguage: (language: Language) => void;
27
+ toggleAllLiquiditySources: (swappers: SwapperMeta[], shouldReset?: boolean) => void;
28
+ setAffiliateRef: (affiliateRef: string | null) => void;
29
+ setAffiliatePercent: (affiliatePercent: number | null) => void;
30
+ setAffiliateWallets: (affiliateWallets: {
31
+ [key: string]: string;
32
+ } | null) => void;
33
+ addPreferredBlockchain: (blockchain: string) => void;
34
+ updateSettings: (config: WidgetConfig) => void;
35
+ }
36
+ export declare const createSettingsSlice: StateCreator<SettingsSlice & ConfigSlice, [
37
+ ], [
38
+ ], SettingsSlice>;
39
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../src/store/slices/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO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AK,IAAI,CAAC;IAC/D,mBAAmB,EAAE,CACnB,gBAAgB,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,IAAI,KAC/C,IAAI,CAAC;IACV,sBAAsB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,cAAc,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;CAChD;AAED,eAAO,MAAM,mBAAmB,EAAE,YAAY,CAC5C,aAAa,GAAG,WAAW,EAC3B;CAAE,EACF;CAAE,EACF,aAAa,CAoHb,CAAC"}
@@ -86,14 +86,27 @@ export type BlockchainAndTokenConfig = {
86
86
  tokens?: Asset[];
87
87
  };
88
88
  /**
89
- * `ExperimentalFeatures`
89
+ * `Features`
90
90
  *
91
- * @property {boolean} routing
92
- *- This property is optional and sets experimental in quote api.
91
+ * @property {'visible' | 'hidden'} [theme]
92
+ * - The visibility state for the theme feature. Optional property.
93
+ *
94
+ * @property {'visible' | 'hidden'} [language]
95
+ * - The visibility state for the language feature. Optional property.
96
+ *
97
+ * @property {'disabled' | 'enabled'} [experimentalRoute]
98
+ * - The enablement state for the experimental route feature. Optional property.
99
+ *
100
+ * @property {'visible' | 'hidden'} [connectWalletButton]
101
+ * - The visibility state for the connect wallet button feature. Optional property.
102
+ *
103
+ * @property {'visible' | 'hidden'} [notification]
104
+ * - The visibility state for the notification feature. Optional property.
105
+ *
106
+ * @property {'visible' | 'hidden'} [liquiditySource]
107
+ * - The visibility state for the liquiditySource feature. Optional property.
93
108
  */
94
- type ExperimentalFeatures = {
95
- routing?: boolean;
96
- };
109
+ export type Features = Partial<Record<'theme' | 'language' | 'connectWalletButton' | 'notification' | 'liquiditySource', 'visible' | 'hidden'>> & Partial<Record<'experimentalRoute', 'disabled' | 'enabled'>>;
97
110
  /**
98
111
  * The type WidgetConfig defines the configuration options for a widget, including API key, affiliate
99
112
  * reference, amount, blockchain and token configurations, liquidity sources, wallet types, language,
@@ -133,7 +146,14 @@ type ExperimentalFeatures = {
133
146
  * you could use to pin tokens of your choice to the top of the token list.
134
147
  * @property {boolean} enableNewLiquiditySources - The `enableNewLiquiditySources` property is a boolean value that when you
135
148
  * set it to true, whenever a new liquidity source is added, it will be added to your list as well.
136
- * @property {ExperimentalFeatures} experimental - The `experimental` property is an optional object that specifies some experimental features.
149
+ * @property {Features} features - An optional object for configuring the visibility or enablement of various features.
150
+ * Keys include:
151
+ * - 'notification': Visibility state for the notification icon.
152
+ * - 'theme': Visibility state for the theme.
153
+ * - 'liquiditySource': Visibility state for liquidity source.
154
+ * - 'connectWalletButton': Visibility state for the wallet connect icon.
155
+ * - 'language': Visibility state for the language.
156
+ * - 'experimentalRoute': Enablement state for the experimental route.
137
157
  */
138
158
  export type WidgetConfig = {
139
159
  apiKey: string;
@@ -152,7 +172,6 @@ export type WidgetConfig = {
152
172
  externalWallets?: boolean;
153
173
  pinnedTokens?: Asset[];
154
174
  enableNewLiquiditySources?: boolean;
155
- experimental?: ExperimentalFeatures;
175
+ features?: Features;
156
176
  };
157
- export {};
158
177
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC;AAClD,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,EAAE,CAAC,EAAE,wBAAwB,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,iBAAiB,CAAC,EAAE,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC;IACvB,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { Features } from '../types';
1
2
  import type { SwapperMeta } from 'rango-sdk';
2
3
  export type LiquiditySourceType = 'BRIDGE' | 'AGGREGATOR' | 'DEX';
3
4
  export type UniqueSwappersGroupType = {
@@ -7,6 +8,8 @@ export type UniqueSwappersGroupType = {
7
8
  type: LiquiditySourceType;
8
9
  selected: boolean;
9
10
  };
10
- export declare function getUniqueSwappersGroups(swappers: SwapperMeta[]): UniqueSwappersGroupType[];
11
+ export declare function getUniqueSwappersGroups(swappers: SwapperMeta[], disabledLiquiditySources: string[]): UniqueSwappersGroupType[];
11
12
  export declare function sortLiquiditySourcesByGroupTitle(a: SwapperMeta, b: SwapperMeta): 1 | -1 | 0;
13
+ export declare function isFeatureHidden(feature: keyof Features, features?: Features): boolean;
14
+ export declare function isFeatureEnabled(feature: keyof Features, features?: Features): boolean;
12
15
  //# sourceMappingURL=settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAM7C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,EAAE,GACtB,uBAAuB,EAAE,CAuC3B;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,cAWf"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/utils/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,CAAC;AAElE,MAAM,MAAM,uBAAuB,GAAG;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,WAAW,EAAE,EACvB,wBAAwB,EAAE,MAAM,EAAE,GACjC,uBAAuB,EAAE,CAqC3B;AAED,wBAAgB,gCAAgC,CAC9C,CAAC,EAAE,WAAW,EACd,CAAC,EAAE,WAAW,cAWf;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ,WAE3E;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,QAAQ,EAAE,QAAQ,CAAC,EAAE,QAAQ,WAE5E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.17.1-next.26",
3
+ "version": "0.17.1-next.27",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -11,7 +11,9 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React from 'react';
13
13
 
14
+ import { useAppStore } from '../../store/AppStore';
14
15
  import { getContainer } from '../../utils/common';
16
+ import { isFeatureHidden } from '../../utils/settings';
15
17
  import { NotificationContent } from '../NotificationContent';
16
18
 
17
19
  import { HeaderButton } from './HeaderButtons.styles';
@@ -26,6 +28,12 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
26
28
  onClickNotifications,
27
29
  } = props;
28
30
 
31
+ const {
32
+ config: { features },
33
+ } = useAppStore();
34
+
35
+ const isNotificationsHidden = isFeatureHidden('notification', features);
36
+
29
37
  return (
30
38
  <>
31
39
  <Tooltip
@@ -41,25 +49,27 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
41
49
  </HeaderButton>
42
50
  </Tooltip>
43
51
 
44
- <Tooltip
45
- container={getContainer()}
46
- side="top"
47
- content={i18n.t('Notifications')}>
48
- <Popover
49
- align="center"
50
- collisionBoundary={layoutRef}
51
- collisionPadding={{ right: 20, left: 20 }}
52
+ {!isNotificationsHidden && (
53
+ <Tooltip
52
54
  container={getContainer()}
53
- content={<NotificationContent />}>
54
- <HeaderButton
55
- size="small"
56
- variant="ghost"
57
- onClick={onClickNotifications}>
58
- <NotificationsIcon size={18} color="black" />
59
- <UnreadNotificationsBadge />
60
- </HeaderButton>
61
- </Popover>
62
- </Tooltip>
55
+ side="top"
56
+ content={i18n.t('Notifications')}>
57
+ <Popover
58
+ align="center"
59
+ collisionBoundary={layoutRef}
60
+ collisionPadding={{ right: 20, left: 20 }}
61
+ container={getContainer()}
62
+ content={<NotificationContent />}>
63
+ <HeaderButton
64
+ size="small"
65
+ variant="ghost"
66
+ onClick={onClickNotifications}>
67
+ <NotificationsIcon size={18} color="black" />
68
+ <UnreadNotificationsBadge />
69
+ </HeaderButton>
70
+ </Popover>
71
+ </Tooltip>
72
+ )}
63
73
  <Tooltip
64
74
  container={getContainer()}
65
75
  side="top"
@@ -5,9 +5,11 @@ import { BottomLogo, Divider, Header } from '@rango-dev/ui';
5
5
  import React from 'react';
6
6
 
7
7
  import { useNavigateBack } from '../../hooks/useNavigateBack';
8
+ import { useAppStore } from '../../store/AppStore';
8
9
  import { useUiStore } from '../../store/ui';
9
10
  import { useWalletsStore } from '../../store/wallets';
10
11
  import { getContainer } from '../../utils/common';
12
+ import { isFeatureHidden } from '../../utils/settings';
11
13
  import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
12
14
 
13
15
  import { Container, Content, Footer } from './Layout.styles';
@@ -22,6 +24,14 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
22
24
  fixedHeight = true,
23
25
  } = props;
24
26
  const connectedWallets = useWalletsStore.use.connectedWallets();
27
+ const {
28
+ config: { features },
29
+ } = useAppStore();
30
+
31
+ const isConnectWalletHidden = isFeatureHidden(
32
+ 'connectWalletButton',
33
+ features
34
+ );
25
35
 
26
36
  const connectWalletsButtonDisabled =
27
37
  useUiStore.use.connectWalletsButtonDisabled();
@@ -44,7 +54,7 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
44
54
  suffix={
45
55
  <>
46
56
  {header.suffix}
47
- {header.onWallet && (
57
+ {header.onWallet && !isConnectWalletHidden && (
48
58
  <WalletButton
49
59
  container={getContainer()}
50
60
  onClick={onConnectWallet}
@@ -12,17 +12,14 @@ import React from 'react';
12
12
 
13
13
  import { errorMessages } from '../../constants/errors';
14
14
  import { useAppStore } from '../../store/AppStore';
15
- import { useSettingsStore } from '../../store/settings';
16
15
 
17
16
  import { makeInfo } from './NoResult.helpers';
18
17
  import { Container, Footer, PrefixIcon } from './NoResult.styles';
19
18
 
20
19
  export function NoResult(props: PropTypes) {
21
20
  const { fetch, error } = props;
22
- const disabledLiquiditySources =
23
- useSettingsStore.use.disabledLiquiditySources();
24
- const toggleAllLiquiditySources =
25
- useSettingsStore.use.toggleAllLiquiditySources();
21
+ const disabledLiquiditySources = useAppStore().disabledLiquiditySources;
22
+ const toggleAllLiquiditySources = useAppStore().toggleAllLiquiditySources;
26
23
 
27
24
  const swappers = useAppStore().swappers();
28
25
 
@@ -9,7 +9,7 @@ import React from 'react';
9
9
  import { useNavigate } from 'react-router-dom';
10
10
 
11
11
  import { navigationRoutes } from '../../constants/navigationRoutes';
12
- import { useSettingsStore } from '../../store/settings';
12
+ import { useAppStore } from '../../store/AppStore';
13
13
  import { QuoteWarningType } from '../../types';
14
14
  import { getContainer } from '../../utils/common';
15
15
 
@@ -21,7 +21,7 @@ type PropsTypes = {
21
21
  };
22
22
 
23
23
  export function SlippageWarningModal(props: PropsTypes) {
24
- const { customSlippage, slippage } = useSettingsStore();
24
+ const { customSlippage, slippage } = useAppStore();
25
25
  const { open, onClose, onConfirm, warning } = props;
26
26
  const navigate = useNavigate();
27
27
  const userSlippage = customSlippage ?? slippage;
@@ -14,17 +14,15 @@ import {
14
14
  MIN_SLIPPGAE,
15
15
  SLIPPAGES,
16
16
  } from '../../constants/swapSettings';
17
- import { useSettingsStore } from '../../store/settings';
17
+ import { useAppStore } from '../../store/AppStore';
18
18
  import { getContainer } from '../../utils/common';
19
19
 
20
20
  import { BaseContainer, Head, SlippageChipsContainer } from './Slippage.styles';
21
21
  import { SlippageTooltipContent } from './SlippageTooltipContent';
22
22
 
23
23
  export function Slippage() {
24
- const slippage = useSettingsStore.use.slippage();
25
- const setSlippage = useSettingsStore.use.setSlippage();
26
- const customSlippage = useSettingsStore.use.customSlippage();
27
- const setCustomSlippage = useSettingsStore.use.setCustomSlippage();
24
+ const { slippage, setSlippage, customSlippage, setCustomSlippage } =
25
+ useAppStore();
28
26
 
29
27
  return (
30
28
  <BaseContainer>
@@ -11,7 +11,6 @@ import { useLanguage } from '../../hooks/useLanguage';
11
11
  import { useTheme } from '../../hooks/useTheme';
12
12
  import { useAppStore } from '../../store/AppStore';
13
13
  import { useNotificationStore } from '../../store/notification';
14
- import { useSettingsStore } from '../../store/settings';
15
14
  import { WidgetContext } from '../Wallets';
16
15
 
17
16
  import { MainContainer } from './App.styles';
@@ -29,7 +28,6 @@ export function Main() {
29
28
 
30
29
  useEffect(() => {
31
30
  void fetchMeta().catch();
32
- void useSettingsStore.persist.rehydrate();
33
31
  void useNotificationStore.persist.rehydrate();
34
32
  widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
35
33
  }, []);
@@ -28,7 +28,7 @@ export const WidgetContext = createContext<WidgetContextInterface>({
28
28
  });
29
29
 
30
30
  function Main(props: PropsWithChildren<PropTypes>) {
31
- const { updateConfig } = useAppStore();
31
+ const { updateConfig, updateSettings } = useAppStore();
32
32
  const blockchains = useAppStore().blockchains();
33
33
  const tokens = useAppStore().tokens();
34
34
  const walletOptions: ProvidersOptions = {
@@ -42,6 +42,7 @@ function Main(props: PropsWithChildren<PropTypes>) {
42
42
  useEffect(() => {
43
43
  if (props.config) {
44
44
  updateConfig(props.config);
45
+ updateSettings(props.config);
45
46
  }
46
47
  }, [props.config]);
47
48
 
@@ -7,8 +7,8 @@ import { useEffect } from 'react';
7
7
 
8
8
  import { useAppStore } from '../../store/AppStore';
9
9
  import { useQuoteStore } from '../../store/quote';
10
- import { useSettingsStore } from '../../store/settings';
11
10
  import { useWalletsStore } from '../../store/wallets';
11
+ import { isFeatureEnabled } from '../../utils/settings';
12
12
  import { createQuoteRequestBody, getWalletsForNewSwap } from '../../utils/swap';
13
13
  import { useFetchQuote } from '../useFetchQuote';
14
14
 
@@ -36,11 +36,11 @@ export function useConfirmSwap(): ConfirmSwap {
36
36
  affiliateRef,
37
37
  affiliateWallets,
38
38
  disabledLiquiditySources,
39
- } = useSettingsStore();
39
+ } = useAppStore();
40
40
  const { connectedWallets } = useWalletsStore();
41
41
  const blockchains = useAppStore().blockchains();
42
42
  const tokens = useAppStore().tokens();
43
- const { experimental } = useAppStore().config;
43
+ const { features } = useAppStore().config;
44
44
  const { enableNewLiquiditySources } = useAppStore().config;
45
45
 
46
46
  const userSlippage = customSlippage || slippage;
@@ -78,7 +78,7 @@ export function useConfirmSwap(): ConfirmSwap {
78
78
  initialQuote: initialQuote ?? undefined,
79
79
  destination: customDestination,
80
80
  });
81
- if (experimental?.routing) {
81
+ if (isFeatureEnabled('experimentalRoute', features)) {
82
82
  requestBody.experimental = true;
83
83
  }
84
84
  let currentQuote: BestRouteResponse;
@@ -3,7 +3,7 @@ import type { LanguageItem } from '../constants/languages';
3
3
  import { type Language } from '@rango-dev/ui';
4
4
 
5
5
  import { DEFAULT_LANGUAGE, LANGUAGES } from '../constants/languages';
6
- import { useSettingsStore } from '../store/settings';
6
+ import { useAppStore } from '../store/AppStore';
7
7
 
8
8
  interface UseLanguage {
9
9
  languages: LanguageItem[];
@@ -13,8 +13,7 @@ interface UseLanguage {
13
13
  }
14
14
 
15
15
  export function useLanguage(): UseLanguage {
16
- const language = useSettingsStore.use.language();
17
- const setLanguage = useSettingsStore.use.setLanguage();
16
+ const { setLanguage, language } = useAppStore();
18
17
  const languages = LANGUAGES;
19
18
  const defaultLanguage = DEFAULT_LANGUAGE;
20
19
 
@@ -6,7 +6,7 @@ import type { BlockchainMeta } from 'rango-sdk';
6
6
 
7
7
  import { useEffect } from 'react';
8
8
 
9
- import { useSettingsStore } from '../../store/settings';
9
+ import { useAppStore } from '../../store/AppStore';
10
10
 
11
11
  import { isInVisibleList, prepare } from './usePrepareBlockchainList.helpers';
12
12
 
@@ -20,7 +20,7 @@ export function usePrepareBlockchainList(
20
20
  blockchains: BlockchainMeta[],
21
21
  options?: PrepareListOptions
22
22
  ): UsePrepareList {
23
- const { preferredBlockchains, addPreferredBlockchain } = useSettingsStore();
23
+ const { preferredBlockchains, addPreferredBlockchain } = useAppStore();
24
24
 
25
25
  useEffect(() => {
26
26
  if (options?.selected) {
@@ -5,11 +5,11 @@ import { useCallback, useEffect, useState } from 'react';
5
5
 
6
6
  import { useAppStore } from '../store/AppStore';
7
7
  import { useQuoteStore } from '../store/quote';
8
- import { useSettingsStore } from '../store/settings';
9
8
  import { QuoteErrorType } from '../types';
10
9
  import { debounce } from '../utils/common';
11
10
  import { isPositiveNumber } from '../utils/numbers';
12
11
  import { generateQuoteWarnings } from '../utils/quote';
12
+ import { isFeatureEnabled } from '../utils/settings';
13
13
  import { createQuoteRequestBody } from '../utils/swap';
14
14
  import { tokensAreEqual } from '../utils/wallets';
15
15
 
@@ -40,7 +40,7 @@ type UseSwapInput = {
40
40
  */
41
41
  export function useSwapInput(): UseSwapInput {
42
42
  const { fetch: fetchQuote, cancelFetch } = useFetchQuote();
43
- const { liquiditySources, enableNewLiquiditySources, experimental } =
43
+ const { liquiditySources, enableNewLiquiditySources, features } =
44
44
  useAppStore().config;
45
45
  const tokens = useAppStore().tokens();
46
46
  const {
@@ -58,7 +58,7 @@ export function useSwapInput(): UseSwapInput {
58
58
  affiliateRef,
59
59
  affiliateWallets,
60
60
  disabledLiquiditySources,
61
- } = useSettingsStore();
61
+ } = useAppStore();
62
62
  const [loading, setLoading] = useState(false);
63
63
  const [error, setError] = useState<QuoteError | null>(null);
64
64
  const [warning, setWarning] = useState<QuoteWarning | null>(null);
@@ -105,7 +105,7 @@ export function useSwapInput(): UseSwapInput {
105
105
  affiliatePercent,
106
106
  affiliateWallets,
107
107
  });
108
- if (experimental?.routing) {
108
+ if (isFeatureEnabled('experimentalRoute', features)) {
109
109
  requestBody.experimental = true;
110
110
  }
111
111
  fetchQuote(requestBody)
@@ -4,7 +4,6 @@ import { useEffect, useLayoutEffect, useMemo, useRef } from 'react';
4
4
 
5
5
  import { useAppStore } from '../store/AppStore';
6
6
  import { useQuoteStore } from '../store/quote';
7
- import { useSettingsStore } from '../store/settings';
8
7
  import { tokensAreEqual } from '../utils/wallets';
9
8
 
10
9
  export function useSyncStoresWithConfig() {
@@ -26,7 +25,7 @@ export function useSyncStoresWithConfig() {
26
25
  const tokens = useAppStore().tokens();
27
26
 
28
27
  const { setAffiliateRef, setAffiliatePercent, setAffiliateWallets } =
29
- useSettingsStore();
28
+ useAppStore();
30
29
 
31
30
  const fromTokensConfig = useMemo(
32
31
  () => config?.from?.tokens,
@@ -1,6 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/no-magic-numbers */
2
- import type { WidgetTheme } from '../types';
3
-
4
2
  import {
5
3
  createTheme,
6
4
  darkTheme as defaultDarkTheme,
@@ -8,7 +6,8 @@ import {
8
6
  } from '@rango-dev/ui';
9
7
  import { useEffect, useState } from 'react';
10
8
 
11
- import { useSettingsStore } from '../store/settings';
9
+ import { useAppStore } from '../store/AppStore';
10
+ import { type WidgetTheme } from '../types';
12
11
  import {
13
12
  DEFAULT_FONT_FAMILY,
14
13
  DEFAULT_PRIMARY_RADIUS,
@@ -26,8 +25,8 @@ export function useTheme(props: WidgetTheme) {
26
25
  } = props;
27
26
 
28
27
  const [OSTheme, setOSTheme] = useState('light');
29
- const theme = useSettingsStore.use.theme();
30
- const setTheme = useSettingsStore.use.setTheme();
28
+
29
+ const { setTheme, theme } = useAppStore();
31
30
 
32
31
  const { dark, light } = customizedThemeTokens(colors);
33
32