@virex-tech/paywallo-sdk 2.2.5 → 2.2.6

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.
@@ -0,0 +1,31 @@
1
+ package com.paywallo.sdk
2
+
3
+ import com.facebook.react.bridge.*
4
+ import android.os.Build
5
+
6
+ class PaywalloEnvModule(private val reactContext: ReactApplicationContext) :
7
+ ReactContextBaseJavaModule(reactContext) {
8
+
9
+ override fun getName() = "PaywalloEnv"
10
+
11
+ @ReactMethod
12
+ fun detect(promise: Promise) {
13
+ try {
14
+ val packageName = reactContext.packageName
15
+ val packageManager = reactContext.packageManager
16
+ val installer = if (Build.VERSION.SDK_INT >= 30) {
17
+ packageManager.getInstallSourceInfo(packageName).installingPackageName
18
+ } else {
19
+ @Suppress("DEPRECATION")
20
+ packageManager.getInstallerPackageName(packageName)
21
+ }
22
+ if (installer == "com.android.vending") {
23
+ promise.resolve("production")
24
+ } else {
25
+ promise.resolve("sandbox")
26
+ }
27
+ } catch (e: Exception) {
28
+ promise.resolve("production")
29
+ }
30
+ }
31
+ }
@@ -12,7 +12,8 @@ class PaywalloSdkPackage : ReactPackage {
12
12
  PaywalloFBBridgeModule(reactContext),
13
13
  PaywalloStorageModule(reactContext),
14
14
  PaywalloDeviceModule(reactContext),
15
- PaywalloNotificationsModule(reactContext)
15
+ PaywalloNotificationsModule(reactContext),
16
+ PaywalloEnvModule(reactContext)
16
17
  )
17
18
  }
18
19
 
package/dist/index.d.mts CHANGED
@@ -307,6 +307,13 @@ interface PaywalloConfig {
307
307
  debug?: boolean;
308
308
  environment?: Environment;
309
309
  errorStrings?: PaywallErrorStrings$1;
310
+ /**
311
+ * App version reported to the server (used in event context.app_version
312
+ * and identify payload). When omitted, defaults to "unknown".
313
+ * Consumers should pass `Application.nativeApplicationVersion` (Expo)
314
+ * or `DeviceInfo.getVersion()` (bare RN) here.
315
+ */
316
+ appVersion?: string;
310
317
  }
311
318
  interface UserProperties {
312
319
  [key: string]: string | number | boolean | null;
@@ -387,12 +394,18 @@ interface EventContext {
387
394
  session_id?: string;
388
395
  device_id?: string;
389
396
  app_version?: string;
397
+ app_build?: string;
398
+ bundle_id?: string;
390
399
  sdk_version?: string;
391
400
  platform?: string;
392
401
  os_version?: string;
393
402
  device_model?: string;
394
403
  timezone?: string;
395
404
  locale?: string;
405
+ carrier?: string;
406
+ screen_width?: number;
407
+ screen_height?: number;
408
+ screen_density?: number;
396
409
  attribution?: Record<string, unknown>;
397
410
  ids?: Record<string, unknown>;
398
411
  }
@@ -896,6 +909,7 @@ declare class NotificationsManager {
896
909
  private getDistinctId;
897
910
  private appKey;
898
911
  private apiBaseUrl;
912
+ private environment;
899
913
  private tokenRefreshCleanup;
900
914
  private foregroundCleanup;
901
915
  private pendingHandlersConfig;
@@ -910,6 +924,7 @@ declare class NotificationsManager {
910
924
  secureStorage: SecureStorage;
911
925
  getDeviceId: () => string | null;
912
926
  getDistinctId?: () => string;
927
+ environment?: "sandbox" | "production";
913
928
  }): void;
914
929
  initialize(config: NotificationsManagerConfig): Promise<void>;
915
930
  private applyConfig;
package/dist/index.d.ts CHANGED
@@ -307,6 +307,13 @@ interface PaywalloConfig {
307
307
  debug?: boolean;
308
308
  environment?: Environment;
309
309
  errorStrings?: PaywallErrorStrings$1;
310
+ /**
311
+ * App version reported to the server (used in event context.app_version
312
+ * and identify payload). When omitted, defaults to "unknown".
313
+ * Consumers should pass `Application.nativeApplicationVersion` (Expo)
314
+ * or `DeviceInfo.getVersion()` (bare RN) here.
315
+ */
316
+ appVersion?: string;
310
317
  }
311
318
  interface UserProperties {
312
319
  [key: string]: string | number | boolean | null;
@@ -387,12 +394,18 @@ interface EventContext {
387
394
  session_id?: string;
388
395
  device_id?: string;
389
396
  app_version?: string;
397
+ app_build?: string;
398
+ bundle_id?: string;
390
399
  sdk_version?: string;
391
400
  platform?: string;
392
401
  os_version?: string;
393
402
  device_model?: string;
394
403
  timezone?: string;
395
404
  locale?: string;
405
+ carrier?: string;
406
+ screen_width?: number;
407
+ screen_height?: number;
408
+ screen_density?: number;
396
409
  attribution?: Record<string, unknown>;
397
410
  ids?: Record<string, unknown>;
398
411
  }
@@ -896,6 +909,7 @@ declare class NotificationsManager {
896
909
  private getDistinctId;
897
910
  private appKey;
898
911
  private apiBaseUrl;
912
+ private environment;
899
913
  private tokenRefreshCleanup;
900
914
  private foregroundCleanup;
901
915
  private pendingHandlersConfig;
@@ -910,6 +924,7 @@ declare class NotificationsManager {
910
924
  secureStorage: SecureStorage;
911
925
  getDeviceId: () => string | null;
912
926
  getDistinctId?: () => string;
927
+ environment?: "sandbox" | "production";
913
928
  }): void;
914
929
  initialize(config: NotificationsManagerConfig): Promise<void>;
915
930
  private applyConfig;