@redneckz/wildless-cms-uni-blocks 0.14.28 → 0.14.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/migration-scripts/0.14.28.js +28 -0
- package/bin/migration-scripts/0.14.29.js +105 -0
- package/bin/migration-scripts/0.14.4.js +4 -4
- package/bin/utils.js +20 -9
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +41 -67
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +3 -2
- package/bundle/components/Headline/headlineVersionStyles.d.ts +1 -2
- package/bundle/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/bundle/model/HeadlineType.d.ts +0 -8
- package/dist/components/Blocks.js +0 -4
- package/dist/components/Blocks.js.map +1 -1
- package/dist/components/Blocks.mobile.js +0 -2
- package/dist/components/Blocks.mobile.js.map +1 -1
- package/dist/components/Carousel/Carousel.js +1 -1
- package/dist/components/Carousel/Carousel.js.map +1 -1
- package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +4 -2
- package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +3 -2
- package/dist/components/Footer/SocialMedia.js +2 -2
- package/dist/components/Footer/SocialMedia.js.map +1 -1
- package/dist/components/Headline/headlineVersionStyles.d.ts +1 -2
- package/dist/components/Headline/headlineVersionStyles.js +1 -12
- package/dist/components/Headline/headlineVersionStyles.js.map +1 -1
- package/dist/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/dist/model/HeadlineType.d.ts +0 -8
- package/dist/ui-kit/BaseTile/BaseTile.js +2 -2
- package/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
- package/dist/ui-kit/Button/renderButtonsSection.js +1 -1
- package/dist/ui-kit/List/List.js +1 -1
- package/dist/ui-kit/List/List.js.map +1 -1
- package/dist/ui-kit/List/ListItem.js +1 -1
- package/dist/ui-kit/List/ListItem.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/Blocks.js +0 -4
- package/lib/components/Blocks.js.map +1 -1
- package/lib/components/Blocks.mobile.js +0 -2
- package/lib/components/Blocks.mobile.js.map +1 -1
- package/lib/components/Carousel/Carousel.fixture.d.ts +0 -2
- package/lib/components/Carousel/Carousel.fixture.mobile.d.ts +0 -2
- package/lib/components/Carousel/Carousel.js +1 -1
- package/lib/components/Carousel/Carousel.js.map +1 -1
- package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.d.ts +2 -0
- package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +4 -2
- package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +3 -2
- package/lib/components/Footer/SocialMedia.js +2 -2
- package/lib/components/Footer/SocialMedia.js.map +1 -1
- package/lib/components/Headline/headlineVersionStyles.d.ts +1 -2
- package/lib/components/Headline/headlineVersionStyles.js +0 -11
- package/lib/components/Headline/headlineVersionStyles.js.map +1 -1
- package/lib/components/RichTextBlock/RichTextBlock.fixture.d.ts +1 -0
- package/lib/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/lib/model/HeadlineType.d.ts +0 -8
- package/lib/ui-kit/BaseTile/BaseTile.js +2 -2
- package/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
- package/lib/ui-kit/Button/renderButtonsSection.js +1 -1
- package/lib/ui-kit/List/List.js +1 -1
- package/lib/ui-kit/List/List.js.map +1 -1
- package/lib/ui-kit/List/ListItem.js +1 -1
- package/lib/ui-kit/List/ListItem.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +41 -64
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +3 -2
- package/mobile/bundle/components/Headline/headlineVersionStyles.d.ts +1 -2
- package/mobile/bundle/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/mobile/bundle/model/HeadlineType.d.ts +0 -8
- package/mobile/dist/components/Blocks.js +0 -2
- package/mobile/dist/components/Blocks.js.map +1 -1
- package/mobile/dist/components/Carousel/Carousel.js +1 -1
- package/mobile/dist/components/Carousel/Carousel.js.map +1 -1
- package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +4 -2
- package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +3 -2
- package/mobile/dist/components/Footer/SocialMedia.js +2 -2
- package/mobile/dist/components/Footer/SocialMedia.js.map +1 -1
- package/mobile/dist/components/Headline/headlineVersionStyles.d.ts +1 -2
- package/mobile/dist/components/Headline/headlineVersionStyles.js +1 -12
- package/mobile/dist/components/Headline/headlineVersionStyles.js.map +1 -1
- package/mobile/dist/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/mobile/dist/model/HeadlineType.d.ts +0 -8
- package/mobile/dist/ui-kit/BaseTile/BaseTile.js +2 -2
- package/mobile/dist/ui-kit/BaseTile/BaseTile.js.map +1 -1
- package/mobile/dist/ui-kit/Button/renderButtonsSection.js +1 -1
- package/mobile/dist/ui-kit/List/List.js +1 -1
- package/mobile/dist/ui-kit/List/List.js.map +1 -1
- package/mobile/dist/ui-kit/List/ListItem.js +1 -1
- package/mobile/dist/ui-kit/List/ListItem.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/Blocks.js +0 -2
- package/mobile/lib/components/Blocks.js.map +1 -1
- package/mobile/lib/components/Carousel/Carousel.js +1 -1
- package/mobile/lib/components/Carousel/Carousel.js.map +1 -1
- package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +4 -2
- package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
- package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +3 -2
- package/mobile/lib/components/Footer/SocialMedia.js +2 -2
- package/mobile/lib/components/Footer/SocialMedia.js.map +1 -1
- package/mobile/lib/components/Headline/headlineVersionStyles.d.ts +1 -2
- package/mobile/lib/components/Headline/headlineVersionStyles.js +0 -11
- package/mobile/lib/components/Headline/headlineVersionStyles.js.map +1 -1
- package/mobile/lib/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
- package/mobile/lib/model/HeadlineType.d.ts +0 -8
- package/mobile/lib/ui-kit/BaseTile/BaseTile.js +2 -2
- package/mobile/lib/ui-kit/BaseTile/BaseTile.js.map +1 -1
- package/mobile/lib/ui-kit/Button/renderButtonsSection.js +1 -1
- package/mobile/lib/ui-kit/List/List.js +1 -1
- package/mobile/lib/ui-kit/List/List.js.map +1 -1
- package/mobile/lib/ui-kit/List/ListItem.js +1 -1
- package/mobile/lib/ui-kit/List/ListItem.js.map +1 -1
- package/mobile/src/components/Blocks.ts +0 -2
- package/mobile/src/components/Carousel/Carousel.tsx +1 -1
- package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +20 -2
- package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +8 -1
- package/mobile/src/components/Footer/SocialMedia.tsx +2 -2
- package/mobile/src/components/Headline/headlineVersionStyles.ts +1 -13
- package/mobile/src/components/RichTextBlock/RichTextBlockContent.ts +2 -1
- package/mobile/src/model/HeadlineType.ts +0 -10
- package/mobile/src/ui-kit/BaseTile/BaseTile.tsx +3 -3
- package/mobile/src/ui-kit/Button/renderButtonsSection.tsx +1 -1
- package/mobile/src/ui-kit/List/List.tsx +1 -1
- package/mobile/src/ui-kit/List/ListItem.tsx +15 -17
- package/package.json +1 -1
- package/src/components/Blocks.mobile.ts +0 -2
- package/src/components/Blocks.ts +0 -4
- package/src/components/Carousel/Carousel.fixture.mobile.tsx +0 -34
- package/src/components/Carousel/Carousel.fixture.tsx +2 -52
- package/src/components/Carousel/Carousel.tsx +1 -1
- package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.tsx +44 -0
- package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +20 -2
- package/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +8 -1
- package/src/components/Footer/SocialMedia.tsx +2 -2
- package/src/components/Headline/headlineVersionStyles.ts +1 -13
- package/src/components/RichTextBlock/RichTextBlock.fixture.tsx +15 -0
- package/src/components/RichTextBlock/RichTextBlockContent.ts +2 -1
- package/src/components/VerticalLayout/VerticalLayout.fixture.tsx +4 -12
- package/src/model/HeadlineType.ts +0 -10
- package/src/ui-kit/BaseTile/BaseTile.tsx +3 -3
- package/src/ui-kit/Button/renderButtonsSection.tsx +1 -1
- package/src/ui-kit/List/List.tsx +1 -1
- package/src/ui-kit/List/ListItem.tsx +15 -17
- package/bin/migration-scripts/0.14.12.js +0 -34
- package/bundle/components/CarouselProductCard/CarouselProductCard.d.ts +0 -5
- package/bundle/components/CarouselProductCard/CarouselProductCardContent.d.ts +0 -27
- package/bundle/components/CarouselRichTextCard/CarouselRichTextCard.d.ts +0 -5
- package/bundle/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +0 -6
- package/dist/components/CarouselProductCard/CarouselProductCard.d.ts +0 -5
- package/dist/components/CarouselProductCard/CarouselProductCard.js +0 -26
- package/dist/components/CarouselProductCard/CarouselProductCard.js.map +0 -1
- package/dist/components/CarouselProductCard/CarouselProductCardContent.d.ts +0 -27
- package/dist/components/CarouselProductCard/CarouselProductCardContent.js +0 -2
- package/dist/components/CarouselProductCard/CarouselProductCardContent.js.map +0 -1
- package/dist/components/CarouselRichTextCard/CarouselRichTextCard.d.ts +0 -5
- package/dist/components/CarouselRichTextCard/CarouselRichTextCard.js +0 -8
- package/dist/components/CarouselRichTextCard/CarouselRichTextCard.js.map +0 -1
- package/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +0 -6
- package/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.js +0 -2
- package/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.js.map +0 -1
- package/lib/components/CarouselProductCard/CarouselProductCard.d.ts +0 -5
- package/lib/components/CarouselProductCard/CarouselProductCard.fixture.d.ts +0 -13
- package/lib/components/CarouselProductCard/CarouselProductCard.fixture.mobile.d.ts +0 -13
- package/lib/components/CarouselProductCard/CarouselProductCard.js +0 -24
- package/lib/components/CarouselProductCard/CarouselProductCard.js.map +0 -1
- package/lib/components/CarouselProductCard/CarouselProductCardContent.d.ts +0 -27
- package/lib/components/CarouselProductCard/CarouselProductCardContent.js +0 -2
- package/lib/components/CarouselProductCard/CarouselProductCardContent.js.map +0 -1
- package/lib/components/CarouselRichTextCard/CarouselRichTextCard.d.ts +0 -5
- package/lib/components/CarouselRichTextCard/CarouselRichTextCard.fixture.d.ts +0 -8
- package/lib/components/CarouselRichTextCard/CarouselRichTextCard.js +0 -6
- package/lib/components/CarouselRichTextCard/CarouselRichTextCard.js.map +0 -1
- package/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +0 -6
- package/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.js +0 -2
- package/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.js.map +0 -1
- package/mobile/bundle/components/CarouselProductCard/CarouselProductCard.d.ts +0 -5
- package/mobile/bundle/components/CarouselProductCard/CarouselProductCardContent.d.ts +0 -27
- package/mobile/bundle/components/CarouselRichTextCard/CarouselRichTextCard.d.ts +0 -5
- package/mobile/bundle/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +0 -6
- package/mobile/dist/components/CarouselProductCard/CarouselProductCard.d.ts +0 -5
- package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js +0 -26
- package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js.map +0 -1
- package/mobile/dist/components/CarouselProductCard/CarouselProductCardContent.d.ts +0 -27
- package/mobile/dist/components/CarouselProductCard/CarouselProductCardContent.js +0 -2
- package/mobile/dist/components/CarouselProductCard/CarouselProductCardContent.js.map +0 -1
- package/mobile/dist/components/CarouselRichTextCard/CarouselRichTextCard.d.ts +0 -5
- package/mobile/dist/components/CarouselRichTextCard/CarouselRichTextCard.js +0 -8
- package/mobile/dist/components/CarouselRichTextCard/CarouselRichTextCard.js.map +0 -1
- package/mobile/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +0 -6
- package/mobile/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.js +0 -2
- package/mobile/dist/components/CarouselRichTextCard/CarouselRichTextCardContent.js.map +0 -1
- package/mobile/lib/components/CarouselProductCard/CarouselProductCard.d.ts +0 -5
- package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js +0 -24
- package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js.map +0 -1
- package/mobile/lib/components/CarouselProductCard/CarouselProductCardContent.d.ts +0 -27
- package/mobile/lib/components/CarouselProductCard/CarouselProductCardContent.js +0 -2
- package/mobile/lib/components/CarouselProductCard/CarouselProductCardContent.js.map +0 -1
- package/mobile/lib/components/CarouselRichTextCard/CarouselRichTextCard.d.ts +0 -5
- package/mobile/lib/components/CarouselRichTextCard/CarouselRichTextCard.js +0 -6
- package/mobile/lib/components/CarouselRichTextCard/CarouselRichTextCard.js.map +0 -1
- package/mobile/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.d.ts +0 -6
- package/mobile/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.js +0 -2
- package/mobile/lib/components/CarouselRichTextCard/CarouselRichTextCardContent.js.map +0 -1
- package/mobile/src/components/CarouselProductCard/CarouselProductCard.example.json +0 -20
- package/mobile/src/components/CarouselProductCard/CarouselProductCard.tsx +0 -115
- package/mobile/src/components/CarouselProductCard/CarouselProductCard.ui.json +0 -21
- package/mobile/src/components/CarouselProductCard/CarouselProductCardContent.ts +0 -39
- package/mobile/src/components/CarouselRichTextCard/CarouselRichTextCard.example.json +0 -6
- package/mobile/src/components/CarouselRichTextCard/CarouselRichTextCard.tsx +0 -15
- package/mobile/src/components/CarouselRichTextCard/CarouselRichTextCard.ui.json +0 -7
- package/mobile/src/components/CarouselRichTextCard/CarouselRichTextCardContent.ts +0 -7
- package/src/components/CarouselProductCard/CarouselProductCard.example.json +0 -20
- package/src/components/CarouselProductCard/CarouselProductCard.fixture.mobile.tsx +0 -92
- package/src/components/CarouselProductCard/CarouselProductCard.fixture.tsx +0 -96
- package/src/components/CarouselProductCard/CarouselProductCard.tsx +0 -115
- package/src/components/CarouselProductCard/CarouselProductCard.ui.json +0 -21
- package/src/components/CarouselProductCard/CarouselProductCardContent.ts +0 -39
- package/src/components/CarouselRichTextCard/CarouselRichTextCard.example.json +0 -6
- package/src/components/CarouselRichTextCard/CarouselRichTextCard.fixture.tsx +0 -26
- package/src/components/CarouselRichTextCard/CarouselRichTextCard.tsx +0 -15
- package/src/components/CarouselRichTextCard/CarouselRichTextCard.ui.json +0 -7
- package/src/components/CarouselRichTextCard/CarouselRichTextCardContent.ts +0 -7
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const description = 'v0.14.28';
|
|
2
|
+
|
|
3
|
+
export default (uniPath, content) => {
|
|
4
|
+
if (!content?.blocks) {
|
|
5
|
+
return content;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
for (const block of content.blocks) {
|
|
9
|
+
adjustCarouselRichTextCardBlock(block);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return { ...content };
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
function adjustCarouselRichTextCardBlock(block) {
|
|
16
|
+
if (block.blocks) {
|
|
17
|
+
for (const childBlock of block.blocks) {
|
|
18
|
+
adjustCarouselRichTextCardBlock(childBlock);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (block.type === 'CarouselRichTextCard' && block?.content) {
|
|
22
|
+
block.content.richVersion = 'striped';
|
|
23
|
+
block.content.padding = 'p-xl';
|
|
24
|
+
}
|
|
25
|
+
if (block.type === 'CarouselRichTextCard') {
|
|
26
|
+
block.type = 'RichTextBlock';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { deleteEmptyProps, deleteProp, renameProp } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export const description = 'v0.14.29';
|
|
4
|
+
|
|
5
|
+
export default (uniPath, content) => {
|
|
6
|
+
if (!content?.blocks) {
|
|
7
|
+
return content;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
for (const block of content.blocks) {
|
|
11
|
+
adjustCarouselProductCardBlock(block);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return { ...content };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
function adjustCarouselProductCardBlock(block) {
|
|
18
|
+
if (block.blocks) {
|
|
19
|
+
for (const childBlock of block.blocks) {
|
|
20
|
+
adjustCarouselProductCardBlock(childBlock);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const content = block?.content;
|
|
25
|
+
|
|
26
|
+
if (!block?.content) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (block.type === 'CarouselProductCard' && content) {
|
|
31
|
+
block.content = deleteEmptyProps(content);
|
|
32
|
+
block.content = deleteEmptyButton(content);
|
|
33
|
+
|
|
34
|
+
const isHeadlineSmallVersion = 'headlineSmallVersion' in content;
|
|
35
|
+
const isXL =
|
|
36
|
+
content?.headlineSmallVersion === 'XL_L' ||
|
|
37
|
+
content?.headlineSmallVersion === 'XL_R' ||
|
|
38
|
+
content?.headlineSmallVersion === 'L_R';
|
|
39
|
+
adjustSocialMedia(content);
|
|
40
|
+
if (isHeadlineSmallVersion && isXL && content?.title) {
|
|
41
|
+
renameProp(content, 'title', 'description');
|
|
42
|
+
}
|
|
43
|
+
content.imageOptions = {
|
|
44
|
+
...content.imageOptions,
|
|
45
|
+
isImageAlwaysOnRight: false,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
if (content?.isTopPosition) {
|
|
49
|
+
content.imageOptions = {
|
|
50
|
+
...content.imageOptions,
|
|
51
|
+
directionRight: false,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (content?.items && content?.items?.length) {
|
|
55
|
+
content.items = content.items.map((_) => _?.text || _);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
deleteProp(content, 'headlineSmallVersion');
|
|
59
|
+
deleteProp(content, 'button');
|
|
60
|
+
deleteProp(content, 'isImageFullWidth');
|
|
61
|
+
deleteProp(content, 'isButtonFullWidth');
|
|
62
|
+
deleteProp(content, 'isTopPosition');
|
|
63
|
+
|
|
64
|
+
block.type = 'CarouselRecommendationCard';
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function adjustSocialMedia(content) {
|
|
69
|
+
const button = content?.button;
|
|
70
|
+
if (button?.text || button?.icon || button?.iconRight) {
|
|
71
|
+
content.socialMedia = [{ ...button }];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function clearIcon(obj, prop = 'icon') {
|
|
76
|
+
const iconObj = obj?.[prop];
|
|
77
|
+
|
|
78
|
+
if (!iconObj) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const isIconName = iconObj?.icon || iconObj?.src;
|
|
82
|
+
|
|
83
|
+
if (!isIconName) {
|
|
84
|
+
deleteProp(obj, prop);
|
|
85
|
+
}
|
|
86
|
+
if (prop === 'icon') {
|
|
87
|
+
clearIcon(obj, 'iconRight');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function deleteEmptyButton(obj) {
|
|
92
|
+
if (obj?.buttons && !obj?.buttons?.length) {
|
|
93
|
+
for (const arrButton of obj.buttons) {
|
|
94
|
+
deleteEmptyButton(arrButton);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const button = obj?.button;
|
|
98
|
+
clearIcon(button);
|
|
99
|
+
if (button?.text || button?.icon || button?.iconRight) {
|
|
100
|
+
return obj;
|
|
101
|
+
}
|
|
102
|
+
deleteProp(obj, 'button');
|
|
103
|
+
|
|
104
|
+
return obj;
|
|
105
|
+
}
|
|
@@ -22,16 +22,16 @@ function adjustBusinessDepositCalculator(block) {
|
|
|
22
22
|
if (block?.content && block?.type === 'Calculator') {
|
|
23
23
|
const businessDepositCalculatorsTabs = block.content.calculatorTabs.filter(
|
|
24
24
|
(_) =>
|
|
25
|
-
_.calculatorBlock
|
|
26
|
-
_.calculatorBlock
|
|
25
|
+
_.calculatorBlock?.calcType === 'BusinessDepositCalculatorForm' &&
|
|
26
|
+
_.calculatorBlock?.sourceBookDir,
|
|
27
27
|
);
|
|
28
|
-
|
|
28
|
+
for (let calculatorTab of businessDepositCalculatorsTabs) {
|
|
29
29
|
calculatorTab.calculatorBlock['rateParams'] = {
|
|
30
30
|
rateType: 'IP',
|
|
31
31
|
sourceBookDir: calculatorTab.calculatorBlock.sourceBookDir,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
Reflect.deleteProperty(calculatorTab.calculatorBlock, 'sourceBookDir');
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
}
|
|
37
37
|
}
|
package/bin/utils.js
CHANGED
|
@@ -7,18 +7,29 @@ export function renameProp(obj, oldKey, newKey) {
|
|
|
7
7
|
return obj;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function
|
|
11
|
-
|
|
12
|
-
const isEmpty = (_) => _ === null || _ === undefined || (isObj(_) && !Object.keys(_).length);
|
|
13
|
-
|
|
14
|
-
const emptyProps = Object.keys(obj).filter((key) => isEmpty(obj[key]));
|
|
15
|
-
for (const key in emptyProps) {
|
|
10
|
+
export function deleteProp(obj, key) {
|
|
11
|
+
if (key in obj) {
|
|
16
12
|
Reflect.deleteProperty(obj, key);
|
|
17
13
|
}
|
|
14
|
+
}
|
|
18
15
|
|
|
19
|
-
|
|
16
|
+
export function deleteEmptyProps(obj) {
|
|
17
|
+
if (Array.isArray(obj)) {
|
|
18
|
+
return obj.map(deleteEmptyProps).filter(isNotEmpty);
|
|
19
|
+
} else if (obj && typeof obj === 'object') {
|
|
20
|
+
const entries = Object.entries(obj)
|
|
21
|
+
.map(([k, v]) => [k, deleteEmptyProps(v)])
|
|
22
|
+
.filter(([, v]) => isNotEmpty(v));
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
return entries.reduce((acc, [k, v]) => Object.assign(acc, { [k]: v }), {});
|
|
25
|
+
} else {
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
|
|
24
|
-
|
|
30
|
+
const isNotEmpty = (_) =>
|
|
31
|
+
_ !== null &&
|
|
32
|
+
_ !== undefined &&
|
|
33
|
+
(!Array.isArray(_) || _.length > 0) &&
|
|
34
|
+
(typeof _ !== 'string' || _.length > 0) &&
|
|
35
|
+
(typeof _ !== 'object' || Object.keys(_).length > 0);
|