@rocapine/react-native-onboarding 1.59.2 → 1.61.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 (267) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/infra/navigation/expoRouterAdapter.js +1 -1
  6. package/dist/infra/navigation/expoRouterAdapter.js.map +1 -1
  7. package/dist/infra/provider/OnboardingProvider.d.ts +12 -1
  8. package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
  9. package/dist/infra/provider/OnboardingProvider.js +15 -1
  10. package/dist/infra/provider/OnboardingProvider.js.map +1 -1
  11. package/dist/products/adapters/expoIap.d.ts +4 -0
  12. package/dist/products/adapters/expoIap.d.ts.map +1 -0
  13. package/dist/products/adapters/expoIap.js +95 -0
  14. package/dist/products/adapters/expoIap.js.map +1 -0
  15. package/dist/products/adapters/revenueCat.d.ts +7 -0
  16. package/dist/products/adapters/revenueCat.d.ts.map +1 -0
  17. package/dist/products/adapters/revenueCat.js +116 -0
  18. package/dist/products/adapters/revenueCat.js.map +1 -0
  19. package/dist/products/adapters/stub.d.ts +8 -0
  20. package/dist/products/adapters/stub.d.ts.map +1 -0
  21. package/dist/products/adapters/stub.js +21 -0
  22. package/dist/products/adapters/stub.js.map +1 -0
  23. package/dist/products/derive.d.ts +19 -0
  24. package/dist/products/derive.d.ts.map +1 -0
  25. package/dist/products/derive.js +79 -0
  26. package/dist/products/derive.js.map +1 -0
  27. package/dist/products/duration.d.ts +3 -0
  28. package/dist/products/duration.d.ts.map +1 -0
  29. package/dist/products/duration.js +25 -0
  30. package/dist/products/duration.js.map +1 -0
  31. package/dist/products/index.d.ts +9 -0
  32. package/dist/products/index.d.ts.map +1 -0
  33. package/dist/products/index.js +20 -0
  34. package/dist/products/index.js.map +1 -0
  35. package/dist/products/toVariables.d.ts +18 -0
  36. package/dist/products/toVariables.d.ts.map +1 -0
  37. package/dist/products/toVariables.js +52 -0
  38. package/dist/products/toVariables.js.map +1 -0
  39. package/dist/products/types.d.ts +96 -0
  40. package/dist/products/types.d.ts.map +1 -0
  41. package/dist/products/types.js +3 -0
  42. package/dist/products/types.js.map +1 -0
  43. package/dist/products/useProducts.d.ts +12 -0
  44. package/dist/products/useProducts.d.ts.map +1 -0
  45. package/dist/products/useProducts.js +90 -0
  46. package/dist/products/useProducts.js.map +1 -0
  47. package/dist/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.d.ts +1 -24
  48. package/dist/screens/elements/AnimatedTextElement.d.ts.map +1 -0
  49. package/dist/screens/elements/AnimatedTextElement.js.map +1 -0
  50. package/dist/{steps/ComposableScreen → screens}/elements/BaseBoxProps.d.ts +2 -25
  51. package/dist/screens/elements/BaseBoxProps.d.ts.map +1 -0
  52. package/dist/{steps/ComposableScreen → screens}/elements/BaseBoxProps.js +1 -1
  53. package/dist/screens/elements/BaseBoxProps.js.map +1 -0
  54. package/dist/{steps/ComposableScreen → screens}/elements/ButtonElement.d.ts +8 -123
  55. package/dist/screens/elements/ButtonElement.d.ts.map +1 -0
  56. package/dist/{steps/ComposableScreen → screens}/elements/ButtonElement.js +2 -2
  57. package/dist/screens/elements/ButtonElement.js.map +1 -0
  58. package/dist/{steps/ComposableScreen → screens}/elements/CarouselElement.d.ts +1 -24
  59. package/dist/screens/elements/CarouselElement.d.ts.map +1 -0
  60. package/dist/screens/elements/CarouselElement.js.map +1 -0
  61. package/dist/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.d.ts +2 -25
  62. package/dist/screens/elements/CheckboxGroupElement.d.ts.map +1 -0
  63. package/dist/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.js +1 -1
  64. package/dist/screens/elements/CheckboxGroupElement.js.map +1 -0
  65. package/dist/{steps/ComposableScreen → screens}/elements/DatePickerElement.d.ts +1 -24
  66. package/dist/screens/elements/DatePickerElement.d.ts.map +1 -0
  67. package/dist/screens/elements/DatePickerElement.js.map +1 -0
  68. package/dist/{steps/ComposableScreen → screens}/elements/DrawingPadElement.d.ts +1 -24
  69. package/dist/screens/elements/DrawingPadElement.d.ts.map +1 -0
  70. package/dist/screens/elements/DrawingPadElement.js.map +1 -0
  71. package/dist/{steps/ComposableScreen → screens}/elements/IconElement.d.ts +1 -24
  72. package/dist/screens/elements/IconElement.d.ts.map +1 -0
  73. package/dist/screens/elements/IconElement.js.map +1 -0
  74. package/dist/{steps/ComposableScreen → screens}/elements/ImageElement.d.ts +1 -24
  75. package/dist/screens/elements/ImageElement.d.ts.map +1 -0
  76. package/dist/screens/elements/ImageElement.js.map +1 -0
  77. package/dist/{steps/ComposableScreen → screens}/elements/InputElement.d.ts +1 -24
  78. package/dist/screens/elements/InputElement.d.ts.map +1 -0
  79. package/dist/screens/elements/InputElement.js.map +1 -0
  80. package/dist/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.d.ts +1 -24
  81. package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts.map +1 -0
  82. package/dist/screens/elements/KeyboardAvoidingViewElement.js.map +1 -0
  83. package/dist/{steps/ComposableScreen → screens}/elements/LottieElement.d.ts +1 -24
  84. package/dist/screens/elements/LottieElement.d.ts.map +1 -0
  85. package/dist/screens/elements/LottieElement.js.map +1 -0
  86. package/dist/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.d.ts +1 -24
  87. package/dist/screens/elements/ProgressIndicatorElement.d.ts.map +1 -0
  88. package/dist/screens/elements/ProgressIndicatorElement.js.map +1 -0
  89. package/dist/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.d.ts +1 -24
  90. package/dist/screens/elements/ProgressiveBlurImageElement.d.ts.map +1 -0
  91. package/dist/screens/elements/ProgressiveBlurImageElement.js.map +1 -0
  92. package/dist/{steps/ComposableScreen → screens}/elements/RadioGroupElement.d.ts +2 -25
  93. package/dist/screens/elements/RadioGroupElement.d.ts.map +1 -0
  94. package/dist/{steps/ComposableScreen → screens}/elements/RadioGroupElement.js +1 -1
  95. package/dist/screens/elements/RadioGroupElement.js.map +1 -0
  96. package/dist/{steps/ComposableScreen → screens}/elements/RichTextElement.d.ts +1 -24
  97. package/dist/screens/elements/RichTextElement.d.ts.map +1 -0
  98. package/dist/screens/elements/RichTextElement.js.map +1 -0
  99. package/dist/{steps/ComposableScreen → screens}/elements/RiveElement.d.ts +1 -24
  100. package/dist/screens/elements/RiveElement.d.ts.map +1 -0
  101. package/dist/screens/elements/RiveElement.js.map +1 -0
  102. package/dist/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.d.ts +1 -24
  103. package/dist/screens/elements/SafeAreaViewElement.d.ts.map +1 -0
  104. package/dist/screens/elements/SafeAreaViewElement.js.map +1 -0
  105. package/dist/{steps/ComposableScreen → screens}/elements/ScrollViewElement.d.ts +1 -24
  106. package/dist/screens/elements/ScrollViewElement.d.ts.map +1 -0
  107. package/dist/screens/elements/ScrollViewElement.js.map +1 -0
  108. package/dist/{steps/ComposableScreen → screens}/elements/SliderElement.d.ts +1 -24
  109. package/dist/screens/elements/SliderElement.d.ts.map +1 -0
  110. package/dist/screens/elements/SliderElement.js.map +1 -0
  111. package/dist/{steps/ComposableScreen → screens}/elements/StackElement.d.ts +1 -24
  112. package/dist/screens/elements/StackElement.d.ts.map +1 -0
  113. package/dist/screens/elements/StackElement.js.map +1 -0
  114. package/dist/{steps/ComposableScreen → screens}/elements/TextElement.d.ts +1 -24
  115. package/dist/screens/elements/TextElement.d.ts.map +1 -0
  116. package/dist/screens/elements/TextElement.js.map +1 -0
  117. package/dist/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.d.ts +1 -24
  118. package/dist/screens/elements/TypewriterTextElement.d.ts.map +1 -0
  119. package/dist/screens/elements/TypewriterTextElement.js.map +1 -0
  120. package/dist/{steps/ComposableScreen → screens}/elements/VideoElement.d.ts +1 -24
  121. package/dist/screens/elements/VideoElement.d.ts.map +1 -0
  122. package/dist/screens/elements/VideoElement.js.map +1 -0
  123. package/dist/{steps/ComposableScreen → screens}/elements/WheelPickerElement.d.ts +1 -24
  124. package/dist/screens/elements/WheelPickerElement.d.ts.map +1 -0
  125. package/dist/screens/elements/WheelPickerElement.js.map +1 -0
  126. package/dist/{steps/ComposableScreen → screens}/elements/ZStackElement.d.ts +1 -24
  127. package/dist/screens/elements/ZStackElement.d.ts.map +1 -0
  128. package/dist/screens/elements/ZStackElement.js.map +1 -0
  129. package/dist/screens/types.d.ts +242 -0
  130. package/dist/screens/types.d.ts.map +1 -0
  131. package/dist/screens/types.js +272 -0
  132. package/dist/screens/types.js.map +1 -0
  133. package/dist/steps/Carousel/types.d.ts +1 -1
  134. package/dist/steps/Commitment/types.d.ts +1 -1
  135. package/dist/steps/ComposableScreen/types.d.ts +5 -236
  136. package/dist/steps/ComposableScreen/types.d.ts.map +1 -1
  137. package/dist/steps/ComposableScreen/types.js +23 -262
  138. package/dist/steps/ComposableScreen/types.js.map +1 -1
  139. package/dist/steps/Loader/types.d.ts +1 -1
  140. package/dist/steps/MediaContent/types.d.ts +1 -1
  141. package/dist/steps/Picker/types.d.ts +1 -1
  142. package/dist/steps/Question/types.d.ts +1 -1
  143. package/dist/steps/Ratings/types.d.ts +1 -1
  144. package/dist/steps/common.types.d.ts +23 -30
  145. package/dist/steps/common.types.d.ts.map +1 -1
  146. package/dist/steps/common.types.js +18 -3
  147. package/dist/steps/common.types.js.map +1 -1
  148. package/package.json +3 -3
  149. package/src/__tests__/productAdapters.test.ts +58 -0
  150. package/src/__tests__/productDerive.test.ts +111 -0
  151. package/src/__tests__/productVariables.test.ts +109 -0
  152. package/src/__tests__/screenTypesBackCompat.test.ts +58 -0
  153. package/src/index.ts +2 -0
  154. package/src/infra/navigation/expoRouterAdapter.ts +1 -1
  155. package/src/infra/provider/OnboardingProvider.tsx +29 -0
  156. package/src/products/adapters/expoIap.ts +93 -0
  157. package/src/products/adapters/revenueCat.ts +108 -0
  158. package/src/products/adapters/stub.ts +20 -0
  159. package/src/products/derive.ts +93 -0
  160. package/src/products/duration.ts +21 -0
  161. package/src/products/index.ts +19 -0
  162. package/src/products/toVariables.ts +54 -0
  163. package/src/products/types.ts +88 -0
  164. package/src/products/useProducts.ts +106 -0
  165. package/src/{steps/ComposableScreen → screens}/elements/BaseBoxProps.ts +1 -1
  166. package/src/{steps/ComposableScreen → screens}/elements/ButtonElement.ts +2 -2
  167. package/src/{steps/ComposableScreen → screens}/elements/CheckboxGroupElement.ts +1 -1
  168. package/src/{steps/ComposableScreen → screens}/elements/RadioGroupElement.ts +1 -1
  169. package/src/screens/types.ts +535 -0
  170. package/src/steps/ComposableScreen/types.ts +9 -528
  171. package/src/steps/common.types.ts +50 -6
  172. package/dist/steps/ComposableScreen/elements/AnimatedTextElement.d.ts.map +0 -1
  173. package/dist/steps/ComposableScreen/elements/AnimatedTextElement.js.map +0 -1
  174. package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +0 -1
  175. package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +0 -1
  176. package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +0 -1
  177. package/dist/steps/ComposableScreen/elements/ButtonElement.js.map +0 -1
  178. package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts.map +0 -1
  179. package/dist/steps/ComposableScreen/elements/CarouselElement.js.map +0 -1
  180. package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +0 -1
  181. package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.js.map +0 -1
  182. package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts.map +0 -1
  183. package/dist/steps/ComposableScreen/elements/DatePickerElement.js.map +0 -1
  184. package/dist/steps/ComposableScreen/elements/DrawingPadElement.d.ts.map +0 -1
  185. package/dist/steps/ComposableScreen/elements/DrawingPadElement.js.map +0 -1
  186. package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +0 -1
  187. package/dist/steps/ComposableScreen/elements/IconElement.js.map +0 -1
  188. package/dist/steps/ComposableScreen/elements/ImageElement.d.ts.map +0 -1
  189. package/dist/steps/ComposableScreen/elements/ImageElement.js.map +0 -1
  190. package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +0 -1
  191. package/dist/steps/ComposableScreen/elements/InputElement.js.map +0 -1
  192. package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts.map +0 -1
  193. package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.js.map +0 -1
  194. package/dist/steps/ComposableScreen/elements/LottieElement.d.ts.map +0 -1
  195. package/dist/steps/ComposableScreen/elements/LottieElement.js.map +0 -1
  196. package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.d.ts.map +0 -1
  197. package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.js.map +0 -1
  198. package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.d.ts.map +0 -1
  199. package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.js.map +0 -1
  200. package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +0 -1
  201. package/dist/steps/ComposableScreen/elements/RadioGroupElement.js.map +0 -1
  202. package/dist/steps/ComposableScreen/elements/RichTextElement.d.ts.map +0 -1
  203. package/dist/steps/ComposableScreen/elements/RichTextElement.js.map +0 -1
  204. package/dist/steps/ComposableScreen/elements/RiveElement.d.ts.map +0 -1
  205. package/dist/steps/ComposableScreen/elements/RiveElement.js.map +0 -1
  206. package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +0 -1
  207. package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.js.map +0 -1
  208. package/dist/steps/ComposableScreen/elements/ScrollViewElement.d.ts.map +0 -1
  209. package/dist/steps/ComposableScreen/elements/ScrollViewElement.js.map +0 -1
  210. package/dist/steps/ComposableScreen/elements/SliderElement.d.ts.map +0 -1
  211. package/dist/steps/ComposableScreen/elements/SliderElement.js.map +0 -1
  212. package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +0 -1
  213. package/dist/steps/ComposableScreen/elements/StackElement.js.map +0 -1
  214. package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +0 -1
  215. package/dist/steps/ComposableScreen/elements/TextElement.js.map +0 -1
  216. package/dist/steps/ComposableScreen/elements/TypewriterTextElement.d.ts.map +0 -1
  217. package/dist/steps/ComposableScreen/elements/TypewriterTextElement.js.map +0 -1
  218. package/dist/steps/ComposableScreen/elements/VideoElement.d.ts.map +0 -1
  219. package/dist/steps/ComposableScreen/elements/VideoElement.js.map +0 -1
  220. package/dist/steps/ComposableScreen/elements/WheelPickerElement.d.ts.map +0 -1
  221. package/dist/steps/ComposableScreen/elements/WheelPickerElement.js.map +0 -1
  222. package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts.map +0 -1
  223. package/dist/steps/ComposableScreen/elements/ZStackElement.js.map +0 -1
  224. /package/dist/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.js +0 -0
  225. /package/dist/{steps/ComposableScreen → screens}/elements/CarouselElement.js +0 -0
  226. /package/dist/{steps/ComposableScreen → screens}/elements/DatePickerElement.js +0 -0
  227. /package/dist/{steps/ComposableScreen → screens}/elements/DrawingPadElement.js +0 -0
  228. /package/dist/{steps/ComposableScreen → screens}/elements/IconElement.js +0 -0
  229. /package/dist/{steps/ComposableScreen → screens}/elements/ImageElement.js +0 -0
  230. /package/dist/{steps/ComposableScreen → screens}/elements/InputElement.js +0 -0
  231. /package/dist/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.js +0 -0
  232. /package/dist/{steps/ComposableScreen → screens}/elements/LottieElement.js +0 -0
  233. /package/dist/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.js +0 -0
  234. /package/dist/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.js +0 -0
  235. /package/dist/{steps/ComposableScreen → screens}/elements/RichTextElement.js +0 -0
  236. /package/dist/{steps/ComposableScreen → screens}/elements/RiveElement.js +0 -0
  237. /package/dist/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.js +0 -0
  238. /package/dist/{steps/ComposableScreen → screens}/elements/ScrollViewElement.js +0 -0
  239. /package/dist/{steps/ComposableScreen → screens}/elements/SliderElement.js +0 -0
  240. /package/dist/{steps/ComposableScreen → screens}/elements/StackElement.js +0 -0
  241. /package/dist/{steps/ComposableScreen → screens}/elements/TextElement.js +0 -0
  242. /package/dist/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.js +0 -0
  243. /package/dist/{steps/ComposableScreen → screens}/elements/VideoElement.js +0 -0
  244. /package/dist/{steps/ComposableScreen → screens}/elements/WheelPickerElement.js +0 -0
  245. /package/dist/{steps/ComposableScreen → screens}/elements/ZStackElement.js +0 -0
  246. /package/src/{steps/ComposableScreen → screens}/elements/AnimatedTextElement.ts +0 -0
  247. /package/src/{steps/ComposableScreen → screens}/elements/CarouselElement.ts +0 -0
  248. /package/src/{steps/ComposableScreen → screens}/elements/DatePickerElement.ts +0 -0
  249. /package/src/{steps/ComposableScreen → screens}/elements/DrawingPadElement.ts +0 -0
  250. /package/src/{steps/ComposableScreen → screens}/elements/IconElement.ts +0 -0
  251. /package/src/{steps/ComposableScreen → screens}/elements/ImageElement.ts +0 -0
  252. /package/src/{steps/ComposableScreen → screens}/elements/InputElement.ts +0 -0
  253. /package/src/{steps/ComposableScreen → screens}/elements/KeyboardAvoidingViewElement.ts +0 -0
  254. /package/src/{steps/ComposableScreen → screens}/elements/LottieElement.ts +0 -0
  255. /package/src/{steps/ComposableScreen → screens}/elements/ProgressIndicatorElement.ts +0 -0
  256. /package/src/{steps/ComposableScreen → screens}/elements/ProgressiveBlurImageElement.ts +0 -0
  257. /package/src/{steps/ComposableScreen → screens}/elements/RichTextElement.ts +0 -0
  258. /package/src/{steps/ComposableScreen → screens}/elements/RiveElement.ts +0 -0
  259. /package/src/{steps/ComposableScreen → screens}/elements/SafeAreaViewElement.ts +0 -0
  260. /package/src/{steps/ComposableScreen → screens}/elements/ScrollViewElement.ts +0 -0
  261. /package/src/{steps/ComposableScreen → screens}/elements/SliderElement.ts +0 -0
  262. /package/src/{steps/ComposableScreen → screens}/elements/StackElement.ts +0 -0
  263. /package/src/{steps/ComposableScreen → screens}/elements/TextElement.ts +0 -0
  264. /package/src/{steps/ComposableScreen → screens}/elements/TypewriterTextElement.ts +0 -0
  265. /package/src/{steps/ComposableScreen → screens}/elements/VideoElement.ts +0 -0
  266. /package/src/{steps/ComposableScreen → screens}/elements/WheelPickerElement.ts +0 -0
  267. /package/src/{steps/ComposableScreen → screens}/elements/ZStackElement.ts +0 -0
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { type ButtonAction, ButtonActionSchema } from "../../common.types";
2
+ import { type ButtonAction, ButtonActionSchema } from "../../steps/common.types";
3
3
 
4
4
  export type GradientStop = {
5
5
  color: string;
@@ -9,7 +9,7 @@ import {
9
9
  ConditionGroupSchema,
10
10
  HapticStyleSchema,
11
11
  ButtonActionSchema,
12
- } from "../../common.types";
12
+ } from "../../steps/common.types";
13
13
 
14
14
  // `ButtonAction` and its variants moved to `common.types.ts` (now shared with the
15
15
  // generic `onPress` on BaseBoxProps). Re-exported here for back-compat.
@@ -18,7 +18,7 @@ export {
18
18
  CustomButtonActionSchema,
19
19
  type SetVariableButtonAction,
20
20
  SetVariableButtonActionSchema,
21
- } from "../../common.types";
21
+ } from "../../steps/common.types";
22
22
  export type { ButtonAction };
23
23
  export { ButtonActionSchema };
24
24
 
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseBoxProps, BaseBoxPropsSchema, type ShadowOffset, ShadowOffsetSchema } from "./BaseBoxProps";
3
- import { type HapticStyle, HapticStyleSchema } from "../../common.types";
3
+ import { type HapticStyle, HapticStyleSchema } from "../../steps/common.types";
4
4
 
5
5
  export type CheckboxGroupElementProps = BaseBoxProps & {
6
6
  variableName?: string;
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BaseBoxProps, BaseBoxPropsSchema, type ShadowOffset, ShadowOffsetSchema } from "./BaseBoxProps";
3
- import { type HapticStyle, HapticStyleSchema } from "../../common.types";
3
+ import { type HapticStyle, HapticStyleSchema } from "../../steps/common.types";
4
4
 
5
5
  export type RadioGroupElementProps = BaseBoxProps & {
6
6
  variableName?: string;
@@ -0,0 +1,535 @@
1
+ import { z } from "zod";
2
+ import {
3
+ type LeafCondition,
4
+ type ConditionGroup,
5
+ LeafConditionSchema,
6
+ ConditionGroupSchema,
7
+ } from "../steps/common.types";
8
+ import { type StackElementProps, StackElementPropsSchema } from "./elements/StackElement";
9
+ import { type TextElementProps, TextElementPropsSchema } from "./elements/TextElement";
10
+ import { type RichTextElementProps, RichTextElementPropsSchema } from "./elements/RichTextElement";
11
+ import { type ImageElementProps, ImageElementPropsSchema } from "./elements/ImageElement";
12
+ import {
13
+ type ProgressiveBlurImageElementProps,
14
+ ProgressiveBlurImageElementPropsSchema,
15
+ } from "./elements/ProgressiveBlurImageElement";
16
+ import { type LottieElementProps, LottieElementPropsSchema } from "./elements/LottieElement";
17
+ import { type RiveElementProps, RiveElementPropsSchema } from "./elements/RiveElement";
18
+ import { type IconElementProps, IconElementPropsSchema } from "./elements/IconElement";
19
+ import { type VideoElementProps, VideoElementPropsSchema } from "./elements/VideoElement";
20
+ import { type InputElementProps, InputElementPropsSchema } from "./elements/InputElement";
21
+ import { type ButtonElementProps, ButtonElementPropsSchema } from "./elements/ButtonElement";
22
+ import { type RadioGroupElementProps, RadioGroupElementPropsSchema } from "./elements/RadioGroupElement";
23
+ import { type CheckboxGroupElementProps, CheckboxGroupElementPropsSchema } from "./elements/CheckboxGroupElement";
24
+ import { type DatePickerElementProps, DatePickerElementPropsSchema } from "./elements/DatePickerElement";
25
+ import { type WheelPickerElementProps, WheelPickerElementPropsSchema } from "./elements/WheelPickerElement";
26
+ import { type CarouselElementProps, CarouselElementPropsSchema } from "./elements/CarouselElement";
27
+ import { type ZStackElementProps, ZStackElementPropsSchema } from "./elements/ZStackElement";
28
+ import { type SafeAreaViewElementProps, SafeAreaViewElementPropsSchema } from "./elements/SafeAreaViewElement";
29
+ import { type ScrollViewElementProps, ScrollViewElementPropsSchema } from "./elements/ScrollViewElement";
30
+ import {
31
+ type KeyboardAvoidingViewElementProps,
32
+ KeyboardAvoidingViewElementPropsSchema,
33
+ } from "./elements/KeyboardAvoidingViewElement";
34
+ import { type ProgressIndicatorElementProps, ProgressIndicatorElementPropsSchema } from "./elements/ProgressIndicatorElement";
35
+ import { type AnimatedTextElementProps, AnimatedTextElementPropsSchema } from "./elements/AnimatedTextElement";
36
+ import { type TypewriterTextElementProps, TypewriterTextElementPropsSchema } from "./elements/TypewriterTextElement";
37
+ import { type DrawingPadElementProps, DrawingPadElementPropsSchema } from "./elements/DrawingPadElement";
38
+ import { type SliderElementProps, SliderElementPropsSchema } from "./elements/SliderElement";
39
+
40
+ export type { BaseBoxProps, GradientBackground, GradientEdge, GradientStop, LinearGradientConfig } from "./elements/BaseBoxProps";
41
+ export type {
42
+ AnimationEasing,
43
+ SpringConfig,
44
+ EnteringPreset,
45
+ ExitingPreset,
46
+ LayoutPreset,
47
+ EffectPreset,
48
+ EnteringAnimation,
49
+ ExitingAnimation,
50
+ LayoutAnimation,
51
+ ElementEffect,
52
+ ElementAnimation,
53
+ ElementTransform,
54
+ } from "./elements/BaseBoxProps";
55
+ export { BaseBoxPropsSchema, GradientBackgroundSchema } from "./elements/BaseBoxProps";
56
+ export type { StackElementProps } from "./elements/StackElement";
57
+ export type { TextElementProps, TextSpan } from "./elements/TextElement";
58
+ export { TextSpanSchema } from "./elements/TextElement";
59
+ export type { RichTextElementProps } from "./elements/RichTextElement";
60
+ export type { ImageElementProps } from "./elements/ImageElement";
61
+ export type {
62
+ ProgressiveBlurImageElementProps,
63
+ BlurMask,
64
+ LinearBlurMask,
65
+ RadialBlurMask,
66
+ BlurMaskStop,
67
+ BlurAppear,
68
+ } from "./elements/ProgressiveBlurImageElement";
69
+ export type { LottieElementProps } from "./elements/LottieElement";
70
+ export type { RiveElementProps } from "./elements/RiveElement";
71
+ export type { IconElementProps } from "./elements/IconElement";
72
+ export type { VideoElementProps } from "./elements/VideoElement";
73
+ export type { InputElementProps } from "./elements/InputElement";
74
+ export type { ButtonElementProps, ButtonAction, CustomButtonAction, SetVariableButtonAction } from "./elements/ButtonElement";
75
+ export { ButtonActionSchema, CustomButtonActionSchema, SetVariableButtonActionSchema } from "./elements/ButtonElement";
76
+ export type { RadioGroupElementProps } from "./elements/RadioGroupElement";
77
+ export type { CheckboxGroupElementProps } from "./elements/CheckboxGroupElement";
78
+ export type { DatePickerElementProps } from "./elements/DatePickerElement";
79
+ export type { WheelPickerElementProps, WheelPickerItem, WheelPickerRange } from "./elements/WheelPickerElement";
80
+ export { WheelPickerElementPropsSchema, generateWheelPickerRangeItems, resolveWheelPickerItems } from "./elements/WheelPickerElement";
81
+ export type { CarouselElementProps } from "./elements/CarouselElement";
82
+ export type { ZStackElementProps } from "./elements/ZStackElement";
83
+ export type { SafeAreaViewElementProps, SafeAreaEdge, SafeAreaEdgeMode } from "./elements/SafeAreaViewElement";
84
+ export type { ScrollViewElementProps, ScrollViewContentInset } from "./elements/ScrollViewElement";
85
+ export type {
86
+ KeyboardAvoidingViewElementProps,
87
+ KeyboardAvoidingBehavior,
88
+ } from "./elements/KeyboardAvoidingViewElement";
89
+ export type { ProgressIndicatorElementProps, ProgressEasing } from "./elements/ProgressIndicatorElement";
90
+ export type { AnimatedTextElementProps } from "./elements/AnimatedTextElement";
91
+ export type { TypewriterTextElementProps } from "./elements/TypewriterTextElement";
92
+ export type { DrawingPadElementProps } from "./elements/DrawingPadElement";
93
+ export type { SliderElementProps } from "./elements/SliderElement";
94
+
95
+ /**
96
+ * Type tag for a ComposableScreen variable. Drives expression-mode coercion
97
+ * in `setVariable` action evaluation (int/float math vs string concat).
98
+ */
99
+ export type ComposableVariableKind = "int" | "float" | "string";
100
+
101
+ /**
102
+ * A variable entry stored in the ComposableScreen variables map.
103
+ * `value` is the canonical value (always a string), `label` is an optional
104
+ * display label, `kind` optionally tags the underlying type.
105
+ */
106
+ export type ComposableVariableEntry = {
107
+ value: string;
108
+ label?: string;
109
+ kind?: ComposableVariableKind;
110
+ };
111
+
112
+ // UIElement union — must live here (not in elements/) to avoid circular deps
113
+ // because the Stack variant's children: UIElement[] references itself.
114
+ export type UIElement =
115
+ | {
116
+ id: string;
117
+ name?: string;
118
+ renderWhen?: LeafCondition | ConditionGroup;
119
+ type: "YStack" | "XStack";
120
+ props: StackElementProps;
121
+ children: UIElement[];
122
+ }
123
+ | {
124
+ id: string;
125
+ name?: string;
126
+ renderWhen?: LeafCondition | ConditionGroup;
127
+ type: "Text";
128
+ props: TextElementProps;
129
+ }
130
+ | {
131
+ id: string;
132
+ name?: string;
133
+ renderWhen?: LeafCondition | ConditionGroup;
134
+ type: "RichText";
135
+ props: RichTextElementProps;
136
+ children: Array<Extract<UIElement, { type: "Text" }>>;
137
+ }
138
+ | {
139
+ id: string;
140
+ name?: string;
141
+ renderWhen?: LeafCondition | ConditionGroup;
142
+ type: "Image";
143
+ props: ImageElementProps;
144
+ }
145
+ | {
146
+ id: string;
147
+ name?: string;
148
+ renderWhen?: LeafCondition | ConditionGroup;
149
+ type: "ProgressiveBlurImage";
150
+ props: ProgressiveBlurImageElementProps;
151
+ }
152
+ | {
153
+ id: string;
154
+ name?: string;
155
+ renderWhen?: LeafCondition | ConditionGroup;
156
+ type: "Lottie";
157
+ props: LottieElementProps;
158
+ }
159
+ | {
160
+ id: string;
161
+ name?: string;
162
+ renderWhen?: LeafCondition | ConditionGroup;
163
+ type: "Rive";
164
+ props: RiveElementProps;
165
+ }
166
+ | {
167
+ id: string;
168
+ name?: string;
169
+ renderWhen?: LeafCondition | ConditionGroup;
170
+ type: "Icon";
171
+ props: IconElementProps;
172
+ }
173
+ | {
174
+ id: string;
175
+ name?: string;
176
+ renderWhen?: LeafCondition | ConditionGroup;
177
+ type: "Video";
178
+ props: VideoElementProps;
179
+ }
180
+ | {
181
+ id: string;
182
+ name?: string;
183
+ renderWhen?: LeafCondition | ConditionGroup;
184
+ type: "Input";
185
+ props: InputElementProps;
186
+ }
187
+ | {
188
+ id: string;
189
+ name?: string;
190
+ renderWhen?: LeafCondition | ConditionGroup;
191
+ type: "Button";
192
+ props: ButtonElementProps;
193
+ }
194
+ | {
195
+ id: string;
196
+ name?: string;
197
+ renderWhen?: LeafCondition | ConditionGroup;
198
+ type: "RadioGroup";
199
+ props: RadioGroupElementProps;
200
+ }
201
+ | {
202
+ id: string;
203
+ name?: string;
204
+ renderWhen?: LeafCondition | ConditionGroup;
205
+ type: "CheckboxGroup";
206
+ props: CheckboxGroupElementProps;
207
+ }
208
+ | {
209
+ id: string;
210
+ name?: string;
211
+ renderWhen?: LeafCondition | ConditionGroup;
212
+ type: "DatePicker";
213
+ props: DatePickerElementProps;
214
+ }
215
+ | {
216
+ id: string;
217
+ name?: string;
218
+ renderWhen?: LeafCondition | ConditionGroup;
219
+ type: "WheelPicker";
220
+ props: WheelPickerElementProps;
221
+ }
222
+ | {
223
+ id: string;
224
+ name?: string;
225
+ renderWhen?: LeafCondition | ConditionGroup;
226
+ type: "Carousel";
227
+ props: CarouselElementProps;
228
+ children: UIElement[];
229
+ }
230
+ | {
231
+ id: string;
232
+ name?: string;
233
+ renderWhen?: LeafCondition | ConditionGroup;
234
+ type: "ZStack";
235
+ props: ZStackElementProps;
236
+ children: UIElement[];
237
+ }
238
+ | {
239
+ id: string;
240
+ name?: string;
241
+ renderWhen?: LeafCondition | ConditionGroup;
242
+ type: "SafeAreaView";
243
+ props: SafeAreaViewElementProps;
244
+ children: UIElement[];
245
+ }
246
+ | {
247
+ id: string;
248
+ name?: string;
249
+ renderWhen?: LeafCondition | ConditionGroup;
250
+ type: "ScrollView";
251
+ props: ScrollViewElementProps;
252
+ children: UIElement[];
253
+ }
254
+ | {
255
+ id: string;
256
+ name?: string;
257
+ renderWhen?: LeafCondition | ConditionGroup;
258
+ type: "KeyboardAvoidingView";
259
+ props: KeyboardAvoidingViewElementProps;
260
+ children: UIElement[];
261
+ }
262
+ | {
263
+ id: string;
264
+ name?: string;
265
+ renderWhen?: LeafCondition | ConditionGroup;
266
+ type: "ProgressIndicator";
267
+ props: ProgressIndicatorElementProps;
268
+ }
269
+ | {
270
+ id: string;
271
+ name?: string;
272
+ renderWhen?: LeafCondition | ConditionGroup;
273
+ type: "AnimatedText";
274
+ props: AnimatedTextElementProps;
275
+ }
276
+ | {
277
+ id: string;
278
+ name?: string;
279
+ renderWhen?: LeafCondition | ConditionGroup;
280
+ type: "TypewriterText";
281
+ props: TypewriterTextElementProps;
282
+ }
283
+ | {
284
+ id: string;
285
+ name?: string;
286
+ renderWhen?: LeafCondition | ConditionGroup;
287
+ type: "DrawingPad";
288
+ props: DrawingPadElementProps;
289
+ }
290
+ | {
291
+ id: string;
292
+ name?: string;
293
+ renderWhen?: LeafCondition | ConditionGroup;
294
+ type: "Slider";
295
+ props: SliderElementProps;
296
+ };
297
+
298
+ // The `Text` variant, extracted so `RichText` can restrict its children to
299
+ // Text-only (children: z.array(TextUIElementSchema)) while the union references
300
+ // the same object.
301
+ const TextUIElementSchema = z.object({
302
+ id: z.string(),
303
+ name: z.string().optional(),
304
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
305
+ type: z.literal("Text"),
306
+ props: TextElementPropsSchema,
307
+ });
308
+
309
+ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
310
+ z.union([
311
+ z.object({
312
+ id: z.string(),
313
+ name: z.string().optional(),
314
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
315
+ type: z.union([z.literal("YStack"), z.literal("XStack")]),
316
+ props: StackElementPropsSchema,
317
+ children: z.array(UIElementSchema),
318
+ }),
319
+ TextUIElementSchema,
320
+ z.object({
321
+ id: z.string(),
322
+ name: z.string().optional(),
323
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
324
+ type: z.literal("RichText"),
325
+ props: RichTextElementPropsSchema,
326
+ children: z.array(TextUIElementSchema),
327
+ }),
328
+ z.object({
329
+ id: z.string(),
330
+ name: z.string().optional(),
331
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
332
+ type: z.literal("Image"),
333
+ props: ImageElementPropsSchema,
334
+ }),
335
+ z.object({
336
+ id: z.string(),
337
+ name: z.string().optional(),
338
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
339
+ type: z.literal("ProgressiveBlurImage"),
340
+ props: ProgressiveBlurImageElementPropsSchema,
341
+ }),
342
+ z.object({
343
+ id: z.string(),
344
+ name: z.string().optional(),
345
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
346
+ type: z.literal("Lottie"),
347
+ props: LottieElementPropsSchema,
348
+ }),
349
+ z.object({
350
+ id: z.string(),
351
+ name: z.string().optional(),
352
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
353
+ type: z.literal("Rive"),
354
+ props: RiveElementPropsSchema,
355
+ }),
356
+ z.object({
357
+ id: z.string(),
358
+ name: z.string().optional(),
359
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
360
+ type: z.literal("Icon"),
361
+ props: IconElementPropsSchema,
362
+ }),
363
+ z.object({
364
+ id: z.string(),
365
+ name: z.string().optional(),
366
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
367
+ type: z.literal("Video"),
368
+ props: VideoElementPropsSchema,
369
+ }),
370
+ z.object({
371
+ id: z.string(),
372
+ name: z.string().optional(),
373
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
374
+ type: z.literal("Input"),
375
+ props: InputElementPropsSchema,
376
+ }),
377
+ z.object({
378
+ id: z.string(),
379
+ name: z.string().optional(),
380
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
381
+ type: z.literal("Button"),
382
+ props: ButtonElementPropsSchema,
383
+ }),
384
+ z.object({
385
+ id: z.string(),
386
+ name: z.string().optional(),
387
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
388
+ type: z.literal("RadioGroup"),
389
+ props: RadioGroupElementPropsSchema,
390
+ }),
391
+ z.object({
392
+ id: z.string(),
393
+ name: z.string().optional(),
394
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
395
+ type: z.literal("CheckboxGroup"),
396
+ props: CheckboxGroupElementPropsSchema,
397
+ }),
398
+ z.object({
399
+ id: z.string(),
400
+ name: z.string().optional(),
401
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
402
+ type: z.literal("DatePicker"),
403
+ props: DatePickerElementPropsSchema,
404
+ }),
405
+ z.object({
406
+ id: z.string(),
407
+ name: z.string().optional(),
408
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
409
+ type: z.literal("WheelPicker"),
410
+ props: WheelPickerElementPropsSchema,
411
+ }),
412
+ z.object({
413
+ id: z.string(),
414
+ name: z.string().optional(),
415
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
416
+ type: z.literal("Carousel"),
417
+ props: CarouselElementPropsSchema,
418
+ children: z.array(UIElementSchema),
419
+ }),
420
+ z.object({
421
+ id: z.string(),
422
+ name: z.string().optional(),
423
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
424
+ type: z.literal("ZStack"),
425
+ props: ZStackElementPropsSchema,
426
+ children: z.array(UIElementSchema),
427
+ }),
428
+ z.object({
429
+ id: z.string(),
430
+ name: z.string().optional(),
431
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
432
+ type: z.literal("SafeAreaView"),
433
+ props: SafeAreaViewElementPropsSchema,
434
+ children: z.array(UIElementSchema),
435
+ }),
436
+ z.object({
437
+ id: z.string(),
438
+ name: z.string().optional(),
439
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
440
+ type: z.literal("ScrollView"),
441
+ props: ScrollViewElementPropsSchema,
442
+ children: z.array(UIElementSchema),
443
+ }),
444
+ z.object({
445
+ id: z.string(),
446
+ name: z.string().optional(),
447
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
448
+ type: z.literal("KeyboardAvoidingView"),
449
+ props: KeyboardAvoidingViewElementPropsSchema,
450
+ children: z.array(UIElementSchema),
451
+ }),
452
+ z.object({
453
+ id: z.string(),
454
+ name: z.string().optional(),
455
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
456
+ type: z.literal("ProgressIndicator"),
457
+ props: ProgressIndicatorElementPropsSchema,
458
+ }),
459
+ z.object({
460
+ id: z.string(),
461
+ name: z.string().optional(),
462
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
463
+ type: z.literal("AnimatedText"),
464
+ props: AnimatedTextElementPropsSchema,
465
+ }),
466
+ z.object({
467
+ id: z.string(),
468
+ name: z.string().optional(),
469
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
470
+ type: z.literal("TypewriterText"),
471
+ props: TypewriterTextElementPropsSchema,
472
+ }),
473
+ z.object({
474
+ id: z.string(),
475
+ name: z.string().optional(),
476
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
477
+ type: z.literal("DrawingPad"),
478
+ props: DrawingPadElementPropsSchema,
479
+ }),
480
+ z.object({
481
+ id: z.string(),
482
+ name: z.string().optional(),
483
+ renderWhen: z.union([LeafConditionSchema, ConditionGroupSchema]).optional(),
484
+ type: z.literal("Slider"),
485
+ props: SliderElementPropsSchema,
486
+ }),
487
+ ])
488
+ );
489
+
490
+ // Walk a UIElement tree; flag any KeyboardAvoidingView descendant of another KeyboardAvoidingView.
491
+ // RN behavior is undefined when a KAV nests another; KAV adjusts the layout of the host view, and
492
+ // stacking adjusters produces drift and clip artifacts on iOS + double height insets on Android.
493
+ const collectNestedKeyboardAvoidingViews = (
494
+ nodes: UIElement[],
495
+ insideKav: boolean,
496
+ out: string[]
497
+ ): void => {
498
+ for (const node of nodes) {
499
+ if (node.type === "KeyboardAvoidingView") {
500
+ if (insideKav) out.push(node.id);
501
+ collectNestedKeyboardAvoidingViews(node.children, true, out);
502
+ continue;
503
+ }
504
+ if (
505
+ node.type === "YStack" ||
506
+ node.type === "XStack" ||
507
+ node.type === "ZStack" ||
508
+ node.type === "SafeAreaView" ||
509
+ node.type === "ScrollView" ||
510
+ node.type === "Carousel"
511
+ ) {
512
+ collectNestedKeyboardAvoidingViews(node.children, insideKav, out);
513
+ }
514
+ }
515
+ };
516
+
517
+ /**
518
+ * The elements array of any composable screen — an onboarding step payload, a
519
+ * paywall, or anything else built on this engine. Carries the nested-
520
+ * KeyboardAvoidingView refinement that used to live on the step payload schema,
521
+ * because the constraint is a property of the element tree, not of steps.
522
+ */
523
+ export const ScreenElementsSchema = z
524
+ .array(UIElementSchema)
525
+ .superRefine((elements, ctx) => {
526
+ const offenders: string[] = [];
527
+ collectNestedKeyboardAvoidingViews(elements, false, offenders);
528
+ for (const id of offenders) {
529
+ ctx.addIssue({
530
+ code: z.ZodIssueCode.custom,
531
+ path: [],
532
+ message: `KeyboardAvoidingView (id="${id}") cannot be nested inside another KeyboardAvoidingView.`,
533
+ });
534
+ }
535
+ });