@developer_tribe/react-builder 1.0.7 → 1.0.9

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 (217) hide show
  1. package/dist/build-components/BIcon/BIconProps.generated.d.ts +3 -0
  2. package/dist/build-components/BackgroundImage/BackgroundImageProps.generated.d.ts +1 -0
  3. package/dist/build-components/Button/ButtonProps.generated.d.ts +1 -0
  4. package/dist/build-components/Carousel/CarouselProps.generated.d.ts +5 -0
  5. package/dist/build-components/CarouselButtons/CarouselButtonsProps.generated.d.ts +1 -0
  6. package/dist/build-components/CarouselDots/CarouselDotsProps.generated.d.ts +1 -0
  7. package/dist/build-components/CarouselItem/CarouselItemProps.generated.d.ts +1 -0
  8. package/dist/build-components/CarouselProvider/CarouselProviderProps.generated.d.ts +1 -0
  9. package/dist/build-components/Image/ImageProps.generated.d.ts +1 -0
  10. package/dist/build-components/Main/MainProps.generated.d.ts +1 -1
  11. package/dist/build-components/Onboard/OnboardProps.generated.d.ts +1 -0
  12. package/dist/build-components/OnboardButton/OnboardButtonProps.generated.d.ts +1 -0
  13. package/dist/build-components/OnboardButtons/OnboardButtonsProps.generated.d.ts +1 -0
  14. package/dist/build-components/OnboardDot/OnboardDotProps.generated.d.ts +1 -0
  15. package/dist/build-components/OnboardFooter/OnboardFooterProps.generated.d.ts +3 -0
  16. package/dist/build-components/OnboardImage/OnboardImageProps.generated.d.ts +1 -0
  17. package/dist/build-components/OnboardItem/OnboardItemProps.generated.d.ts +1 -0
  18. package/dist/build-components/OnboardProvider/OnboardProviderProps.generated.d.ts +3 -0
  19. package/dist/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.d.ts +3 -0
  20. package/dist/build-components/OnboardTitle/OnboardTitleProps.generated.d.ts +3 -0
  21. package/dist/build-components/PaywallBackground/PaywallBackgroundProps.generated.d.ts +1 -1
  22. package/dist/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.d.ts +3 -1
  23. package/dist/build-components/PaywallOptions/PaywallOptionsProps.generated.d.ts +1 -1
  24. package/dist/build-components/PaywallProvider/PaywallContext.d.ts +12 -0
  25. package/dist/build-components/PaywallProvider/PaywallProviderProps.generated.d.ts +1 -1
  26. package/dist/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.d.ts +1 -0
  27. package/dist/build-components/RadioButton/RadioButtonProps.generated.d.ts +1 -1
  28. package/dist/build-components/Text/TextProps.generated.d.ts +3 -0
  29. package/dist/build-components/View/ViewProps.generated.d.ts +1 -0
  30. package/dist/build-components/patterns.generated.d.ts +372 -374
  31. package/dist/components/BuilderProvider.d.ts +2 -0
  32. package/dist/components/ParamsProvider.d.ts +5 -0
  33. package/dist/components/RenderErrorBoundary.d.ts +28 -0
  34. package/dist/hooks/useSyncHtmlThemeClass.d.ts +7 -0
  35. package/dist/index.cjs.js +5 -5
  36. package/dist/index.cjs.js.map +1 -1
  37. package/dist/index.d.ts +2 -0
  38. package/dist/index.esm.js +3 -3
  39. package/dist/index.esm.js.map +1 -1
  40. package/dist/index.native.cjs.js +4 -4
  41. package/dist/index.native.cjs.js.map +1 -1
  42. package/dist/index.native.d.ts +1 -0
  43. package/dist/index.native.esm.js +4 -4
  44. package/dist/index.native.esm.js.map +1 -1
  45. package/dist/migrations/migratePipe.d.ts +14 -0
  46. package/dist/migrations/migrations/1.1.0_normalize_style_attributes.d.ts +2 -0
  47. package/dist/migrations/semver.d.ts +8 -0
  48. package/dist/migrations/types.d.ts +8 -0
  49. package/dist/mockOS/components/SubscriptionModal.d.ts +7 -0
  50. package/dist/mockOS/context/MockOSContextBase.d.ts +1 -0
  51. package/dist/mockOS/hooks/useMockIap.d.ts +3 -0
  52. package/dist/mockOS/index.d.ts +4 -0
  53. package/dist/mockOS/managers/mockOSIapManager.d.ts +6 -0
  54. package/dist/mockOS/managers/subscriptionManager.d.ts +10 -0
  55. package/dist/pages/ProjectDebug.d.ts +14 -0
  56. package/dist/pages/ProjectMigrationPage.d.ts +23 -0
  57. package/dist/pages/ProjectValidationPage.d.ts +15 -0
  58. package/dist/styles.css +1 -1
  59. package/dist/types/Device.d.ts +5 -0
  60. package/dist/utils/__special_exceptions.d.ts +7 -0
  61. package/dist/utils/getImage.d.ts +23 -0
  62. package/dist/utils/pasteNode.d.ts +15 -0
  63. package/dist/utils/patterns.d.ts +1 -2
  64. package/package.json +6 -2
  65. package/scripts/migrate-patterns-to-v2.mjs +131 -0
  66. package/scripts/migrate-samples-to-current.ts +79 -0
  67. package/scripts/prebuild/utils/createGeneratedProps.js +4 -5
  68. package/scripts/prebuild/utils/validateAllComponentsOrThrow.js +32 -21
  69. package/scripts/prebuild/utils/validatePatternJson.js +12 -10
  70. package/src/.DS_Store +0 -0
  71. package/src/AttributesEditor.tsx +41 -11
  72. package/src/RenderPage.tsx +55 -0
  73. package/src/assets/.DS_Store +0 -0
  74. package/src/assets/devices.json +91 -0
  75. package/src/assets/samples/carousel-sample.json +141 -29
  76. package/src/assets/samples/getSamples.ts +9 -0
  77. package/src/assets/samples/paywall-1.json +119 -71
  78. package/src/assets/samples/simple-1.json +28 -16
  79. package/src/assets/samples/simple-2.json +157 -82
  80. package/src/assets/samples/unmigrated-builder1.json +42 -0
  81. package/src/assets/samples/unvalidated-builder1.json +49 -0
  82. package/src/assets/samples/unvalidated-crash1.json +19 -0
  83. package/src/assets/samples/unvalidated-crashcomponent1.json +16 -0
  84. package/src/assets/samples/vpn-onboard-1.json +91 -51
  85. package/src/assets/samples/vpn-onboard-2.json +318 -278
  86. package/src/assets/samples/vpn-onboard-3.json +286 -252
  87. package/src/assets/samples/vpn-onboard-4.json +286 -252
  88. package/src/assets/samples/vpn-onboard-5.json +434 -374
  89. package/src/assets/samples/vpn-onboard-6.json +290 -250
  90. package/src/attributes-editor/Field.tsx +1 -1
  91. package/src/attributes-editor/LayoutPreviewPicker.tsx +5 -2
  92. package/src/build-components/BIcon/BIconProps.generated.ts +3 -0
  93. package/src/build-components/BIcon/pattern.json +12 -9
  94. package/src/build-components/BackgroundImage/BackgroundImage.tsx +3 -1
  95. package/src/build-components/BackgroundImage/BackgroundImageProps.generated.ts +1 -0
  96. package/src/build-components/BackgroundImage/pattern.json +25 -16
  97. package/src/build-components/Button/Button.tsx +26 -3
  98. package/src/build-components/Button/ButtonProps.generated.ts +1 -0
  99. package/src/build-components/Button/pattern.json +10 -6
  100. package/src/build-components/Carousel/CarouselProps.generated.ts +5 -0
  101. package/src/build-components/Carousel/pattern.json +19 -8
  102. package/src/build-components/CarouselButtons/CarouselButtonsProps.generated.ts +1 -0
  103. package/src/build-components/CarouselButtons/pattern.json +11 -5
  104. package/src/build-components/CarouselDots/CarouselDotsProps.generated.ts +1 -0
  105. package/src/build-components/CarouselDots/pattern.json +5 -4
  106. package/src/build-components/CarouselItem/CarouselItemProps.generated.ts +1 -0
  107. package/src/build-components/CarouselItem/pattern.json +5 -4
  108. package/src/build-components/CarouselProvider/CarouselProvider.tsx +44 -2
  109. package/src/build-components/CarouselProvider/CarouselProviderProps.generated.ts +1 -0
  110. package/src/build-components/Image/Image.tsx +2 -1
  111. package/src/build-components/Image/ImageProps.generated.ts +1 -0
  112. package/src/build-components/Image/pattern.json +11 -5
  113. package/src/build-components/Main/MainProps.generated.ts +1 -1
  114. package/src/build-components/Main/pattern.json +12 -9
  115. package/src/build-components/Onboard/OnboardProps.generated.ts +1 -0
  116. package/src/build-components/Onboard/pattern.json +14 -9
  117. package/src/build-components/OnboardButton/OnboardButtonProps.generated.ts +1 -0
  118. package/src/build-components/OnboardButton/pattern.json +5 -4
  119. package/src/build-components/OnboardButtons/OnboardButtonsProps.generated.ts +1 -0
  120. package/src/build-components/OnboardButtons/pattern.json +5 -4
  121. package/src/build-components/OnboardDot/OnboardDotProps.generated.ts +1 -0
  122. package/src/build-components/OnboardDot/pattern.json +5 -4
  123. package/src/build-components/OnboardFooter/OnboardFooterProps.generated.ts +3 -0
  124. package/src/build-components/OnboardFooter/pattern.json +8 -5
  125. package/src/build-components/OnboardImage/OnboardImageProps.generated.ts +1 -0
  126. package/src/build-components/OnboardImage/pattern.json +7 -4
  127. package/src/build-components/OnboardItem/OnboardItemProps.generated.ts +1 -0
  128. package/src/build-components/OnboardItem/pattern.json +18 -9
  129. package/src/build-components/OnboardProvider/OnboardProviderProps.generated.ts +3 -0
  130. package/src/build-components/OnboardProvider/pattern.json +21 -6
  131. package/src/build-components/OnboardSubtitle/OnboardSubtitleProps.generated.ts +3 -0
  132. package/src/build-components/OnboardSubtitle/pattern.json +10 -6
  133. package/src/build-components/OnboardTitle/OnboardTitleProps.generated.ts +3 -0
  134. package/src/build-components/OnboardTitle/pattern.json +11 -7
  135. package/src/build-components/PaywallBackground/PaywallBackgroundProps.generated.ts +1 -1
  136. package/src/build-components/PaywallBackground/pattern.json +5 -4
  137. package/src/build-components/PaywallCloseButton/PaywallCloseButton.tsx +6 -1
  138. package/src/build-components/PaywallCloseButton/PaywallCloseButtonProps.generated.ts +3 -1
  139. package/src/build-components/PaywallCloseButton/pattern.json +15 -12
  140. package/src/build-components/PaywallOptions/PaywallOptionButton.tsx +0 -1
  141. package/src/build-components/PaywallOptions/PaywallOptions.tsx +3 -2
  142. package/src/build-components/PaywallOptions/PaywallOptionsProps.generated.ts +1 -1
  143. package/src/build-components/PaywallOptions/pattern.json +14 -11
  144. package/src/build-components/PaywallProvider/PaywallContext.ts +25 -0
  145. package/src/build-components/PaywallProvider/PaywallProvider.tsx +102 -5
  146. package/src/build-components/PaywallProvider/PaywallProviderProps.generated.ts +1 -1
  147. package/src/build-components/PaywallProvider/pattern.json +11 -8
  148. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButton.tsx +7 -0
  149. package/src/build-components/PaywallSubscribeButton/PaywallSubscribeButtonProps.generated.ts +1 -0
  150. package/src/build-components/PaywallSubscribeButton/pattern.json +16 -13
  151. package/src/build-components/RadioButton/RadioButtonProps.generated.ts +1 -1
  152. package/src/build-components/RadioButton/pattern.json +5 -4
  153. package/src/build-components/Text/Text.tsx +107 -4
  154. package/src/build-components/Text/TextProps.generated.ts +3 -0
  155. package/src/build-components/Text/pattern.json +19 -4
  156. package/src/build-components/View/ViewProps.generated.ts +1 -0
  157. package/src/build-components/View/pattern.json +28 -13
  158. package/src/build-components/other.tsx +15 -0
  159. package/src/build-components/patterns.generated.ts +340 -235
  160. package/src/build-components/useNode.ts +22 -3
  161. package/src/components/BottomBar.tsx +45 -45
  162. package/src/components/Builder.tsx +20 -6
  163. package/src/components/BuilderButton.tsx +75 -38
  164. package/src/components/BuilderProvider.tsx +22 -2
  165. package/src/components/DeviceButton.tsx +12 -5
  166. package/src/components/EditorHeader.tsx +296 -38
  167. package/src/components/ParamsProvider.tsx +7 -0
  168. package/src/components/RenderErrorBoundary.tsx +200 -0
  169. package/src/hooks/useParams.ts +5 -1
  170. package/src/hooks/useSyncHtmlThemeClass.ts +19 -0
  171. package/src/index.native.ts +7 -0
  172. package/src/index.ts +8 -0
  173. package/src/migrations/migratePipe.ts +59 -0
  174. package/src/migrations/migrations/1.1.0_normalize_style_attributes.ts +80 -0
  175. package/src/migrations/semver.ts +24 -0
  176. package/src/migrations/types.ts +9 -0
  177. package/src/mockOS/components/PermissionModal.tsx +3 -2
  178. package/src/mockOS/components/SubscriptionModal.tsx +400 -0
  179. package/src/mockOS/context/MockOSContext.tsx +61 -10
  180. package/src/mockOS/context/MockOSContextBase.ts +1 -0
  181. package/src/mockOS/hooks/useMockIap.ts +11 -0
  182. package/src/mockOS/index.ts +7 -0
  183. package/src/mockOS/managers/mockOSIapManager.ts +10 -0
  184. package/src/mockOS/managers/subscriptionManager.ts +36 -0
  185. package/src/modals/IconPickerModal.tsx +1 -1
  186. package/src/pages/ProjectDebug.tsx +331 -0
  187. package/src/pages/ProjectMigrationPage.tsx +92 -0
  188. package/src/pages/ProjectPage.tsx +318 -166
  189. package/src/pages/ProjectValidationPage.tsx +54 -0
  190. package/src/styles/base/_global.scss +58 -11
  191. package/src/styles/components/_attributes-editor.scss +1 -1
  192. package/src/styles/components/_bottom-bar.scss +7 -4
  193. package/src/styles/components/_editor-shell.scss +126 -4
  194. package/src/styles/components/_mockos-router.scss +3 -2
  195. package/src/styles/components/_ui-components.scss +10 -5
  196. package/src/styles/foundation/_colors.scss +78 -11
  197. package/src/styles/foundation/_mixins.scss +4 -1
  198. package/src/styles/foundation/_sizes.scss +4 -2
  199. package/src/styles/index.scss +1 -0
  200. package/src/styles/layout/_builder.scss +61 -0
  201. package/src/styles/layout/_project-validation.scss +214 -0
  202. package/src/styles/modals/_add-component.scss +4 -2
  203. package/src/styles/modals/_color-modal.scss +4 -2
  204. package/src/styles/modals/_modal-shell.scss +3 -1
  205. package/src/types/Device.ts +5 -0
  206. package/src/utils/__special_exceptions.ts +88 -0
  207. package/src/utils/analyseNode.ts +8 -2
  208. package/src/utils/analyseNodeByPatterns.ts +43 -9
  209. package/src/utils/extractTextStyle.ts +19 -6
  210. package/src/utils/extractViewStyle.ts +68 -59
  211. package/src/utils/getImage.ts +76 -0
  212. package/src/utils/novaToJson.ts +2 -1
  213. package/src/utils/pasteNode.ts +172 -0
  214. package/src/utils/patterns.ts +4 -3
  215. package/dist/android.svg +0 -43
  216. package/dist/apple.svg +0 -16
  217. package/dist/background.jpg +0 -0
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardButton",
6
5
  "children": "never",
@@ -39,10 +38,12 @@
39
38
  }
40
39
  },
41
40
  "meta": {
42
- "desiredParent": ["=OnboardButtons"],
41
+ "desiredParent": [
42
+ "=OnboardButtons"
43
+ ],
43
44
  "label": "Onboard Button",
44
45
  "description": "Single action button for onboarding.",
45
- "attributes": {
46
+ "styles": {
46
47
  "labelKey": {
47
48
  "label": "Label Key",
48
49
  "description": "Localization key for the button text.",
@@ -27,6 +27,7 @@ export type ConditionOptionType = 'carousel-index';
27
27
  export interface OnboardButtonsPropsGenerated {
28
28
  child: string;
29
29
  attributes: {
30
+ style?: Record<string, unknown>;
30
31
  scrollable?: boolean;
31
32
  flexDirection?: FlexDirectionOptionType;
32
33
  alignItems?: AlignItemsOptionType;
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardButtons",
6
5
  "children": "node",
@@ -25,10 +24,12 @@
25
24
  }
26
25
  },
27
26
  "meta": {
28
- "desiredParent": ["=OnboardItem"],
27
+ "desiredParent": [
28
+ "=OnboardItem"
29
+ ],
29
30
  "label": "Onboard Buttons",
30
31
  "description": "Wrapper for onboarding button set.",
31
- "attributes": {
32
+ "styles": {
32
33
  "buttonType": {
33
34
  "label": "Button Type",
34
35
  "description": "Which onboard button to show.",
@@ -14,6 +14,7 @@ export type DotTypeOptionType =
14
14
  export interface OnboardDotPropsGenerated {
15
15
  child: string;
16
16
  attributes: {
17
+ style?: Record<string, unknown>;
17
18
  scrollable?: boolean;
18
19
  flexDirection?: never;
19
20
  alignItems?: never;
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardDot",
6
5
  "children": "never",
@@ -23,10 +22,12 @@
23
22
  }
24
23
  },
25
24
  "meta": {
26
- "desiredParent": [">OnboardProvider"],
25
+ "desiredParent": [
26
+ ">OnboardProvider"
27
+ ],
27
28
  "label": "Onboard Dot",
28
29
  "description": "Renders onboarding progress dots.",
29
- "attributes": {
30
+ "styles": {
30
31
  "dotType": {
31
32
  "label": "Dot Type",
32
33
  "description": "Dot animation style.",
@@ -34,10 +34,13 @@ export type PositionOptionType = 'relative' | 'absolute';
34
34
  export interface OnboardFooterPropsGenerated {
35
35
  child: string;
36
36
  attributes: {
37
+ style?: Record<string, unknown>;
37
38
  color?: string;
38
39
  fontSize?: string;
39
40
  fontWeight?: FontWeightOptionType;
40
41
  textAlign?: TextAlignOptionType;
42
+ adjustsFontSizeToFit?: boolean;
43
+ showEllipsis?: boolean;
41
44
  scrollable?: boolean;
42
45
  flexDirection?: FlexDirectionOptionType;
43
46
  alignItems?: AlignItemsOptionType;
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardFooter",
6
5
  "children": "node",
@@ -16,13 +15,17 @@
16
15
  }
17
16
  },
18
17
  "defaults": {
19
- "paddingHorizontal": "24@s"
18
+ "style": {
19
+ "paddingHorizontal": "24@s"
20
+ }
20
21
  },
21
22
  "meta": {
22
- "desiredParent": [">OnboardItem"],
23
+ "desiredParent": [
24
+ ">OnboardItem"
25
+ ],
23
26
  "label": "Onboard Footer",
24
27
  "description": "Footer text with optional links.",
25
- "attributes": {
28
+ "styles": {
26
29
  "textLocalizationKey": {
27
30
  "label": "Text Localization Key",
28
31
  "description": "Localization key for the footer text.",
@@ -22,6 +22,7 @@ export type PositionOptionType = 'relative' | 'absolute';
22
22
  export interface OnboardImagePropsGenerated {
23
23
  child: string;
24
24
  attributes: {
25
+ style?: Record<string, unknown>;
25
26
  src?: string;
26
27
  width?: string;
27
28
  height?: string;
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardImage",
6
5
  "children": "node",
@@ -11,10 +10,14 @@
11
10
  }
12
11
  },
13
12
  "meta": {
14
- "desiredParent": [">OnboardProvider", ">OnboardItem", "!=Onboard"],
13
+ "desiredParent": [
14
+ ">OnboardProvider",
15
+ ">OnboardItem",
16
+ "!=Onboard"
17
+ ],
15
18
  "label": "Onboard Image",
16
19
  "description": "Onboarding hero image with media.",
17
- "attributes": {
20
+ "styles": {
18
21
  "video_url": {
19
22
  "label": "Video Url",
20
23
  "description": "URL for the onboarding video.",
@@ -22,6 +22,7 @@ export type DisplayOptionType = 'flex' | 'block';
22
22
  export interface OnboardItemPropsGenerated {
23
23
  child: string;
24
24
  attributes: {
25
+ style?: Record<string, unknown>;
25
26
  scrollable?: boolean;
26
27
  flexDirection?: FlexDirectionOptionType;
27
28
  alignItems?: AlignItemsOptionType;
@@ -1,28 +1,37 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardItem",
6
5
  "children": "node",
7
6
  "extends": "View",
8
7
  "attributes": {
9
- "display": ["flex", "block"],
8
+ "display": [
9
+ "flex",
10
+ "block"
11
+ ],
10
12
  "gap": "size",
11
- "flexDirection": ["row", "column"],
13
+ "flexDirection": [
14
+ "row",
15
+ "column"
16
+ ],
12
17
  "paddingHorizontal": "size"
13
18
  }
14
19
  },
15
20
  "defaults": {
16
- "gap": "16@vs",
17
21
  "display": "flex",
18
- "flexDirection": "column",
19
- "paddingHorizontal": "24@s"
22
+ "style": {
23
+ "gap": "16@vs",
24
+ "flexDirection": "column",
25
+ "paddingHorizontal": "24@s"
26
+ }
20
27
  },
21
28
  "meta": {
22
- "desiredParent": ["=Onboard"],
29
+ "desiredParent": [
30
+ "=Onboard"
31
+ ],
23
32
  "label": "Onboard Item",
24
33
  "description": "Single onboarding screen section.",
25
- "attributes": {
34
+ "styles": {
26
35
  "display": {
27
36
  "label": "Display",
28
37
  "description": "Controls layout display mode.",
@@ -17,10 +17,12 @@ export type JustifyContentOptionType =
17
17
  | 'space-around'
18
18
  | 'space-evenly';
19
19
  export type PositionOptionType = 'relative' | 'absolute';
20
+ export type ThemeOptionType = 'light' | 'dark' | 'all';
20
21
 
21
22
  export interface OnboardProviderPropsGenerated {
22
23
  child: string;
23
24
  attributes: {
25
+ style?: Record<string, unknown>;
24
26
  scrollable?: boolean;
25
27
  flexDirection?: FlexDirectionOptionType;
26
28
  alignItems?: AlignItemsOptionType;
@@ -54,6 +56,7 @@ export interface OnboardProviderPropsGenerated {
54
56
  left?: string;
55
57
  right?: string;
56
58
  zIndex?: number;
59
+ theme?: ThemeOptionType;
57
60
  };
58
61
  }
59
62
 
@@ -1,23 +1,38 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardProvider",
6
5
  "children": "node",
7
6
  "extends": "View",
8
7
  "attributes": {
8
+ "theme": [
9
+ "light",
10
+ "dark",
11
+ "all"
12
+ ],
9
13
  "borderRadius": "never"
10
14
  }
11
15
  },
12
16
  "defaults": {
13
- "width": "100%",
14
- "height": "100%"
17
+ "style": {
18
+ "width": "100%",
19
+ "height": "100%"
20
+ }
15
21
  },
16
22
  "meta": {
17
- "desiredParent": ["root"],
23
+ "desiredParent": [
24
+ "root"
25
+ ],
18
26
  "label": "Onboard Provider",
19
27
  "description": "Provides shared settings for onboarding.",
20
- "attributes": {
28
+ "styles": {
29
+ "theme": {
30
+ "label": "Theme",
31
+ "description": "Controls which app theme(s) this onboarding is intended for.",
32
+ "category": "other",
33
+ "specialCategory": null,
34
+ "sort": -10
35
+ },
21
36
  "paddingTop": {
22
37
  "label": "Padding Top",
23
38
  "description": "Top padding for the provider.",
@@ -34,10 +34,13 @@ export type PositionOptionType = 'relative' | 'absolute';
34
34
  export interface OnboardSubtitlePropsGenerated {
35
35
  child: string;
36
36
  attributes: {
37
+ style?: Record<string, unknown>;
37
38
  color?: string;
38
39
  fontSize?: string;
39
40
  fontWeight?: FontWeightOptionType;
40
41
  textAlign?: TextAlignOptionType;
42
+ adjustsFontSizeToFit?: boolean;
43
+ showEllipsis?: boolean;
41
44
  scrollable?: boolean;
42
45
  flexDirection?: FlexDirectionOptionType;
43
46
  alignItems?: AlignItemsOptionType;
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardSubtitle",
6
5
  "children": "string",
@@ -8,13 +7,18 @@
8
7
  "attributes": {}
9
8
  },
10
9
  "defaults": {
11
- "fontSize": "14@fs",
12
- "fontWeight": "600"
10
+ "style": {
11
+ "fontSize": "14@fs",
12
+ "fontWeight": "600"
13
+ }
13
14
  },
14
15
  "meta": {
15
- "desiredParent": [">OnboardProvider", ">OnboardItem"],
16
+ "desiredParent": [
17
+ ">OnboardProvider",
18
+ ">OnboardItem"
19
+ ],
16
20
  "label": "Onboard Subtitle",
17
21
  "description": "Subtitle text for an onboarding step.",
18
- "attributes": {}
22
+ "styles": {}
19
23
  }
20
24
  }
@@ -34,10 +34,13 @@ export type PositionOptionType = 'relative' | 'absolute';
34
34
  export interface OnboardTitlePropsGenerated {
35
35
  child: string;
36
36
  attributes: {
37
+ style?: Record<string, unknown>;
37
38
  color?: string;
38
39
  fontSize?: string;
39
40
  fontWeight?: FontWeightOptionType;
40
41
  textAlign?: TextAlignOptionType;
42
+ adjustsFontSizeToFit?: boolean;
43
+ showEllipsis?: boolean;
41
44
  scrollable?: boolean;
42
45
  flexDirection?: FlexDirectionOptionType;
43
46
  alignItems?: AlignItemsOptionType;
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": false,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "OnboardTitle",
6
5
  "children": "string",
@@ -8,14 +7,19 @@
8
7
  "attributes": {}
9
8
  },
10
9
  "defaults": {
11
- "fontSize": "24@fs",
12
- "fontWeight": "700",
13
- "textAlign": "center"
10
+ "style": {
11
+ "fontSize": "24@fs",
12
+ "fontWeight": "700",
13
+ "textAlign": "center"
14
+ }
14
15
  },
15
16
  "meta": {
16
- "desiredParent": [">OnboardItem", ">OnboardProvider"],
17
+ "desiredParent": [
18
+ ">OnboardItem",
19
+ ">OnboardProvider"
20
+ ],
17
21
  "label": "Onboard Title",
18
22
  "description": "Title text for an onboarding step.",
19
- "attributes": {}
23
+ "styles": {}
20
24
  }
21
25
  }
@@ -21,6 +21,7 @@ export type PositionOptionType = 'relative' | 'absolute';
21
21
  export interface PaywallBackgroundPropsGenerated {
22
22
  child: string;
23
23
  attributes: {
24
+ style?: Record<string, unknown>;
24
25
  scrollable?: boolean;
25
26
  flexDirection?: FlexDirectionOptionType;
26
27
  alignItems?: AlignItemsOptionType;
@@ -54,7 +55,6 @@ export interface PaywallBackgroundPropsGenerated {
54
55
  left?: string;
55
56
  right?: string;
56
57
  zIndex?: number;
57
- [key: string]: string | number | boolean | undefined;
58
58
  };
59
59
  }
60
60
 
@@ -1,6 +1,5 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": true,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "PaywallBackground",
6
5
  "children": "never",
@@ -8,9 +7,11 @@
8
7
  "attributes": {}
9
8
  },
10
9
  "meta": {
11
- "desiredParent": [">PaywallProvider"],
10
+ "desiredParent": [
11
+ ">PaywallProvider"
12
+ ],
12
13
  "label": "Paywall Background",
13
14
  "description": "Paywall Background component.",
14
- "attributes": {}
15
+ "styles": {}
15
16
  }
16
17
  }
@@ -8,10 +8,12 @@ import { isNodeSelected, SELECTED_OUTLINE_STYLE } from '../../utils/selection';
8
8
  import { useMergedStyle } from '../../utils/useMergedStyle';
9
9
  import { Icon } from '../../components/Icon.generated';
10
10
  import { IconsType } from '../../types/Icons';
11
+ import { usePaywallContext } from '../PaywallProvider/PaywallContext';
11
12
 
12
13
  function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
13
14
  useLogRender('PaywallCloseButton');
14
15
  node = useNode(node);
16
+ const { onClose } = usePaywallContext();
15
17
 
16
18
  const generatedId = useId();
17
19
  const attributeName =
@@ -50,7 +52,10 @@ function PaywallCloseButton({ node }: PaywallCloseButtonComponentProps) {
50
52
  attribute-name={attributeName}
51
53
  attribute-key={attributeKey}
52
54
  href="#"
53
- onClick={(e) => e.preventDefault()}
55
+ onClick={(e) => {
56
+ e.preventDefault();
57
+ onClose?.();
58
+ }}
54
59
  aria-label="Close"
55
60
  style={{ ...style, cursor: 'pointer', textDecoration: 'none' }}
56
61
  >
@@ -34,6 +34,7 @@ export type PositionOptionType = 'relative' | 'absolute';
34
34
  export interface PaywallCloseButtonPropsGenerated {
35
35
  child: string;
36
36
  attributes: {
37
+ style?: Record<string, unknown>;
37
38
  iconType?: string;
38
39
  size?: number;
39
40
  strokeWidth?: number;
@@ -41,6 +42,8 @@ export interface PaywallCloseButtonPropsGenerated {
41
42
  fontSize?: string;
42
43
  fontWeight?: FontWeightOptionType;
43
44
  textAlign?: TextAlignOptionType;
45
+ adjustsFontSizeToFit?: boolean;
46
+ showEllipsis?: boolean;
44
47
  scrollable?: boolean;
45
48
  flexDirection?: FlexDirectionOptionType;
46
49
  alignItems?: AlignItemsOptionType;
@@ -74,7 +77,6 @@ export interface PaywallCloseButtonPropsGenerated {
74
77
  left?: string;
75
78
  right?: string;
76
79
  zIndex?: number;
77
- [key: string]: string | number | boolean | undefined;
78
80
  };
79
81
  }
80
82
 
@@ -1,23 +1,26 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": true,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "PaywallCloseButton",
6
5
  "children": "never",
7
6
  "extends": "BIcon",
8
- "attributes": {},
9
- "defaults": {
10
- "iconType": "close",
11
- "size": 24,
12
- "flexDirection": "row",
13
- "justifyContent": "center",
14
- "alignItems": "center"
15
- }
7
+ "attributes": {}
16
8
  },
17
9
  "meta": {
18
- "desiredParent": [">PaywallProvider"],
10
+ "desiredParent": [
11
+ ">PaywallProvider"
12
+ ],
19
13
  "label": "Paywall Close Button",
20
14
  "description": "Paywall Close Button component.",
21
- "attributes": {}
15
+ "styles": {}
16
+ },
17
+ "defaults": {
18
+ "iconType": "close",
19
+ "size": 24,
20
+ "style": {
21
+ "flexDirection": "row",
22
+ "justifyContent": "center",
23
+ "alignItems": "center"
24
+ }
22
25
  }
23
26
  }
@@ -36,7 +36,6 @@ export function PaywallOptionButton({
36
36
  () => extractViewStyle(node, { appConfig, projectColors }),
37
37
  [node, appConfig, projectColors],
38
38
  );
39
- console.log('-->', { node, baseStyle });
40
39
 
41
40
  const isSelected = isNodeSelected({ previewMode, current, node });
42
41
 
@@ -1,4 +1,4 @@
1
- import React, { useId, useMemo, useState } from 'react';
1
+ import React, { useId, useMemo } from 'react';
2
2
  import type { PaywallOptionsComponentProps } from './PaywallOptionsProps.generated';
3
3
  import useNode from '../useNode';
4
4
  import { useLogRender } from '../../utils/useLogRender';
@@ -7,6 +7,7 @@ import { ParamsProvider } from '../../components/ParamsProvider';
7
7
  import type { Product } from '../../paywall/types/paywall-types';
8
8
  import { PaywallOptionButton } from './PaywallOptionButton';
9
9
  import { usePaywallOptionParamsFactory } from './usePaywallOptionParamsFactory';
10
+ import { usePaywallContext } from '../PaywallProvider/PaywallContext';
10
11
 
11
12
  function parseNumberLike(value: unknown): number | undefined {
12
13
  if (value === null || value === undefined) return undefined;
@@ -51,7 +52,7 @@ function PaywallOptions({ node }: PaywallOptionsComponentProps) {
51
52
  useLogRender('PaywallOptions');
52
53
  node = useNode(node);
53
54
  const { products } = useBuilderParams();
54
- const [selectedProductId, setSelectedProductId] = useState<string>('');
55
+ const { selectedProductId, setSelectedProductId } = usePaywallContext();
55
56
  const getParamsForProduct = usePaywallOptionParamsFactory();
56
57
 
57
58
  const sortedProducts = useMemo(() => {
@@ -21,6 +21,7 @@ export type PositionOptionType = 'relative' | 'absolute';
21
21
  export interface PaywallOptionsPropsGenerated {
22
22
  child: string;
23
23
  attributes: {
24
+ style?: Record<string, unknown>;
24
25
  scrollable?: boolean;
25
26
  flexDirection?: FlexDirectionOptionType;
26
27
  alignItems?: AlignItemsOptionType;
@@ -54,7 +55,6 @@ export interface PaywallOptionsPropsGenerated {
54
55
  left?: string;
55
56
  right?: string;
56
57
  zIndex?: number;
57
- [key: string]: string | number | boolean | undefined;
58
58
  };
59
59
  }
60
60
 
@@ -1,22 +1,25 @@
1
1
  {
2
- "schemaVersion": 1,
3
- "allowUnknownAttributes": true,
2
+ "schemaVersion": 2,
4
3
  "pattern": {
5
4
  "type": "PaywallOptions",
6
5
  "extends": "View",
7
- "children": ["node", "array"],
8
- "attributes": {},
9
- "defaults": {
6
+ "children": "node",
7
+ "attributes": {}
8
+ },
9
+ "meta": {
10
+ "desiredParent": [
11
+ ">PaywallProvider"
12
+ ],
13
+ "label": "Paywall Options",
14
+ "description": "Paywall options selector component.",
15
+ "styles": {}
16
+ },
17
+ "defaults": {
18
+ "style": {
10
19
  "flexDirection": "row",
11
20
  "justifyContent": "space-between",
12
21
  "alignItems": "center",
13
22
  "minHeight": "60px"
14
23
  }
15
- },
16
- "meta": {
17
- "desiredParent": [">PaywallProvider"],
18
- "label": "Paywall Options",
19
- "description": "Paywall options selector component.",
20
- "attributes": {}
21
24
  }
22
25
  }
@@ -0,0 +1,25 @@
1
+ import React, { createContext, useContext } from 'react';
2
+ import type { Product } from '../../paywall/types/paywall-types';
3
+
4
+ export type PaywallContextValue = {
5
+ products: Product[];
6
+ selectedProductId: string;
7
+ setSelectedProductId: (productId: string) => void;
8
+ selectedProduct?: Product;
9
+ onClose?: () => void;
10
+ onSubscribe?: (product?: Product) => void | boolean | Promise<boolean>;
11
+ };
12
+
13
+ export const PaywallContext = createContext<PaywallContextValue | undefined>(
14
+ undefined,
15
+ );
16
+
17
+ export function usePaywallContext(): PaywallContextValue {
18
+ return (
19
+ useContext(PaywallContext) ?? {
20
+ products: [],
21
+ selectedProductId: '',
22
+ setSelectedProductId: () => {},
23
+ }
24
+ );
25
+ }