@rocapine/react-native-onboarding 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 +35 -17
- package/dist/onboarding-example.d.ts +83 -0
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +51 -0
- package/dist/onboarding-example.js.map +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +96 -0
- package/dist/steps/ComposableScreen/types.d.ts.map +1 -0
- package/dist/steps/ComposableScreen/types.js +103 -0
- package/dist/steps/ComposableScreen/types.js.map +1 -0
- package/dist/steps/types.d.ts +2 -1
- package/dist/steps/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/onboarding-example.ts +52 -0
- package/src/steps/ComposableScreen/types.ts +190 -0
- package/src/steps/types.ts +2 -0
package/README.md
CHANGED
|
@@ -2,19 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
**A CMS-driven onboarding system for React Native mobile apps.**
|
|
4
4
|
|
|
5
|
-
Build beautiful, customizable onboarding flows that update instantly without app
|
|
5
|
+
Build beautiful, customizable onboarding flows that update instantly without app
|
|
6
|
+
releases.
|
|
6
7
|
|
|
7
8
|
---
|
|
8
9
|
|
|
9
10
|
## ✨ Features
|
|
10
11
|
|
|
11
|
-
- 🎨 **Pre-built Components** - Ready-to-use screens (ratings, pickers,
|
|
12
|
+
- 🎨 **Pre-built Components** - Ready-to-use screens (ratings, pickers,
|
|
13
|
+
carousels, media content, and more)
|
|
12
14
|
- 🔄 **CMS-Driven** - Update onboarding flows remotely without app releases
|
|
13
15
|
- 📱 **React Native** - Works with Expo and bare React Native projects
|
|
14
16
|
- 🎯 **Type-Safe** - Full TypeScript support with runtime validation
|
|
15
17
|
- 💾 **Offline Support** - Built-in caching with AsyncStorage
|
|
16
18
|
- 🎭 **Themeable** - Customizable colors, typography, and styling
|
|
17
|
-
- 🔧 **Extensible** - Three levels of customization from theme tokens to
|
|
19
|
+
- 🔧 **Extensible** - Three levels of customization from theme tokens to
|
|
20
|
+
complete renderer overrides
|
|
18
21
|
|
|
19
22
|
---
|
|
20
23
|
|
|
@@ -58,8 +61,8 @@ export default function RootLayout() {
|
|
|
58
61
|
|
|
59
62
|
```typescript
|
|
60
63
|
import {
|
|
61
|
-
useOnboardingQuestions,
|
|
62
64
|
OnboardingPage,
|
|
65
|
+
useOnboardingQuestions,
|
|
63
66
|
} from "@rocapine/react-native-onboarding";
|
|
64
67
|
|
|
65
68
|
export default function OnboardingScreen() {
|
|
@@ -87,29 +90,38 @@ That's it! 🎉
|
|
|
87
90
|
|
|
88
91
|
Complete documentation for using the SDK in your app:
|
|
89
92
|
|
|
90
|
-
- **[Getting Started](./docs/getting-started.mdx)** - Installation, setup, and
|
|
91
|
-
|
|
93
|
+
- **[Getting Started](./docs/getting-started.mdx)** - Installation, setup, and
|
|
94
|
+
your first onboarding flow
|
|
95
|
+
- **[Core Concepts](./docs/core-concepts.mdx)** - How the SDK works, caching,
|
|
96
|
+
progress tracking
|
|
92
97
|
- **[API Reference](./docs/api-reference.mdx)** - Complete API documentation
|
|
93
|
-
- **[Page Types](./docs/page-types.mdx)** - Available page types and their
|
|
98
|
+
- **[Page Types](./docs/page-types.mdx)** - Available page types and their
|
|
99
|
+
features
|
|
94
100
|
|
|
95
101
|
### Customization
|
|
96
102
|
|
|
97
103
|
Learn how to customize your onboarding experience:
|
|
98
104
|
|
|
99
|
-
- **[Customization Overview](./docs/customization/intro.mdx)** - Choose your
|
|
100
|
-
|
|
101
|
-
- **[Level
|
|
102
|
-
|
|
105
|
+
- **[Customization Overview](./docs/customization/intro.mdx)** - Choose your
|
|
106
|
+
customization level
|
|
107
|
+
- **[Level 1: Theming](./docs/customization/theming.mdx)** - Colors, typography,
|
|
108
|
+
and semantic styles
|
|
109
|
+
- **[Level 2: Custom Components](./docs/customization/custom-components.mdx)** -
|
|
110
|
+
Replace specific UI components
|
|
111
|
+
- **[Level 3: Custom Renderers](./docs/customization/custom-renderers.mdx)** -
|
|
112
|
+
Complete screen control
|
|
103
113
|
|
|
104
114
|
### Support
|
|
105
115
|
|
|
106
|
-
- **[Troubleshooting](./docs/troubleshooting.mdx)** - Common issues and
|
|
116
|
+
- **[Troubleshooting](./docs/troubleshooting.mdx)** - Common issues and
|
|
117
|
+
solutions
|
|
107
118
|
|
|
108
119
|
### For Contributors
|
|
109
120
|
|
|
110
121
|
Want to contribute to the SDK?
|
|
111
122
|
|
|
112
|
-
- **[Contributing Guide](./CONTRIBUTING.md)** - Development setup, architecture,
|
|
123
|
+
- **[Contributing Guide](./CONTRIBUTING.md)** - Development setup, architecture,
|
|
124
|
+
and contribution guidelines
|
|
113
125
|
|
|
114
126
|
---
|
|
115
127
|
|
|
@@ -125,7 +137,7 @@ Customize colors, typography, and semantic styles:
|
|
|
125
137
|
colors: { primary: "#FF5733" },
|
|
126
138
|
typography: { fontFamily: { title: "CustomFont-Bold" } },
|
|
127
139
|
}}
|
|
128
|
-
|
|
140
|
+
/>;
|
|
129
141
|
```
|
|
130
142
|
|
|
131
143
|
### Level 2: Custom Components
|
|
@@ -138,7 +150,7 @@ Replace specific UI components:
|
|
|
138
150
|
QuestionAnswerButton: CustomButton,
|
|
139
151
|
QuestionAnswersList: AnimatedList,
|
|
140
152
|
}}
|
|
141
|
-
|
|
153
|
+
/>;
|
|
142
154
|
```
|
|
143
155
|
|
|
144
156
|
### Level 3: Custom Renderers
|
|
@@ -168,6 +180,10 @@ export default function OnboardingScreen() {
|
|
|
168
180
|
- **Loader** - Sequential progress animation with optional carousel
|
|
169
181
|
- **Ratings** - App store rating prompts with social proof
|
|
170
182
|
- **Commitment** - User commitment and agreement screens
|
|
183
|
+
- **ComposableScreen** _(under development)_ - Declarative layout system driven
|
|
184
|
+
entirely from the CMS. Build arbitrary screens by composing `YStack`,
|
|
185
|
+
`XStack`, and `Text` elements with full layout, spacing, border, and
|
|
186
|
+
typography control — no custom renderer needed.
|
|
171
187
|
|
|
172
188
|
[Learn more about page types →](./docs/page-types.mdx)
|
|
173
189
|
|
|
@@ -199,7 +215,8 @@ npm start
|
|
|
199
215
|
|
|
200
216
|
## 🤝 Contributing
|
|
201
217
|
|
|
202
|
-
We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md)
|
|
218
|
+
We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md)
|
|
219
|
+
for details.
|
|
203
220
|
|
|
204
221
|
### Publishing:
|
|
205
222
|
|
|
@@ -214,7 +231,8 @@ We welcome contributions! Please see our [Contributing Guide](./CONTRIBUTING.md)
|
|
|
214
231
|
## 📧 Support
|
|
215
232
|
|
|
216
233
|
- **Email:** support@rocapine.com
|
|
217
|
-
- **Issues:**
|
|
234
|
+
- **Issues:**
|
|
235
|
+
[GitHub Issues](https://github.com/rocapine/react-native-onboarding-studio/issues)
|
|
218
236
|
- **Documentation:** [Rocapine Docs](https://docs.rocapine.com)
|
|
219
237
|
|
|
220
238
|
---
|
|
@@ -27,6 +27,7 @@ export declare const onboardingExample: {
|
|
|
27
27
|
variant?: undefined;
|
|
28
28
|
duration?: undefined;
|
|
29
29
|
didYouKnowImages?: undefined;
|
|
30
|
+
elements?: undefined;
|
|
30
31
|
socialProofs?: undefined;
|
|
31
32
|
rateTheAppButtonLabel?: undefined;
|
|
32
33
|
};
|
|
@@ -54,6 +55,7 @@ export declare const onboardingExample: {
|
|
|
54
55
|
variant?: undefined;
|
|
55
56
|
duration?: undefined;
|
|
56
57
|
didYouKnowImages?: undefined;
|
|
58
|
+
elements?: undefined;
|
|
57
59
|
socialProofs?: undefined;
|
|
58
60
|
rateTheAppButtonLabel?: undefined;
|
|
59
61
|
};
|
|
@@ -78,6 +80,7 @@ export declare const onboardingExample: {
|
|
|
78
80
|
variant?: undefined;
|
|
79
81
|
duration?: undefined;
|
|
80
82
|
didYouKnowImages?: undefined;
|
|
83
|
+
elements?: undefined;
|
|
81
84
|
socialProofs?: undefined;
|
|
82
85
|
rateTheAppButtonLabel?: undefined;
|
|
83
86
|
};
|
|
@@ -108,6 +111,7 @@ export declare const onboardingExample: {
|
|
|
108
111
|
subtitle?: undefined;
|
|
109
112
|
multipleAnswer?: undefined;
|
|
110
113
|
pickerType?: undefined;
|
|
114
|
+
elements?: undefined;
|
|
111
115
|
socialProofs?: undefined;
|
|
112
116
|
rateTheAppButtonLabel?: undefined;
|
|
113
117
|
};
|
|
@@ -115,6 +119,84 @@ export declare const onboardingExample: {
|
|
|
115
119
|
customPayload: {};
|
|
116
120
|
continueButtonLabel: string;
|
|
117
121
|
displayProgressHeader: false;
|
|
122
|
+
} | {
|
|
123
|
+
id: string;
|
|
124
|
+
name: string;
|
|
125
|
+
type: string;
|
|
126
|
+
displayProgressHeader: true;
|
|
127
|
+
payload: {
|
|
128
|
+
elements: {
|
|
129
|
+
id: string;
|
|
130
|
+
type: string;
|
|
131
|
+
props: {
|
|
132
|
+
gap: number;
|
|
133
|
+
padding: number;
|
|
134
|
+
};
|
|
135
|
+
children: ({
|
|
136
|
+
id: string;
|
|
137
|
+
type: string;
|
|
138
|
+
props: {
|
|
139
|
+
url: string;
|
|
140
|
+
height: number;
|
|
141
|
+
resizeMode: string;
|
|
142
|
+
borderRadius: number;
|
|
143
|
+
content?: undefined;
|
|
144
|
+
fontSize?: undefined;
|
|
145
|
+
fontWeight?: undefined;
|
|
146
|
+
textAlign?: undefined;
|
|
147
|
+
lineHeight?: undefined;
|
|
148
|
+
opacity?: undefined;
|
|
149
|
+
};
|
|
150
|
+
} | {
|
|
151
|
+
id: string;
|
|
152
|
+
type: string;
|
|
153
|
+
props: {
|
|
154
|
+
content: string;
|
|
155
|
+
fontSize: number;
|
|
156
|
+
fontWeight: string;
|
|
157
|
+
textAlign: string;
|
|
158
|
+
url?: undefined;
|
|
159
|
+
height?: undefined;
|
|
160
|
+
resizeMode?: undefined;
|
|
161
|
+
borderRadius?: undefined;
|
|
162
|
+
lineHeight?: undefined;
|
|
163
|
+
opacity?: undefined;
|
|
164
|
+
};
|
|
165
|
+
} | {
|
|
166
|
+
id: string;
|
|
167
|
+
type: string;
|
|
168
|
+
props: {
|
|
169
|
+
content: string;
|
|
170
|
+
fontSize: number;
|
|
171
|
+
textAlign: string;
|
|
172
|
+
lineHeight: number;
|
|
173
|
+
opacity: number;
|
|
174
|
+
url?: undefined;
|
|
175
|
+
height?: undefined;
|
|
176
|
+
resizeMode?: undefined;
|
|
177
|
+
borderRadius?: undefined;
|
|
178
|
+
fontWeight?: undefined;
|
|
179
|
+
};
|
|
180
|
+
})[];
|
|
181
|
+
}[];
|
|
182
|
+
title?: undefined;
|
|
183
|
+
description?: undefined;
|
|
184
|
+
mediaSource?: undefined;
|
|
185
|
+
answers?: undefined;
|
|
186
|
+
infoBox?: undefined;
|
|
187
|
+
subtitle?: undefined;
|
|
188
|
+
multipleAnswer?: undefined;
|
|
189
|
+
pickerType?: undefined;
|
|
190
|
+
steps?: undefined;
|
|
191
|
+
variant?: undefined;
|
|
192
|
+
duration?: undefined;
|
|
193
|
+
didYouKnowImages?: undefined;
|
|
194
|
+
socialProofs?: undefined;
|
|
195
|
+
rateTheAppButtonLabel?: undefined;
|
|
196
|
+
};
|
|
197
|
+
figmaUrl: null;
|
|
198
|
+
customPayload: {};
|
|
199
|
+
continueButtonLabel: string;
|
|
118
200
|
} | {
|
|
119
201
|
id: string;
|
|
120
202
|
name: string;
|
|
@@ -138,6 +220,7 @@ export declare const onboardingExample: {
|
|
|
138
220
|
variant?: undefined;
|
|
139
221
|
duration?: undefined;
|
|
140
222
|
didYouKnowImages?: undefined;
|
|
223
|
+
elements?: undefined;
|
|
141
224
|
};
|
|
142
225
|
figmaUrl: null;
|
|
143
226
|
customPayload: {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-example.d.ts","sourceRoot":"","sources":["../src/onboarding-example.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"onboarding-example.d.ts","sourceRoot":"","sources":["../src/onboarding-example.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoKR,CAAC"}
|
|
@@ -89,6 +89,57 @@ exports.onboardingExample = {
|
|
|
89
89
|
continueButtonLabel: "Continue",
|
|
90
90
|
displayProgressHeader: false,
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
id: "composable-screen-demo",
|
|
94
|
+
name: "Composable Screen",
|
|
95
|
+
type: "ComposableScreen",
|
|
96
|
+
displayProgressHeader: true,
|
|
97
|
+
payload: {
|
|
98
|
+
elements: [
|
|
99
|
+
{
|
|
100
|
+
id: "root",
|
|
101
|
+
type: "YStack",
|
|
102
|
+
props: { gap: 24, padding: 24 },
|
|
103
|
+
children: [
|
|
104
|
+
{
|
|
105
|
+
id: "hero-image",
|
|
106
|
+
type: "Image",
|
|
107
|
+
props: {
|
|
108
|
+
url: "https://picsum.photos/800/400?grayscale",
|
|
109
|
+
height: 180,
|
|
110
|
+
resizeMode: "cover",
|
|
111
|
+
borderRadius: 16,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "headline",
|
|
116
|
+
type: "Text",
|
|
117
|
+
props: {
|
|
118
|
+
content: "Built from the CMS",
|
|
119
|
+
fontSize: 28,
|
|
120
|
+
fontWeight: "700",
|
|
121
|
+
textAlign: "center",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
id: "subheadline",
|
|
126
|
+
type: "Text",
|
|
127
|
+
props: {
|
|
128
|
+
content: "This screen is composed entirely from a JSON payload — no custom renderer needed.",
|
|
129
|
+
fontSize: 15,
|
|
130
|
+
textAlign: "center",
|
|
131
|
+
lineHeight: 22,
|
|
132
|
+
opacity: 0.6,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
figmaUrl: null,
|
|
140
|
+
customPayload: {},
|
|
141
|
+
continueButtonLabel: "Continue",
|
|
142
|
+
},
|
|
92
143
|
{
|
|
93
144
|
id: "ratings-app",
|
|
94
145
|
name: "Rate the App",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onboarding-example.js","sourceRoot":"","sources":["../src/onboarding-example.ts"],"names":[],"mappings":";;;AAEa,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE;QACR,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE,SAAS;QACrB,YAAY,EAAE,SAAS;QACvB,aAAa,EAAE,SAAS;QACxB,KAAK,EAAE,IAAI;KACZ;IACD,KAAK,EAAE;QACL;YACE,EAAE,EAAE,SAAS;YACb,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACP,KAAK,EAAE,qBAAqB;gBAC5B,WAAW,EAAE,+CAA+C;gBAC5D,WAAW,EAAE;oBACX,GAAG,EAAE,mDAAmD;oBACxD,IAAI,EAAE,OAAO;iBACd;aACF;YACD,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,EAAE;YACjB,mBAAmB,EAAE,UAAU;YAC/B,qBAAqB,EAAE,IAAI;SAC5B;QACD;YACE,EAAE,EAAE,yBAAyB;YAC7B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE;gBACP,KAAK,EAAE,6BAA6B;gBACpC,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC9B,EAAE,KAAK,EAAE,MAAM,EAAE,KAA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,EAAE,IAAI;YACd,aAAa,EAAE,EAAE;YACjB,mBAAmB,EAAE,UAAU;YAC/B,qBAAqB,EAAE,KAAK;SAC7B;QACD;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACP,KAAK,EAAE,mBAAmB;gBAC1B,QAAQ,EAAE,0BAA0B;gBACpC,YAAY,EAAE;oBACZ;wBACE,OAAO,EACL,wFAAwF;wBAC1F,UAAU,EAAE,eAAe;wBAC3B,YAAY,EAAE,CAAC;qBAChB;iBACF;gBACD,qBAAqB,EAAE,cAAc;aACtC;YACD,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,EAAE;YACjB,mBAAmB,EAAE,UAAU;YAC/B,qBAAqB,EAAE,KAAK;SAC7B;KACF;IACD,aAAa,EAAE,EAAE;CACG,CAAC"}
|
|
1
|
+
{"version":3,"file":"onboarding-example.js","sourceRoot":"","sources":["../src/onboarding-example.ts"],"names":[],"mappings":";;;AAEa,QAAA,iBAAiB,GAAG;IAC/B,QAAQ,EAAE;QACR,EAAE,EAAE,oBAAoB;QACxB,IAAI,EAAE,oBAAoB;QAC1B,UAAU,EAAE,SAAS;QACrB,YAAY,EAAE,SAAS;QACvB,aAAa,EAAE,SAAS;QACxB,KAAK,EAAE,IAAI;KACZ;IACD,KAAK,EAAE;QACL;YACE,EAAE,EAAE,SAAS;YACb,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACP,KAAK,EAAE,qBAAqB;gBAC5B,WAAW,EAAE,+CAA+C;gBAC5D,WAAW,EAAE;oBACX,GAAG,EAAE,mDAAmD;oBACxD,IAAI,EAAE,OAAO;iBACd;aACF;YACD,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,EAAE;YACjB,mBAAmB,EAAE,UAAU;YAC/B,qBAAqB,EAAE,IAAI;SAC5B;QACD;YACE,EAAE,EAAE,yBAAyB;YAC7B,IAAI,EA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E,IAAI;YACd,aAAa,EAAE,EAAE;YACjB,mBAAmB,EAAE,UAAU;SAChC;QACD;YACE,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACP,KAAK,EAAE,mBAAmB;gBAC1B,QAAQ,EAAE,0BAA0B;gBACpC,YAAY,EAAE;oBACZ;wBACE,OAAO,EACL,wFAAwF;wBAC1F,UAAU,EAAE,eAAe;wBAC3B,YAAY,EAAE,CAAC;qBAChB;iBACF;gBACD,qBAAqB,EAAE,cAAc;aACtC;YACD,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,EAAE;YACjB,mBAAmB,EAAE,UAAU;YAC/B,qBAAqB,EAAE,KAAK;SAC7B;KACF;IACD,aAAa,EAAE,EAAE;CACG,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
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 ComposableScreenStepPayloadSchema: z.ZodObject<{
|
|
80
|
+
elements: z.ZodArray<z.ZodType<UIElement, unknown, z.core.$ZodTypeInternals<UIElement, unknown>>>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export declare const ComposableScreenStepTypeSchema: z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
type: z.ZodLiteral<"ComposableScreen">;
|
|
85
|
+
name: z.ZodString;
|
|
86
|
+
displayProgressHeader: z.ZodBoolean;
|
|
87
|
+
payload: z.ZodObject<{
|
|
88
|
+
elements: z.ZodArray<z.ZodType<UIElement, unknown, z.core.$ZodTypeInternals<UIElement, unknown>>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
customPayload: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
91
|
+
continueButtonLabel: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
92
|
+
figmaUrl: z.ZodNullable<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export type ComposableScreenStepType = z.infer<typeof ComposableScreenStepTypeSchema>;
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/steps/ComposableScreen/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,KAAK,SAAS,GACV;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,KAAK,EAAE;QACL,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,cAAc,CAAC,EAAE,MAAM,CA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,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 = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const common_types_1 = require("../common.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
|
+
const 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(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(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: common_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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Q,EAAE;QAC3B,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QACvB,KAAK,EAAE,sBAAsB;KAC9B,CAAC;IACF,OAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC3B,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC;QACxB,KAAK,EAAE,uBAAuB;KAC/B,CAAC;CACH,CAAC,CACH,CAAC;AAEW,QAAA,iCAAiC,GAAG,OAAC,CAAC,MAAM,CAAC;IACxD,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,eAAe,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,kCAAmB;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"}
|
package/dist/steps/types.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ import { CarouselStepType } from "./Carousel/types";
|
|
|
2
2
|
import { CommitmentStepType } from "./Commitment/types";
|
|
3
3
|
import { LoaderStepType } from "./Loader/types";
|
|
4
4
|
import { MediaContentStepType } from "./MediaContent/types";
|
|
5
|
+
import { ComposableScreenStepType } from "./ComposableScreen/types";
|
|
5
6
|
import { PickerStepType } from "./Picker/types";
|
|
6
7
|
import { QuestionStepType } from "./Question/types";
|
|
7
8
|
import { RatingsStepType } from "./Ratings/types";
|
|
8
|
-
export type OnboardingStepType = CarouselStepType | CommitmentStepType | LoaderStepType | MediaContentStepType | PickerStepType | QuestionStepType | RatingsStepType;
|
|
9
|
+
export type OnboardingStepType = CarouselStepType | CommitmentStepType | LoaderStepType | MediaContentStepType | ComposableScreenStepType | PickerStepType | QuestionStepType | RatingsStepType;
|
|
9
10
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/steps/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAC1B,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,cAAc,GACd,gBAAgB,GAChB,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/steps/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAC1B,gBAAgB,GAChB,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,wBAAwB,GACxB,cAAc,GACd,gBAAgB,GAChB,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocapine/react-native-onboarding",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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
8
|
"build": "tsc",
|
|
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": [
|
|
@@ -88,6 +88,58 @@ export const onboardingExample = {
|
|
|
88
88
|
continueButtonLabel: "Continue",
|
|
89
89
|
displayProgressHeader: false,
|
|
90
90
|
},
|
|
91
|
+
{
|
|
92
|
+
id: "composable-screen-demo",
|
|
93
|
+
name: "Composable Screen",
|
|
94
|
+
type: "ComposableScreen",
|
|
95
|
+
displayProgressHeader: true,
|
|
96
|
+
payload: {
|
|
97
|
+
elements: [
|
|
98
|
+
{
|
|
99
|
+
id: "root",
|
|
100
|
+
type: "YStack",
|
|
101
|
+
props: { gap: 24, padding: 24 },
|
|
102
|
+
children: [
|
|
103
|
+
{
|
|
104
|
+
id: "hero-image",
|
|
105
|
+
type: "Image",
|
|
106
|
+
props: {
|
|
107
|
+
url: "https://picsum.photos/800/400?grayscale",
|
|
108
|
+
height: 180,
|
|
109
|
+
resizeMode: "cover",
|
|
110
|
+
borderRadius: 16,
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "headline",
|
|
115
|
+
type: "Text",
|
|
116
|
+
props: {
|
|
117
|
+
content: "Built from the CMS",
|
|
118
|
+
fontSize: 28,
|
|
119
|
+
fontWeight: "700",
|
|
120
|
+
textAlign: "center",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "subheadline",
|
|
125
|
+
type: "Text",
|
|
126
|
+
props: {
|
|
127
|
+
content:
|
|
128
|
+
"This screen is composed entirely from a JSON payload — no custom renderer needed.",
|
|
129
|
+
fontSize: 15,
|
|
130
|
+
textAlign: "center",
|
|
131
|
+
lineHeight: 22,
|
|
132
|
+
opacity: 0.6,
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
figmaUrl: null,
|
|
140
|
+
customPayload: {},
|
|
141
|
+
continueButtonLabel: "Continue",
|
|
142
|
+
},
|
|
91
143
|
{
|
|
92
144
|
id: "ratings-app",
|
|
93
145
|
name: "Rate the App",
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CustomPayloadSchema } from "../common.types";
|
|
3
|
+
|
|
4
|
+
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
|
+
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
|
+
export const ComposableScreenStepPayloadSchema = z.object({
|
|
176
|
+
elements: z.array(UIElementSchema),
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
export const ComposableScreenStepTypeSchema = z.object({
|
|
180
|
+
id: z.string(),
|
|
181
|
+
type: z.literal("ComposableScreen"),
|
|
182
|
+
name: z.string(),
|
|
183
|
+
displayProgressHeader: z.boolean(),
|
|
184
|
+
payload: ComposableScreenStepPayloadSchema,
|
|
185
|
+
customPayload: CustomPayloadSchema,
|
|
186
|
+
continueButtonLabel: z.string().optional().default("Continue"),
|
|
187
|
+
figmaUrl: z.string().nullable(),
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
export type ComposableScreenStepType = z.infer<typeof ComposableScreenStepTypeSchema>;
|
package/src/steps/types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { CarouselStepType } from "./Carousel/types";
|
|
|
2
2
|
import { CommitmentStepType } from "./Commitment/types";
|
|
3
3
|
import { LoaderStepType } from "./Loader/types";
|
|
4
4
|
import { MediaContentStepType } from "./MediaContent/types";
|
|
5
|
+
import { ComposableScreenStepType } from "./ComposableScreen/types";
|
|
5
6
|
import { PickerStepType } from "./Picker/types";
|
|
6
7
|
import { QuestionStepType } from "./Question/types";
|
|
7
8
|
import { RatingsStepType } from "./Ratings/types";
|
|
@@ -11,6 +12,7 @@ export type OnboardingStepType =
|
|
|
11
12
|
| CommitmentStepType
|
|
12
13
|
| LoaderStepType
|
|
13
14
|
| MediaContentStepType
|
|
15
|
+
| ComposableScreenStepType
|
|
14
16
|
| PickerStepType
|
|
15
17
|
| QuestionStepType
|
|
16
18
|
| RatingsStepType;
|