@virex-tech/paywallo-sdk 1.1.1 → 1.3.0
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.
- package/android/src/main/java/com/paywallo/sdk/PaywalloWebView.kt +45 -0
- package/android/src/main/java/com/paywallo/sdk/PaywalloWebViewManager.kt +1 -0
- package/dist/index.d.mts +83 -42
- package/dist/index.d.ts +83 -42
- package/dist/index.js +1109 -600
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1277 -759
- package/dist/index.mjs.map +1 -1
- package/ios/PaywalloWebView.h +1 -0
- package/ios/PaywalloWebView.m +20 -0
- package/ios/PaywalloWebViewManager.m +1 -0
- package/ios/PaywalloWebViewModule.h +1 -0
- package/ios/PaywalloWebViewModule.m +8 -1
- package/package.json +1 -1
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
package com.paywallo.sdk
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
|
+
import android.annotation.TargetApi
|
|
5
|
+
import android.os.Build
|
|
4
6
|
import android.webkit.JavascriptInterface
|
|
5
7
|
import android.webkit.WebChromeClient
|
|
8
|
+
import android.webkit.WebResourceError
|
|
9
|
+
import android.webkit.WebResourceRequest
|
|
10
|
+
import android.webkit.WebResourceResponse
|
|
6
11
|
import android.webkit.WebSettings
|
|
7
12
|
import android.webkit.WebView
|
|
8
13
|
import android.webkit.WebViewClient
|
|
9
14
|
import com.facebook.react.bridge.Arguments
|
|
10
15
|
import com.facebook.react.bridge.ReactContext
|
|
11
16
|
import com.facebook.react.uimanager.events.RCTEventEmitter
|
|
17
|
+
import org.json.JSONObject
|
|
12
18
|
|
|
13
19
|
@SuppressLint("SetJavaScriptEnabled", "ViewConstructor")
|
|
14
20
|
class PaywalloWebView(context: ReactContext) : WebView(context) {
|
|
@@ -33,6 +39,45 @@ class PaywalloWebView(context: ReactContext) : WebView(context) {
|
|
|
33
39
|
super.onPageFinished(view, url)
|
|
34
40
|
dispatchEvent("onLoadEnd", null)
|
|
35
41
|
}
|
|
42
|
+
|
|
43
|
+
@TargetApi(Build.VERSION_CODES.M)
|
|
44
|
+
override fun onReceivedError(
|
|
45
|
+
view: WebView?,
|
|
46
|
+
request: WebResourceRequest?,
|
|
47
|
+
error: WebResourceError?
|
|
48
|
+
) {
|
|
49
|
+
super.onReceivedError(view, request, error)
|
|
50
|
+
if (request?.isForMainFrame == true) {
|
|
51
|
+
val payload = JSONObject().apply {
|
|
52
|
+
put("type", "error")
|
|
53
|
+
put("payload", JSONObject().apply {
|
|
54
|
+
put("code", error?.errorCode ?: -1)
|
|
55
|
+
put("description", error?.description?.toString() ?: "Unknown error")
|
|
56
|
+
put("url", request.url?.toString() ?: "")
|
|
57
|
+
})
|
|
58
|
+
}
|
|
59
|
+
dispatchEvent("onError", payload.toString())
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun onReceivedHttpError(
|
|
64
|
+
view: WebView?,
|
|
65
|
+
request: WebResourceRequest?,
|
|
66
|
+
errorResponse: WebResourceResponse?
|
|
67
|
+
) {
|
|
68
|
+
super.onReceivedHttpError(view, request, errorResponse)
|
|
69
|
+
if (request?.isForMainFrame == true) {
|
|
70
|
+
val payload = JSONObject().apply {
|
|
71
|
+
put("type", "error")
|
|
72
|
+
put("payload", JSONObject().apply {
|
|
73
|
+
put("code", errorResponse?.statusCode ?: -1)
|
|
74
|
+
put("description", errorResponse?.reasonPhrase ?: "HTTP error")
|
|
75
|
+
put("url", request.url?.toString() ?: "")
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
dispatchEvent("onError", payload.toString())
|
|
79
|
+
}
|
|
80
|
+
}
|
|
36
81
|
}
|
|
37
82
|
|
|
38
83
|
webChromeClient = WebChromeClient()
|
|
@@ -34,6 +34,7 @@ class PaywalloWebViewManager(private val reactContext: ReactApplicationContext)
|
|
|
34
34
|
return MapBuilder.builder<String, Any>()
|
|
35
35
|
.put("onMessage", MapBuilder.of("registrationName", "onMessage"))
|
|
36
36
|
.put("onLoadEnd", MapBuilder.of("registrationName", "onLoadEnd"))
|
|
37
|
+
.put("onError", MapBuilder.of("registrationName", "onError"))
|
|
37
38
|
.build()
|
|
38
39
|
}
|
|
39
40
|
|
package/dist/index.d.mts
CHANGED
|
@@ -116,6 +116,7 @@ interface ServerProductInfo {
|
|
|
116
116
|
}
|
|
117
117
|
interface CampaignResponse {
|
|
118
118
|
campaignId: string;
|
|
119
|
+
placement?: string;
|
|
119
120
|
variantKey: string;
|
|
120
121
|
paywall: {
|
|
121
122
|
id: string;
|
|
@@ -137,6 +138,7 @@ interface CampaignResult {
|
|
|
137
138
|
campaignId?: string;
|
|
138
139
|
variantKey?: string;
|
|
139
140
|
error?: Error;
|
|
141
|
+
skippedReason?: "subscriber";
|
|
140
142
|
}
|
|
141
143
|
interface CampaignPresentOptions {
|
|
142
144
|
placement: string;
|
|
@@ -182,6 +184,31 @@ interface EmergencyPaywallResponse {
|
|
|
182
184
|
paywall?: PaywallConfig;
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
declare class PaywalloError extends Error {
|
|
188
|
+
readonly code: string;
|
|
189
|
+
readonly domain: string;
|
|
190
|
+
constructor(domain: string, code: string, message: string);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
declare class PurchaseError extends PaywalloError {
|
|
194
|
+
readonly userCancelled: boolean;
|
|
195
|
+
constructor(code: string, message: string, userCancelled?: boolean);
|
|
196
|
+
}
|
|
197
|
+
declare const PURCHASE_ERROR_CODES: {
|
|
198
|
+
readonly NOT_INITIALIZED: "PURCHASE_NOT_INITIALIZED";
|
|
199
|
+
readonly PRODUCT_NOT_FOUND: "PRODUCT_NOT_FOUND";
|
|
200
|
+
readonly PURCHASE_FAILED: "PURCHASE_FAILED";
|
|
201
|
+
readonly RESTORE_FAILED: "RESTORE_FAILED";
|
|
202
|
+
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
203
|
+
readonly USER_CANCELLED: "USER_CANCELLED";
|
|
204
|
+
readonly NETWORK_ERROR: "PURCHASE_NETWORK_ERROR";
|
|
205
|
+
readonly STORE_ERROR: "PURCHASE_STORE_ERROR";
|
|
206
|
+
readonly PENDING_PURCHASE: "PURCHASE_PENDING";
|
|
207
|
+
readonly DEFERRED_PURCHASE: "PURCHASE_DEFERRED";
|
|
208
|
+
readonly STORE_NOT_AVAILABLE: "PURCHASE_STORE_NOT_AVAILABLE";
|
|
209
|
+
};
|
|
210
|
+
declare function createPurchaseError(code: keyof typeof PURCHASE_ERROR_CODES, message?: string): PurchaseError;
|
|
211
|
+
|
|
185
212
|
interface Product {
|
|
186
213
|
productId: string;
|
|
187
214
|
title: string;
|
|
@@ -195,6 +222,7 @@ interface Product {
|
|
|
195
222
|
introductoryPrice?: string;
|
|
196
223
|
introductoryPriceValue?: number;
|
|
197
224
|
freeTrialPeriod?: string;
|
|
225
|
+
trialDays?: number;
|
|
198
226
|
pricePerMonth?: string;
|
|
199
227
|
pricePerWeek?: string;
|
|
200
228
|
pricePerDay?: string;
|
|
@@ -211,7 +239,7 @@ interface Purchase {
|
|
|
211
239
|
interface PurchaseResult {
|
|
212
240
|
success: boolean;
|
|
213
241
|
purchase?: Purchase;
|
|
214
|
-
error?:
|
|
242
|
+
error?: PurchaseError;
|
|
215
243
|
}
|
|
216
244
|
interface ValidatePurchaseResponse {
|
|
217
245
|
success: boolean;
|
|
@@ -251,10 +279,16 @@ interface ApiClientConfig {
|
|
|
251
279
|
offlineQueueEnabled?: boolean;
|
|
252
280
|
timeout?: number;
|
|
253
281
|
}
|
|
282
|
+
interface PaywallErrorStrings$1 {
|
|
283
|
+
title?: string;
|
|
284
|
+
retry?: string;
|
|
285
|
+
close?: string;
|
|
286
|
+
}
|
|
254
287
|
interface PaywalloConfig {
|
|
255
288
|
appKey: string;
|
|
256
289
|
debug?: boolean;
|
|
257
290
|
environment?: Environment;
|
|
291
|
+
errorStrings?: PaywallErrorStrings$1;
|
|
258
292
|
}
|
|
259
293
|
interface UserProperties {
|
|
260
294
|
[key: string]: string | number | boolean | null;
|
|
@@ -366,6 +400,7 @@ interface PreloadResult {
|
|
|
366
400
|
interface PaywalloContextValue {
|
|
367
401
|
config: PaywalloConfig | null;
|
|
368
402
|
isInitialized: boolean;
|
|
403
|
+
isReady: boolean;
|
|
369
404
|
initError: Error | null;
|
|
370
405
|
distinctId: string | null;
|
|
371
406
|
subscription: Subscription | null;
|
|
@@ -385,12 +420,6 @@ interface PaywalloContextValue {
|
|
|
385
420
|
}
|
|
386
421
|
declare const PaywalloContext: React.Context<PaywalloContextValue | null>;
|
|
387
422
|
|
|
388
|
-
declare class PaywalloError extends Error {
|
|
389
|
-
readonly code: string;
|
|
390
|
-
readonly domain: string;
|
|
391
|
-
constructor(domain: string, code: string, message: string);
|
|
392
|
-
}
|
|
393
|
-
|
|
394
423
|
declare class PaywallError extends PaywalloError {
|
|
395
424
|
constructor(code: string, message: string);
|
|
396
425
|
}
|
|
@@ -458,8 +487,8 @@ declare class ApiClient {
|
|
|
458
487
|
private httpClient;
|
|
459
488
|
private readonly cache;
|
|
460
489
|
constructor(appKey: string, debug?: boolean, environment?: Environment, offlineQueueEnabled?: boolean, timeout?: number);
|
|
461
|
-
/** Exposed only for QueueProcessor initialization. Prefer get()/post() for requests. */
|
|
462
490
|
getHttpClient(): HttpClient;
|
|
491
|
+
getBaseUrl(): string;
|
|
463
492
|
getWebUrl(): string;
|
|
464
493
|
getEnvironment(): Environment;
|
|
465
494
|
getQueueSize(): number;
|
|
@@ -472,7 +501,7 @@ declare class ApiClient {
|
|
|
472
501
|
post<T>(path: string, body: unknown, skipRetry?: boolean): Promise<HttpResponse<T>>;
|
|
473
502
|
reportError(errorType: string, message: string, context?: Record<string, unknown>): Promise<void>;
|
|
474
503
|
trackEvent(eventName: string, distinctId: string, properties?: UserProperties, timestamp?: number): Promise<void>;
|
|
475
|
-
identify(distinctId: string, properties?: UserProperties, email?: string): Promise<void>;
|
|
504
|
+
identify(distinctId: string, properties?: UserProperties, email?: string, deviceId?: string): Promise<void>;
|
|
476
505
|
startSession(distinctId: string, sessionId: string, platform?: string): Promise<{
|
|
477
506
|
success: boolean;
|
|
478
507
|
}>;
|
|
@@ -483,13 +512,15 @@ declare class ApiClient {
|
|
|
483
512
|
getPaywall(placement: string): Promise<PaywallConfig | null>;
|
|
484
513
|
getEmergencyPaywall(): Promise<EmergencyPaywallResponse>;
|
|
485
514
|
getCampaign(placement: string, distinctId: string, context?: Record<string, unknown>): Promise<CampaignResponse | null>;
|
|
515
|
+
getPrimaryCampaign(distinctId: string): Promise<CampaignResponse | null>;
|
|
486
516
|
validatePurchase(platform: "ios" | "android", receipt: string, productId: string, transactionId: string, priceLocal: number, currency: string, country: string, distinctId?: string, paywallPlacement?: string, variantKey?: string): Promise<ValidatePurchaseResponse>;
|
|
487
517
|
getSubscriptionStatus(distinctId: string): Promise<SubscriptionStatusResponse$1>;
|
|
518
|
+
evaluateFlags(keys: string[], distinctId: string): Promise<Record<string, string | null>>;
|
|
488
519
|
getConditionalFlag(flagKey: string, context: ConditionalFlagContext): Promise<ConditionalFlagResult>;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
520
|
+
getVariantFromCache(flagKey: string, distinctId: string): Promise<FlagVariant | null>;
|
|
521
|
+
private static readonly FLAG_MAX_AGE_MS;
|
|
522
|
+
private readFlagFromStorage;
|
|
523
|
+
private writeFlagToStorage;
|
|
493
524
|
private postWithQueue;
|
|
494
525
|
private log;
|
|
495
526
|
}
|
|
@@ -583,11 +614,13 @@ declare class IAPService {
|
|
|
583
614
|
loadProducts(productIds: string[]): Promise<Product[]>;
|
|
584
615
|
getProduct(productId: string): Product | undefined;
|
|
585
616
|
getCachedProducts(): Map<string, Product>;
|
|
617
|
+
private validateWithRetry;
|
|
586
618
|
private validateWithServer;
|
|
587
619
|
private finishTransaction;
|
|
588
620
|
purchase(productId: string, options?: {
|
|
589
621
|
paywallPlacement?: string;
|
|
590
622
|
variantKey?: string;
|
|
623
|
+
onValidating?: () => void;
|
|
591
624
|
}): Promise<PurchaseResult>;
|
|
592
625
|
restore(): Promise<Purchase[]>;
|
|
593
626
|
}
|
|
@@ -602,7 +635,7 @@ declare const nativeStoreKit: {
|
|
|
602
635
|
getActiveTransactions(): Promise<Purchase[]>;
|
|
603
636
|
};
|
|
604
637
|
|
|
605
|
-
type PurchaseState = "idle" | "loading" | "purchasing" | "restoring" | "error";
|
|
638
|
+
type PurchaseState = "idle" | "loading" | "purchasing" | "validating" | "restoring" | "error";
|
|
606
639
|
interface IAPProduct {
|
|
607
640
|
productId: string;
|
|
608
641
|
price: string;
|
|
@@ -619,6 +652,7 @@ interface IAPProduct {
|
|
|
619
652
|
introductoryPriceNumberOfPeriodsIOS?: string;
|
|
620
653
|
introductoryPriceSubscriptionPeriodIOS?: string;
|
|
621
654
|
freeTrialPeriodAndroid?: string;
|
|
655
|
+
trialDays: number;
|
|
622
656
|
}
|
|
623
657
|
interface IAPPurchase {
|
|
624
658
|
productId: string;
|
|
@@ -642,25 +676,6 @@ interface ProductPriceInfo {
|
|
|
642
676
|
pricePerDay?: string;
|
|
643
677
|
}
|
|
644
678
|
|
|
645
|
-
declare class PurchaseError extends PaywalloError {
|
|
646
|
-
readonly userCancelled: boolean;
|
|
647
|
-
constructor(code: string, message: string, userCancelled?: boolean);
|
|
648
|
-
}
|
|
649
|
-
declare const PURCHASE_ERROR_CODES: {
|
|
650
|
-
readonly NOT_INITIALIZED: "PURCHASE_NOT_INITIALIZED";
|
|
651
|
-
readonly PRODUCT_NOT_FOUND: "PRODUCT_NOT_FOUND";
|
|
652
|
-
readonly PURCHASE_FAILED: "PURCHASE_FAILED";
|
|
653
|
-
readonly RESTORE_FAILED: "RESTORE_FAILED";
|
|
654
|
-
readonly VALIDATION_FAILED: "VALIDATION_FAILED";
|
|
655
|
-
readonly USER_CANCELLED: "USER_CANCELLED";
|
|
656
|
-
readonly NETWORK_ERROR: "PURCHASE_NETWORK_ERROR";
|
|
657
|
-
readonly STORE_ERROR: "PURCHASE_STORE_ERROR";
|
|
658
|
-
readonly PENDING_PURCHASE: "PURCHASE_PENDING";
|
|
659
|
-
readonly DEFERRED_PURCHASE: "PURCHASE_DEFERRED";
|
|
660
|
-
readonly STORE_NOT_AVAILABLE: "PURCHASE_STORE_NOT_AVAILABLE";
|
|
661
|
-
};
|
|
662
|
-
declare function createPurchaseError(code: keyof typeof PURCHASE_ERROR_CODES, message?: string): PurchaseError;
|
|
663
|
-
|
|
664
679
|
interface IdentityState {
|
|
665
680
|
deviceId: string;
|
|
666
681
|
email: string | null;
|
|
@@ -668,6 +683,7 @@ interface IdentityState {
|
|
|
668
683
|
}
|
|
669
684
|
declare class IdentityManager {
|
|
670
685
|
private deviceId;
|
|
686
|
+
private anonId;
|
|
671
687
|
private email;
|
|
672
688
|
private properties;
|
|
673
689
|
private apiClient;
|
|
@@ -686,7 +702,6 @@ declare class IdentityManager {
|
|
|
686
702
|
isSecureStorageAvailable(): boolean;
|
|
687
703
|
private loadPersistedState;
|
|
688
704
|
private ensureInitialized;
|
|
689
|
-
private log;
|
|
690
705
|
}
|
|
691
706
|
declare const identityManager: IdentityManager;
|
|
692
707
|
|
|
@@ -801,19 +816,31 @@ interface PreloadCampaignResult {
|
|
|
801
816
|
success: boolean;
|
|
802
817
|
error?: Error;
|
|
803
818
|
}
|
|
819
|
+
interface PaywallErrorStrings {
|
|
820
|
+
title?: string;
|
|
821
|
+
retry?: string;
|
|
822
|
+
close?: string;
|
|
823
|
+
}
|
|
804
824
|
interface PaywalloInitConfig extends PaywalloConfig {
|
|
805
825
|
sessionConfig?: SessionConfig;
|
|
806
826
|
autoStartSession?: boolean;
|
|
807
827
|
offlineQueueEnabled?: boolean;
|
|
808
828
|
timeout?: number;
|
|
809
|
-
/** Request ATT permission during init (iOS only). Default: false. */
|
|
810
829
|
requestATT?: boolean;
|
|
830
|
+
errorStrings?: PaywallErrorStrings;
|
|
831
|
+
sessionFlags?: string[];
|
|
832
|
+
subscriptionCacheTTL?: number;
|
|
833
|
+
autoPreloadCampaign?: string;
|
|
811
834
|
}
|
|
812
835
|
interface IPaywalloClient {
|
|
813
836
|
init(config: PaywalloInitConfig): Promise<void>;
|
|
837
|
+
isReady(): boolean;
|
|
838
|
+
waitUntilReady(): Promise<void>;
|
|
814
839
|
identify(options?: IdentifyOptions | UserProperties): Promise<void>;
|
|
815
840
|
track(eventName: string, options?: TrackEventOptions): Promise<void>;
|
|
841
|
+
getVariantCached(flagKey: string, defaultValue?: string): Promise<FlagVariant>;
|
|
816
842
|
getVariant(flagKey: string): Promise<FlagVariant>;
|
|
843
|
+
evaluateFlags(keys: string[]): Promise<Record<string, string | null>>;
|
|
817
844
|
getConditionalFlag(flagKey: string, context?: Partial<ConditionalFlagContext>): Promise<boolean>;
|
|
818
845
|
getPaywall(placement: string): Promise<PaywallConfig | null>;
|
|
819
846
|
presentPaywall(placement: string): Promise<PaywallResult>;
|
|
@@ -849,6 +876,7 @@ interface IPaywalloClient {
|
|
|
849
876
|
registerActiveChecker(checker: () => Promise<boolean>): void;
|
|
850
877
|
registerRestoreHandler(handler: () => Promise<RestoreResult>): void;
|
|
851
878
|
registerEmergencyPaywallHandler(handler: EmergencyPaywallHandler): void;
|
|
879
|
+
getSessionFlag(key: string): string | null;
|
|
852
880
|
isOnline(): boolean;
|
|
853
881
|
getOfflineQueueSize(): number;
|
|
854
882
|
clearOfflineQueue(): Promise<void>;
|
|
@@ -858,6 +886,9 @@ interface IPaywalloClient {
|
|
|
858
886
|
}>;
|
|
859
887
|
onboardingStep(index: number, name: string): Promise<void>;
|
|
860
888
|
coreAction(actionName: string): Promise<void>;
|
|
889
|
+
isPreloaded(placement: string): boolean;
|
|
890
|
+
getAutoPreloadedPlacement(): string | null;
|
|
891
|
+
waitForAutoPreloadedPlacement(): Promise<string | null>;
|
|
861
892
|
}
|
|
862
893
|
|
|
863
894
|
declare const PaywalloClient: IPaywalloClient;
|
|
@@ -900,7 +931,7 @@ declare class OfflineQueueClass {
|
|
|
900
931
|
private loadFromStorage;
|
|
901
932
|
private saveToStorage;
|
|
902
933
|
private cleanupExpired;
|
|
903
|
-
enqueue(method: "POST" | "PUT", url: string, body: unknown, headers?: Record<string, string
|
|
934
|
+
enqueue(method: "POST" | "PUT", url: string, body: unknown, headers?: Record<string, string>, id?: string): Promise<QueueItem>;
|
|
904
935
|
private findDuplicateIndex;
|
|
905
936
|
dequeue(): Promise<QueueItem | null>;
|
|
906
937
|
removeItem(id: string): Promise<boolean>;
|
|
@@ -913,7 +944,6 @@ declare class OfflineQueueClass {
|
|
|
913
944
|
processed: number;
|
|
914
945
|
failed: number;
|
|
915
946
|
}>;
|
|
916
|
-
/** Returns true if the item was permanently removed (counted as failed). */
|
|
917
947
|
private handleItemFailure;
|
|
918
948
|
private sleep;
|
|
919
949
|
getQueue(): ReadonlyArray<QueueItem>;
|
|
@@ -990,6 +1020,7 @@ interface FormattedProduct extends ProductPriceInfo {
|
|
|
990
1020
|
subscriptionPeriod?: string;
|
|
991
1021
|
introductoryPrice?: string;
|
|
992
1022
|
freeTrialPeriod?: string;
|
|
1023
|
+
trialDays: number;
|
|
993
1024
|
}
|
|
994
1025
|
|
|
995
1026
|
interface UseProductsResult {
|
|
@@ -1004,13 +1035,19 @@ interface UseProductsResult {
|
|
|
1004
1035
|
}
|
|
1005
1036
|
declare function useProducts(initialProductIds?: string[]): UseProductsResult;
|
|
1006
1037
|
|
|
1038
|
+
interface PurchaseOutcome {
|
|
1039
|
+
status: "success" | "cancelled" | "failed";
|
|
1040
|
+
purchase?: IAPPurchase;
|
|
1041
|
+
error?: PurchaseError;
|
|
1042
|
+
}
|
|
1007
1043
|
interface UsePurchaseResult {
|
|
1008
1044
|
state: PurchaseState;
|
|
1009
|
-
purchase: (productId: string) => Promise<
|
|
1045
|
+
purchase: (productId: string) => Promise<PurchaseOutcome>;
|
|
1010
1046
|
restore: () => Promise<IAPPurchase[]>;
|
|
1011
1047
|
error: PurchaseError | null;
|
|
1012
1048
|
isLoading: boolean;
|
|
1013
1049
|
isPurchasing: boolean;
|
|
1050
|
+
isValidating: boolean;
|
|
1014
1051
|
isRestoring: boolean;
|
|
1015
1052
|
}
|
|
1016
1053
|
declare function usePurchase(): UsePurchaseResult;
|
|
@@ -1069,10 +1106,13 @@ declare class SubscriptionCache {
|
|
|
1069
1106
|
private ttl;
|
|
1070
1107
|
private memoryCache;
|
|
1071
1108
|
private storage;
|
|
1109
|
+
private legacyCleanupDone;
|
|
1072
1110
|
constructor(ttl?: number);
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1111
|
+
private cleanupLegacyCache;
|
|
1112
|
+
get(distinctId: string): Promise<CachedSubscription | null>;
|
|
1113
|
+
set(distinctId: string, data: SubscriptionStatusResponse): Promise<void>;
|
|
1114
|
+
invalidate(distinctId: string): Promise<void>;
|
|
1115
|
+
invalidateAll(): Promise<void>;
|
|
1076
1116
|
private isExpired;
|
|
1077
1117
|
setTTL(ttl: number): void;
|
|
1078
1118
|
}
|
|
@@ -1084,6 +1124,7 @@ declare class SubscriptionManagerClass {
|
|
|
1084
1124
|
private listeners;
|
|
1085
1125
|
private userId;
|
|
1086
1126
|
constructor();
|
|
1127
|
+
private cacheKey;
|
|
1087
1128
|
init(config: SubscriptionManagerConfig): void;
|
|
1088
1129
|
setUserId(userId: string | null): void;
|
|
1089
1130
|
hasActiveSubscription(forceRefresh?: boolean): Promise<boolean>;
|
|
@@ -1136,4 +1177,4 @@ declare function hasVariables(text: string): boolean;
|
|
|
1136
1177
|
|
|
1137
1178
|
declare const Paywallo: IPaywalloClient;
|
|
1138
1179
|
|
|
1139
|
-
export { AFFILIATE_ERROR_CODES, ANALYTICS_ERROR_CODES, type AffiliateBalance, type AffiliateCommission, type AffiliateCoupon, AffiliateError, AffiliateManager, AnalyticsError, ApiClient, type ApiClientConfig, type BlockType, type BoxSpacing, CAMPAIGN_ERROR_CODES, type CachedSubscription, CampaignError, type CampaignPresentOptions, type CampaignResponse, type CampaignResult, type ConditionalFlagContext, type ConditionalFlagResult, PURCHASE_ERROR_CODES as ERROR_CODES, type Environment, type FlagVariant, HttpClient, type HttpClientConfig, type HttpResponse, type IAPProduct, type IAPPurchase, IAPService, IDENTITY_ERROR_CODES, type IPaywalloClient, type IdentifyOptions, IdentityError, IdentityManager, type IdentityState, type LocalizedText, type NetworkListener, type NetworkMonitorConfig, type NetworkState, type OfflineQueueConfig, PAYWALL_ERROR_CODES, PURCHASE_ERROR_CODES, type PaywallBlockConfig, type PaywallConfig, PaywallContext, PaywallError, PaywallModal, type PaywallNode, type PaywallPresentOptions, type PaywallResult, type PaywallState, Paywallo, PaywalloAffiliate, PaywalloClient, type PaywalloConfig, PaywalloContext, PaywalloError, type PaywalloInitConfig, PaywalloProvider, type PreloadCampaignResult, type PreloadResult, type Product, type ProductPriceInfo, type Purchase, type PurchaseControllerConfig, PurchaseError, type PurchaseResult, type PurchaseState, type QueueEvent, type QueueItem, type QueueListener, type QueueProcessorConfig, type RequestOptions, type RestoreResult, type RetryConfig, SESSION_ERROR_CODES, type SessionConfig, SessionError, SessionManager, type SessionState, type Subscription, SubscriptionCache, type SubscriptionInfo, type SubscriptionManagerConfig, type SubscriptionPlatform, type SubscriptionStatus$1 as SubscriptionStatus, type SubscriptionStatusResponse$1 as SubscriptionStatusResponse, type TapBehavior, type TrackEventOptions, type UserProperties, type ValidatePurchaseResponse, type VariableContext, type WithdrawalRequest, affiliateManager, createPurchaseError, Paywallo as default, detectDeviceLanguage, getCurrentLanguage, getDefaultLanguage, getIAPService, getLocalizedString, hasVariables, identityManager, initLocalization, nativeStoreKit, networkMonitor, offlineQueue, parseVariables, queueProcessor, resolveText, sessionManager, setCurrentLanguage, setDefaultLanguage, subscriptionManager, usePaywallContext, usePaywallo, useProducts, usePurchase, useSubscription };
|
|
1180
|
+
export { AFFILIATE_ERROR_CODES, ANALYTICS_ERROR_CODES, type AffiliateBalance, type AffiliateCommission, type AffiliateCoupon, AffiliateError, AffiliateManager, AnalyticsError, ApiClient, type ApiClientConfig, type BlockType, type BoxSpacing, CAMPAIGN_ERROR_CODES, type CachedSubscription, CampaignError, type CampaignPresentOptions, type CampaignResponse, type CampaignResult, type ConditionalFlagContext, type ConditionalFlagResult, PURCHASE_ERROR_CODES as ERROR_CODES, type Environment, type FlagVariant, HttpClient, type HttpClientConfig, type HttpResponse, type IAPProduct, type IAPPurchase, IAPService, IDENTITY_ERROR_CODES, type IPaywalloClient, type IdentifyOptions, IdentityError, IdentityManager, type IdentityState, type LocalizedText, type NetworkListener, type NetworkMonitorConfig, type NetworkState, type OfflineQueueConfig, PAYWALL_ERROR_CODES, PURCHASE_ERROR_CODES, type PaywallBlockConfig, type PaywallConfig, PaywallContext, PaywallError, type PaywallErrorStrings$1 as PaywallErrorStrings, PaywallModal, type PaywallNode, type PaywallPresentOptions, type PaywallResult, type PaywallState, Paywallo, PaywalloAffiliate, PaywalloClient, type PaywalloConfig, PaywalloContext, PaywalloError, type PaywalloInitConfig, PaywalloProvider, type PaywalloProviderProps, type PreloadCampaignResult, type PreloadResult, type Product, type ProductPriceInfo, type Purchase, type PurchaseControllerConfig, PurchaseError, type PurchaseResult, type PurchaseState, type QueueEvent, type QueueItem, type QueueListener, type QueueProcessorConfig, type RequestOptions, type RestoreResult, type RetryConfig, SESSION_ERROR_CODES, type SessionConfig, SessionError, SessionManager, type SessionState, type Subscription, SubscriptionCache, type SubscriptionInfo, type SubscriptionManagerConfig, type SubscriptionPlatform, type SubscriptionStatus$1 as SubscriptionStatus, type SubscriptionStatusResponse$1 as SubscriptionStatusResponse, type TapBehavior, type TrackEventOptions, type UserProperties, type ValidatePurchaseResponse, type VariableContext, type WithdrawalRequest, affiliateManager, createPurchaseError, Paywallo as default, detectDeviceLanguage, getCurrentLanguage, getDefaultLanguage, getIAPService, getLocalizedString, hasVariables, identityManager, initLocalization, nativeStoreKit, networkMonitor, offlineQueue, parseVariables, queueProcessor, resolveText, sessionManager, setCurrentLanguage, setDefaultLanguage, subscriptionManager, usePaywallContext, usePaywallo, useProducts, usePurchase, useSubscription };
|