@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
@@ -37,6 +37,7 @@ export declare const QuestionStepTypeSchema: z.ZodObject<{
37
37
  condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
38
38
  variable: z.ZodString;
39
39
  operator: z.ZodEnum<{
40
+ in: "in";
40
41
  eq: "eq";
41
42
  neq: "neq";
42
43
  gt: "gt";
@@ -44,7 +45,6 @@ export declare const QuestionStepTypeSchema: z.ZodObject<{
44
45
  gte: "gte";
45
46
  lte: "lte";
46
47
  contains: "contains";
47
- in: "in";
48
48
  not_in: "not_in";
49
49
  is_empty: "is_empty";
50
50
  is_not_empty: "is_not_empty";
@@ -26,6 +26,7 @@ export declare const RatingsStepTypeSchema: z.ZodObject<{
26
26
  condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
27
27
  variable: z.ZodString;
28
28
  operator: z.ZodEnum<{
29
+ in: "in";
29
30
  eq: "eq";
30
31
  neq: "neq";
31
32
  gt: "gt";
@@ -33,7 +34,6 @@ export declare const RatingsStepTypeSchema: z.ZodObject<{
33
34
  gte: "gte";
34
35
  lte: "lte";
35
36
  contains: "contains";
36
- in: "in";
37
37
  not_in: "not_in";
38
38
  is_empty: "is_empty";
39
39
  is_not_empty: "is_not_empty";
@@ -88,32 +88,26 @@ export declare const SetVariableButtonActionSchema: z.ZodObject<{
88
88
  toggle: "toggle";
89
89
  }>>;
90
90
  }, z.core.$strip>;
91
- export type ButtonAction = "continue" | CustomButtonAction | SetVariableButtonAction;
92
- export declare const ButtonActionSchema: z.ZodUnion<readonly [z.ZodLiteral<"continue">, z.ZodObject<{
93
- type: z.ZodLiteral<"custom">;
94
- function: z.ZodString;
95
- variables: z.ZodOptional<z.ZodArray<z.ZodString>>;
96
- }, z.core.$strip>, z.ZodObject<{
97
- type: z.ZodLiteral<"setVariable">;
98
- name: z.ZodString;
99
- value: z.ZodString;
100
- label: z.ZodOptional<z.ZodString>;
101
- valueMode: z.ZodOptional<z.ZodEnum<{
102
- literal: "literal";
103
- expression: "expression";
104
- }>>;
105
- kind: z.ZodOptional<z.ZodEnum<{
106
- string: "string";
107
- int: "int";
108
- float: "float";
109
- }>>;
110
- arrayOp: z.ZodOptional<z.ZodEnum<{
111
- append: "append";
112
- remove: "remove";
113
- toggle: "toggle";
114
- }>>;
115
- }, z.core.$strip>]>;
91
+ export type PurchaseButtonAction = {
92
+ type: "purchase";
93
+ /** A product slot key, or an interpolable ref like "{{plan}}". */
94
+ product: string;
95
+ onSuccess?: ButtonAction[];
96
+ onCancel?: ButtonAction[];
97
+ onError?: ButtonAction[];
98
+ };
99
+ export type RestoreButtonAction = {
100
+ type: "restore";
101
+ onSuccess?: ButtonAction[];
102
+ onNothingToRestore?: ButtonAction[];
103
+ onError?: ButtonAction[];
104
+ };
105
+ export type ButtonAction = "continue" | CustomButtonAction | SetVariableButtonAction | PurchaseButtonAction | RestoreButtonAction;
106
+ export declare const PurchaseButtonActionSchema: z.ZodType<PurchaseButtonAction>;
107
+ export declare const RestoreButtonActionSchema: z.ZodType<RestoreButtonAction>;
108
+ export declare const ButtonActionSchema: z.ZodType<ButtonAction>;
116
109
  export declare const ConditionOperatorSchema: z.ZodEnum<{
110
+ in: "in";
117
111
  eq: "eq";
118
112
  neq: "neq";
119
113
  gt: "gt";
@@ -121,7 +115,6 @@ export declare const ConditionOperatorSchema: z.ZodEnum<{
121
115
  gte: "gte";
122
116
  lte: "lte";
123
117
  contains: "contains";
124
- in: "in";
125
118
  not_in: "not_in";
126
119
  is_empty: "is_empty";
127
120
  is_not_empty: "is_not_empty";
@@ -140,6 +133,7 @@ export type ConditionValue = z.infer<typeof ConditionValueSchema>;
140
133
  export declare const LeafConditionSchema: z.ZodObject<{
141
134
  variable: z.ZodString;
142
135
  operator: z.ZodEnum<{
136
+ in: "in";
143
137
  eq: "eq";
144
138
  neq: "neq";
145
139
  gt: "gt";
@@ -147,7 +141,6 @@ export declare const LeafConditionSchema: z.ZodObject<{
147
141
  gte: "gte";
148
142
  lte: "lte";
149
143
  contains: "contains";
150
- in: "in";
151
144
  not_in: "not_in";
152
145
  is_empty: "is_empty";
153
146
  is_not_empty: "is_not_empty";
@@ -166,6 +159,7 @@ export declare const BranchSchema: z.ZodObject<{
166
159
  condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
167
160
  variable: z.ZodString;
168
161
  operator: z.ZodEnum<{
162
+ in: "in";
169
163
  eq: "eq";
170
164
  neq: "neq";
171
165
  gt: "gt";
@@ -173,7 +167,6 @@ export declare const BranchSchema: z.ZodObject<{
173
167
  gte: "gte";
174
168
  lte: "lte";
175
169
  contains: "contains";
176
- in: "in";
177
170
  not_in: "not_in";
178
171
  is_empty: "is_empty";
179
172
  is_not_empty: "is_not_empty";
@@ -191,6 +184,7 @@ export declare const NextStepSchema: z.ZodDefault<z.ZodNullable<z.ZodObject<{
191
184
  condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
192
185
  variable: z.ZodString;
193
186
  operator: z.ZodEnum<{
187
+ in: "in";
194
188
  eq: "eq";
195
189
  neq: "neq";
196
190
  gt: "gt";
@@ -198,7 +192,6 @@ export declare const NextStepSchema: z.ZodDefault<z.ZodNullable<z.ZodObject<{
198
192
  gte: "gte";
199
193
  lte: "lte";
200
194
  contains: "contains";
201
- in: "in";
202
195
  not_in: "not_in";
203
196
  is_empty: "is_empty";
204
197
  is_not_empty: "is_not_empty";
@@ -236,6 +229,7 @@ export declare const BaseStepTypeSchema: z.ZodObject<{
236
229
  condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
237
230
  variable: z.ZodString;
238
231
  operator: z.ZodEnum<{
232
+ in: "in";
239
233
  eq: "eq";
240
234
  neq: "neq";
241
235
  gt: "gt";
@@ -243,7 +237,6 @@ export declare const BaseStepTypeSchema: z.ZodObject<{
243
237
  gte: "gte";
244
238
  lte: "lte";
245
239
  contains: "contains";
246
- in: "in";
247
240
  not_in: "not_in";
248
241
  is_empty: "is_empty";
249
242
  is_not_empty: "is_not_empty";
@@ -1 +1 @@
1
- {"version":3,"file":"common.types.d.ts","sourceRoot":"","sources":["../../src/steps/common.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB,kEAA0C,CAAC;AAE3E,eAAO,MAAM,iBAAiB;;;;;;mBAS5B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;iBAI5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;iBAGxB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;iBAG9B,CAAC;AAMH,eAAO,MAAM,iBAAiB;;;;;;;EAO5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAQ5D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;iBAInC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,YAAY,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iB,KAAG,OACrC,CAAC;AAEnC,eAAO,MAAM,oBAAoB,0IAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;iBAc5B,CAAC;AACL,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,UAAU,EAAE,KAAK,CAAC,aAAa,GAAG,cAAc,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,OAAO,CAAC,cAAc,CAO1D,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;iBAGvB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;mBAMX,CAAC;AACjB,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAIhD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAa7B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseStepTypeSchema = exports.ONBOARDING_END_STEP_ID = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.ConditionValueSchema = exports.isUnaryConditionOperator = exports.UNARY_CONDITION_OPERATORS = exports.ConditionOperatorSchema = exports.ButtonActionSchema = exports.SetVariableButtonActionSchema = exports.CustomButtonActionSchema = exports.HapticStyleSchema = exports.ButtonSectionSchema = exports.InfoBoxSchema = exports.SocialProofSchema = exports.MediaSourceSchema = exports.CustomPayloadSchema = void 0;
3
+ exports.BaseStepTypeSchema = exports.ONBOARDING_END_STEP_ID = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.ConditionValueSchema = exports.isUnaryConditionOperator = exports.UNARY_CONDITION_OPERATORS = exports.ConditionOperatorSchema = exports.ButtonActionSchema = exports.RestoreButtonActionSchema = exports.PurchaseButtonActionSchema = exports.SetVariableButtonActionSchema = exports.CustomButtonActionSchema = exports.HapticStyleSchema = exports.ButtonSectionSchema = exports.InfoBoxSchema = exports.SocialProofSchema = exports.MediaSourceSchema = exports.CustomPayloadSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.CustomPayloadSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullish();
6
6
  exports.MediaSourceSchema = zod_1.z.union([
@@ -52,11 +52,26 @@ exports.SetVariableButtonActionSchema = zod_1.z.object({
52
52
  kind: zod_1.z.enum(["int", "float", "string"]).optional(),
53
53
  arrayOp: zod_1.z.enum(["append", "remove", "toggle"]).optional(),
54
54
  });
55
- exports.ButtonActionSchema = zod_1.z.union([
55
+ exports.PurchaseButtonActionSchema = zod_1.z.lazy(() => zod_1.z.object({
56
+ type: zod_1.z.literal("purchase"),
57
+ product: zod_1.z.string().min(1, "product must not be empty"),
58
+ onSuccess: zod_1.z.array(exports.ButtonActionSchema).optional(),
59
+ onCancel: zod_1.z.array(exports.ButtonActionSchema).optional(),
60
+ onError: zod_1.z.array(exports.ButtonActionSchema).optional(),
61
+ }));
62
+ exports.RestoreButtonActionSchema = zod_1.z.lazy(() => zod_1.z.object({
63
+ type: zod_1.z.literal("restore"),
64
+ onSuccess: zod_1.z.array(exports.ButtonActionSchema).optional(),
65
+ onNothingToRestore: zod_1.z.array(exports.ButtonActionSchema).optional(),
66
+ onError: zod_1.z.array(exports.ButtonActionSchema).optional(),
67
+ }));
68
+ exports.ButtonActionSchema = zod_1.z.lazy(() => zod_1.z.union([
56
69
  zod_1.z.literal("continue"),
57
70
  exports.CustomButtonActionSchema,
58
71
  exports.SetVariableButtonActionSchema,
59
- ]);
72
+ exports.PurchaseButtonActionSchema,
73
+ exports.RestoreButtonActionSchema,
74
+ ]));
60
75
  // ── Branching / nextStep schemas ─────────────────────────────────────────────
61
76
  exports.ConditionOperatorSchema = zod_1.z.enum([
62
77
  "eq",
@@ -1 +1 @@
1
- {"version":3,"file":"common.types.js","sourceRoot":"","sources":["../../src/steps/common.types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAEX,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AAE9D,QAAA,iBAAiB,GAAG,OAAC,CAAC,KAAK,CAAC;IACvC,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7F,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE;KACxB,CAAC;IACF,OAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7F,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;KAChB,CAAC;CAC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AC;IACzC,2EAA2E;IAC3E,qEAAqE;IACrE,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,8BAAsB,EAAE;QACzD,OAAO,EAAE,IAAI,8BAAsB,8EAA8E;KAClH,CAAC;IACF,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,qBAAqB,EAAE,OAAC,CAAC,OAAO,EAAE;IAClC,aAAa,EAAE,2BAAmB;IAClC,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;IAC9D,aAAa,EAAE,2BAAmB,CAAC,QAAQ,EAAE;IAC7C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,QAAQ,EAAE,sBAAc;CACzB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@rocapine/react-native-onboarding",
3
- "version": "1.59.2",
3
+ "version": "1.61.0",
4
4
  "description": "Headless React Native SDK for Rocapine Onboarding Studio - Data fetching, state management, and hooks",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
- "build": "tsc",
8
+ "build": "rm -rf dist && tsc",
9
9
  "watch": "tsc --watch",
10
10
  "type:check": "tsc --noEmit",
11
11
  "test": "vitest run",
12
12
  "test:watch": "vitest",
13
- "patch": "npm version patch && npm run build && npm publish"
13
+ "prepublishOnly": "node ../../scripts/check-versions.mjs"
14
14
  },
15
15
  "keywords": [
16
16
  "react-native",
@@ -0,0 +1,58 @@
1
+ import { describe, it, expect, vi } from "vitest";
2
+ import type { ProductRef, ResolvedProduct } from "../products/types";
3
+
4
+ // Neither react-native-purchases nor expo-iap is a dependency of this repo —
5
+ // their absence IS the condition under test (not simulated). Mirrors the
6
+ // `react-native` mock getOnboarding.query.test.ts already uses for the same
7
+ // import, so `Platform` resolves without pulling in real react-native.
8
+ vi.mock("react-native", () => ({ Platform: { OS: "ios" } }));
9
+
10
+ const REF: ProductRef = { key: "yearly", ios: "com.app.yearly" };
11
+
12
+ const FAKE_PRODUCT: ResolvedProduct = {
13
+ key: "yearly",
14
+ productId: "com.app.yearly",
15
+ store: "app_store",
16
+ title: "Yearly",
17
+ description: "",
18
+ price: "$59.99",
19
+ priceAmount: 59.99,
20
+ currencyCode: "USD",
21
+ period: "year",
22
+ periodCount: 1,
23
+ periodIso: "P1Y",
24
+ };
25
+
26
+ describe("revenueCatProductProvider — degrades cleanly when react-native-purchases is absent", () => {
27
+ it("importing the module and calling the factory do not throw", async () => {
28
+ const { revenueCatProductProvider } = await import("../products/adapters/revenueCat");
29
+ expect(() => revenueCatProductProvider()).not.toThrow();
30
+ });
31
+
32
+ it("defers the missing-dependency error to call time, and names the missing package", async () => {
33
+ const { revenueCatProductProvider } = await import("../products/adapters/revenueCat");
34
+ const provider = revenueCatProductProvider();
35
+ await expect(provider.getProducts([REF])).rejects.toThrow(
36
+ /react-native-purchases is not installed/
37
+ );
38
+ await expect(provider.purchase(FAKE_PRODUCT)).rejects.toThrow(
39
+ /react-native-purchases is not installed/
40
+ );
41
+ await expect(provider.restore()).rejects.toThrow(/react-native-purchases is not installed/);
42
+ });
43
+ });
44
+
45
+ describe("expoIapProductProvider — degrades cleanly when expo-iap is absent", () => {
46
+ it("importing the module and calling the factory do not throw", async () => {
47
+ const { expoIapProductProvider } = await import("../products/adapters/expoIap");
48
+ expect(() => expoIapProductProvider()).not.toThrow();
49
+ });
50
+
51
+ it("defers the missing-dependency error to call time, and names the missing package", async () => {
52
+ const { expoIapProductProvider } = await import("../products/adapters/expoIap");
53
+ const provider = expoIapProductProvider();
54
+ await expect(provider.getProducts([REF])).rejects.toThrow(/expo-iap is not installed/);
55
+ await expect(provider.purchase(FAKE_PRODUCT)).rejects.toThrow(/expo-iap is not installed/);
56
+ await expect(provider.restore()).rejects.toThrow(/expo-iap is not installed/);
57
+ });
58
+ });
@@ -0,0 +1,111 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { parseIsoDuration } from "../products/duration";
3
+ import { formatCurrency, deriveProductFields, deriveAll } from "../products/derive";
4
+ import type { ResolvedProduct, ProductRef } from "../products/types";
5
+
6
+ const make = (over: Partial<ResolvedProduct> = {}): ResolvedProduct => ({
7
+ key: "yearly",
8
+ productId: "com.app.yearly",
9
+ store: "app_store",
10
+ title: "Yearly",
11
+ description: "",
12
+ price: "$59.99",
13
+ priceAmount: 59.99,
14
+ currencyCode: "USD",
15
+ period: "year",
16
+ periodCount: 1,
17
+ periodIso: "P1Y",
18
+ ...over,
19
+ });
20
+
21
+ describe("parseIsoDuration", () => {
22
+ it("parses the store-standard periods to days", () => {
23
+ expect(parseIsoDuration("P1W")).toBe(7);
24
+ expect(parseIsoDuration("P1M")).toBe(30);
25
+ expect(parseIsoDuration("P3M")).toBe(90);
26
+ expect(parseIsoDuration("P6M")).toBe(180);
27
+ expect(parseIsoDuration("P1Y")).toBe(365);
28
+ expect(parseIsoDuration("P7D")).toBe(7);
29
+ });
30
+
31
+ it("returns null for junk rather than guessing", () => {
32
+ expect(parseIsoDuration("")).toBeNull();
33
+ expect(parseIsoDuration("1Y")).toBeNull();
34
+ expect(parseIsoDuration("PT1H")).toBeNull();
35
+ });
36
+ });
37
+
38
+ describe("formatCurrency", () => {
39
+ it("formats in the product's currency, not the device's", () => {
40
+ expect(formatCurrency(1.15, "USD", "en-US")).toBe("$1.15");
41
+ });
42
+
43
+ it("falls back to a plain amount+code string when Intl rejects the currency code", () => {
44
+ // "XYZ" is syntactically valid (3 letters) and Intl accepts it even though it's
45
+ // not a real currency, so it never exercises the catch branch. "ZZZZZZ" is the
46
+ // wrong shape and Intl genuinely throws on it.
47
+ expect(formatCurrency(5, "ZZZZZZ", "en-US")).toBe("5.00 ZZZZZZ");
48
+ });
49
+ });
50
+
51
+ describe("deriveProductFields", () => {
52
+ it("computes per-period prices from the ISO period", () => {
53
+ const d = deriveProductFields(make(), { locale: "en-US" });
54
+ // 59.99 / (365/7) weeks
55
+ expect(d.pricePerWeekAmount).toBeCloseTo(1.1504, 3);
56
+ expect(d.pricePerWeek).toBe("$1.15");
57
+ expect(d.pricePerMonthAmount).toBeCloseTo(4.9307, 3);
58
+ });
59
+
60
+ it("leaves savingsPct undefined without a compareTo", () => {
61
+ expect(deriveProductFields(make(), { locale: "en-US" }).savingsPct).toBeUndefined();
62
+ });
63
+
64
+ it("computes savingsPct against a normalized per-day comparison", () => {
65
+ const yearly = make(); // 59.99 / 365d
66
+ const monthly = make({ key: "monthly", priceAmount: 9.99, periodIso: "P1M" }); // 9.99 / 30d
67
+ const d = deriveProductFields(yearly, { compareTo: monthly, locale: "en-US" });
68
+ // yearly/day = 0.16436, monthly/day = 0.333 → ~51% cheaper
69
+ expect(d.savingsPct).toBe(51);
70
+ });
71
+
72
+ it("omits savingsPct when the comparison is not cheaper", () => {
73
+ const a = make({ priceAmount: 400 });
74
+ const b = make({ key: "monthly", priceAmount: 9.99, periodIso: "P1M" });
75
+ expect(deriveProductFields(a, { compareTo: b }).savingsPct).toBeUndefined();
76
+ });
77
+
78
+ it("derives trialDays from the trial period", () => {
79
+ const p = make({ trial: { period: "week", periodCount: 1, days: 0 } });
80
+ expect(deriveProductFields(p).trialDays).toBe(7);
81
+ });
82
+
83
+ it("returns no per-period prices when the period is unparseable", () => {
84
+ const d = deriveProductFields(make({ periodIso: null, period: null }));
85
+ expect(d.pricePerWeek).toBeUndefined();
86
+ expect(d.pricePerWeekAmount).toBeUndefined();
87
+ });
88
+ });
89
+
90
+ describe("deriveAll", () => {
91
+ const refs: ProductRef[] = [
92
+ { key: "yearly", ios: "com.app.yearly", compareTo: "monthly" },
93
+ { key: "monthly", ios: "com.app.monthly" },
94
+ ];
95
+
96
+ it("keys results by ref key and resolves compareTo between them", () => {
97
+ const products = [
98
+ make(),
99
+ make({ key: "monthly", priceAmount: 9.99, periodIso: "P1M", period: "month" }),
100
+ ];
101
+ const out = deriveAll(products, refs, "en-US");
102
+ expect(Object.keys(out).sort()).toEqual(["monthly", "yearly"]);
103
+ expect(out.yearly.savingsPct).toBe(51);
104
+ expect(out.monthly.savingsPct).toBeUndefined();
105
+ });
106
+
107
+ it("ignores a compareTo pointing at a missing key", () => {
108
+ const out = deriveAll([make()], [{ key: "yearly", compareTo: "nope" }], "en-US");
109
+ expect(out.yearly.savingsPct).toBeUndefined();
110
+ });
111
+ });
@@ -0,0 +1,109 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { productVariables } from "../products/toVariables";
3
+ import type { ProductWithDerived } from "../products/types";
4
+
5
+ const yearly: ProductWithDerived = {
6
+ key: "yearly",
7
+ productId: "com.app.yearly",
8
+ store: "app_store",
9
+ title: "Yearly Plan",
10
+ description: "A year",
11
+ price: "$59.99",
12
+ priceAmount: 59.99,
13
+ currencyCode: "USD",
14
+ period: "year",
15
+ periodCount: 1,
16
+ periodIso: "P1Y",
17
+ pricePerWeek: "$1.15",
18
+ pricePerWeekAmount: 1.1504,
19
+ savingsPct: 51,
20
+ trialDays: 7,
21
+ };
22
+
23
+ // Every optional field populated, so the dotted-key test below catches both a
24
+ // typo in an emitted key and an accidentally-dropped field.
25
+ const complete: ProductWithDerived = {
26
+ ...yearly,
27
+ key: "complete",
28
+ productId: "com.app.complete",
29
+ pricePerMonth: "$4.93",
30
+ pricePerMonthAmount: 4.9307,
31
+ pricePerYear: "$59.99",
32
+ pricePerYearAmount: 59.99,
33
+ introOffer: { price: "$0.99", priceAmount: 0.99, period: "month", periodCount: 1, cycles: 1 },
34
+ };
35
+
36
+ describe("productVariables", () => {
37
+ it("emits flat dotted keys the interpolator can resolve", () => {
38
+ const v = productVariables({ products: { yearly }, status: "ready", purchasing: false });
39
+ expect(v["product.yearly.price"].value).toBe("$59.99");
40
+ expect(v["product.yearly.pricePerWeek"].value).toBe("$1.15");
41
+ expect(v["product.yearly.savingsPct"].value).toBe("51");
42
+ expect(v["product.yearly.trialDays"].value).toBe("7");
43
+ expect(v["product.yearly.title"].value).toBe("Yearly Plan");
44
+ expect(v["product.yearly.period"].value).toBe("year");
45
+ });
46
+
47
+ it("stringifies every value — the variable bag is string-based", () => {
48
+ const v = productVariables({ products: { yearly }, status: "ready", purchasing: false });
49
+ for (const entry of Object.values(v)) {
50
+ expect(typeof entry.value).toBe("string");
51
+ }
52
+ });
53
+
54
+ it("emits the complete set of dotted keys for a fully-populated product", () => {
55
+ const v = productVariables({ products: { complete }, status: "ready", purchasing: false });
56
+ expect(Object.keys(v).sort()).toEqual(
57
+ [
58
+ "product.complete.productId",
59
+ "product.complete.title",
60
+ "product.complete.description",
61
+ "product.complete.price",
62
+ "product.complete.priceAmount",
63
+ "product.complete.currencyCode",
64
+ "product.complete.period",
65
+ "product.complete.periodCount",
66
+ "product.complete.pricePerWeek",
67
+ "product.complete.pricePerWeekAmount",
68
+ "product.complete.pricePerMonth",
69
+ "product.complete.pricePerMonthAmount",
70
+ "product.complete.pricePerYear",
71
+ "product.complete.pricePerYearAmount",
72
+ "product.complete.savingsPct",
73
+ "product.complete.trialDays",
74
+ "product.complete.introPrice",
75
+ "products.loaded",
76
+ "products.purchasing",
77
+ "products.error",
78
+ ].sort()
79
+ );
80
+ });
81
+
82
+ it("omits absent optional fields rather than emitting empty strings", () => {
83
+ const bare = { ...yearly, savingsPct: undefined, trialDays: undefined };
84
+ const v = productVariables({ products: { yearly: bare }, status: "ready", purchasing: false });
85
+ expect(v["product.yearly.savingsPct"]).toBeUndefined();
86
+ expect(v["product.yearly.trialDays"]).toBeUndefined();
87
+ });
88
+
89
+ it("publishes status flags authors gate the CTA on", () => {
90
+ const ready = productVariables({ products: {}, status: "ready", purchasing: false });
91
+ expect(ready["products.loaded"].value).toBe("true");
92
+ expect(ready["products.purchasing"].value).toBe("false");
93
+ expect(ready["products.error"].value).toBe("");
94
+
95
+ const failed = productVariables({
96
+ products: {},
97
+ status: "error",
98
+ error: "network down",
99
+ purchasing: false,
100
+ });
101
+ expect(failed["products.loaded"].value).toBe("false");
102
+ expect(failed["products.error"].value).toBe("network down");
103
+ });
104
+
105
+ it("reports loaded=false while still loading", () => {
106
+ const v = productVariables({ products: {}, status: "loading", purchasing: false });
107
+ expect(v["products.loaded"].value).toBe("false");
108
+ });
109
+ });
@@ -0,0 +1,58 @@
1
+ import { describe, it, expect } from "vitest";
2
+ // Old path — must keep working for onboarding-studio and every host app.
3
+ import {
4
+ ComposableScreenStepTypeSchema,
5
+ UIElementSchema,
6
+ } from "../steps/ComposableScreen/types";
7
+ // New path — the screen-agnostic home.
8
+ import {
9
+ UIElementSchema as ScreenUIElementSchema,
10
+ ScreenElementsSchema,
11
+ } from "../screens/types";
12
+
13
+ const textElement = {
14
+ id: "t1",
15
+ type: "Text",
16
+ props: { content: "Hello" },
17
+ };
18
+
19
+ const step = {
20
+ id: "s1",
21
+ name: "Step 1",
22
+ type: "ComposableScreen",
23
+ displayProgressHeader: true,
24
+ payload: { elements: [textElement] },
25
+ };
26
+
27
+ describe("screen types back-compat", () => {
28
+ it("parses a UIElement from the old path", () => {
29
+ expect(UIElementSchema.safeParse(textElement).success).toBe(true);
30
+ });
31
+
32
+ it("parses a UIElement from the new path", () => {
33
+ expect(ScreenUIElementSchema.safeParse(textElement).success).toBe(true);
34
+ });
35
+
36
+ it("both paths expose the same schema object", () => {
37
+ expect(UIElementSchema).toBe(ScreenUIElementSchema);
38
+ });
39
+
40
+ it("still parses a full ComposableScreen step from the old path", () => {
41
+ const result = ComposableScreenStepTypeSchema.safeParse(step);
42
+ expect(result.success).toBe(true);
43
+ });
44
+
45
+ it("ScreenElementsSchema rejects a KeyboardAvoidingView nested in another", () => {
46
+ const nested = [
47
+ {
48
+ id: "kav1",
49
+ type: "KeyboardAvoidingView",
50
+ props: {},
51
+ children: [
52
+ { id: "kav2", type: "KeyboardAvoidingView", props: {}, children: [] },
53
+ ],
54
+ },
55
+ ];
56
+ expect(ScreenElementsSchema.safeParse(nested).success).toBe(false);
57
+ });
58
+ });
package/src/index.ts CHANGED
@@ -77,3 +77,5 @@ export {
77
77
  isUnaryConditionOperator,
78
78
  ONBOARDING_END_STEP_ID,
79
79
  } from "./steps/common.types";
80
+ // Product runtime (paywall phase 3) — vendor-neutral store products
81
+ export * from "./products";
@@ -3,7 +3,7 @@ import type { OnboardingNavigationAdapter } from "./types";
3
3
 
4
4
  // expo-router is an OPTIONAL peer dependency. Lazily require it so the SDK
5
5
  // loads (and the no-op fallbacks below take over) when it is not installed.
6
- // Precedent: Pages/ComposableScreen/elements/haptics.ts (try/require/catch).
6
+ // Precedent: UI/Runtime/elements/haptics.ts (try/require/catch).
7
7
  let expoRouter: any;
8
8
  try {
9
9
  expoRouter = require("expo-router");