@rocapine/react-native-onboarding-ui 1.0.1 → 1.1.1
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/dist/UI/Pages/Loader/types.d.ts +4 -4
- package/dist/UI/Pages/MediaContent/types.d.ts +4 -4
- package/dist/UI/Pages/types.d.ts +2 -2
- package/dist/UI/Pages/types.js +2 -2
- package/dist/UI/Pages/types.js.map +1 -1
- package/package.json +1 -2
- package/src/UI/ErrorBoundary/README.md +13 -9
- package/src/UI/Pages/types.ts +2 -2
|
@@ -10,10 +10,10 @@ export declare const LoaderStepPayloadSchema: z.ZodObject<{
|
|
|
10
10
|
completed: z.ZodString;
|
|
11
11
|
}, z.core.$strip>>;
|
|
12
12
|
didYouKnowImages: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
13
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
13
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
14
14
|
localPathId: z.ZodString;
|
|
15
15
|
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
16
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
17
17
|
url: z.ZodString;
|
|
18
18
|
}, z.core.$strip>]>>>>;
|
|
19
19
|
duration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -35,10 +35,10 @@ export declare const LoaderStepTypeSchema: z.ZodObject<{
|
|
|
35
35
|
completed: z.ZodString;
|
|
36
36
|
}, z.core.$strip>>;
|
|
37
37
|
didYouKnowImages: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
38
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
38
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
39
39
|
localPathId: z.ZodString;
|
|
40
40
|
}, z.core.$strip>, z.ZodObject<{
|
|
41
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
41
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
42
42
|
url: z.ZodString;
|
|
43
43
|
}, z.core.$strip>]>>>>;
|
|
44
44
|
duration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const MediaContentStepPayloadSchema: z.ZodObject<{
|
|
3
3
|
mediaSource: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
4
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
5
5
|
localPathId: z.ZodString;
|
|
6
6
|
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
7
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
8
8
|
url: z.ZodString;
|
|
9
9
|
}, z.core.$strip>]>;
|
|
10
10
|
title: z.ZodString;
|
|
@@ -22,10 +22,10 @@ export declare const MediaContentStepTypeSchema: z.ZodObject<{
|
|
|
22
22
|
displayProgressHeader: z.ZodBoolean;
|
|
23
23
|
payload: z.ZodObject<{
|
|
24
24
|
mediaSource: z.ZodUnion<readonly [z.ZodObject<{
|
|
25
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
25
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
26
26
|
localPathId: z.ZodString;
|
|
27
27
|
}, z.core.$strip>, z.ZodObject<{
|
|
28
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
28
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
29
29
|
url: z.ZodString;
|
|
30
30
|
}, z.core.$strip>]>;
|
|
31
31
|
title: z.ZodString;
|
package/dist/UI/Pages/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const CustomPayloadSchema: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodAny>>>;
|
|
3
3
|
export declare const MediaSourceSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
4
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
4
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
5
5
|
localPathId: z.ZodString;
|
|
6
6
|
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
-
type: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"image">, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
7
|
+
type: z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"video">, z.ZodLiteral<"image">]>, z.ZodLiteral<"lottie">]>, z.ZodLiteral<"rive">]>;
|
|
8
8
|
url: z.ZodString;
|
|
9
9
|
}, z.core.$strip>]>;
|
|
10
10
|
export declare const SocialProofSchema: z.ZodObject<{
|
package/dist/UI/Pages/types.js
CHANGED
|
@@ -5,11 +5,11 @@ 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([
|
|
7
7
|
zod_1.z.object({
|
|
8
|
-
type: zod_1.z.literal("image").or(zod_1.z.literal("lottie")).or(zod_1.z.literal("rive")),
|
|
8
|
+
type: zod_1.z.literal("video").or(zod_1.z.literal("image")).or(zod_1.z.literal("lottie")).or(zod_1.z.literal("rive")),
|
|
9
9
|
localPathId: zod_1.z.string(),
|
|
10
10
|
}),
|
|
11
11
|
zod_1.z.object({
|
|
12
|
-
type: zod_1.z.literal("image").or(zod_1.z.literal("lottie")).or(zod_1.z.literal("rive")),
|
|
12
|
+
type: zod_1.z.literal("video").or(zod_1.z.literal("image")).or(zod_1.z.literal("lottie")).or(zod_1.z.literal("rive")),
|
|
13
13
|
url: zod_1.z.string(),
|
|
14
14
|
}),
|
|
15
15
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/UI/Pages/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,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/UI/Pages/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;CACH,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocapine/react-native-onboarding-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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
|
-
"prepare": "npm run build",
|
|
10
9
|
"watch": "tsc --watch",
|
|
11
10
|
"patch": "npm version patch && npm run build && npm publish"
|
|
12
11
|
},
|
|
@@ -14,10 +14,13 @@ The Error Boundary is a Higher Order Component (HOC) that wraps all renderers to
|
|
|
14
14
|
All renderers are automatically wrapped with the `withErrorBoundary` HOC:
|
|
15
15
|
|
|
16
16
|
```typescript
|
|
17
|
-
import { QuestionRenderer as QuestionRendererBase } from
|
|
18
|
-
import { withErrorBoundary } from
|
|
17
|
+
import { QuestionRenderer as QuestionRendererBase } from "./Renderer";
|
|
18
|
+
import { withErrorBoundary } from "../../ErrorBoundary";
|
|
19
19
|
|
|
20
|
-
export const QuestionRenderer = withErrorBoundary(
|
|
20
|
+
export const QuestionRenderer = withErrorBoundary(
|
|
21
|
+
QuestionRendererBase,
|
|
22
|
+
"Question"
|
|
23
|
+
);
|
|
21
24
|
```
|
|
22
25
|
|
|
23
26
|
When a Zod validation error occurs (e.g., missing required fields, wrong types), the error boundary will display:
|
|
@@ -32,17 +35,18 @@ If you pass an invalid payload:
|
|
|
32
35
|
|
|
33
36
|
```typescript
|
|
34
37
|
const invalidStep = {
|
|
35
|
-
id:
|
|
36
|
-
type:
|
|
38
|
+
id: "test",
|
|
39
|
+
type: "Question",
|
|
37
40
|
payload: {
|
|
38
|
-
title:
|
|
41
|
+
title: "Test",
|
|
39
42
|
// Missing required 'answers' field
|
|
40
43
|
// Missing required 'multipleAnswer' field
|
|
41
|
-
}
|
|
44
|
+
},
|
|
42
45
|
} as any;
|
|
43
46
|
```
|
|
44
47
|
|
|
45
48
|
The error boundary will show:
|
|
49
|
+
|
|
46
50
|
```
|
|
47
51
|
⚠️ Invalid Step Payload
|
|
48
52
|
Step Type: Question
|
|
@@ -59,11 +63,11 @@ Validation Errors:
|
|
|
59
63
|
You can also use the ErrorBoundary component directly:
|
|
60
64
|
|
|
61
65
|
```typescript
|
|
62
|
-
import { ErrorBoundary } from
|
|
66
|
+
import { ErrorBoundary } from "@rocapine/react-native-onboarding";
|
|
63
67
|
|
|
64
68
|
<ErrorBoundary stepType="MyCustomComponent">
|
|
65
69
|
<MyCustomComponent />
|
|
66
|
-
</ErrorBoundary
|
|
70
|
+
</ErrorBoundary>;
|
|
67
71
|
```
|
|
68
72
|
|
|
69
73
|
## Testing
|
package/src/UI/Pages/types.ts
CHANGED
|
@@ -4,11 +4,11 @@ export const CustomPayloadSchema = z.record(z.string(), z.any()).nullish();
|
|
|
4
4
|
|
|
5
5
|
export const MediaSourceSchema = z.union([
|
|
6
6
|
z.object({
|
|
7
|
-
type: z.literal("image").or(z.literal("lottie")).or(z.literal("rive")),
|
|
7
|
+
type: z.literal("video").or(z.literal("image")).or(z.literal("lottie")).or(z.literal("rive")),
|
|
8
8
|
localPathId: z.string(),
|
|
9
9
|
}),
|
|
10
10
|
z.object({
|
|
11
|
-
type: z.literal("image").or(z.literal("lottie")).or(z.literal("rive")),
|
|
11
|
+
type: z.literal("video").or(z.literal("image")).or(z.literal("lottie")).or(z.literal("rive")),
|
|
12
12
|
url: z.string(),
|
|
13
13
|
}),
|
|
14
14
|
]);
|