Methods
All 26 top-level methods on the ScaleBun facade.
Signatures are extracted from the SDK source. Every facade method is wrapped so it never throws — before init() resolves, calls are buffered or become no-ops rather than failing.
Index#
| Method | Signature |
|---|---|
init | init(rawConfig: SimplifiedInitConfig | ScaleBunInitConfig | any) |
trackPurchase | trackPurchase(input: { revenue: number; currency: string; transactionId: string; [k: string]: any }): void |
updateSkanConversionValue | updateSkanConversionValue(value: number, coarseValue?: SkanCoarseValue, lockWindow?: boolean): void |
getFeatureFlags | getFeatureFlags(): ScaleBunFeatures |
identify | identify(userId: string, traits?: Record<string, any>) |
identifyUser | identifyUser(userId: string, traits?: Record<string, any>) |
setUser | setUser(user: ScaleBunUser) |
clearUser | clearUser() |
submitRating | submitRating(input: { rating: number; comment?: string; source?: 'in_app' | 'prompt' | 'manual'; /** [ADDITIVE] client-generated UUID for app-rating idempotency (contract §1.4, D8). */ clientRatingId?: string; }) |
enablePush | enablePush(options?: EnablePushOptions): Promise<EnablePushResult> |
onForegroundNotification | onForegroundNotification(cb: (notification: PushNotification) => void): () => void |
onNotificationOpened | onNotificationOpened(cb: (notification: PushNotification) => void): () => void |
trackPermission | trackPermission(permission: string, status: 'granted' | 'denied' | 'blocked' | 'undetermined' | 'limited', details?: Record<string, any>) |
track | track(name: string, payload?: Record<string, any>) |
log | log(level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: Record<string, unknown>) |
captureError | captureError(error: Error | string, context?: { screenName?: string; fatal?: boolean; type?: string; metadata?: Record<string, unknown> }) |
nativeCrash | nativeCrash() |
reportBug | reportBug(description: string, metadata?: Record<string, unknown>) |
setAttribute | setAttribute(key: string, value: string | number | boolean) |
flush | flush() |
enableDebug | enableDebug(config: DebugConfig) |
disableDebug | disableDebug() |
setCalibrationTarget | setCalibrationTarget(target: { targetId: string; expectedNX: number; expectedNY: number }): void |
startSession | startSession(metadata?: Record<string, unknown>): boolean |
stopSession | stopSession(reason?: 'ended' | 'timeout'): boolean |
setNavigationRef | setNavigationRef(ref: any): void |
Reference#
init#
ScaleBun.init(rawConfig: SimplifiedInitConfig | ScaleBunInitConfig | any)Initialize the ScaleBun SDK.
trackPurchase#
ScaleBun.trackPurchase(input: { revenue: number; currency: string; transactionId: string; [k: string]: any }): voidConvenience: emit a Phase 1 purchase event (revenue + currency + transaction_id).
updateSkanConversionValue#
ScaleBun.updateSkanConversionValue(value: number, coarseValue?: SkanCoarseValue, lockWindow?: boolean): voidPhase 3: set the SKAdNetwork fine conversion value (0–63), optionally with a SKAN 4.0 coarse value and window-lock. iOS only — a no-op on Android / Expo Go.
getFeatureFlags#
ScaleBun.getFeatureFlags(): ScaleBunFeaturesGet the current feature flags (consumed by enableDebug)
identify#
ScaleBun.identify(userId: string, traits?: Record<string, any>)Identify a user by ID and optional traits
identifyUser#
ScaleBun.identifyUser(userId: string, traits?: Record<string, any>)Stable public alias for {@link identify}. Part of the minimal public push API surface (ScaleBun.init / identifyUser / enablePush) that stays identical across RN versions and future platforms.
setUser#
ScaleBun.setUser(user: ScaleBunUser)Set user identity (for session context)
clearUser#
ScaleBun.clearUser()Clear user identity
submitRating#
ScaleBun.submitRating(input: { rating: number; comment?: string; source?: 'in_app' | 'prompt' | 'manual'; /** [ADDITIVE] client-generated UUID for app-rating idempotency (contract §1.4, D8). */ clientRatingId?: string; })Submit in-app rating (1-5 stars). Attaches to current session when available; otherwise sends standalone. Never throws.
enablePush#
ScaleBun.enablePush(options?: EnablePushOptions): Promise<EnablePushResult>Enable push notifications with smart, version-aware adapter selection.
onForegroundNotification#
ScaleBun.onForegroundNotification(cb: (notification: PushNotification) => void): () => voidSubscribe to notifications received while the app is foregrounded. Thin, platform-agnostic alias for enablePush({ onForegroundNotification }); use it to attach a handler after enablePush. Returns an unsubscribe function. Inert until push is enabled. (iOS direct APNs delivers these via the native UNUserNotificationCenter surface.)
onNotificationOpened#
ScaleBun.onNotificationOpened(cb: (notification: PushNotification) => void): () => voidSubscribe to the user tapping a notification (open / deep-link), including the cold-start notification that launched the app. Thin alias for enablePush({ onNotificationOpened }). Returns an unsubscribe function. The event shape ({ data, title?, body? }) matches across Android and iOS.
trackPermission#
ScaleBun.trackPermission(permission: string, status: 'granted' | 'denied' | 'blocked' | 'undetermined' | 'limited', details?: Record<string, any>)Report the outcome of an OS permission prompt.
track#
ScaleBun.track(name: string, payload?: Record<string, any>)Track a named event with optional payload
log#
ScaleBun.log(level: 'debug' | 'info' | 'warn' | 'error', message: string, data?: Record<string, unknown>)Log a message (convenience wrapper over track)
captureError#
ScaleBun.captureError(error: Error | string, context?: { screenName?: string; fatal?: boolean; type?: string; metadata?: Record<string, unknown> })Capture a handled error/exception and deliver it to the backend errors endpoint (shows up in the dashboard Crashes view).
nativeCrash#
ScaleBun.nativeCrash()DEV/TEST ONLY — trigger a real native crash to validate the native capture → next-launch drain → backend pipeline. No-op when the native module is unavailable. Do not ship calls to this in production code.
reportBug#
ScaleBun.reportBug(description: string, metadata?: Record<string, unknown>)Report a bug (convenience wrapper over track)
setAttribute#
ScaleBun.setAttribute(key: string, value: string | number | boolean)Set a custom attribute on the current session
flush#
ScaleBun.flush()Force-flush all pending events
enableDebug#
ScaleBun.enableDebug(config: DebugConfig)Enable the debug subsystem.
disableDebug#
ScaleBun.disableDebug()Disable the debug subsystem and clean up
setCalibrationTarget#
ScaleBun.setCalibrationTarget(target: { targetId: string; expectedNX: number; expectedNY: number }): voidDiagnostic-only: stamp the expected target for the very next gesture event. Calibration screens call this immediately before their onPress fires so SessionManager merges expectedTargetId / expectedNX / expectedNY into the stored gesture payload. Pure observability — never affects capture, normalization, or marker placement. TTL ≈ 500 ms.
startSession#
ScaleBun.startSession(metadata?: Record<string, unknown>): booleanStart a session (delegates to session namespace)
stopSession#
ScaleBun.stopSession(reason?: 'ended' | 'timeout'): booleanStop the current session (delegates to session namespace)
setNavigationRef#
ScaleBun.setNavigationRef(ref: any): voidSet the React Navigation container ref for automatic screen detection.