rampkit-expo-dev 0.0.63 → 0.0.65
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/build/EventManager.d.ts +3 -14
- package/build/EventManager.js +14 -51
- package/build/RampKit.js +6 -6
- package/build/constants.d.ts +0 -1
- package/build/constants.js +0 -2
- package/package.json +1 -1
package/build/EventManager.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare class EventManager {
|
|
|
17
17
|
private currentPlacement;
|
|
18
18
|
private onboardingStartTime;
|
|
19
19
|
private currentOnboardingId;
|
|
20
|
+
private onboardingCompletedForSession;
|
|
20
21
|
private initialized;
|
|
21
22
|
static get instance(): EventManager;
|
|
22
23
|
/**
|
|
@@ -76,19 +77,7 @@ declare class EventManager {
|
|
|
76
77
|
*/
|
|
77
78
|
trackOnboardingAbandoned(reason: string, lastScreenName?: string, onboardingId?: string): void;
|
|
78
79
|
/**
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
hasOnboardingBeenCompleted(): Promise<boolean>;
|
|
82
|
-
/**
|
|
83
|
-
* Mark onboarding as completed in persistent storage
|
|
84
|
-
*/
|
|
85
|
-
private markOnboardingAsCompleted;
|
|
86
|
-
/**
|
|
87
|
-
* Reset onboarding completion status (useful for testing or user reset)
|
|
88
|
-
*/
|
|
89
|
-
resetOnboardingCompletionStatus(): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Track onboarding completed event - fires ONCE per user
|
|
80
|
+
* Track onboarding completed event
|
|
92
81
|
* Called when:
|
|
93
82
|
* 1. User completes the onboarding flow (onboarding-finished action)
|
|
94
83
|
* 2. User closes the onboarding (close action)
|
|
@@ -99,7 +88,7 @@ declare class EventManager {
|
|
|
99
88
|
* @param totalSteps - Total number of steps in the onboarding
|
|
100
89
|
* @param onboardingId - The onboarding ID
|
|
101
90
|
*/
|
|
102
|
-
|
|
91
|
+
trackOnboardingCompleted(trigger: string, completedSteps?: number, totalSteps?: number, onboardingId?: string): void;
|
|
103
92
|
/**
|
|
104
93
|
* Track notification response
|
|
105
94
|
*/
|
package/build/EventManager.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.EventManager = exports.eventManager = void 0;
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
|
-
const RampKitNative_1 = require("./RampKitNative");
|
|
10
9
|
/**
|
|
11
10
|
* Generate a UUID v4 using Math.random
|
|
12
11
|
* This is sufficient for event IDs - no crypto dependency needed
|
|
@@ -34,6 +33,7 @@ class EventManager {
|
|
|
34
33
|
// Onboarding tracking
|
|
35
34
|
this.onboardingStartTime = null;
|
|
36
35
|
this.currentOnboardingId = null;
|
|
36
|
+
this.onboardingCompletedForSession = false;
|
|
37
37
|
// Initialization state
|
|
38
38
|
this.initialized = false;
|
|
39
39
|
}
|
|
@@ -102,6 +102,7 @@ class EventManager {
|
|
|
102
102
|
this.currentOnboardingId = onboardingId;
|
|
103
103
|
this.onboardingStartTime = new Date();
|
|
104
104
|
this.currentFlowId = onboardingId;
|
|
105
|
+
this.onboardingCompletedForSession = false;
|
|
105
106
|
}
|
|
106
107
|
/**
|
|
107
108
|
* Get onboarding duration in seconds
|
|
@@ -214,6 +215,11 @@ class EventManager {
|
|
|
214
215
|
* Track onboarding abandoned
|
|
215
216
|
*/
|
|
216
217
|
trackOnboardingAbandoned(reason, lastScreenName, onboardingId) {
|
|
218
|
+
// Skip if onboarding was already completed this session
|
|
219
|
+
if (this.onboardingCompletedForSession) {
|
|
220
|
+
console.log("[RampKit] EventManager: onboarding_abandoned skipped (already completed)");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
217
223
|
const timeSpentSeconds = this.getOnboardingDurationSeconds();
|
|
218
224
|
this.track("onboarding_abandoned", {
|
|
219
225
|
onboardingId: onboardingId || this.currentOnboardingId,
|
|
@@ -224,46 +230,10 @@ class EventManager {
|
|
|
224
230
|
this.endOnboardingTracking();
|
|
225
231
|
}
|
|
226
232
|
// ============================================================================
|
|
227
|
-
// Onboarding Completion
|
|
233
|
+
// Onboarding Completion
|
|
228
234
|
// ============================================================================
|
|
229
235
|
/**
|
|
230
|
-
*
|
|
231
|
-
*/
|
|
232
|
-
async hasOnboardingBeenCompleted() {
|
|
233
|
-
try {
|
|
234
|
-
const value = await (0, RampKitNative_1.getStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_COMPLETED);
|
|
235
|
-
return value === "true";
|
|
236
|
-
}
|
|
237
|
-
catch (_a) {
|
|
238
|
-
return false;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Mark onboarding as completed in persistent storage
|
|
243
|
-
*/
|
|
244
|
-
async markOnboardingAsCompleted() {
|
|
245
|
-
try {
|
|
246
|
-
await (0, RampKitNative_1.setStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_COMPLETED, "true");
|
|
247
|
-
console.log("[RampKit] EventManager: onboarding marked as completed (persisted)");
|
|
248
|
-
}
|
|
249
|
-
catch (error) {
|
|
250
|
-
console.warn("[RampKit] EventManager: failed to persist onboarding completion:", error);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Reset onboarding completion status (useful for testing or user reset)
|
|
255
|
-
*/
|
|
256
|
-
async resetOnboardingCompletionStatus() {
|
|
257
|
-
try {
|
|
258
|
-
await (0, RampKitNative_1.setStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_COMPLETED, "");
|
|
259
|
-
console.log("[RampKit] EventManager: onboarding completion status reset");
|
|
260
|
-
}
|
|
261
|
-
catch (error) {
|
|
262
|
-
console.warn("[RampKit] EventManager: failed to reset onboarding completion:", error);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Track onboarding completed event - fires ONCE per user
|
|
236
|
+
* Track onboarding completed event
|
|
267
237
|
* Called when:
|
|
268
238
|
* 1. User completes the onboarding flow (onboarding-finished action)
|
|
269
239
|
* 2. User closes the onboarding (close action)
|
|
@@ -274,16 +244,9 @@ class EventManager {
|
|
|
274
244
|
* @param totalSteps - Total number of steps in the onboarding
|
|
275
245
|
* @param onboardingId - The onboarding ID
|
|
276
246
|
*/
|
|
277
|
-
|
|
278
|
-
// Check if already completed - skip if so
|
|
279
|
-
const alreadyCompleted = await this.hasOnboardingBeenCompleted();
|
|
280
|
-
if (alreadyCompleted) {
|
|
281
|
-
console.log(`[RampKit] EventManager: onboarding_completed already sent, skipping (trigger: ${trigger})`);
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
// Mark as completed BEFORE sending to prevent race conditions
|
|
285
|
-
await this.markOnboardingAsCompleted();
|
|
247
|
+
trackOnboardingCompleted(trigger, completedSteps, totalSteps, onboardingId) {
|
|
286
248
|
const timeToCompleteSeconds = this.getOnboardingDurationSeconds();
|
|
249
|
+
console.log(`[RampKit] EventManager: 📊 onboarding_completed`, `\n trigger: ${trigger}`, `\n onboardingId: ${onboardingId || this.currentOnboardingId}`, `\n timeToCompleteSeconds: ${timeToCompleteSeconds}`);
|
|
287
250
|
this.track("onboarding_completed", {
|
|
288
251
|
onboardingId: onboardingId || this.currentOnboardingId,
|
|
289
252
|
timeToCompleteSeconds,
|
|
@@ -291,8 +254,9 @@ class EventManager {
|
|
|
291
254
|
totalSteps,
|
|
292
255
|
trigger,
|
|
293
256
|
});
|
|
257
|
+
// Mark as completed so abandoned won't fire for this session
|
|
258
|
+
this.onboardingCompletedForSession = true;
|
|
294
259
|
this.endOnboardingTracking();
|
|
295
|
-
console.log(`[RampKit] EventManager: 📊 onboarding_completed sent (trigger: ${trigger})`);
|
|
296
260
|
}
|
|
297
261
|
/**
|
|
298
262
|
* Track notification response
|
|
@@ -363,9 +327,8 @@ class EventManager {
|
|
|
363
327
|
this.currentPlacement = null;
|
|
364
328
|
this.onboardingStartTime = null;
|
|
365
329
|
this.currentOnboardingId = null;
|
|
330
|
+
this.onboardingCompletedForSession = false;
|
|
366
331
|
this.initialized = false;
|
|
367
|
-
// Reset onboarding completion status so it can fire again for new user
|
|
368
|
-
this.resetOnboardingCompletionStatus();
|
|
369
332
|
}
|
|
370
333
|
}
|
|
371
334
|
exports.EventManager = EventManager;
|
package/build/RampKit.js
CHANGED
|
@@ -289,16 +289,16 @@ class RampKitCore {
|
|
|
289
289
|
navigation,
|
|
290
290
|
onOnboardingFinished: (payload) => {
|
|
291
291
|
var _a;
|
|
292
|
-
// Track onboarding completed
|
|
293
|
-
EventManager_1.eventManager.
|
|
292
|
+
// Track onboarding completed - trigger: finished
|
|
293
|
+
EventManager_1.eventManager.trackOnboardingCompleted("finished", screens.length, screens.length, onboardingId);
|
|
294
294
|
try {
|
|
295
295
|
(_a = this.onOnboardingFinished) === null || _a === void 0 ? void 0 : _a.call(this, payload);
|
|
296
296
|
}
|
|
297
297
|
catch (_) { }
|
|
298
298
|
},
|
|
299
299
|
onShowPaywall: (payload) => {
|
|
300
|
-
// Track onboarding completed
|
|
301
|
-
EventManager_1.eventManager.
|
|
300
|
+
// Track onboarding completed - trigger: paywall_shown
|
|
301
|
+
EventManager_1.eventManager.trackOnboardingCompleted("paywall_shown", screens.length, // We don't know exact step, use total
|
|
302
302
|
screens.length, onboardingId);
|
|
303
303
|
// Call the original callback
|
|
304
304
|
const paywallCallback = (opts === null || opts === void 0 ? void 0 : opts.onShowPaywall) || (opts === null || opts === void 0 ? void 0 : opts.showPaywall) || this.onShowPaywall;
|
|
@@ -315,8 +315,8 @@ class RampKitCore {
|
|
|
315
315
|
EventManager_1.eventManager.trackNotificationsResponse(granted ? "granted" : "denied");
|
|
316
316
|
},
|
|
317
317
|
onCloseAction: (screenIndex, _screenId) => {
|
|
318
|
-
// Track onboarding completed
|
|
319
|
-
EventManager_1.eventManager.
|
|
318
|
+
// Track onboarding completed - trigger: closed
|
|
319
|
+
EventManager_1.eventManager.trackOnboardingCompleted("closed", screenIndex + 1, screens.length, onboardingId);
|
|
320
320
|
},
|
|
321
321
|
});
|
|
322
322
|
}
|
package/build/constants.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export declare const STORAGE_KEYS: {
|
|
|
14
14
|
readonly LAUNCH_COUNT: "rk_launch_count";
|
|
15
15
|
readonly LAST_LAUNCH: "rk_last_launch";
|
|
16
16
|
readonly ONBOARDING_RESPONSES: "rk_onboarding_responses";
|
|
17
|
-
readonly ONBOARDING_COMPLETED: "rk_onboarding_completed";
|
|
18
17
|
};
|
|
19
18
|
export declare const CAPABILITIES: readonly ["onboarding", "paywall_event_receiver", "haptic_feedback", "push_notifications"];
|
|
20
19
|
export declare const SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InV1c3RsenV2am1vY2h4a3hhdGZ4Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjIxMDM2NTUsImV4cCI6MjA3NzY3OTY1NX0.d5XsIMGnia4n9Pou0IidipyyEfSlwpXFoeDBufMOEwE";
|
package/build/constants.js
CHANGED
|
@@ -20,8 +20,6 @@ exports.STORAGE_KEYS = {
|
|
|
20
20
|
LAST_LAUNCH: "rk_last_launch",
|
|
21
21
|
// Onboarding responses (persisted)
|
|
22
22
|
ONBOARDING_RESPONSES: "rk_onboarding_responses",
|
|
23
|
-
// Onboarding completion status (persisted) - fires once per user
|
|
24
|
-
ONBOARDING_COMPLETED: "rk_onboarding_completed",
|
|
25
23
|
};
|
|
26
24
|
exports.CAPABILITIES = [
|
|
27
25
|
"onboarding",
|
package/package.json
CHANGED