@rocapine/react-native-onboarding 1.60.0 → 1.62.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/dist/OnboardingStudioClient.d.ts +23 -5
- package/dist/OnboardingStudioClient.d.ts.map +1 -1
- package/dist/OnboardingStudioClient.js +82 -6
- package/dist/OnboardingStudioClient.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/provider/OnboardingProvider.d.ts +37 -1
- package/dist/infra/provider/OnboardingProvider.d.ts.map +1 -1
- package/dist/infra/provider/OnboardingProvider.js +76 -2
- package/dist/infra/provider/OnboardingProvider.js.map +1 -1
- package/dist/infra/queries/cacheKey.d.ts +22 -4
- package/dist/infra/queries/cacheKey.d.ts.map +1 -1
- package/dist/infra/queries/cacheKey.js +26 -5
- package/dist/infra/queries/cacheKey.js.map +1 -1
- package/dist/paywalls/PaywallProvider.d.ts +66 -0
- package/dist/paywalls/PaywallProvider.d.ts.map +1 -0
- package/dist/paywalls/PaywallProvider.js +227 -0
- package/dist/paywalls/PaywallProvider.js.map +1 -0
- package/dist/paywalls/getPaywalls.query.d.ts +37 -0
- package/dist/paywalls/getPaywalls.query.d.ts.map +1 -0
- package/dist/paywalls/getPaywalls.query.js +114 -0
- package/dist/paywalls/getPaywalls.query.js.map +1 -0
- package/dist/paywalls/present.d.ts +100 -0
- package/dist/paywalls/present.d.ts.map +1 -0
- package/dist/paywalls/present.js +113 -0
- package/dist/paywalls/present.js.map +1 -0
- package/dist/paywalls/types.d.ts +95 -0
- package/dist/paywalls/types.d.ts.map +1 -0
- package/dist/paywalls/types.js +10 -0
- package/dist/paywalls/types.js.map +1 -0
- package/dist/paywalls/usePaywall.d.ts +29 -0
- package/dist/paywalls/usePaywall.d.ts.map +1 -0
- package/dist/paywalls/usePaywall.js +17 -0
- package/dist/paywalls/usePaywall.js.map +1 -0
- package/dist/products/ProductRuntimeContext.d.ts +15 -0
- package/dist/products/ProductRuntimeContext.d.ts.map +1 -0
- package/dist/products/ProductRuntimeContext.js +19 -0
- package/dist/products/ProductRuntimeContext.js.map +1 -0
- package/dist/products/adapters/expoIap.d.ts +4 -0
- package/dist/products/adapters/expoIap.d.ts.map +1 -0
- package/dist/products/adapters/expoIap.js +95 -0
- package/dist/products/adapters/expoIap.js.map +1 -0
- package/dist/products/adapters/revenueCat.d.ts +7 -0
- package/dist/products/adapters/revenueCat.d.ts.map +1 -0
- package/dist/products/adapters/revenueCat.js +116 -0
- package/dist/products/adapters/revenueCat.js.map +1 -0
- package/dist/products/adapters/stub.d.ts +8 -0
- package/dist/products/adapters/stub.d.ts.map +1 -0
- package/dist/products/adapters/stub.js +21 -0
- package/dist/products/adapters/stub.js.map +1 -0
- package/dist/products/derive.d.ts +19 -0
- package/dist/products/derive.d.ts.map +1 -0
- package/dist/products/derive.js +79 -0
- package/dist/products/derive.js.map +1 -0
- package/dist/products/duration.d.ts +3 -0
- package/dist/products/duration.d.ts.map +1 -0
- package/dist/products/duration.js +25 -0
- package/dist/products/duration.js.map +1 -0
- package/dist/products/index.d.ts +10 -0
- package/dist/products/index.d.ts.map +1 -0
- package/dist/products/index.js +23 -0
- package/dist/products/index.js.map +1 -0
- package/dist/products/mergeProductRuntimes.d.ts +55 -0
- package/dist/products/mergeProductRuntimes.d.ts.map +1 -0
- package/dist/products/mergeProductRuntimes.js +79 -0
- package/dist/products/mergeProductRuntimes.js.map +1 -0
- package/dist/products/toVariables.d.ts +18 -0
- package/dist/products/toVariables.d.ts.map +1 -0
- package/dist/products/toVariables.js +52 -0
- package/dist/products/toVariables.js.map +1 -0
- package/dist/products/types.d.ts +96 -0
- package/dist/products/types.d.ts.map +1 -0
- package/dist/products/types.js +3 -0
- package/dist/products/types.js.map +1 -0
- package/dist/products/useProducts.d.ts +12 -0
- package/dist/products/useProducts.d.ts.map +1 -0
- package/dist/products/useProducts.js +90 -0
- package/dist/products/useProducts.js.map +1 -0
- package/dist/screens/elements/AnimatedTextElement.d.ts +1 -24
- package/dist/screens/elements/AnimatedTextElement.d.ts.map +1 -1
- package/dist/screens/elements/BaseBoxProps.d.ts +1 -24
- package/dist/screens/elements/BaseBoxProps.d.ts.map +1 -1
- package/dist/screens/elements/ButtonElement.d.ts +6 -121
- package/dist/screens/elements/ButtonElement.d.ts.map +1 -1
- package/dist/screens/elements/CarouselElement.d.ts +1 -24
- package/dist/screens/elements/CarouselElement.d.ts.map +1 -1
- package/dist/screens/elements/CheckboxGroupElement.d.ts +1 -24
- package/dist/screens/elements/CheckboxGroupElement.d.ts.map +1 -1
- package/dist/screens/elements/DatePickerElement.d.ts +1 -24
- package/dist/screens/elements/DatePickerElement.d.ts.map +1 -1
- package/dist/screens/elements/DrawingPadElement.d.ts +1 -24
- package/dist/screens/elements/DrawingPadElement.d.ts.map +1 -1
- package/dist/screens/elements/IconElement.d.ts +1 -24
- package/dist/screens/elements/IconElement.d.ts.map +1 -1
- package/dist/screens/elements/ImageElement.d.ts +1 -24
- package/dist/screens/elements/ImageElement.d.ts.map +1 -1
- package/dist/screens/elements/InputElement.d.ts +1 -24
- package/dist/screens/elements/InputElement.d.ts.map +1 -1
- package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts +1 -24
- package/dist/screens/elements/KeyboardAvoidingViewElement.d.ts.map +1 -1
- package/dist/screens/elements/LottieElement.d.ts +1 -24
- package/dist/screens/elements/LottieElement.d.ts.map +1 -1
- package/dist/screens/elements/ProgressIndicatorElement.d.ts +1 -24
- package/dist/screens/elements/ProgressIndicatorElement.d.ts.map +1 -1
- package/dist/screens/elements/ProgressiveBlurImageElement.d.ts +1 -24
- package/dist/screens/elements/ProgressiveBlurImageElement.d.ts.map +1 -1
- package/dist/screens/elements/RadioGroupElement.d.ts +1 -24
- package/dist/screens/elements/RadioGroupElement.d.ts.map +1 -1
- package/dist/screens/elements/RichTextElement.d.ts +1 -24
- package/dist/screens/elements/RichTextElement.d.ts.map +1 -1
- package/dist/screens/elements/RiveElement.d.ts +1 -24
- package/dist/screens/elements/RiveElement.d.ts.map +1 -1
- package/dist/screens/elements/SafeAreaViewElement.d.ts +1 -24
- package/dist/screens/elements/SafeAreaViewElement.d.ts.map +1 -1
- package/dist/screens/elements/ScrollViewElement.d.ts +1 -24
- package/dist/screens/elements/ScrollViewElement.d.ts.map +1 -1
- package/dist/screens/elements/SliderElement.d.ts +1 -24
- package/dist/screens/elements/SliderElement.d.ts.map +1 -1
- package/dist/screens/elements/StackElement.d.ts +1 -24
- package/dist/screens/elements/StackElement.d.ts.map +1 -1
- package/dist/screens/elements/TextElement.d.ts +1 -24
- package/dist/screens/elements/TextElement.d.ts.map +1 -1
- package/dist/screens/elements/TypewriterTextElement.d.ts +1 -24
- package/dist/screens/elements/TypewriterTextElement.d.ts.map +1 -1
- package/dist/screens/elements/VideoElement.d.ts +1 -24
- package/dist/screens/elements/VideoElement.d.ts.map +1 -1
- package/dist/screens/elements/WheelPickerElement.d.ts +1 -24
- package/dist/screens/elements/WheelPickerElement.d.ts.map +1 -1
- package/dist/screens/elements/ZStackElement.d.ts +1 -24
- package/dist/screens/elements/ZStackElement.d.ts.map +1 -1
- package/dist/steps/Carousel/types.d.ts +1 -1
- package/dist/steps/Commitment/types.d.ts +1 -1
- package/dist/steps/ComposableScreen/types.d.ts +1 -1
- package/dist/steps/Loader/types.d.ts +1 -1
- package/dist/steps/MediaContent/types.d.ts +1 -1
- package/dist/steps/Picker/types.d.ts +1 -1
- package/dist/steps/Question/types.d.ts +1 -1
- package/dist/steps/Ratings/types.d.ts +1 -1
- package/dist/steps/common.types.d.ts +44 -30
- package/dist/steps/common.types.d.ts.map +1 -1
- package/dist/steps/common.types.js +27 -3
- package/dist/steps/common.types.js.map +1 -1
- package/package.json +1 -1
- package/src/OnboardingStudioClient.ts +110 -7
- package/src/__tests__/mergeProductRuntimes.test.ts +172 -0
- package/src/__tests__/productAdapters.test.ts +58 -0
- package/src/__tests__/productDerive.test.ts +111 -0
- package/src/__tests__/productVariables.test.ts +109 -0
- package/src/__tests__/resolveLocalProductArgs.test.ts +41 -0
- package/src/index.ts +14 -0
- package/src/infra/provider/OnboardingProvider.tsx +101 -2
- package/src/infra/queries/cacheKey.ts +27 -4
- package/src/paywalls/PaywallProvider.tsx +342 -0
- package/src/paywalls/__tests__/getPaywalls.test.ts +334 -0
- package/src/paywalls/__tests__/present.test.ts +190 -0
- package/src/paywalls/getPaywalls.query.ts +123 -0
- package/src/paywalls/present.ts +141 -0
- package/src/paywalls/types.ts +99 -0
- package/src/paywalls/usePaywall.ts +35 -0
- package/src/products/ProductRuntimeContext.tsx +17 -0
- package/src/products/adapters/expoIap.ts +93 -0
- package/src/products/adapters/revenueCat.ts +108 -0
- package/src/products/adapters/stub.ts +20 -0
- package/src/products/derive.ts +93 -0
- package/src/products/duration.ts +21 -0
- package/src/products/index.ts +20 -0
- package/src/products/mergeProductRuntimes.ts +78 -0
- package/src/products/toVariables.ts +54 -0
- package/src/products/types.ts +88 -0
- package/src/products/useProducts.ts +106 -0
- package/src/steps/common.types.ts +83 -6
|
@@ -40,6 +40,7 @@ export declare const LoaderStepTypeSchema: z.ZodObject<{
|
|
|
40
40
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
41
41
|
variable: z.ZodString;
|
|
42
42
|
operator: z.ZodEnum<{
|
|
43
|
+
in: "in";
|
|
43
44
|
eq: "eq";
|
|
44
45
|
neq: "neq";
|
|
45
46
|
gt: "gt";
|
|
@@ -47,7 +48,6 @@ export declare const LoaderStepTypeSchema: z.ZodObject<{
|
|
|
47
48
|
gte: "gte";
|
|
48
49
|
lte: "lte";
|
|
49
50
|
contains: "contains";
|
|
50
|
-
in: "in";
|
|
51
51
|
not_in: "not_in";
|
|
52
52
|
is_empty: "is_empty";
|
|
53
53
|
is_not_empty: "is_not_empty";
|
|
@@ -42,6 +42,7 @@ export declare const MediaContentStepTypeSchema: z.ZodObject<{
|
|
|
42
42
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
43
43
|
variable: z.ZodString;
|
|
44
44
|
operator: z.ZodEnum<{
|
|
45
|
+
in: "in";
|
|
45
46
|
eq: "eq";
|
|
46
47
|
neq: "neq";
|
|
47
48
|
gt: "gt";
|
|
@@ -49,7 +50,6 @@ export declare const MediaContentStepTypeSchema: z.ZodObject<{
|
|
|
49
50
|
gte: "gte";
|
|
50
51
|
lte: "lte";
|
|
51
52
|
contains: "contains";
|
|
52
|
-
in: "in";
|
|
53
53
|
not_in: "not_in";
|
|
54
54
|
is_empty: "is_empty";
|
|
55
55
|
is_not_empty: "is_not_empty";
|
|
@@ -38,6 +38,7 @@ export declare const PickerStepTypeSchema: z.ZodObject<{
|
|
|
38
38
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
39
39
|
variable: z.ZodString;
|
|
40
40
|
operator: z.ZodEnum<{
|
|
41
|
+
in: "in";
|
|
41
42
|
eq: "eq";
|
|
42
43
|
neq: "neq";
|
|
43
44
|
gt: "gt";
|
|
@@ -45,7 +46,6 @@ export declare const PickerStepTypeSchema: z.ZodObject<{
|
|
|
45
46
|
gte: "gte";
|
|
46
47
|
lte: "lte";
|
|
47
48
|
contains: "contains";
|
|
48
|
-
in: "in";
|
|
49
49
|
not_in: "not_in";
|
|
50
50
|
is_empty: "is_empty";
|
|
51
51
|
is_not_empty: "is_not_empty";
|
|
@@ -37,6 +37,7 @@ export declare const QuestionStepTypeSchema: z.ZodObject<{
|
|
|
37
37
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
38
38
|
variable: z.ZodString;
|
|
39
39
|
operator: z.ZodEnum<{
|
|
40
|
+
in: "in";
|
|
40
41
|
eq: "eq";
|
|
41
42
|
neq: "neq";
|
|
42
43
|
gt: "gt";
|
|
@@ -44,7 +45,6 @@ export declare const QuestionStepTypeSchema: z.ZodObject<{
|
|
|
44
45
|
gte: "gte";
|
|
45
46
|
lte: "lte";
|
|
46
47
|
contains: "contains";
|
|
47
|
-
in: "in";
|
|
48
48
|
not_in: "not_in";
|
|
49
49
|
is_empty: "is_empty";
|
|
50
50
|
is_not_empty: "is_not_empty";
|
|
@@ -26,6 +26,7 @@ export declare const RatingsStepTypeSchema: z.ZodObject<{
|
|
|
26
26
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
27
27
|
variable: z.ZodString;
|
|
28
28
|
operator: z.ZodEnum<{
|
|
29
|
+
in: "in";
|
|
29
30
|
eq: "eq";
|
|
30
31
|
neq: "neq";
|
|
31
32
|
gt: "gt";
|
|
@@ -33,7 +34,6 @@ export declare const RatingsStepTypeSchema: z.ZodObject<{
|
|
|
33
34
|
gte: "gte";
|
|
34
35
|
lte: "lte";
|
|
35
36
|
contains: "contains";
|
|
36
|
-
in: "in";
|
|
37
37
|
not_in: "not_in";
|
|
38
38
|
is_empty: "is_empty";
|
|
39
39
|
is_not_empty: "is_not_empty";
|
|
@@ -88,32 +88,47 @@ export declare const SetVariableButtonActionSchema: z.ZodObject<{
|
|
|
88
88
|
toggle: "toggle";
|
|
89
89
|
}>>;
|
|
90
90
|
}, z.core.$strip>;
|
|
91
|
-
export type
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
91
|
+
export type PurchaseButtonAction = {
|
|
92
|
+
type: "purchase";
|
|
93
|
+
/** A product slot key, or an interpolable ref like "{{plan}}". */
|
|
94
|
+
product: string;
|
|
95
|
+
onSuccess?: ButtonAction[];
|
|
96
|
+
onCancel?: ButtonAction[];
|
|
97
|
+
onError?: ButtonAction[];
|
|
98
|
+
};
|
|
99
|
+
export type RestoreButtonAction = {
|
|
100
|
+
type: "restore";
|
|
101
|
+
onSuccess?: ButtonAction[];
|
|
102
|
+
onNothingToRestore?: ButtonAction[];
|
|
103
|
+
onError?: ButtonAction[];
|
|
104
|
+
};
|
|
105
|
+
/** Terminal — finishes the screen with a `{ status: "dismissed" }` outcome. */
|
|
106
|
+
export type DismissButtonAction = {
|
|
107
|
+
type: "dismiss";
|
|
108
|
+
};
|
|
109
|
+
export declare const DismissButtonActionSchema: z.ZodObject<{
|
|
110
|
+
type: z.ZodLiteral<"dismiss">;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
/**
|
|
113
|
+
* Asks the host to present a paywall by placement. Available from an
|
|
114
|
+
* onboarding step or a paywall alike — that is how an onboarding step opens a
|
|
115
|
+
* paywall mid-flow. No-ops (with a warning) on a host that doesn't support it.
|
|
116
|
+
*/
|
|
117
|
+
export type PresentPaywallButtonAction = {
|
|
118
|
+
type: "presentPaywall";
|
|
119
|
+
/** Paywall placement key to present, e.g. "hard_paywall". */
|
|
120
|
+
placement: string;
|
|
121
|
+
};
|
|
122
|
+
export declare const PresentPaywallButtonActionSchema: z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"presentPaywall">;
|
|
124
|
+
placement: z.ZodString;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
export type ButtonAction = "continue" | CustomButtonAction | SetVariableButtonAction | PurchaseButtonAction | RestoreButtonAction | DismissButtonAction | PresentPaywallButtonAction;
|
|
127
|
+
export declare const PurchaseButtonActionSchema: z.ZodType<PurchaseButtonAction>;
|
|
128
|
+
export declare const RestoreButtonActionSchema: z.ZodType<RestoreButtonAction>;
|
|
129
|
+
export declare const ButtonActionSchema: z.ZodType<ButtonAction>;
|
|
116
130
|
export declare const ConditionOperatorSchema: z.ZodEnum<{
|
|
131
|
+
in: "in";
|
|
117
132
|
eq: "eq";
|
|
118
133
|
neq: "neq";
|
|
119
134
|
gt: "gt";
|
|
@@ -121,7 +136,6 @@ export declare const ConditionOperatorSchema: z.ZodEnum<{
|
|
|
121
136
|
gte: "gte";
|
|
122
137
|
lte: "lte";
|
|
123
138
|
contains: "contains";
|
|
124
|
-
in: "in";
|
|
125
139
|
not_in: "not_in";
|
|
126
140
|
is_empty: "is_empty";
|
|
127
141
|
is_not_empty: "is_not_empty";
|
|
@@ -140,6 +154,7 @@ export type ConditionValue = z.infer<typeof ConditionValueSchema>;
|
|
|
140
154
|
export declare const LeafConditionSchema: z.ZodObject<{
|
|
141
155
|
variable: z.ZodString;
|
|
142
156
|
operator: z.ZodEnum<{
|
|
157
|
+
in: "in";
|
|
143
158
|
eq: "eq";
|
|
144
159
|
neq: "neq";
|
|
145
160
|
gt: "gt";
|
|
@@ -147,7 +162,6 @@ export declare const LeafConditionSchema: z.ZodObject<{
|
|
|
147
162
|
gte: "gte";
|
|
148
163
|
lte: "lte";
|
|
149
164
|
contains: "contains";
|
|
150
|
-
in: "in";
|
|
151
165
|
not_in: "not_in";
|
|
152
166
|
is_empty: "is_empty";
|
|
153
167
|
is_not_empty: "is_not_empty";
|
|
@@ -166,6 +180,7 @@ export declare const BranchSchema: z.ZodObject<{
|
|
|
166
180
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
167
181
|
variable: z.ZodString;
|
|
168
182
|
operator: z.ZodEnum<{
|
|
183
|
+
in: "in";
|
|
169
184
|
eq: "eq";
|
|
170
185
|
neq: "neq";
|
|
171
186
|
gt: "gt";
|
|
@@ -173,7 +188,6 @@ export declare const BranchSchema: z.ZodObject<{
|
|
|
173
188
|
gte: "gte";
|
|
174
189
|
lte: "lte";
|
|
175
190
|
contains: "contains";
|
|
176
|
-
in: "in";
|
|
177
191
|
not_in: "not_in";
|
|
178
192
|
is_empty: "is_empty";
|
|
179
193
|
is_not_empty: "is_not_empty";
|
|
@@ -191,6 +205,7 @@ export declare const NextStepSchema: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
|
191
205
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
192
206
|
variable: z.ZodString;
|
|
193
207
|
operator: z.ZodEnum<{
|
|
208
|
+
in: "in";
|
|
194
209
|
eq: "eq";
|
|
195
210
|
neq: "neq";
|
|
196
211
|
gt: "gt";
|
|
@@ -198,7 +213,6 @@ export declare const NextStepSchema: z.ZodDefault<z.ZodNullable<z.ZodObject<{
|
|
|
198
213
|
gte: "gte";
|
|
199
214
|
lte: "lte";
|
|
200
215
|
contains: "contains";
|
|
201
|
-
in: "in";
|
|
202
216
|
not_in: "not_in";
|
|
203
217
|
is_empty: "is_empty";
|
|
204
218
|
is_not_empty: "is_not_empty";
|
|
@@ -236,6 +250,7 @@ export declare const BaseStepTypeSchema: z.ZodObject<{
|
|
|
236
250
|
condition: z.ZodDefault<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
|
237
251
|
variable: z.ZodString;
|
|
238
252
|
operator: z.ZodEnum<{
|
|
253
|
+
in: "in";
|
|
239
254
|
eq: "eq";
|
|
240
255
|
neq: "neq";
|
|
241
256
|
gt: "gt";
|
|
@@ -243,7 +258,6 @@ export declare const BaseStepTypeSchema: z.ZodObject<{
|
|
|
243
258
|
gte: "gte";
|
|
244
259
|
lte: "lte";
|
|
245
260
|
contains: "contains";
|
|
246
|
-
in: "in";
|
|
247
261
|
not_in: "not_in";
|
|
248
262
|
is_empty: "is_empty";
|
|
249
263
|
is_not_empty: "is_not_empty";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.types.d.ts","sourceRoot":"","sources":["../../src/steps/common.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB,kEAA0C,CAAC;AAE3E,eAAO,MAAM,iBAAiB;;;;;;mBAS5B,CAAC;AAEH,e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@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseStepTypeSchema = exports.ONBOARDING_END_STEP_ID = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.ConditionValueSchema = exports.isUnaryConditionOperator = exports.UNARY_CONDITION_OPERATORS = exports.ConditionOperatorSchema = exports.ButtonActionSchema = exports.SetVariableButtonActionSchema = exports.CustomButtonActionSchema = exports.HapticStyleSchema = exports.ButtonSectionSchema = exports.InfoBoxSchema = exports.SocialProofSchema = exports.MediaSourceSchema = exports.CustomPayloadSchema = void 0;
|
|
3
|
+
exports.BaseStepTypeSchema = exports.ONBOARDING_END_STEP_ID = exports.NextStepSchema = exports.BranchSchema = exports.ConditionGroupSchema = exports.LeafConditionSchema = exports.ConditionValueSchema = exports.isUnaryConditionOperator = exports.UNARY_CONDITION_OPERATORS = exports.ConditionOperatorSchema = exports.ButtonActionSchema = exports.RestoreButtonActionSchema = exports.PurchaseButtonActionSchema = exports.PresentPaywallButtonActionSchema = exports.DismissButtonActionSchema = exports.SetVariableButtonActionSchema = exports.CustomButtonActionSchema = exports.HapticStyleSchema = exports.ButtonSectionSchema = exports.InfoBoxSchema = exports.SocialProofSchema = exports.MediaSourceSchema = exports.CustomPayloadSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.CustomPayloadSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.any()).nullish();
|
|
6
6
|
exports.MediaSourceSchema = zod_1.z.union([
|
|
@@ -52,11 +52,35 @@ exports.SetVariableButtonActionSchema = zod_1.z.object({
|
|
|
52
52
|
kind: zod_1.z.enum(["int", "float", "string"]).optional(),
|
|
53
53
|
arrayOp: zod_1.z.enum(["append", "remove", "toggle"]).optional(),
|
|
54
54
|
});
|
|
55
|
-
exports.
|
|
55
|
+
exports.DismissButtonActionSchema = zod_1.z.object({
|
|
56
|
+
type: zod_1.z.literal("dismiss"),
|
|
57
|
+
});
|
|
58
|
+
exports.PresentPaywallButtonActionSchema = zod_1.z.object({
|
|
59
|
+
type: zod_1.z.literal("presentPaywall"),
|
|
60
|
+
placement: zod_1.z.string().min(1, "placement must not be empty"),
|
|
61
|
+
});
|
|
62
|
+
exports.PurchaseButtonActionSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
63
|
+
type: zod_1.z.literal("purchase"),
|
|
64
|
+
product: zod_1.z.string().min(1, "product must not be empty"),
|
|
65
|
+
onSuccess: zod_1.z.array(exports.ButtonActionSchema).optional(),
|
|
66
|
+
onCancel: zod_1.z.array(exports.ButtonActionSchema).optional(),
|
|
67
|
+
onError: zod_1.z.array(exports.ButtonActionSchema).optional(),
|
|
68
|
+
}));
|
|
69
|
+
exports.RestoreButtonActionSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
70
|
+
type: zod_1.z.literal("restore"),
|
|
71
|
+
onSuccess: zod_1.z.array(exports.ButtonActionSchema).optional(),
|
|
72
|
+
onNothingToRestore: zod_1.z.array(exports.ButtonActionSchema).optional(),
|
|
73
|
+
onError: zod_1.z.array(exports.ButtonActionSchema).optional(),
|
|
74
|
+
}));
|
|
75
|
+
exports.ButtonActionSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
56
76
|
zod_1.z.literal("continue"),
|
|
57
77
|
exports.CustomButtonActionSchema,
|
|
58
78
|
exports.SetVariableButtonActionSchema,
|
|
59
|
-
|
|
79
|
+
exports.PurchaseButtonActionSchema,
|
|
80
|
+
exports.RestoreButtonActionSchema,
|
|
81
|
+
exports.DismissButtonActionSchema,
|
|
82
|
+
exports.PresentPaywallButtonActionSchema,
|
|
83
|
+
]));
|
|
60
84
|
// ── Branching / nextStep schemas ─────────────────────────────────────────────
|
|
61
85
|
exports.ConditionOperatorSchema = zod_1.z.enum([
|
|
62
86
|
"eq",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.types.js","sourceRoot":"","sources":["../../src/steps/common.types.ts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,QAAQ,EAAE;IAC7C,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,QAAQ,EAAE,sBAAc;CACzB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocapine/react-native-onboarding",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.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",
|
|
@@ -8,7 +8,15 @@ import {
|
|
|
8
8
|
UserDefinedParams,
|
|
9
9
|
BaseStepType,
|
|
10
10
|
} from "./types";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getOnboardingCacheKey,
|
|
13
|
+
getPaywallsCacheKey,
|
|
14
|
+
} from "./infra/queries/cacheKey";
|
|
15
|
+
import {
|
|
16
|
+
PaywallCatalog,
|
|
17
|
+
PaywallOptions,
|
|
18
|
+
GetPaywallsResponseHeaders,
|
|
19
|
+
} from "./paywalls/types";
|
|
12
20
|
|
|
13
21
|
import { Platform } from "react-native";
|
|
14
22
|
|
|
@@ -27,14 +35,18 @@ export class OnboardingStudioClient {
|
|
|
27
35
|
}
|
|
28
36
|
|
|
29
37
|
/**
|
|
30
|
-
* Removes this client's cached onboarding payload
|
|
31
|
-
* derived from `options.cacheKey`, or the
|
|
32
|
-
* or app launch is then a cache miss
|
|
33
|
-
* refetch as well, also
|
|
34
|
-
* `["onboardingQuestions", ...]
|
|
38
|
+
* Removes this client's cached onboarding payload AND cached paywall catalog
|
|
39
|
+
* from AsyncStorage (the keys derived from `options.cacheKey`, or the
|
|
40
|
+
* default keys). The next query mount or app launch is then a cache miss
|
|
41
|
+
* and refetches both. To force an in-session refetch as well, also
|
|
42
|
+
* invalidate the React Query keys `["onboardingQuestions", ...]` and
|
|
43
|
+
* `["paywallCatalog", ...]`.
|
|
35
44
|
*/
|
|
36
45
|
async clearCache(): Promise<void> {
|
|
37
|
-
await
|
|
46
|
+
await Promise.all([
|
|
47
|
+
AsyncStorage.removeItem(getOnboardingCacheKey(this.options.cacheKey)),
|
|
48
|
+
AsyncStorage.removeItem(getPaywallsCacheKey(this.options.cacheKey)),
|
|
49
|
+
]);
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
async getSteps<StepType extends BaseStepType = OnboardingStepType>(
|
|
@@ -115,4 +127,95 @@ export class OnboardingStudioClient {
|
|
|
115
127
|
throw error;
|
|
116
128
|
}
|
|
117
129
|
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Fetches the paywall catalog for this project/audience/locale from
|
|
133
|
+
* `get-paywalls`. By design **omits `placement` by default** — the endpoint
|
|
134
|
+
* deliberately returns every placement in one round-trip so a paywall can
|
|
135
|
+
* be presented the instant the user taps upgrade, without a network call at
|
|
136
|
+
* that moment (spec §6.1). Pass `paywallOptions.placement` only when a
|
|
137
|
+
* single placement is genuinely all that's needed.
|
|
138
|
+
*
|
|
139
|
+
* Unlike `getSteps`, there is no fallback-payload option here: a
|
|
140
|
+
* non-`ok` response or a network failure always rejects rather than
|
|
141
|
+
* resolving to a stand-in catalog.
|
|
142
|
+
*/
|
|
143
|
+
async getPaywalls(
|
|
144
|
+
paywallOptions?: PaywallOptions,
|
|
145
|
+
userDefinedParams?: UserDefinedParams
|
|
146
|
+
): Promise<{ data: PaywallCatalog; headers: GetPaywallsResponseHeaders }> {
|
|
147
|
+
console.info("OnboardingStudioClient getPaywalls");
|
|
148
|
+
const isSandbox = this.options.isSandbox;
|
|
149
|
+
|
|
150
|
+
const urlParams = new URLSearchParams();
|
|
151
|
+
// Add userDefinedParams to URL
|
|
152
|
+
if (userDefinedParams) {
|
|
153
|
+
Object.entries(userDefinedParams).forEach(([key, value]) => {
|
|
154
|
+
urlParams.append(key, value);
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
urlParams.append("projectId", this.projectId);
|
|
159
|
+
urlParams.append("platform", Platform.OS);
|
|
160
|
+
|
|
161
|
+
const appVersion = this.options.appVersion; // TODO get the version from the expo app
|
|
162
|
+
if (appVersion) {
|
|
163
|
+
urlParams.append("appVersion", appVersion);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (isSandbox) {
|
|
167
|
+
urlParams.append("draft", "true");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Add paywallOptions to URL
|
|
171
|
+
if (paywallOptions?.locale) {
|
|
172
|
+
urlParams.append("locale", paywallOptions.locale);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Narrows the response to a single paywall. Omitted unless explicitly
|
|
176
|
+
// requested — see the method doc above.
|
|
177
|
+
if (paywallOptions?.placement) {
|
|
178
|
+
urlParams.append("placement", paywallOptions.placement);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Deliberately NOT sending spec §6.1's `omitNulls=true`: it's a
|
|
182
|
+
// convenience for untyped consumers that strips null-valued keys from the
|
|
183
|
+
// response, which would make the runtime shape diverge from `PaywallCatalog`
|
|
184
|
+
// and `Paywall`'s declared `| null` fields. This client parses into those
|
|
185
|
+
// typed objects, so the fields must always be present (possibly `null`),
|
|
186
|
+
// not sometimes missing.
|
|
187
|
+
const url = `${this.baseUrl}/get-paywalls?${urlParams.toString()}`;
|
|
188
|
+
console.info("OnboardingStudioClient getPaywalls url", url);
|
|
189
|
+
try {
|
|
190
|
+
const response = await Promise.race(
|
|
191
|
+
this.options.timeout
|
|
192
|
+
? [
|
|
193
|
+
fetch(url),
|
|
194
|
+
new Promise<Response>((_, reject) =>
|
|
195
|
+
setTimeout(
|
|
196
|
+
() => reject(new Error("timeout")),
|
|
197
|
+
this.options.timeout
|
|
198
|
+
)
|
|
199
|
+
),
|
|
200
|
+
]
|
|
201
|
+
: [fetch(url)]
|
|
202
|
+
);
|
|
203
|
+
if (!response.ok) {
|
|
204
|
+
throw new Error(
|
|
205
|
+
`Failed to fetch paywalls: ${response.status} ${response.statusText}`
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
const data = await response.json();
|
|
209
|
+
return {
|
|
210
|
+
data,
|
|
211
|
+
headers: {
|
|
212
|
+
"ONBS-Audience-Id": response.headers.get("ONBS-Audience-Id"),
|
|
213
|
+
"ONBS-Paywall-Ids": response.headers.get("ONBS-Paywall-Ids"),
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
} catch (error) {
|
|
217
|
+
console.error("OnboardingStudioClient getPaywalls error", error);
|
|
218
|
+
throw error;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
118
221
|
}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { mergeProductRuntimes } from "../products/mergeProductRuntimes";
|
|
3
|
+
import type { ProductRuntime, ProductWithDerived } from "../products/types";
|
|
4
|
+
|
|
5
|
+
const product = (key: string): ProductWithDerived => ({
|
|
6
|
+
key,
|
|
7
|
+
productId: `com.app.${key}`,
|
|
8
|
+
store: "app_store",
|
|
9
|
+
title: key,
|
|
10
|
+
description: key,
|
|
11
|
+
price: "$1.99",
|
|
12
|
+
priceAmount: 1.99,
|
|
13
|
+
currencyCode: "USD",
|
|
14
|
+
period: null,
|
|
15
|
+
periodCount: 1,
|
|
16
|
+
periodIso: null,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const makeRuntime = (overrides: Partial<ProductRuntime> = {}): ProductRuntime => ({
|
|
20
|
+
products: {},
|
|
21
|
+
status: "idle",
|
|
22
|
+
purchasing: false,
|
|
23
|
+
purchase: async () => ({ status: "cancelled" }),
|
|
24
|
+
restore: async () => ({ status: "nothing_to_restore" }),
|
|
25
|
+
...overrides,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Finding 5, 2026-08-17 final review: `OnboardingProvider` publishes ONE of
|
|
29
|
+
// two ProductRuntimes (the shared `PaywallProvider` context one, or its own
|
|
30
|
+
// local `useProducts` call) — never both — so a host's own `productRefs`
|
|
31
|
+
// resolved locally were invisible whenever a context runtime existed. This
|
|
32
|
+
// function is the fix: it unions the two into one runtime.
|
|
33
|
+
describe("mergeProductRuntimes", () => {
|
|
34
|
+
it("returns the context runtime UNCHANGED when there are no local refs to add — the common case", () => {
|
|
35
|
+
const contextRuntime = makeRuntime({ products: { yearly: product("yearly") }, status: "ready" });
|
|
36
|
+
const localRuntime = makeRuntime();
|
|
37
|
+
|
|
38
|
+
const result = mergeProductRuntimes(contextRuntime, localRuntime, false, true);
|
|
39
|
+
|
|
40
|
+
expect(result).toBe(contextRuntime);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("unions both runtimes' products when the host declared local productRefs", () => {
|
|
44
|
+
const contextRuntime = makeRuntime({ products: { yearly: product("yearly") }, status: "ready" });
|
|
45
|
+
const localRuntime = makeRuntime({ products: { lifetime: product("lifetime") }, status: "ready" });
|
|
46
|
+
|
|
47
|
+
const result = mergeProductRuntimes(contextRuntime, localRuntime, true, true);
|
|
48
|
+
|
|
49
|
+
expect(result.products).toEqual({
|
|
50
|
+
yearly: product("yearly"),
|
|
51
|
+
lifetime: product("lifetime"),
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("is not ready until BOTH runtimes are ready", () => {
|
|
56
|
+
const contextRuntime = makeRuntime({ status: "ready" });
|
|
57
|
+
const localRuntime = makeRuntime({ status: "loading" });
|
|
58
|
+
|
|
59
|
+
expect(mergeProductRuntimes(contextRuntime, localRuntime, true, true).status).toBe("loading");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("reports 'error' if either runtime errored", () => {
|
|
63
|
+
const contextRuntime = makeRuntime({ status: "ready" });
|
|
64
|
+
const localRuntime = makeRuntime({ status: "error", error: "boom" });
|
|
65
|
+
|
|
66
|
+
const result = mergeProductRuntimes(contextRuntime, localRuntime, true, true);
|
|
67
|
+
expect(result.status).toBe("error");
|
|
68
|
+
expect(result.error).toBe("boom");
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it("is 'ready' once both runtimes resolved", () => {
|
|
72
|
+
const contextRuntime = makeRuntime({ status: "ready" });
|
|
73
|
+
const localRuntime = makeRuntime({ status: "ready" });
|
|
74
|
+
|
|
75
|
+
expect(mergeProductRuntimes(contextRuntime, localRuntime, true, true).status).toBe("ready");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
// N3, round 2 of the final review: productRefs declared with no local
|
|
79
|
+
// productProvider is a real, unremarkable configuration (the shared context
|
|
80
|
+
// runtime is expected to cover it) — useProducts then never leaves the
|
|
81
|
+
// local runtime's status at anything but "idle" (it bails before ever
|
|
82
|
+
// calling a provider it doesn't have). A naive mergeStatus would drag the
|
|
83
|
+
// context runtime's "ready" down to "idle" forever, closing every
|
|
84
|
+
// renderWhen gate on products.loaded for the life of the component.
|
|
85
|
+
it("hasLocalProvider=false: merged status is the context runtime's alone, not dragged down by a permanently-idle local runtime", () => {
|
|
86
|
+
const contextRuntime = makeRuntime({ status: "ready", products: { yearly: product("yearly") } });
|
|
87
|
+
const localRuntime = makeRuntime({ status: "idle" });
|
|
88
|
+
|
|
89
|
+
const result = mergeProductRuntimes(contextRuntime, localRuntime, true, false);
|
|
90
|
+
|
|
91
|
+
expect(result.status).toBe("ready");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("hasLocalProvider=false: still surfaces the context runtime's error, since that's a real failure", () => {
|
|
95
|
+
const contextRuntime = makeRuntime({ status: "error", error: "boom" });
|
|
96
|
+
const localRuntime = makeRuntime({ status: "idle" });
|
|
97
|
+
|
|
98
|
+
const result = mergeProductRuntimes(contextRuntime, localRuntime, true, false);
|
|
99
|
+
|
|
100
|
+
expect(result.status).toBe("error");
|
|
101
|
+
expect(result.error).toBe("boom");
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("purchasing is true if EITHER runtime is mid-purchase", () => {
|
|
105
|
+
const contextRuntime = makeRuntime({ purchasing: false });
|
|
106
|
+
const localRuntime = makeRuntime({ purchasing: true });
|
|
107
|
+
|
|
108
|
+
expect(mergeProductRuntimes(contextRuntime, localRuntime, true, true).purchasing).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it("purchase() routes a key resolved by the LOCAL runtime through the local provider", async () => {
|
|
112
|
+
let calledLocal = false;
|
|
113
|
+
const contextRuntime = makeRuntime({
|
|
114
|
+
products: { yearly: product("yearly") },
|
|
115
|
+
purchase: async () => {
|
|
116
|
+
throw new Error("must not call context purchase for a local-only key");
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
const localRuntime = makeRuntime({
|
|
120
|
+
products: { lifetime: product("lifetime") },
|
|
121
|
+
purchase: async (key) => {
|
|
122
|
+
calledLocal = true;
|
|
123
|
+
return { status: "purchased", productKey: key };
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const result = await mergeProductRuntimes(contextRuntime, localRuntime, true, true).purchase("lifetime");
|
|
128
|
+
|
|
129
|
+
expect(calledLocal).toBe(true);
|
|
130
|
+
expect(result).toEqual({ status: "purchased", productKey: "lifetime" });
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("purchase() routes anything else — including an unknown key — through the context runtime", async () => {
|
|
134
|
+
let calledContext = false;
|
|
135
|
+
const contextRuntime = makeRuntime({
|
|
136
|
+
products: { yearly: product("yearly") },
|
|
137
|
+
purchase: async (key) => {
|
|
138
|
+
calledContext = true;
|
|
139
|
+
return { status: "purchased", productKey: key };
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
const localRuntime = makeRuntime({ products: { lifetime: product("lifetime") } });
|
|
143
|
+
|
|
144
|
+
const result = await mergeProductRuntimes(contextRuntime, localRuntime, true, true).purchase("yearly");
|
|
145
|
+
|
|
146
|
+
expect(calledContext).toBe(true);
|
|
147
|
+
expect(result).toEqual({ status: "purchased", productKey: "yearly" });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it("restore() always delegates to the context runtime — restoring is store-account-wide, not per-ref", async () => {
|
|
151
|
+
let calledContext = false;
|
|
152
|
+
let calledLocal = false;
|
|
153
|
+
const contextRuntime = makeRuntime({
|
|
154
|
+
restore: async () => {
|
|
155
|
+
calledContext = true;
|
|
156
|
+
return { status: "restored", entitlements: ["pro"] };
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
const localRuntime = makeRuntime({
|
|
160
|
+
restore: async () => {
|
|
161
|
+
calledLocal = true;
|
|
162
|
+
return { status: "restored", entitlements: ["pro"] };
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const result = await mergeProductRuntimes(contextRuntime, localRuntime, true, true).restore();
|
|
167
|
+
|
|
168
|
+
expect(calledContext).toBe(true);
|
|
169
|
+
expect(calledLocal).toBe(false);
|
|
170
|
+
expect(result).toEqual({ status: "restored", entitlements: ["pro"] });
|
|
171
|
+
});
|
|
172
|
+
});
|