@redneckz/wildless-cms-uni-blocks 0.2.85 → 0.2.88
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/bundle/blocks.schema.json +1 -945
- package/bundle/bundle.umd.js +551 -487
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/Accordion/Accordion.js +1 -1
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/AccordionBlocks.d.ts +3 -0
- package/dist/components/Accordion/AccordionBlocks.js +6 -0
- package/dist/components/Accordion/AccordionBlocks.js.map +1 -1
- package/dist/components/Accordion/AccordionContent.d.ts +37 -10
- package/dist/components/Accordion/AccordionItem.d.ts +2 -2
- package/dist/components/Accordion/AccordionItem.js +5 -6
- package/dist/components/Accordion/AccordionItem.js.map +1 -1
- package/dist/components/BaseTile/BaseTile.d.ts +2 -2
- package/dist/components/BaseTile/BaseTile.js +14 -4
- package/dist/components/BaseTile/BaseTile.js.map +1 -1
- package/dist/components/BaseTile/BaseTileProps.d.ts +41 -0
- package/dist/{model/SitemapContent.js → components/BaseTile/BaseTileProps.js} +1 -1
- package/dist/components/BaseTile/BaseTileProps.js.map +1 -0
- package/dist/components/BenefitsBlock/BenefitsBlock.d.ts +1 -1
- package/dist/components/BenefitsBlock/BenefitsBlock.js +2 -1
- package/dist/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
- package/dist/components/BenefitsBlock/BenefitsBlockContent.d.ts +14 -1
- package/dist/components/BlockContent.d.ts +7 -2
- package/dist/components/Blocks.d.ts +17 -14
- package/dist/components/Blocks.js +23 -17
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/ComparisonTable/ComparisonTableContent.d.ts +45 -2
- package/dist/components/ComparisonTable/HeaderCell.d.ts +2 -2
- package/dist/components/ContentPage/ContentPage.d.ts +3 -2
- package/dist/components/ContentPage/ContentPage.js.map +1 -1
- package/dist/components/CreditCalculator/CreditCalculatorContent.d.ts +4 -0
- package/dist/components/ExchangeRateTile/ExchangeRateTile.d.ts +1 -1
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/dist/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +4 -0
- package/dist/components/Footer/Contacts.js +2 -2
- package/dist/components/Footer/Contacts.js.map +1 -1
- package/dist/components/Footer/FooterContent.d.ts +35 -9
- package/dist/components/Footer/FooterLink.d.ts +2 -2
- package/dist/components/Footer/HorizontalNavigation.js.map +1 -1
- package/dist/components/Footer/Sitemap.d.ts +1 -1
- package/dist/components/Footer/Sitemap.js +1 -1
- package/dist/components/Footer/Sitemap.js.map +1 -1
- package/dist/components/Footer/SocialMedia.d.ts +2 -2
- package/dist/components/Footer/TextInformation.js.map +1 -1
- package/dist/components/Gallery/GalleryContent.d.ts +13 -0
- package/dist/components/Header/HeaderContent.d.ts +10 -2
- package/dist/components/Header/isSubItemActive.d.ts +2 -2
- package/dist/components/Header/isSubItemActive.js.map +1 -1
- package/dist/components/Header/isTopItemActive.d.ts +2 -2
- package/dist/components/Header/isTopItemActive.js.map +1 -1
- package/dist/components/Headline/Headline.d.ts +5 -0
- package/dist/components/Headline/Headline.js +9 -0
- package/dist/components/Headline/Headline.js.map +1 -0
- package/dist/components/Headline/HeadlineContent.d.ts +15 -0
- package/dist/components/{BaseTile/BaseTileContent.js → Headline/HeadlineContent.js} +1 -1
- package/dist/components/Headline/HeadlineContent.js.map +1 -0
- package/dist/components/LinkDocs/LinkDocs.d.ts +5 -0
- package/dist/components/LinkDocs/LinkDocs.js +42 -0
- package/dist/components/LinkDocs/LinkDocs.js.map +1 -0
- package/dist/components/LinkDocs/LinkDocsContent.d.ts +23 -0
- package/dist/components/LinkDocs/LinkDocsContent.js +2 -0
- package/dist/components/LinkDocs/LinkDocsContent.js.map +1 -0
- package/dist/components/MiniGallery/MiniGallery.d.ts +3 -3
- package/dist/components/MiniGallery/MiniGalleryContent.d.ts +6 -0
- package/dist/components/MiniGallery/MiniGalleryContent.js +2 -0
- package/dist/components/MiniGallery/MiniGalleryContent.js.map +1 -0
- package/dist/components/MobileAppTile/MobileAppTileContent.d.ts +11 -2
- package/dist/components/MobileBlocks.d.ts +8 -6
- package/dist/components/MobileBlocks.js +10 -6
- package/dist/components/MobileBlocks.js.map +1 -1
- package/dist/components/PictureText/PictureText.d.ts +5 -0
- package/dist/components/PictureText/PictureText.js +14 -0
- package/dist/components/PictureText/PictureText.js.map +1 -0
- package/dist/components/PictureText/PictureTextContent.d.ts +11 -0
- package/dist/components/PictureText/PictureTextContent.js +2 -0
- package/dist/components/PictureText/PictureTextContent.js.map +1 -0
- package/dist/components/Placeholder/PlaceholderContent.d.ts +3 -0
- package/dist/components/ProductBlock/ProductBlock.mobile.d.ts +2 -2
- package/dist/components/ProductBlock/ProductBlock.mobile.js.map +1 -1
- package/dist/components/ProductBlock/ProductBlockContent.d.ts +10 -5
- package/dist/components/ProductBlock/ProductBlockInner.d.ts +2 -2
- package/dist/components/ProductBlock/ProductBlockInner.js +1 -1
- package/dist/components/ProductBlock/ProductBlockInner.js.map +1 -1
- package/dist/components/ProductGallery/ProductGallery.d.ts +1 -1
- package/dist/components/ProductGallery/ProductGallery.js.map +1 -1
- package/dist/components/ProductGallery/ProductGalleryContent.d.ts +19 -4
- package/dist/components/ProductTile/ProductTileContent.d.ts +6 -2
- package/dist/components/PromoTile/PromoTileContent.d.ts +6 -2
- package/dist/components/StepsBlock/StepsBlockContent.d.ts +13 -0
- package/dist/components/TextBlock/TextBlockContent.d.ts +13 -0
- package/dist/components/Tile/TileContent.d.ts +5 -2
- package/dist/hooks/useLink.d.ts +3 -3
- package/dist/hooks/useLink.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/mergeTopItems.d.ts +2 -2
- package/dist/mergeTopItems.js.map +1 -1
- package/dist/model/BlockVersion.d.ts +4 -0
- package/dist/model/ButtonVersion.d.ts +4 -0
- package/dist/model/LinkProps.d.ts +21 -0
- package/dist/model/{LinkContent.js → LinkProps.js} +1 -1
- package/dist/model/LinkProps.js.map +1 -0
- package/dist/model/Picture.d.ts +11 -0
- package/dist/model/SitemapProps.d.ts +13 -0
- package/dist/model/SitemapProps.js +2 -0
- package/dist/model/SitemapProps.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/ui-kit/Breadcrumb.d.ts +2 -2
- package/dist/ui-kit/Button/Button.d.ts +6 -3
- package/dist/ui-kit/Button/Button.js.map +1 -1
- package/dist/ui-kit/Button/ButtonProps.d.ts +15 -12
- package/dist/ui-kit/Icon/IconProps.d.ts +53 -18
- package/dist/ui-kit/Icon/IconProps.js +23 -18
- package/dist/ui-kit/Icon/IconProps.js.map +1 -1
- package/dist/ui-kit/TopItem/TopItem.d.ts +2 -2
- package/lib/common.css +1 -1
- package/lib/components/Accordion/Accordion.fixture.d.ts +1 -0
- package/lib/components/Accordion/Accordion.js +1 -1
- package/lib/components/Accordion/Accordion.js.map +1 -1
- package/lib/components/Accordion/AccordionBlocks.d.ts +3 -0
- package/lib/components/Accordion/AccordionBlocks.js +6 -0
- package/lib/components/Accordion/AccordionBlocks.js.map +1 -1
- package/lib/components/Accordion/AccordionContent.d.ts +37 -10
- package/lib/components/Accordion/AccordionItem.d.ts +2 -2
- package/lib/components/Accordion/AccordionItem.js +5 -6
- package/lib/components/Accordion/AccordionItem.js.map +1 -1
- package/lib/components/BaseTile/BaseTile.d.ts +2 -2
- package/lib/components/BaseTile/BaseTile.js +14 -4
- package/lib/components/BaseTile/BaseTile.js.map +1 -1
- package/lib/components/BaseTile/BaseTileProps.d.ts +41 -0
- package/lib/components/BaseTile/BaseTileProps.js +2 -0
- package/lib/components/BaseTile/BaseTileProps.js.map +1 -0
- package/lib/components/BenefitsBlock/BenefitsBlock.d.ts +1 -1
- package/lib/components/BenefitsBlock/BenefitsBlock.js +2 -1
- package/lib/components/BenefitsBlock/BenefitsBlock.js.map +1 -1
- package/lib/components/BenefitsBlock/BenefitsBlockContent.d.ts +14 -1
- package/lib/components/BlockContent.d.ts +7 -2
- package/lib/components/Blocks.d.ts +17 -14
- package/lib/components/Blocks.js +23 -17
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/ComparisonTable/ComparisonTableContent.d.ts +45 -2
- package/lib/components/ComparisonTable/HeaderCell.d.ts +2 -2
- package/lib/components/ContentPage/ContentPage.d.ts +3 -2
- package/lib/components/ContentPage/ContentPage.js.map +1 -1
- package/lib/components/CreditCalculator/CreditCalculatorContent.d.ts +4 -0
- package/lib/components/ExchangeRateTile/ExchangeRateTile.d.ts +1 -1
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
- package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
- package/lib/components/ExchangeRateTile/ExchangeRateTileContent.d.ts +4 -0
- package/lib/components/Footer/Contacts.js +2 -2
- package/lib/components/Footer/Contacts.js.map +1 -1
- package/lib/components/Footer/FooterContent.d.ts +35 -9
- package/lib/components/Footer/FooterLink.d.ts +2 -2
- package/lib/components/Footer/HorizontalNavigation.js.map +1 -1
- package/lib/components/Footer/Sitemap.d.ts +1 -1
- package/lib/components/Footer/Sitemap.js +1 -1
- package/lib/components/Footer/Sitemap.js.map +1 -1
- package/lib/components/Footer/SocialMedia.d.ts +2 -2
- package/lib/components/Footer/TextInformation.js.map +1 -1
- package/lib/components/Gallery/GalleryContent.d.ts +13 -0
- package/lib/components/Header/HeaderContent.d.ts +10 -2
- package/lib/components/Header/isSubItemActive.d.ts +2 -2
- package/lib/components/Header/isSubItemActive.js.map +1 -1
- package/lib/components/Header/isTopItemActive.d.ts +2 -2
- package/lib/components/Header/isTopItemActive.js.map +1 -1
- package/lib/components/Headline/Headline.d.ts +5 -0
- package/lib/components/Headline/Headline.fixture.d.ts +7 -0
- package/lib/components/Headline/Headline.js +7 -0
- package/lib/components/Headline/Headline.js.map +1 -0
- package/lib/components/Headline/HeadlineContent.d.ts +15 -0
- package/lib/components/Headline/HeadlineContent.js +2 -0
- package/lib/components/Headline/HeadlineContent.js.map +1 -0
- package/lib/components/LinkDocs/LinkDocs.d.ts +5 -0
- package/lib/components/LinkDocs/LinkDocs.fixture.d.ts +12 -0
- package/lib/components/LinkDocs/LinkDocs.js +40 -0
- package/lib/components/LinkDocs/LinkDocs.js.map +1 -0
- package/lib/components/LinkDocs/LinkDocsContent.d.ts +23 -0
- package/lib/components/LinkDocs/LinkDocsContent.js +2 -0
- package/lib/components/LinkDocs/LinkDocsContent.js.map +1 -0
- package/lib/components/MiniGallery/MiniGallery.d.ts +3 -3
- package/lib/components/MiniGallery/MiniGalleryContent.d.ts +6 -0
- package/lib/components/MiniGallery/MiniGalleryContent.js +2 -0
- package/lib/components/MiniGallery/MiniGalleryContent.js.map +1 -0
- package/lib/components/MobileAppTile/MobileAppTileContent.d.ts +11 -2
- package/lib/components/MobileBlocks.d.ts +8 -6
- package/lib/components/MobileBlocks.js +10 -6
- package/lib/components/MobileBlocks.js.map +1 -1
- package/lib/components/PictureText/PictureText.d.ts +5 -0
- package/lib/components/PictureText/PictureText.fixture.d.ts +4 -0
- package/lib/components/PictureText/PictureText.js +12 -0
- package/lib/components/PictureText/PictureText.js.map +1 -0
- package/lib/components/PictureText/PictureTextContent.d.ts +11 -0
- package/lib/components/PictureText/PictureTextContent.js +2 -0
- package/lib/components/PictureText/PictureTextContent.js.map +1 -0
- package/lib/components/Placeholder/PlaceholderContent.d.ts +3 -0
- package/lib/components/ProductBlock/ProductBlock.mobile.d.ts +2 -2
- package/lib/components/ProductBlock/ProductBlock.mobile.js.map +1 -1
- package/lib/components/ProductBlock/ProductBlockContent.d.ts +10 -5
- package/lib/components/ProductBlock/ProductBlockInner.d.ts +2 -2
- package/lib/components/ProductBlock/ProductBlockInner.js +1 -1
- package/lib/components/ProductBlock/ProductBlockInner.js.map +1 -1
- package/lib/components/ProductGallery/ProductGallery.d.ts +1 -1
- package/lib/components/ProductGallery/ProductGallery.js.map +1 -1
- package/lib/components/ProductGallery/ProductGalleryContent.d.ts +19 -4
- package/lib/components/ProductTile/ProductTileContent.d.ts +6 -2
- package/lib/components/PromoTile/PromoTileContent.d.ts +6 -2
- package/lib/components/StepsBlock/StepsBlockContent.d.ts +13 -0
- package/lib/components/TextBlock/TextBlockContent.d.ts +13 -0
- package/lib/components/Tile/TileContent.d.ts +5 -2
- package/lib/hooks/useLink.d.ts +3 -3
- package/lib/hooks/useLink.js.map +1 -1
- package/lib/index.d.ts +12 -12
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib/mergeTopItems.d.ts +2 -2
- package/lib/mergeTopItems.js.map +1 -1
- package/lib/model/BlockVersion.d.ts +4 -0
- package/lib/model/ButtonVersion.d.ts +4 -0
- package/lib/model/LinkProps.d.ts +21 -0
- package/lib/model/LinkProps.js +2 -0
- package/lib/model/LinkProps.js.map +1 -0
- package/lib/model/Picture.d.ts +11 -0
- package/lib/model/SitemapProps.d.ts +13 -0
- package/lib/model/SitemapProps.js +2 -0
- package/lib/model/SitemapProps.js.map +1 -0
- package/lib/types.d.ts +2 -2
- package/lib/ui-kit/Breadcrumb.d.ts +2 -2
- package/lib/ui-kit/Button/Button.d.ts +6 -3
- package/lib/ui-kit/Button/Button.js.map +1 -1
- package/lib/ui-kit/Button/ButtonProps.d.ts +15 -12
- package/lib/ui-kit/Icon/IconProps.d.ts +53 -18
- package/lib/ui-kit/Icon/IconProps.js +23 -18
- package/lib/ui-kit/Icon/IconProps.js.map +1 -1
- package/lib/ui-kit/TopItem/TopItem.d.ts +2 -2
- package/package.json +2 -22
- package/src/components/Accordion/Accordion.example.json +74 -0
- package/src/components/Accordion/Accordion.fixture.tsx +93 -7
- package/src/components/Accordion/Accordion.tsx +1 -1
- package/src/components/Accordion/AccordionBlocks.tsx +6 -0
- package/src/components/Accordion/AccordionContent.ts +43 -11
- package/src/components/Accordion/AccordionItem.tsx +10 -10
- package/src/components/BaseTile/BaseTile.tsx +22 -9
- package/src/components/BaseTile/BaseTileProps.ts +44 -0
- package/src/components/BenefitsBlock/BenefitsBlock.example.json +13 -0
- package/src/components/BenefitsBlock/BenefitsBlock.tsx +3 -2
- package/src/components/BenefitsBlock/BenefitsBlockContent.ts +14 -1
- package/src/components/BlockContent.ts +19 -12
- package/src/components/Blocks.ts +23 -17
- package/src/components/ComparisonTable/ComparisonTable.example.json +84 -0
- package/src/components/ComparisonTable/ComparisonTableContent.ts +46 -3
- package/src/components/ComparisonTable/HeaderCell.tsx +2 -2
- package/src/components/ContentPage/ContentPage.page.json +88 -2
- package/src/components/ContentPage/ContentPage.tsx +7 -5
- package/src/components/CreditCalculator/CreditCalculatorContent.ts +4 -0
- package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
- package/src/components/ExchangeRateTile/ExchangeRateTileContent.ts +4 -0
- package/src/components/Footer/Contacts.tsx +2 -2
- package/src/components/Footer/FooterContent.ts +36 -9
- package/src/components/Footer/FooterLink.ts +2 -2
- package/src/components/Footer/HorizontalNavigation.tsx +2 -2
- package/src/components/Footer/Sitemap.tsx +5 -5
- package/src/components/Footer/SocialMedia.tsx +2 -2
- package/src/components/Footer/TextInformation.tsx +2 -2
- package/src/components/Gallery/Gallery.example.json +71 -0
- package/src/components/Gallery/GalleryContent.ts +13 -0
- package/src/components/Header/HeaderContent.ts +10 -2
- package/src/components/Header/isSubItemActive.ts +3 -3
- package/src/components/Header/isTopItemActive.ts +3 -3
- package/src/components/Headline/Headline.example.json +6 -0
- package/src/components/Headline/Headline.fixture.tsx +42 -0
- package/src/components/Headline/Headline.tsx +15 -0
- package/src/components/Headline/HeadlineContent.ts +18 -0
- package/src/components/LinkDocs/LinkDocs.fixture.tsx +51 -0
- package/src/components/LinkDocs/LinkDocs.tsx +81 -0
- package/src/components/LinkDocs/LinkDocsContent.ts +26 -0
- package/src/components/MiniGallery/MiniGallery.example.json +61 -0
- package/src/components/MiniGallery/MiniGallery.tsx +3 -3
- package/src/components/MiniGallery/MiniGalleryContent.ts +6 -0
- package/src/components/MobileAppTile/MobileAppTile.example.json +20 -0
- package/src/components/MobileAppTile/MobileAppTileContent.ts +11 -2
- package/src/components/MobileBlocks.ts +10 -6
- package/src/components/PictureText/PictureText.example.json +20 -0
- package/src/components/PictureText/PictureText.fixture.tsx +36 -0
- package/src/components/PictureText/PictureText.tsx +45 -0
- package/src/components/PictureText/PictureTextContent.ts +13 -0
- package/src/components/Placeholder/PlaceholderContent.ts +3 -0
- package/src/components/ProductBlock/ProductBlock.example.json +17 -0
- package/src/components/ProductBlock/ProductBlock.mobile.tsx +3 -3
- package/src/components/ProductBlock/ProductBlockContent.ts +10 -5
- package/src/components/ProductBlock/ProductBlockInner.tsx +4 -4
- package/src/components/ProductGallery/ProductGallery.example.json +21 -0
- package/src/components/ProductGallery/ProductGallery.tsx +3 -3
- package/src/components/ProductGallery/ProductGalleryContent.ts +19 -4
- package/src/components/ProductTile/ProductTile.example.json +30 -0
- package/src/components/ProductTile/ProductTileContent.ts +6 -2
- package/src/components/PromoTile/PromoTile.example.json +13 -0
- package/src/components/PromoTile/PromoTileContent.ts +6 -2
- package/src/components/StepsBlock/StepsBlock.example.json +17 -0
- package/src/components/StepsBlock/StepsBlockContent.ts +13 -0
- package/src/components/TextBlock/TextBlock.example.json +6 -0
- package/src/components/TextBlock/TextBlockContent.ts +14 -0
- package/src/components/Tile/Tile.example.json +18 -0
- package/src/components/Tile/TileContent.ts +5 -2
- package/src/hooks/useLink.ts +2 -2
- package/src/icons/DiscountShape.svg +7 -0
- package/src/icons/DocIcon.svg +1 -1
- package/src/icons/DocumentText.svg +6 -0
- package/src/index.ts +14 -21
- package/src/mergeTopItems.ts +5 -5
- package/src/model/BlockVersion.ts +4 -0
- package/src/model/ButtonVersion.ts +4 -0
- package/src/model/LinkProps.ts +22 -0
- package/src/model/Picture.ts +11 -0
- package/src/model/SitemapProps.ts +15 -0
- package/src/types.ts +2 -2
- package/src/ui-kit/Breadcrumb.tsx +2 -2
- package/src/ui-kit/Button/Button.tsx +7 -3
- package/src/ui-kit/Button/ButtonProps.ts +16 -13
- package/src/ui-kit/Icon/IconProps.ts +39 -4
- package/src/ui-kit/TopItem/TopItem.tsx +2 -2
- package/dist/components/BaseTile/BaseTileContent.d.ts +0 -13
- package/dist/components/BaseTile/BaseTileContent.js.map +0 -1
- package/dist/model/LinkContent.d.ts +0 -5
- package/dist/model/LinkContent.js.map +0 -1
- package/dist/model/SitemapContent.d.ts +0 -7
- package/dist/model/SitemapContent.js.map +0 -1
- package/lib/components/BaseTile/BaseTileContent.d.ts +0 -13
- package/lib/components/BaseTile/BaseTileContent.js +0 -2
- package/lib/components/BaseTile/BaseTileContent.js.map +0 -1
- package/lib/model/LinkContent.d.ts +0 -5
- package/lib/model/LinkContent.js +0 -2
- package/lib/model/LinkContent.js.map +0 -1
- package/lib/model/SitemapContent.d.ts +0 -7
- package/lib/model/SitemapContent.js +0 -2
- package/lib/model/SitemapContent.js.map +0 -1
- package/src/components/BaseTile/BaseTileContent.ts +0 -14
- package/src/icons/MinusIcon.svg +0 -1
- package/src/icons/PlusIcon.svg +0 -1
- package/src/model/LinkContent.ts +0 -5
- package/src/model/SitemapContent.ts +0 -9
package/bundle/bundle.umd.js
CHANGED
|
@@ -38,36 +38,36 @@
|
|
|
38
38
|
return Component._tmpl;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
get CDN() {
|
|
68
|
-
return this._.CDN;
|
|
41
|
+
const getGeolocation = async () => new Promise((resolve) => navigator.geolocation.getCurrentPosition(({ coords }) => resolve(coords)));
|
|
42
|
+
|
|
43
|
+
function DaDataAPI(baseURL = '') {
|
|
44
|
+
async function getFetcherAddress() {
|
|
45
|
+
if (!('geolocation' in navigator)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const coords = await getGeolocation();
|
|
50
|
+
const response = await fetch(`${baseURL}/geolocate`, {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
mode: 'cors',
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
lat: coords.latitude,
|
|
55
|
+
lon: coords.longitude,
|
|
56
|
+
count: 1,
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
const data = (await response.json());
|
|
60
|
+
return data?.suggestions?.[0]?.data?.city;
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
console.error(e);
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
69
66
|
}
|
|
70
|
-
|
|
67
|
+
return {
|
|
68
|
+
getFetcherAddress,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
71
|
|
|
72
72
|
const AUTH_PREFIX = 'guest';
|
|
73
73
|
const STORAGE_KEY = 'likesToken';
|
|
@@ -185,109 +185,6 @@
|
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
const getGeolocation = async () => new Promise((resolve) => navigator.geolocation.getCurrentPosition(({ coords }) => resolve(coords)));
|
|
189
|
-
|
|
190
|
-
function DaDataAPI(baseURL = '') {
|
|
191
|
-
async function getFetcherAddress() {
|
|
192
|
-
if (!('geolocation' in navigator)) {
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
try {
|
|
196
|
-
const coords = await getGeolocation();
|
|
197
|
-
const response = await fetch(`${baseURL}/geolocate`, {
|
|
198
|
-
method: 'POST',
|
|
199
|
-
mode: 'cors',
|
|
200
|
-
body: JSON.stringify({
|
|
201
|
-
lat: coords.latitude,
|
|
202
|
-
lon: coords.longitude,
|
|
203
|
-
count: 1,
|
|
204
|
-
}),
|
|
205
|
-
});
|
|
206
|
-
const data = (await response.json());
|
|
207
|
-
return data?.suggestions?.[0]?.data?.city;
|
|
208
|
-
}
|
|
209
|
-
catch (e) {
|
|
210
|
-
console.error(e);
|
|
211
|
-
return null;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return {
|
|
215
|
-
getFetcherAddress,
|
|
216
|
-
};
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const ContentPageHead = JSX(({ HeadComponent, data, children }) => {
|
|
220
|
-
const { title, description, keywords, robots, og } = data;
|
|
221
|
-
return (jsxs(HeadComponent, { children: [jsx("title", { children: title }), jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), description && jsx("meta", { name: "description", content: description }), keywords && jsx("meta", { name: "keywords", content: keywords.join(',') }), robots && jsx("meta", { name: "robots", content: robots.join(',') }), og
|
|
222
|
-
? Object.entries(og).map(([key, value]) => (jsx("meta", { name: `og:${key}`, content: value }, key)))
|
|
223
|
-
: null, children] }));
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
const LikeButton = JSX(({ className, onClick, ariaLabel }) => (jsx("button", { type: "button", className: `border-0 w-[36px] bg-inherit cursor-pointer ${className || ''}`, onClick: onClick, "aria-label": ariaLabel, children: renderLikeIcon() })));
|
|
227
|
-
const renderLikeIcon = () => {
|
|
228
|
-
const params = {
|
|
229
|
-
stroke: '#292D32',
|
|
230
|
-
strokeLinecap: 'round',
|
|
231
|
-
strokeLinejoin: 'round',
|
|
232
|
-
strokeWidth: '1.5',
|
|
233
|
-
};
|
|
234
|
-
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsx("path", { ...params, strokeMiterlimit: "10", d: "M21.48 11.95c.5-1.4-.4-2.6-1.9-2.6h-4c-.6 0-1.1-.5-1-1.2l.5-3.2c.2-.9-.4-1.9-1.3-2.2-.8-.3-1.8.1-2.2.7l-4.1 6.1M7.48 18.35l3.1 2.4c.4.4 1.3.6 1.9.6h3.8c1.2 0 2.5-.9 2.8-2.1l1.24-3.77" }), jsx("path", { ...params, d: "M2.38 18.35v-9.8c0-1.4.6-1.9 2-1.9h1c1.4 0 2 .5 2 1.9v9.8c0 1.4-.6 1.9-2 1.9h-1c-1.4 0-2-.5-2-1.9Z" })] }));
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
const LikeControl = JSX(({ className, context }) => {
|
|
238
|
-
const likeService = context.useLikeService();
|
|
239
|
-
return (jsxs("div", { className: `border-main border-2 border-solid bg-white flex w-[125px] items-center justify-center gap-3 p-2 font-sans ${className || ''}`, children: [jsx(LikeButton, { onClick: likeService.like, ariaLabel: "\u041F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u00AB\u043B\u0430\u0439\u043A\u00BB" }), jsx(LikeButton, { onClick: likeService.dislike, className: "rotate-180", ariaLabel: "\u041F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u00AB\u0434\u0438\u0437\u043B\u0430\u0439\u043A\u00BB" }), jsx("span", { className: "select-none", children: likeService.likeCount })] }));
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
const listStyleMap = {
|
|
243
|
-
primary: 'bg-primary-main',
|
|
244
|
-
secondary: 'bg-white',
|
|
245
|
-
};
|
|
246
|
-
const textStyleMap = {
|
|
247
|
-
primary: 'text-primary-text',
|
|
248
|
-
secondary: 'text-white',
|
|
249
|
-
};
|
|
250
|
-
const BlockItem = JSX(({ className, text, children, version = 'primary' }) => {
|
|
251
|
-
return (jsxs("div", { className: `inline-block flex ${className || ''}`, role: "listitem", children: [jsx("div", { className: `inline-block w-[8px] h-[8px] min-w-[8px] min-h-[8px] rounded-full mt-2 ${listStyleMap[version]}` }), jsx("span", { className: `text-base font-normal font-sans mx-3 ${textStyleMap[version]}`, children: text || children })] }));
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
const buttonStyleMap = {
|
|
255
|
-
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
256
|
-
secondary: 'text-primary-main bg-secondary-light hover:bg-secondary-hover active:bg-secondary-active',
|
|
257
|
-
};
|
|
258
|
-
const buttonDisabledStyleMap = {
|
|
259
|
-
primary: 'bg-secondary-dark text-secondary-text',
|
|
260
|
-
secondary: 'bg-secondary-light text-secondary-text',
|
|
261
|
-
};
|
|
262
|
-
const styleButton = 'inline-block text-center font-sans select-none';
|
|
263
|
-
const Button = JSX(({ className, text, aboveText, appendLeft, href, target, onClick, children, disabled, rounded, version = 'none', ariaLabel, ...rest }) => {
|
|
264
|
-
const buttonInner = children ?? (jsx(ButtonInner, { text: text, aboveText: aboveText, appendLeft: appendLeft, rounded: rounded }));
|
|
265
|
-
if (disabled) {
|
|
266
|
-
return (jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabIndex: "-1", className: `${styleButton} ${buttonDisabledStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, children: buttonInner }));
|
|
267
|
-
}
|
|
268
|
-
return (jsx("a", { className: `${styleButton} cursor-pointer no-underline ${buttonStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, href: href, target: target, onClick: onClick, "aria-label": ariaLabel, role: !href ? 'button' : 'link', ...rest, children: buttonInner }));
|
|
269
|
-
});
|
|
270
|
-
const ButtonInner = JSX(({ text, aboveText, appendLeft, rounded }) => {
|
|
271
|
-
const withoutText = !text && !aboveText && Boolean(appendLeft);
|
|
272
|
-
const buttonInnerClasses = `flex items-center justify-center ${withoutText ? 'h-12 w-12 min-h-12 min-w-12' : `px-8 gap-2 ${aboveText ? 'py-2' : 'py-[13px]'}`} ${rounded ? 'rounded-full' : ''}`;
|
|
273
|
-
return (jsxs("div", { className: buttonInnerClasses, children: [appendLeft ? appendLeft : null, !withoutText ? (jsxs("div", { children: [jsx("div", { className: "text-xxs text-left", children: aboveText }), jsx("div", { className: "text-sm font-medium text-left", children: text })] })) : null] }));
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
const Icon = JSX(({ className, name, alt = `Icon ${name}`, title = alt, asSVG, ...imgProps }) => {
|
|
277
|
-
const href = `${projectSettings.CDN || ''}icons/${name}.svg`;
|
|
278
|
-
if (asSVG) {
|
|
279
|
-
return (jsxs("svg", { className: className, ...imgProps, "aria-hidden": "true", children: [title ? jsx("title", { children: title }) : null, alt ? jsx("desc", { children: alt }) : null, jsx("use", { href: `${href}#icon`, xlinkHref: `${href}#icon` })] }));
|
|
280
|
-
}
|
|
281
|
-
return (jsx("img", { className: className, src: href, alt: alt, title: title, ...imgProps, "aria-hidden": "true" }));
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
const Img = JSX(({ className, image }) => (jsxs("picture", { className: `${className || ''}`, children: [image.sources?.length
|
|
285
|
-
? image.sources.map(({ src, format }, index) => (jsx("source", { srcSet: src, type: formatToMimeType(format) }, `${index}_${src}`)))
|
|
286
|
-
: null, jsx("img", { src: image.src, alt: image.alt || image.title, title: image.title, ...image?.size })] })));
|
|
287
|
-
function formatToMimeType(format) {
|
|
288
|
-
return format ? `image/${String(format)}` : undefined;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
188
|
var SizeTableClass;
|
|
292
189
|
(function (SizeTableClass) {
|
|
293
190
|
SizeTableClass["XL"] = "text-title-lg";
|
|
@@ -302,6 +199,45 @@
|
|
|
302
199
|
});
|
|
303
200
|
const getClasses = (...classes) => classes.filter(Boolean).join(' ');
|
|
304
201
|
|
|
202
|
+
const projectSettings = new (class {
|
|
203
|
+
_ = {
|
|
204
|
+
PROD_BRANCH: 'master',
|
|
205
|
+
FORCED_DRAFT_FLOW: false,
|
|
206
|
+
};
|
|
207
|
+
setup(_) {
|
|
208
|
+
this._ = _;
|
|
209
|
+
}
|
|
210
|
+
get TEST_BRANCH() {
|
|
211
|
+
return this._.TEST_BRANCH;
|
|
212
|
+
}
|
|
213
|
+
get RC_BRANCH() {
|
|
214
|
+
return this._.RC_BRANCH;
|
|
215
|
+
}
|
|
216
|
+
get PROD_BRANCH() {
|
|
217
|
+
return this._.PROD_BRANCH;
|
|
218
|
+
}
|
|
219
|
+
get FORCED_DRAFT_FLOW() {
|
|
220
|
+
return this._.FORCED_DRAFT_FLOW;
|
|
221
|
+
}
|
|
222
|
+
get ENABLE_ASSIST() {
|
|
223
|
+
return this._.ENABLE_ASSIST;
|
|
224
|
+
}
|
|
225
|
+
get SITEMAP() {
|
|
226
|
+
return this._.SITEMAP;
|
|
227
|
+
}
|
|
228
|
+
get CDN() {
|
|
229
|
+
return this._.CDN;
|
|
230
|
+
}
|
|
231
|
+
})();
|
|
232
|
+
|
|
233
|
+
const Icon = JSX(({ className, name, alt = `Icon ${name}`, title = alt, asSVG, ...imgProps }) => {
|
|
234
|
+
const href = `${projectSettings.CDN || ''}icons/${name}.svg`;
|
|
235
|
+
if (asSVG) {
|
|
236
|
+
return (jsxs("svg", { className: className, ...imgProps, "aria-hidden": "true", children: [title ? jsx("title", { children: title }) : null, alt ? jsx("desc", { children: alt }) : null, jsx("use", { href: `${href}#icon`, xlinkHref: `${href}#icon` })] }));
|
|
237
|
+
}
|
|
238
|
+
return (jsx("img", { className: className, src: href, alt: alt, title: title, ...imgProps, "aria-hidden": "true" }));
|
|
239
|
+
});
|
|
240
|
+
|
|
305
241
|
const MOBILE_URL_PATH = '/mobile';
|
|
306
242
|
const isURL = (href) => href?.includes('//');
|
|
307
243
|
const isHrefActive = (href, router, cmp = (href, baseHref) => href === baseHref) => {
|
|
@@ -365,17 +301,68 @@
|
|
|
365
301
|
};
|
|
366
302
|
}
|
|
367
303
|
|
|
304
|
+
const listStyleMap = {
|
|
305
|
+
primary: 'bg-primary-main',
|
|
306
|
+
secondary: 'bg-white',
|
|
307
|
+
};
|
|
308
|
+
const textStyleMap = {
|
|
309
|
+
primary: 'text-primary-text',
|
|
310
|
+
secondary: 'text-white',
|
|
311
|
+
};
|
|
312
|
+
const BlockItem = JSX(({ className, text, children, version = 'primary' }) => {
|
|
313
|
+
return (jsxs("div", { className: `inline-block flex ${className || ''}`, role: "listitem", children: [jsx("div", { className: `inline-block w-[8px] h-[8px] min-w-[8px] min-h-[8px] rounded-full mt-2 ${listStyleMap[version]}` }), jsx("span", { className: `text-base font-normal font-sans mx-3 ${textStyleMap[version]}`, children: text || children })] }));
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
const buttonStyleMap = {
|
|
317
|
+
primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
|
|
318
|
+
secondary: 'text-primary-main bg-secondary-light hover:bg-secondary-hover active:bg-secondary-active',
|
|
319
|
+
};
|
|
320
|
+
const buttonDisabledStyleMap = {
|
|
321
|
+
primary: 'bg-secondary-dark text-secondary-text',
|
|
322
|
+
secondary: 'bg-secondary-light text-secondary-text',
|
|
323
|
+
};
|
|
324
|
+
const styleButton = 'inline-block text-center font-sans select-none';
|
|
325
|
+
const Button = JSX(({ className, text, aboveText, appendLeft, href, target, onClick, children, disabled, rounded, version = 'none', ariaLabel, ...rest }) => {
|
|
326
|
+
const buttonInner = children ?? (jsx(ButtonInner, { text: text, aboveText: aboveText, appendLeft: appendLeft, rounded: rounded }));
|
|
327
|
+
if (disabled) {
|
|
328
|
+
return (jsx("div", { role: "button", "aria-disabled": "true", "aria-label": ariaLabel, tabIndex: "-1", className: `${styleButton} ${buttonDisabledStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, children: buttonInner }));
|
|
329
|
+
}
|
|
330
|
+
return (jsx("a", { className: `${styleButton} cursor-pointer no-underline ${buttonStyleMap[version] || ''} ${rounded ? 'rounded-full' : 'rounded-md'} ${className || ''}`, href: href, target: target, onClick: onClick, "aria-label": ariaLabel, role: !href ? 'button' : 'link', ...rest, children: buttonInner }));
|
|
331
|
+
});
|
|
332
|
+
const ButtonInner = JSX(({ text, aboveText, appendLeft, rounded }) => {
|
|
333
|
+
const withoutText = !text && !aboveText && Boolean(appendLeft);
|
|
334
|
+
const buttonInnerClasses = `flex items-center justify-center ${withoutText ? 'h-12 w-12 min-h-12 min-w-12' : `px-8 gap-2 ${aboveText ? 'py-2' : 'py-[13px]'}`} ${rounded ? 'rounded-full' : ''}`;
|
|
335
|
+
return (jsxs("div", { className: buttonInnerClasses, children: [appendLeft ? appendLeft : null, !withoutText ? (jsxs("div", { children: [jsx("div", { className: "text-xxs text-left", children: aboveText }), jsx("div", { className: "text-sm font-medium text-left", children: text })] })) : null] }));
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
const Img = JSX(({ className, image }) => (jsxs("picture", { className: `${className || ''}`, children: [image.sources?.length
|
|
339
|
+
? image.sources.map(({ src, format }, index) => (jsx("source", { srcSet: src, type: formatToMimeType(format) }, `${index}_${src}`)))
|
|
340
|
+
: null, jsx("img", { src: image.src, alt: image.alt || image.title, title: image.title, ...image?.size })] })));
|
|
341
|
+
function formatToMimeType(format) {
|
|
342
|
+
return format ? `image/${String(format)}` : undefined;
|
|
343
|
+
}
|
|
344
|
+
|
|
368
345
|
const getColSpan = (className) => {
|
|
369
346
|
const colSpanPrefix = 'col-span-';
|
|
370
347
|
const colSpanStr = className.split(/\s+/).find((_) => _.startsWith(colSpanPrefix));
|
|
371
348
|
return colSpanStr ? parseInt(colSpanStr.substring(colSpanPrefix.length), 10) : 12;
|
|
372
349
|
};
|
|
373
350
|
|
|
351
|
+
const alignBlock = {
|
|
352
|
+
left: 'items-start',
|
|
353
|
+
center: 'items-center',
|
|
354
|
+
right: 'items-end',
|
|
355
|
+
};
|
|
356
|
+
const alignText = {
|
|
357
|
+
left: 'text-left',
|
|
358
|
+
center: 'text-center',
|
|
359
|
+
right: 'text-right',
|
|
360
|
+
};
|
|
374
361
|
const TITLE_CLASSES = 'font-medium m-0 mb-4 whitespace-pre-wrap max-w-[600px]';
|
|
375
|
-
const BaseTile = JSX(({ className, context, title, titleSize, description, children, buttons, image, items, version = 'primary', }) => {
|
|
362
|
+
const BaseTile = JSX(({ className, context, title, titleSize, description, children, buttons, image, items, version = 'primary', align = 'left', }) => {
|
|
376
363
|
const router = context.useRouter();
|
|
377
364
|
const { handlerDecorator } = context;
|
|
378
|
-
return (jsxs("div", { className: `font-sans flex flex-col grow h-full`, children: [title && (jsx(Title, { size: titleSize || getTitleSizeByClassName(className), className: TITLE_CLASSES, children: title })), jsxs("div", { className: "flex grow justify-between", children: [jsxs("div", { className:
|
|
365
|
+
return (jsxs("div", { className: `font-sans flex flex-col grow h-full ${alignBlock[align]}`, children: [title && (jsx(Title, { size: titleSize || getTitleSizeByClassName(className), className: TITLE_CLASSES, children: title })), jsxs("div", { className: "flex grow justify-between", children: [jsxs("div", { className: `flex flex-col justify-between ${alignBlock[align]}`, children: [jsxs("div", { children: [description ? (jsx("div", { className: `font-normal text-base max-w-[600px] ${alignText[align]}`, children: description })) : null, children, items?.length ? renderItems$1(items, version) : null] }), buttons?.length ? (jsx("div", { className: "flex mt-9 gap-3", children: buttons.map((button, index) => renderButton$1(useLink({ router, handlerDecorator }, button), index)) })) : null] }), image?.src && jsx(Img, { className: "mt-auto ml-7", image: image })] })] }));
|
|
379
366
|
});
|
|
380
367
|
function getTitleSizeByClassName(className = '') {
|
|
381
368
|
const colSpan = getColSpan(className);
|
|
@@ -390,7 +377,7 @@
|
|
|
390
377
|
}
|
|
391
378
|
}
|
|
392
379
|
function renderItems$1(items = [], version) {
|
|
393
|
-
return (jsx("section", { className: "max-w-[600px]", role: "list", children: items.map((_, i) => (jsx(BlockItem, { className: i ? 'mt-2.5' : '', text: _, version: version }, String(i)))) }));
|
|
380
|
+
return (jsx("section", { className: "max-w-[600px] mt-5", role: "list", children: items.map((_, i) => (jsx(BlockItem, { className: i ? 'mt-2.5' : '', text: _, version: version }, String(i)))) }));
|
|
394
381
|
}
|
|
395
382
|
function renderButton$1({ icon, ...button }, i) {
|
|
396
383
|
if (!button?.text)
|
|
@@ -400,86 +387,353 @@
|
|
|
400
387
|
return jsx(Button, { ...button }, String(i));
|
|
401
388
|
}
|
|
402
389
|
|
|
403
|
-
const
|
|
404
|
-
|
|
405
|
-
|
|
390
|
+
const Headline = JSX(({ bgColor = 'bg-white', className, ...props }) => {
|
|
391
|
+
return (jsx("section", { className: `p-10 ${bgColor} ${className || ''} `, children: jsx(BaseTile, { ...props }) }));
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
const titleAlignStyleMap = {
|
|
395
|
+
left: 'text-left',
|
|
396
|
+
center: 'text-center',
|
|
397
|
+
right: 'text-right',
|
|
406
398
|
};
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
|
|
399
|
+
const titleMarginsStyleMap = {
|
|
400
|
+
double: 'mb-8',
|
|
401
|
+
single: '',
|
|
402
|
+
};
|
|
403
|
+
const linkColumnsModeStyleMap = {
|
|
404
|
+
double: 'gap-x-5 gap-y-[26px] flex-wrap',
|
|
405
|
+
single: 'gap-3.5 flex-col',
|
|
406
|
+
};
|
|
407
|
+
const LinkDocs = JSX(({ className, title, align, documents, icon, columnsMode = 'double' }) => {
|
|
408
|
+
const containerClasses = linkColumnsModeStyleMap[columnsMode];
|
|
409
|
+
return (jsxs("section", { className: `font-sans p-[50px] bg-white ${className}`, children: [title && (jsx(Title, { className: `font-medium m-0 ${titleMarginsStyleMap[columnsMode]} ${titleAlignStyleMap[align ?? 'center']}`, children: title })), jsx("div", { className: `flex ${containerClasses}`, role: "list", children: documents?.length
|
|
410
|
+
? documents.map(({ text, fileSize, ...linkProps }) => (jsxs("a", { className: `group flex items-center text-sm
|
|
411
|
+
text-sm font-sans align-middle items-center text-primary-text no-underline group hover:text-primary-main
|
|
412
|
+
${columnsMode === 'double' ? 'basis-[calc(50%-20px)]' : ''}`, role: "listitem", ...linkProps, children: [icon && jsx(Icon, { className: "mr-3.5", name: icon, width: "24px", height: "24px" }), jsxs("span", { children: [text, jsx("span", { className: "text-secondary-text group-hover:text-primary-main", children: linkProps?.href && formatSuffix(getExtFromHref(linkProps.href), fileSize) })] })] })))
|
|
413
|
+
: null })] }));
|
|
410
414
|
});
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
}
|
|
415
|
+
const getExtFromHref = (href) => {
|
|
416
|
+
if (!href)
|
|
417
|
+
return '';
|
|
418
|
+
const lastChunk = href.split('.').pop();
|
|
419
|
+
if (!lastChunk || lastChunk.includes('/'))
|
|
420
|
+
return '';
|
|
421
|
+
return lastChunk;
|
|
422
|
+
};
|
|
423
|
+
const formatSuffix = (ext, fileSize) => {
|
|
424
|
+
const prefix = ext || fileSize ? ',' : '';
|
|
425
|
+
const extension = ext ? ` ${ext}` : '';
|
|
426
|
+
const size = fileSize ? ` (${fileSize})` : '';
|
|
427
|
+
return prefix + extension + size;
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
const PictureText = JSX(({ className, title, image, benefits }) => {
|
|
431
|
+
return (jsxs("section", { className: `relative font-sans text-primary-text bg-white p-14 ${className}`, children: [jsx(Title, { className: "font-medium m-0 text-center", children: title }), jsxs("div", { className: 'flex justify-center mt-9', children: [image?.src && jsx(Img, { className: "mr-6", image: image }), benefits?.length ? (jsx("div", { className: "flex flex-col", children: benefits.map(renderBenefit$1) })) : null] })] }));
|
|
432
|
+
});
|
|
433
|
+
function renderBenefit$1(benefit, i) {
|
|
434
|
+
return (jsxs("div", { className: "flex flex-row mb-8", children: [benefit.icon && (jsx(Icon, { className: "w-[48px] h-[48px] bg-main rounded-full box-border p-[12px]", name: benefit.icon, width: "48", height: "48" })), jsxs("div", { className: "flex gap-1 flex-col h-full ml-5 max-w-[490px]", children: [jsx("div", { className: "font-medium text-primary-text text-xl m-0", children: benefit.label }), benefit.description && (jsx("div", { className: "font-normal text-sm text-secondary-text", children: benefit.description }))] })] }, String(i)));
|
|
422
435
|
}
|
|
423
436
|
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
437
|
+
const textBlockStyleMaps = {
|
|
438
|
+
primary: {
|
|
439
|
+
background: 'bg-white',
|
|
440
|
+
icon: 'bg-primary-main text-white',
|
|
441
|
+
title: 'text-primary-text',
|
|
442
|
+
description: 'text-secondary-text',
|
|
443
|
+
},
|
|
444
|
+
secondary: {
|
|
445
|
+
background: 'bg-primary-main',
|
|
446
|
+
icon: 'bg-white text-primary-main',
|
|
447
|
+
title: 'text-white',
|
|
448
|
+
description: 'text-white',
|
|
449
|
+
},
|
|
450
|
+
'secondary-light': {
|
|
451
|
+
background: 'bg-primary-main/10',
|
|
452
|
+
icon: 'bg-primary-main text-white',
|
|
453
|
+
title: 'text-primary-text',
|
|
454
|
+
description: 'text-secondary-text',
|
|
455
|
+
},
|
|
456
|
+
};
|
|
457
|
+
const TextBlock = JSX(({ title, description, blockVersion = 'primary', iconVersion, image, className }) => {
|
|
458
|
+
const textBlockStyleMap = textBlockStyleMaps[blockVersion];
|
|
459
|
+
return (jsxs("section", { className: `font-sans px-9 py-4 flex ${textBlockStyleMap.background} ${className || ''}`, children: [iconVersion && iconVersion === 'small' ? renderIcon(textBlockStyleMap.icon) : null, iconVersion && iconVersion === 'big' ? renderImage(image) : null, jsxs("div", { className: "py-0.5", children: [title && (jsx("div", { className: `font-medium text-base mb-1 ${textBlockStyleMap.title}`, children: title })), description && (jsx("div", { className: `text-sm ${textBlockStyleMap.description}`, children: description }))] })] }));
|
|
427
460
|
});
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
461
|
+
function renderIcon(className) {
|
|
462
|
+
return (jsx("div", { className: `pt-1.5 pr-4`, children: jsx("div", { className: `rounded-full h-4 w-4 text-center text-xs ${className}`, children: "i" }) }));
|
|
463
|
+
}
|
|
464
|
+
function renderImage(image) {
|
|
465
|
+
return image?.src ? jsx(Img, { className: "pt-0.5 pr-3", image: image }) : null;
|
|
466
|
+
}
|
|
433
467
|
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
468
|
+
const AccordionBlocks = {
|
|
469
|
+
Headline,
|
|
470
|
+
LinkDocs,
|
|
471
|
+
TextBlock,
|
|
472
|
+
PictureText,
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
const AccordionItem = JSX(({ label, blocks, context }) => {
|
|
476
|
+
const [isActive, setIsActive] = context.useState(false);
|
|
477
|
+
const hasContent = blocks?.length;
|
|
478
|
+
const icon = isActive ? 'MinusIcon' : 'PlusIcon';
|
|
479
|
+
const handleToggle = (e) => {
|
|
480
|
+
if (!hasContent)
|
|
481
|
+
return null;
|
|
482
|
+
setIsActive(!isActive);
|
|
483
|
+
const contentBlock = getContentBlock(e);
|
|
484
|
+
contentBlock.style.maxHeight = contentBlock.style.maxHeight
|
|
485
|
+
? null
|
|
486
|
+
: `${contentBlock.scrollHeight}px`;
|
|
487
|
+
};
|
|
488
|
+
return (jsxs("li", { className: "border-0 border-b border-solid border-main-divider last:border-b-0", children: [jsxs("button", { className: `border-none bg-transparent px-0 py-5 flex justify-between text-left w-full font-sans text-primary-text
|
|
489
|
+
${hasContent ? 'group cursor-pointer' : ''}`, onClick: handleToggle, children: [jsx("span", { className: `m-0 text-xl pr-2.5 font-medium ${hasContent ? 'group-hover:text-primary-main' : ''}`, children: label }), hasContent ? jsx(Icon, { name: icon, width: "24", height: "24" }) : null] }), hasContent ? (jsx("div", { className: `${isActive ? 'pb-5' : ''} text-sm transition-all duration-300 max-h-0 overflow-hidden group-last:last:pb-0 `, children: blocks?.length ? blocks.map((block, i) => renderBlock(block, i, context)) : null })) : null] }));
|
|
490
|
+
});
|
|
491
|
+
const renderBlock = (block, i, context) => {
|
|
492
|
+
if (!block.type || !block.data || !AccordionBlocks.hasOwnProperty(block.type)) {
|
|
493
|
+
return null;
|
|
451
494
|
}
|
|
495
|
+
const AccordionBlock = AccordionBlocks[block.type];
|
|
496
|
+
return (jsx("div", { className: "mb-5 last:mb-0", children: jsx(AccordionBlock, { context: context, ...block.data }) }, `block_${i}`));
|
|
497
|
+
};
|
|
498
|
+
const getContentBlock = (e) => e.target.tagName === 'BUTTON' ? e.target.nextSibling : e.target.parentNode.nextSibling;
|
|
499
|
+
|
|
500
|
+
const Accordion = JSX(({ title, accordionItems, context, className }) => {
|
|
501
|
+
return (jsxs("section", { className: `p-[50px] font-sans bg-white text-primary-text ${className || ''}`, children: [title ? jsx(Title, { className: "m-0 mb-2.5", children: title }) : null, accordionItems?.length ? (jsx("ul", { className: "list-none m-0 p-0", children: accordionItems.map((item, i) => (jsx(AccordionItem, { ...item, context: context }, `AccordionItem${i}`))) })) : null] }));
|
|
452
502
|
});
|
|
453
|
-
|
|
454
|
-
|
|
503
|
+
|
|
504
|
+
const BenefitsBlock = JSX(({ className, title, benefits }) => {
|
|
505
|
+
return (jsxs("section", { className: `font-sans text-primary-text bg-white p-12 pb-2 flex flex-col items-center ${className || ''}`, children: [title ? jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center", children: title }) : null, benefits?.length ? (jsx("div", { className: "grid grid-cols-2 gap-5 mt-9", children: benefits.map(renderStep) })) : null] }));
|
|
506
|
+
});
|
|
507
|
+
const renderStep = (benefit, i) => {
|
|
508
|
+
return (jsxs("div", { className: "flex items-center p-10 gap-5 max-w-[580px]", children: [benefit.icon && (jsx(Icon, { className: "h-[70px] w-[70px] min-w-[70px] min-h-[70px]", name: benefit.icon, width: "70", height: "70" })), jsxs("div", { children: [jsx("h3", { className: "font-medium text-xl m-0", children: benefit.label }), benefit.description && (jsx("div", { className: "font-normal text-sm mt-2", children: benefit.description }))] })] }, String(i)));
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
|
|
512
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill, ...options }, i) => (jsx("path", { d: d, fill: fill || 'currentColor', ...commonOptions, ...options }, i))) }));
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
const ARROW_PATHS = [
|
|
516
|
+
{
|
|
517
|
+
d: 'm9 12 4-4-4-4',
|
|
518
|
+
stroke: 'currentColor',
|
|
519
|
+
strokeWidth: '2',
|
|
520
|
+
strokeLinecap: 'round',
|
|
521
|
+
fill: 'none',
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
d: 'M2 9a1 1 0 0 1 0-2v2Zm6-2a1 1 0 0 1 0 2V7ZM2 7h6v2H2V7Z',
|
|
525
|
+
},
|
|
526
|
+
];
|
|
527
|
+
const ArrowButton = JSX(({ className, disabled, ...rest }) => (jsx(Button, { rounded: true, className: `shadow-[0_4px_25px_rgba(0,0,0,0.07)] w-12 h-12 min-h-12 max-h-12 flex items-center justify-center ${disabled
|
|
528
|
+
? 'bg-secondary-light text-secondary-text'
|
|
529
|
+
: 'bg-white text-primary-text hover:text-primary-main'} ${className || ''}`, disabled: disabled, ...rest, children: jsx(SVG, { paths: ARROW_PATHS, viewBox: "0 0 16 16", fill: "none", width: "16", height: "16" }) })));
|
|
530
|
+
|
|
531
|
+
const TableRowContainer = JSX(({ children }) => (jsx("div", { className: "self-start flex flex-col", role: "row", children: jsx("div", { className: "flex", children: children }) })));
|
|
532
|
+
|
|
533
|
+
const GRADIENT = 'bg-gradient-to-r from-main-gradient-start to-main-gradient-end';
|
|
534
|
+
const BORDER_CLASSES = 'border-main-stroke border-solid border';
|
|
535
|
+
const DIVIDER_CLASSES = 'border-main-divider border border-t-0 border-x-0';
|
|
536
|
+
const FIRST_CELL_CLASSES = 'w-[200px] mr-6';
|
|
537
|
+
const COLS_LENGTH_FOR_SCROLL = 2;
|
|
538
|
+
const COLUMN_WIDTH = 4 * 80 + 4 * 4; // w-80 + gap-4 = 336px
|
|
539
|
+
|
|
540
|
+
const TableCarouselContainer = JSX(({ children, activeCardIndex }) => (jsx("div", { className: "flex flex-1 overflow-hidden", children: jsx("div", { className: "flex gap-4 duration-1000", style: { transform: `translateX(-${activeCardIndex * COLUMN_WIDTH}px)` }, children: children }) })));
|
|
541
|
+
|
|
542
|
+
const HeaderCell = JSX(({ icon, image, title, link }) => (jsxs("div", { className: `w-80 box-border flex flex-col items-center rounded-t-md border-b-0 px-7 pt-7 pb-12 ${BORDER_CLASSES} ${GRADIENT}`, role: "columnheader", scope: "col", children: [icon && !image?.src && (jsx(Icon, { className: "h-[63px] w-[63px] min-w-[63px] min-h-[63px] mb-4", name: icon, width: "63", height: "63" })), image?.src && jsx(Img, { className: "mb-4", image: image }), title && (jsx(Title, { size: "S", className: "font-medium m-0 text-center text-white", children: title })), link?.text && (jsx("div", { className: "mt-auto w-full", children: jsx(Button, { href: link.href, target: link.target, className: "mt-4 w-full text-primary-main bg-white hover:bg-secondary-hover active:bg-secondary-active", children: jsx("div", { className: "text-xs py-[11px]", children: link.text }) }) }))] })));
|
|
543
|
+
|
|
544
|
+
const TableCell = JSX(({ cell, isFirstRow, isLastRow, isFillGradient }) => {
|
|
545
|
+
const cellWrapperClasses = `w-80 box-border flex flex-col ${BORDER_CLASSES} ${!isLastRow ? 'border-y-0' : 'border-t-0 rounded-b-md'} ${isFillGradient ? GRADIENT : ''}`;
|
|
546
|
+
const cellClasses = `mx-7 h-full ${DIVIDER_CLASSES} ${isFillGradient && isFirstRow ? 'border-t' : ''} ${!isLastRow ? 'border-solid' : ''}`;
|
|
547
|
+
return (jsx("div", { className: cellWrapperClasses, role: "cell", children: jsx("div", { className: cellClasses, children: cell.map((item, i) => renderCellInner(item, i, isFillGradient)) }) }));
|
|
548
|
+
});
|
|
549
|
+
const renderCellInner = ({ label, description }, i, isFillGradient) => (jsxs("div", { className: "first:pt-7 pt-6 last:pb-7", children: [label && (jsx("h5", { className: `text-xl font-medium m-0 ${isFillGradient ? 'text-white' : ''}`, children: label })), description && (jsx("div", { className: `text-sm opacity-80 ${isFillGradient ? 'text-white' : 'text-secondary-text'}`, children: description }))] }, String(i)));
|
|
550
|
+
|
|
551
|
+
const TableRow = JSX(({ row: { header, data }, activeCardIndex, isColoredFirstColumn, isFirstRow, isLastRow }) => (jsxs(TableRowContainer, { children: [header?.title ? (jsx("div", { className: `text-sm py-7 ${DIVIDER_CLASSES} ${FIRST_CELL_CLASSES} ${!isLastRow ? 'border-solid' : ''}`, children: header.title })) : null, data?.length ? (jsx(TableCarouselContainer, { activeCardIndex: activeCardIndex, children: data.map((cell, i) => (jsx(TableCell, { cell: cell, isFirstRow: isFirstRow, isLastRow: isLastRow, isFillGradient: isColoredFirstColumn && i === 0 }, String(i)))) })) : null] })));
|
|
552
|
+
|
|
553
|
+
const ComparisonTable = JSX(({ className, context, title, rowHeaders, columns, visibleRowLength = 0, isColoredFirstColumn = false, }) => {
|
|
554
|
+
const router = context.useRouter();
|
|
555
|
+
const { handlerDecorator } = context;
|
|
556
|
+
const [activeCardIndex, setActiveCardIndex] = context.useState(0);
|
|
557
|
+
const [isShowAllRow, setIsShowAllRow] = context.useState(!visibleRowLength);
|
|
558
|
+
const colHeaders = columns?.map(({ header }) => header || {});
|
|
559
|
+
const colData = columns?.map(({ data }) => data) || [];
|
|
560
|
+
const rowData = rowHeaders
|
|
561
|
+
?.map((header, i) => ({
|
|
562
|
+
header,
|
|
563
|
+
data: colData.map((col) => col?.[i] || [{}]),
|
|
564
|
+
}))
|
|
565
|
+
.slice(0, isShowAllRow ? rowHeaders.length : visibleRowLength);
|
|
566
|
+
const nextClick = () => setActiveCardIndex(activeCardIndex + 1);
|
|
567
|
+
const prevClick = () => setActiveCardIndex(activeCardIndex - 1);
|
|
568
|
+
const showToggle = () => setIsShowAllRow(!isShowAllRow);
|
|
569
|
+
const isScrollAvailable = colData?.length && colData.length > COLS_LENGTH_FOR_SCROLL;
|
|
570
|
+
const showNextButton = isScrollAvailable && colData?.length - activeCardIndex > COLS_LENGTH_FOR_SCROLL;
|
|
571
|
+
const showPrevButton = isScrollAvailable && activeCardIndex > 0;
|
|
572
|
+
return (jsxs("section", { className: `bg-white font-sans py-[50px] pl-[50px] overflow-hidden text-primary-text relative ${className || ''}`, children: [jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center mb-9 mx-auto", children: title }), jsxs("div", { role: "table", children: [colHeaders?.length ? (jsxs(TableRowContainer, { children: [jsx("div", { className: FIRST_CELL_CLASSES, role: "columnheader", scope: "col" }), jsx(TableCarouselContainer, { activeCardIndex: activeCardIndex, children: colHeaders.map((header, i) => (jsx(HeaderCell, { ...header, link: header.link && useLink({ router, handlerDecorator }, header.link) }, String(i)))) })] })) : null, rowData?.length ? (jsxs("div", { className: "relative", children: [rowData.map((row, i, { length }) => (jsx(TableRow, { row: row, isFirstRow: i === 0, isLastRow: i + 1 === length, activeCardIndex: activeCardIndex, isColoredFirstColumn: isColoredFirstColumn }, String(i)))), isScrollAvailable ? (jsx("div", { children: jsxs("div", { className: "absolute top-7 right-7 z-10", children: [jsx(ArrowButton, { onClick: nextClick, disabled: !showNextButton, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E" }), jsx(ArrowButton, { className: "mt-4 rotate-180", onClick: prevClick, disabled: !showPrevButton, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E" })] }) })) : null] })) : null] }), isScrollAvailable ? (jsx("div", { className: "absolute top-0 right-0 bottom-0 w-[84px] bg-opacity-to-white" })) : null, visibleRowLength ? (jsx("div", { className: "pr-[50px]", children: jsxs("div", { className: "flex w-full", children: [jsx("div", { className: FIRST_CELL_CLASSES }), jsx("button", { onClick: showToggle, className: "mt-5 flex-1 border-main-stroke border-solid border text-primary-text bg-white hover:border-primary-main hover:text-primary-main", children: jsx("div", { className: "font-sans font-medium text-xs py-[11px]", children: !isShowAllRow ? 'Показать все параметры' : 'Скрыть' }) })] }) })) : null] }));
|
|
573
|
+
});
|
|
574
|
+
|
|
575
|
+
function useCreditCalculatorData(useAsyncData, directoryName) {
|
|
576
|
+
const { data } = useAsyncData(creditCalculatorUrl(directoryName), () => fetchCreditCalculatorData(directoryName));
|
|
577
|
+
return data || {};
|
|
578
|
+
}
|
|
579
|
+
async function fetchCreditCalculatorData(directoryName) {
|
|
580
|
+
const response = await fetch(creditCalculatorUrl(directoryName));
|
|
581
|
+
return await response.json();
|
|
582
|
+
}
|
|
583
|
+
function creditCalculatorUrl(directoryName) {
|
|
584
|
+
return `/wcms-resources/${directoryName || 'credit-calculator-data'}.json`;
|
|
455
585
|
}
|
|
456
586
|
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
587
|
+
const CHECK_PATHS = [
|
|
588
|
+
{
|
|
589
|
+
d: 'M10.207.793a1 1 0 0 1 0 1.414l-6 6a1 1 0 0 1-1.414 0l-2.5-2.5a1 1 0 0 1 1.414-1.414L3.5 6.086 8.793.793a1 1 0 0 1 1.414 0Z',
|
|
590
|
+
fillRule: 'evenodd',
|
|
591
|
+
clipRule: 'evenodd',
|
|
592
|
+
fill: 'white',
|
|
593
|
+
},
|
|
594
|
+
];
|
|
595
|
+
const Checkbox = JSX(({ text, checked, onChange, className }) => (jsx("div", { className: className, children: jsxs("label", { className: "flex items-center cursor-pointer relative", children: [jsx("input", { className: `peer appearance-none w-5 h-5 border-solid border rounded border-black checked:bg-primary-main checked:border-primary-main`, type: "checkbox", onChange: (e) => {
|
|
596
|
+
onChange(e.target.checked);
|
|
597
|
+
}, checked: checked }), jsx(SVG, { paths: CHECK_PATHS, className: "hidden absolute left-2 ml-px peer-checked:block", width: "11", height: "9", fill: "white", viewBox: "0 0 11 9" }), text ? jsx("span", { className: "font-sans ml-2 text-sm cursor-pointer", children: text }) : null] }) })));
|
|
598
|
+
|
|
599
|
+
const addSpacesBetweenNumbers = (number) => new Intl.NumberFormat('ru-RU', { maximumSignificantDigits: 3 }).format(number);
|
|
600
|
+
|
|
601
|
+
const InputRange = JSX(({ className, title, items = [], min = 1, max = 100, step = 1, value = min, onChange }) => {
|
|
602
|
+
const handleChange = (value) => {
|
|
603
|
+
if (!onChange)
|
|
604
|
+
return;
|
|
605
|
+
const sanitizedValue = Number(value.replace(/\D/g, ''));
|
|
606
|
+
onChange(sanitizedValue);
|
|
462
607
|
};
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
608
|
+
const inputStyle = {
|
|
609
|
+
backgroundSize: `${(((value - min) * 100) / (max - min)).toFixed(2)}% 100%`,
|
|
610
|
+
};
|
|
611
|
+
const handleBlur = () => {
|
|
612
|
+
if (!onChange)
|
|
613
|
+
return;
|
|
614
|
+
if (value < min)
|
|
615
|
+
onChange(min);
|
|
616
|
+
if (value > max)
|
|
617
|
+
onChange(max);
|
|
618
|
+
};
|
|
619
|
+
return (jsxs("div", { className: className, children: [jsxs("div", { className: "relative", children: [title ? (jsx("span", { className: "absolute text-xs text-secondary-text top-1 mt-0.5 pl-4 ml-0.5", children: title })) : null, jsx("input", { className: `m-0 font-sans text-sm w-full h-12 border-2 border-solid border-main-divider rounded-md outline-none p-0 pl-4 m-0 box-border text-primary-text ${title ? 'pt-4' : ''}`, value: addSpacesBetweenNumbers(value), onChange: (e) => handleChange(e.target.value), onBlur: handleBlur }), jsx("div", { className: "absolute inset-x-0 mt-0.5 top-8 px-4", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider", type: "range", min: min, max: max, step: step, value: value, onChange: (e) => handleChange(e.target.value), style: inputStyle }) })] }), jsx("div", { className: "flex justify-between mt-3 mb-4", children: items.map((item, i) => (jsx("span", { className: "text-xs text-secondary-text pl-4", children: item }, String(i)))) })] }));
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
|
|
623
|
+
|
|
624
|
+
const DEFAULT_MIN_SUM = 30000;
|
|
625
|
+
const DEFAULT_MAX_SUM = 3000000;
|
|
626
|
+
const DEFAULT_SUM = (DEFAULT_MAX_SUM - DEFAULT_MIN_SUM) / 2;
|
|
627
|
+
const DEFAULT_MIN_MONTHS = 1;
|
|
628
|
+
const DEFAULT_MAX_MONTHS = 84;
|
|
629
|
+
const DEFAULT_MONTHS = Math.round((DEFAULT_MAX_MONTHS - DEFAULT_MIN_MONTHS) / 2);
|
|
630
|
+
const MONTHS_IN_YEAR = 12;
|
|
631
|
+
|
|
632
|
+
const getCalculatorParams = (params) => {
|
|
633
|
+
const { tableRows, isAnnuity = false } = params;
|
|
634
|
+
if (!tableRows)
|
|
635
|
+
return {};
|
|
636
|
+
const calculatorParams = tableRows.find((row) => row.isAnnuity === isAnnuity);
|
|
637
|
+
return calculatorParams || {};
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
const DEFAULT_RATE = 5;
|
|
641
|
+
const getCreditRate = (params) => {
|
|
642
|
+
const { calculatorParams, isInsurance } = params;
|
|
643
|
+
if (!calculatorParams)
|
|
644
|
+
return DEFAULT_RATE;
|
|
645
|
+
return isInsurance
|
|
646
|
+
? calculatorParams?.rateWithInsurance || DEFAULT_RATE
|
|
647
|
+
: calculatorParams?.rateWithoutInsurance || DEFAULT_RATE;
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
const MAX_YEARS_LENGTH = 5;
|
|
651
|
+
const getCreditTermYears = (minMonths, maxMonths) => {
|
|
652
|
+
const totalYears = Math.ceil((maxMonths - minMonths) / 12);
|
|
653
|
+
const firstYear = Math.floor(minMonths / MONTHS_IN_YEAR) + 1;
|
|
654
|
+
const result = new Array(Math.min(totalYears - 1, MAX_YEARS_LENGTH))
|
|
655
|
+
.fill(0)
|
|
656
|
+
.map((_, i) => firstYear + i);
|
|
657
|
+
const maxYear = totalYears + firstYear - 1;
|
|
658
|
+
return result.concat(maxYear);
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
const getMonthlyPayment = (params) => {
|
|
662
|
+
const { calculatorParams, paymentType, rate, sum, months } = params;
|
|
663
|
+
if (!calculatorParams)
|
|
664
|
+
return 0;
|
|
665
|
+
const finalSum = clamp(sum, calculatorParams.minSum || DEFAULT_MIN_SUM, calculatorParams.maxSum || DEFAULT_MAX_SUM);
|
|
666
|
+
if (paymentType === 'annuity') {
|
|
667
|
+
const annuityCoef = Number(rate) / (MONTHS_IN_YEAR * 100);
|
|
668
|
+
return finalSum * (annuityCoef + annuityCoef / (Math.pow(1 + annuityCoef, months) - 1));
|
|
471
669
|
}
|
|
472
670
|
else {
|
|
473
|
-
return
|
|
671
|
+
return finalSum / months + finalSum * (Number(rate) / 12);
|
|
474
672
|
}
|
|
475
|
-
}
|
|
673
|
+
};
|
|
476
674
|
|
|
477
|
-
const
|
|
478
|
-
|
|
675
|
+
const STEP_MONEY = 1000;
|
|
676
|
+
const STEP_MONTHS = 1;
|
|
677
|
+
const DEFAULT_PAYMENT_TYPE = 'annuity';
|
|
678
|
+
const borderStyle = 'border-solid border-3 border-primary-main rounded-md';
|
|
679
|
+
const CreditCalculator = JSX(({ context, className, directoryName }) => {
|
|
680
|
+
const [moneyValue, setMoneyValue] = context.useState(undefined);
|
|
681
|
+
const [monthsValue, setMonthsValue] = context.useState(undefined);
|
|
682
|
+
const [isAnnuityChecked, setIsAnnuityChecked] = context.useState(true);
|
|
683
|
+
const [isInsuranceChecked, setIsInsuranceChecked] = context.useState(true);
|
|
684
|
+
const tableRows = useCreditCalculatorData(context.useAsyncData, directoryName).rows;
|
|
685
|
+
const calculatorParams = getCalculatorParams({ tableRows, isAnnuity: isAnnuityChecked });
|
|
686
|
+
const defaultSum = calculatorParams.maxSum && calculatorParams.minSum
|
|
687
|
+
? (calculatorParams.maxSum - calculatorParams.minSum) / 2
|
|
688
|
+
: DEFAULT_SUM;
|
|
689
|
+
const defaultMonths = calculatorParams.maxMonths && calculatorParams.minMonths
|
|
690
|
+
? Math.round((calculatorParams.maxMonths - calculatorParams.minMonths) / 2)
|
|
691
|
+
: DEFAULT_MONTHS;
|
|
692
|
+
const minSum = calculatorParams?.minSum || DEFAULT_MIN_SUM;
|
|
693
|
+
const maxSum = calculatorParams?.maxSum || DEFAULT_MAX_SUM;
|
|
694
|
+
const minMonths = calculatorParams?.minMonths || DEFAULT_MIN_MONTHS;
|
|
695
|
+
const maxMonths = calculatorParams?.maxMonths || DEFAULT_MAX_MONTHS;
|
|
696
|
+
const rate = getCreditRate({ calculatorParams, isInsurance: isInsuranceChecked });
|
|
697
|
+
const montlyPayment = getMonthlyPayment({
|
|
698
|
+
calculatorParams,
|
|
699
|
+
paymentType: DEFAULT_PAYMENT_TYPE,
|
|
700
|
+
rate,
|
|
701
|
+
sum: moneyValue || defaultSum,
|
|
702
|
+
months: monthsValue || defaultMonths,
|
|
703
|
+
});
|
|
704
|
+
const creditTermYears = getCreditTermYears(minMonths, maxMonths);
|
|
705
|
+
function handleButtonClick(value) {
|
|
706
|
+
setMonthsValue(clamp(value * MONTHS_IN_YEAR, minMonths, maxMonths));
|
|
707
|
+
}
|
|
708
|
+
return (jsx("section", { className: `font-sans text-primary-text bg-white p-4 ${className}`, children: jsxs("div", { className: `box-border p-12 flex flex-col justify-between ${borderStyle}`, children: [jsxs("div", { className: "flex justify-between", children: [jsxs("div", { className: "grow mr-11", children: [jsx(InputRange, { title: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0441\u0443\u043C\u043C\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u0430, \u20BD", items: [
|
|
709
|
+
`От ${addSpacesBetweenNumbers(minSum)} рублей`,
|
|
710
|
+
`До ${addSpacesBetweenNumbers(maxSum)} рублей`,
|
|
711
|
+
], min: minSum, max: maxSum, step: STEP_MONEY, value: moneyValue || defaultSum, onChange: setMoneyValue }), jsx(InputRange, { title: "\u0421\u0440\u043E\u043A \u043A\u0440\u0435\u0434\u0438\u0442\u0430, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ['Или выберите из предложенных вариантов ниже'], min: minMonths, max: maxMonths, step: STEP_MONTHS, value: monthsValue || defaultMonths, onChange: setMonthsValue }), jsx("div", { className: "flex mb-7", children: creditTermYears.map((number, i) => renderButton(number, i, handleButtonClick)) }), jsx(Checkbox, { text: "\u041F\u043E\u043B\u0443\u0447\u0430\u044E \u043F\u0435\u043D\u0441\u0438\u044E \u043D\u0430 \u043A\u0430\u0440\u0442\u0443 \u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A\u0430", checked: isAnnuityChecked, onChange: setIsAnnuityChecked }), jsx(Checkbox, { className: "mb-4", text: "\u041A\u043E\u043C\u043F\u043B\u0435\u043A\u0441\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u0445\u043E\u0432\u0430\u044F \u0437\u0430\u0449\u0438\u0442\u0430", checked: isInsuranceChecked, onChange: setIsInsuranceChecked })] }), jsxs("div", { className: "p-9 bg-primary-main rounded-md text-white", children: [jsx("div", { className: "text-base mb-5", children: "\u041D\u0430\u0448\u0435 \u043F\u0440\u0435\u0434\u043B\u043E\u0436\u0435\u043D\u0438\u0435" }), jsx("div", { className: "text-sm opacity-60", children: "\u0415\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436" }), jsxs("div", { className: "text-lg mb-3", children: [addSpacesBetweenNumbers(Math.round(montlyPayment)), " \u20BD"] }), jsx("div", { className: "text-sm opacity-60", children: "\u0421\u0442\u0430\u0432\u043A\u0430" }), jsxs("div", { className: "text-lg", children: [rate, " %"] })] })] }), jsxs("div", { className: "flex items-center", children: [jsx(Button, { className: "mr-3", text: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443", version: "primary", href: "#" }), jsx("div", { className: "w-80 text-xxs leading-4 text-secondary-text", "aria-label": "\u0421\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u0435 \u043D\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0443 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445", children: "\u041E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u044F \u0437\u0430\u044F\u0432\u043A\u0443, \u0432\u044B \u0441\u043E\u0433\u043B\u0430\u0448\u0430\u0435\u0442\u0435\u0441\u044C \u043D\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0443 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u043E \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044F\u043C \u0424\u0417\u00A0\u00AB\u041E\u00A0\u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\u00BB" })] })] }) }));
|
|
479
712
|
});
|
|
480
|
-
|
|
481
|
-
return (
|
|
713
|
+
function renderButton(number, i, handleClick) {
|
|
714
|
+
return (jsx("button", { className: "bg-secondary-light rounded-3xl h-10 w-[75px] box-border mr-2 flex items-center justify-center cursor-pointer border-none", onClick: () => handleClick(number), children: jsxs("span", { className: "font-semibold text-sm", children: [number, " ", number === 1 ? 'год' : number > 4 ? 'лет' : 'года'] }) }, String(i)));
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
const tileStyleMap = {
|
|
718
|
+
primary: 'bg-white text-primary-text',
|
|
719
|
+
secondary: 'bg-primary-main text-white',
|
|
482
720
|
};
|
|
721
|
+
const Tile = JSX((props) => {
|
|
722
|
+
const { children, className, version = 'primary' } = props;
|
|
723
|
+
return (jsx("section", { className: `font-sans p-9 min-h-[320px] box-border ${className || ''} ${tileStyleMap[version]} ${getContainerPaddingRight(className)} `, children: jsx(BaseTile, { ...props, children: children }) }));
|
|
724
|
+
});
|
|
725
|
+
function getContainerPaddingRight(className = '') {
|
|
726
|
+
const colSpan = getColSpan(className);
|
|
727
|
+
if (colSpan <= 6) {
|
|
728
|
+
return 'pr-9';
|
|
729
|
+
}
|
|
730
|
+
else if (colSpan <= 8) {
|
|
731
|
+
return 'pr-[4.75rem]';
|
|
732
|
+
}
|
|
733
|
+
else {
|
|
734
|
+
return 'pr-[9.4rem]';
|
|
735
|
+
}
|
|
736
|
+
}
|
|
483
737
|
|
|
484
738
|
const CBR_EXCHANGE_RATE_URL = 'https://www.cbr-xml-daily.ru/daily_json.js';
|
|
485
739
|
const CURRENCY_CODES = ['USD', 'EUR'];
|
|
@@ -510,10 +764,6 @@
|
|
|
510
764
|
const currencyNumberFormat = new Intl.NumberFormat('ru', { style: 'currency', currency: 'RUB' });
|
|
511
765
|
const formatCurrency = (value) => (value ? currencyNumberFormat.format(value) : '');
|
|
512
766
|
|
|
513
|
-
const SVG = JSX(({ className, viewBox, fill = 'none', width, height, paths, ...commonOptions }) => {
|
|
514
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: className, viewBox: viewBox, fill: fill, width: width, height: height, children: paths.map(({ d, fill, ...options }, i) => (jsx("path", { d: d, fill: fill || 'currentColor', ...commonOptions, ...options }, i))) }));
|
|
515
|
-
});
|
|
516
|
-
|
|
517
767
|
const LOGO_PATHS = [
|
|
518
768
|
'm13.72 25.51 4.42-4.33v-2.95l-4.42 4.32v2.96Zm0-10.98 4.42-4.35V7.41l-4.42 4.31v2.8Zm0 3.63 4.42-4.33v-2.78l-4.42 4.32v2.8ZM12.46 7.44l-.6-.56V0h-.66v6.22l-.58-.57V0h-.67v5l-.59-.58V0H8.7v6.56l4.44 4.33V0h-.67v7.44Zm1.26 14.35 4.42-4.33v-2.78L13.72 19v2.8Zm-5.03-.61 4.44 4.33v-2.96l-4.44-4.32v2.95Zm8.79-16.76-.59.58V0h-.66v5.66l-.6.56V0h-.66v6.87l-.58.57V0h-.67v10.9l4.42-4.34V0h-.66v4.42Zm-8.79 5.76 4.44 4.35v-2.8L8.69 7.4v2.77Zm0 3.65 4.44 4.33v-2.8l-4.44-4.3v2.77Zm0 3.63 4.44 4.33V19l-4.44-4.31v2.78Zm26.37 2.29H24.3a2.25 2.25 0 0 0 .36-1.22 2.32 2.32 0 0 0-2.33-2.31 2.32 2.32 0 0 0-2.31 2.31c0 .5.16.96.43 1.34a.74.74 0 0 0-.33.61c0 .26.14.49.33.62a2.32 2.32 0 0 0-.43 1.34 2.31 2.31 0 0 0 2.31 2.31 2.32 2.32 0 0 0 2.33-2.31c0-.45-.13-.87-.36-1.22h8.01v.49h-.8v.68h.8v.7h-.8v1.3h.8v-.58h1.17v.58h.79v-1.3h-.79v-.7h.79v-.68h-.79v-.5h1.58a.56.56 0 0 0 .56-.56v-.34a.57.57 0 0 0-.56-.56Zm-11.53 2.7a1.2 1.2 0 0 1-2.4 0c0-.24.08-.47.2-.66l.34-.56a.97.97 0 0 1-.34-.75c0-.3.13-.56.33-.74l-.32-.56a1.13 1.13 0 0 1-.2-.66 1.2 1.2 0 0 1 2.4 0c0 .49-.56 1.65-.56 1.65v.62c-.01.01.55 1.17.55 1.66ZM4.67 18.34v2.89c0 2.75 1.2 4.53 1.9 5.21l4.58 4.5c1.28 1.25 1.5 1.66 1.79 2.37v-3.2c0-2.84-1.44-3.94-2.19-4.67-1.73-1.68-2.89-2.8-3.82-3.73a8.98 8.98 0 0 1-2.26-3.37Zm6.08 14.24c-1.73-1.7-2.89-2.8-3.82-3.73a10 10 0 0 1-2.25-2.98v2.49a7.87 7.87 0 0 0 1.89 5.24l4.58 4.47c1.28 1.25 1.5 1.85 1.79 2.55v-3.37c0-2.85-1.45-3.95-2.19-4.67Z',
|
|
519
769
|
'M19.88 5.34c-.32 0-.64 0-.96.02V6.7a18.5 18.5 0 1 1 .95 36.94A18.5 18.5 0 0 1 1.35 25.17c0-5.67 2.55-10.73 6.58-14.13V9.32A19.78 19.78 0 0 0 0 25.17C0 36.12 8.9 45 19.88 45a19.85 19.85 0 0 0 19.86-19.83c0-10.95-8.9-19.83-19.87-19.83Z',
|
|
@@ -546,7 +796,7 @@
|
|
|
546
796
|
const { type, text, description } = item;
|
|
547
797
|
return (jsxs("div", { className: "mb-4", children: [jsx("div", { children: renderText(type, text) }), jsx("div", { className: "font-sans text-sm text-secondary-text", children: description })] }, String(index)));
|
|
548
798
|
};
|
|
549
|
-
const renderText = (type, text) => {
|
|
799
|
+
const renderText = (type, text = '') => {
|
|
550
800
|
switch (type) {
|
|
551
801
|
case 'tel':
|
|
552
802
|
return (jsx("a", { className: "font-sans font-medium text-xl text-primary-text no-underline", href: `tel:${formatTel(text)}`, children: text }));
|
|
@@ -565,13 +815,6 @@
|
|
|
565
815
|
});
|
|
566
816
|
const HorizontalNavigationLink = JSX(({ className, index, text, href, target, onClick }) => (jsx("a", { className: `font-sans font-normal text-sm text-secondary-text hover:text-primary-text inline-block no-underline max-w-[292px] ${className || ''}`, href: href, target: target, onClick: onClick, children: text || `Документ ${index}` })));
|
|
567
817
|
|
|
568
|
-
const cmp = (a) => (b) => a?.href === b?.href;
|
|
569
|
-
const substitute = (items, substitution) => (items || []).map((_) => substitution?.find(cmp(_)) || _);
|
|
570
|
-
const subtract = (minuend, subtrahend) => (minuend || []).filter((_) => !subtrahend?.find(cmp(_)));
|
|
571
|
-
function mergeTopItems(left, right) {
|
|
572
|
-
return substitute(left, right).concat(subtract(right, left));
|
|
573
|
-
}
|
|
574
|
-
|
|
575
818
|
function useSitemap(useAsyncData) {
|
|
576
819
|
const { data } = useAsyncData(sitemapURL(), fetchSitemap);
|
|
577
820
|
return data || {};
|
|
@@ -584,6 +827,13 @@
|
|
|
584
827
|
return `/wcms-resources/${projectSettings.SITEMAP || 'sitemap'}.json`;
|
|
585
828
|
}
|
|
586
829
|
|
|
830
|
+
const cmp = (a) => (b) => a?.href === b?.href;
|
|
831
|
+
const substitute = (items, substitution) => (items || []).map((_) => substitution?.find(cmp(_)) || _);
|
|
832
|
+
const subtract = (minuend, subtrahend) => (minuend || []).filter((_) => !subtrahend?.find(cmp(_)));
|
|
833
|
+
function mergeTopItems(left, right) {
|
|
834
|
+
return substitute(left, right).concat(subtract(right, left));
|
|
835
|
+
}
|
|
836
|
+
|
|
587
837
|
const Sitemap = JSX(({ className, items, context }) => {
|
|
588
838
|
const sitemap = useSitemap(context.useAsyncData);
|
|
589
839
|
const mergedItems = mergeTopItems(sitemap.topItems, items);
|
|
@@ -635,22 +885,6 @@
|
|
|
635
885
|
return (jsxs("footer", { className: `${className} px-9 py-10 bg-white`, children: [jsxs("div", { className: "flex items-stretch gap-32 pb-8 xl:gap-8", children: [jsx(Logo, { className: `${LEFT_COL_WIDTH_FULL_HD} ${LEFT_COL_WIDTH_SMALL_DESKTOP}` }), jsx(SearchBar, { context: context, className: "grow" })] }), jsxs("div", { className: "flex items-stretch gap-32 xl:gap-8", children: [jsx(Contacts, { className: `${LEFT_COL_WIDTH_FULL_HD} shrink-0 overflow-hidden ${LEFT_COL_WIDTH_SMALL_DESKTOP}`, items: contacts, context: context, hasButton: true }), jsx(Sitemap, { className: "pt-[3px]", context: context, items: topItems })] }), jsx(SocialMedia, { media: socialMedia, context: context }), jsx(HorizontalNavigation, { links: relatedEnterprises, context: context }), jsx(TextInformation, { links: documents, context: context })] }));
|
|
636
886
|
});
|
|
637
887
|
|
|
638
|
-
const ARROW_PATHS = [
|
|
639
|
-
{
|
|
640
|
-
d: 'm9 12 4-4-4-4',
|
|
641
|
-
stroke: 'currentColor',
|
|
642
|
-
strokeWidth: '2',
|
|
643
|
-
strokeLinecap: 'round',
|
|
644
|
-
fill: 'none',
|
|
645
|
-
},
|
|
646
|
-
{
|
|
647
|
-
d: 'M2 9a1 1 0 0 1 0-2v2Zm6-2a1 1 0 0 1 0 2V7ZM2 7h6v2H2V7Z',
|
|
648
|
-
},
|
|
649
|
-
];
|
|
650
|
-
const ArrowButton = JSX(({ className, disabled, ...rest }) => (jsx(Button, { rounded: true, className: `shadow-[0_4px_25px_rgba(0,0,0,0.07)] w-12 h-12 min-h-12 max-h-12 flex items-center justify-center ${disabled
|
|
651
|
-
? 'bg-secondary-light text-secondary-text'
|
|
652
|
-
: 'bg-white text-primary-text hover:text-primary-main'} ${className || ''}`, disabled: disabled, ...rest, children: jsx(SVG, { paths: ARROW_PATHS, viewBox: "0 0 16 16", fill: "none", width: "16", height: "16" }) })));
|
|
653
|
-
|
|
654
888
|
const cardStyleMap = {
|
|
655
889
|
normal: 'min-w-[364px] w-[364px]',
|
|
656
890
|
mini: 'min-w-[260px] w-[260px]',
|
|
@@ -737,6 +971,16 @@
|
|
|
737
971
|
return (jsx(Tile, { className: className, context: context, title: title, buttons: buttons, children: jsxs("div", { className: "flex items-center", children: [qr?.src && qr?.href && (jsx("a", { href: qr.href, target: "_blank", children: jsx("img", { src: qr.src, alt: title, title: title, width: "164", height: "164", className: "w-[90px] h-[90px] min-w-[90px] min-h-[90px] bg-secondary-light" }) })), jsx("span", { className: "font-normal text-sm text-secondary-text ml-4", children: "\u041D\u0430\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u0430\u043C\u0435\u0440\u0443 \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0430 \u043D\u0430 QR-\u043A\u043E\u0434 \u0438 \u0441\u043A\u0430\u0447\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u0435" })] }) }));
|
|
738
972
|
});
|
|
739
973
|
|
|
974
|
+
const GOLDEN_RATIO = 1.618;
|
|
975
|
+
const Placeholder = JSX(({ className, context, title }) => {
|
|
976
|
+
return (jsx(Tile, { className: className, context: context, title: title, description: "\u0411\u043B\u043E\u043A \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043E\u0442\u043A\u0435...", children: jsx("figure", { className: "m-0 min-w-[600px]", children: renderShimmer() }) }));
|
|
977
|
+
});
|
|
978
|
+
const renderShimmer = (size = 3) => goldenSequence(100, size)
|
|
979
|
+
.map((_) => Math.floor(_))
|
|
980
|
+
.map(renderShimmerItem);
|
|
981
|
+
const renderShimmerItem = (width = 100, index) => (jsx("div", { style: { width: `${width}%` }, className: "h-4 mt-2 bg-secondary-light" }, String(index)));
|
|
982
|
+
const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
|
|
983
|
+
|
|
740
984
|
const ProductBlockInner = JSX(({ className, context, title, titleSize, description, benefits, buttons, image, items }) => {
|
|
741
985
|
return (jsxs("div", { className: `flex grow justify-between items-stretch ${className || ''}`, children: [jsxs("div", { className: 'flex flex-col', children: [title && (
|
|
742
986
|
/* TODO Why <Title> is duplicated here? */
|
|
@@ -826,278 +1070,96 @@
|
|
|
826
1070
|
return (jsx("div", { className: "flex flex-col items-center text-center relative w-[276px]", children: jsxs("div", { className: "max-w-min", children: [jsx("h5", { className: "font-medium text-xl m-0 mt-4 whitespace-nowrap px-3", children: step.label }), step.description && (jsx("div", { className: "font-normal text-sm text-secondary-text mt-2", children: step.description }))] }) }, String(i)));
|
|
827
1071
|
};
|
|
828
1072
|
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
const TextBlock = JSX(({ title, description, blockVersion = 'primary', iconVersion, image, className }) => {
|
|
850
|
-
const textBlockStyleMap = textBlockStyleMaps[blockVersion];
|
|
851
|
-
return (jsxs("section", { className: `font-sans px-9 py-4 flex ${textBlockStyleMap.background} ${className || ''}`, children: [iconVersion && iconVersion === 'small' ? renderIcon(textBlockStyleMap.icon) : null, iconVersion && iconVersion === 'big' ? renderImage(image) : null, jsxs("div", { className: "py-0.5", children: [title && (jsx("div", { className: `font-medium text-base mb-1 ${textBlockStyleMap.title}`, children: title })), description && (jsx("div", { className: `text-sm ${textBlockStyleMap.description}`, children: description }))] })] }));
|
|
852
|
-
});
|
|
853
|
-
function renderIcon(className) {
|
|
854
|
-
return (jsx("div", { className: `pt-1.5 pr-4`, children: jsx("div", { className: `rounded-full h-4 w-4 text-center text-xs ${className}`, children: "i" }) }));
|
|
855
|
-
}
|
|
856
|
-
function renderImage(image) {
|
|
857
|
-
return image?.src ? jsx(Img, { className: "pt-0.5 pr-3", image: image }) : null;
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
const TableRowContainer = JSX(({ children }) => (jsx("div", { className: "self-start flex flex-col", role: "row", children: jsx("div", { className: "flex", children: children }) })));
|
|
861
|
-
|
|
862
|
-
const GRADIENT = 'bg-gradient-to-r from-main-gradient-start to-main-gradient-end';
|
|
863
|
-
const BORDER_CLASSES = 'border-main-stroke border-solid border';
|
|
864
|
-
const DIVIDER_CLASSES = 'border-main-divider border border-t-0 border-x-0';
|
|
865
|
-
const FIRST_CELL_CLASSES = 'w-[200px] mr-6';
|
|
866
|
-
const COLS_LENGTH_FOR_SCROLL = 2;
|
|
867
|
-
const COLUMN_WIDTH = 4 * 80 + 4 * 4; // w-80 + gap-4 = 336px
|
|
868
|
-
|
|
869
|
-
const TableCarouselContainer = JSX(({ children, activeCardIndex }) => (jsx("div", { className: "flex flex-1 overflow-hidden", children: jsx("div", { className: "flex gap-4 duration-1000", style: { transform: `translateX(-${activeCardIndex * COLUMN_WIDTH}px)` }, children: children }) })));
|
|
870
|
-
|
|
871
|
-
const HeaderCell = JSX(({ icon, image, title, link }) => (jsxs("div", { className: `w-80 box-border flex flex-col items-center rounded-t-md border-b-0 px-7 pt-7 pb-12 ${BORDER_CLASSES} ${GRADIENT}`, role: "columnheader", scope: "col", children: [icon && !image?.src && (jsx(Icon, { className: "h-[63px] w-[63px] min-w-[63px] min-h-[63px] mb-4", name: icon, width: "63", height: "63" })), image?.src && jsx(Img, { className: "mb-4", image: image }), title && (jsx(Title, { size: "S", className: "font-medium m-0 text-center text-white", children: title })), link?.text && (jsx("div", { className: "mt-auto w-full", children: jsx(Button, { href: link.href, target: link.target, className: "mt-4 w-full text-primary-main bg-white hover:bg-secondary-hover active:bg-secondary-active", children: jsx("div", { className: "text-xs py-[11px]", children: link.text }) }) }))] })));
|
|
872
|
-
|
|
873
|
-
const TableCell = JSX(({ cell, isFirstRow, isLastRow, isFillGradient }) => {
|
|
874
|
-
const cellWrapperClasses = `w-80 box-border flex flex-col ${BORDER_CLASSES} ${!isLastRow ? 'border-y-0' : 'border-t-0 rounded-b-md'} ${isFillGradient ? GRADIENT : ''}`;
|
|
875
|
-
const cellClasses = `mx-7 h-full ${DIVIDER_CLASSES} ${isFillGradient && isFirstRow ? 'border-t' : ''} ${!isLastRow ? 'border-solid' : ''}`;
|
|
876
|
-
return (jsx("div", { className: cellWrapperClasses, role: "cell", children: jsx("div", { className: cellClasses, children: cell.map((item, i) => renderCellInner(item, i, isFillGradient)) }) }));
|
|
877
|
-
});
|
|
878
|
-
const renderCellInner = ({ label, description }, i, isFillGradient) => (jsxs("div", { className: "first:pt-7 pt-6 last:pb-7", children: [label && (jsx("h5", { className: `text-xl font-medium m-0 ${isFillGradient ? 'text-white' : ''}`, children: label })), description && (jsx("div", { className: `text-sm opacity-80 ${isFillGradient ? 'text-white' : 'text-secondary-text'}`, children: description }))] }, String(i)));
|
|
879
|
-
|
|
880
|
-
const TableRow = JSX(({ row: { header, data }, activeCardIndex, isColoredFirstColumn, isFirstRow, isLastRow }) => (jsxs(TableRowContainer, { children: [header?.title ? (jsx("div", { className: `text-sm py-7 ${DIVIDER_CLASSES} ${FIRST_CELL_CLASSES} ${!isLastRow ? 'border-solid' : ''}`, children: header.title })) : null, data?.length ? (jsx(TableCarouselContainer, { activeCardIndex: activeCardIndex, children: data.map((cell, i) => (jsx(TableCell, { cell: cell, isFirstRow: isFirstRow, isLastRow: isLastRow, isFillGradient: isColoredFirstColumn && i === 0 }, String(i)))) })) : null] })));
|
|
881
|
-
|
|
882
|
-
const ComparisonTable = JSX(({ className, context, title, rowHeaders, columns, visibleRowLength = 0, isColoredFirstColumn = false, }) => {
|
|
883
|
-
const router = context.useRouter();
|
|
884
|
-
const { handlerDecorator } = context;
|
|
885
|
-
const [activeCardIndex, setActiveCardIndex] = context.useState(0);
|
|
886
|
-
const [isShowAllRow, setIsShowAllRow] = context.useState(!visibleRowLength);
|
|
887
|
-
const colHeaders = columns?.map(({ header }) => header || {});
|
|
888
|
-
const colData = columns?.map(({ data }) => data) || [];
|
|
889
|
-
const rowData = rowHeaders
|
|
890
|
-
?.map((header, i) => ({
|
|
891
|
-
header,
|
|
892
|
-
data: colData.map((col) => col?.[i] || [{}]),
|
|
893
|
-
}))
|
|
894
|
-
.slice(0, isShowAllRow ? rowHeaders.length : visibleRowLength);
|
|
895
|
-
const nextClick = () => setActiveCardIndex(activeCardIndex + 1);
|
|
896
|
-
const prevClick = () => setActiveCardIndex(activeCardIndex - 1);
|
|
897
|
-
const showToggle = () => setIsShowAllRow(!isShowAllRow);
|
|
898
|
-
const isScrollAvailable = colData?.length && colData.length > COLS_LENGTH_FOR_SCROLL;
|
|
899
|
-
const showNextButton = isScrollAvailable && colData?.length - activeCardIndex > COLS_LENGTH_FOR_SCROLL;
|
|
900
|
-
const showPrevButton = isScrollAvailable && activeCardIndex > 0;
|
|
901
|
-
return (jsxs("section", { className: `bg-white font-sans py-[50px] pl-[50px] overflow-hidden text-primary-text relative ${className || ''}`, children: [jsx(Title, { className: "font-medium m-0 max-w-[47rem] text-center mb-9 mx-auto", children: title }), jsxs("div", { role: "table", children: [colHeaders?.length ? (jsxs(TableRowContainer, { children: [jsx("div", { className: FIRST_CELL_CLASSES, role: "columnheader", scope: "col" }), jsx(TableCarouselContainer, { activeCardIndex: activeCardIndex, children: colHeaders.map((header, i) => (jsx(HeaderCell, { ...header, link: header.link && useLink({ router, handlerDecorator }, header.link) }, String(i)))) })] })) : null, rowData?.length ? (jsxs("div", { className: "relative", children: [rowData.map((row, i, { length }) => (jsx(TableRow, { row: row, isFirstRow: i === 0, isLastRow: i + 1 === length, activeCardIndex: activeCardIndex, isColoredFirstColumn: isColoredFirstColumn }, String(i)))), isScrollAvailable ? (jsx("div", { children: jsxs("div", { className: "absolute top-7 right-7 z-10", children: [jsx(ArrowButton, { onClick: nextClick, disabled: !showNextButton, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E" }), jsx(ArrowButton, { className: "mt-4 rotate-180", onClick: prevClick, disabled: !showPrevButton, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E" })] }) })) : null] })) : null] }), isScrollAvailable ? (jsx("div", { className: "absolute top-0 right-0 bottom-0 w-[84px] bg-opacity-to-white" })) : null, visibleRowLength ? (jsx("div", { className: "pr-[50px]", children: jsxs("div", { className: "flex w-full", children: [jsx("div", { className: FIRST_CELL_CLASSES }), jsx("button", { onClick: showToggle, className: "mt-5 flex-1 border-main-stroke border-solid border text-primary-text bg-white hover:border-primary-main hover:text-primary-main", children: jsx("div", { className: "font-sans font-medium text-xs py-[11px]", children: !isShowAllRow ? 'Показать все параметры' : 'Скрыть' }) })] }) })) : null] }));
|
|
902
|
-
});
|
|
903
|
-
|
|
904
|
-
const AccordionBlocks = {
|
|
1073
|
+
const Blocks = {
|
|
1074
|
+
Accordion,
|
|
1075
|
+
BenefitsBlock,
|
|
1076
|
+
ComparisonTable,
|
|
1077
|
+
CreditCalculator,
|
|
1078
|
+
ExchangeRateTile,
|
|
1079
|
+
Footer: Footer$1,
|
|
1080
|
+
Gallery: Gallery$1,
|
|
1081
|
+
Header,
|
|
1082
|
+
Headline,
|
|
1083
|
+
LinkDocs,
|
|
1084
|
+
MiniGallery,
|
|
1085
|
+
MobileAppTile,
|
|
1086
|
+
PictureText,
|
|
1087
|
+
Placeholder,
|
|
1088
|
+
ProductBlock: ProductBlock$1,
|
|
1089
|
+
ProductGallery,
|
|
1090
|
+
ProductTile,
|
|
1091
|
+
PromoTile,
|
|
1092
|
+
StepsBlock,
|
|
905
1093
|
TextBlock,
|
|
1094
|
+
Tile,
|
|
906
1095
|
};
|
|
907
1096
|
|
|
908
|
-
const
|
|
909
|
-
|
|
910
|
-
const
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
setIsActive(!isActive);
|
|
916
|
-
const contentBlock = getContentBlock(e);
|
|
917
|
-
contentBlock.style.maxHeight = contentBlock.style.maxHeight
|
|
918
|
-
? null
|
|
919
|
-
: `${contentBlock.scrollHeight}px`;
|
|
1097
|
+
const LikeButton = JSX(({ className, onClick, ariaLabel }) => (jsx("button", { type: "button", className: `border-0 w-[36px] bg-inherit cursor-pointer ${className || ''}`, onClick: onClick, "aria-label": ariaLabel, children: renderLikeIcon() })));
|
|
1098
|
+
const renderLikeIcon = () => {
|
|
1099
|
+
const params = {
|
|
1100
|
+
stroke: '#292D32',
|
|
1101
|
+
strokeLinecap: 'round',
|
|
1102
|
+
strokeLinejoin: 'round',
|
|
1103
|
+
strokeWidth: '1.5',
|
|
920
1104
|
};
|
|
921
|
-
return (jsxs("
|
|
922
|
-
${hasContent ? 'group cursor-pointer' : ''}`, onClick: handleToggle, children: [jsx("span", { className: `m-0 text-xl pr-2.5 font-medium ${hasContent ? 'group-hover:text-primary-main' : ''}`, children: label }), hasContent ? jsx(Icon, { name: icon, width: "24", height: "24" }) : null] }), hasContent ? (jsx("div", { className: `${isActive ? 'pb-5' : ''} text-sm transition-all duration-300 max-h-0 overflow-hidden group-last:last:pb-0 `, children: blocks?.length ? blocks.map(renderComponent) : null })) : null] }));
|
|
923
|
-
});
|
|
924
|
-
// TODO: draft, for dynamic rendering of components
|
|
925
|
-
const renderComponent = (block, i) => {
|
|
926
|
-
if (block.type && block.data && !AccordionBlocks.hasOwnProperty(block.type)) {
|
|
927
|
-
return null;
|
|
928
|
-
}
|
|
929
|
-
const AccordionBlock = block.type && AccordionBlocks[block.type];
|
|
930
|
-
return (jsx("div", { className: "mb-5 last:mb-0", children: jsx(AccordionBlock, { ...block.data }) }, `component${i}`));
|
|
1105
|
+
return (jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [jsx("path", { ...params, strokeMiterlimit: "10", d: "M21.48 11.95c.5-1.4-.4-2.6-1.9-2.6h-4c-.6 0-1.1-.5-1-1.2l.5-3.2c.2-.9-.4-1.9-1.3-2.2-.8-.3-1.8.1-2.2.7l-4.1 6.1M7.48 18.35l3.1 2.4c.4.4 1.3.6 1.9.6h3.8c1.2 0 2.5-.9 2.8-2.1l1.24-3.77" }), jsx("path", { ...params, d: "M2.38 18.35v-9.8c0-1.4.6-1.9 2-1.9h1c1.4 0 2 .5 2 1.9v9.8c0 1.4-.6 1.9-2 1.9h-1c-1.4 0-2-.5-2-1.9Z" })] }));
|
|
931
1106
|
};
|
|
932
|
-
const getContentBlock = (e) => e.target.tagName === 'BUTTON' ? e.target.nextSibling : e.target.parentNode.nextSibling;
|
|
933
1107
|
|
|
934
|
-
const
|
|
935
|
-
|
|
1108
|
+
const LikeControl = JSX(({ className, context }) => {
|
|
1109
|
+
const likeService = context.useLikeService();
|
|
1110
|
+
return (jsxs("div", { className: `border-main border-2 border-solid bg-white flex w-[125px] items-center justify-center gap-3 p-2 font-sans ${className || ''}`, children: [jsx(LikeButton, { onClick: likeService.like, ariaLabel: "\u041F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u00AB\u043B\u0430\u0439\u043A\u00BB" }), jsx(LikeButton, { onClick: likeService.dislike, className: "rotate-180", ariaLabel: "\u041F\u043E\u0441\u0442\u0430\u0432\u0438\u0442\u044C \u043E\u0442\u043C\u0435\u0442\u043A\u0443 \u00AB\u0434\u0438\u0437\u043B\u0430\u0439\u043A\u00BB" }), jsx("span", { className: "select-none", children: likeService.likeCount })] }));
|
|
936
1111
|
});
|
|
937
1112
|
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
return data || {};
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
1113
|
+
const defaultBlockDecorator = ({ blockClassName, block, render }) => render({ blockClassName, block });
|
|
1114
|
+
const ContentPage = JSX(({ className, context, blocksRegistry, data: { style: pageStyle, blocks, likeControl, colorPalette = 'pc' }, blockDecorator = defaultBlockDecorator, }) => {
|
|
1115
|
+
return (jsxs("section", { className: "relative", "data-theme": colorPalette, children: [jsx("div", { className: `grid grid-cols-12 gap-1 ${style2className(pageStyle)} ${className || ''}`, children: blocks?.length ? blocks.map(renderBlock) : null }), likeControl && (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-lg sticky bottom-0 pointer-events-auto", context: context }) }))] }));
|
|
1116
|
+
function renderBlock(block, i) {
|
|
1117
|
+
const { type } = block;
|
|
1118
|
+
if (!(type in blocksRegistry)) {
|
|
1119
|
+
console.warn(`No block with "${type}" is registered`);
|
|
1120
|
+
}
|
|
1121
|
+
const BlockComponent = blocksRegistry[type] || Placeholder;
|
|
1122
|
+
return blockDecorator({
|
|
1123
|
+
blockClassName: style2className(block.style),
|
|
1124
|
+
block,
|
|
1125
|
+
render: (props) => {
|
|
1126
|
+
const { version, content, blocks } = props.block;
|
|
1127
|
+
return (jsx(BlockComponent, { className: props.blockClassName, version: version, context: context, ...content, children: blocks?.length ? blocks.map(renderBlock) : null }, `${type}-${i}`));
|
|
1128
|
+
},
|
|
1129
|
+
}, `block-${i}`);
|
|
1130
|
+
}
|
|
1131
|
+
});
|
|
1132
|
+
function style2className(style) {
|
|
1133
|
+
return style ? style.join(' ') : '';
|
|
948
1134
|
}
|
|
949
1135
|
|
|
950
|
-
const
|
|
951
|
-
{
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
fill: 'white',
|
|
956
|
-
},
|
|
957
|
-
];
|
|
958
|
-
const Checkbox = JSX(({ text, checked, onChange, className }) => (jsx("div", { className: className, children: jsxs("label", { className: "flex items-center cursor-pointer relative", children: [jsx("input", { className: `peer appearance-none w-5 h-5 border-solid border rounded border-black checked:bg-primary-main checked:border-primary-main`, type: "checkbox", onChange: (e) => {
|
|
959
|
-
onChange(e.target.checked);
|
|
960
|
-
}, checked: checked }), jsx(SVG, { paths: CHECK_PATHS, className: "hidden absolute left-2 ml-px peer-checked:block", width: "11", height: "9", fill: "white", viewBox: "0 0 11 9" }), text ? jsx("span", { className: "font-sans ml-2 text-sm cursor-pointer", children: text }) : null] }) })));
|
|
961
|
-
|
|
962
|
-
const addSpacesBetweenNumbers = (number) => new Intl.NumberFormat('ru-RU', { maximumSignificantDigits: 3 }).format(number);
|
|
963
|
-
|
|
964
|
-
const InputRange = JSX(({ className, title, items = [], min = 1, max = 100, step = 1, value = min, onChange }) => {
|
|
965
|
-
const handleChange = (value) => {
|
|
966
|
-
if (!onChange)
|
|
967
|
-
return;
|
|
968
|
-
const sanitizedValue = Number(value.replace(/\D/g, ''));
|
|
969
|
-
onChange(sanitizedValue);
|
|
970
|
-
};
|
|
971
|
-
const inputStyle = {
|
|
972
|
-
backgroundSize: `${(((value - min) * 100) / (max - min)).toFixed(2)}% 100%`,
|
|
973
|
-
};
|
|
974
|
-
const handleBlur = () => {
|
|
975
|
-
if (!onChange)
|
|
976
|
-
return;
|
|
977
|
-
if (value < min)
|
|
978
|
-
onChange(min);
|
|
979
|
-
if (value > max)
|
|
980
|
-
onChange(max);
|
|
981
|
-
};
|
|
982
|
-
return (jsxs("div", { className: className, children: [jsxs("div", { className: "relative", children: [title ? (jsx("span", { className: "absolute text-xs text-secondary-text top-1 mt-0.5 pl-4 ml-0.5", children: title })) : null, jsx("input", { className: `m-0 font-sans text-sm w-full h-12 border-2 border-solid border-main-divider rounded-md outline-none p-0 pl-4 m-0 box-border text-primary-text ${title ? 'pt-4' : ''}`, value: addSpacesBetweenNumbers(value), onChange: (e) => handleChange(e.target.value), onBlur: handleBlur }), jsx("div", { className: "absolute inset-x-0 mt-0.5 top-8 px-4", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider", type: "range", min: min, max: max, step: step, value: value, onChange: (e) => handleChange(e.target.value), style: inputStyle }) })] }), jsx("div", { className: "flex justify-between mt-3 mb-4", children: items.map((item, i) => (jsx("span", { className: "text-xs text-secondary-text pl-4", children: item }, String(i)))) })] }));
|
|
1136
|
+
const ContentPageHead = JSX(({ HeadComponent, data, children }) => {
|
|
1137
|
+
const { title, description, keywords, robots, og } = data;
|
|
1138
|
+
return (jsxs(HeadComponent, { children: [jsx("title", { children: title }), jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), description && jsx("meta", { name: "description", content: description }), keywords && jsx("meta", { name: "keywords", content: keywords.join(',') }), robots && jsx("meta", { name: "robots", content: robots.join(',') }), og
|
|
1139
|
+
? Object.entries(og).map(([key, value]) => (jsx("meta", { name: `og:${key}`, content: value }, key)))
|
|
1140
|
+
: null, children] }));
|
|
983
1141
|
});
|
|
984
1142
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
const calculatorParams = tableRows.find((row) => row.isAnnuity === isAnnuity);
|
|
1000
|
-
return calculatorParams || {};
|
|
1001
|
-
};
|
|
1002
|
-
|
|
1003
|
-
const DEFAULT_RATE = 5;
|
|
1004
|
-
const getCreditRate = (params) => {
|
|
1005
|
-
const { calculatorParams, isInsurance } = params;
|
|
1006
|
-
if (!calculatorParams)
|
|
1007
|
-
return DEFAULT_RATE;
|
|
1008
|
-
return isInsurance
|
|
1009
|
-
? calculatorParams?.rateWithInsurance || DEFAULT_RATE
|
|
1010
|
-
: calculatorParams?.rateWithoutInsurance || DEFAULT_RATE;
|
|
1011
|
-
};
|
|
1012
|
-
|
|
1013
|
-
const MAX_YEARS_LENGTH = 5;
|
|
1014
|
-
const getCreditTermYears = (minMonths, maxMonths) => {
|
|
1015
|
-
const totalYears = Math.ceil((maxMonths - minMonths) / 12);
|
|
1016
|
-
const firstYear = Math.floor(minMonths / MONTHS_IN_YEAR) + 1;
|
|
1017
|
-
const result = new Array(Math.min(totalYears - 1, MAX_YEARS_LENGTH))
|
|
1018
|
-
.fill(0)
|
|
1019
|
-
.map((_, i) => firstYear + i);
|
|
1020
|
-
const maxYear = totalYears + firstYear - 1;
|
|
1021
|
-
return result.concat(maxYear);
|
|
1022
|
-
};
|
|
1023
|
-
|
|
1024
|
-
const getMonthlyPayment = (params) => {
|
|
1025
|
-
const { calculatorParams, paymentType, rate, sum, months } = params;
|
|
1026
|
-
if (!calculatorParams)
|
|
1027
|
-
return 0;
|
|
1028
|
-
const finalSum = clamp(sum, calculatorParams.minSum || DEFAULT_MIN_SUM, calculatorParams.maxSum || DEFAULT_MAX_SUM);
|
|
1029
|
-
if (paymentType === 'annuity') {
|
|
1030
|
-
const annuityCoef = Number(rate) / (MONTHS_IN_YEAR * 100);
|
|
1031
|
-
return finalSum * (annuityCoef + annuityCoef / (Math.pow(1 + annuityCoef, months) - 1));
|
|
1143
|
+
function toMobilePage(contentPage) {
|
|
1144
|
+
const blocks = contentPage.blocks?.filter(({ mobile }) => !mobile?.hidden).map(toMobileBlock);
|
|
1145
|
+
return {
|
|
1146
|
+
...contentPage,
|
|
1147
|
+
blocks,
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
function toMobileBlock(block) {
|
|
1151
|
+
const { mobile } = block;
|
|
1152
|
+
if (mobile) {
|
|
1153
|
+
return {
|
|
1154
|
+
...block,
|
|
1155
|
+
style: mobile.style?.length ? mobile.style : block.style,
|
|
1156
|
+
};
|
|
1032
1157
|
}
|
|
1033
1158
|
else {
|
|
1034
|
-
return
|
|
1035
|
-
}
|
|
1036
|
-
};
|
|
1037
|
-
|
|
1038
|
-
const STEP_MONEY = 1000;
|
|
1039
|
-
const STEP_MONTHS = 1;
|
|
1040
|
-
const DEFAULT_PAYMENT_TYPE = 'annuity';
|
|
1041
|
-
const borderStyle = 'border-solid border-3 border-primary-main rounded-md';
|
|
1042
|
-
const CreditCalculator = JSX(({ context, className, directoryName }) => {
|
|
1043
|
-
const [moneyValue, setMoneyValue] = context.useState(undefined);
|
|
1044
|
-
const [monthsValue, setMonthsValue] = context.useState(undefined);
|
|
1045
|
-
const [isAnnuityChecked, setIsAnnuityChecked] = context.useState(true);
|
|
1046
|
-
const [isInsuranceChecked, setIsInsuranceChecked] = context.useState(true);
|
|
1047
|
-
const tableRows = useCreditCalculatorData(context.useAsyncData, directoryName).rows;
|
|
1048
|
-
const calculatorParams = getCalculatorParams({ tableRows, isAnnuity: isAnnuityChecked });
|
|
1049
|
-
const defaultSum = calculatorParams.maxSum && calculatorParams.minSum
|
|
1050
|
-
? (calculatorParams.maxSum - calculatorParams.minSum) / 2
|
|
1051
|
-
: DEFAULT_SUM;
|
|
1052
|
-
const defaultMonths = calculatorParams.maxMonths && calculatorParams.minMonths
|
|
1053
|
-
? Math.round((calculatorParams.maxMonths - calculatorParams.minMonths) / 2)
|
|
1054
|
-
: DEFAULT_MONTHS;
|
|
1055
|
-
const minSum = calculatorParams?.minSum || DEFAULT_MIN_SUM;
|
|
1056
|
-
const maxSum = calculatorParams?.maxSum || DEFAULT_MAX_SUM;
|
|
1057
|
-
const minMonths = calculatorParams?.minMonths || DEFAULT_MIN_MONTHS;
|
|
1058
|
-
const maxMonths = calculatorParams?.maxMonths || DEFAULT_MAX_MONTHS;
|
|
1059
|
-
const rate = getCreditRate({ calculatorParams, isInsurance: isInsuranceChecked });
|
|
1060
|
-
const montlyPayment = getMonthlyPayment({
|
|
1061
|
-
calculatorParams,
|
|
1062
|
-
paymentType: DEFAULT_PAYMENT_TYPE,
|
|
1063
|
-
rate,
|
|
1064
|
-
sum: moneyValue || defaultSum,
|
|
1065
|
-
months: monthsValue || defaultMonths,
|
|
1066
|
-
});
|
|
1067
|
-
const creditTermYears = getCreditTermYears(minMonths, maxMonths);
|
|
1068
|
-
function handleButtonClick(value) {
|
|
1069
|
-
setMonthsValue(clamp(value * MONTHS_IN_YEAR, minMonths, maxMonths));
|
|
1159
|
+
return block;
|
|
1070
1160
|
}
|
|
1071
|
-
return (jsx("section", { className: `font-sans text-primary-text bg-white p-4 ${className}`, children: jsxs("div", { className: `box-border p-12 flex flex-col justify-between ${borderStyle}`, children: [jsxs("div", { className: "flex justify-between", children: [jsxs("div", { className: "grow mr-11", children: [jsx(InputRange, { title: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0441\u0443\u043C\u043C\u0430 \u043A\u0440\u0435\u0434\u0438\u0442\u0430, \u20BD", items: [
|
|
1072
|
-
`От ${addSpacesBetweenNumbers(minSum)} рублей`,
|
|
1073
|
-
`До ${addSpacesBetweenNumbers(maxSum)} рублей`,
|
|
1074
|
-
], min: minSum, max: maxSum, step: STEP_MONEY, value: moneyValue || defaultSum, onChange: setMoneyValue }), jsx(InputRange, { title: "\u0421\u0440\u043E\u043A \u043A\u0440\u0435\u0434\u0438\u0442\u0430, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ['Или выберите из предложенных вариантов ниже'], min: minMonths, max: maxMonths, step: STEP_MONTHS, value: monthsValue || defaultMonths, onChange: setMonthsValue }), jsx("div", { className: "flex mb-7", children: creditTermYears.map((number, i) => renderButton(number, i, handleButtonClick)) }), jsx(Checkbox, { text: "\u041F\u043E\u043B\u0443\u0447\u0430\u044E \u043F\u0435\u043D\u0441\u0438\u044E \u043D\u0430 \u043A\u0430\u0440\u0442\u0443 \u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A\u0430", checked: isAnnuityChecked, onChange: setIsAnnuityChecked }), jsx(Checkbox, { className: "mb-4", text: "\u041A\u043E\u043C\u043F\u043B\u0435\u043A\u0441\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u0445\u043E\u0432\u0430\u044F \u0437\u0430\u0449\u0438\u0442\u0430", checked: isInsuranceChecked, onChange: setIsInsuranceChecked })] }), jsxs("div", { className: "p-9 bg-primary-main rounded-md text-white", children: [jsx("div", { className: "text-base mb-5", children: "\u041D\u0430\u0448\u0435 \u043F\u0440\u0435\u0434\u043B\u043E\u0436\u0435\u043D\u0438\u0435" }), jsx("div", { className: "text-sm opacity-60", children: "\u0415\u0436\u0435\u043C\u0435\u0441\u044F\u0447\u043D\u044B\u0439 \u043F\u043B\u0430\u0442\u0451\u0436" }), jsxs("div", { className: "text-lg mb-3", children: [addSpacesBetweenNumbers(Math.round(montlyPayment)), " \u20BD"] }), jsx("div", { className: "text-sm opacity-60", children: "\u0421\u0442\u0430\u0432\u043A\u0430" }), jsxs("div", { className: "text-lg", children: [rate, " %"] })] })] }), jsxs("div", { className: "flex items-center", children: [jsx(Button, { className: "mr-3", text: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0437\u0430\u044F\u0432\u043A\u0443", version: "primary", href: "#" }), jsx("div", { className: "w-80 text-xxs leading-4 text-secondary-text", "aria-label": "\u0421\u043E\u0433\u043B\u0430\u0448\u0435\u043D\u0438\u0435 \u043D\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0443 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445", children: "\u041E\u0442\u043F\u0440\u0430\u0432\u043B\u044F\u044F \u0437\u0430\u044F\u0432\u043A\u0443, \u0432\u044B \u0441\u043E\u0433\u043B\u0430\u0448\u0430\u0435\u0442\u0435\u0441\u044C \u043D\u0430 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0443 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043D\u043D\u043E \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044F\u043C \u0424\u0417\u00A0\u00AB\u041E\u00A0\u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\u00BB" })] })] }) }));
|
|
1075
|
-
});
|
|
1076
|
-
function renderButton(number, i, handleClick) {
|
|
1077
|
-
return (jsx("button", { className: "bg-secondary-light rounded-3xl h-10 w-[75px] box-border mr-2 flex items-center justify-center cursor-pointer border-none", onClick: () => handleClick(number), children: jsxs("span", { className: "font-semibold text-sm", children: [number, " ", number === 1 ? 'год' : number > 4 ? 'лет' : 'года'] }) }, String(i)));
|
|
1078
1161
|
}
|
|
1079
1162
|
|
|
1080
|
-
const Blocks = {
|
|
1081
|
-
Header,
|
|
1082
|
-
Footer: Footer$1,
|
|
1083
|
-
Placeholder,
|
|
1084
|
-
Tile,
|
|
1085
|
-
PromoTile,
|
|
1086
|
-
TextBlock,
|
|
1087
|
-
ProductTile,
|
|
1088
|
-
ProductBlock: ProductBlock$1,
|
|
1089
|
-
StepsBlock,
|
|
1090
|
-
BenefitsBlock,
|
|
1091
|
-
ProductGallery,
|
|
1092
|
-
ExchangeRateTile,
|
|
1093
|
-
MobileAppTile,
|
|
1094
|
-
Gallery: Gallery$1,
|
|
1095
|
-
MiniGallery,
|
|
1096
|
-
ComparisonTable,
|
|
1097
|
-
Accordion,
|
|
1098
|
-
CreditCalculator,
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
1163
|
const Footer = JSX(({ className, context }) => (jsx("footer", { className: `${className} px-9 py-2 bg-white rounded-bl-3xl rounded-br-3xl`, children: jsx(TextInformation, { context: context }) })));
|
|
1102
1164
|
|
|
1103
1165
|
const Gallery = JSX(({ title, description, cards = [], className }) => {
|
|
@@ -1116,16 +1178,18 @@
|
|
|
1116
1178
|
});
|
|
1117
1179
|
|
|
1118
1180
|
const MobileBlocks = {
|
|
1119
|
-
|
|
1181
|
+
ExchangeRateTile,
|
|
1120
1182
|
Footer,
|
|
1183
|
+
Gallery,
|
|
1184
|
+
Header,
|
|
1185
|
+
Headline,
|
|
1186
|
+
MobileAppTile,
|
|
1187
|
+
PictureText,
|
|
1121
1188
|
Placeholder,
|
|
1122
|
-
Tile,
|
|
1123
|
-
ProductTile,
|
|
1124
1189
|
ProductBlock,
|
|
1190
|
+
ProductTile,
|
|
1125
1191
|
TextBlock,
|
|
1126
|
-
|
|
1127
|
-
MobileAppTile,
|
|
1128
|
-
Gallery,
|
|
1192
|
+
Tile,
|
|
1129
1193
|
// TODO StepsBlock,
|
|
1130
1194
|
// TODO BenefitsBlock,
|
|
1131
1195
|
// TODO ProductGallery
|