@redneckz/wildless-cms-uni-blocks 0.8.9 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/migration-scripts/0.8.10.js +31 -0
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +154 -138
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/Calculator/rangeHelpers.d.ts +4 -0
- package/bundle/components/StepsBlock/StepsBlockContent.d.ts +11 -1
- package/bundle/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
- package/bundle/components/StepsBlock/{renderStepContent.d.ts → renderStep.d.ts} +5 -5
- package/bundle/components/Tile/TileContent.d.ts +2 -2
- package/bundle/services/BlockRouter/BlockRouter.d.ts +1 -3
- package/bundle/ui-kit/Img/ImgAsPicture.d.ts +0 -2
- package/bundle/utils/adjustHref.d.ts +3 -0
- package/bundle/utils/dirname.d.ts +1 -0
- package/bundle/utils/url.d.ts +2 -2
- package/dist/ProjectSettings.js +3 -4
- package/dist/ProjectSettings.js.map +1 -1
- package/dist/components/Calculator/Rate.js +1 -1
- package/dist/components/Calculator/Rate.js.map +1 -1
- package/dist/components/Calculator/constants.js +2 -2
- package/dist/components/Calculator/constants.js.map +1 -1
- package/dist/components/Calculator/rangeHelpers.d.ts +4 -0
- package/dist/components/Calculator/rangeHelpers.js +12 -0
- package/dist/components/Calculator/rangeHelpers.js.map +1 -0
- package/dist/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
- package/dist/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
- package/dist/components/Calculator/useCreditCalculatorParams.js +8 -2
- package/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
- package/dist/components/Calculator/useDepositCalculatorParams.js +14 -4
- package/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
- package/dist/components/Carousel/Carousel.js +6 -4
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/PictureText/renderBenefit.js +1 -0
- package/dist/components/PictureText/renderBenefit.js.map +1 -1
- package/dist/components/ProductTile/renderBenefit.js +1 -0
- package/dist/components/ProductTile/renderBenefit.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlock.js +7 -13
- package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlock.mobile.js +24 -4
- package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -1
- package/dist/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
- package/dist/components/StepsBlock/checkCanRenderIcon.js +5 -0
- package/dist/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
- package/{lib/components/StepsBlock/renderStepContent.d.ts → dist/components/StepsBlock/renderStep.d.ts} +5 -5
- package/dist/components/StepsBlock/renderStep.js +34 -0
- package/dist/components/StepsBlock/renderStep.js.map +1 -0
- package/dist/components/Tile/Tile.js +3 -3
- package/dist/components/Tile/Tile.js.map +1 -1
- package/dist/components/Tile/TileContent.d.ts +2 -2
- package/dist/hooks/useLink.js +4 -16
- package/dist/hooks/useLink.js.map +1 -1
- package/dist/services/BlockRouter/BlockRouter.d.ts +1 -3
- package/dist/services/BlockRouter/BlockRouter.js +3 -9
- package/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/dist/services/BlockRouter/useBlockRouterProvider.js +2 -10
- package/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/dist/setup-fixture.js +3 -4
- package/dist/setup-fixture.js.map +1 -1
- package/dist/ui-kit/Icon/Icon.js +5 -1
- package/dist/ui-kit/Icon/Icon.js.map +1 -1
- package/dist/ui-kit/Img/ImgAsPicture.d.ts +0 -2
- package/dist/ui-kit/Img/ImgAsPicture.js +18 -21
- package/dist/ui-kit/Img/ImgAsPicture.js.map +1 -1
- package/dist/utils/adjustHref.d.ts +3 -0
- package/dist/utils/adjustHref.js +14 -0
- package/dist/utils/adjustHref.js.map +1 -0
- package/dist/utils/dirname.d.ts +1 -0
- package/dist/utils/dirname.js +5 -0
- package/dist/utils/dirname.js.map +1 -0
- package/dist/utils/url.d.ts +2 -2
- package/dist/utils/url.js +1 -1
- package/dist/utils/url.js.map +1 -1
- package/dist/wlc.json +0 -1
- package/lib/ProjectSettings.js +3 -4
- package/lib/ProjectSettings.js.map +1 -1
- package/lib/components/Calculator/Rate.js +1 -1
- package/lib/components/Calculator/Rate.js.map +1 -1
- package/lib/components/Calculator/constants.js +2 -2
- package/lib/components/Calculator/constants.js.map +1 -1
- package/lib/components/Calculator/rangeHelpers.d.ts +4 -0
- package/lib/components/Calculator/rangeHelpers.js +8 -0
- package/lib/components/Calculator/rangeHelpers.js.map +1 -0
- package/lib/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
- package/lib/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
- package/lib/components/Calculator/useCreditCalculatorParams.js +8 -2
- package/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
- package/lib/components/Calculator/useDepositCalculatorParams.js +14 -4
- package/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
- package/lib/components/Carousel/Carousel.js +6 -4
- package/lib/components/Carousel/Carousel.js.map +1 -1
- package/lib/components/PictureText/renderBenefit.js +1 -0
- package/lib/components/PictureText/renderBenefit.js.map +1 -1
- package/lib/components/ProductTile/renderBenefit.js +1 -0
- package/lib/components/ProductTile/renderBenefit.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlock.js +7 -13
- package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlock.mobile.js +24 -4
- package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
- package/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -1
- package/lib/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
- package/lib/components/StepsBlock/checkCanRenderIcon.js +2 -0
- package/lib/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
- package/{dist/components/StepsBlock/renderStepContent.d.ts → lib/components/StepsBlock/renderStep.d.ts} +5 -5
- package/lib/components/StepsBlock/renderStep.js +31 -0
- package/lib/components/StepsBlock/renderStep.js.map +1 -0
- package/lib/components/Tile/Tile.js +3 -3
- package/lib/components/Tile/Tile.js.map +1 -1
- package/lib/components/Tile/TileContent.d.ts +2 -2
- package/lib/hooks/useLink.js +5 -17
- package/lib/hooks/useLink.js.map +1 -1
- package/lib/services/BlockRouter/BlockRouter.d.ts +1 -3
- package/lib/services/BlockRouter/BlockRouter.js +2 -7
- package/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/lib/services/BlockRouter/useBlockRouterProvider.js +2 -10
- package/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/lib/setup-fixture.js +3 -4
- package/lib/setup-fixture.js.map +1 -1
- package/lib/ui-kit/Icon/Icon.js +5 -1
- package/lib/ui-kit/Icon/Icon.js.map +1 -1
- package/lib/ui-kit/Img/ImgAsPicture.d.ts +0 -2
- package/lib/ui-kit/Img/ImgAsPicture.js +17 -19
- package/lib/ui-kit/Img/ImgAsPicture.js.map +1 -1
- package/lib/utils/adjustHref.d.ts +3 -0
- package/lib/utils/adjustHref.js +11 -0
- package/lib/utils/adjustHref.js.map +1 -0
- package/lib/utils/dirname.d.ts +1 -0
- package/lib/utils/dirname.js +2 -0
- package/lib/utils/dirname.js.map +1 -0
- package/lib/utils/url.d.ts +2 -2
- package/lib/utils/url.js +1 -1
- package/lib/utils/url.js.map +1 -1
- package/lib/wlc.json +0 -1
- package/mobile/bundle/bundle.umd.js +104 -95
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/Calculator/rangeHelpers.d.ts +4 -0
- package/mobile/bundle/components/StepsBlock/StepsBlockContent.d.ts +11 -1
- package/mobile/bundle/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
- package/mobile/bundle/components/StepsBlock/{renderStepContent.d.ts → renderStep.d.ts} +5 -5
- package/mobile/bundle/components/Tile/TileContent.d.ts +2 -2
- package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +1 -3
- package/mobile/bundle/ui-kit/Img/ImgAsPicture.d.ts +0 -2
- package/mobile/bundle/utils/adjustHref.d.ts +3 -0
- package/mobile/bundle/utils/dirname.d.ts +1 -0
- package/mobile/bundle/utils/url.d.ts +2 -2
- package/mobile/dist/ProjectSettings.js +3 -4
- package/mobile/dist/ProjectSettings.js.map +1 -1
- package/mobile/dist/components/Calculator/Rate.js +1 -1
- package/mobile/dist/components/Calculator/Rate.js.map +1 -1
- package/mobile/dist/components/Calculator/constants.js +2 -2
- package/mobile/dist/components/Calculator/constants.js.map +1 -1
- package/mobile/dist/components/Calculator/rangeHelpers.d.ts +4 -0
- package/mobile/dist/components/Calculator/rangeHelpers.js +12 -0
- package/mobile/dist/components/Calculator/rangeHelpers.js.map +1 -0
- package/mobile/dist/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
- package/mobile/dist/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
- package/mobile/dist/components/Calculator/useCreditCalculatorParams.js +8 -2
- package/mobile/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
- package/mobile/dist/components/Calculator/useDepositCalculatorParams.js +14 -4
- package/mobile/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
- package/mobile/dist/components/Carousel/Carousel.js +6 -4
- package/mobile/dist/components/Carousel/Carousel.js.map +1 -1
- package/mobile/dist/components/PictureText/renderBenefit.js +1 -0
- package/mobile/dist/components/PictureText/renderBenefit.js.map +1 -1
- package/mobile/dist/components/ProductTile/renderBenefit.js +1 -0
- package/mobile/dist/components/ProductTile/renderBenefit.js.map +1 -1
- package/mobile/dist/components/StepsBlock/StepsBlock.js +24 -4
- package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -1
- package/mobile/dist/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
- package/mobile/dist/components/StepsBlock/checkCanRenderIcon.js +5 -0
- package/mobile/dist/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
- package/mobile/dist/components/StepsBlock/renderStep.d.ts +11 -0
- package/mobile/dist/components/StepsBlock/renderStep.js +34 -0
- package/mobile/dist/components/StepsBlock/renderStep.js.map +1 -0
- package/mobile/dist/components/Tile/Tile.js +3 -3
- package/mobile/dist/components/Tile/Tile.js.map +1 -1
- package/mobile/dist/components/Tile/TileContent.d.ts +2 -2
- package/mobile/dist/hooks/useLink.js +4 -16
- package/mobile/dist/hooks/useLink.js.map +1 -1
- package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +1 -3
- package/mobile/dist/services/BlockRouter/BlockRouter.js +3 -9
- package/mobile/dist/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js +2 -10
- package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/mobile/dist/setup-fixture.js +3 -4
- package/mobile/dist/setup-fixture.js.map +1 -1
- package/mobile/dist/ui-kit/Icon/Icon.js +5 -1
- package/mobile/dist/ui-kit/Icon/Icon.js.map +1 -1
- package/mobile/dist/ui-kit/Img/ImgAsPicture.d.ts +0 -2
- package/mobile/dist/ui-kit/Img/ImgAsPicture.js +18 -21
- package/mobile/dist/ui-kit/Img/ImgAsPicture.js.map +1 -1
- package/mobile/dist/utils/adjustHref.d.ts +3 -0
- package/mobile/dist/utils/adjustHref.js +14 -0
- package/mobile/dist/utils/adjustHref.js.map +1 -0
- package/mobile/dist/utils/dirname.d.ts +1 -0
- package/mobile/dist/utils/dirname.js +5 -0
- package/mobile/dist/utils/dirname.js.map +1 -0
- package/mobile/dist/utils/url.d.ts +2 -2
- package/mobile/dist/utils/url.js +1 -1
- package/mobile/dist/utils/url.js.map +1 -1
- package/mobile/dist/wlc.json +0 -1
- package/mobile/lib/ProjectSettings.js +3 -4
- package/mobile/lib/ProjectSettings.js.map +1 -1
- package/mobile/lib/components/Calculator/Rate.js +1 -1
- package/mobile/lib/components/Calculator/Rate.js.map +1 -1
- package/mobile/lib/components/Calculator/constants.js +2 -2
- package/mobile/lib/components/Calculator/constants.js.map +1 -1
- package/mobile/lib/components/Calculator/rangeHelpers.d.ts +4 -0
- package/mobile/lib/components/Calculator/rangeHelpers.js +8 -0
- package/mobile/lib/components/Calculator/rangeHelpers.js.map +1 -0
- package/mobile/lib/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
- package/mobile/lib/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
- package/mobile/lib/components/Calculator/useCreditCalculatorParams.js +8 -2
- package/mobile/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
- package/mobile/lib/components/Calculator/useDepositCalculatorParams.js +14 -4
- package/mobile/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
- package/mobile/lib/components/Carousel/Carousel.js +6 -4
- package/mobile/lib/components/Carousel/Carousel.js.map +1 -1
- package/mobile/lib/components/PictureText/renderBenefit.js +1 -0
- package/mobile/lib/components/PictureText/renderBenefit.js.map +1 -1
- package/mobile/lib/components/ProductTile/renderBenefit.js +1 -0
- package/mobile/lib/components/ProductTile/renderBenefit.js.map +1 -1
- package/mobile/lib/components/StepsBlock/StepsBlock.js +24 -4
- package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
- package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -1
- package/mobile/lib/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
- package/mobile/lib/components/StepsBlock/checkCanRenderIcon.js +2 -0
- package/mobile/lib/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
- package/mobile/lib/components/StepsBlock/renderStep.d.ts +11 -0
- package/mobile/lib/components/StepsBlock/renderStep.js +31 -0
- package/mobile/lib/components/StepsBlock/renderStep.js.map +1 -0
- package/mobile/lib/components/Tile/Tile.js +3 -3
- package/mobile/lib/components/Tile/Tile.js.map +1 -1
- package/mobile/lib/components/Tile/TileContent.d.ts +2 -2
- package/mobile/lib/hooks/useLink.js +5 -17
- package/mobile/lib/hooks/useLink.js.map +1 -1
- package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +1 -3
- package/mobile/lib/services/BlockRouter/BlockRouter.js +2 -7
- package/mobile/lib/services/BlockRouter/BlockRouter.js.map +1 -1
- package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js +2 -10
- package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
- package/mobile/lib/setup-fixture.js +3 -4
- package/mobile/lib/setup-fixture.js.map +1 -1
- package/mobile/lib/ui-kit/Icon/Icon.js +5 -1
- package/mobile/lib/ui-kit/Icon/Icon.js.map +1 -1
- package/mobile/lib/ui-kit/Img/ImgAsPicture.d.ts +0 -2
- package/mobile/lib/ui-kit/Img/ImgAsPicture.js +17 -19
- package/mobile/lib/ui-kit/Img/ImgAsPicture.js.map +1 -1
- package/mobile/lib/utils/adjustHref.d.ts +3 -0
- package/mobile/lib/utils/adjustHref.js +11 -0
- package/mobile/lib/utils/adjustHref.js.map +1 -0
- package/mobile/lib/utils/dirname.d.ts +1 -0
- package/mobile/lib/utils/dirname.js +2 -0
- package/mobile/lib/utils/dirname.js.map +1 -0
- package/mobile/lib/utils/url.d.ts +2 -2
- package/mobile/lib/utils/url.js +1 -1
- package/mobile/lib/utils/url.js.map +1 -1
- package/mobile/lib/wlc.json +0 -1
- package/mobile/src/ProjectSettings.ts +4 -4
- package/mobile/src/components/Calculator/Rate.tsx +1 -1
- package/mobile/src/components/Calculator/constants.ts +2 -2
- package/mobile/src/components/Calculator/rangeHelpers.ts +24 -0
- package/mobile/src/components/Calculator/useBusinessDepositCalculatorParams.ts +15 -3
- package/mobile/src/components/Calculator/useCreditCalculatorParams.ts +8 -2
- package/mobile/src/components/Calculator/useDepositCalculatorParams.ts +18 -4
- package/mobile/src/components/Carousel/Carousel.tsx +6 -4
- package/mobile/src/components/PictureText/renderBenefit.tsx +1 -0
- package/mobile/src/components/ProductTile/renderBenefit.tsx +1 -0
- package/mobile/src/components/StepsBlock/StepsBlock.tsx +29 -5
- package/mobile/src/components/StepsBlock/StepsBlock.ui.json +6 -0
- package/mobile/src/components/StepsBlock/StepsBlockContent.ts +13 -1
- package/mobile/src/components/StepsBlock/checkCanRenderIcon.ts +3 -0
- package/mobile/src/components/StepsBlock/renderStep.tsx +83 -0
- package/mobile/src/components/Tile/Tile.example.json +1 -1
- package/mobile/src/components/Tile/Tile.tsx +4 -4
- package/mobile/src/components/Tile/Tile.ui.json +7 -1
- package/mobile/src/components/Tile/TileContent.ts +2 -2
- package/mobile/src/hooks/useLink.ts +5 -18
- package/mobile/src/services/BlockRouter/BlockRouter.ts +6 -9
- package/mobile/src/services/BlockRouter/useBlockRouterProvider.ts +4 -10
- package/mobile/src/setup-fixture.ts +5 -4
- package/mobile/src/ui-kit/Icon/Icon.tsx +5 -1
- package/mobile/src/ui-kit/Img/ImgAsPicture.tsx +23 -28
- package/mobile/src/utils/adjustHref.ts +17 -0
- package/mobile/src/utils/dirname.ts +1 -0
- package/mobile/src/utils/url.ts +2 -3
- package/mobile/src/wlc.json +0 -1
- package/package.json +1 -1
- package/src/ProjectSettings.ts +4 -4
- package/src/components/Calculator/Rate.tsx +1 -1
- package/src/components/Calculator/constants.ts +2 -2
- package/src/components/Calculator/rangeHelpers.ts +24 -0
- package/src/components/Calculator/useBusinessDepositCalculatorParams.ts +15 -3
- package/src/components/Calculator/useCreditCalculatorParams.ts +8 -2
- package/src/components/Calculator/useDepositCalculatorParams.ts +18 -4
- package/src/components/Carousel/Carousel.tsx +6 -4
- package/src/components/PictureText/renderBenefit.tsx +1 -0
- package/src/components/ProductTile/renderBenefit.tsx +1 -0
- package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +19 -1
- package/src/components/StepsBlock/StepsBlock.fixture.tsx +10 -3
- package/src/components/StepsBlock/StepsBlock.mobile.tsx +29 -5
- package/src/components/StepsBlock/StepsBlock.tsx +28 -16
- package/src/components/StepsBlock/StepsBlock.ui.json +6 -0
- package/src/components/StepsBlock/StepsBlockContent.ts +13 -1
- package/src/components/StepsBlock/checkCanRenderIcon.ts +3 -0
- package/src/components/StepsBlock/renderStep.tsx +83 -0
- package/src/components/Tile/Tile.example.json +1 -1
- package/src/components/Tile/Tile.fixture.tsx +2 -2
- package/src/components/Tile/Tile.tsx +4 -4
- package/src/components/Tile/Tile.ui.json +7 -1
- package/src/components/Tile/TileContent.ts +2 -2
- package/src/hooks/useLink.ts +5 -18
- package/src/services/BlockRouter/BlockRouter.ts +6 -9
- package/src/services/BlockRouter/useBlockRouterProvider.ts +4 -10
- package/src/setup-fixture.ts +5 -4
- package/src/ui-kit/Icon/Icon.tsx +5 -1
- package/src/ui-kit/Img/ImgAsPicture.tsx +23 -28
- package/src/utils/adjustHref.ts +17 -0
- package/src/utils/dirname.ts +1 -0
- package/src/utils/url.ts +2 -3
- package/src/wlc.json +0 -1
- package/bundle/utils/checkIsIconRenderable.d.ts +0 -2
- package/dist/components/StepsBlock/renderStepContent.js +0 -19
- package/dist/components/StepsBlock/renderStepContent.js.map +0 -1
- package/dist/utils/checkIsIconRenderable.d.ts +0 -2
- package/dist/utils/checkIsIconRenderable.js +0 -5
- package/dist/utils/checkIsIconRenderable.js.map +0 -1
- package/lib/components/StepsBlock/renderStepContent.js +0 -16
- package/lib/components/StepsBlock/renderStepContent.js.map +0 -1
- package/lib/utils/checkIsIconRenderable.d.ts +0 -2
- package/lib/utils/checkIsIconRenderable.js +0 -2
- package/lib/utils/checkIsIconRenderable.js.map +0 -1
- package/mobile/bundle/utils/checkIsIconRenderable.d.ts +0 -2
- package/mobile/dist/components/StepsBlock/renderStepContent.d.ts +0 -11
- package/mobile/dist/components/StepsBlock/renderStepContent.js +0 -19
- package/mobile/dist/components/StepsBlock/renderStepContent.js.map +0 -1
- package/mobile/dist/utils/checkIsIconRenderable.d.ts +0 -2
- package/mobile/dist/utils/checkIsIconRenderable.js +0 -5
- package/mobile/dist/utils/checkIsIconRenderable.js.map +0 -1
- package/mobile/lib/components/StepsBlock/renderStepContent.d.ts +0 -11
- package/mobile/lib/components/StepsBlock/renderStepContent.js +0 -16
- package/mobile/lib/components/StepsBlock/renderStepContent.js.map +0 -1
- package/mobile/lib/utils/checkIsIconRenderable.d.ts +0 -2
- package/mobile/lib/utils/checkIsIconRenderable.js +0 -2
- package/mobile/lib/utils/checkIsIconRenderable.js.map +0 -1
- package/mobile/src/components/StepsBlock/renderStepContent.tsx +0 -83
- package/mobile/src/utils/checkIsIconRenderable.tsx +0 -3
- package/src/components/StepsBlock/renderStepContent.tsx +0 -83
- package/src/utils/checkIsIconRenderable.tsx +0 -3
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { DEFAULT_DEPOSIT_CALCULATOR_PARAMS, DEPOSIT_CALC_DEFAULT_DIR } from './constants';
|
|
2
|
+
import { checkRangeByKeys, getRangeByKeys } from './rangeHelpers';
|
|
2
3
|
import { useCalculatorParams } from './useCalculatorParams';
|
|
3
4
|
|
|
4
5
|
export interface CommonDepositParams {
|
|
5
6
|
isMonthlyInterestPayment: boolean;
|
|
6
7
|
}
|
|
8
|
+
|
|
7
9
|
export interface DepositCalculatorSourceBookParams extends CommonDepositParams {
|
|
8
10
|
minSum: number;
|
|
9
11
|
maxSum: number;
|
|
@@ -32,22 +34,34 @@ export const useDepositCalculatorParams = (
|
|
|
32
34
|
userInputParams: DepositCalculatorUserInputParams,
|
|
33
35
|
sourceBookDir?: string,
|
|
34
36
|
): DepositCalculatorParams => {
|
|
35
|
-
const { isMonthlyInterestPayment, moneyValue } = userInputParams;
|
|
37
|
+
const { isMonthlyInterestPayment, moneyValue, monthsValue } = userInputParams;
|
|
36
38
|
|
|
37
39
|
const data = useCalculatorParams<DepositCalculatorData>(
|
|
38
40
|
sourceBookDir || DEPOSIT_CALC_DEFAULT_DIR,
|
|
39
41
|
);
|
|
40
42
|
|
|
41
43
|
const depositCalculatorSourceBookParams =
|
|
42
|
-
data?.rows?.find(
|
|
43
|
-
|
|
44
|
+
data?.rows?.find(
|
|
45
|
+
(_) =>
|
|
46
|
+
isMonthlyInterestPayment === _.isMonthlyInterestPayment &&
|
|
47
|
+
checkRangeByKeys(moneyValue, ['minSum', 'maxSum'], _) &&
|
|
48
|
+
checkRangeByKeys(monthsValue, ['minMonths', 'maxMonths'], _),
|
|
49
|
+
) || DEFAULT_DEPOSIT_CALCULATOR_PARAMS;
|
|
44
50
|
|
|
45
51
|
const { rate } = depositCalculatorSourceBookParams;
|
|
46
52
|
|
|
47
53
|
const income = getDepositIncome(rate, userInputParams);
|
|
48
54
|
const finalSum = moneyValue + income;
|
|
55
|
+
const sourceBookRows = data?.rows || [DEFAULT_DEPOSIT_CALCULATOR_PARAMS];
|
|
49
56
|
|
|
50
|
-
return {
|
|
57
|
+
return {
|
|
58
|
+
...depositCalculatorSourceBookParams,
|
|
59
|
+
...getRangeByKeys(['minSum', 'maxSum'], sourceBookRows),
|
|
60
|
+
...getRangeByKeys(['minMonths', 'maxMonths'], sourceBookRows),
|
|
61
|
+
...userInputParams,
|
|
62
|
+
income,
|
|
63
|
+
finalSum,
|
|
64
|
+
};
|
|
51
65
|
};
|
|
52
66
|
|
|
53
67
|
const getDepositIncome = (rate: number, userInputParams: DepositCalculatorUserInputParams) => {
|
|
@@ -52,10 +52,12 @@ export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
|
|
|
52
52
|
gap={ITEMS_GAP}
|
|
53
53
|
onVisibleIndicesChange={scroll.handleVisibleIndicesChange}
|
|
54
54
|
>
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
{isBankHistoryCarousel
|
|
56
|
+
? renderChildren({
|
|
57
|
+
...rest,
|
|
58
|
+
block: { ...rest.block, blocks: buildBlocks(childBlocks, activeIndex) },
|
|
59
|
+
})
|
|
60
|
+
: renderChildren(rest)}
|
|
59
61
|
</SwipeListContainer>
|
|
60
62
|
<CarouselScrollButtons
|
|
61
63
|
scroll={scroll}
|
|
@@ -4,6 +4,7 @@ import type { ComplexBenefitProps } from '../../ui-kit/BenefitItem/BenefitItemPr
|
|
|
4
4
|
import { RichText } from '../../ui-kit/RichText/RichText';
|
|
5
5
|
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
6
6
|
|
|
7
|
+
// TODO: Create universal function for this case
|
|
7
8
|
export const renderBenefit =
|
|
8
9
|
// Linter doesn't understand that switch processes all cases
|
|
9
10
|
// eslint-disable-next-line consistent-return
|
|
@@ -3,6 +3,7 @@ import { Text } from '../../ui-kit/Text/Text';
|
|
|
3
3
|
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
4
4
|
import type { Benefit } from './ProductTileContent';
|
|
5
5
|
|
|
6
|
+
// TODO: Create universal function for this case
|
|
6
7
|
export const renderBenefit =
|
|
7
8
|
// Linter doesn't understand that switch processes all cases
|
|
8
9
|
// eslint-disable-next-line consistent-return
|
|
@@ -5,9 +5,11 @@ import type { SizeVersion } from '../../model/SizeVersion';
|
|
|
5
5
|
import { BlockWrapper } from '../../ui-kit/BlockWrapper';
|
|
6
6
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
7
7
|
import { Img } from '../../ui-kit/Img/Img';
|
|
8
|
-
import {
|
|
8
|
+
import { RichText } from '../../ui-kit/RichText/RichText';
|
|
9
|
+
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
9
10
|
import { getIconWithVersion } from '../../utils/getIconWithVersion';
|
|
10
|
-
import
|
|
11
|
+
import { checkCanRenderIcon } from './checkCanRenderIcon';
|
|
12
|
+
import type { DefaultStep, Step, StepsBlockContent } from './StepsBlockContent';
|
|
11
13
|
import { STEPS_BLOCK_STYLE_MAPS } from './StepsBlockStyleMaps';
|
|
12
14
|
|
|
13
15
|
export interface StepsBlockProps extends StepsBlockContent, UniBlockProps {}
|
|
@@ -50,7 +52,7 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
50
52
|
{steps?.length ? (
|
|
51
53
|
<div className={`box-border py-0.5 mb-0.5 mt-5`}>
|
|
52
54
|
<div className="flex flex-col justify-between gap-x-[101px]">
|
|
53
|
-
{steps.map(
|
|
55
|
+
{steps.map(renderStep(size, version, showLines))}
|
|
54
56
|
</div>
|
|
55
57
|
</div>
|
|
56
58
|
) : null}
|
|
@@ -59,9 +61,31 @@ export const StepsBlock = JSX<StepsBlockProps>(
|
|
|
59
61
|
},
|
|
60
62
|
);
|
|
61
63
|
|
|
62
|
-
|
|
64
|
+
// TODO: Create universal function for this case
|
|
65
|
+
const renderStep =
|
|
63
66
|
(size: SizeVersion, version: BlockVersion, showLines: boolean) =>
|
|
67
|
+
// Linter doesn't understand that switch processes all cases
|
|
68
|
+
// eslint-disable-next-line consistent-return
|
|
64
69
|
(step: Step, i: number, steps: Step[]) => {
|
|
70
|
+
const { type } = step;
|
|
71
|
+
|
|
72
|
+
if (!(type === 'default' || type === 'rte')) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
switch (type) {
|
|
77
|
+
case 'default':
|
|
78
|
+
return renderDefaultStep(size, version, showLines)(step, i, steps);
|
|
79
|
+
case 'rte':
|
|
80
|
+
return <RichText __html={step.__html} />;
|
|
81
|
+
default:
|
|
82
|
+
assertUnreachable(step);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const renderDefaultStep =
|
|
87
|
+
(size: SizeVersion, version: BlockVersion, showLines: boolean) =>
|
|
88
|
+
(step: DefaultStep, i: number, steps: Step[]) => {
|
|
65
89
|
const isLastStep = steps.length - 1 === i;
|
|
66
90
|
const margin = size === 'normal' ? 'ml-[34px]' : 'ml-6';
|
|
67
91
|
const styleMap = STEPS_BLOCK_STYLE_MAPS[version];
|
|
@@ -106,7 +130,7 @@ const renderIconArea = (size: SizeVersion, version: BlockVersion) => (step: Step
|
|
|
106
130
|
className={`${iconAreaSize} ${styleMap.iconBackground} rounded-full z-10 mr-3 flex justify-center content-center`}
|
|
107
131
|
>
|
|
108
132
|
<span className={`font-medium flex self-center ${iconTextSize}`}>
|
|
109
|
-
{
|
|
133
|
+
{checkCanRenderIcon(step?.icon) ? (
|
|
110
134
|
<Img
|
|
111
135
|
image={getIconWithVersion({ ...step.icon }, version)}
|
|
112
136
|
width={iconSize}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
+
import type { DefaultListItemType } from '../../model/DefaultListItemType';
|
|
2
3
|
import type { DescriptionProps, HeadlineCommonProps, LabelProps } from '../../model/HeadlineType';
|
|
3
4
|
import type { IconProps } from '../../model/Picture';
|
|
5
|
+
import type { RichTextItem } from '../../model/RichTextItem';
|
|
4
6
|
import type { SizeVersion } from '../../model/SizeVersion';
|
|
5
7
|
import type { ButtonWithIconProps } from '../../ui-kit/Button/ButtonProps';
|
|
6
8
|
|
|
@@ -16,10 +18,20 @@ type StepCommonProps = IconProps & {
|
|
|
16
18
|
items?: string[];
|
|
17
19
|
};
|
|
18
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @title Стандартный
|
|
23
|
+
*/
|
|
24
|
+
export type DefaultStep = DescriptionProps & LabelProps & StepCommonProps & DefaultListItemType;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @title Форматированный текст
|
|
28
|
+
*/
|
|
29
|
+
type RichTextStep = RichTextItem & IconProps;
|
|
30
|
+
|
|
19
31
|
/**
|
|
20
32
|
* @title Шаг
|
|
21
33
|
*/
|
|
22
|
-
export type Step =
|
|
34
|
+
export type Step = DefaultStep | RichTextStep;
|
|
23
35
|
|
|
24
36
|
/**
|
|
25
37
|
* @title Блок шаги
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
+
import type { ButtonVersion } from '../../model/ButtonVersion';
|
|
3
|
+
import type { VNode } from '../../model/VNode';
|
|
4
|
+
import { Button } from '../../ui-kit/Button/Button';
|
|
5
|
+
import { List } from '../../ui-kit/List/List';
|
|
6
|
+
import { RichText } from '../../ui-kit/RichText/RichText';
|
|
7
|
+
import { Text } from '../../ui-kit/Text/Text';
|
|
8
|
+
import { assertUnreachable } from '../../utils/assertUnreachable';
|
|
9
|
+
import { style } from '../../utils/style';
|
|
10
|
+
import type { DefaultStep, Step } from './StepsBlockContent';
|
|
11
|
+
import type { StyleType } from './StepsBlockStyleMaps';
|
|
12
|
+
|
|
13
|
+
interface RenderStepProps {
|
|
14
|
+
styleMap: StyleType;
|
|
15
|
+
isMainButton: boolean;
|
|
16
|
+
version?: BlockVersion;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// TODO: Create universal function for this case
|
|
20
|
+
export const renderStep =
|
|
21
|
+
(props: RenderStepProps) =>
|
|
22
|
+
// Linter doesn't understand that switch processes all cases
|
|
23
|
+
// eslint-disable-next-line consistent-return
|
|
24
|
+
(step: Step, i: number, arr: Step[]): VNode => {
|
|
25
|
+
const { type } = step;
|
|
26
|
+
|
|
27
|
+
if (!(type === 'default' || type === 'rte')) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
switch (type) {
|
|
32
|
+
case 'default':
|
|
33
|
+
return renderDefaultStep(props)(step, i, arr);
|
|
34
|
+
case 'rte':
|
|
35
|
+
return <RichText __html={step.__html} />;
|
|
36
|
+
default:
|
|
37
|
+
assertUnreachable(step);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const renderDefaultStep =
|
|
42
|
+
({ styleMap, isMainButton, version }: RenderStepProps) =>
|
|
43
|
+
(step: DefaultStep, i: number, arr: Step[]) => {
|
|
44
|
+
const { label, description, button, items, isDotted } = step;
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<div
|
|
48
|
+
key={String(i)}
|
|
49
|
+
className={style(
|
|
50
|
+
'relative flex flex-col items-center text-center whitespace-pre-line overflow-hidden',
|
|
51
|
+
getContainerWidth(arr.length),
|
|
52
|
+
)}
|
|
53
|
+
>
|
|
54
|
+
<div className={style(button?.text ? 'mb-8' : '', 'text-center')}>
|
|
55
|
+
{label ? (
|
|
56
|
+
<div className="mb-2">
|
|
57
|
+
<Text size="text-h6">{label}</Text>
|
|
58
|
+
</div>
|
|
59
|
+
) : null}
|
|
60
|
+
<div className="flex flex-col items-center">
|
|
61
|
+
{description ? <div className={styleMap.description}>{description}</div> : null}
|
|
62
|
+
<List
|
|
63
|
+
className={style(description ? `${styleMap.description} mt-0.5` : 'text-h6')}
|
|
64
|
+
items={items}
|
|
65
|
+
listItemSize="M"
|
|
66
|
+
isDotted={isDotted}
|
|
67
|
+
/>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
{button?.text && !isMainButton ? (
|
|
71
|
+
<Button
|
|
72
|
+
className="box-border py-3 h-12 w-full max-w-[240px] mt-auto"
|
|
73
|
+
version={version as ButtonVersion}
|
|
74
|
+
{...button}
|
|
75
|
+
>
|
|
76
|
+
{button?.text}
|
|
77
|
+
</Button>
|
|
78
|
+
) : null}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const getContainerWidth = (length: number): string => (length < 5 ? 'w-[276px]' : 'w-[210px]');
|
|
@@ -5,7 +5,7 @@ import { renderButtonsSection } from '../../ui-kit/Button/renderButtonsSection';
|
|
|
5
5
|
import { Heading } from '../../ui-kit/Heading/Heading';
|
|
6
6
|
import { Img } from '../../ui-kit/Img/Img';
|
|
7
7
|
import { List } from '../../ui-kit/List/List';
|
|
8
|
-
import {
|
|
8
|
+
import { RichText } from '../../ui-kit/RichText/RichText';
|
|
9
9
|
import { Tags } from '../../ui-kit/Tags/Tags';
|
|
10
10
|
import { BaseTile } from '../BaseTile/BaseTile';
|
|
11
11
|
import { getTileMinHeight } from '../BaseTile/getTileMinHeight';
|
|
@@ -18,7 +18,7 @@ export const Tile = JSX<TileProps>(
|
|
|
18
18
|
({
|
|
19
19
|
title,
|
|
20
20
|
headingType = 'h3',
|
|
21
|
-
|
|
21
|
+
__html,
|
|
22
22
|
items,
|
|
23
23
|
buttons,
|
|
24
24
|
image,
|
|
@@ -52,9 +52,9 @@ export const Tile = JSX<TileProps>(
|
|
|
52
52
|
})}
|
|
53
53
|
image={image?.src ? <Img className="mt-auto ml-7" image={image} /> : null}
|
|
54
54
|
>
|
|
55
|
-
{
|
|
55
|
+
{__html ? (
|
|
56
56
|
<div className="max-w-[600px] mt-2.5">
|
|
57
|
-
<
|
|
57
|
+
<RichText __html={__html} />
|
|
58
58
|
</div>
|
|
59
59
|
) : null}
|
|
60
60
|
{children}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { BlockVersion } from '../../model/BlockVersion';
|
|
2
|
-
import type { DescriptionProps } from '../../model/HeadlineType';
|
|
3
2
|
import type { Picture } from '../../model/Picture';
|
|
4
3
|
import type { ButtonContent } from '../../ui-kit/Button/ButtonProps';
|
|
5
4
|
import type { HeadingCommonProps } from '../../ui-kit/Heading/HeadingProps';
|
|
6
5
|
import type { ListContent } from '../../ui-kit/List/ListContent';
|
|
7
6
|
import type { ListItemSize } from '../../ui-kit/List/ListProps';
|
|
7
|
+
import type { RichTextProps } from '../../ui-kit/RichText/RichTextProps';
|
|
8
8
|
import type { TagsContent } from '../../ui-kit/Tags/TagsContent';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @title Плитка
|
|
12
12
|
*/
|
|
13
13
|
export type TileContent = HeadingCommonProps &
|
|
14
|
-
|
|
14
|
+
RichTextProps &
|
|
15
15
|
ListContent &
|
|
16
16
|
ButtonContent &
|
|
17
17
|
TagsContent & {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { LinkProps } from '../model/LinkProps';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { isHash, isLocalURL, joinPath } from '../utils/url';
|
|
2
|
+
import { adjustHref } from '../utils/adjustHref';
|
|
3
|
+
import { isLocalURL } from '../utils/url';
|
|
5
4
|
import { handlerDecorator } from './handlerDecorator';
|
|
6
5
|
import { useRouter } from './useRouter';
|
|
7
6
|
|
|
@@ -18,35 +17,23 @@ export function useLink(isRemote?: boolean) {
|
|
|
18
17
|
|
|
19
18
|
return <L extends Partial<LinkProps & Clickable>>(props: L): L & Clickable => ({
|
|
20
19
|
...props,
|
|
21
|
-
href: adjustHref(props.href),
|
|
20
|
+
href: isRemote ? props.href : adjustHref(router)(props.href),
|
|
22
21
|
'aria-label': props.text,
|
|
23
22
|
onClick: handlerDecorator(handleHref(props), props),
|
|
24
23
|
});
|
|
25
24
|
|
|
26
|
-
function adjustHref(href: string | undefined) {
|
|
27
|
-
const isRelativeToBase = !isRemote && href?.startsWith('/');
|
|
28
|
-
|
|
29
|
-
return projectSettings.BASE_PATH && href && isRelativeToBase
|
|
30
|
-
? joinPath(projectSettings.BASE_PATH, href)
|
|
31
|
-
: href;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
25
|
function handleHref({ href, target, onClick }: Partial<LinkProps & Clickable>) {
|
|
35
26
|
return (ev?: PreventableEvent) => {
|
|
36
27
|
onClick && onClick(ev);
|
|
37
28
|
|
|
38
|
-
if (isRemote || !isLocalURL(href, target)) {
|
|
29
|
+
if (!href || isRemote || !isLocalURL(href, target)) {
|
|
39
30
|
// Default routing
|
|
40
31
|
return;
|
|
41
32
|
}
|
|
42
33
|
|
|
43
34
|
// Client routing
|
|
44
35
|
ev?.preventDefault();
|
|
45
|
-
|
|
46
|
-
gotoBlock(router, href);
|
|
47
|
-
} else if (href) {
|
|
48
|
-
router.push(href);
|
|
49
|
-
}
|
|
36
|
+
router.push(href);
|
|
50
37
|
};
|
|
51
38
|
}
|
|
52
39
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import type { Router } from '../../hooks/useRouter';
|
|
2
1
|
import type { BlockDef } from '../../model/ContentPageDef';
|
|
3
2
|
|
|
4
3
|
const normalizeAnchor = (anchor?: string) => anchor?.replace('#', '') || '';
|
|
5
4
|
|
|
6
|
-
export function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
scroll: false,
|
|
13
|
-
});
|
|
5
|
+
export function trackBlock(block?: BlockDef) {
|
|
6
|
+
globalThis.history?.replaceState(
|
|
7
|
+
globalThis.history?.state,
|
|
8
|
+
'',
|
|
9
|
+
`#${normalizeAnchor(block?.anchor)}`,
|
|
10
|
+
);
|
|
14
11
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
|
|
2
|
-
import { useRouter } from '../../hooks/useRouter';
|
|
3
2
|
import type { BlockDef } from '../../model/ContentPageDef';
|
|
4
3
|
import { debounce } from '../../utils/debounce';
|
|
5
4
|
import { trackBlock } from './BlockRouter';
|
|
@@ -9,8 +8,6 @@ import { findActiveBlock } from './findActiveBlock';
|
|
|
9
8
|
const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
|
|
10
9
|
|
|
11
10
|
export function useBlockRouterProvider(scrollTarget: EventTarget = globalThis) {
|
|
12
|
-
const router = useRouter();
|
|
13
|
-
|
|
14
11
|
const intersectionsMapRef = useRef<Map<BlockDef, IntersectionObserverEntry>>(new Map());
|
|
15
12
|
|
|
16
13
|
useEffect(
|
|
@@ -25,12 +22,9 @@ export function useBlockRouterProvider(scrollTarget: EventTarget = globalThis) {
|
|
|
25
22
|
|
|
26
23
|
useEffect(() => {
|
|
27
24
|
const handleScroll = debounce(() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} else {
|
|
32
|
-
trackBlock(router);
|
|
33
|
-
}
|
|
25
|
+
trackBlock(
|
|
26
|
+
isScrolledEnough() ? findActiveBlock([...(intersectionsMapRef.current || [])]) : undefined,
|
|
27
|
+
);
|
|
34
28
|
}, 100);
|
|
35
29
|
|
|
36
30
|
scrollTarget.addEventListener('scroll', handleScroll);
|
|
@@ -39,5 +33,5 @@ export function useBlockRouterProvider(scrollTarget: EventTarget = globalThis) {
|
|
|
39
33
|
handleScroll.dispose();
|
|
40
34
|
scrollTarget.removeEventListener('scroll', handleScroll);
|
|
41
35
|
};
|
|
42
|
-
}, [
|
|
36
|
+
}, [scrollTarget]);
|
|
43
37
|
}
|
|
@@ -3,13 +3,14 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import { handlerDecorator } from './hooks/handlerDecorator';
|
|
4
4
|
import { useRouter } from './hooks/useRouter';
|
|
5
5
|
import { projectSettings } from './ProjectSettings';
|
|
6
|
+
import { joinPath } from './utils/url';
|
|
6
7
|
import wlc from './wlc.json';
|
|
7
8
|
|
|
8
9
|
projectSettings.setup(wlc);
|
|
9
10
|
|
|
10
11
|
useRouter.setup(() => {
|
|
11
12
|
const [href, setHref] = useState<string>(
|
|
12
|
-
|
|
13
|
+
joinPath(globalThis.location.origin, projectSettings.BASE_PATH, 'cards-credit'),
|
|
13
14
|
);
|
|
14
15
|
|
|
15
16
|
useEffect(() => {
|
|
@@ -26,9 +27,9 @@ useRouter.setup(() => {
|
|
|
26
27
|
|
|
27
28
|
return {
|
|
28
29
|
href,
|
|
29
|
-
pathname:
|
|
30
|
-
?
|
|
31
|
-
|
|
30
|
+
pathname: new URL(href).pathname.substring(
|
|
31
|
+
projectSettings.BASE_PATH ? projectSettings.BASE_PATH.length - 1 : 0,
|
|
32
|
+
),
|
|
32
33
|
query: {},
|
|
33
34
|
push: (url: string) => {
|
|
34
35
|
globalThis.history.pushState(null, '', url);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { useRouter } from '../../hooks/useRouter';
|
|
2
3
|
import type { IconVersion } from '../../model/IconVersion';
|
|
3
4
|
import { projectSettings } from '../../ProjectSettings';
|
|
5
|
+
import { adjustHref } from '../../utils/adjustHref';
|
|
4
6
|
import { style } from '../../utils/style';
|
|
7
|
+
import { joinPath } from '../../utils/url';
|
|
5
8
|
import type { IconProps } from './IconProps';
|
|
6
9
|
|
|
7
10
|
const svgUseStyleMap: Record<IconVersion, string> = {
|
|
@@ -22,7 +25,8 @@ export const Icon = JSX<IconProps>(
|
|
|
22
25
|
asSVG,
|
|
23
26
|
...imgProps
|
|
24
27
|
}) => {
|
|
25
|
-
const
|
|
28
|
+
const router = useRouter();
|
|
29
|
+
const href = adjustHref(router)(joinPath(projectSettings.CDN, '/icons', `${name}.svg`));
|
|
26
30
|
|
|
27
31
|
if (asSVG && iconVersion !== 'normal') {
|
|
28
32
|
return (
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { JSX } from '@redneckz/uni-jsx';
|
|
2
|
+
import { Router, useRouter } from '../../hooks/useRouter';
|
|
2
3
|
import type { ImgSource, Picture } from '../../model/Picture';
|
|
4
|
+
import { adjustHref } from '../../utils/adjustHref';
|
|
5
|
+
import { isURL, joinPath } from '../../utils/url';
|
|
3
6
|
import type { ImageProps } from './ImgProps';
|
|
4
7
|
|
|
5
|
-
const sourcesComparator = (a: Picture, b: Picture) =>
|
|
6
|
-
|
|
7
|
-
return a.media - b.media;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return 0;
|
|
11
|
-
};
|
|
8
|
+
const sourcesComparator = (a: Picture, b: Picture) =>
|
|
9
|
+
a?.media && b?.media ? a.media - b.media : 0;
|
|
12
10
|
|
|
13
11
|
export const ImgAsPicture = JSX<ImageProps>(
|
|
14
12
|
({ className = '', image, imageClassName = '', isMobile = false, pathPrefix }) => {
|
|
15
|
-
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
13
|
+
const router = useRouter();
|
|
18
14
|
|
|
19
15
|
const pictureStyles = isMobile ? 'flex' : 'flex-none';
|
|
20
16
|
|
|
@@ -22,22 +18,25 @@ export const ImgAsPicture = JSX<ImageProps>(
|
|
|
22
18
|
<picture className={`${pictureStyles} ${className}`}>
|
|
23
19
|
{image?.sources?.length
|
|
24
20
|
? image.sources
|
|
21
|
+
.filter((_) => _?.src)
|
|
25
22
|
.sort(sourcesComparator)
|
|
26
23
|
.map(({ src, format, media }, index) => (
|
|
27
24
|
<source
|
|
28
25
|
key={`${index}_${src}`}
|
|
29
|
-
srcSet={
|
|
26
|
+
srcSet={adjustSrcset(router, pathPrefix)(src)}
|
|
30
27
|
type={formatToMimeType(format)}
|
|
31
28
|
media={media ? `(max-width: ${media}px)` : ''}
|
|
32
29
|
{...image.size}
|
|
33
30
|
/>
|
|
34
31
|
))
|
|
35
32
|
: null}
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
{image?.src
|
|
34
|
+
? renderImg(
|
|
35
|
+
{ ...image, src: adjustSrcset(router, pathPrefix)(image.src) },
|
|
36
|
+
imageClassName,
|
|
37
|
+
isMobile,
|
|
38
|
+
)
|
|
39
|
+
: null}
|
|
41
40
|
</picture>
|
|
42
41
|
);
|
|
43
42
|
},
|
|
@@ -65,18 +64,14 @@ const renderImg = (image: Picture, imageClassName = '', isMobile = false) => {
|
|
|
65
64
|
);
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
const
|
|
69
|
-
pathPrefix && !pathPrefix.endsWith('/') ? `${pathPrefix}/` : pathPrefix;
|
|
70
|
-
|
|
71
|
-
const addPathPrefixToSrc = (src?: string, pathPrefix?: string) =>
|
|
72
|
-
!src || src?.startsWith('data:image') ? src : `${normalizePathPrefix(pathPrefix)}${src}`;
|
|
73
|
-
|
|
74
|
-
const addPathPrefixToSrcSet = (srcset?: string, pathPrefix?: string) =>
|
|
67
|
+
const adjustSrcset = (router: Router, pathPrefix?: string) => (srcset: string | undefined) =>
|
|
75
68
|
srcset
|
|
76
|
-
?.split(
|
|
77
|
-
.map((src) =>
|
|
69
|
+
?.split(/\s*,\s*/)
|
|
70
|
+
.map((src) => src.trim())
|
|
71
|
+
.filter(Boolean)
|
|
72
|
+
.map((src) => (isURL(src) ? src : joinPath(pathPrefix, src)))
|
|
73
|
+
.map(adjustHref(router))
|
|
78
74
|
.join(', ');
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
76
|
+
const formatToMimeType = (format: ImgSource['format']) =>
|
|
77
|
+
format ? `image/${String(format)}` : undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { projectSettings } from '../ProjectSettings';
|
|
2
|
+
import { dirname } from './dirname';
|
|
3
|
+
import { isURL, joinPath } from './url';
|
|
4
|
+
|
|
5
|
+
export const adjustHref = (router: { pathname: string }) => (href: string | undefined) => {
|
|
6
|
+
if (!href || isURL(href) || (projectSettings.CDN && href.startsWith(projectSettings.CDN))) {
|
|
7
|
+
return href;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const isRelativeToBase = href.startsWith('/');
|
|
11
|
+
|
|
12
|
+
return joinPath(
|
|
13
|
+
projectSettings.BASE_PATH,
|
|
14
|
+
isRelativeToBase ? '/' : dirname(router.pathname),
|
|
15
|
+
href,
|
|
16
|
+
);
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const dirname = (path: string | undefined) => path?.split('/').slice(0, -1).join('/');
|
package/mobile/src/utils/url.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Target } from '../model/LinkProps';
|
|
2
2
|
|
|
3
|
-
export const isURL = (href?: string): href is `${string}
|
|
4
|
-
Boolean(href?.includes('//'));
|
|
3
|
+
export const isURL = (href?: string): href is `${string}:${string}` => Boolean(href?.includes(':'));
|
|
5
4
|
|
|
6
5
|
export const isLocalURL = (href: string | undefined, target?: Target) =>
|
|
7
6
|
Boolean(href && !isURL(href) && (!target || target === '_self'));
|
|
@@ -11,5 +10,5 @@ export const isHash = (href?: string): href is `#${string}` => Boolean(href?.sta
|
|
|
11
10
|
export const withoutQuery = (href?: string): string =>
|
|
12
11
|
(href || '').replace(/\?.*/, '').replace(/\/$/, '');
|
|
13
12
|
|
|
14
|
-
export const joinPath = (...path: string[]): string =>
|
|
13
|
+
export const joinPath = (...path: (string | undefined)[]): string =>
|
|
15
14
|
path.filter(Boolean).join('/').replace(/\/+/g, '/');
|
package/mobile/src/wlc.json
CHANGED