rampkit-expo-dev 0.0.18 → 0.0.19
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/RampKit.d.ts +4 -2
- package/build/RampKit.js +17 -3
- package/package.json +1 -1
package/build/RampKit.d.ts
CHANGED
|
@@ -3,12 +3,14 @@ export declare class RampKitCore {
|
|
|
3
3
|
private config;
|
|
4
4
|
private onboardingData;
|
|
5
5
|
private userId;
|
|
6
|
+
private appId;
|
|
6
7
|
private onOnboardingFinished?;
|
|
7
8
|
private onShowPaywall?;
|
|
8
|
-
private static readonly
|
|
9
|
+
private static readonly MANIFEST_BASE_URL;
|
|
9
10
|
static get instance(): RampKitCore;
|
|
10
11
|
init(config: {
|
|
11
|
-
|
|
12
|
+
appId: string;
|
|
13
|
+
apiKey?: string;
|
|
12
14
|
environment?: string;
|
|
13
15
|
autoShowOnboarding?: boolean;
|
|
14
16
|
onOnboardingFinished?: (payload?: any) => void;
|
package/build/RampKit.js
CHANGED
|
@@ -8,6 +8,7 @@ class RampKitCore {
|
|
|
8
8
|
this.config = {};
|
|
9
9
|
this.onboardingData = null;
|
|
10
10
|
this.userId = null;
|
|
11
|
+
this.appId = null;
|
|
11
12
|
}
|
|
12
13
|
static get instance() {
|
|
13
14
|
if (!this._instance)
|
|
@@ -16,6 +17,7 @@ class RampKitCore {
|
|
|
16
17
|
}
|
|
17
18
|
async init(config) {
|
|
18
19
|
this.config = config;
|
|
20
|
+
this.appId = config.appId;
|
|
19
21
|
this.onOnboardingFinished = config.onOnboardingFinished;
|
|
20
22
|
this.onShowPaywall = config.onShowPaywall || config.showPaywall;
|
|
21
23
|
try {
|
|
@@ -28,8 +30,20 @@ class RampKitCore {
|
|
|
28
30
|
}
|
|
29
31
|
console.log("[RampKit] Init: starting onboarding load");
|
|
30
32
|
try {
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
+
// First, fetch the app manifest to get the onboarding URL
|
|
34
|
+
const manifestUrl = `${RampKitCore.MANIFEST_BASE_URL}/${config.appId}/manifest.json`;
|
|
35
|
+
console.log("[RampKit] Init: fetching manifest from", manifestUrl);
|
|
36
|
+
const manifestResponse = await globalThis.fetch(manifestUrl);
|
|
37
|
+
const manifest = await manifestResponse.json();
|
|
38
|
+
if (!manifest.onboardings || manifest.onboardings.length === 0) {
|
|
39
|
+
throw new Error("No onboardings found in manifest");
|
|
40
|
+
}
|
|
41
|
+
// Use the first onboarding
|
|
42
|
+
const firstOnboarding = manifest.onboardings[0];
|
|
43
|
+
console.log("[RampKit] Init: using onboarding", firstOnboarding.name, firstOnboarding.id);
|
|
44
|
+
// Fetch the actual onboarding data
|
|
45
|
+
const onboardingResponse = await globalThis.fetch(firstOnboarding.url);
|
|
46
|
+
const json = await onboardingResponse.json();
|
|
33
47
|
this.onboardingData = json;
|
|
34
48
|
try {
|
|
35
49
|
console.log("[RampKit] Init: onboardingId", json && json.onboardingId);
|
|
@@ -122,4 +136,4 @@ class RampKitCore {
|
|
|
122
136
|
}
|
|
123
137
|
}
|
|
124
138
|
exports.RampKitCore = RampKitCore;
|
|
125
|
-
RampKitCore.
|
|
139
|
+
RampKitCore.MANIFEST_BASE_URL = "https://dh1psiwzzzkgr.cloudfront.net";
|
package/package.json
CHANGED