@redneckz/wildless-cms-uni-blocks 0.4.7 → 0.5.0

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 (174) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +14 -14
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/BaseTile/BaseTile.js +1 -1
  5. package/dist/components/BaseTile/BaseTile.js.map +1 -1
  6. package/dist/components/Calculator/Calculator.js +1 -1
  7. package/dist/components/Calculator/Calculator.js.map +1 -1
  8. package/dist/components/ContentPage/filterBlocks.d.ts +11 -0
  9. package/dist/components/ContentPage/filterBlocks.js +7 -0
  10. package/dist/components/ContentPage/filterBlocks.js.map +1 -0
  11. package/dist/components/ContentPage/filterBlocks.mobile.d.ts +11 -0
  12. package/dist/components/ContentPage/filterBlocks.mobile.js +10 -0
  13. package/dist/components/ContentPage/filterBlocks.mobile.js.map +1 -0
  14. package/dist/components/ContentPage/isBlockInRegistry.d.ts +2 -1
  15. package/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
  16. package/dist/components/ContentPage/normalizePage.d.ts +28 -1
  17. package/dist/components/ContentPage/normalizePage.js +6 -11
  18. package/dist/components/ContentPage/normalizePage.js.map +1 -1
  19. package/dist/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
  20. package/dist/components/Footer/HorizontalNavigation.js +1 -1
  21. package/dist/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
  22. package/dist/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
  23. package/dist/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
  24. package/dist/components/Recommendation/RecommendationCard.js +1 -1
  25. package/dist/components/Recommendation/RecommendationCard.js.map +1 -1
  26. package/dist/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
  27. package/dist/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
  28. package/dist/ui-kit/Foldable/Foldable.js +2 -2
  29. package/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  30. package/dist/ui-kit/Input/Input.js +1 -1
  31. package/dist/ui-kit/Input/Input.js.map +1 -1
  32. package/dist/ui-kit/Logo/Logo.js +2 -2
  33. package/dist/ui-kit/Logo/Logo.js.map +1 -1
  34. package/dist/ui-kit/SearchBar/SearchBarInner.js +1 -1
  35. package/dist/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
  36. package/dist/ui-kit/Select/Select.js +1 -1
  37. package/dist/ui-kit/Select/Select.js.map +1 -1
  38. package/lib/common.css +1 -1
  39. package/lib/components/BaseTile/BaseTile.js +1 -1
  40. package/lib/components/BaseTile/BaseTile.js.map +1 -1
  41. package/lib/components/Calculator/Calculator.js +1 -1
  42. package/lib/components/Calculator/Calculator.js.map +1 -1
  43. package/lib/components/ContentPage/filterBlocks.d.ts +11 -0
  44. package/lib/components/ContentPage/filterBlocks.js +4 -0
  45. package/lib/components/ContentPage/filterBlocks.js.map +1 -0
  46. package/lib/components/ContentPage/filterBlocks.mobile.d.ts +11 -0
  47. package/lib/components/ContentPage/filterBlocks.mobile.js +7 -0
  48. package/lib/components/ContentPage/filterBlocks.mobile.js.map +1 -0
  49. package/lib/components/ContentPage/isBlockInRegistry.d.ts +2 -1
  50. package/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
  51. package/lib/components/ContentPage/normalizePage.d.ts +28 -1
  52. package/lib/components/ContentPage/normalizePage.js +6 -11
  53. package/lib/components/ContentPage/normalizePage.js.map +1 -1
  54. package/lib/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
  55. package/lib/components/Footer/HorizontalNavigation.js +1 -1
  56. package/lib/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
  57. package/lib/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
  58. package/lib/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
  59. package/lib/components/Recommendation/RecommendationCard.js +1 -1
  60. package/lib/components/Recommendation/RecommendationCard.js.map +1 -1
  61. package/lib/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
  62. package/lib/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
  63. package/lib/ui-kit/Foldable/Foldable.js +2 -2
  64. package/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  65. package/lib/ui-kit/Input/Input.js +1 -1
  66. package/lib/ui-kit/Input/Input.js.map +1 -1
  67. package/lib/ui-kit/Logo/Logo.js +2 -2
  68. package/lib/ui-kit/Logo/Logo.js.map +1 -1
  69. package/lib/ui-kit/SearchBar/SearchBarInner.js +1 -1
  70. package/lib/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
  71. package/lib/ui-kit/Select/Select.js +1 -1
  72. package/lib/ui-kit/Select/Select.js.map +1 -1
  73. package/mobile/bundle/bundle.umd.js +4 -4
  74. package/mobile/bundle/bundle.umd.min.js +1 -1
  75. package/mobile/dist/components/BaseTile/BaseTile.js +1 -1
  76. package/mobile/dist/components/BaseTile/BaseTile.js.map +1 -1
  77. package/mobile/dist/components/Calculator/Calculator.js +1 -1
  78. package/mobile/dist/components/Calculator/Calculator.js.map +1 -1
  79. package/mobile/dist/components/ContentPage/filterBlocks.d.ts +3 -0
  80. package/mobile/dist/components/ContentPage/filterBlocks.js +10 -0
  81. package/mobile/dist/components/ContentPage/filterBlocks.js.map +1 -0
  82. package/mobile/dist/components/ContentPage/isBlockInRegistry.d.ts +2 -1
  83. package/mobile/dist/components/ContentPage/isBlockInRegistry.js.map +1 -1
  84. package/mobile/dist/components/ContentPage/normalizePage.d.ts +20 -1
  85. package/mobile/dist/components/ContentPage/normalizePage.js +6 -13
  86. package/mobile/dist/components/ContentPage/normalizePage.js.map +1 -1
  87. package/mobile/dist/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
  88. package/mobile/dist/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
  89. package/mobile/dist/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
  90. package/mobile/dist/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
  91. package/mobile/dist/components/Recommendation/RecommendationCard.js +1 -1
  92. package/mobile/dist/components/Recommendation/RecommendationCard.js.map +1 -1
  93. package/mobile/dist/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
  94. package/mobile/dist/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
  95. package/mobile/dist/ui-kit/Foldable/Foldable.js +2 -2
  96. package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  97. package/mobile/dist/ui-kit/Input/Input.js +1 -1
  98. package/mobile/dist/ui-kit/Input/Input.js.map +1 -1
  99. package/mobile/dist/ui-kit/SearchBar/SearchBarInner.js +1 -1
  100. package/mobile/dist/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
  101. package/mobile/dist/ui-kit/Select/Select.js +1 -1
  102. package/mobile/dist/ui-kit/Select/Select.js.map +1 -1
  103. package/mobile/lib/components/BaseTile/BaseTile.js +1 -1
  104. package/mobile/lib/components/BaseTile/BaseTile.js.map +1 -1
  105. package/mobile/lib/components/Calculator/Calculator.js +1 -1
  106. package/mobile/lib/components/Calculator/Calculator.js.map +1 -1
  107. package/mobile/lib/components/ContentPage/filterBlocks.d.ts +3 -0
  108. package/mobile/lib/components/ContentPage/filterBlocks.js +7 -0
  109. package/mobile/lib/components/ContentPage/filterBlocks.js.map +1 -0
  110. package/mobile/lib/components/ContentPage/isBlockInRegistry.d.ts +2 -1
  111. package/mobile/lib/components/ContentPage/isBlockInRegistry.js.map +1 -1
  112. package/mobile/lib/components/ContentPage/normalizePage.d.ts +20 -1
  113. package/mobile/lib/components/ContentPage/normalizePage.js +6 -13
  114. package/mobile/lib/components/ContentPage/normalizePage.js.map +1 -1
  115. package/mobile/lib/components/ErrorBlock/ErrorBlockContent.d.ts +2 -2
  116. package/mobile/lib/components/OfficeServicesBlock/OfficeServicesBlock.js +2 -2
  117. package/mobile/lib/components/OfficeServicesBlock/OfficeServicesBlock.js.map +1 -1
  118. package/mobile/lib/components/OfficeServicesBlock/OfficeServicesBlockContent.d.ts +2 -2
  119. package/mobile/lib/components/Recommendation/RecommendationCard.js +1 -1
  120. package/mobile/lib/components/Recommendation/RecommendationCard.js.map +1 -1
  121. package/mobile/lib/ui-kit/CurrencyInput/CurrencyInput.js +1 -1
  122. package/mobile/lib/ui-kit/CurrencyInput/CurrencyInput.js.map +1 -1
  123. package/mobile/lib/ui-kit/Foldable/Foldable.js +2 -2
  124. package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  125. package/mobile/lib/ui-kit/Input/Input.js +1 -1
  126. package/mobile/lib/ui-kit/Input/Input.js.map +1 -1
  127. package/mobile/lib/ui-kit/SearchBar/SearchBarInner.js +1 -1
  128. package/mobile/lib/ui-kit/SearchBar/SearchBarInner.js.map +1 -1
  129. package/mobile/lib/ui-kit/Select/Select.js +1 -1
  130. package/mobile/lib/ui-kit/Select/Select.js.map +1 -1
  131. package/mobile/src/components/BaseTile/BaseTile.tsx +2 -2
  132. package/mobile/src/components/Calculator/Calculator.tsx +1 -1
  133. package/mobile/src/components/ContentPage/filterBlocks.ts +13 -0
  134. package/mobile/src/components/ContentPage/isBlockInRegistry.ts +3 -1
  135. package/mobile/src/components/ContentPage/normalizePage.ts +25 -36
  136. package/mobile/src/components/ErrorBlock/ErrorBlockContent.ts +2 -2
  137. package/mobile/src/components/OfficeServicesBlock/OfficeServicesBlock.tsx +2 -2
  138. package/mobile/src/components/OfficeServicesBlock/OfficeServicesBlockContent.ts +2 -2
  139. package/mobile/src/components/Recommendation/RecommendationCard.tsx +18 -16
  140. package/mobile/src/components/__snapshots__/Blocks.spec.tsx.snap +24 -14
  141. package/mobile/src/ui-kit/CurrencyInput/CurrencyInput.tsx +1 -1
  142. package/mobile/src/ui-kit/Foldable/Foldable.tsx +11 -2
  143. package/mobile/src/ui-kit/Input/Input.tsx +1 -1
  144. package/mobile/src/ui-kit/SearchBar/SearchBarInner.tsx +1 -1
  145. package/mobile/src/ui-kit/Select/Select.tsx +1 -1
  146. package/package.json +1 -1
  147. package/src/components/BaseTile/BaseTile.tsx +2 -2
  148. package/src/components/Calculator/Calculator.tsx +1 -1
  149. package/src/components/ContentPage/ContentPage.fixture.mobile.tsx +1 -1
  150. package/src/components/ContentPage/ContentPage.fixture.tsx +2 -2
  151. package/src/components/ContentPage/filterBlocks.mobile.ts +13 -0
  152. package/src/components/ContentPage/filterBlocks.ts +7 -0
  153. package/src/components/ContentPage/isBlockInRegistry.ts +3 -1
  154. package/src/components/ContentPage/normalizePage.ts +25 -31
  155. package/src/components/ErrorBlock/ErrorBlockContent.ts +2 -2
  156. package/src/components/Footer/HorizontalNavigation.tsx +1 -1
  157. package/src/components/OfficeServicesBlock/OfficeServicesBlock.fixture.tsx +1 -1
  158. package/src/components/OfficeServicesBlock/OfficeServicesBlock.tsx +2 -2
  159. package/src/components/OfficeServicesBlock/OfficeServicesBlockContent.ts +2 -2
  160. package/src/components/Recommendation/RecommendationCard.tsx +18 -16
  161. package/src/components/__snapshots__/Blocks.spec.tsx.snap +24 -14
  162. package/src/ui-kit/CurrencyInput/CurrencyInput.tsx +1 -1
  163. package/src/ui-kit/Foldable/Foldable.tsx +11 -2
  164. package/src/ui-kit/Input/Input.tsx +1 -1
  165. package/src/ui-kit/Logo/Logo.tsx +2 -2
  166. package/src/ui-kit/SearchBar/SearchBarInner.tsx +1 -1
  167. package/src/ui-kit/Select/Select.tsx +1 -1
  168. package/dist/components/ContentPage/normalizePage.mobile.d.ts +0 -2
  169. package/dist/components/ContentPage/normalizePage.mobile.js +0 -30
  170. package/dist/components/ContentPage/normalizePage.mobile.js.map +0 -1
  171. package/lib/components/ContentPage/normalizePage.mobile.d.ts +0 -2
  172. package/lib/components/ContentPage/normalizePage.mobile.js +0 -27
  173. package/lib/components/ContentPage/normalizePage.mobile.js.map +0 -1
  174. package/src/components/ContentPage/normalizePage.mobile.ts +0 -40
@@ -45,7 +45,7 @@ export const Foldable = JSX<FoldableProps>(
45
45
 
46
46
  const buttonClassName =
47
47
  foldButtonClasses ||
48
- 'border-none bg-primary-main hover:bg-primary-hover px-0 py-[26px] mb-[1px] w-full font-sans text-white text-h4 flex justify-center cursor-pointer';
48
+ 'border-none bg-primary-main hover:bg-primary-hover px-0 py-5 mb-[1px] w-full font-sans text-white text-h4 flex justify-center cursor-pointer';
49
49
  const getFoldButtonLabel = isActive ? 'Скрыть' : foldButtonLabel;
50
50
 
51
51
  return blocks ? (
@@ -58,7 +58,16 @@ export const Foldable = JSX<FoldableProps>(
58
58
  onClick={handleToggle}
59
59
  >
60
60
  <span className="pr-3">{getFoldButtonLabel}</span>
61
- {icon ? <Icon name={icon} iconVersion="white" width="20" height="20" asSVG /> : null}
61
+ {icon ? (
62
+ <Icon
63
+ className="my-auto"
64
+ name={icon}
65
+ iconVersion="white"
66
+ width="20"
67
+ height="20"
68
+ asSVG
69
+ />
70
+ ) : null}
62
71
  </button>
63
72
  ) : null}
64
73
  </div>
@@ -10,7 +10,7 @@ export const Input = JSX<InputProps>(
10
10
 
11
11
  return (
12
12
  <input
13
- className={className}
13
+ className={`border-main-stroke hover:border-primary-hover active:border-primary-text focus:border-primary-text ${className}`}
14
14
  id={id}
15
15
  name={name || id}
16
16
  type={type}
@@ -25,7 +25,7 @@ const SVG_COLOR: Record<BgColorVersion, string> = {
25
25
  transparent: 'text-white',
26
26
  };
27
27
  const TEXT_COLOR: Record<BgColorVersion, string> = {
28
- 'bg-white': 'text-black',
28
+ 'bg-white': 'text-primary-text',
29
29
  transparent: 'text-white',
30
30
  };
31
31
 
@@ -66,5 +66,5 @@ export const Logo = JSX<Partial<LogoProps>>(
66
66
  const renderTitle = (children, bgColor, title) => {
67
67
  const text = children || title || 'Россельхозбанк';
68
68
 
69
- return <span className={`${TEXT_COLOR[bgColor]} font-light ml-2.5`}>{text}</span>;
69
+ return <span className={`${TEXT_COLOR[bgColor]} font-medium ml-2.5`}>{text}</span>;
70
70
  };
@@ -34,7 +34,7 @@ export const SearchBarInner = JSX<SearchBarInnerProps>(({ className, isMobile =
34
34
  <input
35
35
  id="search-bar-input"
36
36
  className={`h-12 pl-12 w-full peer text-l text-black border border-solid rounded-md box-border
37
- outline-none pr-[6%] border-main-divider focus:border-primary-text ${SearchBarInputClassName}`}
37
+ outline-none pr-[6%] border-main-stroke hover:border-primary-hover active:border-primary-text focus:border-primary-text ${SearchBarInputClassName}`}
38
38
  value={term}
39
39
  onChange={(e) => setTerm(e.target.value as string)}
40
40
  type="text"
@@ -22,7 +22,7 @@ export const Select = JSX<SelectProps>(
22
22
  name={name || id}
23
23
  value={value}
24
24
  onChange={(e) => onChange(e.target.value as string)}
25
- placeholder="12321321312"
25
+ placeholder=""
26
26
  >
27
27
  {children}
28
28
  </select>
@@ -1,2 +0,0 @@
1
- import type { ContentPageDef } from '../../types';
2
- export declare function normalizePage(contentPage: ContentPageDef | undefined | null): ContentPageDef | undefined;
@@ -1,30 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.normalizePage = void 0;
3
- const Blocks_1 = require("../Blocks");
4
- const isBlockInRegistry_1 = require("./isBlockInRegistry");
5
- const normalizeBlock_1 = require("./normalizeBlock");
6
- function normalizePage(contentPage) {
7
- if (!contentPage) {
8
- return undefined;
9
- }
10
- const { blocks, slots } = contentPage;
11
- return {
12
- ...contentPage,
13
- blocks: getMobileBlocks(blocks),
14
- slots: slots &&
15
- Object.keys(slots).reduce((res, key) => ({
16
- ...res,
17
- [key]: {
18
- ...slots[key],
19
- blocks: getMobileBlocks(slots[key].blocks),
20
- },
21
- }), {}),
22
- };
23
- }
24
- exports.normalizePage = normalizePage;
25
- function getMobileBlocks(blocks) {
26
- return blocks
27
- ?.filter((block) => (0, isBlockInRegistry_1.isBlockInRegistry)(block?.type || block?.mobile?.type, Blocks_1.Blocks) && !block.mobile?.hidden)
28
- .map(normalizeBlock_1.normalizeBlock);
29
- }
30
- //# sourceMappingURL=normalizePage.mobile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizePage.mobile.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.mobile.ts"],"names":[],"mappings":";;AACA,sCAAmC;AACnC,2DAAwD;AACxD,qDAAkD;AAElD,SAAgB,aAAa,CAC3B,WAA8C;IAE9C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAEtC,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;QAC/B,KAAK,EACH,KAAK;YACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CACvB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBACb,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE;oBACL,GAAG,KAAK,CAAC,GAAG,CAAC;oBACb,MAAM,EAAE,eAAe,CAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,CAAC;iBACrD;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC;AAzBD,sCAyBC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,OAAO,MAAM;QACX,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,IAAA,qCAAiB,EAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,eAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACzF;SACA,GAAG,CAAC,+BAAc,CAAC,CAAC;AACzB,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { ContentPageDef } from '../../types';
2
- export declare function normalizePage(contentPage: ContentPageDef | undefined | null): ContentPageDef | undefined;
@@ -1,27 +0,0 @@
1
- import { Blocks } from '../Blocks.js';
2
- import { isBlockInRegistry } from './isBlockInRegistry.js';
3
- import { normalizeBlock } from './normalizeBlock.js';
4
- export function normalizePage(contentPage) {
5
- if (!contentPage) {
6
- return undefined;
7
- }
8
- const { blocks, slots } = contentPage;
9
- return {
10
- ...contentPage,
11
- blocks: getMobileBlocks(blocks),
12
- slots: slots &&
13
- Object.keys(slots).reduce((res, key) => ({
14
- ...res,
15
- [key]: {
16
- ...slots[key],
17
- blocks: getMobileBlocks(slots[key].blocks),
18
- },
19
- }), {}),
20
- };
21
- }
22
- function getMobileBlocks(blocks) {
23
- return blocks
24
- ?.filter((block) => isBlockInRegistry(block?.type || block?.mobile?.type, Blocks) && !block.mobile?.hidden)
25
- .map(normalizeBlock);
26
- }
27
- //# sourceMappingURL=normalizePage.mobile.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalizePage.mobile.js","sourceRoot":"","sources":["../../../src/components/ContentPage/normalizePage.mobile.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,aAAa,CAC3B,WAA8C;IAE9C,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAEtC,OAAO;QACL,GAAG,WAAW;QACd,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC;QAC/B,KAAK,EACH,KAAK;YACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CACvB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;gBACb,GAAG,GAAG;gBACN,CAAC,GAAG,CAAC,EAAE;oBACL,GAAG,KAAK,CAAC,GAAG,CAAC;oBACb,MAAM,EAAE,eAAe,CAAE,KAAK,CAAC,GAAG,CAAU,CAAC,MAAM,CAAC;iBACrD;aACF,CAAC,EACF,EAAE,CACH;KACJ,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,OAAO,MAAM;QACX,EAAE,MAAM,CACN,CAAC,KAAK,EAAE,EAAE,CACR,iBAAiB,CAAC,KAAK,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CACzF;SACA,GAAG,CAAC,cAAc,CAAC,CAAC;AACzB,CAAC"}
@@ -1,40 +0,0 @@
1
- import type { BlockDef, ContentPageDef, Slot } from '../../types';
2
- import { Blocks } from '../Blocks';
3
- import { isBlockInRegistry } from './isBlockInRegistry';
4
- import { normalizeBlock } from './normalizeBlock';
5
-
6
- export function normalizePage(
7
- contentPage: ContentPageDef | undefined | null,
8
- ): ContentPageDef | undefined {
9
- if (!contentPage) {
10
- return undefined;
11
- }
12
-
13
- const { blocks, slots } = contentPage;
14
-
15
- return {
16
- ...contentPage,
17
- blocks: getMobileBlocks(blocks),
18
- slots:
19
- slots &&
20
- Object.keys(slots).reduce(
21
- (res, key) => ({
22
- ...res,
23
- [key]: {
24
- ...slots[key],
25
- blocks: getMobileBlocks((slots[key] as Slot).blocks),
26
- },
27
- }),
28
- {},
29
- ),
30
- };
31
- }
32
-
33
- function getMobileBlocks(blocks?: BlockDef[]) {
34
- return blocks
35
- ?.filter(
36
- (block) =>
37
- isBlockInRegistry(block?.type || block?.mobile?.type, Blocks) && !block.mobile?.hidden,
38
- )
39
- .map(normalizeBlock);
40
- }