@developer_tribe/react-builder 1.2.24 → 1.2.26

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 (193) hide show
  1. package/dist/attributes-editor/AttributesEditorFields.d.ts +1 -1
  2. package/dist/attributes-editor/SpecialCategorySection.d.ts +2 -1
  3. package/dist/attributes-editor/attributesEditorModelTypes.d.ts +2 -0
  4. package/dist/build-components/BIcon/BIconProps.generated.d.ts +0 -2
  5. package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +0 -2
  6. package/dist/build-components/Button/ButtonProps.generated.d.ts +0 -2
  7. package/dist/build-components/Carousel/CarouselProps.generated.d.ts +0 -2
  8. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +0 -2
  9. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +0 -2
  10. package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +0 -2
  11. package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +0 -2
  12. package/dist/build-components/CountDown/CountDownProps.generated.d.ts +3 -6
  13. package/dist/build-components/Image/ImageProps.generated.d.ts +0 -2
  14. package/dist/build-components/Main/MainProps.generated.d.ts +0 -2
  15. package/dist/build-components/NavigationBarColor/NavigationBarColorProps.generated.d.ts +0 -2
  16. package/dist/build-components/Onboard/OnboardProps.generated.d.ts +0 -2
  17. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +0 -2
  18. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +0 -2
  19. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +0 -2
  20. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +0 -2
  21. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +0 -2
  22. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +0 -2
  23. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +0 -2
  24. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +0 -2
  25. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +0 -2
  26. package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +0 -2
  27. package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +0 -2
  28. package/dist/build-components/PaywallOptions/PaywallOptionButton.d.ts +1 -1
  29. package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +0 -2
  30. package/dist/build-components/PaywallProvider/PaywallContext.d.ts +1 -2
  31. package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +0 -2
  32. package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +0 -2
  33. package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +0 -2
  34. package/dist/build-components/Separator/SeparatorProps.generated.d.ts +0 -2
  35. package/dist/build-components/StatusBarColor/StatusBarColorProps.generated.d.ts +0 -2
  36. package/dist/build-components/Text/TextProps.generated.d.ts +0 -2
  37. package/dist/build-components/index.d.ts +1 -3
  38. package/dist/build-components/patterns.generated.d.ts +818 -1690
  39. package/dist/index.cjs.js +3 -3
  40. package/dist/index.cjs.js.map +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.esm.js +4 -4
  43. package/dist/index.esm.js.map +1 -1
  44. package/dist/index.web.cjs.js +4 -4
  45. package/dist/index.web.cjs.js.map +1 -1
  46. package/dist/index.web.esm.js +3 -3
  47. package/dist/index.web.esm.js.map +1 -1
  48. package/dist/pages/ProjectPage.d.ts +2 -2
  49. package/dist/pages/projectPageUtils.d.ts +7 -1
  50. package/dist/paywall/hooks/index.d.ts +0 -1
  51. package/dist/styles.css +1 -1
  52. package/dist/types/Project.d.ts +6 -0
  53. package/dist/utils/index.d.ts +1 -0
  54. package/dist/utils/patterns.d.ts +2 -0
  55. package/dist/utils/projectColors.d.ts +7 -0
  56. package/package.json +3 -3
  57. package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +11 -2
  58. package/src/AttributesEditor.tsx +15 -4
  59. package/src/DeviceMockFrame.tsx +0 -2
  60. package/src/RenderPage.tsx +0 -9
  61. package/src/assets/.DS_Store +0 -0
  62. package/src/assets/meta.json +1 -1
  63. package/src/assets/samples/paywall-1.json +0 -1
  64. package/src/assets/samples/paywall-2.json +2 -3
  65. package/src/assets/samples/paywall-app-delete-offer.json +2 -4
  66. package/src/assets/samples/paywall-app-open-offer.json +2 -4
  67. package/src/assets/samples/paywall-back-offer.json +2 -4
  68. package/src/assets/samples/paywall-notification-offer.json +2 -4
  69. package/src/assets/samples/simple-2.json +0 -1
  70. package/src/assets/samples/vpn-onboard-1.json +15 -15
  71. package/src/assets/samples/vpn-onboard-2.json +15 -15
  72. package/src/assets/samples/vpn-onboard-3.json +15 -15
  73. package/src/assets/samples/vpn-onboard-4.json +15 -15
  74. package/src/assets/samples/vpn-onboard-5.json +21 -21
  75. package/src/assets/samples/vpn-onboard-6.json +15 -15
  76. package/src/attributes-editor/AttributesEditorFields.tsx +0 -1
  77. package/src/attributes-editor/AttributesEditorView.tsx +43 -38
  78. package/src/attributes-editor/Field.tsx +1 -1
  79. package/src/attributes-editor/SpecialCategorySection.tsx +5 -4
  80. package/src/attributes-editor/attributesEditorModelTypes.ts +2 -0
  81. package/src/attributes-editor/useAttributesEditorModel.ts +24 -8
  82. package/src/build-components/BIcon/BIcon.tsx +1 -1
  83. package/src/build-components/BIcon/BIconProps.generated.ts +0 -2
  84. package/src/build-components/BIcon/pattern.json +2 -2
  85. package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +0 -2
  86. package/src/build-components/BackgroundImage/pattern.json +2 -2
  87. package/src/build-components/Button/ButtonProps.generated.ts +0 -2
  88. package/src/build-components/Button/pattern.json +2 -2
  89. package/src/build-components/Carousel/Carousel.tsx +1 -1
  90. package/src/build-components/Carousel/CarouselProps.generated.ts +0 -2
  91. package/src/build-components/Carousel/pattern.json +3 -3
  92. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +0 -2
  93. package/src/build-components/CarouselButtons/pattern.json +2 -2
  94. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +0 -2
  95. package/src/build-components/CarouselDots/pattern.json +2 -2
  96. package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +0 -2
  97. package/src/build-components/CarouselItem/pattern.json +3 -5
  98. package/src/build-components/CarouselProvider/CarouselProvider.tsx +1 -1
  99. package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +0 -2
  100. package/src/build-components/CarouselProvider/pattern.json +2 -4
  101. package/src/build-components/CountDown/CountDown.tsx +25 -1
  102. package/src/build-components/CountDown/CountDownProps.generated.ts +3 -6
  103. package/src/build-components/CountDown/pattern.json +10 -2
  104. package/src/build-components/Image/ImageProps.generated.ts +0 -2
  105. package/src/build-components/Image/pattern.json +5 -3
  106. package/src/build-components/Main/MainProps.generated.ts +0 -2
  107. package/src/build-components/Main/pattern.json +2 -2
  108. package/src/build-components/NavigationBarColor/NavigationBarColorProps.generated.ts +0 -2
  109. package/src/build-components/NavigationBarColor/pattern.json +2 -2
  110. package/src/build-components/Onboard/OnboardProps.generated.ts +0 -2
  111. package/src/build-components/Onboard/pattern.json +3 -5
  112. package/src/build-components/OnboardButton/OnboardButton.tsx +1 -4
  113. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +0 -2
  114. package/src/build-components/OnboardButton/pattern.json +2 -2
  115. package/src/build-components/OnboardButtons/OnboardButtons.tsx +1 -9
  116. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +0 -2
  117. package/src/build-components/OnboardButtons/pattern.json +2 -2
  118. package/src/build-components/OnboardDot/OnboardDot.tsx +2 -1
  119. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +0 -2
  120. package/src/build-components/OnboardDot/pattern.json +2 -2
  121. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +0 -2
  122. package/src/build-components/OnboardFooter/pattern.json +2 -2
  123. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +0 -2
  124. package/src/build-components/OnboardImage/pattern.json +2 -2
  125. package/src/build-components/OnboardItem/OnboardItem.tsx +1 -1
  126. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +0 -2
  127. package/src/build-components/OnboardItem/pattern.json +2 -2
  128. package/src/build-components/OnboardProvider/OnboardProvider.tsx +0 -1
  129. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +0 -2
  130. package/src/build-components/OnboardProvider/pattern.json +2 -2
  131. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +0 -2
  132. package/src/build-components/OnboardSubtitle/pattern.json +3 -5
  133. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +0 -2
  134. package/src/build-components/OnboardTitle/pattern.json +3 -5
  135. package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +0 -2
  136. package/src/build-components/PaywallBackground/pattern.json +2 -4
  137. package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +0 -2
  138. package/src/build-components/PaywallCloseButton/pattern.json +3 -5
  139. package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +1 -2
  140. package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +0 -2
  141. package/src/build-components/PaywallOptions/pattern.json +3 -5
  142. package/src/build-components/PaywallProvider/PaywallContext.ts +1 -1
  143. package/src/build-components/PaywallProvider/PaywallProvider.tsx +0 -10
  144. package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +0 -2
  145. package/src/build-components/PaywallProvider/pattern.json +2 -2
  146. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +1 -1
  147. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +0 -2
  148. package/src/build-components/PaywallSubscribeButton/pattern.json +3 -5
  149. package/src/build-components/RadioButton/RadioButton.tsx +1 -1
  150. package/src/build-components/RadioButton/RadioButtonProps.generated.ts +0 -2
  151. package/src/build-components/RadioButton/pattern.json +2 -2
  152. package/src/build-components/RenderNode.generated.tsx +0 -10
  153. package/src/build-components/Separator/SeparatorProps.generated.ts +0 -2
  154. package/src/build-components/Separator/pattern.json +2 -2
  155. package/src/build-components/StatusBarColor/StatusBarColorProps.generated.ts +0 -2
  156. package/src/build-components/StatusBarColor/pattern.json +2 -2
  157. package/src/build-components/Text/TextProps.generated.ts +0 -2
  158. package/src/build-components/Text/pattern.json +2 -3
  159. package/src/build-components/View/pattern.json +2 -0
  160. package/src/build-components/index.ts +0 -10
  161. package/src/build-components/patterns.generated.ts +850 -1759
  162. package/src/components/AttributesEditorPanel.tsx +48 -32
  163. package/src/components/Builder.tsx +9 -1
  164. package/src/components/BuilderProvider.tsx +2 -37
  165. package/src/hooks/useSafeAreaViewStyle.ts +1 -3
  166. package/src/index.ts +1 -1
  167. package/src/mockOS/managers/navigationManager.ts +1 -1
  168. package/src/pages/ProjectPage.tsx +47 -22
  169. package/src/pages/projectPageUtils.ts +15 -1
  170. package/src/pages/tabs/SideTool.tsx +1 -22
  171. package/src/paywall/hooks/index.ts +0 -1
  172. package/src/store.ts +1 -6
  173. package/src/styles/base/_global.scss +2 -0
  174. package/src/types/Project.ts +7 -0
  175. package/src/utils/analyseNodeByPatterns.ts +4 -0
  176. package/src/utils/index.ts +1 -0
  177. package/src/utils/logRenderStore.ts +0 -1
  178. package/src/utils/novaToJson.ts +1 -5
  179. package/src/utils/parseColor.ts +1 -0
  180. package/src/utils/patterns.ts +2 -0
  181. package/src/utils/projectColors.ts +71 -0
  182. package/dist/build-components/Counter/Counter.d.ts +0 -2
  183. package/dist/build-components/Counter/CounterProps.generated.d.ts +0 -63
  184. package/dist/build-components/PaywallCounter/PaywallCounter.d.ts +0 -2
  185. package/dist/build-components/PaywallCounter/PaywallCounterProps.generated.d.ts +0 -63
  186. package/dist/paywall/hooks/useHandleGoBack.d.ts +0 -1
  187. package/src/build-components/Counter/Counter.tsx +0 -44
  188. package/src/build-components/Counter/CounterProps.generated.ts +0 -80
  189. package/src/build-components/Counter/pattern.json +0 -25
  190. package/src/build-components/PaywallCounter/PaywallCounter.tsx +0 -46
  191. package/src/build-components/PaywallCounter/PaywallCounterProps.generated.ts +0 -80
  192. package/src/build-components/PaywallCounter/pattern.json +0 -23
  193. package/src/paywall/hooks/useHandleGoBack.ts +0 -60
@@ -1,63 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
3
- export type FlexDirectionOptionType = 'row' | 'column';
4
- export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
5
- export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
6
- export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
7
- export type PositionOptionType = 'relative' | 'absolute';
8
- export interface CounterStyleGenerated {
9
- color?: string;
10
- fontSize?: string;
11
- fontFamily?: string;
12
- fontWeight?: string;
13
- textAlign?: TextAlignOptionType;
14
- flexDirection?: FlexDirectionOptionType;
15
- flexWrap?: FlexWrapOptionType;
16
- alignItems?: AlignItemsOptionType;
17
- justifyContent?: JustifyContentOptionType;
18
- gap?: string;
19
- padding?: string;
20
- paddingHorizontal?: string;
21
- paddingVertical?: string;
22
- paddingTop?: string;
23
- paddingBottom?: string;
24
- paddingLeft?: string;
25
- paddingRight?: string;
26
- margin?: string;
27
- marginHorizontal?: string;
28
- marginVertical?: string;
29
- marginTop?: string;
30
- marginBottom?: string;
31
- marginLeft?: string;
32
- marginRight?: string;
33
- backgroundColor?: string;
34
- borderRadius?: string;
35
- width?: string;
36
- minWidth?: string;
37
- maxWidth?: string;
38
- height?: string;
39
- minHeight?: string;
40
- maxHeight?: string;
41
- flex?: number;
42
- position?: PositionOptionType;
43
- top?: string;
44
- bottom?: string;
45
- left?: string;
46
- right?: string;
47
- zIndex?: number;
48
- }
49
- export interface CounterPropsGenerated {
50
- child: string;
51
- attributes: {
52
- style?: CounterStyleGenerated;
53
- title?: string;
54
- description?: string;
55
- adjustsFontSizeToFit?: boolean;
56
- showEllipsis?: boolean;
57
- scrollable?: boolean;
58
- count?: number;
59
- };
60
- }
61
- export interface CounterComponentProps {
62
- node: NodeData<CounterPropsGenerated['attributes']>;
63
- }
@@ -1,2 +0,0 @@
1
- import type { PaywallCounterComponentProps } from './PaywallCounterProps.generated';
2
- export declare function PaywallCounter({ node }: PaywallCounterComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -1,63 +0,0 @@
1
- import type { NodeData } from '../../types/Node';
2
- export type TextAlignOptionType = 'left' | 'center' | 'right' | 'justify';
3
- export type FlexDirectionOptionType = 'row' | 'column';
4
- export type FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
5
- export type AlignItemsOptionType = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
6
- export type JustifyContentOptionType = 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly';
7
- export type PositionOptionType = 'relative' | 'absolute';
8
- export interface PaywallCounterStyleGenerated {
9
- color?: string;
10
- fontSize?: string;
11
- fontFamily?: string;
12
- fontWeight?: string;
13
- textAlign?: TextAlignOptionType;
14
- flexDirection?: FlexDirectionOptionType;
15
- flexWrap?: FlexWrapOptionType;
16
- alignItems?: AlignItemsOptionType;
17
- justifyContent?: JustifyContentOptionType;
18
- gap?: string;
19
- padding?: string;
20
- paddingHorizontal?: string;
21
- paddingVertical?: string;
22
- paddingTop?: string;
23
- paddingBottom?: string;
24
- paddingLeft?: string;
25
- paddingRight?: string;
26
- margin?: string;
27
- marginHorizontal?: string;
28
- marginVertical?: string;
29
- marginTop?: string;
30
- marginBottom?: string;
31
- marginLeft?: string;
32
- marginRight?: string;
33
- backgroundColor?: string;
34
- borderRadius?: string;
35
- width?: string;
36
- minWidth?: string;
37
- maxWidth?: string;
38
- height?: string;
39
- minHeight?: string;
40
- maxHeight?: string;
41
- flex?: number;
42
- position?: PositionOptionType;
43
- top?: string;
44
- bottom?: string;
45
- left?: string;
46
- right?: string;
47
- zIndex?: number;
48
- }
49
- export interface PaywallCounterPropsGenerated {
50
- child: string;
51
- attributes: {
52
- style?: PaywallCounterStyleGenerated;
53
- count?: number;
54
- title?: string;
55
- description?: string;
56
- adjustsFontSizeToFit?: boolean;
57
- showEllipsis?: boolean;
58
- scrollable?: boolean;
59
- };
60
- }
61
- export interface PaywallCounterComponentProps {
62
- node: NodeData<PaywallCounterPropsGenerated['attributes']>;
63
- }
@@ -1 +0,0 @@
1
- export declare function useHandleGoBack(handleGoBack: () => boolean | null | undefined): void;
@@ -1,44 +0,0 @@
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
- }
@@ -1,80 +0,0 @@
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 FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
8
- export type AlignItemsOptionType =
9
- | 'flex-start'
10
- | 'center'
11
- | 'flex-end'
12
- | 'stretch'
13
- | 'baseline';
14
- export type JustifyContentOptionType =
15
- | 'flex-start'
16
- | 'center'
17
- | 'flex-end'
18
- | 'space-between'
19
- | 'space-around'
20
- | 'space-evenly';
21
- export type PositionOptionType = 'relative' | 'absolute';
22
-
23
- export interface CounterStyleGenerated {
24
- color?: string;
25
- fontSize?: string;
26
- fontFamily?: string;
27
- fontWeight?: string;
28
- textAlign?: TextAlignOptionType;
29
- flexDirection?: FlexDirectionOptionType;
30
- flexWrap?: FlexWrapOptionType;
31
- alignItems?: AlignItemsOptionType;
32
- justifyContent?: JustifyContentOptionType;
33
- gap?: string;
34
- padding?: string;
35
- paddingHorizontal?: string;
36
- paddingVertical?: string;
37
- paddingTop?: string;
38
- paddingBottom?: string;
39
- paddingLeft?: string;
40
- paddingRight?: string;
41
- margin?: string;
42
- marginHorizontal?: string;
43
- marginVertical?: string;
44
- marginTop?: string;
45
- marginBottom?: string;
46
- marginLeft?: string;
47
- marginRight?: string;
48
- backgroundColor?: string;
49
- borderRadius?: string;
50
- width?: string;
51
- minWidth?: string;
52
- maxWidth?: string;
53
- height?: string;
54
- minHeight?: string;
55
- maxHeight?: string;
56
- flex?: number;
57
- position?: PositionOptionType;
58
- top?: string;
59
- bottom?: string;
60
- left?: string;
61
- right?: string;
62
- zIndex?: number;
63
- }
64
-
65
- export interface CounterPropsGenerated {
66
- child: string;
67
- attributes: {
68
- style?: CounterStyleGenerated;
69
- title?: string;
70
- description?: string;
71
- adjustsFontSizeToFit?: boolean;
72
- showEllipsis?: boolean;
73
- scrollable?: boolean;
74
- count?: number;
75
- };
76
- }
77
-
78
- export interface CounterComponentProps {
79
- node: NodeData<CounterPropsGenerated['attributes']>;
80
- }
@@ -1,25 +0,0 @@
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
- }
@@ -1,46 +0,0 @@
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
-
10
- //Optimzation trade off by readability: skip React.memo to keep named exports.
11
- export function PaywallCounter({ node }: PaywallCounterComponentProps) {
12
- useLogRender('PaywallCounter');
13
- node = useNode(node);
14
-
15
- const generatedId = useId();
16
- const attributeName = node.sourceType ?? node.type ?? 'PaywallCounter';
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 fallbackCount = node.attributes?.count;
32
- const count =
33
- typeof fallbackCount === 'number' && Number.isFinite(fallbackCount)
34
- ? fallbackCount
35
- : 0;
36
-
37
- return (
38
- <p
39
- attribute-name={attributeName}
40
- attribute-key={attributeKey}
41
- style={style}
42
- >
43
- {String(count)}
44
- </p>
45
- );
46
- }
@@ -1,80 +0,0 @@
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 FlexWrapOptionType = 'nowrap' | 'wrap' | 'wrap-reverse';
8
- export type AlignItemsOptionType =
9
- | 'flex-start'
10
- | 'center'
11
- | 'flex-end'
12
- | 'stretch'
13
- | 'baseline';
14
- export type JustifyContentOptionType =
15
- | 'flex-start'
16
- | 'center'
17
- | 'flex-end'
18
- | 'space-between'
19
- | 'space-around'
20
- | 'space-evenly';
21
- export type PositionOptionType = 'relative' | 'absolute';
22
-
23
- export interface PaywallCounterStyleGenerated {
24
- color?: string;
25
- fontSize?: string;
26
- fontFamily?: string;
27
- fontWeight?: string;
28
- textAlign?: TextAlignOptionType;
29
- flexDirection?: FlexDirectionOptionType;
30
- flexWrap?: FlexWrapOptionType;
31
- alignItems?: AlignItemsOptionType;
32
- justifyContent?: JustifyContentOptionType;
33
- gap?: string;
34
- padding?: string;
35
- paddingHorizontal?: string;
36
- paddingVertical?: string;
37
- paddingTop?: string;
38
- paddingBottom?: string;
39
- paddingLeft?: string;
40
- paddingRight?: string;
41
- margin?: string;
42
- marginHorizontal?: string;
43
- marginVertical?: string;
44
- marginTop?: string;
45
- marginBottom?: string;
46
- marginLeft?: string;
47
- marginRight?: string;
48
- backgroundColor?: string;
49
- borderRadius?: string;
50
- width?: string;
51
- minWidth?: string;
52
- maxWidth?: string;
53
- height?: string;
54
- minHeight?: string;
55
- maxHeight?: string;
56
- flex?: number;
57
- position?: PositionOptionType;
58
- top?: string;
59
- bottom?: string;
60
- left?: string;
61
- right?: string;
62
- zIndex?: number;
63
- }
64
-
65
- export interface PaywallCounterPropsGenerated {
66
- child: string;
67
- attributes: {
68
- style?: PaywallCounterStyleGenerated;
69
- count?: number;
70
- title?: string;
71
- description?: string;
72
- adjustsFontSizeToFit?: boolean;
73
- showEllipsis?: boolean;
74
- scrollable?: boolean;
75
- };
76
- }
77
-
78
- export interface PaywallCounterComponentProps {
79
- node: NodeData<PaywallCounterPropsGenerated['attributes']>;
80
- }
@@ -1,23 +0,0 @@
1
- {
2
- "schemaVersion": 2,
3
- "pattern": {
4
- "type": "PaywallCounter",
5
- "children": "never",
6
- "extends": "Counter",
7
- "attributes": {}
8
- },
9
- "meta": {
10
- "desiredParent": ["all"],
11
- "label": "Paywall Counter",
12
- "description": "Displays the paywall counter value.",
13
- "attributes": {
14
- "count": {
15
- "label": "Fallback Count",
16
- "description": "Used only when the paywall counter hook returns no value.",
17
- "category": "other",
18
- "specialCategory": null,
19
- "sort": 1
20
- }
21
- }
22
- }
23
- }
@@ -1,60 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { useMockOSContext } from '../../mockOS/context/MockOSContextBase';
3
-
4
- export function useHandleGoBack(
5
- handleGoBack: () => boolean | null | undefined,
6
- ) {
7
- const mockOS = useMockOSContext();
8
-
9
- useEffect(() => {
10
- if (!mockOS?.isEnabled) {
11
- return;
12
- }
13
-
14
- const handleBackPress = (event?: KeyboardEvent | PopStateEvent) => {
15
- const result = handleGoBack();
16
-
17
- // Only allow navigation if result is explicitly true
18
- if (result !== true) {
19
- // Prevent navigation
20
- if (event instanceof KeyboardEvent) {
21
- event.preventDefault();
22
- event.stopPropagation();
23
- } else if (event instanceof PopStateEvent) {
24
- // Prevent browser navigation by pushing state back
25
- window.history.pushState(null, '', window.location.href);
26
- }
27
- return;
28
- }
29
-
30
- // Allow navigation - execute MockOS goBack
31
- const canGoBack = mockOS.goBack();
32
- if (!canGoBack) {
33
- mockOS.navigation('launchscreen');
34
- }
35
- };
36
-
37
- // Handle Escape key
38
- const handleKeyDown = (e: KeyboardEvent) => {
39
- if (e.key === 'Escape') {
40
- handleBackPress(e);
41
- }
42
- };
43
-
44
- // Handle browser back button
45
- const handlePopState = (e: PopStateEvent) => {
46
- handleBackPress(e);
47
- };
48
-
49
- // Push a state to track back navigation
50
- window.history.pushState(null, '', window.location.href);
51
-
52
- window.addEventListener('keydown', handleKeyDown);
53
- window.addEventListener('popstate', handlePopState);
54
-
55
- return () => {
56
- window.removeEventListener('keydown', handleKeyDown);
57
- window.removeEventListener('popstate', handlePopState);
58
- };
59
- }, [handleGoBack, mockOS]);
60
- }