@redneckz/wildless-cms-uni-blocks 0.14.504 → 0.14.506

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/bin/migration-scripts/0.14.505.js +62 -0
  2. package/bin/utils.js +6 -0
  3. package/bundle/blocks.schema.json +1 -1
  4. package/bundle/bundle.umd.js +2 -2
  5. package/bundle/bundle.umd.min.js +1 -1
  6. package/bundle/ui-kit/BaseProductTile/BaseProductTileContent.d.ts +11 -4
  7. package/bundle/ui-kit/PriceList/PriceListProps.d.ts +1 -5
  8. package/dist/ui-kit/BaseProductTile/BaseProductTileContent.d.ts +11 -4
  9. package/dist/ui-kit/PriceList/PriceList.js +1 -1
  10. package/dist/ui-kit/PriceList/PriceList.js.map +1 -1
  11. package/dist/ui-kit/PriceList/PriceListProps.d.ts +1 -5
  12. package/lib/ui-kit/BaseProductTile/BaseProductTileContent.d.ts +11 -4
  13. package/lib/ui-kit/PriceList/PriceList.js +1 -1
  14. package/lib/ui-kit/PriceList/PriceList.js.map +1 -1
  15. package/lib/ui-kit/PriceList/PriceListProps.d.ts +1 -5
  16. package/mobile/bundle/bundle.umd.js +2 -2
  17. package/mobile/bundle/bundle.umd.min.js +1 -1
  18. package/mobile/bundle/ui-kit/BaseProductTile/BaseProductTileContent.d.ts +11 -4
  19. package/mobile/bundle/ui-kit/PriceList/PriceListProps.d.ts +1 -5
  20. package/mobile/dist/ui-kit/BaseProductTile/BaseProductTileContent.d.ts +11 -4
  21. package/mobile/dist/ui-kit/PriceList/PriceList.js +1 -1
  22. package/mobile/dist/ui-kit/PriceList/PriceList.js.map +1 -1
  23. package/mobile/dist/ui-kit/PriceList/PriceListProps.d.ts +1 -5
  24. package/mobile/lib/ui-kit/BaseProductTile/BaseProductTileContent.d.ts +11 -4
  25. package/mobile/lib/ui-kit/PriceList/PriceList.js +1 -1
  26. package/mobile/lib/ui-kit/PriceList/PriceList.js.map +1 -1
  27. package/mobile/lib/ui-kit/PriceList/PriceListProps.d.ts +1 -5
  28. package/mobile/src/components/Carousel/Carousel.example.json +0 -3
  29. package/mobile/src/components/VerticalLayout/VerticalLayout.example.json +1 -3
  30. package/mobile/src/ui-kit/BaseProductTile/BaseProductTileContent.ts +11 -4
  31. package/mobile/src/ui-kit/PriceList/PriceList.tsx +4 -3
  32. package/mobile/src/ui-kit/PriceList/PriceListProps.ts +1 -6
  33. package/package.json +1 -1
  34. package/src/components/Carousel/Carousel.example.json +0 -3
  35. package/src/components/VerticalLayout/VerticalLayout.example.json +1 -3
  36. package/src/components/VerticalLayout/VerticalLayout.fixture.tsx +0 -2
  37. package/src/ui-kit/BaseProductTile/BaseProductTileContent.ts +11 -4
  38. package/src/ui-kit/PriceList/PriceList.tsx +4 -3
  39. package/src/ui-kit/PriceList/PriceListProps.ts +1 -6
@@ -0,0 +1,62 @@
1
+ import { deleteEmptyArray, deleteEmptyProps, deleteProp, traversePageBlocks } from '../utils.js';
2
+
3
+ export const description = 'v0.14.505';
4
+
5
+ export default traversePageBlocks(adjustClearContent);
6
+
7
+ function adjustClearContent(block) {
8
+ const content = block?.content;
9
+
10
+ if (!content) {
11
+ return;
12
+ }
13
+
14
+ if ('isBlur' in content) {
15
+ Reflect.deleteProperty(content, 'isBlur');
16
+ }
17
+ if ('isCycle' in content) {
18
+ Reflect.deleteProperty(content, 'isCycle');
19
+ }
20
+ if ('isAlignCenter' in content) {
21
+ Reflect.deleteProperty(content, 'isAlignCenter');
22
+ }
23
+
24
+ if (!block?.mobile?.content) {
25
+ return;
26
+ }
27
+ const mobile = block.mobile;
28
+
29
+ if (mobile?.style?.length && block.style?.length) {
30
+ mobile.style = mobile?.style?.filter((_) => !block?.style.some((el) => el === _));
31
+ }
32
+
33
+ if (block?.style?.length) {
34
+ deleteEmptyArray(block);
35
+ }
36
+
37
+ mobile.content.imageOptions = clearMobileContent(
38
+ mobile?.content?.imageOptions,
39
+ content?.imageOptions,
40
+ );
41
+ mobile.content.image = clearMobileContent(mobile?.content?.image, content?.image);
42
+ mobile.content = clearMobileContent(mobile?.content, content);
43
+
44
+ block.mobile = deleteEmptyArray(mobile);
45
+ block.mobile.content = deleteEmptyArray(mobile.content);
46
+ block.mobile = deleteEmptyProps(mobile);
47
+ if (!Object.keys(block.mobile).length) {
48
+ deleteProp(block, 'mobile');
49
+ }
50
+ }
51
+
52
+ const clearMobileContent = (mobileContent, content) => {
53
+ if (typeof mobileContent === 'object') {
54
+ Object.entries(mobileContent).forEach(([key, val]) => {
55
+ if (typeof val !== 'object' && content?.[key] === val) {
56
+ Reflect.deleteProperty(mobileContent, key);
57
+ }
58
+ });
59
+ }
60
+
61
+ return mobileContent;
62
+ };
package/bin/utils.js CHANGED
@@ -98,3 +98,9 @@ export const traversePageBlocks =
98
98
 
99
99
  return { ...content };
100
100
  };
101
+
102
+ export const deleteEmptyArray = (content) => {
103
+ return Object.fromEntries(
104
+ Object.entries(content).filter(([, val]) => !Array.isArray(val) || val?.length),
105
+ );
106
+ };