@virex-tech/paywallo-sdk 1.3.0 → 1.4.1
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/PaywalloSdk.podspec +1 -0
- package/README.md +28 -53
- package/android/build.gradle +1 -0
- package/android/src/main/java/com/paywallo/sdk/PaywalloFBBridgeModule.kt +84 -0
- package/android/src/main/java/com/paywallo/sdk/PaywalloSdkPackage.kt +4 -1
- package/dist/index.d.mts +13 -10
- package/dist/index.d.ts +13 -10
- package/dist/index.js +325 -176
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -161
- package/dist/index.mjs.map +1 -1
- package/ios/PaywalloFBBridge.m +23 -0
- package/ios/PaywalloFBBridge.swift +77 -0
- package/ios/PaywalloStoreKit.swift +17 -5
- package/ios/RCTBridgeTypes.swift +6 -0
- package/package.json +6 -20
package/PaywalloSdk.podspec
CHANGED
package/README.md
CHANGED
|
@@ -1,43 +1,35 @@
|
|
|
1
1
|
# @virex-tech/paywallo-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Paywalls, subscriptions, analytics and feature flags for React Native.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @virex-tech/paywallo-sdk
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
O SDK requer as seguintes dependências instaladas no seu projeto:
|
|
11
|
+
Peer dependencies:
|
|
14
12
|
|
|
15
13
|
```bash
|
|
16
14
|
npm install @react-native-async-storage/async-storage @react-native-community/netinfo react-native-iap react-native-device-info
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Para melhor persistência do device ID entre reinstalações do app (especialmente no iOS), instale também:
|
|
17
|
+
Optional but recommended — persists device ID across reinstalls via Keychain (iOS) and Keystore (Android):
|
|
22
18
|
|
|
23
19
|
```bash
|
|
24
20
|
npm install react-native-keychain
|
|
25
21
|
```
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
- **iOS**: Device ID persiste no Keychain mesmo após desinstalar o app
|
|
29
|
-
- **Android**: Device ID é armazenado de forma segura no Keystore
|
|
30
|
-
|
|
31
|
-
Sem ela, o SDK usa AsyncStorage como fallback (funciona, mas não persiste após desinstalação).
|
|
23
|
+
Without it, the SDK falls back to AsyncStorage (works, but device ID resets on reinstall).
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
iOS only:
|
|
34
26
|
```bash
|
|
35
27
|
cd ios && pod install
|
|
36
28
|
```
|
|
37
29
|
|
|
38
|
-
## Quick
|
|
30
|
+
## Quick start
|
|
39
31
|
|
|
40
|
-
### 1.
|
|
32
|
+
### 1. Wrap your app
|
|
41
33
|
|
|
42
34
|
```tsx
|
|
43
35
|
import { PaywalloProvider } from '@virex-tech/paywallo-sdk';
|
|
@@ -46,7 +38,7 @@ export default function App() {
|
|
|
46
38
|
return (
|
|
47
39
|
<PaywalloProvider
|
|
48
40
|
config={{
|
|
49
|
-
appKey: '
|
|
41
|
+
appKey: 'your_app_key',
|
|
50
42
|
debug: __DEV__,
|
|
51
43
|
}}
|
|
52
44
|
>
|
|
@@ -56,7 +48,7 @@ export default function App() {
|
|
|
56
48
|
}
|
|
57
49
|
```
|
|
58
50
|
|
|
59
|
-
### 2.
|
|
51
|
+
### 2. Show a paywall
|
|
60
52
|
|
|
61
53
|
```tsx
|
|
62
54
|
import { usePaywallo, useSubscription } from '@virex-tech/paywallo-sdk';
|
|
@@ -80,55 +72,42 @@ function MyComponent() {
|
|
|
80
72
|
}
|
|
81
73
|
```
|
|
82
74
|
|
|
83
|
-
##
|
|
84
|
-
|
|
85
|
-
### PaywalloProvider
|
|
86
|
-
|
|
87
|
-
Provider que inicializa o SDK e disponibiliza o contexto para toda a aplicação.
|
|
88
|
-
|
|
89
|
-
```tsx
|
|
90
|
-
<PaywalloProvider config={PaywalloConfig}>
|
|
91
|
-
{children}
|
|
92
|
-
</PaywalloProvider>
|
|
93
|
-
```
|
|
75
|
+
## Hooks
|
|
94
76
|
|
|
95
77
|
### usePaywallo()
|
|
96
78
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
79
|
+
| Property | Type | Description |
|
|
80
|
+
|---|---|---|
|
|
81
|
+
| `isInitialized` | `boolean` | SDK ready |
|
|
82
|
+
| `distinctId` | `string` | Current user ID |
|
|
83
|
+
| `presentPaywall(placement)` | `Promise<PaywallResult>` | Show a paywall |
|
|
84
|
+
| `hasActiveSubscription()` | `Promise<boolean>` | Check subscription status |
|
|
85
|
+
| `getSubscription()` | `Promise<Subscription>` | Get subscription data |
|
|
86
|
+
| `restorePurchases()` | `Promise<void>` | Restore previous purchases |
|
|
105
87
|
|
|
106
88
|
### useSubscription()
|
|
107
89
|
|
|
108
|
-
|
|
90
|
+
| Property | Type | Description |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `subscription` | `Subscription \| null` | Current subscription |
|
|
93
|
+
| `isLoading` | `boolean` | Loading state |
|
|
94
|
+
| `refresh()` | `() => void` | Refetch subscription data |
|
|
109
95
|
|
|
110
|
-
|
|
111
|
-
- `isLoading` - Estado de carregamento
|
|
112
|
-
- `refresh()` - Atualiza dados da assinatura
|
|
96
|
+
## Imperative API
|
|
113
97
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Para uso fora de componentes React:
|
|
98
|
+
For use outside React components:
|
|
117
99
|
|
|
118
100
|
```tsx
|
|
119
101
|
import { PaywalloClient } from '@virex-tech/paywallo-sdk';
|
|
120
102
|
|
|
121
|
-
// Identificar usuário
|
|
122
103
|
await PaywalloClient.identify('user_123', { email: 'user@example.com' });
|
|
123
104
|
|
|
124
|
-
// Rastrear evento
|
|
125
105
|
await PaywalloClient.track('purchase_completed', { product: 'premium' });
|
|
126
106
|
|
|
127
|
-
// Feature Flags
|
|
128
107
|
const variant = await PaywalloClient.getVariant('new_feature');
|
|
129
108
|
```
|
|
130
109
|
|
|
131
|
-
##
|
|
110
|
+
## Types
|
|
132
111
|
|
|
133
112
|
```tsx
|
|
134
113
|
interface PaywalloConfig {
|
|
@@ -155,10 +134,6 @@ interface PaywallResult {
|
|
|
155
134
|
}
|
|
156
135
|
```
|
|
157
136
|
|
|
158
|
-
##
|
|
159
|
-
|
|
160
|
-
Para dúvidas ou problemas, entre em contato com o suporte Paywallo.
|
|
161
|
-
|
|
162
|
-
## Licença
|
|
137
|
+
## License
|
|
163
138
|
|
|
164
139
|
MIT
|
package/android/build.gradle
CHANGED
|
@@ -51,4 +51,5 @@ dependencies {
|
|
|
51
51
|
implementation "com.android.billingclient:billing-ktx:7.0.0"
|
|
52
52
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
|
|
53
53
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
|
|
54
|
+
implementation "com.facebook.android:facebook-android-sdk:17.+"
|
|
54
55
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
package com.paywallo.sdk
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.*
|
|
4
|
+
import com.facebook.appevents.AppEventsLogger
|
|
5
|
+
import java.math.BigDecimal
|
|
6
|
+
import java.util.Currency
|
|
7
|
+
import android.os.Bundle
|
|
8
|
+
|
|
9
|
+
class PaywalloFBBridgeModule(private val reactContext: ReactApplicationContext) :
|
|
10
|
+
ReactContextBaseJavaModule(reactContext) {
|
|
11
|
+
|
|
12
|
+
override fun getName() = "PaywalloFBBridge"
|
|
13
|
+
|
|
14
|
+
@ReactMethod
|
|
15
|
+
fun getAnonymousID(promise: Promise) {
|
|
16
|
+
try {
|
|
17
|
+
val anonId = AppEventsLogger.getAnonymousAppDeviceGUID(reactApplicationContext)
|
|
18
|
+
if (anonId.isNullOrEmpty()) {
|
|
19
|
+
promise.resolve(null)
|
|
20
|
+
} else {
|
|
21
|
+
promise.resolve(anonId)
|
|
22
|
+
}
|
|
23
|
+
} catch (e: Exception) {
|
|
24
|
+
promise.resolve(null)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@ReactMethod
|
|
29
|
+
fun logEvent(name: String, params: ReadableMap, promise: Promise) {
|
|
30
|
+
try {
|
|
31
|
+
val bundle = toBundle(params)
|
|
32
|
+
val logger = AppEventsLogger.newLogger(reactApplicationContext)
|
|
33
|
+
logger.logEvent(name, bundle)
|
|
34
|
+
promise.resolve(null)
|
|
35
|
+
} catch (e: Exception) {
|
|
36
|
+
promise.resolve(null)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@ReactMethod
|
|
41
|
+
fun logPurchase(amount: Double, currency: String, params: ReadableMap, promise: Promise) {
|
|
42
|
+
try {
|
|
43
|
+
val bundle = toBundle(params)
|
|
44
|
+
val logger = AppEventsLogger.newLogger(reactApplicationContext)
|
|
45
|
+
logger.logPurchase(BigDecimal.valueOf(amount), Currency.getInstance(currency), bundle)
|
|
46
|
+
promise.resolve(null)
|
|
47
|
+
} catch (e: Exception) {
|
|
48
|
+
promise.resolve(null)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@ReactMethod
|
|
53
|
+
fun setUserID(userId: String) {
|
|
54
|
+
try {
|
|
55
|
+
AppEventsLogger.setUserID(userId)
|
|
56
|
+
} catch (e: Exception) {
|
|
57
|
+
// never crash
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@ReactMethod
|
|
62
|
+
fun flush() {
|
|
63
|
+
try {
|
|
64
|
+
AppEventsLogger.newLogger(reactApplicationContext).flush()
|
|
65
|
+
} catch (e: Exception) {
|
|
66
|
+
// never crash
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private fun toBundle(map: ReadableMap): Bundle {
|
|
71
|
+
val bundle = Bundle()
|
|
72
|
+
val iterator = map.keySetIterator()
|
|
73
|
+
while (iterator.hasNextKey()) {
|
|
74
|
+
val key = iterator.nextKey()
|
|
75
|
+
when (map.getType(key)) {
|
|
76
|
+
ReadableType.String -> bundle.putString(key, map.getString(key))
|
|
77
|
+
ReadableType.Number -> bundle.putDouble(key, map.getDouble(key))
|
|
78
|
+
ReadableType.Boolean -> bundle.putBoolean(key, map.getBoolean(key))
|
|
79
|
+
else -> {}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return bundle
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -7,7 +7,10 @@ import com.facebook.react.uimanager.ViewManager
|
|
|
7
7
|
|
|
8
8
|
class PaywalloSdkPackage : ReactPackage {
|
|
9
9
|
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
10
|
-
return listOf(
|
|
10
|
+
return listOf(
|
|
11
|
+
PaywalloStoreKitModule(reactContext),
|
|
12
|
+
PaywalloFBBridgeModule(reactContext)
|
|
13
|
+
)
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
package/dist/index.d.mts
CHANGED
|
@@ -286,6 +286,7 @@ interface PaywallErrorStrings$1 {
|
|
|
286
286
|
}
|
|
287
287
|
interface PaywalloConfig {
|
|
288
288
|
appKey: string;
|
|
289
|
+
apiUrl?: string;
|
|
289
290
|
debug?: boolean;
|
|
290
291
|
environment?: Environment;
|
|
291
292
|
errorStrings?: PaywallErrorStrings$1;
|
|
@@ -486,7 +487,7 @@ declare class ApiClient {
|
|
|
486
487
|
private offlineQueueEnabled;
|
|
487
488
|
private httpClient;
|
|
488
489
|
private readonly cache;
|
|
489
|
-
constructor(appKey: string, debug?: boolean, environment?: Environment, offlineQueueEnabled?: boolean, timeout?: number);
|
|
490
|
+
constructor(appKey: string, apiUrl: string, debug?: boolean, environment?: Environment, offlineQueueEnabled?: boolean, timeout?: number);
|
|
490
491
|
getHttpClient(): HttpClient;
|
|
491
492
|
getBaseUrl(): string;
|
|
492
493
|
getWebUrl(): string;
|
|
@@ -620,7 +621,6 @@ declare class IAPService {
|
|
|
620
621
|
purchase(productId: string, options?: {
|
|
621
622
|
paywallPlacement?: string;
|
|
622
623
|
variantKey?: string;
|
|
623
|
-
onValidating?: () => void;
|
|
624
624
|
}): Promise<PurchaseResult>;
|
|
625
625
|
restore(): Promise<Purchase[]>;
|
|
626
626
|
}
|
|
@@ -635,7 +635,7 @@ declare const nativeStoreKit: {
|
|
|
635
635
|
getActiveTransactions(): Promise<Purchase[]>;
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
-
type PurchaseState = "idle" | "
|
|
638
|
+
type PurchaseState = "idle" | "purchasing" | "restoring" | "error";
|
|
639
639
|
interface IAPProduct {
|
|
640
640
|
productId: string;
|
|
641
641
|
price: string;
|
|
@@ -716,6 +716,15 @@ declare const IDENTITY_ERROR_CODES: {
|
|
|
716
716
|
readonly IDENTIFY_FAILED: "IDENTITY_IDENTIFY_FAILED";
|
|
717
717
|
};
|
|
718
718
|
|
|
719
|
+
declare class MetaBridge {
|
|
720
|
+
getAnonymousID(): Promise<string | null>;
|
|
721
|
+
logEvent(name: string, params?: Record<string, unknown>): Promise<void>;
|
|
722
|
+
logPurchase(amount: number, currency: string, params?: Record<string, unknown>): Promise<void>;
|
|
723
|
+
setUserID(userId: string): void;
|
|
724
|
+
flush(): void;
|
|
725
|
+
}
|
|
726
|
+
declare const metaBridge: MetaBridge;
|
|
727
|
+
|
|
719
728
|
type NetworkState = "online" | "offline" | "unknown";
|
|
720
729
|
type NetworkListener = (state: NetworkState) => void;
|
|
721
730
|
interface NetworkMonitorConfig {
|
|
@@ -728,17 +737,13 @@ declare class NetworkMonitorClass {
|
|
|
728
737
|
private config;
|
|
729
738
|
private listeners;
|
|
730
739
|
private currentState;
|
|
731
|
-
private netInfoModule;
|
|
732
|
-
private netInfoSubscription;
|
|
733
740
|
private appStateSubscription;
|
|
734
741
|
private initialized;
|
|
735
742
|
private checkIntervalId;
|
|
736
743
|
initialize(config?: Partial<NetworkMonitorConfig>): Promise<void>;
|
|
737
|
-
private setupNetInfoListener;
|
|
738
744
|
private setupFallbackDetection;
|
|
739
745
|
private setupAppStateListener;
|
|
740
746
|
private checkConnectivity;
|
|
741
|
-
private netInfoStateToNetworkState;
|
|
742
747
|
private updateState;
|
|
743
748
|
private notifyListeners;
|
|
744
749
|
isOnline(): boolean;
|
|
@@ -1045,9 +1050,7 @@ interface UsePurchaseResult {
|
|
|
1045
1050
|
purchase: (productId: string) => Promise<PurchaseOutcome>;
|
|
1046
1051
|
restore: () => Promise<IAPPurchase[]>;
|
|
1047
1052
|
error: PurchaseError | null;
|
|
1048
|
-
isLoading: boolean;
|
|
1049
1053
|
isPurchasing: boolean;
|
|
1050
|
-
isValidating: boolean;
|
|
1051
1054
|
isRestoring: boolean;
|
|
1052
1055
|
}
|
|
1053
1056
|
declare function usePurchase(): UsePurchaseResult;
|
|
@@ -1177,4 +1180,4 @@ declare function hasVariables(text: string): boolean;
|
|
|
1177
1180
|
|
|
1178
1181
|
declare const Paywallo: IPaywalloClient;
|
|
1179
1182
|
|
|
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 };
|
|
1183
|
+
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, MetaBridge, 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, metaBridge, nativeStoreKit, networkMonitor, offlineQueue, parseVariables, queueProcessor, resolveText, sessionManager, setCurrentLanguage, setDefaultLanguage, subscriptionManager, usePaywallContext, usePaywallo, useProducts, usePurchase, useSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -286,6 +286,7 @@ interface PaywallErrorStrings$1 {
|
|
|
286
286
|
}
|
|
287
287
|
interface PaywalloConfig {
|
|
288
288
|
appKey: string;
|
|
289
|
+
apiUrl?: string;
|
|
289
290
|
debug?: boolean;
|
|
290
291
|
environment?: Environment;
|
|
291
292
|
errorStrings?: PaywallErrorStrings$1;
|
|
@@ -486,7 +487,7 @@ declare class ApiClient {
|
|
|
486
487
|
private offlineQueueEnabled;
|
|
487
488
|
private httpClient;
|
|
488
489
|
private readonly cache;
|
|
489
|
-
constructor(appKey: string, debug?: boolean, environment?: Environment, offlineQueueEnabled?: boolean, timeout?: number);
|
|
490
|
+
constructor(appKey: string, apiUrl: string, debug?: boolean, environment?: Environment, offlineQueueEnabled?: boolean, timeout?: number);
|
|
490
491
|
getHttpClient(): HttpClient;
|
|
491
492
|
getBaseUrl(): string;
|
|
492
493
|
getWebUrl(): string;
|
|
@@ -620,7 +621,6 @@ declare class IAPService {
|
|
|
620
621
|
purchase(productId: string, options?: {
|
|
621
622
|
paywallPlacement?: string;
|
|
622
623
|
variantKey?: string;
|
|
623
|
-
onValidating?: () => void;
|
|
624
624
|
}): Promise<PurchaseResult>;
|
|
625
625
|
restore(): Promise<Purchase[]>;
|
|
626
626
|
}
|
|
@@ -635,7 +635,7 @@ declare const nativeStoreKit: {
|
|
|
635
635
|
getActiveTransactions(): Promise<Purchase[]>;
|
|
636
636
|
};
|
|
637
637
|
|
|
638
|
-
type PurchaseState = "idle" | "
|
|
638
|
+
type PurchaseState = "idle" | "purchasing" | "restoring" | "error";
|
|
639
639
|
interface IAPProduct {
|
|
640
640
|
productId: string;
|
|
641
641
|
price: string;
|
|
@@ -716,6 +716,15 @@ declare const IDENTITY_ERROR_CODES: {
|
|
|
716
716
|
readonly IDENTIFY_FAILED: "IDENTITY_IDENTIFY_FAILED";
|
|
717
717
|
};
|
|
718
718
|
|
|
719
|
+
declare class MetaBridge {
|
|
720
|
+
getAnonymousID(): Promise<string | null>;
|
|
721
|
+
logEvent(name: string, params?: Record<string, unknown>): Promise<void>;
|
|
722
|
+
logPurchase(amount: number, currency: string, params?: Record<string, unknown>): Promise<void>;
|
|
723
|
+
setUserID(userId: string): void;
|
|
724
|
+
flush(): void;
|
|
725
|
+
}
|
|
726
|
+
declare const metaBridge: MetaBridge;
|
|
727
|
+
|
|
719
728
|
type NetworkState = "online" | "offline" | "unknown";
|
|
720
729
|
type NetworkListener = (state: NetworkState) => void;
|
|
721
730
|
interface NetworkMonitorConfig {
|
|
@@ -728,17 +737,13 @@ declare class NetworkMonitorClass {
|
|
|
728
737
|
private config;
|
|
729
738
|
private listeners;
|
|
730
739
|
private currentState;
|
|
731
|
-
private netInfoModule;
|
|
732
|
-
private netInfoSubscription;
|
|
733
740
|
private appStateSubscription;
|
|
734
741
|
private initialized;
|
|
735
742
|
private checkIntervalId;
|
|
736
743
|
initialize(config?: Partial<NetworkMonitorConfig>): Promise<void>;
|
|
737
|
-
private setupNetInfoListener;
|
|
738
744
|
private setupFallbackDetection;
|
|
739
745
|
private setupAppStateListener;
|
|
740
746
|
private checkConnectivity;
|
|
741
|
-
private netInfoStateToNetworkState;
|
|
742
747
|
private updateState;
|
|
743
748
|
private notifyListeners;
|
|
744
749
|
isOnline(): boolean;
|
|
@@ -1045,9 +1050,7 @@ interface UsePurchaseResult {
|
|
|
1045
1050
|
purchase: (productId: string) => Promise<PurchaseOutcome>;
|
|
1046
1051
|
restore: () => Promise<IAPPurchase[]>;
|
|
1047
1052
|
error: PurchaseError | null;
|
|
1048
|
-
isLoading: boolean;
|
|
1049
1053
|
isPurchasing: boolean;
|
|
1050
|
-
isValidating: boolean;
|
|
1051
1054
|
isRestoring: boolean;
|
|
1052
1055
|
}
|
|
1053
1056
|
declare function usePurchase(): UsePurchaseResult;
|
|
@@ -1177,4 +1180,4 @@ declare function hasVariables(text: string): boolean;
|
|
|
1177
1180
|
|
|
1178
1181
|
declare const Paywallo: IPaywalloClient;
|
|
1179
1182
|
|
|
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 };
|
|
1183
|
+
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, MetaBridge, 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, metaBridge, nativeStoreKit, networkMonitor, offlineQueue, parseVariables, queueProcessor, resolveText, sessionManager, setCurrentLanguage, setDefaultLanguage, subscriptionManager, usePaywallContext, usePaywallo, useProducts, usePurchase, useSubscription };
|