rampkit-expo-dev 0.0.89 → 0.0.90

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.
@@ -1,42 +1,25 @@
1
1
  /**
2
2
  * OnboardingResponseStorage
3
- * Manages persistent storage of onboarding state variables
3
+ * Manages persistent storage of onboarding variables
4
4
  */
5
5
  /**
6
- * Represents the stored onboarding state
7
- */
8
- export interface OnboardingState {
9
- /** The state variables as key-value pairs */
10
- variables: Record<string, any>;
11
- /** ISO 8601 timestamp when the state was last updated */
12
- updatedAt: string;
13
- }
14
- /**
15
- * Manages persistent storage of onboarding state variables
6
+ * Manages persistent storage of onboarding variables
16
7
  */
17
8
  export declare const OnboardingResponseStorage: {
18
9
  /**
19
- * Initialize the state with initial values from onboarding config
20
- * This should be called when onboarding starts
21
- */
22
- initializeState(initialVariables: Record<string, any>): Promise<void>;
23
- /**
24
- * Update state with new variable values (merges with existing)
10
+ * Initialize with initial values from onboarding config
25
11
  */
26
- updateState(newVariables: Record<string, any>): Promise<void>;
12
+ initializeVariables(initialVariables: Record<string, any>): Promise<void>;
27
13
  /**
28
- * Retrieve the stored state
29
- * @returns OnboardingState object with variables and timestamp
14
+ * Update variables (merges with existing)
30
15
  */
31
- retrieveState(): Promise<OnboardingState>;
16
+ updateVariables(newVariables: Record<string, any>): Promise<void>;
32
17
  /**
33
- * Retrieve just the variables (convenience method)
34
- * @returns Record of variable name to value
18
+ * Get stored variables
35
19
  */
36
- retrieveVariables(): Promise<Record<string, any>>;
20
+ getVariables(): Promise<Record<string, any>>;
37
21
  /**
38
- * Clear all stored state
22
+ * Clear all stored variables
39
23
  */
40
- clearState(): Promise<void>;
41
- clearResponses(): Promise<void>;
24
+ clearVariables(): Promise<void>;
42
25
  };
@@ -1,98 +1,74 @@
1
1
  "use strict";
2
2
  /**
3
3
  * OnboardingResponseStorage
4
- * Manages persistent storage of onboarding state variables
4
+ * Manages persistent storage of onboarding variables
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.OnboardingResponseStorage = void 0;
8
8
  const RampKitNative_1 = require("./RampKitNative");
9
9
  const constants_1 = require("./constants");
10
10
  /**
11
- * Manages persistent storage of onboarding state variables
11
+ * Manages persistent storage of onboarding variables
12
12
  */
13
13
  exports.OnboardingResponseStorage = {
14
14
  /**
15
- * Initialize the state with initial values from onboarding config
16
- * This should be called when onboarding starts
15
+ * Initialize with initial values from onboarding config
17
16
  */
18
- async initializeState(initialVariables) {
17
+ async initializeVariables(initialVariables) {
19
18
  try {
20
- const state = {
21
- variables: { ...initialVariables },
22
- updatedAt: new Date().toISOString(),
23
- };
24
- await (0, RampKitNative_1.setStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_RESPONSES, JSON.stringify(state));
19
+ await (0, RampKitNative_1.setStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_RESPONSES, JSON.stringify(initialVariables));
25
20
  if (__DEV__) {
26
- console.log("[RampKit] Initialized onboarding state:", initialVariables);
21
+ console.log("[RampKit] Initialized onboarding variables:", initialVariables);
27
22
  }
28
23
  }
29
24
  catch (error) {
30
- console.warn("[RampKit] Failed to initialize onboarding state:", error);
25
+ console.warn("[RampKit] Failed to initialize onboarding variables:", error);
31
26
  }
32
27
  },
33
28
  /**
34
- * Update state with new variable values (merges with existing)
29
+ * Update variables (merges with existing)
35
30
  */
36
- async updateState(newVariables) {
31
+ async updateVariables(newVariables) {
37
32
  try {
38
- const currentState = await this.retrieveState();
39
- const updatedState = {
40
- variables: {
41
- ...currentState.variables,
42
- ...newVariables,
43
- },
44
- updatedAt: new Date().toISOString(),
45
- };
46
- await (0, RampKitNative_1.setStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_RESPONSES, JSON.stringify(updatedState));
33
+ const current = await this.getVariables();
34
+ const merged = { ...current, ...newVariables };
35
+ await (0, RampKitNative_1.setStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_RESPONSES, JSON.stringify(merged));
47
36
  if (__DEV__) {
48
- console.log("[RampKit] Updated onboarding state:", newVariables);
37
+ console.log("[RampKit] Updated onboarding variables:", newVariables);
49
38
  }
50
39
  }
51
40
  catch (error) {
52
- console.warn("[RampKit] Failed to update onboarding state:", error);
41
+ console.warn("[RampKit] Failed to update onboarding variables:", error);
53
42
  }
54
43
  },
55
44
  /**
56
- * Retrieve the stored state
57
- * @returns OnboardingState object with variables and timestamp
45
+ * Get stored variables
58
46
  */
59
- async retrieveState() {
47
+ async getVariables() {
60
48
  try {
61
49
  const jsonString = await (0, RampKitNative_1.getStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_RESPONSES);
62
50
  if (!jsonString) {
63
- return { variables: {}, updatedAt: "" };
51
+ return {};
64
52
  }
65
53
  return JSON.parse(jsonString);
66
54
  }
67
55
  catch (error) {
68
- console.warn("[RampKit] Failed to retrieve onboarding state:", error);
69
- return { variables: {}, updatedAt: "" };
56
+ console.warn("[RampKit] Failed to retrieve onboarding variables:", error);
57
+ return {};
70
58
  }
71
59
  },
72
60
  /**
73
- * Retrieve just the variables (convenience method)
74
- * @returns Record of variable name to value
61
+ * Clear all stored variables
75
62
  */
76
- async retrieveVariables() {
77
- const state = await this.retrieveState();
78
- return state.variables;
79
- },
80
- /**
81
- * Clear all stored state
82
- */
83
- async clearState() {
63
+ async clearVariables() {
84
64
  try {
85
65
  await (0, RampKitNative_1.setStoredValue)(constants_1.STORAGE_KEYS.ONBOARDING_RESPONSES, "");
86
66
  if (__DEV__) {
87
- console.log("[RampKit] Cleared onboarding state");
67
+ console.log("[RampKit] Cleared onboarding variables");
88
68
  }
89
69
  }
90
70
  catch (error) {
91
- console.warn("[RampKit] Failed to clear onboarding state:", error);
71
+ console.warn("[RampKit] Failed to clear onboarding variables:", error);
92
72
  }
93
73
  },
94
- // Legacy aliases for backwards compatibility
95
- async clearResponses() {
96
- return this.clearState();
97
- },
98
74
  };
@@ -3,7 +3,6 @@
3
3
  * Main SDK class for RampKit Expo integration
4
4
  */
5
5
  import { DeviceInfo, RampKitConfig, EventContext } from "./types";
6
- import { OnboardingState } from "./OnboardingResponseStorage";
7
6
  export declare class RampKitCore {
8
7
  private static _instance;
9
8
  private config;
@@ -63,19 +62,13 @@ export declare class RampKitCore {
63
62
  */
64
63
  isInitialized(): boolean;
65
64
  /**
66
- * Get all stored onboarding state variables
67
- * @returns Promise resolving to OnboardingState with variables and timestamp
65
+ * Get all user answers from onboarding
68
66
  */
69
- getOnboardingState(): Promise<OnboardingState>;
67
+ getAnswers(): Promise<Record<string, any>>;
70
68
  /**
71
- * Get just the onboarding variables (convenience method)
72
- * @returns Promise resolving to Record of variable name to value
69
+ * Get a single answer by key
73
70
  */
74
- getOnboardingVariables(): Promise<Record<string, any>>;
75
- /**
76
- * @deprecated Use getOnboardingState() or getOnboardingVariables() instead
77
- */
78
- getOnboardingResponses(): Promise<Record<string, any>>;
71
+ getAnswer(key: string): Promise<any>;
79
72
  /**
80
73
  * Show the onboarding overlay
81
74
  */
package/build/RampKit.js CHANGED
@@ -221,24 +221,17 @@ class RampKitCore {
221
221
  return this.initialized;
222
222
  }
223
223
  /**
224
- * Get all stored onboarding state variables
225
- * @returns Promise resolving to OnboardingState with variables and timestamp
224
+ * Get all user answers from onboarding
226
225
  */
227
- async getOnboardingState() {
228
- return OnboardingResponseStorage_1.OnboardingResponseStorage.retrieveState();
226
+ async getAnswers() {
227
+ return OnboardingResponseStorage_1.OnboardingResponseStorage.getVariables();
229
228
  }
230
229
  /**
231
- * Get just the onboarding variables (convenience method)
232
- * @returns Promise resolving to Record of variable name to value
230
+ * Get a single answer by key
233
231
  */
234
- async getOnboardingVariables() {
235
- return OnboardingResponseStorage_1.OnboardingResponseStorage.retrieveVariables();
236
- }
237
- /**
238
- * @deprecated Use getOnboardingState() or getOnboardingVariables() instead
239
- */
240
- async getOnboardingResponses() {
241
- return OnboardingResponseStorage_1.OnboardingResponseStorage.retrieveVariables();
232
+ async getAnswer(key) {
233
+ const answers = await OnboardingResponseStorage_1.OnboardingResponseStorage.getVariables();
234
+ return answers[key];
242
235
  }
243
236
  /**
244
237
  * Show the onboarding overlay
@@ -264,8 +257,8 @@ class RampKitCore {
264
257
  return {};
265
258
  }
266
259
  })();
267
- // Initialize state storage with initial values
268
- OnboardingResponseStorage_1.OnboardingResponseStorage.initializeState(variables);
260
+ // Initialize storage with initial values
261
+ OnboardingResponseStorage_1.OnboardingResponseStorage.initializeVariables(variables);
269
262
  const screens = data.screens.map((s) => ({
270
263
  id: s.id,
271
264
  html: s.html ||
@@ -391,8 +384,8 @@ class RampKitCore {
391
384
  this.onboardingData = null;
392
385
  this.initialized = false;
393
386
  this.appUserID = null;
394
- // Clear stored onboarding responses
395
- await OnboardingResponseStorage_1.OnboardingResponseStorage.clearResponses();
387
+ // Clear stored onboarding variables
388
+ await OnboardingResponseStorage_1.OnboardingResponseStorage.clearVariables();
396
389
  console.log("[RampKit] Reset: Re-initializing SDK...");
397
390
  // Re-initialize with stored config
398
391
  await this.configure(this.config);
@@ -2014,8 +2014,8 @@ function Overlay(props) {
2014
2014
  if (__DEV__) {
2015
2015
  console.log("[Rampkit] variables updated:", newVars);
2016
2016
  }
2017
- // Persist state updates to storage
2018
- OnboardingResponseStorage_1.OnboardingResponseStorage.updateState(newVars);
2017
+ // Persist variable updates to storage
2018
+ OnboardingResponseStorage_1.OnboardingResponseStorage.updateVariables(newVars);
2019
2019
  // CRITICAL: Send merged vars back to the active screen
2020
2020
  // This ensures window.__rampkitVariables has the complete state
2021
2021
  // which is needed for dynamic tap conditions to evaluate correctly
package/build/index.d.ts CHANGED
@@ -12,5 +12,4 @@ export type { NativeDeviceInfo, NativeLaunchData } from "./RampKitNative";
12
12
  export { Haptics, StoreReview, Notifications, TransactionObserver, isNativeModuleAvailable } from "./RampKitNative";
13
13
  export type { ImpactStyle, NotificationType, NotificationOptions, NotificationPermissionResult, TransactionObserverResult, SentEventResult, TrackedTransactionDetail, EntitlementCheckResult } from "./RampKitNative";
14
14
  export type { DeviceInfo, RampKitEvent, EventDevice, EventContext, RampKitConfig, RampKitEventName, RampKitContext, RampKitDeviceContext, RampKitUserContext, NavigationData, ScreenPosition, AppSessionStartedProperties, OnboardingStartedProperties, OnboardingCompletedProperties, OnboardingAbandonedProperties, OptionSelectedProperties, NotificationsResponseProperties, PaywallShownProperties, PurchaseStartedProperties, PurchaseCompletedProperties, PurchaseFailedProperties, PurchaseRestoredProperties, } from "./types";
15
- export type { OnboardingState } from "./OnboardingResponseStorage";
16
15
  export { SDK_VERSION, CAPABILITIES } from "./constants";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rampkit-expo-dev",
3
- "version": "0.0.89",
3
+ "version": "0.0.90",
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",