mobiqo-react-native 0.0.5 → 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
CHANGED
|
@@ -34,7 +34,7 @@ cd ios && pod install
|
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
36
|
import Mobiqo from 'mobiqo-react-native';
|
|
37
|
-
import {
|
|
37
|
+
import { MobiqoEvent } from 'mobiqo-react-native';
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
### Initialize the service
|
|
@@ -70,7 +70,7 @@ await mobiqo.syncUser({
|
|
|
70
70
|
// Track an event with additional data (optional)
|
|
71
71
|
await mobiqo.trackEvent(
|
|
72
72
|
'button_clicked',
|
|
73
|
-
|
|
73
|
+
MobiqoEvent.CLICK,
|
|
74
74
|
{
|
|
75
75
|
button_name: 'subscribe',
|
|
76
76
|
screen: 'home'
|
|
@@ -78,7 +78,7 @@ await mobiqo.trackEvent(
|
|
|
78
78
|
);
|
|
79
79
|
|
|
80
80
|
// Track an event without additional data
|
|
81
|
-
await mobiqo.trackEvent('screen_opened',
|
|
81
|
+
await mobiqo.trackEvent('screen_opened', MobiqoEvent.SCREEN_VIEW);
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
### Get user information
|
|
@@ -113,13 +113,13 @@ Retrieve user information from Mobiqo.
|
|
|
113
113
|
#### `trackEvent(event, eventType, additionalData?)`
|
|
114
114
|
Track custom events.
|
|
115
115
|
- `event` (string): Event name
|
|
116
|
-
- `eventType` (
|
|
116
|
+
- `eventType` (MobiqoEvent): Event type from the MobiqoEvent enum
|
|
117
117
|
- `additionalData` (Record<string, any>, optional): Additional event data
|
|
118
118
|
|
|
119
119
|
### Event Types
|
|
120
120
|
|
|
121
121
|
```typescript
|
|
122
|
-
enum
|
|
122
|
+
enum MobiqoEvent {
|
|
123
123
|
CLICK = 'click',
|
|
124
124
|
ACTION = 'action',
|
|
125
125
|
SCREEN_VIEW = 'screen_view',
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
8
|
* ```typescript
|
|
9
|
-
* import {
|
|
9
|
+
* import { MobiqoEvent } from 'mobiqo-capacitor';
|
|
10
10
|
*
|
|
11
11
|
* // Track different types of events
|
|
12
|
-
* await mobiqo.trackEvent('subscribe_button',
|
|
13
|
-
* await mobiqo.trackEvent('paywall_shown',
|
|
12
|
+
* await mobiqo.trackEvent('subscribe_button', MobiqoEvent.CLICK, { location: 'home' });
|
|
13
|
+
* await mobiqo.trackEvent('paywall_shown', MobiqoEvent.PAYWALL_VIEW);
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
export declare enum
|
|
16
|
+
export declare enum MobiqoEvent {
|
|
17
17
|
/** Button or UI element tapped/clicked */
|
|
18
18
|
CLICK = "click",
|
|
19
19
|
/** User performs an action */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MobiqoEvent = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Event types for Mobiqo analytics tracking
|
|
6
6
|
*
|
|
@@ -9,35 +9,35 @@ exports.EventType = void 0;
|
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
|
-
* import {
|
|
12
|
+
* import { MobiqoEvent } from 'mobiqo-capacitor';
|
|
13
13
|
*
|
|
14
14
|
* // Track different types of events
|
|
15
|
-
* await mobiqo.trackEvent('subscribe_button',
|
|
16
|
-
* await mobiqo.trackEvent('paywall_shown',
|
|
15
|
+
* await mobiqo.trackEvent('subscribe_button', MobiqoEvent.CLICK, { location: 'home' });
|
|
16
|
+
* await mobiqo.trackEvent('paywall_shown', MobiqoEvent.PAYWALL_VIEW);
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
var
|
|
20
|
-
(function (
|
|
19
|
+
var MobiqoEvent;
|
|
20
|
+
(function (MobiqoEvent) {
|
|
21
21
|
/** Button or UI element tapped/clicked */
|
|
22
|
-
|
|
22
|
+
MobiqoEvent["CLICK"] = "click";
|
|
23
23
|
/** User performs an action */
|
|
24
|
-
|
|
24
|
+
MobiqoEvent["ACTION"] = "action";
|
|
25
25
|
/** A screen/page is displayed to the user */
|
|
26
|
-
|
|
26
|
+
MobiqoEvent["SCREEN_VIEW"] = "screen_view";
|
|
27
27
|
/** Paywall or subscription screen is shown */
|
|
28
|
-
|
|
28
|
+
MobiqoEvent["PAYWALL_VIEW"] = "paywall_view";
|
|
29
29
|
/** User closes or dismisses paywall */
|
|
30
|
-
|
|
30
|
+
MobiqoEvent["PAYWALL_DISMISS"] = "paywall_dismiss";
|
|
31
31
|
/** User initiates a purchase flow */
|
|
32
|
-
|
|
32
|
+
MobiqoEvent["PURCHASE_ATTEMPT"] = "purchase_attempt";
|
|
33
33
|
/** In-app purchase completed successfully (if not using RevenueCat webhook) */
|
|
34
|
-
|
|
34
|
+
MobiqoEvent["PURCHASE_SUCCESS"] = "purchase_success";
|
|
35
35
|
/** Form or input field submitted */
|
|
36
|
-
|
|
36
|
+
MobiqoEvent["FORM_SUBMIT"] = "form_submit";
|
|
37
37
|
/** User navigates to another screen/section */
|
|
38
|
-
|
|
38
|
+
MobiqoEvent["NAVIGATION"] = "navigation";
|
|
39
39
|
/** A handled error or issue occurred */
|
|
40
|
-
|
|
40
|
+
MobiqoEvent["ERROR"] = "error";
|
|
41
41
|
/** Custom event type for user-defined cases */
|
|
42
|
-
|
|
43
|
-
})(
|
|
42
|
+
MobiqoEvent["CUSTOM"] = "custom";
|
|
43
|
+
})(MobiqoEvent || (exports.MobiqoEvent = MobiqoEvent = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { MobiqoEvent } from "./MobiqoEvent";
|
|
2
|
+
export { MobiqoEvent } from "./MobiqoEvent";
|
|
3
3
|
/**
|
|
4
4
|
* Mobiqo app user data structure
|
|
5
5
|
*/
|
|
@@ -72,7 +72,7 @@ export interface GetUserInfoResponse {
|
|
|
72
72
|
*
|
|
73
73
|
* @example
|
|
74
74
|
* ```typescript
|
|
75
|
-
* import Mobiqo, {
|
|
75
|
+
* import Mobiqo, { MobiqoEvent, SyncUserResponse, AppUser } from 'mobiqo-capacitor';
|
|
76
76
|
*
|
|
77
77
|
* const mobiqo = new Mobiqo();
|
|
78
78
|
* await mobiqo.init({ mobiqoKey: 'your-api-key' });
|
|
@@ -86,8 +86,8 @@ export interface GetUserInfoResponse {
|
|
|
86
86
|
* console.log('Purchase probability:', result.statistics.purchase_probability);
|
|
87
87
|
*
|
|
88
88
|
* // Track events with optional additional data
|
|
89
|
-
* await mobiqo.trackEvent('button_clicked',
|
|
90
|
-
* await mobiqo.trackEvent('screen_viewed',
|
|
89
|
+
* await mobiqo.trackEvent('button_clicked', MobiqoEvent.CLICK, { screen: 'home' });
|
|
90
|
+
* await mobiqo.trackEvent('screen_viewed', MobiqoEvent.SCREEN_VIEW);
|
|
91
91
|
* ```
|
|
92
92
|
*/
|
|
93
93
|
export default class Mobiqo {
|
|
@@ -175,7 +175,7 @@ export default class Mobiqo {
|
|
|
175
175
|
* Events are automatically timestamped and associated with the current user session.
|
|
176
176
|
*
|
|
177
177
|
* @param event - Name/identifier for the event (e.g., 'button_clicked', 'screen_viewed')
|
|
178
|
-
* @param eventType - Type of event from
|
|
178
|
+
* @param eventType - Type of event from MobiqoEvent enum (CLICK, SCREEN_VIEW, etc.)
|
|
179
179
|
* @param additionalData - Optional custom data to attach to the event
|
|
180
180
|
* @returns Promise that resolves with tracking confirmation
|
|
181
181
|
*
|
|
@@ -184,7 +184,7 @@ export default class Mobiqo {
|
|
|
184
184
|
* // Track a button click with additional data
|
|
185
185
|
* await mobiqo.trackEvent(
|
|
186
186
|
* 'subscribe_button_clicked',
|
|
187
|
-
*
|
|
187
|
+
* MobiqoEvent.CLICK,
|
|
188
188
|
* {
|
|
189
189
|
* button_location: 'home_screen',
|
|
190
190
|
* user_plan: 'free'
|
|
@@ -192,10 +192,10 @@ export default class Mobiqo {
|
|
|
192
192
|
* );
|
|
193
193
|
*
|
|
194
194
|
* // Track a screen view without additional data
|
|
195
|
-
* await mobiqo.trackEvent('settings_screen',
|
|
195
|
+
* await mobiqo.trackEvent('settings_screen', MobiqoEvent.SCREEN_VIEW);
|
|
196
196
|
* ```
|
|
197
197
|
*/
|
|
198
|
-
trackEvent(event: string, eventType:
|
|
198
|
+
trackEvent(event: string, eventType: MobiqoEvent, additionalData?: Record<string, any>): Promise<any>;
|
|
199
199
|
/**
|
|
200
200
|
* Send a heartbeat to maintain the user session
|
|
201
201
|
*
|
package/dist/index.js
CHANGED
|
@@ -12,10 +12,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.MobiqoEvent = void 0;
|
|
16
16
|
const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
17
|
-
var
|
|
18
|
-
Object.defineProperty(exports, "
|
|
17
|
+
var MobiqoEvent_1 = require("./MobiqoEvent");
|
|
18
|
+
Object.defineProperty(exports, "MobiqoEvent", { enumerable: true, get: function () { return MobiqoEvent_1.MobiqoEvent; } });
|
|
19
19
|
/**
|
|
20
20
|
* Mobiqo Analytics Service for Capacitor apps
|
|
21
21
|
*
|
|
@@ -24,7 +24,7 @@ Object.defineProperty(exports, "EventType", { enumerable: true, get: function ()
|
|
|
24
24
|
*
|
|
25
25
|
* @example
|
|
26
26
|
* ```typescript
|
|
27
|
-
* import Mobiqo, {
|
|
27
|
+
* import Mobiqo, { MobiqoEvent, SyncUserResponse, AppUser } from 'mobiqo-capacitor';
|
|
28
28
|
*
|
|
29
29
|
* const mobiqo = new Mobiqo();
|
|
30
30
|
* await mobiqo.init({ mobiqoKey: 'your-api-key' });
|
|
@@ -38,8 +38,8 @@ Object.defineProperty(exports, "EventType", { enumerable: true, get: function ()
|
|
|
38
38
|
* console.log('Purchase probability:', result.statistics.purchase_probability);
|
|
39
39
|
*
|
|
40
40
|
* // Track events with optional additional data
|
|
41
|
-
* await mobiqo.trackEvent('button_clicked',
|
|
42
|
-
* await mobiqo.trackEvent('screen_viewed',
|
|
41
|
+
* await mobiqo.trackEvent('button_clicked', MobiqoEvent.CLICK, { screen: 'home' });
|
|
42
|
+
* await mobiqo.trackEvent('screen_viewed', MobiqoEvent.SCREEN_VIEW);
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
class Mobiqo {
|
|
@@ -198,7 +198,7 @@ class Mobiqo {
|
|
|
198
198
|
* Events are automatically timestamped and associated with the current user session.
|
|
199
199
|
*
|
|
200
200
|
* @param event - Name/identifier for the event (e.g., 'button_clicked', 'screen_viewed')
|
|
201
|
-
* @param eventType - Type of event from
|
|
201
|
+
* @param eventType - Type of event from MobiqoEvent enum (CLICK, SCREEN_VIEW, etc.)
|
|
202
202
|
* @param additionalData - Optional custom data to attach to the event
|
|
203
203
|
* @returns Promise that resolves with tracking confirmation
|
|
204
204
|
*
|
|
@@ -207,7 +207,7 @@ class Mobiqo {
|
|
|
207
207
|
* // Track a button click with additional data
|
|
208
208
|
* await mobiqo.trackEvent(
|
|
209
209
|
* 'subscribe_button_clicked',
|
|
210
|
-
*
|
|
210
|
+
* MobiqoEvent.CLICK,
|
|
211
211
|
* {
|
|
212
212
|
* button_location: 'home_screen',
|
|
213
213
|
* user_plan: 'free'
|
|
@@ -215,7 +215,7 @@ class Mobiqo {
|
|
|
215
215
|
* );
|
|
216
216
|
*
|
|
217
217
|
* // Track a screen view without additional data
|
|
218
|
-
* await mobiqo.trackEvent('settings_screen',
|
|
218
|
+
* await mobiqo.trackEvent('settings_screen', MobiqoEvent.SCREEN_VIEW);
|
|
219
219
|
* ```
|
|
220
220
|
*/
|
|
221
221
|
trackEvent(event, eventType, additionalData) {
|