rampkit-expo-dev 0.0.4 → 0.0.6
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 +33 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<
|
|
2
|
+
<br />
|
|
3
|
+
<img src="https://dqplcvw3fzili.cloudfront.net/rampkitlogo.png" height="110" />
|
|
3
4
|
</p>
|
|
4
5
|
|
|
5
6
|
<h1 align="center">RampKit Expo SDK</h1>
|
|
@@ -37,15 +38,20 @@ npx expo install rampkit-expo-dev
|
|
|
37
38
|
```ts
|
|
38
39
|
import { RampKit } from "rampkit-expo-dev";
|
|
39
40
|
|
|
40
|
-
RampKit.
|
|
41
|
-
|
|
41
|
+
await RampKit.init({
|
|
42
|
+
apiKey: "YOUR_API_KEY",
|
|
43
|
+
environment: "production", // optional
|
|
44
|
+
autoShowOnboarding: false, // optional
|
|
45
|
+
onOnboardingFinished: (payload) => {
|
|
46
|
+
// optional callback fired when the flow finishes
|
|
47
|
+
},
|
|
42
48
|
});
|
|
43
49
|
```
|
|
44
50
|
|
|
45
51
|
Show an onboarding:
|
|
46
52
|
|
|
47
53
|
```ts
|
|
48
|
-
|
|
54
|
+
RampKit.showOnboarding();
|
|
49
55
|
```
|
|
50
56
|
|
|
51
57
|
---
|
|
@@ -53,11 +59,21 @@ await RampKit.present();
|
|
|
53
59
|
## Configuration Options
|
|
54
60
|
|
|
55
61
|
```ts
|
|
56
|
-
RampKit.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
await RampKit.init({
|
|
63
|
+
apiKey: "abc123",
|
|
64
|
+
environment: "staging", // optional
|
|
65
|
+
autoShowOnboarding: true, // optional (auto-present after init if data is available)
|
|
66
|
+
onOnboardingFinished: (payload) => {
|
|
67
|
+
// optional
|
|
68
|
+
},
|
|
60
69
|
});
|
|
70
|
+
|
|
71
|
+
// Access the generated stable user id (stored securely)
|
|
72
|
+
const idFromInit = RampKit.getUserId(); // string | null (available after init)
|
|
73
|
+
|
|
74
|
+
// Or fetch/generate it directly (always returns a string)
|
|
75
|
+
import { getRampKitUserId } from "rampkit-expo-dev";
|
|
76
|
+
const userId = await getRampKitUserId();
|
|
61
77
|
```
|
|
62
78
|
|
|
63
79
|
More examples are in the docs:
|
|
@@ -68,11 +84,19 @@ https://rampkit.com/docs
|
|
|
68
84
|
## Example
|
|
69
85
|
|
|
70
86
|
```ts
|
|
87
|
+
import { useEffect } from "react";
|
|
71
88
|
import { RampKit } from "rampkit-expo-dev";
|
|
72
89
|
import { Button } from "react-native";
|
|
73
90
|
|
|
74
91
|
export default function App() {
|
|
75
|
-
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
// Initialize once in your app
|
|
94
|
+
RampKit.init({ apiKey: "YOUR_API_KEY" });
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<Button title="Show Onboarding" onPress={() => RampKit.showOnboarding()} />
|
|
99
|
+
);
|
|
76
100
|
}
|
|
77
101
|
```
|
|
78
102
|
|
package/package.json
CHANGED