@rocapine/react-native-onboarding-ui 1.1.6 β†’ 1.3.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.
package/README.md ADDED
@@ -0,0 +1,193 @@
1
+ # @rocapine/react-native-onboarding-ui
2
+
3
+ **UI layer for the Rocapine Onboarding Studio SDK.**
4
+
5
+ Pre-built renderers, components, and a theme system on top of
6
+ `@rocapine/react-native-onboarding`.
7
+
8
+ ---
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @rocapine/react-native-onboarding-ui @rocapine/react-native-onboarding
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Usage
19
+
20
+ Render any CMS-driven step with a single component:
21
+
22
+ ```typescript
23
+ import { OnboardingPage } from "@rocapine/react-native-onboarding-ui";
24
+
25
+ export default function OnboardingScreen() {
26
+ const { step } = useOnboardingQuestions({ stepNumber: 1 });
27
+ return <OnboardingPage step={step} onContinue={handleContinue} />;
28
+ }
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 🎨 Page Types
34
+
35
+ | Type | Description |
36
+ | ---------------------------------------- | ------------------------------------------------------ |
37
+ | `Question` | Single / multi-select answer screens |
38
+ | `MediaContent` | Image or video with title and description |
39
+ | `Carousel` | Horizontal paginated slides |
40
+ | `Picker` | Structured data pickers (weight, height, age, gender…) |
41
+ | `Loader` | Animated progress bars with optional carousel |
42
+ | `Ratings` | App store rating prompts with social proof |
43
+ | `Commitment` | Agreement / signature screens |
44
+ | `ComposableScreen` _(under development)_ | Declarative layout system β€” see below |
45
+
46
+ ---
47
+
48
+ ## 🧱 ComposableScreen _(under development)_
49
+
50
+ > **This page type is still under active development. The API may change before
51
+ > it is considered stable.**
52
+
53
+ `ComposableScreen` lets you build arbitrary onboarding screens entirely from CMS
54
+ data, without writing a custom renderer. You compose a tree of layout and text
55
+ elements that is rendered directly to native views.
56
+
57
+ ### Element types
58
+
59
+ **`YStack`** β€” vertical flex container (`flexDirection: "column"`)
60
+
61
+ **`XStack`** β€” horizontal flex container (`flexDirection: "row"`)
62
+
63
+ **`Text`** β€” text node
64
+
65
+ ### Supported props
66
+
67
+ #### Stack elements (`YStack` / `XStack`)
68
+
69
+ | Prop | Type | Notes |
70
+ | ------------------- | ----------------------------------------------------------------------------- | -------------------------------------- |
71
+ | `gap` | `number` | Space between children |
72
+ | `padding` | `number` | |
73
+ | `paddingHorizontal` | `number` | |
74
+ | `paddingVertical` | `number` | |
75
+ | `margin` | `number` | |
76
+ | `marginHorizontal` | `number` | |
77
+ | `marginVertical` | `number` | |
78
+ | `flex` | `number` | |
79
+ | `flexShrink` | `number` | Defaults to `1` inside an `XStack` |
80
+ | `flexWrap` | `"wrap" \| "nowrap"` | |
81
+ | `alignItems` | `"flex-start" \| "center" \| "flex-end" \| "stretch"` | |
82
+ | `justifyContent` | `"flex-start" \| "center" \| "flex-end" \| "space-between" \| "space-around"` | |
83
+ | `width` | `number` | |
84
+ | `height` | `number` | |
85
+ | `minWidth` | `number` | |
86
+ | `maxWidth` | `number` | |
87
+ | `minHeight` | `number` | |
88
+ | `maxHeight` | `number` | |
89
+ | `backgroundColor` | `string` | |
90
+ | `borderWidth` | `number` | |
91
+ | `borderRadius` | `number` | |
92
+ | `borderColor` | `string` | |
93
+ | `overflow` | `"hidden" \| "visible" \| "scroll"` | Use `"hidden"` to clip rounded corners |
94
+ | `opacity` | `number` | |
95
+
96
+ #### Text elements
97
+
98
+ | Prop | Type | Notes |
99
+ | ------------------- | ------------------------------- | --------------------------------------- |
100
+ | `content` | `string` | **Required** |
101
+ | `fontSize` | `number` | |
102
+ | `fontWeight` | `string` | |
103
+ | `color` | `string` | Defaults to `theme.colors.text.primary` |
104
+ | `textAlign` | `"left" \| "center" \| "right"` | |
105
+ | `letterSpacing` | `number` | |
106
+ | `lineHeight` | `number` | |
107
+ | `backgroundColor` | `string` | |
108
+ | `padding` | `number` | |
109
+ | `paddingHorizontal` | `number` | |
110
+ | `paddingVertical` | `number` | |
111
+ | `margin` | `number` | |
112
+ | `marginHorizontal` | `number` | |
113
+ | `marginVertical` | `number` | |
114
+ | `borderWidth` | `number` | |
115
+ | `borderRadius` | `number` | |
116
+ | `borderColor` | `string` | |
117
+ | `opacity` | `number` | |
118
+
119
+ ### Example payload
120
+
121
+ ```json
122
+ {
123
+ "type": "ComposableScreen",
124
+ "payload": {
125
+ "elements": [
126
+ {
127
+ "id": "card",
128
+ "type": "YStack",
129
+ "props": {
130
+ "padding": 24,
131
+ "gap": 12,
132
+ "borderWidth": 1,
133
+ "borderRadius": 16,
134
+ "borderColor": "#E0E0E0",
135
+ "overflow": "hidden"
136
+ },
137
+ "children": [
138
+ {
139
+ "id": "title",
140
+ "type": "Text",
141
+ "props": {
142
+ "content": "Welcome aboard",
143
+ "fontSize": 24,
144
+ "fontWeight": "700"
145
+ }
146
+ },
147
+ {
148
+ "id": "subtitle",
149
+ "type": "Text",
150
+ "props": {
151
+ "content": "Let's get you set up.",
152
+ "fontSize": 16
153
+ }
154
+ }
155
+ ]
156
+ }
157
+ ]
158
+ }
159
+ }
160
+ ```
161
+
162
+ ---
163
+
164
+ ## 🎭 Theming
165
+
166
+ Pass a `theme` prop (or `lightTheme` / `darkTheme`) to `OnboardingProvider`:
167
+
168
+ ```typescript
169
+ <OnboardingProvider
170
+ theme={{
171
+ colors: { primary: "#FF5733" },
172
+ typography: { fontFamily: { title: "CustomFont-Bold" } },
173
+ }}
174
+ />;
175
+ ```
176
+
177
+ See `@rocapine/react-native-onboarding` for the full token reference.
178
+
179
+ ---
180
+
181
+ ## πŸ“¦ Optional Dependencies
182
+
183
+ | Feature | Package |
184
+ | ---------------------- | ----------------------------- |
185
+ | Picker screens | `@react-native-picker/picker` |
186
+ | Ratings screen | `expo-store-review` |
187
+ | Commitment (signature) | `@shopify/react-native-skia` |
188
+
189
+ ---
190
+
191
+ ## πŸ“„ License
192
+
193
+ MIT Β© [Rocapine](https://rocapine.com)
@@ -1 +1 @@
1
- {"version":3,"file":"OnboardingPage.d.ts","sourceRoot":"","sources":["../../src/UI/OnboardingPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAiI,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAG7M,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,UAAU,mBAAmB;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EAAE;QACjB,oBAAoB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACtE,mBAAmB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;KACrE,CAAC;CACH;AAED,eAAO,MAAM,cAAc,GAAI,iCAAiC,mBAAmB,4CAkClF,CAAC"}
1
+ {"version":3,"file":"OnboardingPage.d.ts","sourceRoot":"","sources":["../../src/UI/OnboardingPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAA2J,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAGvO,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,UAAU,mBAAmB;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,UAAU,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,gBAAgB,CAAC,EAAE;QACjB,oBAAoB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACtE,mBAAmB,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,wBAAwB,CAAC,CAAC;KACrE,CAAC;CACH;AAED,eAAO,MAAM,cAAc,GAAI,iCAAiC,mBAAmB,4CAoClF,CAAC"}
@@ -22,6 +22,8 @@ const OnboardingPage = ({ step, onContinue, isSandbox }) => {
22
22
  return (0, jsx_runtime_1.jsx)(Pages_1.LoaderRenderer, { step: step, onContinue: onContinue, theme: theme });
23
23
  case 'Question':
24
24
  return (0, jsx_runtime_1.jsx)(Pages_1.QuestionRenderer, { step: step, onContinue: onContinue, theme: theme });
25
+ case 'ComposableScreen':
26
+ return (0, jsx_runtime_1.jsx)(Pages_1.ComposableScreenRenderer, { step: step, onContinue: onContinue, theme: theme });
25
27
  default:
26
28
  if (isSandbox) {
27
29
  // @ts-ignore
@@ -1 +1 @@
1
- {"version":3,"file":"OnboardingPage.js","sourceRoot":"","sources":["../../src/UI/OnboardingPage.tsx"],"names":[],"mappings":";;;;AACA,mCAA6M;AAC7M,+CAAkD;AAClD,+CAA4C;AAerC,MAAM,cAAc,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAuB,EAAE,EAAE;IACrF,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,mBAAQ,GAAE,CAAC;IAE7B,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,uBAAC,uBAAe,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC;QAC/E,KAAK,QAAQ;YACX,OAAO,uBAAC,sBAAc,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC;QAC9E,KAAK,YAAY;YACf,OAAO,uBAAC,0BAAkB,IAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC;QAClF,KAAK,UAAU;YACb,OAAO,uB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I,CAAC;gBAC3B,OAAO,wBAAC,mBAAI,eACV,wBAAC,mBAAI,0BAAS,QAAQ,wBAAwB,EAC9C,uBAAC,qBAAM,IAAC,KAAK,EAAC,UAAU,EAAC,OAAO,EAAE,UAAU,GAAI,IAC3C,CAAA;YACT,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,mCAAmC,CAAC,CAAC;gBAChD,OAAO,wBAAC,mBAAI,eACV,uBAAC,mBAAI,sCAA2B,EAChC,uBAAC,qBAAM,IAAC,KAAK,EAAC,UAAU,EAAC,OAAO,EAAE,UAAU,GAAI,IAC3C,CAAA;YACT,CAAC;IACL,CAAC;AACH,CAAC,CAAC;AApCW,QAAA,cAAc,kBAoCzB"}
@@ -0,0 +1,13 @@
1
+ import { ComposableScreenStepType } from "./types";
2
+ import { Theme } from "../../Theme/types";
3
+ type ContentProps = {
4
+ step: ComposableScreenStepType;
5
+ onContinue: () => void;
6
+ theme?: Theme;
7
+ };
8
+ export declare const ComposableScreenRenderer: {
9
+ (props: ContentProps): import("react/jsx-runtime").JSX.Element;
10
+ displayName: string;
11
+ };
12
+ export {};
13
+ //# sourceMappingURL=Renderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Renderer.d.ts","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/Renderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAA6C,MAAM,SAAS,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAO1C,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,wBAAwB,CAAC;IAC/B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AA8JF,eAAO,MAAM,wBAAwB;;;CAAsE,CAAC"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComposableScreenRenderer = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_native_1 = require("react-native");
6
+ const types_1 = require("./types");
7
+ const defaultTheme_1 = require("../../Theme/defaultTheme");
8
+ const helpers_1 = require("../../Theme/helpers");
9
+ const ErrorBoundary_1 = require("../../ErrorBoundary");
10
+ const OnboardingTemplate_1 = require("../../Templates/OnboardingTemplate");
11
+ const renderElement = (element, theme, parentType) => {
12
+ var _a, _b, _c, _d, _e;
13
+ if (element.type === "YStack" || element.type === "XStack") {
14
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
15
+ flexDirection: element.type === "XStack" ? "row" : "column",
16
+ gap: element.props.gap,
17
+ padding: element.props.padding,
18
+ paddingHorizontal: element.props.paddingHorizontal,
19
+ paddingVertical: element.props.paddingVertical,
20
+ margin: element.props.margin,
21
+ marginHorizontal: element.props.marginHorizontal,
22
+ marginVertical: element.props.marginVertical,
23
+ flex: element.props.flex,
24
+ width: element.props.width,
25
+ height: element.props.height,
26
+ minWidth: element.props.minWidth,
27
+ maxWidth: element.props.maxWidth,
28
+ minHeight: element.props.minHeight,
29
+ maxHeight: element.props.maxHeight,
30
+ flexShrink: (_a = element.props.flexShrink) !== null && _a !== void 0 ? _a : (parentType === "XStack" ? 1 : undefined),
31
+ flexWrap: element.props.flexWrap,
32
+ alignItems: element.props.alignItems,
33
+ justifyContent: element.props.justifyContent,
34
+ backgroundColor: element.props.backgroundColor,
35
+ borderWidth: element.props.borderWidth,
36
+ borderRadius: element.props.borderRadius,
37
+ borderColor: element.props.borderColor,
38
+ overflow: element.props.overflow,
39
+ opacity: element.props.opacity,
40
+ }, children: element.children.map((child) => renderElement(child, theme, element.type)) }, element.id));
41
+ }
42
+ if (element.type === "Text") {
43
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: {
44
+ fontSize: element.props.fontSize,
45
+ fontWeight: element.props.fontWeight,
46
+ color: (_b = element.props.color) !== null && _b !== void 0 ? _b : theme.colors.text.primary,
47
+ textAlign: element.props.textAlign,
48
+ letterSpacing: element.props.letterSpacing,
49
+ lineHeight: element.props.lineHeight,
50
+ backgroundColor: element.props.backgroundColor,
51
+ padding: element.props.padding,
52
+ paddingHorizontal: element.props.paddingHorizontal,
53
+ paddingVertical: element.props.paddingVertical,
54
+ margin: element.props.margin,
55
+ marginHorizontal: element.props.marginHorizontal,
56
+ marginVertical: element.props.marginVertical,
57
+ borderWidth: element.props.borderWidth,
58
+ borderRadius: element.props.borderRadius,
59
+ borderColor: element.props.borderColor,
60
+ opacity: element.props.opacity,
61
+ flexShrink: parentType === "XStack" ? 1 : undefined,
62
+ }, children: element.props.content }, element.id));
63
+ }
64
+ if (element.type === "Image") {
65
+ const hasExplicitHeight = element.props.height !== undefined;
66
+ const aspectRatio = hasExplicitHeight
67
+ ? undefined
68
+ : ((_c = element.props.aspectRatio) !== null && _c !== void 0 ? _c : 16 / 9);
69
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Image, { source: { uri: element.props.url }, resizeMode: (_d = element.props.resizeMode) !== null && _d !== void 0 ? _d : "cover", style: {
70
+ width: (_e = element.props.width) !== null && _e !== void 0 ? _e : "100%",
71
+ height: element.props.height,
72
+ aspectRatio,
73
+ borderRadius: element.props.borderRadius,
74
+ borderWidth: element.props.borderWidth,
75
+ borderColor: element.props.borderColor,
76
+ opacity: element.props.opacity,
77
+ margin: element.props.margin,
78
+ marginHorizontal: element.props.marginHorizontal,
79
+ marginVertical: element.props.marginVertical,
80
+ padding: element.props.padding,
81
+ paddingHorizontal: element.props.paddingHorizontal,
82
+ paddingVertical: element.props.paddingVertical,
83
+ } }, element.id));
84
+ }
85
+ return null;
86
+ };
87
+ const ComposableScreenRendererBase = ({ step, onContinue, theme = defaultTheme_1.defaultTheme }) => {
88
+ const validatedData = types_1.ComposableScreenStepTypeSchema.parse(step);
89
+ const { elements } = validatedData.payload;
90
+ return ((0, jsx_runtime_1.jsx)(OnboardingTemplate_1.OnboardingTemplate, { step: step, onContinue: onContinue, theme: theme, children: (0, jsx_runtime_1.jsxs)(react_native_1.ScrollView, { contentContainerStyle: styles.scrollContent, showsVerticalScrollIndicator: false, alwaysBounceVertical: false, children: [elements.map((element) => renderElement(element, theme)), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: styles.bottomSection, children: (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { style: [styles.ctaButton, { backgroundColor: theme.colors.primary }], onPress: onContinue, activeOpacity: 0.8, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
91
+ (0, helpers_1.getTextStyle)(theme, "button"),
92
+ { color: theme.colors.text.opposite },
93
+ ], children: validatedData.continueButtonLabel }) }) })] }) }));
94
+ };
95
+ const styles = react_native_1.StyleSheet.create({
96
+ container: {
97
+ flex: 1,
98
+ },
99
+ scrollContent: {
100
+ flexGrow: 1,
101
+ },
102
+ bottomSection: {
103
+ paddingHorizontal: 32,
104
+ alignItems: "center",
105
+ },
106
+ ctaButton: {
107
+ borderRadius: 90,
108
+ paddingVertical: 18,
109
+ paddingHorizontal: 24,
110
+ minWidth: 234,
111
+ alignItems: "center",
112
+ },
113
+ });
114
+ exports.ComposableScreenRenderer = (0, ErrorBoundary_1.withErrorBoundary)(ComposableScreenRendererBase, "ComposableScreen");
115
+ //# sourceMappingURL=Renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Renderer.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/Renderer.tsx"],"names":[],"mappings":";;;;AACA,+CAA2F;AAC3F,mCAA8F;AAE9F,2DAAwD;AACxD,iDAAmD;AAEnD,uDAAwD;AACxD,2EAAwE;AAQxE,MAAM,aAAa,GAAG,CAAC,OAAkB,EAAE,KAAY,EAAE,UAAgC,EAAmB,EAAE;;IAC5G,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3D,OAAO,CACL,uBAAC,mBAAI,IAEH,KAAK,EAAE;gBACL,aAAa,EAAE,OAAO,CAAC,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I,CAAC,QAAQ,EAAE;6BACtC,YAEA,aAAa,CAAC,mBAAmB,GAC7B,GACU,GACd,IACI,GACM,CACtB,CAAA;AACH,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;KACR;IACD,aAAa,EAAE;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,aAAa,EAAE;QACb,iBAAiB,EAAE,EAAE;QACrB,UAAU,EAAE,QAAQ;KACrB;IACD,SAAS,EAAE;QACT,YAAY,EAAE,EAAE;QAChB,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,EAAE;QACrB,QAAQ,EAAE,GAAG;QACb,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC,CAAC;AAEU,QAAA,wBAAwB,GAAG,IAAA,iCAAiB,EAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./Renderer";
2
+ export * from "./types";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Renderer"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,0CAAwB"}
@@ -0,0 +1,96 @@
1
+ import { z } from "zod";
2
+ export type UIElement = {
3
+ id: string;
4
+ name?: string;
5
+ type: "YStack" | "XStack";
6
+ props: {
7
+ gap?: number;
8
+ padding?: number;
9
+ paddingHorizontal?: number;
10
+ paddingVertical?: number;
11
+ margin?: number;
12
+ marginHorizontal?: number;
13
+ marginVertical?: number;
14
+ flex?: number;
15
+ width?: number;
16
+ height?: number;
17
+ minWidth?: number;
18
+ maxWidth?: number;
19
+ minHeight?: number;
20
+ maxHeight?: number;
21
+ alignItems?: "flex-start" | "center" | "flex-end" | "stretch";
22
+ justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around";
23
+ backgroundColor?: string;
24
+ flexWrap?: "wrap" | "nowrap";
25
+ flexShrink?: number;
26
+ borderWidth?: number;
27
+ borderRadius?: number;
28
+ borderColor?: string;
29
+ overflow?: "hidden" | "visible" | "scroll";
30
+ opacity?: number;
31
+ };
32
+ children: UIElement[];
33
+ } | {
34
+ id: string;
35
+ name?: string;
36
+ type: "Text";
37
+ props: {
38
+ content: string;
39
+ fontSize?: number;
40
+ fontWeight?: string;
41
+ color?: string;
42
+ textAlign?: "left" | "center" | "right";
43
+ letterSpacing?: number;
44
+ lineHeight?: number;
45
+ backgroundColor?: string;
46
+ padding?: number;
47
+ paddingHorizontal?: number;
48
+ paddingVertical?: number;
49
+ margin?: number;
50
+ marginHorizontal?: number;
51
+ marginVertical?: number;
52
+ borderWidth?: number;
53
+ borderRadius?: number;
54
+ borderColor?: string;
55
+ opacity?: number;
56
+ };
57
+ } | {
58
+ id: string;
59
+ name?: string;
60
+ type: "Image";
61
+ props: {
62
+ url: string;
63
+ width?: number;
64
+ height?: number;
65
+ aspectRatio?: number;
66
+ resizeMode?: "cover" | "contain" | "stretch" | "center";
67
+ borderRadius?: number;
68
+ borderWidth?: number;
69
+ borderColor?: string;
70
+ opacity?: number;
71
+ margin?: number;
72
+ marginHorizontal?: number;
73
+ marginVertical?: number;
74
+ padding?: number;
75
+ paddingHorizontal?: number;
76
+ paddingVertical?: number;
77
+ };
78
+ };
79
+ export declare const UIElementSchema: z.ZodType<UIElement>;
80
+ export declare const ComposableScreenStepPayloadSchema: z.ZodObject<{
81
+ elements: z.ZodArray<z.ZodType<UIElement, unknown, z.core.$ZodTypeInternals<UIElement, unknown>>>;
82
+ }, z.core.$strip>;
83
+ export declare const ComposableScreenStepTypeSchema: z.ZodObject<{
84
+ id: z.ZodString;
85
+ type: z.ZodLiteral<"ComposableScreen">;
86
+ name: z.ZodString;
87
+ displayProgressHeader: z.ZodBoolean;
88
+ payload: z.ZodObject<{
89
+ elements: z.ZodArray<z.ZodType<UIElement, unknown, z.core.$ZodTypeInternals<UIElement, unknown>>>;
90
+ }, z.core.$strip>;
91
+ customPayload: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
92
+ continueButtonLabel: z.ZodDefault<z.ZodOptional<z.ZodString>>;
93
+ figmaUrl: z.ZodNullable<z.ZodString>;
94
+ }, z.core.$strip>;
95
+ export type ComposableScreenStepType = z.infer<typeof ComposableScreenStepTypeSchema>;
96
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,MAAM,SAAS,GACjB;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IA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gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAoEN,eAAO,MAAM,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAsBhD,CAAC;AAGF,eAAO,MAAM,iCAAiC;;iBAE5C,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;iBASzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ComposableScreenStepTypeSchema = exports.ComposableScreenStepPayloadSchema = exports.UIElementSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const types_1 = require("../types");
6
+ const StackElementPropsSchema = zod_1.z.object({
7
+ gap: zod_1.z.number().optional(),
8
+ padding: zod_1.z.number().optional(),
9
+ paddingHorizontal: zod_1.z.number().optional(),
10
+ paddingVertical: zod_1.z.number().optional(),
11
+ margin: zod_1.z.number().optional(),
12
+ marginHorizontal: zod_1.z.number().optional(),
13
+ marginVertical: zod_1.z.number().optional(),
14
+ flex: zod_1.z.number().optional(),
15
+ width: zod_1.z.number().optional(),
16
+ height: zod_1.z.number().optional(),
17
+ minWidth: zod_1.z.number().optional(),
18
+ maxWidth: zod_1.z.number().optional(),
19
+ minHeight: zod_1.z.number().optional(),
20
+ maxHeight: zod_1.z.number().optional(),
21
+ alignItems: zod_1.z.enum(["flex-start", "center", "flex-end", "stretch"]).optional(),
22
+ justifyContent: zod_1.z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
23
+ backgroundColor: zod_1.z.string().optional(),
24
+ flexWrap: zod_1.z.enum(["wrap", "nowrap"]).optional(),
25
+ flexShrink: zod_1.z.number().optional(),
26
+ borderWidth: zod_1.z.number().optional(),
27
+ borderRadius: zod_1.z.number().optional(),
28
+ borderColor: zod_1.z.string().optional(),
29
+ overflow: zod_1.z.enum(["hidden", "visible", "scroll"]).optional(),
30
+ opacity: zod_1.z.number().min(0).max(1).optional(),
31
+ });
32
+ const TextElementPropsSchema = zod_1.z.object({
33
+ content: zod_1.z.string(),
34
+ fontSize: zod_1.z.number().optional(),
35
+ fontWeight: zod_1.z.string().optional(),
36
+ color: zod_1.z.string().optional(),
37
+ textAlign: zod_1.z.enum(["left", "center", "right"]).optional(),
38
+ letterSpacing: zod_1.z.number().optional(),
39
+ lineHeight: zod_1.z.number().optional(),
40
+ backgroundColor: zod_1.z.string().optional(),
41
+ padding: zod_1.z.number().optional(),
42
+ paddingHorizontal: zod_1.z.number().optional(),
43
+ paddingVertical: zod_1.z.number().optional(),
44
+ margin: zod_1.z.number().optional(),
45
+ marginHorizontal: zod_1.z.number().optional(),
46
+ marginVertical: zod_1.z.number().optional(),
47
+ borderWidth: zod_1.z.number().optional(),
48
+ borderRadius: zod_1.z.number().optional(),
49
+ borderColor: zod_1.z.string().optional(),
50
+ opacity: zod_1.z.number().min(0).max(1).optional(),
51
+ });
52
+ const ImageElementPropsSchema = zod_1.z.object({
53
+ url: zod_1.z.string(),
54
+ width: zod_1.z.number().optional(),
55
+ height: zod_1.z.number().optional(),
56
+ aspectRatio: zod_1.z.number().optional(),
57
+ resizeMode: zod_1.z.enum(["cover", "contain", "stretch", "center"]).optional(),
58
+ borderRadius: zod_1.z.number().optional(),
59
+ borderWidth: zod_1.z.number().optional(),
60
+ borderColor: zod_1.z.string().optional(),
61
+ opacity: zod_1.z.number().min(0).max(1).optional(),
62
+ margin: zod_1.z.number().optional(),
63
+ marginHorizontal: zod_1.z.number().optional(),
64
+ marginVertical: zod_1.z.number().optional(),
65
+ padding: zod_1.z.number().optional(),
66
+ paddingHorizontal: zod_1.z.number().optional(),
67
+ paddingVertical: zod_1.z.number().optional(),
68
+ });
69
+ exports.UIElementSchema = zod_1.z.lazy(() => zod_1.z.union([
70
+ zod_1.z.object({
71
+ id: zod_1.z.string(),
72
+ name: zod_1.z.string().optional(),
73
+ type: zod_1.z.union([zod_1.z.literal("YStack"), zod_1.z.literal("XStack")]),
74
+ props: StackElementPropsSchema,
75
+ children: zod_1.z.array(exports.UIElementSchema),
76
+ }),
77
+ zod_1.z.object({
78
+ id: zod_1.z.string(),
79
+ name: zod_1.z.string().optional(),
80
+ type: zod_1.z.literal("Text"),
81
+ props: TextElementPropsSchema,
82
+ }),
83
+ zod_1.z.object({
84
+ id: zod_1.z.string(),
85
+ name: zod_1.z.string().optional(),
86
+ type: zod_1.z.literal("Image"),
87
+ props: ImageElementPropsSchema,
88
+ }),
89
+ ]));
90
+ exports.ComposableScreenStepPayloadSchema = zod_1.z.object({
91
+ elements: zod_1.z.array(exports.UIElementSchema),
92
+ });
93
+ exports.ComposableScreenStepTypeSchema = zod_1.z.object({
94
+ id: zod_1.z.string(),
95
+ type: zod_1.z.literal("ComposableScreen"),
96
+ name: zod_1.z.string(),
97
+ displayProgressHeader: zod_1.z.boolean(),
98
+ payload: exports.ComposableScreenStepPayloadSchema,
99
+ customPayload: types_1.CustomPayloadSchema,
100
+ continueButtonLabel: zod_1.z.string().optional().default("Continue"),
101
+ figmaUrl: zod_1.z.string().nullable(),
102
+ });
103
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/UI/Pages/ComposableScreen/types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAA+C;AAmF/C,MAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,iBAAiB,EAAE,OA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B,CAAC;CACH,CAAC,CACH,CAAC;AAGW,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,uBAAe,CAAC;CACnC,CAAC,CAAC;AAEU,QAAA,8BAA8B,GAAG,OAAC,CAAC,MAAM,CAAC;IACrD,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC;IACnC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,qBAAqB,EAAE,OAAC,CAAC,OAAO,EAAE;IAClC,OAAO,EAAE,yCAAiC;IAC1C,aAAa,EAAE,2BAAmB;IAClC,mBAAmB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC;IAC9D,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC"}
@@ -2,6 +2,7 @@ export * from "./Carousel";
2
2
  export * from "./Commitment";
3
3
  export * from "./Loader";
4
4
  export * from "./MediaContent";
5
+ export * from "./ComposableScreen";
5
6
  export * from "./Picker";
6
7
  export * from "./Question";
7
8
  export * from "./Ratings";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/UI/Pages/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAG1B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/UI/Pages/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAG1B,cAAc,SAAS,CAAC"}
@@ -18,6 +18,7 @@ __exportStar(require("./Carousel"), exports);
18
18
  __exportStar(require("./Commitment"), exports);
19
19
  __exportStar(require("./Loader"), exports);
20
20
  __exportStar(require("./MediaContent"), exports);
21
+ __exportStar(require("./ComposableScreen"), exports);
21
22
  __exportStar(require("./Picker"), exports);
22
23
  __exportStar(require("./Question"), exports);
23
24
  __exportStar(require("./Ratings"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/UI/Pages/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAC/B,2CAAyB;AACzB,6CAA2B;AAC3B,4CAA0B;AAE1B,eAAe;AACf,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/UI/Pages/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,+CAA6B;AAC7B,2CAAyB;AACzB,iDAA+B;AAC/B,qDAAmC;AACnC,2CAAyB;AACzB,6CAA2B;AAC3B,4CAA0B;AAE1B,eAAe;AACf,0CAAwB"}
@@ -1,4 +1,4 @@
1
- import { CarouselStepType, CommitmentStepType, LoaderStepType, MediaContentStepType, PickerStepType, RatingsStepType, QuestionStepType } from "./Pages";
1
+ import { CarouselStepType, CommitmentStepType, LoaderStepType, MediaContentStepType, ComposableScreenStepType, PickerStepType, RatingsStepType, QuestionStepType } from "./Pages";
2
2
  export type CustomStepType<StepPayload = any> = {
3
3
  id: string;
4
4
  type: "CustomScreen";
@@ -19,5 +19,5 @@ export type BaseStepType = {
19
19
  payload?: any;
20
20
  customPayload?: any;
21
21
  };
22
- export type OnboardingStepType = RatingsStepType | MediaContentStepType | PickerStepType | CommitmentStepType | CarouselStepType | LoaderStepType | QuestionStepType | CustomStepType;
22
+ export type OnboardingStepType = RatingsStepType | MediaContentStepType | ComposableScreenStepType | PickerStepType | CommitmentStepType | CarouselStepType | LoaderStepType | QuestionStepType | CustomStepType;
23
23
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/UI/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,cAAc,CAAC,WAAW,GAAG,GAAG,IAAI;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,aAAa,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,oBAAoB,GACpB,cAAc,GACd,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,cAAc,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/UI/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,eAAe,EACf,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,cAAc,CAAC,WAAW,GAAG,GAAG,IAAI;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,OAAO,CAAC;IAC/B,OAAO,EAAE;QACP,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,aAAa,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,oBAAoB,GACpB,wBAAwB,GACxB,cAAc,GACd,kBAAkB,GAClB,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@rocapine/react-native-onboarding-ui",
3
- "version": "1.1.6",
3
+ "version": "1.3.0",
4
4
  "description": "UI components and renderers for Rocapine Onboarding Studio - Built on top of the headless SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc && cp -r src/assets dist/",
9
9
  "watch": "tsc --watch",
10
+ "type:check": "tsc --noEmit",
10
11
  "patch": "npm version patch && npm run build && npm publish"
11
12
  },
12
13
  "keywords": [
@@ -1,5 +1,5 @@
1
1
  import { OnboardingStepType } from "./types";
2
- import { RatingsRenderer, PickerRenderer, CommitmentRenderer, CarouselRenderer, LoaderRenderer, MediaContentRenderer, QuestionRenderer, QuestionAnswerButtonProps, QuestionAnswersListProps } from "./Pages";
2
+ import { RatingsRenderer, PickerRenderer, CommitmentRenderer, CarouselRenderer, LoaderRenderer, MediaContentRenderer, ComposableScreenRenderer, QuestionRenderer, QuestionAnswerButtonProps, QuestionAnswersListProps } from "./Pages";
3
3
  import { View, Text, Button } from 'react-native';
4
4
  import { useTheme } from "./Theme/useTheme";
5
5
  import { Theme } from "./Theme";
@@ -34,6 +34,8 @@ export const OnboardingPage = ({ step, onContinue, isSandbox }: OnboardingPagePr
34
34
  return <LoaderRenderer step={step} onContinue={onContinue} theme={theme} />;
35
35
  case 'Question':
36
36
  return <QuestionRenderer step={step} onContinue={onContinue} theme={theme} />;
37
+ case 'ComposableScreen':
38
+ return <ComposableScreenRenderer step={step} onContinue={onContinue} theme={theme} />;
37
39
  default:
38
40
  if (isSandbox) {
39
41
  // @ts-ignore
@@ -0,0 +1,173 @@
1
+ import React from "react";
2
+ import { View, Text, Image, ScrollView, StyleSheet, TouchableOpacity } from "react-native";
3
+ import { ComposableScreenStepType, ComposableScreenStepTypeSchema, UIElement } from "./types";
4
+ import { Theme } from "../../Theme/types";
5
+ import { defaultTheme } from "../../Theme/defaultTheme";
6
+ import { getTextStyle } from "../../Theme/helpers";
7
+
8
+ import { withErrorBoundary } from "../../ErrorBoundary";
9
+ import { OnboardingTemplate } from "../../Templates/OnboardingTemplate";
10
+
11
+ type ContentProps = {
12
+ step: ComposableScreenStepType;
13
+ onContinue: () => void;
14
+ theme?: Theme;
15
+ };
16
+
17
+ const renderElement = (element: UIElement, theme: Theme, parentType?: "XStack" | "YStack"): React.ReactNode => {
18
+ if (element.type === "YStack" || element.type === "XStack") {
19
+ return (
20
+ <View
21
+ key={element.id}
22
+ style={{
23
+ flexDirection: element.type === "XStack" ? "row" : "column",
24
+ gap: element.props.gap,
25
+ padding: element.props.padding,
26
+ paddingHorizontal: element.props.paddingHorizontal,
27
+ paddingVertical: element.props.paddingVertical,
28
+ margin: element.props.margin,
29
+ marginHorizontal: element.props.marginHorizontal,
30
+ marginVertical: element.props.marginVertical,
31
+ flex: element.props.flex,
32
+ width: element.props.width,
33
+ height: element.props.height,
34
+ minWidth: element.props.minWidth,
35
+ maxWidth: element.props.maxWidth,
36
+ minHeight: element.props.minHeight,
37
+ maxHeight: element.props.maxHeight,
38
+ flexShrink: element.props.flexShrink ?? (parentType === "XStack" ? 1 : undefined),
39
+ flexWrap: element.props.flexWrap,
40
+ alignItems: element.props.alignItems,
41
+ justifyContent: element.props.justifyContent,
42
+ backgroundColor: element.props.backgroundColor,
43
+ borderWidth: element.props.borderWidth,
44
+ borderRadius: element.props.borderRadius,
45
+ borderColor: element.props.borderColor,
46
+ overflow: element.props.overflow,
47
+ opacity: element.props.opacity,
48
+ }}
49
+ >
50
+ {element.children.map((child) => renderElement(child, theme, element.type))}
51
+ </View>
52
+ );
53
+ }
54
+
55
+ if (element.type === "Text") {
56
+ return (
57
+ <Text
58
+ key={element.id}
59
+ style={{
60
+ fontSize: element.props.fontSize,
61
+ fontWeight: element.props.fontWeight as any,
62
+ color: element.props.color ?? theme.colors.text.primary,
63
+ textAlign: element.props.textAlign,
64
+ letterSpacing: element.props.letterSpacing,
65
+ lineHeight: element.props.lineHeight,
66
+ backgroundColor: element.props.backgroundColor,
67
+ padding: element.props.padding,
68
+ paddingHorizontal: element.props.paddingHorizontal,
69
+ paddingVertical: element.props.paddingVertical,
70
+ margin: element.props.margin,
71
+ marginHorizontal: element.props.marginHorizontal,
72
+ marginVertical: element.props.marginVertical,
73
+ borderWidth: element.props.borderWidth,
74
+ borderRadius: element.props.borderRadius,
75
+ borderColor: element.props.borderColor,
76
+ opacity: element.props.opacity,
77
+ flexShrink: parentType === "XStack" ? 1 : undefined,
78
+ }}
79
+ >
80
+ {element.props.content}
81
+ </Text>
82
+ );
83
+ }
84
+
85
+ if (element.type === "Image") {
86
+ const hasExplicitHeight = element.props.height !== undefined;
87
+ const aspectRatio = hasExplicitHeight
88
+ ? undefined
89
+ : (element.props.aspectRatio ?? 16 / 9);
90
+ return (
91
+ <Image
92
+ key={element.id}
93
+ source={{ uri: element.props.url }}
94
+ resizeMode={element.props.resizeMode ?? "cover"}
95
+ style={{
96
+ width: element.props.width ?? "100%",
97
+ height: element.props.height,
98
+ aspectRatio,
99
+ borderRadius: element.props.borderRadius,
100
+ borderWidth: element.props.borderWidth,
101
+ borderColor: element.props.borderColor,
102
+ opacity: element.props.opacity,
103
+ margin: element.props.margin,
104
+ marginHorizontal: element.props.marginHorizontal,
105
+ marginVertical: element.props.marginVertical,
106
+ padding: element.props.padding,
107
+ paddingHorizontal: element.props.paddingHorizontal,
108
+ paddingVertical: element.props.paddingVertical,
109
+ }}
110
+ />
111
+ );
112
+ }
113
+
114
+ return null;
115
+ };
116
+
117
+ const ComposableScreenRendererBase = ({ step, onContinue, theme = defaultTheme }: ContentProps) => {
118
+ const validatedData = ComposableScreenStepTypeSchema.parse(step);
119
+ const { elements } = validatedData.payload;
120
+ return (
121
+ <OnboardingTemplate
122
+ step={step}
123
+ onContinue={onContinue}
124
+ theme={theme}
125
+ >
126
+ <ScrollView
127
+ contentContainerStyle={styles.scrollContent}
128
+ showsVerticalScrollIndicator={false}
129
+ alwaysBounceVertical={false}
130
+ >
131
+ {elements.map((element) => renderElement(element, theme))}
132
+ <View style={styles.bottomSection}>
133
+ <TouchableOpacity
134
+ style={[styles.ctaButton, { backgroundColor: theme.colors.primary }]}
135
+ onPress={onContinue}
136
+ activeOpacity={0.8}
137
+ >
138
+ <Text
139
+ style={[
140
+ getTextStyle(theme, "button"),
141
+ { color: theme.colors.text.opposite },
142
+ ]}
143
+ >
144
+ {validatedData.continueButtonLabel}
145
+ </Text>
146
+ </TouchableOpacity>
147
+ </View>
148
+ </ScrollView>
149
+ </OnboardingTemplate>
150
+ )
151
+ };
152
+
153
+ const styles = StyleSheet.create({
154
+ container: {
155
+ flex: 1,
156
+ },
157
+ scrollContent: {
158
+ flexGrow: 1,
159
+ },
160
+ bottomSection: {
161
+ paddingHorizontal: 32,
162
+ alignItems: "center",
163
+ },
164
+ ctaButton: {
165
+ borderRadius: 90,
166
+ paddingVertical: 18,
167
+ paddingHorizontal: 24,
168
+ minWidth: 234,
169
+ alignItems: "center",
170
+ },
171
+ });
172
+
173
+ export const ComposableScreenRenderer = withErrorBoundary(ComposableScreenRendererBase, "ComposableScreen");
@@ -0,0 +1,2 @@
1
+ export * from "./Renderer";
2
+ export * from "./types";
@@ -0,0 +1,191 @@
1
+ import { z } from "zod";
2
+ import { CustomPayloadSchema } from "../types";
3
+
4
+ export type UIElement =
5
+ | {
6
+ id: string;
7
+ name?: string;
8
+ type: "YStack" | "XStack";
9
+ props: {
10
+ gap?: number;
11
+ padding?: number;
12
+ paddingHorizontal?: number;
13
+ paddingVertical?: number;
14
+ margin?: number;
15
+ marginHorizontal?: number;
16
+ marginVertical?: number;
17
+ flex?: number;
18
+ width?: number;
19
+ height?: number;
20
+ minWidth?: number;
21
+ maxWidth?: number;
22
+ minHeight?: number;
23
+ maxHeight?: number;
24
+ alignItems?: "flex-start" | "center" | "flex-end" | "stretch";
25
+ justifyContent?: "flex-start" | "center" | "flex-end" | "space-between" | "space-around";
26
+ backgroundColor?: string;
27
+ flexWrap?: "wrap" | "nowrap";
28
+ flexShrink?: number;
29
+ borderWidth?: number;
30
+ borderRadius?: number;
31
+ borderColor?: string;
32
+ overflow?: "hidden" | "visible" | "scroll";
33
+ opacity?: number;
34
+ };
35
+ children: UIElement[];
36
+ }
37
+ | {
38
+ id: string;
39
+ name?: string;
40
+ type: "Text";
41
+ props: {
42
+ content: string;
43
+ fontSize?: number;
44
+ fontWeight?: string;
45
+ color?: string;
46
+ textAlign?: "left" | "center" | "right";
47
+ letterSpacing?: number;
48
+ lineHeight?: number;
49
+ backgroundColor?: string;
50
+ padding?: number;
51
+ paddingHorizontal?: number;
52
+ paddingVertical?: number;
53
+ margin?: number;
54
+ marginHorizontal?: number;
55
+ marginVertical?: number;
56
+ borderWidth?: number;
57
+ borderRadius?: number;
58
+ borderColor?: string;
59
+ opacity?: number;
60
+ };
61
+ }
62
+ | {
63
+ id: string;
64
+ name?: string;
65
+ type: "Image";
66
+ props: {
67
+ url: string;
68
+ width?: number;
69
+ height?: number;
70
+ aspectRatio?: number;
71
+ resizeMode?: "cover" | "contain" | "stretch" | "center";
72
+ borderRadius?: number;
73
+ borderWidth?: number;
74
+ borderColor?: string;
75
+ opacity?: number;
76
+ margin?: number;
77
+ marginHorizontal?: number;
78
+ marginVertical?: number;
79
+ padding?: number;
80
+ paddingHorizontal?: number;
81
+ paddingVertical?: number;
82
+ };
83
+ };
84
+
85
+ const StackElementPropsSchema = z.object({
86
+ gap: z.number().optional(),
87
+ padding: z.number().optional(),
88
+ paddingHorizontal: z.number().optional(),
89
+ paddingVertical: z.number().optional(),
90
+ margin: z.number().optional(),
91
+ marginHorizontal: z.number().optional(),
92
+ marginVertical: z.number().optional(),
93
+ flex: z.number().optional(),
94
+ width: z.number().optional(),
95
+ height: z.number().optional(),
96
+ minWidth: z.number().optional(),
97
+ maxWidth: z.number().optional(),
98
+ minHeight: z.number().optional(),
99
+ maxHeight: z.number().optional(),
100
+ alignItems: z.enum(["flex-start", "center", "flex-end", "stretch"]).optional(),
101
+ justifyContent: z.enum(["flex-start", "center", "flex-end", "space-between", "space-around"]).optional(),
102
+ backgroundColor: z.string().optional(),
103
+ flexWrap: z.enum(["wrap", "nowrap"]).optional(),
104
+ flexShrink: z.number().optional(),
105
+ borderWidth: z.number().optional(),
106
+ borderRadius: z.number().optional(),
107
+ borderColor: z.string().optional(),
108
+ overflow: z.enum(["hidden", "visible", "scroll"]).optional(),
109
+ opacity: z.number().min(0).max(1).optional(),
110
+ });
111
+
112
+ const TextElementPropsSchema = z.object({
113
+ content: z.string(),
114
+ fontSize: z.number().optional(),
115
+ fontWeight: z.string().optional(),
116
+ color: z.string().optional(),
117
+ textAlign: z.enum(["left", "center", "right"]).optional(),
118
+ letterSpacing: z.number().optional(),
119
+ lineHeight: z.number().optional(),
120
+ backgroundColor: z.string().optional(),
121
+ padding: z.number().optional(),
122
+ paddingHorizontal: z.number().optional(),
123
+ paddingVertical: z.number().optional(),
124
+ margin: z.number().optional(),
125
+ marginHorizontal: z.number().optional(),
126
+ marginVertical: z.number().optional(),
127
+ borderWidth: z.number().optional(),
128
+ borderRadius: z.number().optional(),
129
+ borderColor: z.string().optional(),
130
+ opacity: z.number().min(0).max(1).optional(),
131
+ });
132
+
133
+ const ImageElementPropsSchema = z.object({
134
+ url: z.string(),
135
+ width: z.number().optional(),
136
+ height: z.number().optional(),
137
+ aspectRatio: z.number().optional(),
138
+ resizeMode: z.enum(["cover", "contain", "stretch", "center"]).optional(),
139
+ borderRadius: z.number().optional(),
140
+ borderWidth: z.number().optional(),
141
+ borderColor: z.string().optional(),
142
+ opacity: z.number().min(0).max(1).optional(),
143
+ margin: z.number().optional(),
144
+ marginHorizontal: z.number().optional(),
145
+ marginVertical: z.number().optional(),
146
+ padding: z.number().optional(),
147
+ paddingHorizontal: z.number().optional(),
148
+ paddingVertical: z.number().optional(),
149
+ });
150
+
151
+ export const UIElementSchema: z.ZodType<UIElement> = z.lazy(() =>
152
+ z.union([
153
+ z.object({
154
+ id: z.string(),
155
+ name: z.string().optional(),
156
+ type: z.union([z.literal("YStack"), z.literal("XStack")]),
157
+ props: StackElementPropsSchema,
158
+ children: z.array(UIElementSchema),
159
+ }),
160
+ z.object({
161
+ id: z.string(),
162
+ name: z.string().optional(),
163
+ type: z.literal("Text"),
164
+ props: TextElementPropsSchema,
165
+ }),
166
+ z.object({
167
+ id: z.string(),
168
+ name: z.string().optional(),
169
+ type: z.literal("Image"),
170
+ props: ImageElementPropsSchema,
171
+ }),
172
+ ])
173
+ );
174
+
175
+
176
+ export const ComposableScreenStepPayloadSchema = z.object({
177
+ elements: z.array(UIElementSchema),
178
+ });
179
+
180
+ export const ComposableScreenStepTypeSchema = z.object({
181
+ id: z.string(),
182
+ type: z.literal("ComposableScreen"),
183
+ name: z.string(),
184
+ displayProgressHeader: z.boolean(),
185
+ payload: ComposableScreenStepPayloadSchema,
186
+ customPayload: CustomPayloadSchema,
187
+ continueButtonLabel: z.string().optional().default("Continue"),
188
+ figmaUrl: z.string().nullable(),
189
+ });
190
+
191
+ export type ComposableScreenStepType = z.infer<typeof ComposableScreenStepTypeSchema>;
@@ -2,6 +2,7 @@ export * from "./Carousel";
2
2
  export * from "./Commitment";
3
3
  export * from "./Loader";
4
4
  export * from "./MediaContent";
5
+ export * from "./ComposableScreen";
5
6
  export * from "./Picker";
6
7
  export * from "./Question";
7
8
  export * from "./Ratings";
package/src/UI/types.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  CommitmentStepType,
4
4
  LoaderStepType,
5
5
  MediaContentStepType,
6
+ ComposableScreenStepType,
6
7
  PickerStepType,
7
8
  RatingsStepType,
8
9
  QuestionStepType,
@@ -33,6 +34,7 @@ export type BaseStepType = {
33
34
  export type OnboardingStepType =
34
35
  | RatingsStepType
35
36
  | MediaContentStepType
37
+ | ComposableScreenStepType
36
38
  | PickerStepType
37
39
  | CommitmentStepType
38
40
  | CarouselStepType