@developer_tribe/react-builder 1.2.13 → 1.2.15

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 (161) hide show
  1. package/dist/build-components/BIcon/BIconProps.generated.d.ts +2 -0
  2. package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +2 -0
  3. package/dist/build-components/Button/ButtonProps.generated.d.ts +2 -0
  4. package/dist/build-components/Carousel/CarouselProps.generated.d.ts +2 -0
  5. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +2 -0
  6. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +2 -0
  7. package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +2 -0
  8. package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +2 -0
  9. package/dist/build-components/CountDown/CountDown.d.ts +2 -0
  10. package/dist/build-components/CountDown/CountDownProps.generated.d.ts +61 -0
  11. package/dist/build-components/CountDown/formatCountdownTime.d.ts +1 -0
  12. package/dist/build-components/Counter/Counter.d.ts +2 -0
  13. package/dist/build-components/Counter/CounterProps.generated.d.ts +61 -0
  14. package/dist/build-components/Image/ImageProps.generated.d.ts +2 -0
  15. package/dist/build-components/Main/MainProps.generated.d.ts +2 -0
  16. package/dist/build-components/Onboard/OnboardProps.generated.d.ts +2 -0
  17. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +2 -0
  18. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +2 -0
  19. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +2 -0
  20. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +2 -0
  21. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +2 -0
  22. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +2 -0
  23. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +2 -0
  24. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +2 -0
  25. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +2 -0
  26. package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +2 -0
  27. package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +2 -0
  28. package/dist/build-components/PaywallCounter/PaywallCounter.d.ts +2 -0
  29. package/dist/build-components/PaywallCounter/PaywallCounterProps.generated.d.ts +61 -0
  30. package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +2 -0
  31. package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +2 -0
  32. package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +2 -0
  33. package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +2 -0
  34. package/dist/build-components/Text/TextProps.generated.d.ts +2 -0
  35. package/dist/build-components/View/ViewProps.generated.d.ts +2 -0
  36. package/dist/build-components/index.d.ts +4 -1
  37. package/dist/build-components/patterns.generated.d.ts +2961 -1552
  38. package/dist/components/BuilderProvider.d.ts +0 -1
  39. package/dist/index.cjs.js +4 -4
  40. package/dist/index.cjs.js.map +1 -1
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.esm.js +4 -4
  43. package/dist/index.esm.js.map +1 -1
  44. package/dist/index.native.d.ts +7 -0
  45. package/dist/index.web.cjs.js +7 -5
  46. package/dist/index.web.cjs.js.map +1 -1
  47. package/dist/index.web.esm.js +7 -5
  48. package/dist/index.web.esm.js.map +1 -1
  49. package/dist/utils/getDefaultProject.d.ts +4 -0
  50. package/dist/utils/patterns.d.ts +3 -0
  51. package/package.json +2 -1
  52. package/scripts/prebuild/utils/createComponentTsx.js +1 -1
  53. package/scripts/prebuild/utils/createGeneratedProps.js +6 -2
  54. package/scripts/prebuild/utils/createRenderNodeGenerated.js +26 -5
  55. package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +17 -5
  56. package/scripts/prebuild/utils/validateExistingComponentTsx.js +12 -8
  57. package/src/AttributesEditor.tsx +7 -2
  58. package/src/RenderPage.tsx +34 -3
  59. package/src/assets/meta.json +1 -1
  60. package/src/assets/samples/carousel-sample.json +44 -14
  61. package/src/assets/samples/getSamples.ts +3 -1
  62. package/src/assets/samples/paywall-1.json +73 -29
  63. package/src/assets/samples/paywall-2.json +338 -0
  64. package/src/assets/samples/simple-1.json +9 -3
  65. package/src/assets/samples/simple-2.json +72 -24
  66. package/src/assets/samples/unmigrated-builder-1.1.1.json +19 -7
  67. package/src/assets/samples/unmigrated-builder1.json +10 -4
  68. package/src/assets/samples/unvalidated-builder1.json +10 -4
  69. package/src/assets/samples/unvalidated-crash1.json +3 -1
  70. package/src/assets/samples/unvalidated-crashcomponent1.json +3 -1
  71. package/src/assets/samples/vpn-onboard-1.json +88 -40
  72. package/src/assets/samples/vpn-onboard-2.json +85 -37
  73. package/src/assets/samples/vpn-onboard-3.json +93 -45
  74. package/src/assets/samples/vpn-onboard-4.json +93 -45
  75. package/src/assets/samples/vpn-onboard-5.json +121 -53
  76. package/src/assets/samples/vpn-onboard-6.json +93 -45
  77. package/src/attributes-editor/AttributesEditorView.tsx +39 -1
  78. package/src/attributes-editor/Field.tsx +30 -0
  79. package/src/build-components/BIcon/BIconProps.generated.ts +2 -0
  80. package/src/build-components/BIcon/pattern.json +2 -0
  81. package/src/build-components/BackgroundImage/BackgroundImage.tsx +0 -1
  82. package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +2 -0
  83. package/src/build-components/BackgroundImage/pattern.json +2 -0
  84. package/src/build-components/Button/ButtonProps.generated.ts +2 -0
  85. package/src/build-components/Button/pattern.json +2 -0
  86. package/src/build-components/Carousel/CarouselProps.generated.ts +2 -0
  87. package/src/build-components/Carousel/pattern.json +2 -0
  88. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +2 -0
  89. package/src/build-components/CarouselButtons/pattern.json +2 -0
  90. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +2 -0
  91. package/src/build-components/CarouselDots/pattern.json +2 -0
  92. package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +2 -0
  93. package/src/build-components/CarouselItem/pattern.json +4 -1
  94. package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +2 -0
  95. package/src/build-components/CarouselProvider/pattern.json +4 -1
  96. package/src/build-components/CountDown/CountDown.tsx +73 -0
  97. package/src/build-components/CountDown/CountDownProps.generated.ts +78 -0
  98. package/src/build-components/CountDown/formatCountdownTime.ts +10 -0
  99. package/src/build-components/CountDown/pattern.json +24 -0
  100. package/src/build-components/Counter/Counter.tsx +44 -0
  101. package/src/build-components/Counter/CounterProps.generated.ts +78 -0
  102. package/src/build-components/Counter/pattern.json +26 -0
  103. package/src/build-components/Image/ImageProps.generated.ts +2 -0
  104. package/src/build-components/Image/pattern.json +2 -0
  105. package/src/build-components/Main/MainProps.generated.ts +2 -0
  106. package/src/build-components/Main/pattern.json +2 -0
  107. package/src/build-components/Onboard/OnboardProps.generated.ts +2 -0
  108. package/src/build-components/Onboard/pattern.json +4 -1
  109. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +2 -0
  110. package/src/build-components/OnboardButton/pattern.json +2 -0
  111. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +2 -0
  112. package/src/build-components/OnboardButtons/pattern.json +2 -0
  113. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +2 -0
  114. package/src/build-components/OnboardDot/pattern.json +2 -0
  115. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +2 -0
  116. package/src/build-components/OnboardFooter/pattern.json +2 -0
  117. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +2 -0
  118. package/src/build-components/OnboardImage/pattern.json +2 -0
  119. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +2 -0
  120. package/src/build-components/OnboardItem/pattern.json +2 -0
  121. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +2 -0
  122. package/src/build-components/OnboardProvider/pattern.json +2 -0
  123. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +2 -0
  124. package/src/build-components/OnboardSubtitle/pattern.json +4 -1
  125. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +2 -0
  126. package/src/build-components/OnboardTitle/pattern.json +4 -1
  127. package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +2 -0
  128. package/src/build-components/PaywallBackground/pattern.json +4 -1
  129. package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +7 -5
  130. package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +2 -0
  131. package/src/build-components/PaywallCloseButton/pattern.json +4 -1
  132. package/src/build-components/PaywallCounter/PaywallCounter.tsx +49 -0
  133. package/src/build-components/PaywallCounter/PaywallCounterProps.generated.ts +78 -0
  134. package/src/build-components/PaywallCounter/pattern.json +24 -0
  135. package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +2 -0
  136. package/src/build-components/PaywallOptions/pattern.json +4 -1
  137. package/src/build-components/PaywallProvider/PaywallProvider.tsx +8 -16
  138. package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +2 -0
  139. package/src/build-components/PaywallProvider/pattern.json +4 -1
  140. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +2 -0
  141. package/src/build-components/PaywallSubscribeButton/pattern.json +4 -1
  142. package/src/build-components/RadioButton/RadioButtonProps.generated.ts +2 -0
  143. package/src/build-components/RadioButton/pattern.json +2 -0
  144. package/src/build-components/RenderNode.generated.tsx +17 -2
  145. package/src/build-components/Text/TextProps.generated.ts +2 -0
  146. package/src/build-components/Text/pattern.json +3 -1
  147. package/src/build-components/View/View.tsx +1 -1
  148. package/src/build-components/View/ViewProps.generated.ts +2 -0
  149. package/src/build-components/View/pattern.json +35 -38
  150. package/src/build-components/index.ts +15 -0
  151. package/src/build-components/patterns.generated.ts +3084 -1570
  152. package/src/components/BuilderButton.tsx +23 -6
  153. package/src/components/BuilderProvider.tsx +10 -7
  154. package/src/index.native.ts +7 -0
  155. package/src/index.ts +1 -0
  156. package/src/mockOS/context/MockOSContext.tsx +22 -8
  157. package/src/mockOS/managers/navigationManager.ts +4 -0
  158. package/src/pages/projectPageUtils.ts +3 -2
  159. package/src/utils/analyseNodeByPatterns.ts +21 -0
  160. package/src/utils/getDefaultProject.ts +34 -0
  161. package/src/utils/patterns.ts +6 -7
@@ -0,0 +1,78 @@
1
+ /* AUTO-GENERATED FILE - DO NOT EDIT */
2
+
3
+ import type { NodeData } from '../../types/Node';
4
+
5
+ export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
6
+ export type FlexDirectionOptionType = 'row' | 'column';
7
+ export type AlignItemsOptionType =
8
+ | 'flex-start'
9
+ | 'center'
10
+ | 'flex-end'
11
+ | 'stretch'
12
+ | 'baseline';
13
+ export type JustifyContentOptionType =
14
+ | 'flex-start'
15
+ | 'center'
16
+ | 'flex-end'
17
+ | 'space-between'
18
+ | 'space-around'
19
+ | 'space-evenly';
20
+ export type PositionOptionType = 'relative' | 'absolute';
21
+
22
+ export interface CountDownStyleGenerated {
23
+ color?: string;
24
+ fontSize?: string;
25
+ fontFamily?: string;
26
+ fontWeight?: string;
27
+ textAlign?: TextAlignOptionType;
28
+ flexDirection?: FlexDirectionOptionType;
29
+ alignItems?: AlignItemsOptionType;
30
+ justifyContent?: JustifyContentOptionType;
31
+ gap?: string;
32
+ padding?: string;
33
+ paddingHorizontal?: string;
34
+ paddingVertical?: string;
35
+ paddingTop?: string;
36
+ paddingBottom?: string;
37
+ paddingLeft?: string;
38
+ paddingRight?: string;
39
+ margin?: string;
40
+ marginHorizontal?: string;
41
+ marginVertical?: string;
42
+ marginTop?: string;
43
+ marginBottom?: string;
44
+ marginLeft?: string;
45
+ marginRight?: string;
46
+ backgroundColor?: string;
47
+ borderRadius?: string;
48
+ width?: string;
49
+ minWidth?: string;
50
+ maxWidth?: string;
51
+ height?: string;
52
+ minHeight?: string;
53
+ maxHeight?: string;
54
+ flex?: number;
55
+ position?: PositionOptionType;
56
+ top?: string;
57
+ bottom?: string;
58
+ left?: string;
59
+ right?: string;
60
+ zIndex?: number;
61
+ }
62
+
63
+ export interface CountDownPropsGenerated {
64
+ child: string;
65
+ attributes: {
66
+ style?: CountDownStyleGenerated;
67
+ count?: number;
68
+ title?: string;
69
+ description?: string;
70
+ adjustsFontSizeToFit?: boolean;
71
+ showEllipsis?: boolean;
72
+ scrollable?: boolean;
73
+ };
74
+ }
75
+
76
+ export interface CountDownComponentProps {
77
+ node: NodeData<CountDownPropsGenerated['attributes']>;
78
+ }
@@ -0,0 +1,10 @@
1
+ import moment from 'moment';
2
+
3
+ export function formatCountdownTime(
4
+ targetTimeMs: number,
5
+ format: string,
6
+ nowMs: number = Date.now(),
7
+ ): string {
8
+ const diffMs = Math.max(0, targetTimeMs - nowMs);
9
+ return moment(diffMs).format(format);
10
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "pattern": {
4
+ "type": "CountDown",
5
+ "children": "never",
6
+ "extends": "Counter",
7
+ "attributes": {}
8
+ },
9
+ "meta": {
10
+ "desiredParent": ["all"],
11
+ "label": "Count Down",
12
+ "description": "Displays a countdown timer.",
13
+ "attributes": {
14
+ "count": {
15
+ "label": "Count (ms)",
16
+ "description": "Countdown duration in milliseconds.",
17
+ "category": "other",
18
+ "specialCategory": null,
19
+ "sort": 1
20
+ }
21
+ }
22
+ }
23
+ }
24
+
@@ -0,0 +1,44 @@
1
+ import React, { useId } from 'react';
2
+ import type { CounterComponentProps } from './CounterProps.generated';
3
+ import useNode from '../useNode';
4
+ import { useBuilderParams } from '../../components/BuilderProvider';
5
+ import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
6
+ import { useLogRender } from '../../utils/useLogRender';
7
+ import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
+ import { useMergedStyle } from '../../utils/useMergedStyle';
9
+
10
+ //Optimzation trade off by readability: skip React.memo to keep named exports.
11
+ export function Counter({ node }: CounterComponentProps) {
12
+ useLogRender('Counter');
13
+ node = useNode(node);
14
+
15
+ const generatedId = useId();
16
+ const attributeName = node.sourceType ?? node.type ?? 'Counter';
17
+ const attributeKey = node.key ?? generatedId;
18
+
19
+ const { previewMode, selectedKey } = useBuilderParams();
20
+ const baseStyle = useExtractTextStyle(node);
21
+ const isSelected = isNodeSelected({
22
+ previewMode: !!previewMode,
23
+ current: selectedKey ? { key: selectedKey } : undefined,
24
+ node,
25
+ });
26
+ const style = useMergedStyle(
27
+ baseStyle,
28
+ isSelected ? SELECTED_OUTLINE_STYLE : undefined,
29
+ );
30
+
31
+ const rawCount = node.attributes?.count;
32
+ const count =
33
+ typeof rawCount === 'number' && Number.isFinite(rawCount) ? rawCount : 0;
34
+
35
+ return (
36
+ <p
37
+ attribute-name={attributeName}
38
+ attribute-key={attributeKey}
39
+ style={style}
40
+ >
41
+ {String(count)}
42
+ </p>
43
+ );
44
+ }
@@ -0,0 +1,78 @@
1
+ /* AUTO-GENERATED FILE - DO NOT EDIT */
2
+
3
+ import type { NodeData } from '../../types/Node';
4
+
5
+ export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
6
+ export type FlexDirectionOptionType = 'row' | 'column';
7
+ export type AlignItemsOptionType =
8
+ | 'flex-start'
9
+ | 'center'
10
+ | 'flex-end'
11
+ | 'stretch'
12
+ | 'baseline';
13
+ export type JustifyContentOptionType =
14
+ | 'flex-start'
15
+ | 'center'
16
+ | 'flex-end'
17
+ | 'space-between'
18
+ | 'space-around'
19
+ | 'space-evenly';
20
+ export type PositionOptionType = 'relative' | 'absolute';
21
+
22
+ export interface CounterStyleGenerated {
23
+ color?: string;
24
+ fontSize?: string;
25
+ fontFamily?: string;
26
+ fontWeight?: string;
27
+ textAlign?: TextAlignOptionType;
28
+ flexDirection?: FlexDirectionOptionType;
29
+ alignItems?: AlignItemsOptionType;
30
+ justifyContent?: JustifyContentOptionType;
31
+ gap?: string;
32
+ padding?: string;
33
+ paddingHorizontal?: string;
34
+ paddingVertical?: string;
35
+ paddingTop?: string;
36
+ paddingBottom?: string;
37
+ paddingLeft?: string;
38
+ paddingRight?: string;
39
+ margin?: string;
40
+ marginHorizontal?: string;
41
+ marginVertical?: string;
42
+ marginTop?: string;
43
+ marginBottom?: string;
44
+ marginLeft?: string;
45
+ marginRight?: string;
46
+ backgroundColor?: string;
47
+ borderRadius?: string;
48
+ width?: string;
49
+ minWidth?: string;
50
+ maxWidth?: string;
51
+ height?: string;
52
+ minHeight?: string;
53
+ maxHeight?: string;
54
+ flex?: number;
55
+ position?: PositionOptionType;
56
+ top?: string;
57
+ bottom?: string;
58
+ left?: string;
59
+ right?: string;
60
+ zIndex?: number;
61
+ }
62
+
63
+ export interface CounterPropsGenerated {
64
+ child: string;
65
+ attributes: {
66
+ style?: CounterStyleGenerated;
67
+ title?: string;
68
+ description?: string;
69
+ adjustsFontSizeToFit?: boolean;
70
+ showEllipsis?: boolean;
71
+ scrollable?: boolean;
72
+ count?: number;
73
+ };
74
+ }
75
+
76
+ export interface CounterComponentProps {
77
+ node: NodeData<CounterPropsGenerated['attributes']>;
78
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "pattern": {
4
+ "type": "Counter",
5
+ "children": "never",
6
+ "extends": "Text",
7
+ "attributes": {
8
+ "count": "number"
9
+ }
10
+ },
11
+ "meta": {
12
+ "desiredParent": ["all"],
13
+ "label": "Counter",
14
+ "description": "Displays a numeric counter.",
15
+ "attributes": {
16
+ "count": {
17
+ "label": "Count",
18
+ "description": "Numeric value to display.",
19
+ "category": "other",
20
+ "specialCategory": null,
21
+ "sort": 1
22
+ }
23
+ }
24
+ }
25
+ }
26
+
@@ -59,6 +59,8 @@ export interface ImagePropsGenerated {
59
59
  child: string;
60
60
  attributes: {
61
61
  style?: ImageStyleGenerated;
62
+ title?: string;
63
+ description?: string;
62
64
  scrollable?: boolean;
63
65
  src?: string;
64
66
  width?: string;
@@ -5,6 +5,8 @@
5
5
  "children": "never",
6
6
  "extends": "View",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "src": "string",
9
11
  "width": "size",
10
12
  "height": "size",
@@ -58,6 +58,8 @@ export interface MainPropsGenerated {
58
58
  child: string;
59
59
  attributes: {
60
60
  style?: MainStyleGenerated;
61
+ title?: string;
62
+ description?: string;
61
63
  scrollable?: boolean;
62
64
  useSafeAreaView?: boolean;
63
65
  };
@@ -5,6 +5,8 @@
5
5
  "children": "node",
6
6
  "extends": "View",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "useSafeAreaView": "boolean"
9
11
  }
10
12
  },
@@ -58,6 +58,8 @@ export interface OnboardPropsGenerated {
58
58
  child: string;
59
59
  attributes: {
60
60
  style?: OnboardStyleGenerated;
61
+ title?: string;
62
+ description?: string;
61
63
  scrollable?: boolean;
62
64
  };
63
65
  }
@@ -4,7 +4,10 @@
4
4
  "type": "Onboard",
5
5
  "children": "node",
6
6
  "extends": "View",
7
- "attributes": {}
7
+ "attributes": {
8
+ "title": "title",
9
+ "description": "description"
10
+ }
8
11
  },
9
12
  "meta": {
10
13
  "desiredParent": [
@@ -73,6 +73,8 @@ export interface OnboardButtonPropsGenerated {
73
73
  child: string;
74
74
  attributes: {
75
75
  style?: OnboardButtonStyleGenerated;
76
+ title?: string;
77
+ description?: string;
76
78
  scrollable?: boolean;
77
79
  labelKey?: string;
78
80
  button_text_color?: string;
@@ -5,6 +5,8 @@
5
5
  "children": "never",
6
6
  "extends": "View",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "labelKey": "string",
9
11
  "button_text_color": "color",
10
12
  "animation": [
@@ -64,6 +64,8 @@ export interface OnboardButtonsPropsGenerated {
64
64
  child: string;
65
65
  attributes: {
66
66
  style?: OnboardButtonsStyleGenerated;
67
+ title?: string;
68
+ description?: string;
67
69
  scrollable?: boolean;
68
70
  buttonType?: ButtonTypeOptionType;
69
71
  skipNumber?: number;
@@ -5,6 +5,8 @@
5
5
  "children": "node",
6
6
  "extends": "View",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "buttonType": [
9
11
  "previous_button",
10
12
  "next_button",
@@ -65,6 +65,8 @@ export interface OnboardDotPropsGenerated {
65
65
  child: string;
66
66
  attributes: {
67
67
  style?: OnboardDotStyleGenerated;
68
+ title?: string;
69
+ description?: string;
68
70
  scrollable?: boolean;
69
71
  dotType?: DotTypeOptionType;
70
72
  inactive_dot_opacity?: number;
@@ -5,6 +5,8 @@
5
5
  "children": "never",
6
6
  "extends": "View",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "dotType": [
9
11
  "expanding_dot",
10
12
  "normal_dot",
@@ -64,6 +64,8 @@ export interface OnboardFooterPropsGenerated {
64
64
  child: string;
65
65
  attributes: {
66
66
  style?: OnboardFooterStyleGenerated;
67
+ title?: string;
68
+ description?: string;
67
69
  adjustsFontSizeToFit?: boolean;
68
70
  showEllipsis?: boolean;
69
71
  scrollable?: boolean;
@@ -5,6 +5,8 @@
5
5
  "children": "node",
6
6
  "extends": "Text",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "textLocalizationKey": "string",
9
11
  "linkedWordFirstLocalizationKey": "string",
10
12
  "linkedWordFirstColor": "color",
@@ -59,6 +59,8 @@ export interface OnboardImagePropsGenerated {
59
59
  child: string;
60
60
  attributes: {
61
61
  style?: OnboardImageStyleGenerated;
62
+ title?: string;
63
+ description?: string;
62
64
  src?: string;
63
65
  width?: string;
64
66
  height?: string;
@@ -5,6 +5,8 @@
5
5
  "children": "node",
6
6
  "extends": "Image",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "video_url": "string",
9
11
  "lottie": "string"
10
12
  }
@@ -59,6 +59,8 @@ export interface OnboardItemPropsGenerated {
59
59
  child: string;
60
60
  attributes: {
61
61
  style?: OnboardItemStyleGenerated;
62
+ title?: string;
63
+ description?: string;
62
64
  scrollable?: boolean;
63
65
  display?: DisplayOptionType;
64
66
  gap?: string;
@@ -5,6 +5,8 @@
5
5
  "children": "node",
6
6
  "extends": "View",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "display": [
9
11
  "flex",
10
12
  "block"
@@ -59,6 +59,8 @@ export interface OnboardProviderPropsGenerated {
59
59
  child: string;
60
60
  attributes: {
61
61
  style?: OnboardProviderStyleGenerated;
62
+ title?: string;
63
+ description?: string;
62
64
  scrollable?: boolean;
63
65
  theme?: ThemeOptionType;
64
66
  borderRadius?: never;
@@ -5,6 +5,8 @@
5
5
  "children": "node",
6
6
  "extends": "View",
7
7
  "attributes": {
8
+ "title": "title",
9
+ "description": "description",
8
10
  "theme": [
9
11
  "light",
10
12
  "dark",
@@ -64,6 +64,8 @@ export interface OnboardSubtitlePropsGenerated {
64
64
  child: string;
65
65
  attributes: {
66
66
  style?: OnboardSubtitleStyleGenerated;
67
+ title?: string;
68
+ description?: string;
67
69
  adjustsFontSizeToFit?: boolean;
68
70
  showEllipsis?: boolean;
69
71
  scrollable?: boolean;
@@ -4,7 +4,10 @@
4
4
  "type": "OnboardSubtitle",
5
5
  "children": "string",
6
6
  "extends": "Text",
7
- "attributes": {}
7
+ "attributes": {
8
+ "title": "title",
9
+ "description": "description"
10
+ }
8
11
  },
9
12
  "defaults": {
10
13
  "style": {
@@ -64,6 +64,8 @@ export interface OnboardTitlePropsGenerated {
64
64
  child: string;
65
65
  attributes: {
66
66
  style?: OnboardTitleStyleGenerated;
67
+ title?: string;
68
+ description?: string;
67
69
  adjustsFontSizeToFit?: boolean;
68
70
  showEllipsis?: boolean;
69
71
  scrollable?: boolean;
@@ -4,7 +4,10 @@
4
4
  "type": "OnboardTitle",
5
5
  "children": "string",
6
6
  "extends": "Text",
7
- "attributes": {}
7
+ "attributes": {
8
+ "title": "title",
9
+ "description": "description"
10
+ }
8
11
  },
9
12
  "defaults": {
10
13
  "style": {
@@ -59,6 +59,8 @@ export interface PaywallBackgroundPropsGenerated {
59
59
  child: string;
60
60
  attributes: {
61
61
  style?: PaywallBackgroundStyleGenerated;
62
+ title?: string;
63
+ description?: string;
62
64
  src?: string;
63
65
  resizeMode?: ResizeModeOptionType;
64
66
  scrollable?: boolean;
@@ -4,7 +4,10 @@
4
4
  "type": "PaywallBackground",
5
5
  "children": "never",
6
6
  "extends": "BackgroundImage",
7
- "attributes": {},
7
+ "attributes": {
8
+ "title": "title",
9
+ "description": "description"
10
+ },
8
11
  "defaults": {
9
12
  "resizeMode": "cover",
10
13
  "style": {
@@ -1,8 +1,9 @@
1
- import React, { useId, useMemo } from 'react';
1
+ import React, { useId } from 'react';
2
2
  import type { PaywallCloseButtonComponentProps } from './PaywallCloseButtonProps.generated';
3
3
  import useNode from '../useNode';
4
4
  import { useBuilderParams } from '../../components/BuilderProvider';
5
5
  import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
6
+ import { useExtractViewStyle } from '../../attribute-analyser/style/web/useExtractViewStyle';
6
7
  import { useLogRender } from '../../utils/useLogRender';
7
8
  import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
9
  import { useMergedStyle } from '../../utils/useMergedStyle';
@@ -21,7 +22,8 @@ function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
21
22
 
22
23
  const { previewMode, selectedKey } = useBuilderParams();
23
24
 
24
- const baseStyle = useExtractTextStyle(node);
25
+ const viewStyle = useExtractViewStyle(node);
26
+ const textStyle = useExtractTextStyle(node);
25
27
 
26
28
  const isSelected = isNodeSelected({
27
29
  previewMode: !!previewMode,
@@ -29,16 +31,16 @@ function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
29
31
  node,
30
32
  });
31
33
  const style = useMergedStyle(
32
- baseStyle,
34
+ viewStyle,
33
35
  isSelected ? SELECTED_OUTLINE_STYLE : undefined,
34
36
  );
35
37
 
36
38
  const attrs = node.attributes;
37
39
  const styleBag = attrs?.style;
38
40
  const iconType = attrs?.iconType ?? 'close';
39
- const size = attrs?.size ?? (style.fontSize as number | undefined) ?? 24;
41
+ const size = attrs?.size ?? (textStyle.fontSize as number | undefined) ?? 24;
40
42
  const color =
41
- (style.color as string | undefined) ??
43
+ (textStyle.color as string | undefined) ??
42
44
  (styleBag?.color as string | undefined);
43
45
 
44
46
  return (
@@ -64,6 +64,8 @@ export interface PaywallCloseButtonPropsGenerated {
64
64
  child: string;
65
65
  attributes: {
66
66
  style?: PaywallCloseButtonStyleGenerated;
67
+ title?: string;
68
+ description?: string;
67
69
  iconType?: string;
68
70
  size?: number;
69
71
  strokeWidth?: number;
@@ -4,7 +4,10 @@
4
4
  "type": "PaywallCloseButton",
5
5
  "children": "never",
6
6
  "extends": "BIcon",
7
- "attributes": {}
7
+ "attributes": {
8
+ "title": "title",
9
+ "description": "description"
10
+ }
8
11
  },
9
12
  "meta": {
10
13
  "desiredParent": [
@@ -0,0 +1,49 @@
1
+ import React, { useId } from 'react';
2
+ import type { PaywallCounterComponentProps } from './PaywallCounterProps.generated';
3
+ import useNode from '../useNode';
4
+ import { useBuilderParams } from '../../components/BuilderProvider';
5
+ import { useExtractTextStyle } from '../../attribute-analyser/style/web/useExtractTextStyle';
6
+ import { useLogRender } from '../../utils/useLogRender';
7
+ import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
+ import { useMergedStyle } from '../../utils/useMergedStyle';
9
+ import { usePaywallCounter } from '../../paywall/hooks';
10
+
11
+ //Optimzation trade off by readability: skip React.memo to keep named exports.
12
+ export function PaywallCounter({ node }: PaywallCounterComponentProps) {
13
+ useLogRender('PaywallCounter');
14
+ node = useNode(node);
15
+
16
+ const generatedId = useId();
17
+ const attributeName = node.sourceType ?? node.type ?? 'PaywallCounter';
18
+ const attributeKey = node.key ?? generatedId;
19
+
20
+ const { previewMode, selectedKey } = useBuilderParams();
21
+ const baseStyle = useExtractTextStyle(node);
22
+ const isSelected = isNodeSelected({
23
+ previewMode: !!previewMode,
24
+ current: selectedKey ? { key: selectedKey } : undefined,
25
+ node,
26
+ });
27
+ const style = useMergedStyle(
28
+ baseStyle,
29
+ isSelected ? SELECTED_OUTLINE_STYLE : undefined,
30
+ );
31
+
32
+ const paywallCount = usePaywallCounter();
33
+ const fallbackCount = node.attributes?.count;
34
+ const count = Number.isFinite(paywallCount)
35
+ ? paywallCount
36
+ : typeof fallbackCount === 'number' && Number.isFinite(fallbackCount)
37
+ ? fallbackCount
38
+ : 0;
39
+
40
+ return (
41
+ <p
42
+ attribute-name={attributeName}
43
+ attribute-key={attributeKey}
44
+ style={style}
45
+ >
46
+ {String(count)}
47
+ </p>
48
+ );
49
+ }