mobiqo-react-native 0.0.7 → 0.0.8
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 +6 -2
- package/dist/index.d.ts +15 -9
- package/dist/index.js +13 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,6 +52,7 @@ await mobiqo.init({ mobiqoKey: 'your-mobiqo-api-key' });
|
|
|
52
52
|
// With additional data (optional)
|
|
53
53
|
await mobiqo.syncUser({
|
|
54
54
|
revenue_cat_user_id: 'user-123',
|
|
55
|
+
include_advanced_analysis: false,
|
|
55
56
|
additional_data: {
|
|
56
57
|
email: 'user@example.com',
|
|
57
58
|
plan: 'premium'
|
|
@@ -85,7 +86,8 @@ await mobiqo.trackEvent('screen_opened', MobiqoEvent.SCREEN_VIEW);
|
|
|
85
86
|
|
|
86
87
|
```typescript
|
|
87
88
|
const userInfo = await mobiqo.getUserInfo({
|
|
88
|
-
revenue_cat_user_id: 'user-123'
|
|
89
|
+
revenue_cat_user_id: 'user-123',
|
|
90
|
+
include_advanced_analysis: true
|
|
89
91
|
});
|
|
90
92
|
```
|
|
91
93
|
|
|
@@ -104,11 +106,13 @@ Initialize the Mobiqo service with your API key.
|
|
|
104
106
|
#### `syncUser(options)`
|
|
105
107
|
Sync user data with Mobiqo and start a session.
|
|
106
108
|
- `options.revenue_cat_user_id` (string): RevenueCat user ID
|
|
109
|
+
- `options.include_advanced_analysis` (boolean): whether or not to include advanced analysis in the response (to get the purchase probability and other data, but the request will take more time)
|
|
107
110
|
- `options.additional_data` (Record<string, any>, optional): Additional user data
|
|
108
111
|
|
|
109
112
|
#### `getUserInfo(options)`
|
|
110
113
|
Retrieve user information from Mobiqo.
|
|
111
114
|
- `options.revenue_cat_user_id` (string): RevenueCat user ID
|
|
115
|
+
- `options.include_advanced_analysis` (boolean): whether or not to include advanced analysis in the response (to get the purchase probability and other data, but the request will take more time)
|
|
112
116
|
|
|
113
117
|
#### `trackEvent(event, eventType, additionalData?)`
|
|
114
118
|
Track custom events.
|
|
@@ -176,7 +180,7 @@ interface AppUser {
|
|
|
176
180
|
```typescript
|
|
177
181
|
interface Statistics {
|
|
178
182
|
purchasing_power_parity: number;
|
|
179
|
-
|
|
183
|
+
purchase_intent: number;
|
|
180
184
|
avg_arpu: number;
|
|
181
185
|
avg_arppu: number;
|
|
182
186
|
avg_ltv: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -35,8 +35,8 @@ export interface AppUser {
|
|
|
35
35
|
export interface Statistics {
|
|
36
36
|
/** Purchasing power parity score */
|
|
37
37
|
purchasing_power_parity: number;
|
|
38
|
-
/** Predicted
|
|
39
|
-
|
|
38
|
+
/** Predicted intent to make a purchase */
|
|
39
|
+
purchase_intent: number;
|
|
40
40
|
/** Average revenue per user */
|
|
41
41
|
avg_arpu: number;
|
|
42
42
|
/** Average revenue per paying user */
|
|
@@ -83,7 +83,7 @@ export interface GetUserInfoResponse {
|
|
|
83
83
|
* additional_data: { plan: 'premium' }
|
|
84
84
|
* });
|
|
85
85
|
* console.log('User OS:', result.appUser.os);
|
|
86
|
-
* console.log('Purchase
|
|
86
|
+
* console.log('Purchase intent:', result.statistics.purchase_intent);
|
|
87
87
|
*
|
|
88
88
|
* // Track events with optional additional data
|
|
89
89
|
* await mobiqo.trackEvent('button_clicked', MobiqoEvent.CLICK, { screen: 'home' });
|
|
@@ -121,14 +121,16 @@ export default class Mobiqo {
|
|
|
121
121
|
*
|
|
122
122
|
* @param options - User sync options
|
|
123
123
|
* @param options.revenue_cat_user_id - The RevenueCat user identifier
|
|
124
|
+
* @param options.include_advanced_analysis - Whether to include advanced analysis in the response (purchase probability and other data, but request takes more time)
|
|
124
125
|
* @param options.additional_data - Optional extra user data to store (email, plan, etc.)
|
|
125
126
|
* @returns Promise that resolves with user sync response including user data and statistics
|
|
126
127
|
*
|
|
127
128
|
* @example
|
|
128
129
|
* ```typescript
|
|
129
|
-
* // With additional data
|
|
130
|
+
* // With additional data and advanced analysis
|
|
130
131
|
* await mobiqo.syncUser({
|
|
131
132
|
* revenue_cat_user_id: 'user-123',
|
|
133
|
+
* include_advanced_analysis: true,
|
|
132
134
|
* additional_data: {
|
|
133
135
|
* email: 'user@example.com',
|
|
134
136
|
* plan: 'premium',
|
|
@@ -136,14 +138,15 @@ export default class Mobiqo {
|
|
|
136
138
|
* }
|
|
137
139
|
* });
|
|
138
140
|
*
|
|
139
|
-
* // Without additional data
|
|
141
|
+
* // Without additional data and advanced analysis
|
|
140
142
|
* await mobiqo.syncUser({
|
|
141
143
|
* revenue_cat_user_id: 'user-123'
|
|
142
144
|
* });
|
|
143
145
|
* ```
|
|
144
146
|
*/
|
|
145
|
-
syncUser({ revenue_cat_user_id, additional_data }: {
|
|
147
|
+
syncUser({ revenue_cat_user_id, include_advanced_analysis, additional_data }: {
|
|
146
148
|
revenue_cat_user_id: string;
|
|
149
|
+
include_advanced_analysis?: boolean;
|
|
147
150
|
additional_data?: Record<string, any>;
|
|
148
151
|
}): Promise<SyncUserResponse | undefined>;
|
|
149
152
|
/**
|
|
@@ -154,19 +157,22 @@ export default class Mobiqo {
|
|
|
154
157
|
*
|
|
155
158
|
* @param options - User lookup options
|
|
156
159
|
* @param options.revenue_cat_user_id - The RevenueCat user identifier to look up
|
|
160
|
+
* @param options.include_advanced_analysis - Whether to include advanced analysis in the response (purchase probability and other data, but request takes more time)
|
|
157
161
|
* @returns Promise that resolves with user information including user data and statistics
|
|
158
162
|
*
|
|
159
163
|
* @example
|
|
160
164
|
* ```typescript
|
|
161
165
|
* const userInfo = await mobiqo.getUserInfo({
|
|
162
|
-
* revenue_cat_user_id: 'user-123'
|
|
166
|
+
* revenue_cat_user_id: 'user-123',
|
|
167
|
+
* include_advanced_analysis: true
|
|
163
168
|
* });
|
|
164
169
|
* console.log('User OS:', userInfo.appUser.os);
|
|
165
|
-
* console.log('Purchase
|
|
170
|
+
* console.log('Purchase intent:', userInfo.statistics.purchase_intent);
|
|
166
171
|
* ```
|
|
167
172
|
*/
|
|
168
|
-
getUserInfo({ revenue_cat_user_id }: {
|
|
173
|
+
getUserInfo({ revenue_cat_user_id, include_advanced_analysis }: {
|
|
169
174
|
revenue_cat_user_id: string;
|
|
175
|
+
include_advanced_analysis?: boolean;
|
|
170
176
|
}): Promise<GetUserInfoResponse | undefined>;
|
|
171
177
|
/**
|
|
172
178
|
* Track a custom event with Mobiqo analytics
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ Object.defineProperty(exports, "MobiqoEvent", { enumerable: true, get: function
|
|
|
35
35
|
* additional_data: { plan: 'premium' }
|
|
36
36
|
* });
|
|
37
37
|
* console.log('User OS:', result.appUser.os);
|
|
38
|
-
* console.log('Purchase
|
|
38
|
+
* console.log('Purchase intent:', result.statistics.purchase_intent);
|
|
39
39
|
*
|
|
40
40
|
* // Track events with optional additional data
|
|
41
41
|
* await mobiqo.trackEvent('button_clicked', MobiqoEvent.CLICK, { screen: 'home' });
|
|
@@ -96,14 +96,16 @@ class Mobiqo {
|
|
|
96
96
|
*
|
|
97
97
|
* @param options - User sync options
|
|
98
98
|
* @param options.revenue_cat_user_id - The RevenueCat user identifier
|
|
99
|
+
* @param options.include_advanced_analysis - Whether to include advanced analysis in the response (purchase probability and other data, but request takes more time)
|
|
99
100
|
* @param options.additional_data - Optional extra user data to store (email, plan, etc.)
|
|
100
101
|
* @returns Promise that resolves with user sync response including user data and statistics
|
|
101
102
|
*
|
|
102
103
|
* @example
|
|
103
104
|
* ```typescript
|
|
104
|
-
* // With additional data
|
|
105
|
+
* // With additional data and advanced analysis
|
|
105
106
|
* await mobiqo.syncUser({
|
|
106
107
|
* revenue_cat_user_id: 'user-123',
|
|
108
|
+
* include_advanced_analysis: true,
|
|
107
109
|
* additional_data: {
|
|
108
110
|
* email: 'user@example.com',
|
|
109
111
|
* plan: 'premium',
|
|
@@ -111,14 +113,14 @@ class Mobiqo {
|
|
|
111
113
|
* }
|
|
112
114
|
* });
|
|
113
115
|
*
|
|
114
|
-
* // Without additional data
|
|
116
|
+
* // Without additional data and advanced analysis
|
|
115
117
|
* await mobiqo.syncUser({
|
|
116
118
|
* revenue_cat_user_id: 'user-123'
|
|
117
119
|
* });
|
|
118
120
|
* ```
|
|
119
121
|
*/
|
|
120
122
|
syncUser(_a) {
|
|
121
|
-
return __awaiter(this, arguments, void 0, function* ({ revenue_cat_user_id, additional_data }) {
|
|
123
|
+
return __awaiter(this, arguments, void 0, function* ({ revenue_cat_user_id, include_advanced_analysis, additional_data }) {
|
|
122
124
|
try {
|
|
123
125
|
const project_id = yield async_storage_1.default.getItem('mobiqo_project_id');
|
|
124
126
|
if (!project_id) {
|
|
@@ -130,7 +132,7 @@ class Mobiqo {
|
|
|
130
132
|
headers: {
|
|
131
133
|
"Content-Type": "application/json"
|
|
132
134
|
},
|
|
133
|
-
body: JSON.stringify({ revenue_cat_user_id, project_id, additional_data, local_timestamp: new Date().getTime() })
|
|
135
|
+
body: JSON.stringify({ revenue_cat_user_id, project_id, include_advanced_analysis, additional_data, local_timestamp: new Date().getTime() })
|
|
134
136
|
});
|
|
135
137
|
const responseData = yield response.json();
|
|
136
138
|
yield async_storage_1.default.setItem('mobiqo_session_id', responseData.sessionId);
|
|
@@ -156,19 +158,21 @@ class Mobiqo {
|
|
|
156
158
|
*
|
|
157
159
|
* @param options - User lookup options
|
|
158
160
|
* @param options.revenue_cat_user_id - The RevenueCat user identifier to look up
|
|
161
|
+
* @param options.include_advanced_analysis - Whether to include advanced analysis in the response (purchase probability and other data, but request takes more time)
|
|
159
162
|
* @returns Promise that resolves with user information including user data and statistics
|
|
160
163
|
*
|
|
161
164
|
* @example
|
|
162
165
|
* ```typescript
|
|
163
166
|
* const userInfo = await mobiqo.getUserInfo({
|
|
164
|
-
* revenue_cat_user_id: 'user-123'
|
|
167
|
+
* revenue_cat_user_id: 'user-123',
|
|
168
|
+
* include_advanced_analysis: true
|
|
165
169
|
* });
|
|
166
170
|
* console.log('User OS:', userInfo.appUser.os);
|
|
167
|
-
* console.log('Purchase
|
|
171
|
+
* console.log('Purchase intent:', userInfo.statistics.purchase_intent);
|
|
168
172
|
* ```
|
|
169
173
|
*/
|
|
170
174
|
getUserInfo(_a) {
|
|
171
|
-
return __awaiter(this, arguments, void 0, function* ({ revenue_cat_user_id }) {
|
|
175
|
+
return __awaiter(this, arguments, void 0, function* ({ revenue_cat_user_id, include_advanced_analysis }) {
|
|
172
176
|
try {
|
|
173
177
|
const project_id = yield async_storage_1.default.getItem('mobiqo_project_id');
|
|
174
178
|
if (!project_id) {
|
|
@@ -180,7 +184,7 @@ class Mobiqo {
|
|
|
180
184
|
headers: {
|
|
181
185
|
"Content-Type": "application/json"
|
|
182
186
|
},
|
|
183
|
-
body: JSON.stringify({ revenue_cat_user_id })
|
|
187
|
+
body: JSON.stringify({ revenue_cat_user_id, project_id, include_advanced_analysis })
|
|
184
188
|
});
|
|
185
189
|
const responseData = yield response.json();
|
|
186
190
|
return responseData;
|