@rocapine/react-native-onboarding 1.53.0 → 1.55.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 +1 -1
- package/dist/OnboardingStudioClient.d.ts +8 -0
- package/dist/OnboardingStudioClient.d.ts.map +1 -1
- package/dist/OnboardingStudioClient.js +15 -0
- package/dist/OnboardingStudioClient.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/queries/cacheKey.d.ts +20 -0
- package/dist/infra/queries/cacheKey.d.ts.map +1 -0
- package/dist/infra/queries/cacheKey.js +26 -0
- package/dist/infra/queries/cacheKey.js.map +1 -0
- package/dist/infra/queries/getOnboarding.query.d.ts.map +1 -1
- package/dist/infra/queries/getOnboarding.query.js +20 -10
- package/dist/infra/queries/getOnboarding.query.js.map +1 -1
- package/dist/onboarding-example.d.ts +161 -0
- package/dist/onboarding-example.d.ts.map +1 -1
- package/dist/onboarding-example.js +32 -0
- package/dist/onboarding-example.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/AnimatedTextElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/AnimatedTextElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts +33 -2
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js +6 -0
- package/dist/steps/ComposableScreen/elements/BaseBoxProps.js.map +1 -1
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts +48 -4
- package/dist/steps/ComposableScreen/elements/ButtonElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/CarouselElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts +13 -2
- package/dist/steps/ComposableScreen/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/DatePickerElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/DrawingPadElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/DrawingPadElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/IconElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/IconElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/ImageElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/InputElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/KeyboardAvoidingViewElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/LottieElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/LottieElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/ProgressIndicatorElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/ProgressiveBlurImageElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts +13 -2
- package/dist/steps/ComposableScreen/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/RichTextElement.d.ts +14 -3
- package/dist/steps/ComposableScreen/elements/RichTextElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/RiveElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/RiveElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/SafeAreaViewElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ScrollViewElement.d.ts +14 -3
- package/dist/steps/ComposableScreen/elements/ScrollViewElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/SliderElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/SliderElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/StackElement.d.ts +14 -3
- package/dist/steps/ComposableScreen/elements/StackElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/TextElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/VideoElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/VideoElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/WheelPickerElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/WheelPickerElement.d.ts.map +1 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts +12 -1
- package/dist/steps/ComposableScreen/elements/ZStackElement.d.ts.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/OnboardingStudioClient.ts +13 -0
- package/src/__tests__/getOnboarding.query.test.ts +76 -5
- package/src/index.ts +5 -0
- package/src/infra/queries/cacheKey.ts +24 -0
- package/src/infra/queries/getOnboarding.query.ts +20 -11
- package/src/onboarding-example.ts +32 -0
- package/src/steps/ComposableScreen/elements/BaseBoxProps.ts +16 -1
- package/src/types.ts +10 -0
|
@@ -95,10 +95,10 @@ export declare const TextElementPropsSchema: z.ZodObject<{
|
|
|
95
95
|
flexGrow: z.ZodOptional<z.ZodNumber>;
|
|
96
96
|
aspectRatio: z.ZodOptional<z.ZodNumber>;
|
|
97
97
|
alignSelf: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
center: "center";
|
|
98
99
|
auto: "auto";
|
|
99
100
|
"flex-start": "flex-start";
|
|
100
101
|
"flex-end": "flex-end";
|
|
101
|
-
center: "center";
|
|
102
102
|
stretch: "stretch";
|
|
103
103
|
baseline: "baseline";
|
|
104
104
|
}>>;
|
|
@@ -130,6 +130,17 @@ export declare const TextElementPropsSchema: z.ZodObject<{
|
|
|
130
130
|
color: z.ZodString;
|
|
131
131
|
position: z.ZodOptional<z.ZodNumber>;
|
|
132
132
|
}, z.core.$strip>>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
type: z.ZodLiteral<"radial">;
|
|
135
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
136
|
+
x: z.ZodNumber;
|
|
137
|
+
y: z.ZodNumber;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
radius: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
141
|
+
color: z.ZodString;
|
|
142
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
}, z.core.$strip>>;
|
|
133
144
|
}, z.core.$strip>], "type">>;
|
|
134
145
|
overflow: z.ZodOptional<z.ZodEnum<{
|
|
135
146
|
hidden: "hidden";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextElement.d.ts","sourceRoot":"","sources":["../../../../src/steps/ComposableScreen/elements/TextElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAChC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,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AAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAWjC,CAAC"}
|
|
@@ -20,10 +20,10 @@ export declare const VideoElementPropsSchema: z.ZodObject<{
|
|
|
20
20
|
flexGrow: z.ZodOptional<z.ZodNumber>;
|
|
21
21
|
aspectRatio: z.ZodOptional<z.ZodNumber>;
|
|
22
22
|
alignSelf: z.ZodOptional<z.ZodEnum<{
|
|
23
|
+
center: "center";
|
|
23
24
|
auto: "auto";
|
|
24
25
|
"flex-start": "flex-start";
|
|
25
26
|
"flex-end": "flex-end";
|
|
26
|
-
center: "center";
|
|
27
27
|
stretch: "stretch";
|
|
28
28
|
baseline: "baseline";
|
|
29
29
|
}>>;
|
|
@@ -55,6 +55,17 @@ export declare const VideoElementPropsSchema: z.ZodObject<{
|
|
|
55
55
|
color: z.ZodString;
|
|
56
56
|
position: z.ZodOptional<z.ZodNumber>;
|
|
57
57
|
}, z.core.$strip>>;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
59
|
+
type: z.ZodLiteral<"radial">;
|
|
60
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
x: z.ZodNumber;
|
|
62
|
+
y: z.ZodNumber;
|
|
63
|
+
}, z.core.$strip>>;
|
|
64
|
+
radius: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
66
|
+
color: z.ZodString;
|
|
67
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
}, z.core.$strip>>;
|
|
58
69
|
}, z.core.$strip>], "type">>;
|
|
59
70
|
overflow: z.ZodOptional<z.ZodEnum<{
|
|
60
71
|
hidden: "hidden";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoElement.d.ts","sourceRoot":"","sources":["../../../../src/steps/ComposableScreen/elements/VideoElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"VideoElement.d.ts","sourceRoot":"","sources":["../../../../src/steps/ComposableScreen/elements/VideoElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOlC,CAAC"}
|
|
@@ -47,10 +47,10 @@ export declare const WheelPickerElementPropsSchema: z.ZodObject<{
|
|
|
47
47
|
flexGrow: z.ZodOptional<z.ZodNumber>;
|
|
48
48
|
aspectRatio: z.ZodOptional<z.ZodNumber>;
|
|
49
49
|
alignSelf: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
center: "center";
|
|
50
51
|
auto: "auto";
|
|
51
52
|
"flex-start": "flex-start";
|
|
52
53
|
"flex-end": "flex-end";
|
|
53
|
-
center: "center";
|
|
54
54
|
stretch: "stretch";
|
|
55
55
|
baseline: "baseline";
|
|
56
56
|
}>>;
|
|
@@ -82,6 +82,17 @@ export declare const WheelPickerElementPropsSchema: z.ZodObject<{
|
|
|
82
82
|
color: z.ZodString;
|
|
83
83
|
position: z.ZodOptional<z.ZodNumber>;
|
|
84
84
|
}, z.core.$strip>>;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
type: z.ZodLiteral<"radial">;
|
|
87
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
x: z.ZodNumber;
|
|
89
|
+
y: z.ZodNumber;
|
|
90
|
+
}, z.core.$strip>>;
|
|
91
|
+
radius: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
93
|
+
color: z.ZodString;
|
|
94
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
85
96
|
}, z.core.$strip>], "type">>;
|
|
86
97
|
overflow: z.ZodOptional<z.ZodEnum<{
|
|
87
98
|
hidden: "hidden";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WheelPickerElement.d.ts","sourceRoot":"","sources":["../../../../src/steps/ComposableScreen/elements/WheelPickerElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B,kFAAkF;IAClF,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,gBAAgB,GAAG,eAAe,EAAE,CAcxF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,GAAG,eAAe,EAAE,CAIzF;AAcD,eAAO,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"WheelPickerElement.d.ts","sourceRoot":"","sources":["../../../../src/steps/ComposableScreen/elements/WheelPickerElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,eAAe,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG;IACnD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,eAAe,EAAE,CAAC;IAC1B,kFAAkF;IAClF,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,gBAAgB,GAAG,eAAe,EAAE,CAcxF;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,uBAAuB,GAAG,eAAe,EAAE,CAIzF;AAcD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwCxC,CAAC"}
|
|
@@ -13,10 +13,10 @@ export declare const ZStackElementPropsSchema: z.ZodObject<{
|
|
|
13
13
|
flexGrow: z.ZodOptional<z.ZodNumber>;
|
|
14
14
|
aspectRatio: z.ZodOptional<z.ZodNumber>;
|
|
15
15
|
alignSelf: z.ZodOptional<z.ZodEnum<{
|
|
16
|
+
center: "center";
|
|
16
17
|
auto: "auto";
|
|
17
18
|
"flex-start": "flex-start";
|
|
18
19
|
"flex-end": "flex-end";
|
|
19
|
-
center: "center";
|
|
20
20
|
stretch: "stretch";
|
|
21
21
|
baseline: "baseline";
|
|
22
22
|
}>>;
|
|
@@ -48,6 +48,17 @@ export declare const ZStackElementPropsSchema: z.ZodObject<{
|
|
|
48
48
|
color: z.ZodString;
|
|
49
49
|
position: z.ZodOptional<z.ZodNumber>;
|
|
50
50
|
}, z.core.$strip>>;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
type: z.ZodLiteral<"radial">;
|
|
53
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
54
|
+
x: z.ZodNumber;
|
|
55
|
+
y: z.ZodNumber;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
radius: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
59
|
+
color: z.ZodString;
|
|
60
|
+
position: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
51
62
|
}, z.core.$strip>], "type">>;
|
|
52
63
|
overflow: z.ZodOptional<z.ZodEnum<{
|
|
53
64
|
hidden: "hidden";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZStackElement.d.ts","sourceRoot":"","sources":["../../../../src/steps/ComposableScreen/elements/ZStackElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE9C,eAAO,MAAM,wBAAwB
|
|
1
|
+
{"version":3,"file":"ZStackElement.d.ts","sourceRoot":"","sources":["../../../../src/steps/ComposableScreen/elements/ZStackElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAsB,MAAM,gBAAgB,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE9C,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAqB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -20,6 +20,16 @@ export type OnboardingStudioClientOptions<StepType extends BaseStepType = BaseSt
|
|
|
20
20
|
baseUrl?: string;
|
|
21
21
|
fallbackOnboarding?: Onboarding<StepType>;
|
|
22
22
|
timeout?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Optional custom cache key. When provided, the fetched onboarding is
|
|
25
|
+
* persisted under `"rocapine-onboarding-sdk-{cacheKey}"` and served
|
|
26
|
+
* **cache-first with no background revalidation** — the pinned version stays
|
|
27
|
+
* put across launches until the host refetches (see
|
|
28
|
+
* `OnboardingStudioClient.clearCache`). Omit for the default key
|
|
29
|
+
* (`"rocapine-onboarding-studio"`) with stale-while-revalidate caching.
|
|
30
|
+
* Ignored in sandbox mode (which always fetches fresh).
|
|
31
|
+
*/
|
|
32
|
+
cacheKey?: string;
|
|
23
33
|
};
|
|
24
34
|
export type OnboardingOptions = {
|
|
25
35
|
locale?: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;GAGG;AACH,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;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,6BAA6B,CACvC,QAAQ,SAAS,YAAY,GAAG,YAAY,IAC1C;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"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ACjB;AAED,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,QAAQ,GACR,UAAU,GACV,MAAM,GACN,WAAW,GACX,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AAEV,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC;IAC/B,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrC,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,uBAAuB,GAAG,kBAAkB,GAAG,gBAAgB,EAAE,CAAC;AAE9E,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;AAEpE,MAAM,WAAW,UAAU,CAAC,QAAQ,SAAS,YAAY,GAAG,YAAY;IACtE,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,aAAa,EAAE,GAAG,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,MAAM,WAAW,uBAAuB;IACtC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocapine/react-native-onboarding",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.55.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",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
1
2
|
import { OnboardingStepType } from "./steps/types";
|
|
2
3
|
import {
|
|
3
4
|
Onboarding,
|
|
@@ -7,6 +8,7 @@ import {
|
|
|
7
8
|
UserDefinedParams,
|
|
8
9
|
BaseStepType,
|
|
9
10
|
} from "./types";
|
|
11
|
+
import { getOnboardingCacheKey } from "./infra/queries/cacheKey";
|
|
10
12
|
|
|
11
13
|
import { Platform } from "react-native";
|
|
12
14
|
|
|
@@ -24,6 +26,17 @@ export class OnboardingStudioClient {
|
|
|
24
26
|
"https://takbcvjljqialzqyksic.supabase.co/functions/v1";
|
|
25
27
|
}
|
|
26
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Removes this client's cached onboarding payload from AsyncStorage (the key
|
|
31
|
+
* derived from `options.cacheKey`, or the default key). The next query mount
|
|
32
|
+
* or app launch is then a cache miss and refetches. To force an in-session
|
|
33
|
+
* refetch as well, also invalidate the React Query key
|
|
34
|
+
* `["onboardingQuestions", ...]`.
|
|
35
|
+
*/
|
|
36
|
+
async clearCache(): Promise<void> {
|
|
37
|
+
await AsyncStorage.removeItem(getOnboardingCacheKey(this.options.cacheKey));
|
|
38
|
+
}
|
|
39
|
+
|
|
27
40
|
async getSteps<StepType extends BaseStepType = OnboardingStepType>(
|
|
28
41
|
onboardingOptions?: OnboardingOptions,
|
|
29
42
|
userDefinedParams?: UserDefinedParams
|
|
@@ -1,17 +1,28 @@
|
|
|
1
1
|
import { describe, it, expect, vi, beforeEach } from "vitest";
|
|
2
2
|
|
|
3
3
|
// AsyncStorage is mocked — the query reads/writes the production cache through it.
|
|
4
|
-
const { getItem, setItem } = vi.hoisted(() => ({
|
|
4
|
+
const { getItem, setItem, removeItem } = vi.hoisted(() => ({
|
|
5
5
|
getItem: vi.fn<(key: string) => Promise<string | null>>(),
|
|
6
6
|
setItem: vi.fn<(key: string, value: string) => Promise<void>>(),
|
|
7
|
+
removeItem: vi.fn<(key: string) => Promise<void>>(),
|
|
7
8
|
}));
|
|
8
9
|
vi.mock("@react-native-async-storage/async-storage", () => ({
|
|
9
|
-
default: { getItem, setItem },
|
|
10
|
+
default: { getItem, setItem, removeItem },
|
|
10
11
|
}));
|
|
11
|
-
|
|
12
|
+
// OnboardingStudioClient (used by the clearCache test) imports `react-native`
|
|
13
|
+
// for `Platform`; stub it so the class loads under Node.
|
|
14
|
+
vi.mock("react-native", () => ({ Platform: { OS: "ios" } }));
|
|
15
|
+
|
|
16
|
+
import { OnboardingStudioClient } from "../OnboardingStudioClient";
|
|
17
|
+
import {
|
|
18
|
+
getOnboardingCacheKey,
|
|
19
|
+
DEFAULT_ONBOARDING_CACHE_KEY,
|
|
20
|
+
} from "../infra/queries/cacheKey";
|
|
12
21
|
import { getOnboardingQuery } from "../infra/queries/getOnboarding.query";
|
|
13
22
|
|
|
14
23
|
const CACHE_KEY = "rocapine-onboarding-studio";
|
|
24
|
+
const CUSTOM_KEY = "v2";
|
|
25
|
+
const CUSTOM_CACHE_KEY = "rocapine-onboarding-sdk-v2";
|
|
15
26
|
|
|
16
27
|
const realOnboarding = { metadata: { id: "real" }, steps: [], fonts: {} } as any;
|
|
17
28
|
const fallbackOnboarding = { metadata: { id: "fallback" }, steps: [], fonts: {} } as any;
|
|
@@ -19,7 +30,7 @@ const fallbackOnboarding = { metadata: { id: "fallback" }, steps: [], fonts: {}
|
|
|
19
30
|
// Builds a fake client whose `getSteps` resolves to the given payload + the
|
|
20
31
|
// ONBS-Onboarding-Id header the SDK uses to flag the offline fallback.
|
|
21
32
|
const makeClient = (
|
|
22
|
-
{ isSandbox, onboardingId, data }: { isSandbox: boolean; onboardingId: string; data: any }
|
|
33
|
+
{ isSandbox, onboardingId, data, cacheKey }: { isSandbox: boolean; onboardingId: string; data: any; cacheKey?: string }
|
|
23
34
|
) => {
|
|
24
35
|
const getSteps = vi.fn().mockResolvedValue({
|
|
25
36
|
data,
|
|
@@ -31,7 +42,7 @@ const makeClient = (
|
|
|
31
42
|
});
|
|
32
43
|
return {
|
|
33
44
|
projectId: "p1",
|
|
34
|
-
options: { isSandbox, baseUrl: undefined },
|
|
45
|
+
options: { isSandbox, baseUrl: undefined, cacheKey },
|
|
35
46
|
getSteps,
|
|
36
47
|
} as any;
|
|
37
48
|
};
|
|
@@ -45,7 +56,9 @@ describe("getOnboardingQuery", () => {
|
|
|
45
56
|
beforeEach(() => {
|
|
46
57
|
getItem.mockReset();
|
|
47
58
|
setItem.mockReset();
|
|
59
|
+
removeItem.mockReset();
|
|
48
60
|
setItem.mockResolvedValue(undefined);
|
|
61
|
+
removeItem.mockResolvedValue(undefined);
|
|
49
62
|
});
|
|
50
63
|
|
|
51
64
|
it("sandbox: always fetches, never touches the cache", async () => {
|
|
@@ -98,4 +111,62 @@ describe("getOnboardingQuery", () => {
|
|
|
98
111
|
expect(setItem).toHaveBeenCalledWith(CACHE_KEY, JSON.stringify(realOnboarding));
|
|
99
112
|
expect(setOnboarding).toHaveBeenCalledWith(realOnboarding);
|
|
100
113
|
});
|
|
114
|
+
|
|
115
|
+
it("custom key, cache hit: serves cache and does NOT revalidate", async () => {
|
|
116
|
+
const cached = { metadata: { id: "cached" }, steps: [], fonts: {} } as any;
|
|
117
|
+
getItem.mockResolvedValue(JSON.stringify(cached));
|
|
118
|
+
const client = makeClient({ isSandbox: false, onboardingId: "real", data: realOnboarding, cacheKey: CUSTOM_KEY });
|
|
119
|
+
const setOnboarding = vi.fn();
|
|
120
|
+
|
|
121
|
+
const data = await run(client, setOnboarding);
|
|
122
|
+
|
|
123
|
+
// Reads the namespaced key and serves it.
|
|
124
|
+
expect(getItem).toHaveBeenCalledWith(CUSTOM_CACHE_KEY);
|
|
125
|
+
expect(data).toEqual(cached);
|
|
126
|
+
expect(setOnboarding).toHaveBeenCalledWith(cached);
|
|
127
|
+
|
|
128
|
+
// No background revalidation — the pinned version is never refetched.
|
|
129
|
+
await flush();
|
|
130
|
+
expect(client.getSteps).not.toHaveBeenCalled();
|
|
131
|
+
expect(setItem).not.toHaveBeenCalled();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("custom key, cache miss: fetches once and persists under the namespaced key", async () => {
|
|
135
|
+
getItem.mockResolvedValue(null);
|
|
136
|
+
const client = makeClient({ isSandbox: false, onboardingId: "real", data: realOnboarding, cacheKey: CUSTOM_KEY });
|
|
137
|
+
|
|
138
|
+
const data = await run(client);
|
|
139
|
+
|
|
140
|
+
expect(getItem).toHaveBeenCalledWith(CUSTOM_CACHE_KEY);
|
|
141
|
+
expect(client.getSteps).toHaveBeenCalledTimes(1);
|
|
142
|
+
expect(setItem).toHaveBeenCalledWith(CUSTOM_CACHE_KEY, JSON.stringify(realOnboarding));
|
|
143
|
+
expect(data).toBe(realOnboarding);
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
describe("getOnboardingCacheKey", () => {
|
|
148
|
+
it("returns the default key when no custom key is given", () => {
|
|
149
|
+
expect(getOnboardingCacheKey()).toBe(DEFAULT_ONBOARDING_CACHE_KEY);
|
|
150
|
+
expect(DEFAULT_ONBOARDING_CACHE_KEY).toBe(CACHE_KEY);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("namespaces a custom key", () => {
|
|
154
|
+
expect(getOnboardingCacheKey(CUSTOM_KEY)).toBe(CUSTOM_CACHE_KEY);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
describe("OnboardingStudioClient.clearCache", () => {
|
|
159
|
+
beforeEach(() => removeItem.mockReset());
|
|
160
|
+
|
|
161
|
+
it("removes the default key when no custom key is configured", async () => {
|
|
162
|
+
const client = new OnboardingStudioClient("p1", {});
|
|
163
|
+
await client.clearCache();
|
|
164
|
+
expect(removeItem).toHaveBeenCalledWith(CACHE_KEY);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it("removes the namespaced key when a custom key is configured", async () => {
|
|
168
|
+
const client = new OnboardingStudioClient("p1", { cacheKey: CUSTOM_KEY });
|
|
169
|
+
await client.clearCache();
|
|
170
|
+
expect(removeItem).toHaveBeenCalledWith(CUSTOM_CACHE_KEY);
|
|
171
|
+
});
|
|
101
172
|
});
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
export { OnboardingStudioClient } from "./OnboardingStudioClient";
|
|
3
3
|
export * from "./types";
|
|
4
4
|
export * from "./onboarding-example";
|
|
5
|
+
// Cache key helper (advanced/host use — e.g. to read/clear the persisted key)
|
|
6
|
+
export {
|
|
7
|
+
getOnboardingCacheKey,
|
|
8
|
+
DEFAULT_ONBOARDING_CACHE_KEY,
|
|
9
|
+
} from "./infra/queries/cacheKey";
|
|
5
10
|
// ComposableScreen types (Button actions, variable entry, etc.)
|
|
6
11
|
export type {
|
|
7
12
|
ButtonAction,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AsyncStorage key derivation for the cached onboarding payload.
|
|
3
|
+
*
|
|
4
|
+
* Lives in its own module so both `getOnboarding.query.ts` and
|
|
5
|
+
* `OnboardingStudioClient` can use it as a value without a circular import
|
|
6
|
+
* (the query module imports `OnboardingStudioClient` for typing).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** Default cache key used when the host does not provide a custom one. */
|
|
10
|
+
export const DEFAULT_ONBOARDING_CACHE_KEY = "rocapine-onboarding-studio";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Derives the AsyncStorage key for the cached onboarding payload.
|
|
14
|
+
*
|
|
15
|
+
* - No custom key → the shared default `"rocapine-onboarding-studio"`
|
|
16
|
+
* (stale-while-revalidate: served cache-first and healed in the background).
|
|
17
|
+
* - Custom key → `"rocapine-onboarding-sdk-{customKey}"`, which the SDK
|
|
18
|
+
* persists cache-first with **no** background revalidation, so the host owns
|
|
19
|
+
* when to refetch (see `OnboardingStudioClient.clearCache`).
|
|
20
|
+
*/
|
|
21
|
+
export const getOnboardingCacheKey = (customKey?: string): string =>
|
|
22
|
+
customKey
|
|
23
|
+
? `rocapine-onboarding-sdk-${customKey}`
|
|
24
|
+
: DEFAULT_ONBOARDING_CACHE_KEY;
|
|
@@ -2,8 +2,7 @@ import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
|
2
2
|
import { OnboardingStudioClient } from "../../OnboardingStudioClient";
|
|
3
3
|
import { BaseStepType, Onboarding, OnboardingMetadata } from "../../types";
|
|
4
4
|
import type { UseQueryOptions } from "@tanstack/react-query";
|
|
5
|
-
|
|
6
|
-
const cacheKey = "rocapine-onboarding-studio";
|
|
5
|
+
import { getOnboardingCacheKey } from "./cacheKey";
|
|
7
6
|
|
|
8
7
|
export const getOnboardingQuery = <StepType extends BaseStepType>(
|
|
9
8
|
client: OnboardingStudioClient,
|
|
@@ -17,11 +16,17 @@ export const getOnboardingQuery = <StepType extends BaseStepType>(
|
|
|
17
16
|
client.projectId,
|
|
18
17
|
client.options.isSandbox,
|
|
19
18
|
client.options.baseUrl,
|
|
19
|
+
client.options.cacheKey,
|
|
20
20
|
locale,
|
|
21
21
|
JSON.stringify(customAudienceParams),
|
|
22
22
|
],
|
|
23
23
|
queryFn: async (): Promise<Onboarding<StepType>> => {
|
|
24
24
|
const isProduction = !(client?.options?.isSandbox || false);
|
|
25
|
+
// A custom key opts into app-controlled caching: persist cache-first
|
|
26
|
+
// with NO background revalidation, so a pinned version survives across
|
|
27
|
+
// launches. The default key keeps stale-while-revalidate.
|
|
28
|
+
const hasCustomKey = Boolean(client.options.cacheKey);
|
|
29
|
+
const cacheKey = getOnboardingCacheKey(client.options.cacheKey);
|
|
25
30
|
|
|
26
31
|
// Fetches the live payload, pushes it to the provider, and caches it —
|
|
27
32
|
// but NEVER caches the offline fallback. Caching the fallback (with
|
|
@@ -55,9 +60,11 @@ export const getOnboardingQuery = <StepType extends BaseStepType>(
|
|
|
55
60
|
return fetchAndCache();
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
// Production:
|
|
59
|
-
//
|
|
60
|
-
// the background
|
|
63
|
+
// Production: serve the cached payload instantly (fast first paint,
|
|
64
|
+
// offline-resilient). With the default key this is stale-while-revalidate
|
|
65
|
+
// (also refresh in the background so studio re-deploys propagate and a
|
|
66
|
+
// stale cache heals). With a custom key it's persist-only — no background
|
|
67
|
+
// refetch — so a pinned version is never swapped out from under the host.
|
|
61
68
|
let cached: Onboarding<StepType> | null = null;
|
|
62
69
|
try {
|
|
63
70
|
const cachedData = await AsyncStorage.getItem(cacheKey);
|
|
@@ -68,12 +75,14 @@ export const getOnboardingQuery = <StepType extends BaseStepType>(
|
|
|
68
75
|
|
|
69
76
|
if (cached) {
|
|
70
77
|
setOnboarding && setOnboarding(cached);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
if (!hasCustomKey) {
|
|
79
|
+
// Background revalidation — updates the cache + provider state when a
|
|
80
|
+
// fresh real payload arrives. Errors are swallowed: the cache already
|
|
81
|
+
// painted, so an offline revalidation must not surface as a query error.
|
|
82
|
+
void fetchAndCache().catch((error) => {
|
|
83
|
+
console.warn("Background onboarding revalidation failed:", error);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
77
86
|
return cached;
|
|
78
87
|
}
|
|
79
88
|
|
|
@@ -1016,6 +1016,38 @@ export const onboardingExample = {
|
|
|
1016
1016
|
},
|
|
1017
1017
|
],
|
|
1018
1018
|
},
|
|
1019
|
+
{
|
|
1020
|
+
id: "radial-gradient-card",
|
|
1021
|
+
type: "YStack",
|
|
1022
|
+
props: {
|
|
1023
|
+
padding: 20,
|
|
1024
|
+
gap: 8,
|
|
1025
|
+
borderRadius: 16,
|
|
1026
|
+
overflow: "hidden",
|
|
1027
|
+
marginVertical: 4,
|
|
1028
|
+
backgroundGradient: {
|
|
1029
|
+
type: "radial",
|
|
1030
|
+
center: { x: 0.5, y: 0.4 },
|
|
1031
|
+
radius: 0.8,
|
|
1032
|
+
stops: [
|
|
1033
|
+
{ color: "#FF6584", position: 0 },
|
|
1034
|
+
{ color: "#6C63FF", position: 1 },
|
|
1035
|
+
],
|
|
1036
|
+
},
|
|
1037
|
+
},
|
|
1038
|
+
children: [
|
|
1039
|
+
{
|
|
1040
|
+
id: "radial-gradient-card-title",
|
|
1041
|
+
type: "Text",
|
|
1042
|
+
props: { content: "Radial gradient", fontSize: 15, fontWeight: "700", color: "#fff" },
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
id: "radial-gradient-card-body",
|
|
1046
|
+
type: "Text",
|
|
1047
|
+
props: { content: "center → edge", fontSize: 12, color: "#fff", opacity: 0.85 },
|
|
1048
|
+
},
|
|
1049
|
+
],
|
|
1050
|
+
},
|
|
1019
1051
|
{
|
|
1020
1052
|
id: "gradient-button",
|
|
1021
1053
|
type: "Button",
|
|
@@ -23,7 +23,16 @@ export type LinearGradientConfig = {
|
|
|
23
23
|
stops: GradientStop[];
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
export type
|
|
26
|
+
export type RadialGradientConfig = {
|
|
27
|
+
type: "radial";
|
|
28
|
+
// Center of the gradient as 0..1 fractions of the box (default { x: 0.5, y: 0.5 }).
|
|
29
|
+
center?: { x: number; y: number };
|
|
30
|
+
// Radius as a fraction of the box (objectBoundingBox units, default 0.75).
|
|
31
|
+
radius?: number;
|
|
32
|
+
stops: GradientStop[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type GradientBackground = LinearGradientConfig | RadialGradientConfig;
|
|
27
36
|
|
|
28
37
|
export const GradientEdgeSchema = z.enum(["top", "bottom", "left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight"]);
|
|
29
38
|
|
|
@@ -39,6 +48,12 @@ export const GradientBackgroundSchema = z.discriminatedUnion("type", [
|
|
|
39
48
|
to: GradientEdgeSchema,
|
|
40
49
|
stops: z.array(GradientStopSchema).min(2, "gradient requires at least 2 stops"),
|
|
41
50
|
}),
|
|
51
|
+
z.object({
|
|
52
|
+
type: z.literal("radial"),
|
|
53
|
+
center: z.object({ x: z.number().min(0).max(1), y: z.number().min(0).max(1) }).optional(),
|
|
54
|
+
radius: z.number().positive().optional(),
|
|
55
|
+
stops: z.array(GradientStopSchema).min(2, "gradient requires at least 2 stops"),
|
|
56
|
+
}),
|
|
42
57
|
]);
|
|
43
58
|
|
|
44
59
|
export type ShadowOffset = {
|
package/src/types.ts
CHANGED
|
@@ -24,6 +24,16 @@ export type OnboardingStudioClientOptions<
|
|
|
24
24
|
baseUrl?: string;
|
|
25
25
|
fallbackOnboarding?: Onboarding<StepType>;
|
|
26
26
|
timeout?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Optional custom cache key. When provided, the fetched onboarding is
|
|
29
|
+
* persisted under `"rocapine-onboarding-sdk-{cacheKey}"` and served
|
|
30
|
+
* **cache-first with no background revalidation** — the pinned version stays
|
|
31
|
+
* put across launches until the host refetches (see
|
|
32
|
+
* `OnboardingStudioClient.clearCache`). Omit for the default key
|
|
33
|
+
* (`"rocapine-onboarding-studio"`) with stale-while-revalidate caching.
|
|
34
|
+
* Ignored in sandbox mode (which always fetches fresh).
|
|
35
|
+
*/
|
|
36
|
+
cacheKey?: string;
|
|
27
37
|
};
|
|
28
38
|
|
|
29
39
|
export type OnboardingOptions = {
|