rn-onboarding-analytics 1.0.0 → 1.1.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 +3 -3
- package/lib/module/spill-onboarding/analytics.js +12 -5
- package/lib/module/spill-onboarding/analytics.js.map +1 -1
- package/lib/module/spill-onboarding/components/OnboardingPaywallPanel.js +299 -0
- package/lib/module/spill-onboarding/components/OnboardingPaywallPanel.js.map +1 -0
- package/lib/module/spill-onboarding/index.js +49 -6
- package/lib/module/spill-onboarding/index.js.map +1 -1
- package/lib/typescript/src/spill-onboarding/analytics.d.ts +1 -1
- package/lib/typescript/src/spill-onboarding/analytics.d.ts.map +1 -1
- package/lib/typescript/src/spill-onboarding/components/OnboardingPaywallPanel.d.ts +4 -0
- package/lib/typescript/src/spill-onboarding/components/OnboardingPaywallPanel.d.ts.map +1 -0
- package/lib/typescript/src/spill-onboarding/index.d.ts +1 -1
- package/lib/typescript/src/spill-onboarding/index.d.ts.map +1 -1
- package/lib/typescript/src/spill-onboarding/types.d.ts +61 -3
- package/lib/typescript/src/spill-onboarding/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/spill-onboarding/analytics.ts +18 -5
- package/src/spill-onboarding/components/OnboardingPaywallPanel.tsx +346 -0
- package/src/spill-onboarding/index.tsx +68 -18
- package/src/spill-onboarding/types.ts +68 -3
|
@@ -206,7 +206,7 @@ export interface OnboardingProps {
|
|
|
206
206
|
steps: OnboardingStep[];
|
|
207
207
|
|
|
208
208
|
/** Called when the user completes the final step. */
|
|
209
|
-
onComplete: () => void;
|
|
209
|
+
onComplete: (planId?: string) => void;
|
|
210
210
|
|
|
211
211
|
/** Called when the user skips the onboarding. */
|
|
212
212
|
onSkip?: () => void;
|
|
@@ -237,7 +237,72 @@ export interface OnboardingProps {
|
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
239
|
* API Key for analytics.
|
|
240
|
-
*
|
|
240
|
+
* Optional. If not provided, analytics will be disabled.
|
|
241
241
|
*/
|
|
242
|
-
apiKey
|
|
242
|
+
apiKey?: string;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* If true, analytics events will be logged to console but not sent to the server.
|
|
246
|
+
* Useful for development.
|
|
247
|
+
*/
|
|
248
|
+
isDev?: boolean;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Optional Paywall panel content.
|
|
252
|
+
* If provided, it will be shown after the last step.
|
|
253
|
+
*/
|
|
254
|
+
paywallPanel?: OnboardingPaywallPanelConfig;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export interface PaywallPlan {
|
|
258
|
+
id: string;
|
|
259
|
+
title: string;
|
|
260
|
+
price: string;
|
|
261
|
+
interval?: string;
|
|
262
|
+
features?: string[];
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Props for the paywall panel.
|
|
267
|
+
*/
|
|
268
|
+
export interface OnboardingPaywallPanelProps {
|
|
269
|
+
/** Callback invoked when the user taps the main action button. */
|
|
270
|
+
onPressContinue: (planId: string) => void;
|
|
271
|
+
|
|
272
|
+
/** Title content. */
|
|
273
|
+
title?: string | ReactNode;
|
|
274
|
+
|
|
275
|
+
/** Subtitle content. */
|
|
276
|
+
subtitle?: string | ReactNode;
|
|
277
|
+
|
|
278
|
+
/** List of plans to display. */
|
|
279
|
+
plans: PaywallPlan[];
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Button content. Either a simple string label or a render function.
|
|
283
|
+
*/
|
|
284
|
+
button: string | (({ onPress }: { onPress: () => void }) => ReactNode);
|
|
285
|
+
|
|
286
|
+
/** Optional image shown on the paywall panel. */
|
|
287
|
+
image?: ImageSourcePropType | (() => ReactNode);
|
|
288
|
+
|
|
289
|
+
/** Helper text displayed above the continue button. */
|
|
290
|
+
helperTextContinue?: string;
|
|
291
|
+
|
|
292
|
+
/** Link for restore purchase action. */
|
|
293
|
+
onRestorePurchase?: { text?: string; onPress: () => void };
|
|
294
|
+
|
|
295
|
+
/** Link for terms of service action. */
|
|
296
|
+
onTerms?: { text?: string; onPress: () => void };
|
|
297
|
+
|
|
298
|
+
/** Link for privacy policy action. */
|
|
299
|
+
onPrivacy?: { text?: string; onPress: () => void };
|
|
243
300
|
}
|
|
301
|
+
|
|
302
|
+
type OnboardingPaywallPanelConfig =
|
|
303
|
+
| Omit<OnboardingPaywallPanelProps, 'onPressContinue'>
|
|
304
|
+
| (({
|
|
305
|
+
onPressContinue,
|
|
306
|
+
}: {
|
|
307
|
+
onPressContinue: (planId: string) => void;
|
|
308
|
+
}) => ReactNode);
|