rampkit-expo-dev 0.0.17 → 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.
@@ -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 ONBOARDING_URL;
9
+ private static readonly MANIFEST_BASE_URL;
9
10
  static get instance(): RampKitCore;
10
11
  init(config: {
11
- apiKey: string;
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
- const response = await globalThis.fetch(RampKitCore.ONBOARDING_URL);
32
- const json = await response.json();
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.ONBOARDING_URL = "https://dqplcvw3fzili.cloudfront.net/labelaiOnboarding.json";
139
+ RampKitCore.MANIFEST_BASE_URL = "https://dh1psiwzzzkgr.cloudfront.net";
@@ -477,10 +477,10 @@ function Overlay(props) {
477
477
  console.log("[Rampkit] onPageSelected", pos);
478
478
  sendVarsToWebView(pos);
479
479
  };
480
- const handleAdvance = (i) => {
480
+ const handleAdvance = (i, animation = "fade") => {
481
481
  const last = props.screens.length - 1;
482
482
  if (i < last) {
483
- navigateToIndex(i + 1);
483
+ navigateToIndex(i + 1, animation);
484
484
  Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light).catch(() => { });
485
485
  }
486
486
  else {
@@ -682,7 +682,7 @@ function Overlay(props) {
682
682
  }
683
683
  if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:continue" ||
684
684
  (data === null || data === void 0 ? void 0 : data.type) === "continue") {
685
- handleAdvance(i);
685
+ handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
686
686
  return;
687
687
  }
688
688
  if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:navigate") {
@@ -697,7 +697,7 @@ function Overlay(props) {
697
697
  return;
698
698
  }
699
699
  if (!target || target === "__continue__") {
700
- handleAdvance(i);
700
+ handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
701
701
  return;
702
702
  }
703
703
  const targetIndex = props.screens.findIndex((s) => s.id === target);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rampkit-expo-dev",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "The Expo SDK for RampKit. Build, test, and personalize app onboardings with instant updates.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",