@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.
Files changed (220) hide show
  1. package/bin/migration-scripts/0.14.900.js +18 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +212 -20
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
  6. package/bundle/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
  7. package/bundle/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
  8. package/bundle/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
  9. package/bundle/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
  10. package/bundle/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
  11. package/bundle/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
  12. package/bundle/components/ExchangeRateTile/calculateResult.d.ts +2 -0
  13. package/bundle/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
  14. package/bundle/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
  15. package/bundle/components/ExchangeRateTile/renderInput.d.ts +11 -0
  16. package/bundle/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
  17. package/dist/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
  18. package/dist/components/Blocks.js +2 -0
  19. package/dist/components/Blocks.js.map +1 -1
  20. package/dist/components/Blocks.mobile.js +2 -0
  21. package/dist/components/Blocks.mobile.js.map +1 -1
  22. package/dist/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
  23. package/dist/components/ExchangeRateTile/CurrencyProps.js +10 -0
  24. package/dist/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
  25. package/dist/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
  26. package/dist/components/ExchangeRateTile/CurrencyTable.js +23 -0
  27. package/dist/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
  28. package/dist/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
  29. package/dist/components/ExchangeRateTile/CurrentLocation.js +10 -0
  30. package/dist/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
  31. package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
  32. package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +73 -0
  33. package/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
  34. package/dist/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
  35. package/dist/components/ExchangeRateTile/ExchangeRateTile.js +26 -0
  36. package/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
  37. package/dist/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
  38. package/dist/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
  39. package/dist/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
  40. package/dist/components/ExchangeRateTile/calculateResult.d.ts +2 -0
  41. package/dist/components/ExchangeRateTile/calculateResult.js +11 -0
  42. package/dist/components/ExchangeRateTile/calculateResult.js.map +1 -0
  43. package/dist/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
  44. package/dist/components/ExchangeRateTile/callbackCurrencySelect.js +21 -0
  45. package/dist/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
  46. package/dist/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
  47. package/dist/components/ExchangeRateTile/formatCurrency.js +10 -0
  48. package/dist/components/ExchangeRateTile/formatCurrency.js.map +1 -0
  49. package/dist/components/ExchangeRateTile/renderInput.d.ts +11 -0
  50. package/dist/components/ExchangeRateTile/renderInput.js +16 -0
  51. package/dist/components/ExchangeRateTile/renderInput.js.map +1 -0
  52. package/dist/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
  53. package/dist/components/ExchangeRateTile/useFetchExchangeRateData.js +13 -0
  54. package/dist/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
  55. package/lib/common.css +1 -1
  56. package/lib/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
  57. package/lib/components/Blocks.js +2 -0
  58. package/lib/components/Blocks.js.map +1 -1
  59. package/lib/components/Blocks.mobile.js +2 -0
  60. package/lib/components/Blocks.mobile.js.map +1 -1
  61. package/lib/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
  62. package/lib/components/ExchangeRateTile/CurrencyProps.js +8 -0
  63. package/lib/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
  64. package/lib/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
  65. package/lib/components/ExchangeRateTile/CurrencyTable.js +21 -0
  66. package/lib/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
  67. package/lib/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
  68. package/lib/components/ExchangeRateTile/CurrentLocation.js +8 -0
  69. package/lib/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
  70. package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
  71. package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +71 -0
  72. package/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
  73. package/lib/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
  74. package/lib/components/ExchangeRateTile/ExchangeRateTile.fixture.d.ts +5 -0
  75. package/lib/components/ExchangeRateTile/ExchangeRateTile.fixture.mobile.d.ts +5 -0
  76. package/lib/components/ExchangeRateTile/ExchangeRateTile.js +24 -0
  77. package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
  78. package/lib/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
  79. package/lib/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
  80. package/lib/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
  81. package/lib/components/ExchangeRateTile/calculateResult.d.ts +2 -0
  82. package/lib/components/ExchangeRateTile/calculateResult.js +7 -0
  83. package/lib/components/ExchangeRateTile/calculateResult.js.map +1 -0
  84. package/lib/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
  85. package/lib/components/ExchangeRateTile/callbackCurrencySelect.js +18 -0
  86. package/lib/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
  87. package/lib/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
  88. package/lib/components/ExchangeRateTile/formatCurrency.js +7 -0
  89. package/lib/components/ExchangeRateTile/formatCurrency.js.map +1 -0
  90. package/lib/components/ExchangeRateTile/renderInput.d.ts +11 -0
  91. package/lib/components/ExchangeRateTile/renderInput.js +13 -0
  92. package/lib/components/ExchangeRateTile/renderInput.js.map +1 -0
  93. package/lib/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
  94. package/lib/components/ExchangeRateTile/useFetchExchangeRateData.js +10 -0
  95. package/lib/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
  96. package/mobile/bundle/bundle.umd.js +212 -20
  97. package/mobile/bundle/bundle.umd.min.js +1 -1
  98. package/mobile/bundle/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
  99. package/mobile/bundle/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
  100. package/mobile/bundle/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
  101. package/mobile/bundle/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
  102. package/mobile/bundle/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
  103. package/mobile/bundle/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
  104. package/mobile/bundle/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
  105. package/mobile/bundle/components/ExchangeRateTile/calculateResult.d.ts +2 -0
  106. package/mobile/bundle/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
  107. package/mobile/bundle/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
  108. package/mobile/bundle/components/ExchangeRateTile/renderInput.d.ts +11 -0
  109. package/mobile/bundle/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
  110. package/mobile/dist/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
  111. package/mobile/dist/components/Blocks.js +2 -0
  112. package/mobile/dist/components/Blocks.js.map +1 -1
  113. package/mobile/dist/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
  114. package/mobile/dist/components/ExchangeRateTile/CurrencyProps.js +10 -0
  115. package/mobile/dist/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
  116. package/mobile/dist/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
  117. package/mobile/dist/components/ExchangeRateTile/CurrencyTable.js +23 -0
  118. package/mobile/dist/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
  119. package/mobile/dist/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
  120. package/mobile/dist/components/ExchangeRateTile/CurrentLocation.js +10 -0
  121. package/mobile/dist/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
  122. package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
  123. package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +73 -0
  124. package/mobile/dist/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
  125. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
  126. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js +26 -0
  127. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
  128. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
  129. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
  130. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
  131. package/mobile/dist/components/ExchangeRateTile/calculateResult.d.ts +2 -0
  132. package/mobile/dist/components/ExchangeRateTile/calculateResult.js +11 -0
  133. package/mobile/dist/components/ExchangeRateTile/calculateResult.js.map +1 -0
  134. package/mobile/dist/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
  135. package/mobile/dist/components/ExchangeRateTile/callbackCurrencySelect.js +21 -0
  136. package/mobile/dist/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
  137. package/mobile/dist/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
  138. package/mobile/dist/components/ExchangeRateTile/formatCurrency.js +10 -0
  139. package/mobile/dist/components/ExchangeRateTile/formatCurrency.js.map +1 -0
  140. package/mobile/dist/components/ExchangeRateTile/renderInput.d.ts +11 -0
  141. package/mobile/dist/components/ExchangeRateTile/renderInput.js +16 -0
  142. package/mobile/dist/components/ExchangeRateTile/renderInput.js.map +1 -0
  143. package/mobile/dist/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
  144. package/mobile/dist/components/ExchangeRateTile/useFetchExchangeRateData.js +13 -0
  145. package/mobile/dist/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
  146. package/mobile/lib/common.css +1 -1
  147. package/mobile/lib/components/ApplicationForm/ApplicationFormContent.d.ts +2 -1
  148. package/mobile/lib/components/Blocks.js +2 -0
  149. package/mobile/lib/components/Blocks.js.map +1 -1
  150. package/mobile/lib/components/ExchangeRateTile/CurrencyProps.d.ts +6 -0
  151. package/mobile/lib/components/ExchangeRateTile/CurrencyProps.js +8 -0
  152. package/mobile/lib/components/ExchangeRateTile/CurrencyProps.js.map +1 -0
  153. package/mobile/lib/components/ExchangeRateTile/CurrencyTable.d.ts +7 -0
  154. package/mobile/lib/components/ExchangeRateTile/CurrencyTable.js +21 -0
  155. package/mobile/lib/components/ExchangeRateTile/CurrencyTable.js.map +1 -0
  156. package/mobile/lib/components/ExchangeRateTile/CurrentLocation.d.ts +6 -0
  157. package/mobile/lib/components/ExchangeRateTile/CurrentLocation.js +8 -0
  158. package/mobile/lib/components/ExchangeRateTile/CurrentLocation.js.map +1 -0
  159. package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.d.ts +24 -0
  160. package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js +71 -0
  161. package/mobile/lib/components/ExchangeRateTile/ExchangeCurrencyCalculator.js.map +1 -0
  162. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.d.ts +5 -0
  163. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js +24 -0
  164. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -0
  165. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +9 -0
  166. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTileContent.js +2 -0
  167. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTileContent.js.map +1 -0
  168. package/mobile/lib/components/ExchangeRateTile/calculateResult.d.ts +2 -0
  169. package/mobile/lib/components/ExchangeRateTile/calculateResult.js +7 -0
  170. package/mobile/lib/components/ExchangeRateTile/calculateResult.js.map +1 -0
  171. package/mobile/lib/components/ExchangeRateTile/callbackCurrencySelect.d.ts +8 -0
  172. package/mobile/lib/components/ExchangeRateTile/callbackCurrencySelect.js +18 -0
  173. package/mobile/lib/components/ExchangeRateTile/callbackCurrencySelect.js.map +1 -0
  174. package/mobile/lib/components/ExchangeRateTile/formatCurrency.d.ts +1 -0
  175. package/mobile/lib/components/ExchangeRateTile/formatCurrency.js +7 -0
  176. package/mobile/lib/components/ExchangeRateTile/formatCurrency.js.map +1 -0
  177. package/mobile/lib/components/ExchangeRateTile/renderInput.d.ts +11 -0
  178. package/mobile/lib/components/ExchangeRateTile/renderInput.js +13 -0
  179. package/mobile/lib/components/ExchangeRateTile/renderInput.js.map +1 -0
  180. package/mobile/lib/components/ExchangeRateTile/useFetchExchangeRateData.d.ts +9 -0
  181. package/mobile/lib/components/ExchangeRateTile/useFetchExchangeRateData.js +10 -0
  182. package/mobile/lib/components/ExchangeRateTile/useFetchExchangeRateData.js.map +1 -0
  183. package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +92 -29
  184. package/mobile/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
  185. package/mobile/src/components/Blocks.ts +2 -0
  186. package/mobile/src/components/ExchangeRateTile/CurrencyProps.ts +6 -0
  187. package/mobile/src/components/ExchangeRateTile/CurrencyTable.tsx +64 -0
  188. package/mobile/src/components/ExchangeRateTile/CurrentLocation.tsx +28 -0
  189. package/mobile/src/components/ExchangeRateTile/ExchangeCurrencyCalculator.tsx +155 -0
  190. package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.example.json +12 -0
  191. package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.tsx +60 -0
  192. package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.ui.json +8 -0
  193. package/mobile/src/components/ExchangeRateTile/ExchangeRateTileContent.ts +11 -0
  194. package/mobile/src/components/ExchangeRateTile/calculateResult.ts +9 -0
  195. package/mobile/src/components/ExchangeRateTile/callbackCurrencySelect.ts +25 -0
  196. package/mobile/src/components/ExchangeRateTile/formatCurrency.ts +8 -0
  197. package/mobile/src/components/ExchangeRateTile/renderInput.tsx +43 -0
  198. package/mobile/src/components/ExchangeRateTile/useFetchExchangeRateData.ts +25 -0
  199. package/package.json +2 -2
  200. package/src/components/ApplicationForm/ApplicationForm.example.json +92 -29
  201. package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +11 -11
  202. package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +11 -11
  203. package/src/components/ApplicationForm/ApplicationFormContent.ts +2 -1
  204. package/src/components/Blocks.mobile.ts +2 -0
  205. package/src/components/Blocks.ts +2 -0
  206. package/src/components/ExchangeRateTile/CurrencyProps.ts +6 -0
  207. package/src/components/ExchangeRateTile/CurrencyTable.tsx +64 -0
  208. package/src/components/ExchangeRateTile/CurrentLocation.tsx +28 -0
  209. package/src/components/ExchangeRateTile/ExchangeCurrencyCalculator.tsx +155 -0
  210. package/src/components/ExchangeRateTile/ExchangeRateTile.example.json +12 -0
  211. package/src/components/ExchangeRateTile/ExchangeRateTile.fixture.mobile.tsx +21 -0
  212. package/src/components/ExchangeRateTile/ExchangeRateTile.fixture.tsx +21 -0
  213. package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +60 -0
  214. package/src/components/ExchangeRateTile/ExchangeRateTile.ui.json +8 -0
  215. package/src/components/ExchangeRateTile/ExchangeRateTileContent.ts +11 -0
  216. package/src/components/ExchangeRateTile/calculateResult.ts +9 -0
  217. package/src/components/ExchangeRateTile/callbackCurrencySelect.ts +25 -0
  218. package/src/components/ExchangeRateTile/formatCurrency.ts +8 -0
  219. package/src/components/ExchangeRateTile/renderInput.tsx +43 -0
  220. package/src/components/ExchangeRateTile/useFetchExchangeRateData.ts +25 -0
@@ -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"}
@@ -182,7 +182,7 @@
182
182
  "padding": "",
183
183
  "title": "Заявка на выпуск бизнес-карты",
184
184
  "typeForm": "BCRD",
185
- "endpoint": "sendcorporatelead",
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": "sendcorporatelead",
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": "sendcorporatelead",
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": "sendcorporatelead",
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": "sendcorporatelead",
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": "sendcorporatelead",
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": ["currencyControl"]
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": ["currencyControl", "documentOperations"]
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": ["documentOperations", "conversionTransactions", "otherIssues"]
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": "sendcorporatelead",
1078
+ "endpoint": "initcorporatelead",
1066
1079
  "sections": [
1067
1080
  {
1068
- "inputs": [{ "name": "name", "required": true }]
1081
+ "inputs": [
1082
+ {
1083
+ "name": "name",
1084
+ "required": true
1085
+ }
1086
+ ]
1069
1087
  },
1070
1088
  {
1071
1089
  "columns": 2,
1072
1090
  "inputs": [
1073
- { "name": "phone", "required": true },
1074
- { "name": "inn", "required": true }
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": "sendcorporatelead",
1122
+ "endpoint": "initcorporatelead",
1099
1123
  "sections": [
1100
1124
  {
1101
- "inputs": [{ "name": "name", "required": true }]
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": "sendcorporatelead",
1166
+ "endpoint": "initcorporatelead",
1138
1167
  "sections": [
1139
1168
  {
1140
- "inputs": [{ "name": "name", "required": true }]
1169
+ "inputs": [
1170
+ {
1171
+ "name": "name",
1172
+ "required": true
1173
+ }
1174
+ ]
1141
1175
  },
1142
1176
  {
1143
1177
  "columns": 2,
1144
- "inputs": [{ "name": "phone", "required": true }, { "name": "inn" }]
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": "sendcorporatelead",
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": "sendcorporatelead",
1521
+ "endpoint": "initcorporatelead",
1472
1522
  "sections": [
1473
1523
  {
1474
- "inputs": [{ "name": "name", "required": true }]
1524
+ "inputs": [
1525
+ {
1526
+ "name": "name",
1527
+ "required": true
1528
+ }
1529
+ ]
1475
1530
  },
1476
1531
  {
1477
1532
  "columns": 2,
1478
- "inputs": [{ "name": "phone", "required": true }, { "name": "inn" }]
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
+ ]
@@ -38,10 +38,11 @@ export type FieldDef = Required &
38
38
  name?: NameFieldDef;
39
39
  dadata?: boolean;
40
40
  defaultValue?: string;
41
+ placeholder?: string;
41
42
  };
42
43
 
43
44
  /** @hidden */
44
- export type EndpointType = 'lead' | 'sendcorporatelead' | 'initcorporatelead';
45
+ export type EndpointType = 'lead' | 'initcorporatelead';
45
46
 
46
47
  /**
47
48
  * @title Секция полей ввода
@@ -22,6 +22,7 @@ import { CreditForm } from './CreditForm/CreditForm';
22
22
  import { DebitForm } from './DebitForm/DebitForm';
23
23
  import { DepositFiltration } from './DepositFiltration/DepositFiltration';
24
24
  import { ErrorBlock } from './ErrorBlock/ErrorBlock';
25
+ import { ExchangeRateTile } from './ExchangeRateTile/ExchangeRateTile';
25
26
  import { Footer } from './Footer/Footer';
26
27
  import { GalleryLayout } from './GalleryLayout/GalleryLayout';
27
28
  import { GrantSupport } from './GrantSupport/GrantSupport';
@@ -61,6 +62,7 @@ export const Blocks: BlocksRegistry = {
61
62
  CarouselTariffsCard,
62
63
  DepositFiltration,
63
64
  ErrorBlock,
65
+ ExchangeRateTile,
64
66
  Footer,
65
67
  GalleryLayout,
66
68
  GrantSupport,
@@ -0,0 +1,6 @@
1
+ export enum Currency {
2
+ RUB = 'RUB',
3
+ EUR = 'EUR',
4
+ USD = 'USD',
5
+ CNY = 'CNY',
6
+ }
@@ -0,0 +1,64 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { type ComponentType } from '../../model/ComponentType';
3
+ import { Img } from '../../ui-kit/Img/Img';
4
+ import { Text } from '../../ui-kit/Text/Text';
5
+ import { style } from '../../utils/style';
6
+ import { type ExchangeCurrencyItem } from './ExchangeCurrencyCalculator';
7
+ import { formatCurrency } from './formatCurrency';
8
+
9
+ const TABLE_STYLE_BASE = 'text-m font-light text-secondary-text ';
10
+ const TABLE_HEAD_STYLE = `${TABLE_STYLE_BASE} text-left`;
11
+ const TABLE_HEAD_STYLE_CENTER = `${TABLE_STYLE_BASE} pl-5xl text-center`;
12
+ const TABLE_HEAD_STYLE_RIGHT = `${TABLE_STYLE_BASE} pl-5xl text-right`;
13
+
14
+ const CURRENCY_ICONS_MAP = {
15
+ USD: 'DollarIcon',
16
+ EUR: 'EuroIcon',
17
+ CNY: 'ChineseYuanRenminbiIcon',
18
+ };
19
+
20
+ interface CurrencyTableProps extends ComponentType {
21
+ exchangeCurrencyItems: ExchangeCurrencyItem[];
22
+ }
23
+
24
+ export const CurrencyTable = JSX<CurrencyTableProps>(({ className, exchangeCurrencyItems }) => (
25
+ <table className={style('h-fit w-full', className)}>
26
+ <thead>
27
+ <tr>
28
+ <th className={TABLE_HEAD_STYLE}>
29
+ <Text size="text-m">Валюта</Text>
30
+ </th>
31
+ <th className={TABLE_HEAD_STYLE_CENTER}>
32
+ <Text size="text-m">Купить</Text>
33
+ </th>
34
+ <th className={TABLE_HEAD_STYLE_RIGHT}>
35
+ <Text size="text-m">Продать</Text>
36
+ </th>
37
+ </tr>
38
+ </thead>
39
+ <tbody>{exchangeCurrencyItems.map(renderCurrencyRow)}</tbody>
40
+ </table>
41
+ ));
42
+
43
+ const renderCurrencyRow = (exchangeCurrencyItem: ExchangeCurrencyItem) => {
44
+ const currency = exchangeCurrencyItem?.currency?.currency;
45
+
46
+ return (
47
+ <tr key={currency} className="pb-2xs text-h6">
48
+ <td className="pt-m m-auto flex text-left">
49
+ <div className="flex items-center gap-xs">
50
+ {currency ? (
51
+ <Img image={{ icon: CURRENCY_ICONS_MAP[currency] }} width="24" height="24" />
52
+ ) : null}
53
+ <Text size="text-h6">{currency}</Text>
54
+ </div>
55
+ </td>
56
+ <td className="pt-m pl-5xl text-center">
57
+ <Text size="text-h6">{formatCurrency(exchangeCurrencyItem?.saleExchangeRate)}</Text>
58
+ </td>
59
+ <td className="pt-m pl-5xl text-right">
60
+ <Text size="text-h6">{formatCurrency(exchangeCurrencyItem?.buyExchangeRate)}</Text>
61
+ </td>
62
+ </tr>
63
+ );
64
+ };
@@ -0,0 +1,28 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { type ComponentType } from '../../model/ComponentType';
3
+ import { type Picture } from '../../model/Picture';
4
+ import { RoundedIcon } from '../../ui-kit/Icon/RoundedIcon';
5
+ import { Paragraph } from '../../ui-kit/Paragraph/Paragraph';
6
+ import { style } from '../../utils/style';
7
+
8
+ interface CurrentLocationProps extends ComponentType {
9
+ address?: string;
10
+ }
11
+
12
+ const icon: Picture = { icon: 'GpsIcon' };
13
+
14
+ export const CurrentLocation = JSX<CurrentLocationProps>(({ className = '', address }) => (
15
+ <div className={style('flex gap-s w-full justify-between @sm:justify-center', className)}>
16
+ <RoundedIcon {...icon} iconBgVersion="primary" className="shrink-0" />
17
+ <div className="space-y-2xs whitespace-pre-wrap">
18
+ {address ? (
19
+ <Paragraph size="text-l" color="text-primary-main">
20
+ {address}
21
+ </Paragraph>
22
+ ) : null}
23
+ <Paragraph size="text-m" color="text-secondary-text">
24
+ Курс указан для заданного офиса
25
+ </Paragraph>
26
+ </div>
27
+ </div>
28
+ ));
@@ -0,0 +1,155 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { type ComponentType } from '../../model/ComponentType';
4
+ import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
5
+ import { type ButtonCommonContent } from '../../ui-kit/LinkButton/LinkButtonContent';
6
+ import { calculateResult, formatValue } from './calculateResult';
7
+ import { callbackCurrencySelect } from './callbackCurrencySelect';
8
+ import { Currency } from './CurrencyProps';
9
+ import { renderInput } from './renderInput';
10
+
11
+ export interface ExchangeCurrencyItem {
12
+ currency?: {
13
+ id?: number;
14
+ code?: string;
15
+ currency?: Currency;
16
+ };
17
+ buyExchangeRate?: number;
18
+ saleExchangeRate?: number;
19
+ }
20
+
21
+ export interface ExchangeCurrencyCalculatorProps extends ComponentType {
22
+ currencyRatesBuy: ExchangeCurrencyItem[];
23
+ currencyRatesSell: ExchangeCurrencyItem[];
24
+ button?: ButtonCommonContent;
25
+ }
26
+
27
+ export interface CalcState {
28
+ inputSell: string;
29
+ inputBuy: string;
30
+ selectSell: Currency;
31
+ selectBuy: Currency;
32
+ }
33
+
34
+ export const ExchangeCurrencyCalculator = JSX<ExchangeCurrencyCalculatorProps>(
35
+ ({ className = '', currencyRatesBuy, currencyRatesSell, button }) => {
36
+ const [calcState, setCalcState] = useState<CalcState>({
37
+ inputSell: '',
38
+ inputBuy: '',
39
+ selectSell: currencyRatesBuy?.[0]?.currency?.currency || Currency.RUB,
40
+ selectBuy: currencyRatesSell?.[0]?.currency?.currency || Currency.USD,
41
+ });
42
+
43
+ const handleSetCalcState = useCallback(
44
+ (newState: Partial<CalcState>) => setCalcState((oldState) => ({ ...oldState, ...newState })),
45
+ [],
46
+ );
47
+
48
+ return (
49
+ <div className={`flex flex-col gap-m pt-2xl ${className}`}>
50
+ {currencyRatesBuy && currencyRatesSell ? (
51
+ <div className="grid gap-m">
52
+ {renderInput({
53
+ placeholder: 'Хочу продать',
54
+ rates: currencyRatesSell,
55
+ selected: calcState.selectSell,
56
+ setSelected: handleSelectSell(calcState, handleSetCalcState, currencyRatesSell),
57
+ value: calcState.inputSell,
58
+ onChange: (value) =>
59
+ handleInputSell(handleSetCalcState, currencyRatesSell)(
60
+ value,
61
+ calcState.selectSell,
62
+ calcState.selectBuy,
63
+ ),
64
+ })}
65
+ {renderInput({
66
+ placeholder: 'Получу',
67
+ rates: currencyRatesBuy,
68
+ selected: calcState.selectBuy,
69
+ setSelected: handleSelectBuy(calcState, handleSetCalcState, currencyRatesBuy),
70
+ value: calcState.inputBuy,
71
+ onChange: (value) =>
72
+ handleInputBuy(handleSetCalcState, currencyRatesBuy)(
73
+ value,
74
+ calcState.selectBuy,
75
+ calcState.selectSell,
76
+ ),
77
+ })}
78
+ </div>
79
+ ) : null}
80
+ {button?.text ? (
81
+ <LinkButton text={button.text} version={button?.version} {...button} />
82
+ ) : null}
83
+ </div>
84
+ );
85
+ },
86
+ );
87
+
88
+ const handleSelectSell =
89
+ (
90
+ calcState: CalcState,
91
+ setCalcState: (state: Partial<CalcState>) => void,
92
+ currencyRatesSell: ExchangeCurrencyItem[],
93
+ ) =>
94
+ (value: Currency) => {
95
+ setCalcState({ selectSell: value });
96
+ callbackCurrencySelect({
97
+ value,
98
+ oppositeValue: calcState.selectBuy,
99
+ handleConvert: (currencyFrom = calcState.selectSell, currencyTo = calcState.selectBuy) => {
100
+ handleInputSell(setCalcState, currencyRatesSell)(
101
+ calcState.inputSell,
102
+ currencyFrom,
103
+ currencyTo,
104
+ );
105
+ },
106
+ });
107
+ };
108
+
109
+ const handleSelectBuy =
110
+ (
111
+ calcState: CalcState,
112
+ setCalcState: (state: Partial<CalcState>) => void,
113
+ currencyRatesBuy: ExchangeCurrencyItem[],
114
+ ) =>
115
+ (value: Currency) => {
116
+ setCalcState({ selectBuy: value });
117
+ callbackCurrencySelect({
118
+ value,
119
+ oppositeValue: calcState.selectSell,
120
+ handleConvert: (currencyTo = calcState.selectBuy, currencyFrom = calcState.selectSell) =>
121
+ handleInputBuy(setCalcState, currencyRatesBuy)(
122
+ calcState.inputBuy,
123
+ currencyTo,
124
+ currencyFrom,
125
+ ),
126
+ });
127
+ };
128
+
129
+ const handleInputSell =
130
+ (setCalcState: (state: Partial<CalcState>) => void, currencyRatesSell: ExchangeCurrencyItem[]) =>
131
+ (value: string, currencyFrom: Currency, currencyTo: Currency) => {
132
+ setCalcState({ inputSell: formatValue(value), selectBuy: currencyTo });
133
+ const rate =
134
+ currencyRatesSell.find((_) => _.currency?.currency === currencyTo)?.buyExchangeRate ||
135
+ currencyRatesSell.find((_) => _.currency?.currency === currencyFrom)?.buyExchangeRate;
136
+ if (rate) {
137
+ setCalcState({
138
+ inputBuy: String(calculateResult(value, rate, currencyFrom === Currency.RUB) || ''),
139
+ });
140
+ }
141
+ };
142
+
143
+ const handleInputBuy =
144
+ (setCalcState: (state: Partial<CalcState>) => void, currencyRatesBuy: ExchangeCurrencyItem[]) =>
145
+ (value: string, currencyTo: Currency, currencyFrom: Currency) => {
146
+ setCalcState({ inputBuy: formatValue(value), selectSell: currencyFrom });
147
+ const rate =
148
+ currencyRatesBuy.find((_) => _.currency?.currency === currencyFrom)?.saleExchangeRate ||
149
+ currencyRatesBuy.find((_) => _.currency?.currency === currencyTo)?.saleExchangeRate;
150
+ if (rate) {
151
+ setCalcState({
152
+ inputSell: String(calculateResult(value, rate, currencyTo === Currency.RUB) || ''),
153
+ });
154
+ }
155
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "content": {
3
+ "version": "primary",
4
+ "padding": "",
5
+ "button": {
6
+ "href": "https://coins.rshb.ru/exchange",
7
+ "text": "Купить валюту",
8
+ "target": "_blank",
9
+ "version": "primary"
10
+ }
11
+ }
12
+ }