@virex-tech/paywallo-sdk 1.5.0 → 1.5.3

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,20 @@
1
+ package com.paywallo.sdk
2
+
3
+ import com.facebook.react.bridge.WritableMap
4
+ import com.facebook.react.uimanager.events.Event
5
+
6
+ /**
7
+ * Custom event that works with both Old Architecture (RCTEventEmitter) and
8
+ * New Architecture (EventDispatcher via UIManagerHelper).
9
+ */
10
+ class PaywalloWebViewEvent(
11
+ surfaceId: Int,
12
+ viewId: Int,
13
+ private val eventName: String,
14
+ private val payload: WritableMap
15
+ ) : Event<PaywalloWebViewEvent>(surfaceId, viewId) {
16
+
17
+ override fun getEventName(): String = eventName
18
+
19
+ override fun getEventData(): WritableMap = payload
20
+ }
package/dist/index.d.mts CHANGED
@@ -448,7 +448,10 @@ declare class HttpClient {
448
448
  private shouldRetry;
449
449
  private isNetworkError;
450
450
  private calculateDelay;
451
+ private calculateDelayForResponse;
451
452
  private sleep;
453
+ /** Strips path segments that look like app keys (alphanumeric, 20–64 chars) from URLs before logging. */
454
+ private redactUrl;
452
455
  private log;
453
456
  setDebug(debug: boolean): void;
454
457
  getConfig(): Readonly<HttpClientConfig>;
@@ -463,14 +466,12 @@ declare class ApiClient {
463
466
  private offlineQueueEnabled;
464
467
  private httpClient;
465
468
  private readonly cache;
466
- private eventBatch;
467
- private batchTimer;
468
- private readonly BATCH_MAX_SIZE;
469
- private readonly BATCH_FLUSH_MS;
469
+ private readonly batcher;
470
470
  constructor(appKey: string, apiUrl: string, debug?: boolean, environment?: Environment, offlineQueueEnabled?: boolean, timeout?: number);
471
471
  getHttpClient(): HttpClient;
472
472
  getBaseUrl(): string;
473
473
  getWebUrl(): string;
474
+ getAppKey(): string;
474
475
  getEnvironment(): Environment;
475
476
  getQueueSize(): number;
476
477
  setofflineQueueEnabled(enabled: boolean): void;
@@ -483,6 +484,7 @@ declare class ApiClient {
483
484
  reportError(errorType: string, message: string, context?: Record<string, unknown>): Promise<void>;
484
485
  trackEvent(eventName: string, distinctId: string, properties?: UserProperties, timestamp?: number): Promise<void>;
485
486
  flushEventBatch(): Promise<void>;
487
+ dispose(): void;
486
488
  identify(distinctId: string, properties?: UserProperties, email?: string, deviceId?: string): Promise<void>;
487
489
  startSession(distinctId: string, sessionId: string, platform?: string, appVersion?: string, deviceModel?: string, osVersion?: string): Promise<{
488
490
  success: boolean;
@@ -500,9 +502,6 @@ declare class ApiClient {
500
502
  evaluateFlags(keys: string[], distinctId: string): Promise<Record<string, string | null>>;
501
503
  getConditionalFlag(flagKey: string, context: ConditionalFlagContext): Promise<ConditionalFlagResult>;
502
504
  getVariantFromCache(flagKey: string, distinctId: string): Promise<FlagVariant | null>;
503
- private static readonly FLAG_MAX_AGE_MS;
504
- private readFlagFromStorage;
505
- private writeFlagToStorage;
506
505
  private postWithQueue;
507
506
  private log;
508
507
  }
@@ -510,6 +509,7 @@ declare class ApiClient {
510
509
  declare class IAPService {
511
510
  private productsCache;
512
511
  private apiClient;
512
+ private purchaseInFlight;
513
513
  constructor(apiClient?: ApiClient);
514
514
  private get debug();
515
515
  private getDeviceCountry;
@@ -593,7 +593,9 @@ declare class IdentityManager {
593
593
  private secureStorage;
594
594
  private debug;
595
595
  private initialized;
596
+ private initPromise;
596
597
  initialize(apiClient: ApiClient, debug?: boolean): Promise<string>;
598
+ private _doInitialize;
597
599
  identify(options?: IdentifyOptions | UserProperties): Promise<void>;
598
600
  getDistinctId(): string;
599
601
  getDeviceId(): string | null;
@@ -694,7 +696,7 @@ declare class SessionManager {
694
696
  isSessionActive(): boolean;
695
697
  getState(): SessionState;
696
698
  destroy(): void;
697
- registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler): void;
699
+ registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler | null): void;
698
700
  private restoreSession;
699
701
  private setupAppStateListener;
700
702
  private handleAppStateChange;
@@ -778,12 +780,12 @@ interface IPaywalloClient {
778
780
  getSessionId(): string | null;
779
781
  startSession(): Promise<string>;
780
782
  endSession(): Promise<void>;
781
- registerPaywallPresenter(presenter: (placement: string) => Promise<PaywallResult>): void;
782
- registerCampaignPresenter(presenter: (campaign: CampaignResponse) => Promise<CampaignResult>): void;
783
- registerSubscriptionGetter(getter: () => Promise<Subscription | null>): void;
784
- registerActiveChecker(checker: () => Promise<boolean>): void;
785
- registerRestoreHandler(handler: () => Promise<RestoreResult>): void;
786
- registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler): void;
783
+ registerPaywallPresenter(presenter: ((placement: string) => Promise<PaywallResult>) | null): void;
784
+ registerCampaignPresenter(presenter: ((campaign: CampaignResponse) => Promise<CampaignResult>) | null): void;
785
+ registerSubscriptionGetter(getter: (() => Promise<Subscription | null>) | null): void;
786
+ registerActiveChecker(checker: (() => Promise<boolean>) | null): void;
787
+ registerRestoreHandler(handler: (() => Promise<RestoreResult>) | null): void;
788
+ registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler | null): void;
787
789
  getEmergencyPaywall(): Promise<EmergencyPaywallResponse>;
788
790
  getSessionFlag(key: string): string | null;
789
791
  isOnline(): boolean;
@@ -1019,6 +1021,8 @@ declare class SubscriptionCache {
1019
1021
  private cleanupLegacyCache;
1020
1022
  get(distinctId: string): Promise<CachedSubscription | null>;
1021
1023
  set(distinctId: string, data: SubscriptionStatusResponse): Promise<void>;
1024
+ private addToIndex;
1025
+ private readIndex;
1022
1026
  invalidate(distinctId: string): Promise<void>;
1023
1027
  invalidateAll(): Promise<void>;
1024
1028
  private isExpired;
package/dist/index.d.ts CHANGED
@@ -448,7 +448,10 @@ declare class HttpClient {
448
448
  private shouldRetry;
449
449
  private isNetworkError;
450
450
  private calculateDelay;
451
+ private calculateDelayForResponse;
451
452
  private sleep;
453
+ /** Strips path segments that look like app keys (alphanumeric, 20–64 chars) from URLs before logging. */
454
+ private redactUrl;
452
455
  private log;
453
456
  setDebug(debug: boolean): void;
454
457
  getConfig(): Readonly<HttpClientConfig>;
@@ -463,14 +466,12 @@ declare class ApiClient {
463
466
  private offlineQueueEnabled;
464
467
  private httpClient;
465
468
  private readonly cache;
466
- private eventBatch;
467
- private batchTimer;
468
- private readonly BATCH_MAX_SIZE;
469
- private readonly BATCH_FLUSH_MS;
469
+ private readonly batcher;
470
470
  constructor(appKey: string, apiUrl: string, debug?: boolean, environment?: Environment, offlineQueueEnabled?: boolean, timeout?: number);
471
471
  getHttpClient(): HttpClient;
472
472
  getBaseUrl(): string;
473
473
  getWebUrl(): string;
474
+ getAppKey(): string;
474
475
  getEnvironment(): Environment;
475
476
  getQueueSize(): number;
476
477
  setofflineQueueEnabled(enabled: boolean): void;
@@ -483,6 +484,7 @@ declare class ApiClient {
483
484
  reportError(errorType: string, message: string, context?: Record<string, unknown>): Promise<void>;
484
485
  trackEvent(eventName: string, distinctId: string, properties?: UserProperties, timestamp?: number): Promise<void>;
485
486
  flushEventBatch(): Promise<void>;
487
+ dispose(): void;
486
488
  identify(distinctId: string, properties?: UserProperties, email?: string, deviceId?: string): Promise<void>;
487
489
  startSession(distinctId: string, sessionId: string, platform?: string, appVersion?: string, deviceModel?: string, osVersion?: string): Promise<{
488
490
  success: boolean;
@@ -500,9 +502,6 @@ declare class ApiClient {
500
502
  evaluateFlags(keys: string[], distinctId: string): Promise<Record<string, string | null>>;
501
503
  getConditionalFlag(flagKey: string, context: ConditionalFlagContext): Promise<ConditionalFlagResult>;
502
504
  getVariantFromCache(flagKey: string, distinctId: string): Promise<FlagVariant | null>;
503
- private static readonly FLAG_MAX_AGE_MS;
504
- private readFlagFromStorage;
505
- private writeFlagToStorage;
506
505
  private postWithQueue;
507
506
  private log;
508
507
  }
@@ -510,6 +509,7 @@ declare class ApiClient {
510
509
  declare class IAPService {
511
510
  private productsCache;
512
511
  private apiClient;
512
+ private purchaseInFlight;
513
513
  constructor(apiClient?: ApiClient);
514
514
  private get debug();
515
515
  private getDeviceCountry;
@@ -593,7 +593,9 @@ declare class IdentityManager {
593
593
  private secureStorage;
594
594
  private debug;
595
595
  private initialized;
596
+ private initPromise;
596
597
  initialize(apiClient: ApiClient, debug?: boolean): Promise<string>;
598
+ private _doInitialize;
597
599
  identify(options?: IdentifyOptions | UserProperties): Promise<void>;
598
600
  getDistinctId(): string;
599
601
  getDeviceId(): string | null;
@@ -694,7 +696,7 @@ declare class SessionManager {
694
696
  isSessionActive(): boolean;
695
697
  getState(): SessionState;
696
698
  destroy(): void;
697
- registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler): void;
699
+ registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler | null): void;
698
700
  private restoreSession;
699
701
  private setupAppStateListener;
700
702
  private handleAppStateChange;
@@ -778,12 +780,12 @@ interface IPaywalloClient {
778
780
  getSessionId(): string | null;
779
781
  startSession(): Promise<string>;
780
782
  endSession(): Promise<void>;
781
- registerPaywallPresenter(presenter: (placement: string) => Promise<PaywallResult>): void;
782
- registerCampaignPresenter(presenter: (campaign: CampaignResponse) => Promise<CampaignResult>): void;
783
- registerSubscriptionGetter(getter: () => Promise<Subscription | null>): void;
784
- registerActiveChecker(checker: () => Promise<boolean>): void;
785
- registerRestoreHandler(handler: () => Promise<RestoreResult>): void;
786
- registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler): void;
783
+ registerPaywallPresenter(presenter: ((placement: string) => Promise<PaywallResult>) | null): void;
784
+ registerCampaignPresenter(presenter: ((campaign: CampaignResponse) => Promise<CampaignResult>) | null): void;
785
+ registerSubscriptionGetter(getter: (() => Promise<Subscription | null>) | null): void;
786
+ registerActiveChecker(checker: (() => Promise<boolean>) | null): void;
787
+ registerRestoreHandler(handler: (() => Promise<RestoreResult>) | null): void;
788
+ registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler | null): void;
787
789
  getEmergencyPaywall(): Promise<EmergencyPaywallResponse>;
788
790
  getSessionFlag(key: string): string | null;
789
791
  isOnline(): boolean;
@@ -1019,6 +1021,8 @@ declare class SubscriptionCache {
1019
1021
  private cleanupLegacyCache;
1020
1022
  get(distinctId: string): Promise<CachedSubscription | null>;
1021
1023
  set(distinctId: string, data: SubscriptionStatusResponse): Promise<void>;
1024
+ private addToIndex;
1025
+ private readIndex;
1022
1026
  invalidate(distinctId: string): Promise<void>;
1023
1027
  invalidateAll(): Promise<void>;
1024
1028
  private isExpired;