@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,60 @@
|
|
|
1
|
+
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useLocation } from '../../hooks/useLocation';
|
|
3
|
+
import { BaseTile } from '../../ui-kit/BaseTile/BaseTile';
|
|
4
|
+
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
5
|
+
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
6
|
+
import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
|
|
7
|
+
import { style } from '../../utils/style';
|
|
8
|
+
import { Currency } from './CurrencyProps';
|
|
9
|
+
import { CurrencyTable } from './CurrencyTable';
|
|
10
|
+
import { CurrentLocation } from './CurrentLocation';
|
|
11
|
+
import {
|
|
12
|
+
ExchangeCurrencyCalculator,
|
|
13
|
+
type ExchangeCurrencyItem,
|
|
14
|
+
} from './ExchangeCurrencyCalculator';
|
|
15
|
+
import { type ExchangeRateTileContent } from './ExchangeRateTileContent';
|
|
16
|
+
import { useFetchExchangeRateData } from './useFetchExchangeRateData';
|
|
17
|
+
|
|
18
|
+
export interface ExchangeRateTileProps extends ExchangeRateTileContent, UniBlockProps {}
|
|
19
|
+
|
|
20
|
+
export const ExchangeRateTile = JSX<ExchangeRateTileProps>(
|
|
21
|
+
({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
|
|
22
|
+
const currentLocation = useLocation();
|
|
23
|
+
const exchangeRates = useFetchExchangeRateData(currentLocation);
|
|
24
|
+
|
|
25
|
+
const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
|
|
26
|
+
|
|
27
|
+
const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
|
|
28
|
+
currencyRatesBuy.unshift({ currency: { currency: Currency.RUB } });
|
|
29
|
+
|
|
30
|
+
const currencyRatesSell = currencyRates.filter((_) => _.saleExchangeRate);
|
|
31
|
+
currencyRatesSell.push({ currency: { currency: Currency.RUB } });
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<BlockWrapper className={style('box-border min-h-80', className)} {...rest}>
|
|
35
|
+
<BaseTile
|
|
36
|
+
className="h-full"
|
|
37
|
+
title={<Heading headingType="h4" title={title} className="whitespace-pre-wrap" />}
|
|
38
|
+
>
|
|
39
|
+
<div className="flex w-full gap-6xl flex-wrap @lg:flex-nowrap">
|
|
40
|
+
<div className="w-full @2xl:w-auto @5xl:w-1/2">
|
|
41
|
+
{currencyRates ? (
|
|
42
|
+
<CurrencyTable className="mb-xl" exchangeCurrencyItems={currencyRates} />
|
|
43
|
+
) : null}
|
|
44
|
+
<CurrentLocation address={exchangeRates?.address} />
|
|
45
|
+
</div>
|
|
46
|
+
<ExchangeCurrencyCalculator
|
|
47
|
+
className="grow w-1/2"
|
|
48
|
+
currencyRatesBuy={currencyRatesBuy}
|
|
49
|
+
currencyRatesSell={currencyRatesSell}
|
|
50
|
+
button={button}
|
|
51
|
+
/>
|
|
52
|
+
</div>
|
|
53
|
+
</BaseTile>
|
|
54
|
+
</BlockWrapper>
|
|
55
|
+
);
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const getCurrencyRates = (currencies?: ExchangeCurrencyItem[]) =>
|
|
60
|
+
currencies?.filter((_) => [1, 2, 3].includes(_?.currency?.id as number)) || [];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TitleProps } from '../../model/HeadlineType';
|
|
2
|
+
import { type LinkButtonContent } from '../../ui-kit/LinkButton/LinkButtonContent';
|
|
3
|
+
import { type UniBlockContent } from '../../UniBlock/UniBlockProps';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @title Курсы обмена валют
|
|
7
|
+
*/
|
|
8
|
+
export type ExchangeRateTileContent = UniBlockContent &
|
|
9
|
+
TitleProps & {
|
|
10
|
+
button?: LinkButtonContent;
|
|
11
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { roundTo } from '../../utils/roundTo';
|
|
2
|
+
|
|
3
|
+
export const calculateResult = (value: string, rate: number, precision: boolean) => {
|
|
4
|
+
const result = Number(formatValue(value)) * Math.pow(rate, precision ? -1 : 1);
|
|
5
|
+
|
|
6
|
+
return Number.isInteger(result) ? result : roundTo(result);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const formatValue = (value: string) => value.replace(/[^\d.,]/g, '').replace(',', '.');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { tableFunc } from '../../utils/tableFunc';
|
|
2
|
+
import { Currency } from './CurrencyProps';
|
|
3
|
+
|
|
4
|
+
interface TableFuncProps {
|
|
5
|
+
value: Currency;
|
|
6
|
+
oppositeValue: Currency;
|
|
7
|
+
handleConvert: (currencyFrom?: Currency, currencyTo?: Currency) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const callbackCurrencySelect = (props: TableFuncProps) =>
|
|
11
|
+
tableFunc<TableFuncProps, () => void>([
|
|
12
|
+
[
|
|
13
|
+
(_) => _.value !== Currency.RUB && _.oppositeValue !== Currency.RUB,
|
|
14
|
+
() => props.handleConvert(props.value, Currency.RUB),
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
(_) => _.value === Currency.RUB && _.oppositeValue === Currency.RUB,
|
|
18
|
+
() => props.handleConvert(props.value, Currency.USD),
|
|
19
|
+
],
|
|
20
|
+
[
|
|
21
|
+
(_) => _.value === Currency.RUB && _.oppositeValue === Currency.RUB,
|
|
22
|
+
() => props.handleConvert(props.value, Currency.CNY),
|
|
23
|
+
],
|
|
24
|
+
[() => true, () => props.handleConvert(props.value)],
|
|
25
|
+
])(props)?.();
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ControlProps } from '../../model/ControlProps';
|
|
2
|
+
import { type PlaceholderProps } from '../../model/PlaceholderProps';
|
|
3
|
+
import { Input } from '../../ui-kit/Input/Input';
|
|
4
|
+
import { type Option } from '../../ui-kit/Select/Option';
|
|
5
|
+
import { Select } from '../../ui-kit/Select/Select';
|
|
6
|
+
import { type Currency } from './CurrencyProps';
|
|
7
|
+
import { type ExchangeCurrencyItem } from './ExchangeCurrencyCalculator';
|
|
8
|
+
|
|
9
|
+
interface InputProps extends PlaceholderProps, ControlProps<string> {
|
|
10
|
+
rates: ExchangeCurrencyItem[];
|
|
11
|
+
selected: string;
|
|
12
|
+
setSelected: (value: Currency) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function renderInput(props: InputProps) {
|
|
16
|
+
const { placeholder, rates, selected, value, onChange, setSelected } = props;
|
|
17
|
+
const ratesOptions: Option[] = rates.map((_) => ({
|
|
18
|
+
key: _?.currency?.currency ?? '',
|
|
19
|
+
text: _?.currency?.currency ?? '',
|
|
20
|
+
}));
|
|
21
|
+
const selectedValue: Option = { key: selected, text: selected };
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div className="relative flex">
|
|
25
|
+
<Input
|
|
26
|
+
className="shrink-0 text-l w-full appearance-none -mr-20"
|
|
27
|
+
placeholder={placeholder}
|
|
28
|
+
type="text"
|
|
29
|
+
value={value}
|
|
30
|
+
onChange={onChange}
|
|
31
|
+
/>
|
|
32
|
+
{ratesOptions.length ? (
|
|
33
|
+
<Select
|
|
34
|
+
className="absolute right-0"
|
|
35
|
+
isBorder={false}
|
|
36
|
+
onChange={(_) => setSelected(_.key as Currency)}
|
|
37
|
+
options={ratesOptions}
|
|
38
|
+
value={selectedValue}
|
|
39
|
+
/>
|
|
40
|
+
) : null}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
|
|
2
|
+
import { API_BASE_URI } from '../../api/apiBaseUrl';
|
|
3
|
+
import { type ExchangeCurrencyItem } from '../../components/ExchangeRateTile/ExchangeCurrencyCalculator';
|
|
4
|
+
import { type Region } from '../../hooks/useRegions';
|
|
5
|
+
import { fetchJSONUnsafe, type FetchJSONUnsafeType } from '../../utils/fetchJSON';
|
|
6
|
+
|
|
7
|
+
export interface ExchangeData {
|
|
8
|
+
exchangeRate?: {
|
|
9
|
+
currencies?: ExchangeCurrencyItem[];
|
|
10
|
+
};
|
|
11
|
+
address?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const EXCHANGE_RATES_URL = `${API_BASE_URI}/exchangerates`;
|
|
15
|
+
|
|
16
|
+
export function useFetchExchangeRateData(currentRegion: Region) {
|
|
17
|
+
const regionCode = currentRegion?.code || '000';
|
|
18
|
+
|
|
19
|
+
const { data } = useAsyncData(
|
|
20
|
+
EXCHANGE_RATES_URL + `?regionCode=${regionCode}`,
|
|
21
|
+
fetchJSONUnsafe as FetchJSONUnsafeType<ExchangeData>,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return data || {};
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redneckz/wildless-cms-uni-blocks",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.900",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ЦК",
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
"path": "lib/common.css"
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
|
-
"limit": "
|
|
207
|
+
"limit": "100 kB",
|
|
208
208
|
"path": "bundle/bundle.umd.min.js"
|
|
209
209
|
}
|
|
210
210
|
],
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
"padding": "",
|
|
183
183
|
"title": "Заявка на выпуск бизнес-карты",
|
|
184
184
|
"typeForm": "BCRD",
|
|
185
|
-
"endpoint": "
|
|
185
|
+
"endpoint": "initcorporatelead",
|
|
186
186
|
"sections": [
|
|
187
187
|
{
|
|
188
188
|
"inputs": [
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
"padding": "",
|
|
236
236
|
"title": "Заполните онлайн-заявку на открытие брокерского счёта",
|
|
237
237
|
"typeForm": "BROK",
|
|
238
|
-
"endpoint": "
|
|
238
|
+
"endpoint": "initcorporatelead",
|
|
239
239
|
"sections": [
|
|
240
240
|
{
|
|
241
241
|
"columns": 2,
|
|
@@ -334,7 +334,7 @@
|
|
|
334
334
|
"padding": "",
|
|
335
335
|
"title": "Заполните заявку на консультацию",
|
|
336
336
|
"typeForm": "COLLECTION",
|
|
337
|
-
"endpoint": "
|
|
337
|
+
"endpoint": "initcorporatelead",
|
|
338
338
|
"sections": [
|
|
339
339
|
{
|
|
340
340
|
"inputs": [
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
"padding": "",
|
|
389
389
|
"title": "Оформите заявку на кредит прямо сейчас",
|
|
390
390
|
"typeForm": "CRED",
|
|
391
|
-
"endpoint": "
|
|
391
|
+
"endpoint": "initcorporatelead",
|
|
392
392
|
"sections": [
|
|
393
393
|
{
|
|
394
394
|
"title": "Параметры кредита",
|
|
@@ -659,7 +659,9 @@
|
|
|
659
659
|
"required": true,
|
|
660
660
|
"condition": {
|
|
661
661
|
"name": "serviceDirection",
|
|
662
|
-
"values": [
|
|
662
|
+
"values": [
|
|
663
|
+
"Юридическое лицо / ИП"
|
|
664
|
+
]
|
|
663
665
|
}
|
|
664
666
|
},
|
|
665
667
|
{
|
|
@@ -667,7 +669,9 @@
|
|
|
667
669
|
"label": "Наименование организации",
|
|
668
670
|
"condition": {
|
|
669
671
|
"name": "serviceDirection",
|
|
670
|
-
"values": [
|
|
672
|
+
"values": [
|
|
673
|
+
"Юридическое лицо / ИП"
|
|
674
|
+
]
|
|
671
675
|
}
|
|
672
676
|
},
|
|
673
677
|
{
|
|
@@ -723,7 +727,7 @@
|
|
|
723
727
|
"padding": "",
|
|
724
728
|
"title": "Заполните заявку на консультацию",
|
|
725
729
|
"typeForm": "SELFCOLLECTION",
|
|
726
|
-
"endpoint": "
|
|
730
|
+
"endpoint": "initcorporatelead",
|
|
727
731
|
"sections": [
|
|
728
732
|
{
|
|
729
733
|
"inputs": [
|
|
@@ -901,7 +905,7 @@
|
|
|
901
905
|
"padding": "",
|
|
902
906
|
"title": "Получите консультацию по обслуживанию ВЭД",
|
|
903
907
|
"typeForm": "KVED",
|
|
904
|
-
"endpoint": "
|
|
908
|
+
"endpoint": "initcorporatelead",
|
|
905
909
|
"sections": [
|
|
906
910
|
{
|
|
907
911
|
"inputs": [
|
|
@@ -922,7 +926,9 @@
|
|
|
922
926
|
"required": true,
|
|
923
927
|
"condition": {
|
|
924
928
|
"name": "vedTypes",
|
|
925
|
-
"values": [
|
|
929
|
+
"values": [
|
|
930
|
+
"currencyControl"
|
|
931
|
+
]
|
|
926
932
|
}
|
|
927
933
|
}
|
|
928
934
|
]
|
|
@@ -935,7 +941,10 @@
|
|
|
935
941
|
"required": true,
|
|
936
942
|
"condition": {
|
|
937
943
|
"name": "vedTypes",
|
|
938
|
-
"values": [
|
|
944
|
+
"values": [
|
|
945
|
+
"currencyControl",
|
|
946
|
+
"documentOperations"
|
|
947
|
+
]
|
|
939
948
|
}
|
|
940
949
|
},
|
|
941
950
|
{
|
|
@@ -957,7 +966,11 @@
|
|
|
957
966
|
"required": true,
|
|
958
967
|
"condition": {
|
|
959
968
|
"name": "vedTypes",
|
|
960
|
-
"values": [
|
|
969
|
+
"values": [
|
|
970
|
+
"documentOperations",
|
|
971
|
+
"conversionTransactions",
|
|
972
|
+
"otherIssues"
|
|
973
|
+
]
|
|
961
974
|
}
|
|
962
975
|
}
|
|
963
976
|
]
|
|
@@ -1062,16 +1075,27 @@
|
|
|
1062
1075
|
"padding": "",
|
|
1063
1076
|
"title": "Заявка по акции 'Шеф в деле'",
|
|
1064
1077
|
"typeForm": "FCB",
|
|
1065
|
-
"endpoint": "
|
|
1078
|
+
"endpoint": "initcorporatelead",
|
|
1066
1079
|
"sections": [
|
|
1067
1080
|
{
|
|
1068
|
-
"inputs": [
|
|
1081
|
+
"inputs": [
|
|
1082
|
+
{
|
|
1083
|
+
"name": "name",
|
|
1084
|
+
"required": true
|
|
1085
|
+
}
|
|
1086
|
+
]
|
|
1069
1087
|
},
|
|
1070
1088
|
{
|
|
1071
1089
|
"columns": 2,
|
|
1072
1090
|
"inputs": [
|
|
1073
|
-
{
|
|
1074
|
-
|
|
1091
|
+
{
|
|
1092
|
+
"name": "phone",
|
|
1093
|
+
"required": true
|
|
1094
|
+
},
|
|
1095
|
+
{
|
|
1096
|
+
"name": "inn",
|
|
1097
|
+
"required": true
|
|
1098
|
+
}
|
|
1075
1099
|
]
|
|
1076
1100
|
}
|
|
1077
1101
|
],
|
|
@@ -1095,10 +1119,15 @@
|
|
|
1095
1119
|
"padding": "",
|
|
1096
1120
|
"title": "Льготное кредитование АПК",
|
|
1097
1121
|
"typeForm": "CREDL",
|
|
1098
|
-
"endpoint": "
|
|
1122
|
+
"endpoint": "initcorporatelead",
|
|
1099
1123
|
"sections": [
|
|
1100
1124
|
{
|
|
1101
|
-
"inputs": [
|
|
1125
|
+
"inputs": [
|
|
1126
|
+
{
|
|
1127
|
+
"name": "name",
|
|
1128
|
+
"required": true
|
|
1129
|
+
}
|
|
1130
|
+
]
|
|
1102
1131
|
},
|
|
1103
1132
|
{
|
|
1104
1133
|
"columns": 2,
|
|
@@ -1134,14 +1163,27 @@
|
|
|
1134
1163
|
"padding": "",
|
|
1135
1164
|
"title": "Подключить расчетно-кассовое обслуживание",
|
|
1136
1165
|
"typeForm": "CONT",
|
|
1137
|
-
"endpoint": "
|
|
1166
|
+
"endpoint": "initcorporatelead",
|
|
1138
1167
|
"sections": [
|
|
1139
1168
|
{
|
|
1140
|
-
"inputs": [
|
|
1169
|
+
"inputs": [
|
|
1170
|
+
{
|
|
1171
|
+
"name": "name",
|
|
1172
|
+
"required": true
|
|
1173
|
+
}
|
|
1174
|
+
]
|
|
1141
1175
|
},
|
|
1142
1176
|
{
|
|
1143
1177
|
"columns": 2,
|
|
1144
|
-
"inputs": [
|
|
1178
|
+
"inputs": [
|
|
1179
|
+
{
|
|
1180
|
+
"name": "phone",
|
|
1181
|
+
"required": true
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
"name": "inn"
|
|
1185
|
+
}
|
|
1186
|
+
]
|
|
1145
1187
|
}
|
|
1146
1188
|
],
|
|
1147
1189
|
"button": {
|
|
@@ -1312,7 +1354,9 @@
|
|
|
1312
1354
|
"required": true,
|
|
1313
1355
|
"condition": {
|
|
1314
1356
|
"name": "serviceDirection",
|
|
1315
|
-
"values": [
|
|
1357
|
+
"values": [
|
|
1358
|
+
"Юридическое лицо / ИП"
|
|
1359
|
+
]
|
|
1316
1360
|
}
|
|
1317
1361
|
},
|
|
1318
1362
|
{
|
|
@@ -1320,7 +1364,9 @@
|
|
|
1320
1364
|
"label": "Наименование организации",
|
|
1321
1365
|
"condition": {
|
|
1322
1366
|
"name": "serviceDirection",
|
|
1323
|
-
"values": [
|
|
1367
|
+
"values": [
|
|
1368
|
+
"Юридическое лицо / ИП"
|
|
1369
|
+
]
|
|
1324
1370
|
}
|
|
1325
1371
|
},
|
|
1326
1372
|
{
|
|
@@ -1337,7 +1383,9 @@
|
|
|
1337
1383
|
"label": "Ваше сообщение",
|
|
1338
1384
|
"condition": {
|
|
1339
1385
|
"name": "serviceDirection",
|
|
1340
|
-
"values": [
|
|
1386
|
+
"values": [
|
|
1387
|
+
"Физическое лицо"
|
|
1388
|
+
]
|
|
1341
1389
|
}
|
|
1342
1390
|
},
|
|
1343
1391
|
{
|
|
@@ -1346,7 +1394,9 @@
|
|
|
1346
1394
|
"required": true,
|
|
1347
1395
|
"condition": {
|
|
1348
1396
|
"name": "serviceDirection",
|
|
1349
|
-
"values": [
|
|
1397
|
+
"values": [
|
|
1398
|
+
"Юридическое лицо / ИП"
|
|
1399
|
+
]
|
|
1350
1400
|
}
|
|
1351
1401
|
}
|
|
1352
1402
|
]
|
|
@@ -1379,7 +1429,7 @@
|
|
|
1379
1429
|
"version": "primary",
|
|
1380
1430
|
"title": "Онлайн-заявка от партнёра",
|
|
1381
1431
|
"typeForm": "PF",
|
|
1382
|
-
"endpoint": "
|
|
1432
|
+
"endpoint": "initcorporatelead",
|
|
1383
1433
|
"sections": [
|
|
1384
1434
|
{
|
|
1385
1435
|
"title": "Информация о партнёре",
|
|
@@ -1468,14 +1518,27 @@
|
|
|
1468
1518
|
"padding": "",
|
|
1469
1519
|
"title": "Подключить расчетно-кассовое обслуживание'",
|
|
1470
1520
|
"typeForm": "UNIVERSAL",
|
|
1471
|
-
"endpoint": "
|
|
1521
|
+
"endpoint": "initcorporatelead",
|
|
1472
1522
|
"sections": [
|
|
1473
1523
|
{
|
|
1474
|
-
"inputs": [
|
|
1524
|
+
"inputs": [
|
|
1525
|
+
{
|
|
1526
|
+
"name": "name",
|
|
1527
|
+
"required": true
|
|
1528
|
+
}
|
|
1529
|
+
]
|
|
1475
1530
|
},
|
|
1476
1531
|
{
|
|
1477
1532
|
"columns": 2,
|
|
1478
|
-
"inputs": [
|
|
1533
|
+
"inputs": [
|
|
1534
|
+
{
|
|
1535
|
+
"name": "phone",
|
|
1536
|
+
"required": true
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
"name": "inn"
|
|
1540
|
+
}
|
|
1541
|
+
]
|
|
1479
1542
|
}
|
|
1480
1543
|
],
|
|
1481
1544
|
"button": {
|
|
@@ -1490,4 +1553,4 @@
|
|
|
1490
1553
|
}
|
|
1491
1554
|
}
|
|
1492
1555
|
]
|
|
1493
|
-
]
|
|
1556
|
+
]
|
|
@@ -159,7 +159,7 @@ export default {
|
|
|
159
159
|
className="col-span-12"
|
|
160
160
|
title="Заполните онлайн-заявку на открытие брокерского счёта"
|
|
161
161
|
typeForm="BROK"
|
|
162
|
-
endpoint="
|
|
162
|
+
endpoint="initcorporatelead"
|
|
163
163
|
sections={[
|
|
164
164
|
{
|
|
165
165
|
columns: 2,
|
|
@@ -219,7 +219,7 @@ export default {
|
|
|
219
219
|
className="col-span-12"
|
|
220
220
|
title="Заявка на выпуск бизнес-карты"
|
|
221
221
|
typeForm="BCRD"
|
|
222
|
-
endpoint="
|
|
222
|
+
endpoint="initcorporatelead"
|
|
223
223
|
sections={[
|
|
224
224
|
{
|
|
225
225
|
inputs: [{ name: 'region', required: true }],
|
|
@@ -247,7 +247,7 @@ export default {
|
|
|
247
247
|
className="col-span-12"
|
|
248
248
|
title="Заполните заявку на консультацию"
|
|
249
249
|
typeForm="COLLECTION"
|
|
250
|
-
endpoint="
|
|
250
|
+
endpoint="initcorporatelead"
|
|
251
251
|
sections={[
|
|
252
252
|
{
|
|
253
253
|
inputs: [
|
|
@@ -285,7 +285,7 @@ export default {
|
|
|
285
285
|
className="col-span-12"
|
|
286
286
|
title="Оформите заявку на кредит прямо сейчас"
|
|
287
287
|
typeForm="CRED"
|
|
288
|
-
endpoint="
|
|
288
|
+
endpoint="initcorporatelead"
|
|
289
289
|
sections={[
|
|
290
290
|
{
|
|
291
291
|
title: 'Параметры кредита',
|
|
@@ -501,7 +501,7 @@ export default {
|
|
|
501
501
|
className="col-span-12"
|
|
502
502
|
title="Самоинкассация (ЮЛ)"
|
|
503
503
|
typeForm="SELFCOLLECTION"
|
|
504
|
-
endpoint="
|
|
504
|
+
endpoint="initcorporatelead"
|
|
505
505
|
sections={[
|
|
506
506
|
{
|
|
507
507
|
inputs: [
|
|
@@ -563,7 +563,7 @@ export default {
|
|
|
563
563
|
className="col-span-12"
|
|
564
564
|
title="Получите консультацию по обслуживанию ВЭД"
|
|
565
565
|
typeForm="KVED"
|
|
566
|
-
endpoint="
|
|
566
|
+
endpoint="initcorporatelead"
|
|
567
567
|
sections={[
|
|
568
568
|
{
|
|
569
569
|
inputs: [
|
|
@@ -663,7 +663,7 @@ export default {
|
|
|
663
663
|
className="col-span-12"
|
|
664
664
|
title="Заявка по акции 'Шеф в деле'"
|
|
665
665
|
typeForm="FCB"
|
|
666
|
-
endpoint="
|
|
666
|
+
endpoint="initcorporatelead"
|
|
667
667
|
sections={[
|
|
668
668
|
{
|
|
669
669
|
inputs: [{ name: 'name', required: true }],
|
|
@@ -689,7 +689,7 @@ export default {
|
|
|
689
689
|
className="col-span-12"
|
|
690
690
|
title="Льготное кредитование АПК"
|
|
691
691
|
typeForm="CREDL"
|
|
692
|
-
endpoint="
|
|
692
|
+
endpoint="initcorporatelead"
|
|
693
693
|
sections={[
|
|
694
694
|
{
|
|
695
695
|
inputs: [{ name: 'name', required: true }],
|
|
@@ -715,7 +715,7 @@ export default {
|
|
|
715
715
|
className="col-span-12"
|
|
716
716
|
title="Подключить расчетно-кассовое обслуживание"
|
|
717
717
|
typeForm="CONT"
|
|
718
|
-
endpoint="
|
|
718
|
+
endpoint="initcorporatelead"
|
|
719
719
|
sections={[
|
|
720
720
|
{
|
|
721
721
|
inputs: [{ name: 'name', required: true }],
|
|
@@ -855,7 +855,7 @@ export default {
|
|
|
855
855
|
className="col-span-12"
|
|
856
856
|
title="Онлайн-заявка от партнера"
|
|
857
857
|
typeForm="PF"
|
|
858
|
-
endpoint="
|
|
858
|
+
endpoint="initcorporatelead"
|
|
859
859
|
sections={[
|
|
860
860
|
{
|
|
861
861
|
title: 'Информация о партнере',
|
|
@@ -902,7 +902,7 @@ export default {
|
|
|
902
902
|
className="col-span-12"
|
|
903
903
|
title="Заявка на открытие счёта для бизнеса"
|
|
904
904
|
typeForm="UNIVERSAL"
|
|
905
|
-
endpoint="
|
|
905
|
+
endpoint="initcorporatelead"
|
|
906
906
|
sections={[
|
|
907
907
|
{
|
|
908
908
|
inputs: [{ name: 'name', required: true }],
|