rampkit-expo-dev 0.0.50 → 0.0.51
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.
|
@@ -474,7 +474,7 @@ class RampKitModule : Module(), PurchasesUpdatedListener {
|
|
|
474
474
|
if (!existingId.isNullOrEmpty()) {
|
|
475
475
|
return existingId
|
|
476
476
|
}
|
|
477
|
-
val newId = UUID.randomUUID().toString().lowercase()
|
|
477
|
+
val newId = "rk_" + UUID.randomUUID().toString().lowercase()
|
|
478
478
|
prefs.edit().putString(USER_ID_KEY, newId).apply()
|
|
479
479
|
return newId
|
|
480
480
|
}
|
package/build/EventManager.js
CHANGED
|
@@ -3,86 +3,14 @@
|
|
|
3
3
|
* RampKit Event Manager
|
|
4
4
|
* Handles event tracking for the /app-user-events endpoint
|
|
5
5
|
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
-
}) : function(o, v) {
|
|
20
|
-
o["default"] = v;
|
|
21
|
-
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
-
var ownKeys = function(o) {
|
|
24
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
-
var ar = [];
|
|
26
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
return ownKeys(o);
|
|
30
|
-
};
|
|
31
|
-
return function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
})();
|
|
39
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
7
|
exports.EventManager = exports.eventManager = void 0;
|
|
41
|
-
const Crypto = __importStar(require("expo-crypto"));
|
|
42
8
|
const constants_1 = require("./constants");
|
|
43
9
|
/**
|
|
44
|
-
* Generate a UUID v4 using
|
|
45
|
-
|
|
46
|
-
async function generateEventId() {
|
|
47
|
-
try {
|
|
48
|
-
const bytes = (await Crypto.getRandomBytesAsync(16));
|
|
49
|
-
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
50
|
-
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
51
|
-
const hex = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0"));
|
|
52
|
-
return (hex[0] +
|
|
53
|
-
hex[1] +
|
|
54
|
-
hex[2] +
|
|
55
|
-
hex[3] +
|
|
56
|
-
"-" +
|
|
57
|
-
hex[4] +
|
|
58
|
-
hex[5] +
|
|
59
|
-
"-" +
|
|
60
|
-
hex[6] +
|
|
61
|
-
hex[7] +
|
|
62
|
-
"-" +
|
|
63
|
-
hex[8] +
|
|
64
|
-
hex[9] +
|
|
65
|
-
"-" +
|
|
66
|
-
hex[10] +
|
|
67
|
-
hex[11] +
|
|
68
|
-
hex[12] +
|
|
69
|
-
hex[13] +
|
|
70
|
-
hex[14] +
|
|
71
|
-
hex[15]);
|
|
72
|
-
}
|
|
73
|
-
catch (_a) {
|
|
74
|
-
// Fallback using Math.random
|
|
75
|
-
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
76
|
-
const r = (Math.random() * 16) | 0;
|
|
77
|
-
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
78
|
-
return v.toString(16);
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Synchronous UUID generator for when async is not practical
|
|
10
|
+
* Generate a UUID v4 using Math.random
|
|
11
|
+
* This is sufficient for event IDs - no crypto dependency needed
|
|
84
12
|
*/
|
|
85
|
-
function
|
|
13
|
+
function generateEventId() {
|
|
86
14
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
87
15
|
const r = (Math.random() * 16) | 0;
|
|
88
16
|
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
@@ -205,7 +133,7 @@ class EventManager {
|
|
|
205
133
|
console.warn("[RampKit] EventManager: Not initialized, skipping event:", eventName);
|
|
206
134
|
return;
|
|
207
135
|
}
|
|
208
|
-
const eventId =
|
|
136
|
+
const eventId = generateEventId();
|
|
209
137
|
const occurredAt = new Date().toISOString();
|
|
210
138
|
const context = {
|
|
211
139
|
screenName: (_a = contextOverrides === null || contextOverrides === void 0 ? void 0 : contextOverrides.screenName) !== null && _a !== void 0 ? _a : this.currentScreenName,
|
package/build/userId.js
CHANGED
|
@@ -30,9 +30,10 @@ async function getRampKitUserId() {
|
|
|
30
30
|
* Generate a fallback UUID when native module is not available
|
|
31
31
|
*/
|
|
32
32
|
function generateFallbackUuid() {
|
|
33
|
-
|
|
33
|
+
const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
34
34
|
const r = (Math.random() * 16) | 0;
|
|
35
35
|
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
36
36
|
return v.toString(16);
|
|
37
37
|
});
|
|
38
|
+
return "rk_" + uuid;
|
|
38
39
|
}
|
package/ios/RampKitModule.swift
CHANGED
package/package.json
CHANGED