@redneckz/wildless-cms-uni-blocks 0.14.899 → 0.14.900
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/bin/migration-scripts/0.14.900.js +18 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +212 -20
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
- package/bundle/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
- package/bundle/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
- package/bundle/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
- package/bundle/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
- package/bundle/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
- package/bundle/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
- package/bundle/components/ExchangeRateTile/calculateResult.d.ts +2 -0
- package/bundle/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
- package/bundle/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
- package/bundle/components/ExchangeRateTile/renderInput.d.ts +11 -0
- package/bundle/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
- package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
- package/dist/components/Blocks.js +2 -0
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/Blocks.mobile.js +2 -0
- package/dist/components/Blocks.mobile.js.map +1 -1
- package/dist/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
- package/dist/components/ExchangeRateTile/CurrencyProps.js +10 -0
- package/dist/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
- package/dist/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
- package/dist/components/ExchangeRateTile/CurrencyTable.js +23 -0
- package/dist/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
- package/dist/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
- package/dist/components/ExchangeRateTile/CurrentLocation.js +10 -0
- package/dist/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
- package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
- package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +73 -0
- package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js +26 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
- package/dist/components/ExchangeRateTile/calculateResult.d.ts +2 -0
- package/dist/components/ExchangeRateTile/calculateResult.js +11 -0
- package/dist/components/ExchangeRateTile/calculateResult.js.map +1 -0
- package/dist/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
- package/dist/components/ExchangeRateTile/callbackCurrencySelect.js +21 -0
- package/dist/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
- package/dist/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
- package/dist/components/ExchangeRateTile/formatCurrency.js +10 -0
- package/dist/components/ExchangeRateTile/formatCurrency.js.map +1 -0
- package/dist/components/ExchangeRateTile/renderInput.d.ts +11 -0
- package/dist/components/ExchangeRateTile/renderInput.js +16 -0
- package/dist/components/ExchangeRateTile/renderInput.js.map +1 -0
- package/dist/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
- package/dist/components/ExchangeRateTile/useFetchExchangeRateData.js +13 -0
- package/dist/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
- package/lib/common.css +1 -1
- package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
- package/lib/components/Blocks.js +2 -0
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/Blocks.mobile.js +2 -0
- package/lib/components/Blocks.mobile.js.map +1 -1
- package/lib/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
- package/lib/components/ExchangeRateTile/CurrencyProps.js +8 -0
- package/lib/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
- package/lib/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
- package/lib/components/ExchangeRateTile/CurrencyTable.js +21 -0
- package/lib/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
- package/lib/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
- package/lib/components/ExchangeRateTile/CurrentLocation.js +8 -0
- package/lib/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
- package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
- package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +71 -0
- package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.fixture.d.ts +5 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.fixture.mobile.d.ts +5 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js +24 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
- package/lib/components/ExchangeRateTile/calculateResult.d.ts +2 -0
- package/lib/components/ExchangeRateTile/calculateResult.js +7 -0
- package/lib/components/ExchangeRateTile/calculateResult.js.map +1 -0
- package/lib/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
- package/lib/components/ExchangeRateTile/callbackCurrencySelect.js +18 -0
- package/lib/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
- package/lib/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
- package/lib/components/ExchangeRateTile/formatCurrency.js +7 -0
- package/lib/components/ExchangeRateTile/formatCurrency.js.map +1 -0
- package/lib/components/ExchangeRateTile/renderInput.d.ts +11 -0
- package/lib/components/ExchangeRateTile/renderInput.js +13 -0
- package/lib/components/ExchangeRateTile/renderInput.js.map +1 -0
- package/lib/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
- package/lib/components/ExchangeRateTile/useFetchExchangeRateData.js +10 -0
- package/lib/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
- package/mobile/bundle/bundle.umd.js +212 -20
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
- package/mobile/bundle/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
- package/mobile/bundle/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
- package/mobile/bundle/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
- package/mobile/bundle/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
- package/mobile/bundle/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
- package/mobile/bundle/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
- package/mobile/bundle/components/ExchangeRateTile/calculateResult.d.ts +2 -0
- package/mobile/bundle/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
- package/mobile/bundle/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
- package/mobile/bundle/components/ExchangeRateTile/renderInput.d.ts +11 -0
- package/mobile/bundle/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
- package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
- package/mobile/dist/components/Blocks.js +2 -0
- package/mobile/dist/components/Blocks.js.map +1 -1
- package/mobile/dist/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
- package/mobile/dist/components/ExchangeRateTile/CurrencyProps.js +10 -0
- package/mobile/dist/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
- package/mobile/dist/components/ExchangeRateTile/CurrencyTable.js +23 -0
- package/mobile/dist/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
- package/mobile/dist/components/ExchangeRateTile/CurrentLocation.js +10 -0
- package/mobile/dist/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +73 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js +26 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
- package/mobile/dist/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/calculateResult.d.ts +2 -0
- package/mobile/dist/components/ExchangeRateTile/calculateResult.js +11 -0
- package/mobile/dist/components/ExchangeRateTile/calculateResult.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
- package/mobile/dist/components/ExchangeRateTile/callbackCurrencySelect.js +21 -0
- package/mobile/dist/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
- package/mobile/dist/components/ExchangeRateTile/formatCurrency.js +10 -0
- package/mobile/dist/components/ExchangeRateTile/formatCurrency.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/renderInput.d.ts +11 -0
- package/mobile/dist/components/ExchangeRateTile/renderInput.js +16 -0
- package/mobile/dist/components/ExchangeRateTile/renderInput.js.map +1 -0
- package/mobile/dist/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
- package/mobile/dist/components/ExchangeRateTile/useFetchExchangeRateData.js +13 -0
- package/mobile/dist/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
- package/mobile/lib/components/Blocks.js +2 -0
- package/mobile/lib/components/Blocks.js.map +1 -1
- package/mobile/lib/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
- package/mobile/lib/components/ExchangeRateTile/CurrencyProps.js +8 -0
- package/mobile/lib/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
- package/mobile/lib/components/ExchangeRateTile/CurrencyTable.js +21 -0
- package/mobile/lib/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
- package/mobile/lib/components/ExchangeRateTile/CurrentLocation.js +8 -0
- package/mobile/lib/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +71 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js +24 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
- package/mobile/lib/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/calculateResult.d.ts +2 -0
- package/mobile/lib/components/ExchangeRateTile/calculateResult.js +7 -0
- package/mobile/lib/components/ExchangeRateTile/calculateResult.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
- package/mobile/lib/components/ExchangeRateTile/callbackCurrencySelect.js +18 -0
- package/mobile/lib/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
- package/mobile/lib/components/ExchangeRateTile/formatCurrency.js +7 -0
- package/mobile/lib/components/ExchangeRateTile/formatCurrency.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/renderInput.d.ts +11 -0
- package/mobile/lib/components/ExchangeRateTile/renderInput.js +13 -0
- package/mobile/lib/components/ExchangeRateTile/renderInput.js.map +1 -0
- package/mobile/lib/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
- package/mobile/lib/components/ExchangeRateTile/useFetchExchangeRateData.js +10 -0
- package/mobile/lib/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
- package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +92 -29
- package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
- package/mobile/src/components/Blocks.ts +2 -0
- package/mobile/src/components/ExchangeRateTile/CurrencyProps.ts +6 -0
- package/mobile/src/components/ExchangeRateTile/CurrencyTable.tsx +64 -0
- package/mobile/src/components/ExchangeRateTile/CurrentLocation.tsx +28 -0
- package/mobile/src/components/ExchangeRateTile/ExchangeCurrencyCalculator.tsx +155 -0
- package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.example.json +12 -0
- package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.tsx +60 -0
- package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.ui.json +8 -0
- package/mobile/src/components/ExchangeRateTile/ExchangeRateTileContent.ts +11 -0
- package/mobile/src/components/ExchangeRateTile/calculateResult.ts +9 -0
- package/mobile/src/components/ExchangeRateTile/callbackCurrencySelect.ts +25 -0
- package/mobile/src/components/ExchangeRateTile/formatCurrency.ts +8 -0
- package/mobile/src/components/ExchangeRateTile/renderInput.tsx +43 -0
- package/mobile/src/components/ExchangeRateTile/useFetchExchangeRateData.ts +25 -0
- package/package.json +2 -2
- package/src/components/ApplicationForm/ApplicationForm.example.json +92 -29
- package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +11 -11
- package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +11 -11
- package/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
- package/src/components/Blocks.mobile.ts +2 -0
- package/src/components/Blocks.ts +2 -0
- package/src/components/ExchangeRateTile/CurrencyProps.ts +6 -0
- package/src/components/ExchangeRateTile/CurrencyTable.tsx +64 -0
- package/src/components/ExchangeRateTile/CurrentLocation.tsx +28 -0
- package/src/components/ExchangeRateTile/ExchangeCurrencyCalculator.tsx +155 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.example.json +12 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.fixture.mobile.tsx +21 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.fixture.tsx +21 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +60 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.ui.json +8 -0
- package/src/components/ExchangeRateTile/ExchangeRateTileContent.ts +11 -0
- package/src/components/ExchangeRateTile/calculateResult.ts +9 -0
- package/src/components/ExchangeRateTile/callbackCurrencySelect.ts +25 -0
- package/src/components/ExchangeRateTile/formatCurrency.ts +8 -0
- package/src/components/ExchangeRateTile/renderInput.tsx +43 -0
- package/src/components/ExchangeRateTile/useFetchExchangeRateData.ts +25 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { tableFunc } from '../../utils/tableFunc.js';
|
|
2
|
+
import { Currency } from './CurrencyProps.js';
|
|
3
|
+
export const callbackCurrencySelect = (props) => tableFunc([
|
|
4
|
+
[
|
|
5
|
+
(_) => _.value !== Currency.RUB && _.oppositeValue !== Currency.RUB,
|
|
6
|
+
() => props.handleConvert(props.value, Currency.RUB),
|
|
7
|
+
],
|
|
8
|
+
[
|
|
9
|
+
(_) => _.value === Currency.RUB && _.oppositeValue === Currency.RUB,
|
|
10
|
+
() => props.handleConvert(props.value, Currency.USD),
|
|
11
|
+
],
|
|
12
|
+
[
|
|
13
|
+
(_) => _.value === Currency.RUB && _.oppositeValue === Currency.RUB,
|
|
14
|
+
() => props.handleConvert(props.value, Currency.CNY),
|
|
15
|
+
],
|
|
16
|
+
[() => true, () => props.handleConvert(props.value)],
|
|
17
|
+
])(props)?.();
|
|
18
|
+
//# sourceMappingURL=callbackCurrencySelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbackCurrencySelect.js","sourceRoot":"","sources":["../../../src/components/ExchangeRateTile/callbackCurrencySelect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQ3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAqB,EAAE,EAAE,CAC9D,SAAS,CAA6B;IACpC;QACE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,aAAa,KAAK,QAAQ,CAAC,GAAG;QACnE,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;KACrD;IACD;QACE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,aAAa,KAAK,QAAQ,CAAC,GAAG;QACnE,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;KACrD;IACD;QACE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,aAAa,KAAK,QAAQ,CAAC,GAAG;QACnE,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;KACrD;IACD,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;CACrD,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatCurrency: (value?: number) => string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Currency } from './CurrencyProps.js';
|
|
2
|
+
const currencyNumberFormat = new Intl.NumberFormat('ru', {
|
|
3
|
+
style: 'currency',
|
|
4
|
+
currency: Currency.RUB,
|
|
5
|
+
});
|
|
6
|
+
export const formatCurrency = (value) => (value ? currencyNumberFormat.format(value) : '');
|
|
7
|
+
//# sourceMappingURL=formatCurrency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatCurrency.js","sourceRoot":"","sources":["../../../src/components/ExchangeRateTile/formatCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,oBAAoB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE;IACvD,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,QAAQ,CAAC,GAAG;CACvB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ControlProps } from '../../model/ControlProps';
|
|
2
|
+
import { type PlaceholderProps } from '../../model/PlaceholderProps';
|
|
3
|
+
import { type Currency } from './CurrencyProps';
|
|
4
|
+
import { type ExchangeCurrencyItem } from './ExchangeCurrencyCalculator';
|
|
5
|
+
interface InputProps extends PlaceholderProps, ControlProps<string> {
|
|
6
|
+
rates: ExchangeCurrencyItem[];
|
|
7
|
+
selected: string;
|
|
8
|
+
setSelected: (value: Currency) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function renderInput(props: InputProps): any;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
|
|
2
|
+
import { Input } from '../../ui-kit/Input/Input.js';
|
|
3
|
+
import { Select } from '../../ui-kit/Select/Select.js';
|
|
4
|
+
export function renderInput(props) {
|
|
5
|
+
const { placeholder, rates, selected, value, onChange, setSelected } = props;
|
|
6
|
+
const ratesOptions = rates.map((_) => ({
|
|
7
|
+
key: _?.currency?.currency ?? '',
|
|
8
|
+
text: _?.currency?.currency ?? '',
|
|
9
|
+
}));
|
|
10
|
+
const selectedValue = { key: selected, text: selected };
|
|
11
|
+
return (_jsxs("div", { className: "relative flex", children: [_jsx(Input, { className: "shrink-0 text-l w-full appearance-none -mr-20", placeholder: placeholder, type: "text", value: value, onChange: onChange }), ratesOptions.length ? (_jsx(Select, { className: "absolute right-0", isBorder: false, onChange: (_) => setSelected(_.key), options: ratesOptions, value: selectedValue })) : null] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=renderInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderInput.js","sourceRoot":"","sources":["../../../src/components/ExchangeRateTile/renderInput.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAUpD,MAAM,UAAU,WAAW,CAAC,KAAiB;IAC3C,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAC7E,MAAM,YAAY,GAAa,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/C,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAAI,EAAE;QAChC,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAAI,EAAE;KAClC,CAAC,CAAC,CAAC;IACJ,MAAM,aAAa,GAAW,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAEhE,OAAO,CACL,eAAK,SAAS,EAAC,eAAe,aAC5B,KAAC,KAAK,IACJ,SAAS,EAAC,+CAA+C,EACzD,WAAW,EAAE,WAAW,EACxB,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,GAClB,EACD,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CACrB,KAAC,MAAM,IACL,SAAS,EAAC,kBAAkB,EAC5B,QAAQ,EAAE,KAAK,EACf,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,GAAe,CAAC,EAC/C,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,aAAa,GACpB,CACH,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ExchangeCurrencyItem } from '../../components/ExchangeRateTile/ExchangeCurrencyCalculator';
|
|
2
|
+
import { type Region } from '../../hooks/useRegions';
|
|
3
|
+
export interface ExchangeData {
|
|
4
|
+
exchangeRate?: {
|
|
5
|
+
currencies?: ExchangeCurrencyItem[];
|
|
6
|
+
};
|
|
7
|
+
address?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function useFetchExchangeRateData(currentRegion: Region): ExchangeData;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
2
|
+
import { API_BASE_URI } from '../../api/apiBaseUrl.js';
|
|
3
|
+
import { fetchJSONUnsafe } from '../../utils/fetchJSON.js';
|
|
4
|
+
const EXCHANGE_RATES_URL = `${API_BASE_URI}/exchangerates`;
|
|
5
|
+
export function useFetchExchangeRateData(currentRegion) {
|
|
6
|
+
const regionCode = currentRegion?.code || '000';
|
|
7
|
+
const { data } = useAsyncData(EXCHANGE_RATES_URL + `?regionCode=${regionCode}`, fetchJSONUnsafe);
|
|
8
|
+
return data || {};
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=useFetchExchangeRateData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchExchangeRateData.js","sourceRoot":"","sources":["../../../src/components/ExchangeRateTile/useFetchExchangeRateData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAA4B,MAAM,uBAAuB,CAAC;AASlF,MAAM,kBAAkB,GAAG,GAAG,YAAY,gBAAgB,CAAC;AAE3D,MAAM,UAAU,wBAAwB,CAAC,aAAqB;IAC5D,MAAM,UAAU,GAAG,aAAa,EAAE,IAAI,IAAI,KAAK,CAAC;IAEhD,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAC3B,kBAAkB,GAAG,eAAe,UAAU,EAAE,EAChD,eAAoD,CACrD,CAAC;IAEF,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -763,10 +763,10 @@
|
|
|
763
763
|
const and = (a, b) => (...args) => a(...args) && b(...args);
|
|
764
764
|
|
|
765
765
|
const table = (...table) => (...input) => {
|
|
766
|
-
const [, unit] = assertNonEmpty(table.find(([predicate]) => predicate(...input)));
|
|
766
|
+
const [, unit] = assertNonEmpty$1(table.find(([predicate]) => predicate(...input)));
|
|
767
767
|
return unit(...input);
|
|
768
768
|
};
|
|
769
|
-
function assertNonEmpty(value) {
|
|
769
|
+
function assertNonEmpty$1(value) {
|
|
770
770
|
if (!value) {
|
|
771
771
|
throw new Error('Value should be fulfilled');
|
|
772
772
|
}
|
|
@@ -10143,6 +10143,214 @@
|
|
|
10143
10143
|
};
|
|
10144
10144
|
const ErrorBlock = JSX(({ className = '', title, description, error, button, ...rest }) => (jsxs(BlockWrapper, { className: style('flex flex-col justify-center items-center', className), defaultPadding: style('p-6xl'), version: "transparent", ...rest, children: [jsx("div", { className: "flex justify-center", children: renderErrorContent(error) }), jsx(Headline, { title: title, description: description, headlineVersion: "XL", isEmbedded: true, className: "mb-2xl last:mb-0" }), button?.text ? (jsx(LinkButton, { version: button?.version, text: button?.text, ...button })) : null] })));
|
|
10145
10145
|
|
|
10146
|
+
const REGION_URL = `${API_BASE_URI$1}/region`;
|
|
10147
|
+
function useLocation(defaultLocation = 'Москва') {
|
|
10148
|
+
const locationStore = useLocalStore();
|
|
10149
|
+
return locationStore.location ?? { name: defaultLocation };
|
|
10150
|
+
}
|
|
10151
|
+
function useDefaultLocation(defaultLocation = 'Москва') {
|
|
10152
|
+
const locationStore = useLocalStore();
|
|
10153
|
+
const preselectLocation = useCallback(async () => {
|
|
10154
|
+
if (!locationStore.location) {
|
|
10155
|
+
const region = await fetchJSON(REGION_URL);
|
|
10156
|
+
locationStore.location = region ?? { name: defaultLocation };
|
|
10157
|
+
}
|
|
10158
|
+
}, [locationStore, defaultLocation]);
|
|
10159
|
+
useAsyncData(REGION_URL, preselectLocation);
|
|
10160
|
+
return locationStore;
|
|
10161
|
+
}
|
|
10162
|
+
|
|
10163
|
+
var Currency;
|
|
10164
|
+
(function (Currency) {
|
|
10165
|
+
Currency["RUB"] = "RUB";
|
|
10166
|
+
Currency["EUR"] = "EUR";
|
|
10167
|
+
Currency["USD"] = "USD";
|
|
10168
|
+
Currency["CNY"] = "CNY";
|
|
10169
|
+
})(Currency || (Currency = {}));
|
|
10170
|
+
|
|
10171
|
+
const currencyNumberFormat = new Intl.NumberFormat('ru', {
|
|
10172
|
+
style: 'currency',
|
|
10173
|
+
currency: Currency.RUB,
|
|
10174
|
+
});
|
|
10175
|
+
const formatCurrency = (value) => (value ? currencyNumberFormat.format(value) : '');
|
|
10176
|
+
|
|
10177
|
+
const TABLE_STYLE_BASE = 'text-m font-light text-secondary-text ';
|
|
10178
|
+
const TABLE_HEAD_STYLE = `${TABLE_STYLE_BASE} text-left`;
|
|
10179
|
+
const TABLE_HEAD_STYLE_CENTER = `${TABLE_STYLE_BASE} pl-5xl text-center`;
|
|
10180
|
+
const TABLE_HEAD_STYLE_RIGHT = `${TABLE_STYLE_BASE} pl-5xl text-right`;
|
|
10181
|
+
const CURRENCY_ICONS_MAP = {
|
|
10182
|
+
USD: 'DollarIcon',
|
|
10183
|
+
EUR: 'EuroIcon',
|
|
10184
|
+
CNY: 'ChineseYuanRenminbiIcon',
|
|
10185
|
+
};
|
|
10186
|
+
const CurrencyTable = JSX(({ className, exchangeCurrencyItems }) => (jsxs("table", { className: style('h-fit w-full', className), children: [jsx("thead", { children: jsxs("tr", { children: [jsx("th", { className: TABLE_HEAD_STYLE, children: jsx(Text, { size: "text-m", children: "\u0412\u0430\u043B\u044E\u0442\u0430" }) }), jsx("th", { className: TABLE_HEAD_STYLE_CENTER, children: jsx(Text, { size: "text-m", children: "\u041A\u0443\u043F\u0438\u0442\u044C" }) }), jsx("th", { className: TABLE_HEAD_STYLE_RIGHT, children: jsx(Text, { size: "text-m", children: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C" }) })] }) }), jsx("tbody", { children: exchangeCurrencyItems.map(renderCurrencyRow) })] })));
|
|
10187
|
+
const renderCurrencyRow = (exchangeCurrencyItem) => {
|
|
10188
|
+
const currency = exchangeCurrencyItem?.currency?.currency;
|
|
10189
|
+
return (jsxs("tr", { className: "pb-2xs text-h6", children: [jsx("td", { className: "pt-m m-auto flex text-left", children: jsxs("div", { className: "flex items-center gap-xs", children: [currency ? (jsx(Img, { image: { icon: CURRENCY_ICONS_MAP[currency] }, width: "24", height: "24" })) : null, jsx(Text, { size: "text-h6", children: currency })] }) }), jsx("td", { className: "pt-m pl-5xl text-center", children: jsx(Text, { size: "text-h6", children: formatCurrency(exchangeCurrencyItem?.saleExchangeRate) }) }), jsx("td", { className: "pt-m pl-5xl text-right", children: jsx(Text, { size: "text-h6", children: formatCurrency(exchangeCurrencyItem?.buyExchangeRate) }) })] }, currency));
|
|
10190
|
+
};
|
|
10191
|
+
|
|
10192
|
+
const icon = { icon: 'GpsIcon' };
|
|
10193
|
+
const CurrentLocation = JSX(({ className = '', address }) => (jsxs("div", { className: style('flex gap-s w-full justify-between @sm:justify-center', className), children: [jsx(RoundedIcon, { ...icon, iconBgVersion: "primary", className: "shrink-0" }), jsxs("div", { className: "space-y-2xs whitespace-pre-wrap", children: [address ? (jsx(Paragraph, { size: "text-l", color: "text-primary-main", children: address })) : null, jsx(Paragraph, { size: "text-m", color: "text-secondary-text", children: "\u041A\u0443\u0440\u0441 \u0443\u043A\u0430\u0437\u0430\u043D \u0434\u043B\u044F \u0437\u0430\u0434\u0430\u043D\u043D\u043E\u0433\u043E \u043E\u0444\u0438\u0441\u0430" })] })] })));
|
|
10194
|
+
|
|
10195
|
+
const roundTo = (value, precision = 2) => {
|
|
10196
|
+
const factor = 10 ** precision;
|
|
10197
|
+
return Math.round(parseFloat(String(value)) * factor) / factor;
|
|
10198
|
+
};
|
|
10199
|
+
|
|
10200
|
+
const calculateResult = (value, rate, precision) => {
|
|
10201
|
+
const result = Number(formatValue(value)) * Math.pow(rate, precision ? -1 : 1);
|
|
10202
|
+
return Number.isInteger(result) ? result : roundTo(result);
|
|
10203
|
+
};
|
|
10204
|
+
const formatValue = (value) => value.replace(/[^\d.,]/g, '').replace(',', '.');
|
|
10205
|
+
|
|
10206
|
+
function assertNonEmpty(value) {
|
|
10207
|
+
if (!value) {
|
|
10208
|
+
throw new Error('Value should be fulfilled');
|
|
10209
|
+
}
|
|
10210
|
+
return value;
|
|
10211
|
+
}
|
|
10212
|
+
|
|
10213
|
+
const baseTableFunc = (table) => (input) => {
|
|
10214
|
+
const [, unit] = assertNonEmpty(table.find(([predicate]) => predicate(input)));
|
|
10215
|
+
return unit(input);
|
|
10216
|
+
};
|
|
10217
|
+
const tableFunc = (table) => baseTableFunc(table.map(([p, o]) => [p, () => o]));
|
|
10218
|
+
tableFunc.if = (predicate) => new TableFuncBuilder(undefined, predicate);
|
|
10219
|
+
class TableFuncBuilder {
|
|
10220
|
+
parent;
|
|
10221
|
+
predicate;
|
|
10222
|
+
unit;
|
|
10223
|
+
get entry() {
|
|
10224
|
+
return [assertNonEmpty(this.predicate), assertNonEmpty(this.unit)];
|
|
10225
|
+
}
|
|
10226
|
+
constructor(parent, predicate, unit) {
|
|
10227
|
+
this.parent = parent;
|
|
10228
|
+
this.predicate = predicate;
|
|
10229
|
+
this.unit = unit;
|
|
10230
|
+
}
|
|
10231
|
+
if(predicate) {
|
|
10232
|
+
return new TableFuncBuilder(this, predicate);
|
|
10233
|
+
}
|
|
10234
|
+
then(unit) {
|
|
10235
|
+
return new TableFuncBuilder(this.parent, this.predicate, unit);
|
|
10236
|
+
}
|
|
10237
|
+
else(unit) {
|
|
10238
|
+
return baseTableFunc([...buildTable(this), [() => true, unit]]);
|
|
10239
|
+
}
|
|
10240
|
+
}
|
|
10241
|
+
const buildTable = (builder) => [
|
|
10242
|
+
...(builder?.parent ? buildTable(builder.parent) : []),
|
|
10243
|
+
builder.entry,
|
|
10244
|
+
];
|
|
10245
|
+
|
|
10246
|
+
const callbackCurrencySelect = (props) => tableFunc([
|
|
10247
|
+
[
|
|
10248
|
+
(_) => _.value !== Currency.RUB && _.oppositeValue !== Currency.RUB,
|
|
10249
|
+
() => props.handleConvert(props.value, Currency.RUB),
|
|
10250
|
+
],
|
|
10251
|
+
[
|
|
10252
|
+
(_) => _.value === Currency.RUB && _.oppositeValue === Currency.RUB,
|
|
10253
|
+
() => props.handleConvert(props.value, Currency.USD),
|
|
10254
|
+
],
|
|
10255
|
+
[
|
|
10256
|
+
(_) => _.value === Currency.RUB && _.oppositeValue === Currency.RUB,
|
|
10257
|
+
() => props.handleConvert(props.value, Currency.CNY),
|
|
10258
|
+
],
|
|
10259
|
+
[() => true, () => props.handleConvert(props.value)],
|
|
10260
|
+
])(props)?.();
|
|
10261
|
+
|
|
10262
|
+
function renderInput(props) {
|
|
10263
|
+
const { placeholder, rates, selected, value, onChange, setSelected } = props;
|
|
10264
|
+
const ratesOptions = rates.map((_) => ({
|
|
10265
|
+
key: _?.currency?.currency ?? '',
|
|
10266
|
+
text: _?.currency?.currency ?? '',
|
|
10267
|
+
}));
|
|
10268
|
+
const selectedValue = { key: selected, text: selected };
|
|
10269
|
+
return (jsxs("div", { className: "relative flex", children: [jsx(Input, { className: "shrink-0 text-l w-full appearance-none -mr-20", placeholder: placeholder, type: "text", value: value, onChange: onChange }), ratesOptions.length ? (jsx(Select, { className: "absolute right-0", isBorder: false, onChange: (_) => setSelected(_.key), options: ratesOptions, value: selectedValue })) : null] }));
|
|
10270
|
+
}
|
|
10271
|
+
|
|
10272
|
+
const ExchangeCurrencyCalculator = JSX(({ className = '', currencyRatesBuy, currencyRatesSell, button }) => {
|
|
10273
|
+
const [calcState, setCalcState] = useState({
|
|
10274
|
+
inputSell: '',
|
|
10275
|
+
inputBuy: '',
|
|
10276
|
+
selectSell: currencyRatesBuy?.[0]?.currency?.currency || Currency.RUB,
|
|
10277
|
+
selectBuy: currencyRatesSell?.[0]?.currency?.currency || Currency.USD,
|
|
10278
|
+
});
|
|
10279
|
+
const handleSetCalcState = useCallback((newState) => setCalcState((oldState) => ({ ...oldState, ...newState })), []);
|
|
10280
|
+
return (jsxs("div", { className: `flex flex-col gap-m pt-2xl ${className}`, children: [currencyRatesBuy && currencyRatesSell ? (jsxs("div", { className: "grid gap-m", children: [renderInput({
|
|
10281
|
+
placeholder: 'Хочу продать',
|
|
10282
|
+
rates: currencyRatesSell,
|
|
10283
|
+
selected: calcState.selectSell,
|
|
10284
|
+
setSelected: handleSelectSell(calcState, handleSetCalcState, currencyRatesSell),
|
|
10285
|
+
value: calcState.inputSell,
|
|
10286
|
+
onChange: (value) => handleInputSell(handleSetCalcState, currencyRatesSell)(value, calcState.selectSell, calcState.selectBuy),
|
|
10287
|
+
}), renderInput({
|
|
10288
|
+
placeholder: 'Получу',
|
|
10289
|
+
rates: currencyRatesBuy,
|
|
10290
|
+
selected: calcState.selectBuy,
|
|
10291
|
+
setSelected: handleSelectBuy(calcState, handleSetCalcState, currencyRatesBuy),
|
|
10292
|
+
value: calcState.inputBuy,
|
|
10293
|
+
onChange: (value) => handleInputBuy(handleSetCalcState, currencyRatesBuy)(value, calcState.selectBuy, calcState.selectSell),
|
|
10294
|
+
})] })) : null, button?.text ? (jsx(LinkButton, { text: button.text, version: button?.version, ...button })) : null] }));
|
|
10295
|
+
});
|
|
10296
|
+
const handleSelectSell = (calcState, setCalcState, currencyRatesSell) => (value) => {
|
|
10297
|
+
setCalcState({ selectSell: value });
|
|
10298
|
+
callbackCurrencySelect({
|
|
10299
|
+
value,
|
|
10300
|
+
oppositeValue: calcState.selectBuy,
|
|
10301
|
+
handleConvert: (currencyFrom = calcState.selectSell, currencyTo = calcState.selectBuy) => {
|
|
10302
|
+
handleInputSell(setCalcState, currencyRatesSell)(calcState.inputSell, currencyFrom, currencyTo);
|
|
10303
|
+
},
|
|
10304
|
+
});
|
|
10305
|
+
};
|
|
10306
|
+
const handleSelectBuy = (calcState, setCalcState, currencyRatesBuy) => (value) => {
|
|
10307
|
+
setCalcState({ selectBuy: value });
|
|
10308
|
+
callbackCurrencySelect({
|
|
10309
|
+
value,
|
|
10310
|
+
oppositeValue: calcState.selectSell,
|
|
10311
|
+
handleConvert: (currencyTo = calcState.selectBuy, currencyFrom = calcState.selectSell) => handleInputBuy(setCalcState, currencyRatesBuy)(calcState.inputBuy, currencyTo, currencyFrom),
|
|
10312
|
+
});
|
|
10313
|
+
};
|
|
10314
|
+
const handleInputSell = (setCalcState, currencyRatesSell) => (value, currencyFrom, currencyTo) => {
|
|
10315
|
+
setCalcState({ inputSell: formatValue(value), selectBuy: currencyTo });
|
|
10316
|
+
const rate = currencyRatesSell.find((_) => _.currency?.currency === currencyTo)?.buyExchangeRate ||
|
|
10317
|
+
currencyRatesSell.find((_) => _.currency?.currency === currencyFrom)?.buyExchangeRate;
|
|
10318
|
+
if (rate) {
|
|
10319
|
+
setCalcState({
|
|
10320
|
+
inputBuy: String(calculateResult(value, rate, currencyFrom === Currency.RUB) || ''),
|
|
10321
|
+
});
|
|
10322
|
+
}
|
|
10323
|
+
};
|
|
10324
|
+
const handleInputBuy = (setCalcState, currencyRatesBuy) => (value, currencyTo, currencyFrom) => {
|
|
10325
|
+
setCalcState({ inputBuy: formatValue(value), selectSell: currencyFrom });
|
|
10326
|
+
const rate = currencyRatesBuy.find((_) => _.currency?.currency === currencyFrom)?.saleExchangeRate ||
|
|
10327
|
+
currencyRatesBuy.find((_) => _.currency?.currency === currencyTo)?.saleExchangeRate;
|
|
10328
|
+
if (rate) {
|
|
10329
|
+
setCalcState({
|
|
10330
|
+
inputSell: String(calculateResult(value, rate, currencyTo === Currency.RUB) || ''),
|
|
10331
|
+
});
|
|
10332
|
+
}
|
|
10333
|
+
};
|
|
10334
|
+
|
|
10335
|
+
const EXCHANGE_RATES_URL = `${API_BASE_URI$1}/exchangerates`;
|
|
10336
|
+
function useFetchExchangeRateData(currentRegion) {
|
|
10337
|
+
const regionCode = currentRegion?.code || '000';
|
|
10338
|
+
const { data } = useAsyncData(EXCHANGE_RATES_URL + `?regionCode=${regionCode}`, fetchJSONUnsafe);
|
|
10339
|
+
return data || {};
|
|
10340
|
+
}
|
|
10341
|
+
|
|
10342
|
+
const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
|
|
10343
|
+
const currentLocation = useLocation();
|
|
10344
|
+
const exchangeRates = useFetchExchangeRateData(currentLocation);
|
|
10345
|
+
const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
|
|
10346
|
+
const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
|
|
10347
|
+
currencyRatesBuy.unshift({ currency: { currency: Currency.RUB } });
|
|
10348
|
+
const currencyRatesSell = currencyRates.filter((_) => _.saleExchangeRate);
|
|
10349
|
+
currencyRatesSell.push({ currency: { currency: Currency.RUB } });
|
|
10350
|
+
return (jsx(BlockWrapper, { className: style('box-border min-h-80', className), ...rest, children: jsx(BaseTile, { className: "h-full", title: jsx(Heading, { headingType: "h4", title: title, className: "whitespace-pre-wrap" }), children: jsxs("div", { className: "flex w-full gap-6xl flex-wrap @lg:flex-nowrap", children: [jsxs("div", { className: "w-full @2xl:w-auto @5xl:w-1/2", children: [currencyRates ? (jsx(CurrencyTable, { className: "mb-xl", exchangeCurrencyItems: currencyRates })) : null, jsx(CurrentLocation, { address: exchangeRates?.address })] }), jsx(ExchangeCurrencyCalculator, { className: "grow w-1/2", currencyRatesBuy: currencyRatesBuy, currencyRatesSell: currencyRatesSell, button: button })] }) }) }));
|
|
10351
|
+
});
|
|
10352
|
+
const getCurrencyRates = (currencies) => currencies?.filter((_) => [1, 2, 3].includes(_?.currency?.id)) || [];
|
|
10353
|
+
|
|
10146
10354
|
const LinkList = JSX(({ className = '', items }) => {
|
|
10147
10355
|
const link = useLink();
|
|
10148
10356
|
return (jsx("ul", { className: style('flex flex-col gap-s w-full', className), children: items?.map(renderLinkListItem(link)) }));
|
|
@@ -10489,23 +10697,6 @@
|
|
|
10489
10697
|
return (jsx(BlockWrapper, { className: style('min-h-80', className), padding: "p-0", version: version, ...rest, children: jsxs(BaseTile, { className: "h-full", padding: padding, defaultPadding: "p-6xl", title: jsx(Heading, { headingType: headingType, title: title, className: style('whitespace-pre-wrap', align) }), rightImage: img, buttons: renderButtonsSection(buttons, { className: 'flex-wrap' }), children: [description ? (jsx(Text, { size: "text-xl", "font-weight": "font-light", children: description })) : null, jsxs("div", { className: style('gap-m', 'flex flex-1 flex-col', 'flex-col items-start @xl:flex-row @xl:items-center'), children: [__html ? jsx(RichText, { __html: __html, itemSize: "list-m" }) : null, jsx(Text, { size: "text-m", "font-weight": "font-light", color: "text-secondary-text", children: additionalDescription }), qr?.src ? (jsx("div", { className: style('flex justify-center bg-white rounded-md @xl:-order-1', containerStyle), children: jsx(Img, { className: "w-fit", image: qr }) })) : null, image?.src ? jsx(Img, { className: "lg:hidden", image: image }) : null] })] }) }));
|
|
10490
10698
|
});
|
|
10491
10699
|
|
|
10492
|
-
const REGION_URL = `${API_BASE_URI$1}/region`;
|
|
10493
|
-
function useLocation(defaultLocation = 'Москва') {
|
|
10494
|
-
const locationStore = useLocalStore();
|
|
10495
|
-
return locationStore.location ?? { name: defaultLocation };
|
|
10496
|
-
}
|
|
10497
|
-
function useDefaultLocation(defaultLocation = 'Москва') {
|
|
10498
|
-
const locationStore = useLocalStore();
|
|
10499
|
-
const preselectLocation = useCallback(async () => {
|
|
10500
|
-
if (!locationStore.location) {
|
|
10501
|
-
const region = await fetchJSON(REGION_URL);
|
|
10502
|
-
locationStore.location = region ?? { name: defaultLocation };
|
|
10503
|
-
}
|
|
10504
|
-
}, [locationStore, defaultLocation]);
|
|
10505
|
-
useAsyncData(REGION_URL, preselectLocation);
|
|
10506
|
-
return locationStore;
|
|
10507
|
-
}
|
|
10508
|
-
|
|
10509
10700
|
const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
|
|
10510
10701
|
const VISIBLE_FILTERS = [
|
|
10511
10702
|
'workingSaturday',
|
|
@@ -11355,6 +11546,7 @@
|
|
|
11355
11546
|
CarouselTariffsCard,
|
|
11356
11547
|
DepositFiltration,
|
|
11357
11548
|
ErrorBlock,
|
|
11549
|
+
ExchangeRateTile,
|
|
11358
11550
|
Footer,
|
|
11359
11551
|
GalleryLayout,
|
|
11360
11552
|
GrantSupport,
|
|
@@ -11499,7 +11691,7 @@
|
|
|
11499
11691
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
11500
11692
|
});
|
|
11501
11693
|
|
|
11502
|
-
const packageVersion = "0.14.
|
|
11694
|
+
const packageVersion = "0.14.899";
|
|
11503
11695
|
|
|
11504
11696
|
exports.Blocks = Blocks;
|
|
11505
11697
|
exports.ContentPage = ContentPage;
|