rampkit-expo-dev 0.0.18 → 0.0.22
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/android/build.gradle +87 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/expo/modules/rampkit/RampKitModule.kt +445 -0
- package/build/DeviceInfoCollector.d.ts +21 -0
- package/build/DeviceInfoCollector.js +200 -0
- package/build/EventManager.d.ts +155 -0
- package/build/EventManager.js +419 -0
- package/build/RampKit.d.ts +93 -9
- package/build/RampKit.js +224 -21
- package/build/RampKitNative.d.ts +151 -0
- package/build/RampKitNative.js +255 -0
- package/build/RampkitOverlay.d.ts +8 -0
- package/build/RampkitOverlay.js +72 -106
- package/build/constants.d.ts +18 -0
- package/build/constants.js +29 -0
- package/build/index.d.ts +12 -0
- package/build/index.js +30 -1
- package/build/types.d.ts +178 -0
- package/build/types.js +5 -0
- package/build/userId.d.ts +8 -0
- package/build/userId.js +28 -72
- package/expo-module.config.json +10 -0
- package/ios/RampKit.podspec +22 -0
- package/ios/RampKitModule.swift +407 -0
- package/package.json +9 -7
package/build/index.js
CHANGED
|
@@ -1,7 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* RampKit Expo SDK
|
|
4
|
+
* Main entry point for the SDK
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRampKitUserId = exports.RampKit = void 0;
|
|
10
|
+
exports.CAPABILITIES = exports.SDK_VERSION = exports.Notifications = exports.StoreReview = exports.Haptics = exports.RampKitNative = exports.getSessionStartTime = exports.getSessionDurationSeconds = exports.collectDeviceInfo = exports.eventManager = exports.getRampKitUserId = exports.RampKit = void 0;
|
|
4
11
|
const RampKit_1 = require("./RampKit");
|
|
12
|
+
// Main SDK singleton instance
|
|
5
13
|
exports.RampKit = RampKit_1.RampKitCore.instance;
|
|
14
|
+
// Export user ID utility
|
|
6
15
|
var userId_1 = require("./userId");
|
|
7
16
|
Object.defineProperty(exports, "getRampKitUserId", { enumerable: true, get: function () { return userId_1.getRampKitUserId; } });
|
|
17
|
+
// Export event manager for direct access
|
|
18
|
+
var EventManager_1 = require("./EventManager");
|
|
19
|
+
Object.defineProperty(exports, "eventManager", { enumerable: true, get: function () { return EventManager_1.eventManager; } });
|
|
20
|
+
// Export device info collector utilities
|
|
21
|
+
var DeviceInfoCollector_1 = require("./DeviceInfoCollector");
|
|
22
|
+
Object.defineProperty(exports, "collectDeviceInfo", { enumerable: true, get: function () { return DeviceInfoCollector_1.collectDeviceInfo; } });
|
|
23
|
+
Object.defineProperty(exports, "getSessionDurationSeconds", { enumerable: true, get: function () { return DeviceInfoCollector_1.getSessionDurationSeconds; } });
|
|
24
|
+
Object.defineProperty(exports, "getSessionStartTime", { enumerable: true, get: function () { return DeviceInfoCollector_1.getSessionStartTime; } });
|
|
25
|
+
// Export native module for direct access
|
|
26
|
+
var RampKitNative_1 = require("./RampKitNative");
|
|
27
|
+
Object.defineProperty(exports, "RampKitNative", { enumerable: true, get: function () { return __importDefault(RampKitNative_1).default; } });
|
|
28
|
+
// Export native APIs (replacing expo-haptics, expo-store-review, expo-notifications)
|
|
29
|
+
var RampKitNative_2 = require("./RampKitNative");
|
|
30
|
+
Object.defineProperty(exports, "Haptics", { enumerable: true, get: function () { return RampKitNative_2.Haptics; } });
|
|
31
|
+
Object.defineProperty(exports, "StoreReview", { enumerable: true, get: function () { return RampKitNative_2.StoreReview; } });
|
|
32
|
+
Object.defineProperty(exports, "Notifications", { enumerable: true, get: function () { return RampKitNative_2.Notifications; } });
|
|
33
|
+
// Export constants
|
|
34
|
+
var constants_1 = require("./constants");
|
|
35
|
+
Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return constants_1.SDK_VERSION; } });
|
|
36
|
+
Object.defineProperty(exports, "CAPABILITIES", { enumerable: true, get: function () { return constants_1.CAPABILITIES; } });
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RampKit SDK Types
|
|
3
|
+
*/
|
|
4
|
+
export interface DeviceInfo {
|
|
5
|
+
appUserId: string;
|
|
6
|
+
vendorId: string | null;
|
|
7
|
+
appSessionId: string;
|
|
8
|
+
installDate: string;
|
|
9
|
+
isFirstLaunch: boolean;
|
|
10
|
+
launchCount: number;
|
|
11
|
+
lastLaunchAt: string | null;
|
|
12
|
+
bundleId: string | null;
|
|
13
|
+
appName: string | null;
|
|
14
|
+
appVersion: string | null;
|
|
15
|
+
buildNumber: string | null;
|
|
16
|
+
sdkVersion: string;
|
|
17
|
+
platform: "iOS" | "Android" | "iPadOS";
|
|
18
|
+
platformVersion: string;
|
|
19
|
+
platformWrapper: "Expo" | "React Native" | null;
|
|
20
|
+
deviceModel: string;
|
|
21
|
+
deviceName: string;
|
|
22
|
+
isSimulator: boolean;
|
|
23
|
+
deviceLanguageCode: string | null;
|
|
24
|
+
deviceLocale: string;
|
|
25
|
+
regionCode: string | null;
|
|
26
|
+
preferredLanguage: string | null;
|
|
27
|
+
preferredLanguages: string[];
|
|
28
|
+
deviceCurrencyCode: string | null;
|
|
29
|
+
deviceCurrencySymbol: string | null;
|
|
30
|
+
timezoneIdentifier: string;
|
|
31
|
+
timezoneOffsetSeconds: number;
|
|
32
|
+
interfaceStyle: "light" | "dark" | "unspecified";
|
|
33
|
+
screenWidth: number;
|
|
34
|
+
screenHeight: number;
|
|
35
|
+
screenScale: number;
|
|
36
|
+
isLowPowerMode: boolean;
|
|
37
|
+
freeStorageBytes: number | null;
|
|
38
|
+
totalStorageBytes: number | null;
|
|
39
|
+
totalMemoryBytes: number;
|
|
40
|
+
isAppleSearchAdsAttribution: boolean;
|
|
41
|
+
appleSearchAdsToken: string | null;
|
|
42
|
+
capabilities: string[];
|
|
43
|
+
connectionType: string | null;
|
|
44
|
+
collectedAt: string;
|
|
45
|
+
}
|
|
46
|
+
export interface EventDevice {
|
|
47
|
+
platform: string;
|
|
48
|
+
platformVersion: string;
|
|
49
|
+
deviceModel: string;
|
|
50
|
+
sdkVersion: string;
|
|
51
|
+
appVersion: string | null;
|
|
52
|
+
buildNumber: string | null;
|
|
53
|
+
}
|
|
54
|
+
export interface EventContext {
|
|
55
|
+
screenName: string | null;
|
|
56
|
+
flowId: string | null;
|
|
57
|
+
variantId: string | null;
|
|
58
|
+
paywallId: string | null;
|
|
59
|
+
locale: string | null;
|
|
60
|
+
regionCode: string | null;
|
|
61
|
+
placement: string | null;
|
|
62
|
+
}
|
|
63
|
+
export interface RampKitEvent {
|
|
64
|
+
appId: string;
|
|
65
|
+
appUserId: string;
|
|
66
|
+
eventId: string;
|
|
67
|
+
eventName: string;
|
|
68
|
+
sessionId: string;
|
|
69
|
+
occurredAt: string;
|
|
70
|
+
device: EventDevice;
|
|
71
|
+
context: EventContext;
|
|
72
|
+
properties: Record<string, any>;
|
|
73
|
+
}
|
|
74
|
+
export interface AppSessionStartedProperties {
|
|
75
|
+
isFirstLaunch: boolean;
|
|
76
|
+
launchCount: number;
|
|
77
|
+
}
|
|
78
|
+
export interface AppSessionEndedProperties {
|
|
79
|
+
reason: string;
|
|
80
|
+
sessionDurationSeconds: number;
|
|
81
|
+
}
|
|
82
|
+
export interface AppBackgroundedProperties {
|
|
83
|
+
sessionDurationSeconds: number;
|
|
84
|
+
}
|
|
85
|
+
export interface AppForegroundedProperties {
|
|
86
|
+
}
|
|
87
|
+
export interface OnboardingStartedProperties {
|
|
88
|
+
onboardingId?: string;
|
|
89
|
+
totalSteps?: number;
|
|
90
|
+
}
|
|
91
|
+
export interface OnboardingScreenViewedProperties {
|
|
92
|
+
onboardingId?: string;
|
|
93
|
+
screenName: string;
|
|
94
|
+
screenIndex: number;
|
|
95
|
+
totalScreens: number;
|
|
96
|
+
}
|
|
97
|
+
export interface OnboardingQuestionAnsweredProperties {
|
|
98
|
+
onboardingId?: string;
|
|
99
|
+
questionId: string;
|
|
100
|
+
answer: any;
|
|
101
|
+
questionText?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface OnboardingCompletedProperties {
|
|
104
|
+
onboardingId?: string;
|
|
105
|
+
timeToCompleteSeconds: number;
|
|
106
|
+
completedSteps: number;
|
|
107
|
+
totalSteps: number;
|
|
108
|
+
}
|
|
109
|
+
export interface OnboardingAbandonedProperties {
|
|
110
|
+
onboardingId?: string;
|
|
111
|
+
reason: string;
|
|
112
|
+
lastScreenName?: string;
|
|
113
|
+
timeSpentSeconds: number;
|
|
114
|
+
}
|
|
115
|
+
export interface ScreenViewProperties {
|
|
116
|
+
screenName: string;
|
|
117
|
+
referrer?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface CtaTapProperties {
|
|
120
|
+
buttonId: string;
|
|
121
|
+
buttonText?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface NotificationsPromptShownProperties {
|
|
124
|
+
}
|
|
125
|
+
export interface NotificationsResponseProperties {
|
|
126
|
+
status: "granted" | "denied" | "provisional";
|
|
127
|
+
}
|
|
128
|
+
export interface PaywallShownProperties {
|
|
129
|
+
paywallId: string;
|
|
130
|
+
placement?: string;
|
|
131
|
+
products?: Array<{
|
|
132
|
+
productId: string;
|
|
133
|
+
price?: number;
|
|
134
|
+
currency?: string;
|
|
135
|
+
}>;
|
|
136
|
+
}
|
|
137
|
+
export interface PaywallPrimaryActionTapProperties {
|
|
138
|
+
paywallId: string;
|
|
139
|
+
productId?: string;
|
|
140
|
+
}
|
|
141
|
+
export interface PaywallClosedProperties {
|
|
142
|
+
paywallId: string;
|
|
143
|
+
reason: "dismissed" | "purchased" | "backgrounded";
|
|
144
|
+
}
|
|
145
|
+
export interface PurchaseStartedProperties {
|
|
146
|
+
productId: string;
|
|
147
|
+
amount?: number;
|
|
148
|
+
currency?: string;
|
|
149
|
+
}
|
|
150
|
+
export interface PurchaseCompletedProperties {
|
|
151
|
+
productId: string;
|
|
152
|
+
amount: number;
|
|
153
|
+
currency: string;
|
|
154
|
+
transactionId: string;
|
|
155
|
+
originalTransactionId?: string;
|
|
156
|
+
purchaseDate?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface PurchaseFailedProperties {
|
|
159
|
+
productId: string;
|
|
160
|
+
errorCode: string;
|
|
161
|
+
errorMessage: string;
|
|
162
|
+
}
|
|
163
|
+
export type AppLifecycleEventName = "app_session_started" | "app_session_ended" | "app_backgrounded" | "app_foregrounded";
|
|
164
|
+
export type OnboardingEventName = "onboarding_started" | "onboarding_screen_viewed" | "onboarding_question_answered" | "onboarding_completed" | "onboarding_abandoned";
|
|
165
|
+
export type NavigationEventName = "screen_view" | "cta_tap";
|
|
166
|
+
export type PermissionEventName = "notifications_prompt_shown" | "notifications_response";
|
|
167
|
+
export type PaywallEventName = "paywall_shown" | "paywall_primary_action_tap" | "paywall_closed";
|
|
168
|
+
export type PurchaseEventName = "purchase_started" | "purchase_completed" | "purchase_failed";
|
|
169
|
+
export type RampKitEventName = AppLifecycleEventName | OnboardingEventName | NavigationEventName | PermissionEventName | PaywallEventName | PurchaseEventName;
|
|
170
|
+
export interface RampKitConfig {
|
|
171
|
+
appId: string;
|
|
172
|
+
apiKey?: string;
|
|
173
|
+
environment?: "production" | "development";
|
|
174
|
+
autoShowOnboarding?: boolean;
|
|
175
|
+
onOnboardingFinished?: (payload?: any) => void;
|
|
176
|
+
onShowPaywall?: (payload?: any) => void;
|
|
177
|
+
showPaywall?: (payload?: any) => void;
|
|
178
|
+
}
|
package/build/types.js
ADDED
package/build/userId.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RampKit User ID
|
|
3
|
+
* Uses native module for secure storage
|
|
4
|
+
*/
|
|
1
5
|
export declare const RAMPKIT_USER_ID_KEY = "rk_user_id";
|
|
6
|
+
/**
|
|
7
|
+
* Get or create a unique RampKit user ID
|
|
8
|
+
* Uses native Keychain (iOS) / SharedPreferences (Android) for storage
|
|
9
|
+
*/
|
|
2
10
|
export declare function getRampKitUserId(): Promise<string>;
|
package/build/userId.js
CHANGED
|
@@ -1,82 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
/**
|
|
3
|
+
* RampKit User ID
|
|
4
|
+
* Uses native module for secure storage
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
35
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
10
|
exports.RAMPKIT_USER_ID_KEY = void 0;
|
|
37
11
|
exports.getRampKitUserId = getRampKitUserId;
|
|
38
|
-
const
|
|
39
|
-
const Crypto = __importStar(require("expo-crypto"));
|
|
12
|
+
const RampKitNative_1 = __importDefault(require("./RampKitNative"));
|
|
40
13
|
exports.RAMPKIT_USER_ID_KEY = "rk_user_id";
|
|
14
|
+
/**
|
|
15
|
+
* Get or create a unique RampKit user ID
|
|
16
|
+
* Uses native Keychain (iOS) / SharedPreferences (Android) for storage
|
|
17
|
+
*/
|
|
41
18
|
async function getRampKitUserId() {
|
|
42
|
-
const existing = await SecureStore.getItemAsync(exports.RAMPKIT_USER_ID_KEY);
|
|
43
|
-
if (existing && typeof existing === "string" && existing.length > 0) {
|
|
44
|
-
return existing;
|
|
45
|
-
}
|
|
46
|
-
const newId = await generateUuidV4();
|
|
47
|
-
try {
|
|
48
|
-
console.log("[RampKit] UserId: created", newId);
|
|
49
|
-
}
|
|
50
|
-
catch (_a) { }
|
|
51
|
-
await SecureStore.setItemAsync(exports.RAMPKIT_USER_ID_KEY, newId);
|
|
52
|
-
return newId;
|
|
53
|
-
}
|
|
54
|
-
async function generateUuidV4() {
|
|
55
19
|
try {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
59
|
-
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
60
|
-
const hex = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0"));
|
|
61
|
-
return (hex[0] + hex[1] + hex[2] + hex[3] + "-" +
|
|
62
|
-
hex[4] + hex[5] + "-" +
|
|
63
|
-
hex[6] + hex[7] + "-" +
|
|
64
|
-
hex[8] + hex[9] + "-" +
|
|
65
|
-
hex[10] + hex[11] + hex[12] + hex[13] + hex[14] + hex[15]);
|
|
20
|
+
const userId = await RampKitNative_1.default.getUserId();
|
|
21
|
+
return userId;
|
|
66
22
|
}
|
|
67
|
-
catch (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
for (let i = 0; i < 16; i++)
|
|
72
|
-
bytes[i] = randByte();
|
|
73
|
-
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
74
|
-
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
75
|
-
const hex = Array.from(bytes).map((b) => b.toString(16).padStart(2, "0"));
|
|
76
|
-
return (hex[0] + hex[1] + hex[2] + hex[3] + "-" +
|
|
77
|
-
hex[4] + hex[5] + "-" +
|
|
78
|
-
hex[6] + hex[7] + "-" +
|
|
79
|
-
hex[8] + hex[9] + "-" +
|
|
80
|
-
hex[10] + hex[11] + hex[12] + hex[13] + hex[14] + hex[15]);
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.warn("[RampKit] UserId: Failed to get from native module", error);
|
|
25
|
+
// Fallback to generating a new UUID
|
|
26
|
+
return generateFallbackUuid();
|
|
81
27
|
}
|
|
82
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Generate a fallback UUID when native module is not available
|
|
31
|
+
*/
|
|
32
|
+
function generateFallbackUuid() {
|
|
33
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
34
|
+
const r = (Math.random() * 16) | 0;
|
|
35
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
36
|
+
return v.toString(16);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'RampKit'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = package['description']
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.author = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = { :ios => '13.4', :tvos => '13.4' }
|
|
14
|
+
s.swift_version = '5.4'
|
|
15
|
+
s.source = { git: 'https://github.com/getrampkit/rampkit-expo.git' }
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
|
|
18
|
+
s.dependency 'ExpoModulesCore'
|
|
19
|
+
|
|
20
|
+
s.source_files = "*.swift"
|
|
21
|
+
end
|
|
22
|
+
|