@rango-dev/widget-embedded 0.14.1-next.13 → 0.14.1-next.15
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.
- package/dist/Widget.d.ts.map +1 -1
- package/dist/constants/errors.d.ts +1 -1
- package/dist/constants/errors.d.ts.map +1 -1
- package/dist/constants/languages.d.ts +11 -0
- package/dist/constants/languages.d.ts.map +1 -0
- package/dist/constants/messages.d.ts +1 -1
- package/dist/constants/messages.d.ts.map +1 -1
- package/dist/hooks/useLanguage.d.ts +11 -0
- package/dist/hooks/useLanguage.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/pages/LanguagePage.d.ts.map +1 -1
- package/dist/store/settings.d.ts +10 -6
- package/dist/store/settings.d.ts.map +1 -1
- package/dist/types/config.d.ts +3 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/Widget.tsx +10 -1
- package/src/components/NoRoutes/NoRoutes.helper.ts +4 -4
- package/src/components/NoRoutes/NoRoutes.tsx +1 -1
- package/src/components/RouteErrors/RouteErrors.tsx +2 -2
- package/src/components/RouteErrors/RouteErrorsModal.tsx +6 -6
- package/src/constants/errors.ts +43 -41
- package/src/constants/languages.ts +19 -0
- package/src/constants/messages.ts +7 -5
- package/src/hooks/useConfirmSwap.ts +1 -1
- package/src/hooks/useLanguage.ts +27 -0
- package/src/pages/Home.tsx +2 -2
- package/src/pages/LanguagePage.tsx +16 -39
- package/src/store/settings.ts +12 -3
- package/src/types/config.ts +3 -0
- package/src/utils/settings.ts +1 -1
- package/src/utils/swap.ts +10 -10
package/src/utils/swap.ts
CHANGED
|
@@ -131,7 +131,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
131
131
|
symbol: swap.from.symbol,
|
|
132
132
|
},
|
|
133
133
|
});
|
|
134
|
-
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
134
|
+
recommendation = errorMessages().bridgeLimitErrors.increaseAmount;
|
|
135
135
|
} else if (isExclusive && !!minimum && minimum.gte(swap.fromAmount)) {
|
|
136
136
|
fromAmountRangeError = i18n.t({
|
|
137
137
|
id: 'requiredMin',
|
|
@@ -145,7 +145,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
145
145
|
symbol: swap.from.symbol,
|
|
146
146
|
},
|
|
147
147
|
});
|
|
148
|
-
recommendation = errorMessages.bridgeLimitErrors.increaseAmount;
|
|
148
|
+
recommendation = errorMessages().bridgeLimitErrors.increaseAmount;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
if (!isExclusive && !!maximum && maximum.lt(swap.fromAmount)) {
|
|
@@ -161,7 +161,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
161
161
|
symbol: swap.from.symbol,
|
|
162
162
|
},
|
|
163
163
|
});
|
|
164
|
-
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
164
|
+
recommendation = errorMessages().bridgeLimitErrors.decreaseAmount;
|
|
165
165
|
} else if (isExclusive && !!maximum && maximum.lte(swap.fromAmount)) {
|
|
166
166
|
fromAmountRangeError = i18n.t({
|
|
167
167
|
id: 'requiredMax',
|
|
@@ -175,7 +175,7 @@ export function LimitErrorMessage(bestRoute: BestRouteResponse | null): {
|
|
|
175
175
|
symbol: swap.from.symbol,
|
|
176
176
|
},
|
|
177
177
|
});
|
|
178
|
-
recommendation = errorMessages.bridgeLimitErrors.decreaseAmount;
|
|
178
|
+
recommendation = errorMessages().bridgeLimitErrors.decreaseAmount;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
return { swap, fromAmountRangeError, recommendation };
|
|
@@ -194,14 +194,14 @@ export function getSwapButtonState(
|
|
|
194
194
|
): SwapButtonState {
|
|
195
195
|
if (loadingMetaStatus !== 'success') {
|
|
196
196
|
return {
|
|
197
|
-
title: swapButtonTitles.connectWallet,
|
|
197
|
+
title: swapButtonTitles().connectWallet,
|
|
198
198
|
state: ButtonState.WAITFORCONNECTING,
|
|
199
199
|
disabled: true,
|
|
200
200
|
};
|
|
201
201
|
}
|
|
202
202
|
if (connectedWallets.length == 0) {
|
|
203
203
|
return {
|
|
204
|
-
title: swapButtonTitles.connectWallet,
|
|
204
|
+
title: swapButtonTitles().connectWallet,
|
|
205
205
|
state: ButtonState.WAITFORCONNECTING,
|
|
206
206
|
disabled: false,
|
|
207
207
|
};
|
|
@@ -215,27 +215,27 @@ export function getSwapButtonState(
|
|
|
215
215
|
inputAmount === '0'
|
|
216
216
|
) {
|
|
217
217
|
return {
|
|
218
|
-
title: swapButtonTitles.swap,
|
|
218
|
+
title: swapButtonTitles().swap,
|
|
219
219
|
disabled: true,
|
|
220
220
|
state: ButtonState.SWAP,
|
|
221
221
|
};
|
|
222
222
|
} else if (highValueLoss || priceImpactCanNotBeComputed) {
|
|
223
223
|
return {
|
|
224
|
-
title: swapButtonTitles.swapAnyway,
|
|
224
|
+
title: swapButtonTitles().swapAnyway,
|
|
225
225
|
disabled: false,
|
|
226
226
|
hasWarning: true,
|
|
227
227
|
state: ButtonState.NEEDTOCONFIRM,
|
|
228
228
|
};
|
|
229
229
|
} else if (needsToWarnEthOnPath) {
|
|
230
230
|
return {
|
|
231
|
-
title: swapButtonTitles.ethRouteWarning,
|
|
231
|
+
title: swapButtonTitles().ethRouteWarning,
|
|
232
232
|
disabled: false,
|
|
233
233
|
hasWarning: true,
|
|
234
234
|
state: ButtonState.WARNING,
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
237
|
return {
|
|
238
|
-
title: swapButtonTitles.swap,
|
|
238
|
+
title: swapButtonTitles().swap,
|
|
239
239
|
disabled: false,
|
|
240
240
|
state: ButtonState.SWAP,
|
|
241
241
|
};
|