react-native-purchases-ui 8.8.2 → 8.9.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/RNPaywalls.podspec +1 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/revenuecat/purchases/react/ui/RNCustomerCenterModule.kt +61 -1
- package/ios/RNCustomerCenter.m +62 -2
- package/lib/commonjs/index.js +51 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +51 -5
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +62 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.tsx +146 -4
package/RNPaywalls.podspec
CHANGED
@@ -17,6 +17,6 @@ Pod::Spec.new do |spec|
|
|
17
17
|
spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
18
18
|
|
19
19
|
spec.dependency "React-Core"
|
20
|
-
spec.dependency "PurchasesHybridCommonUI", '13.
|
20
|
+
spec.dependency "PurchasesHybridCommonUI", '13.26.0'
|
21
21
|
spec.swift_version = '5.7'
|
22
22
|
end
|
package/android/build.gradle
CHANGED
@@ -59,7 +59,7 @@ android {
|
|
59
59
|
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
60
60
|
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
61
61
|
versionCode 1
|
62
|
-
versionName '8.
|
62
|
+
versionName '8.9.0'
|
63
63
|
}
|
64
64
|
|
65
65
|
buildTypes {
|
@@ -91,7 +91,7 @@ dependencies {
|
|
91
91
|
//noinspection GradleDynamicVersion
|
92
92
|
implementation "com.facebook.react:react-native:+"
|
93
93
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
94
|
-
implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:13.
|
94
|
+
implementation 'com.revenuecat.purchases:purchases-hybrid-common-ui:13.26.0'
|
95
95
|
implementation 'androidx.compose.ui:ui-android:1.5.4'
|
96
96
|
implementation "androidx.appcompat:appcompat:1.6.1"
|
97
97
|
}
|
@@ -9,10 +9,16 @@ import com.facebook.react.bridge.Promise
|
|
9
9
|
import com.facebook.react.bridge.ReactApplicationContext
|
10
10
|
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
11
11
|
import com.facebook.react.bridge.ReactMethod
|
12
|
+
import com.facebook.react.bridge.WritableMap
|
13
|
+
import com.facebook.react.bridge.WritableNativeMap
|
14
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
15
|
+
import com.revenuecat.purchases.Purchases
|
16
|
+
import com.revenuecat.purchases.customercenter.CustomerCenterListener
|
17
|
+
import com.revenuecat.purchases.hybridcommon.ui.CustomerCenterListenerWrapper
|
12
18
|
import com.revenuecat.purchases.ui.revenuecatui.customercenter.ShowCustomerCenter
|
13
19
|
|
14
20
|
internal class RNCustomerCenterModule(
|
15
|
-
reactContext: ReactApplicationContext
|
21
|
+
private val reactContext: ReactApplicationContext
|
16
22
|
) : ReactContextBaseJavaModule(reactContext) {
|
17
23
|
|
18
24
|
companion object {
|
@@ -84,9 +90,63 @@ internal class RNCustomerCenterModule(
|
|
84
90
|
private fun presentCustomerCenterFromActivity(
|
85
91
|
activity: Activity
|
86
92
|
) {
|
93
|
+
val customerCenterListener = createCustomerCenterListener()
|
94
|
+
Purchases.sharedInstance.customerCenterListener = customerCenterListener
|
87
95
|
val intent = ShowCustomerCenter()
|
88
96
|
.createIntent(activity, Unit)
|
89
97
|
activity.startActivityForResult(intent, REQUEST_CODE_CUSTOMER_CENTER)
|
90
98
|
}
|
91
99
|
|
100
|
+
private fun createCustomerCenterListener(): CustomerCenterListener {
|
101
|
+
return object : CustomerCenterListenerWrapper() {
|
102
|
+
override fun onFeedbackSurveyCompletedWrapper(feedbackSurveyOptionId: String) {
|
103
|
+
val params = WritableNativeMap().apply {
|
104
|
+
putString("feedbackSurveyOptionId", feedbackSurveyOptionId)
|
105
|
+
}
|
106
|
+
sendEvent("onFeedbackSurveyCompleted", params)
|
107
|
+
}
|
108
|
+
|
109
|
+
override fun onManagementOptionSelectedWrapper(action: String, url: String?) {
|
110
|
+
val params = WritableNativeMap().apply {
|
111
|
+
putString("option", action)
|
112
|
+
putString("url", url)
|
113
|
+
}
|
114
|
+
sendEvent("onManagementOptionSelected", params)
|
115
|
+
}
|
116
|
+
|
117
|
+
override fun onShowingManageSubscriptionsWrapper() {
|
118
|
+
sendEvent("onShowingManageSubscriptions", null)
|
119
|
+
}
|
120
|
+
|
121
|
+
override fun onRestoreCompletedWrapper(customerInfo: Map<String, Any?>) {
|
122
|
+
val params = WritableNativeMap().apply {
|
123
|
+
putMap("customerInfo", RNPurchasesConverters.convertMapToWriteableMap(customerInfo))
|
124
|
+
}
|
125
|
+
sendEvent("onRestoreCompleted", params)
|
126
|
+
}
|
127
|
+
|
128
|
+
override fun onRestoreFailedWrapper(error: Map<String, Any?>) {
|
129
|
+
val params = WritableNativeMap().apply {
|
130
|
+
putMap("error", RNPurchasesConverters.convertMapToWriteableMap(error))
|
131
|
+
}
|
132
|
+
sendEvent("onRestoreFailed", params)
|
133
|
+
}
|
134
|
+
|
135
|
+
override fun onRestoreStartedWrapper() {
|
136
|
+
sendEvent("onRestoreStarted", null)
|
137
|
+
}
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
private fun sendEvent(eventName: String, params: WritableMap?) {
|
142
|
+
reactContext.runOnUiQueueThread {
|
143
|
+
try {
|
144
|
+
reactContext
|
145
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
146
|
+
.emit(eventName, params)
|
147
|
+
} catch (e: Exception) {
|
148
|
+
Log.e(NAME, "Error sending event $eventName", e)
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
92
152
|
}
|
package/ios/RNCustomerCenter.m
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
@import PurchasesHybridCommonUI;
|
11
11
|
@import RevenueCat;
|
12
12
|
|
13
|
-
@interface RNCustomerCenter ()
|
13
|
+
@interface RNCustomerCenter () <RCCustomerCenterViewControllerDelegateWrapper>
|
14
14
|
|
15
15
|
@property (nonatomic, strong) id customerCenterProxy;
|
16
16
|
|
@@ -41,6 +41,7 @@ RCT_EXPORT_MODULE();
|
|
41
41
|
- (void)initializeCustomerCenter {
|
42
42
|
if (@available(iOS 15.0, *)) {
|
43
43
|
self.customerCenterProxy = [CustomerCenterProxy new];
|
44
|
+
[(CustomerCenterProxy *)self.customerCenterProxy setDelegate:self];
|
44
45
|
} else {
|
45
46
|
self.customerCenterProxy = nil;
|
46
47
|
}
|
@@ -49,7 +50,17 @@ RCT_EXPORT_MODULE();
|
|
49
50
|
// MARK: -
|
50
51
|
|
51
52
|
- (NSArray<NSString *> *)supportedEvents {
|
52
|
-
return @[
|
53
|
+
return @[
|
54
|
+
@"onRestoreStarted",
|
55
|
+
@"onRestoreCompleted",
|
56
|
+
@"onRestoreFailed",
|
57
|
+
@"onShowingManageSubscriptions",
|
58
|
+
@"onRefundRequestStarted",
|
59
|
+
@"onRefundRequestCompleted",
|
60
|
+
@"onFeedbackSurveyCompleted",
|
61
|
+
@"onManagementOptionSelected",
|
62
|
+
@"onDismiss"
|
63
|
+
];
|
53
64
|
}
|
54
65
|
|
55
66
|
- (dispatch_queue_t)methodQueue {
|
@@ -82,6 +93,55 @@ RCT_EXPORT_METHOD(presentCustomerCenter:(RCTPromiseResolveBlock)resolve
|
|
82
93
|
reject(@"CustomerCenterUnsupportedCode", @"CustomerCenter is not supported prior to iOS 15.", nil);
|
83
94
|
}
|
84
95
|
|
96
|
+
// MARK: - CustomerCenterViewControllerDelegateWrapper Methods
|
97
|
+
|
98
|
+
- (void)customerCenterViewControllerWasDismissed:(CustomerCenterUIViewController *)controller API_AVAILABLE(ios(15.0)) {
|
99
|
+
[self sendEventWithName:@"onDismiss" body:@{}];
|
100
|
+
}
|
101
|
+
|
102
|
+
- (void)customerCenterViewControllerDidStartRestore:(CustomerCenterUIViewController *)controller API_AVAILABLE(ios(15.0)) {
|
103
|
+
[self sendEventWithName:@"onRestoreStarted" body:@{}];
|
104
|
+
}
|
105
|
+
|
106
|
+
- (void)customerCenterViewController:(CustomerCenterUIViewController *)controller
|
107
|
+
didFinishRestoringWithCustomerInfoDictionary:(NSDictionary<NSString *, id> *)customerInfoDictionary API_AVAILABLE(ios(15.0)) {
|
108
|
+
[self sendEventWithName:@"onRestoreCompleted" body:@{@"customerInfo": customerInfoDictionary}];
|
109
|
+
}
|
110
|
+
|
111
|
+
- (void)customerCenterViewController:(CustomerCenterUIViewController *)controller
|
112
|
+
didFailRestoringWithErrorDictionary:(NSDictionary<NSString *, id> *)errorDictionary API_AVAILABLE(ios(15.0)) {
|
113
|
+
[self sendEventWithName:@"onRestoreFailed" body:@{@"error": errorDictionary}];
|
114
|
+
}
|
115
|
+
|
116
|
+
- (void)customerCenterViewControllerDidShowManageSubscriptions:(CustomerCenterUIViewController *)controller API_AVAILABLE(ios(15.0)) {
|
117
|
+
[self sendEventWithName:@"onShowingManageSubscriptions" body:@{}];
|
118
|
+
}
|
119
|
+
|
120
|
+
- (void)customerCenterViewController:(CustomerCenterUIViewController *)controller
|
121
|
+
didStartRefundRequestForProductWithID:(NSString *)productID API_AVAILABLE(ios(15.0)) {
|
122
|
+
[self sendEventWithName:@"onRefundRequestStarted" body:@{@"productIdentifier": productID}];
|
123
|
+
}
|
124
|
+
|
125
|
+
- (void)customerCenterViewController:(CustomerCenterUIViewController *)controller
|
126
|
+
didCompleteRefundRequestForProductWithID:(NSString *)productID
|
127
|
+
withStatus:(NSString *)status API_AVAILABLE(ios(15.0)) {
|
128
|
+
[self sendEventWithName:@"onRefundRequestCompleted" body:@{
|
129
|
+
@"productIdentifier": productID,
|
130
|
+
@"refundRequestStatus": status
|
131
|
+
}];
|
132
|
+
}
|
133
|
+
|
134
|
+
- (void)customerCenterViewController:(CustomerCenterUIViewController *)controller
|
135
|
+
didCompleteFeedbackSurveyWithOptionID:(NSString *)optionID API_AVAILABLE(ios(15.0)) {
|
136
|
+
[self sendEventWithName:@"onFeedbackSurveyCompleted" body:@{@"feedbackSurveyOptionId": optionID}];
|
137
|
+
}
|
138
|
+
|
139
|
+
- (void)customerCenterViewController:(CustomerCenterUIViewController *)controller
|
140
|
+
didSelectCustomerCenterManagementOption:(NSString *)optionID
|
141
|
+
withURL:(NSString *)url API_AVAILABLE(ios(15.0)) {
|
142
|
+
[self sendEventWithName:@"onManagementOptionSelected" body:@{@"option": optionID, @"url": url ?: [NSNull null]}];
|
143
|
+
}
|
144
|
+
|
85
145
|
+ (BOOL)requiresMainQueueSetup
|
86
146
|
{
|
87
147
|
return YES;
|
package/lib/commonjs/index.js
CHANGED
@@ -28,6 +28,7 @@ if (!RNCustomerCenter) {
|
|
28
28
|
throw new Error(LINKING_ERROR);
|
29
29
|
}
|
30
30
|
const eventEmitter = new _reactNative.NativeEventEmitter(RNPaywalls);
|
31
|
+
const customerCenterEventEmitter = new _reactNative.NativeEventEmitter(RNCustomerCenter);
|
31
32
|
const InternalPaywall = _reactNative.UIManager.getViewManagerConfig('Paywall') != null ? (0, _reactNative.requireNativeComponent)('Paywall') : () => {
|
32
33
|
throw new Error(LINKING_ERROR);
|
33
34
|
};
|
@@ -37,6 +38,8 @@ const InternalPaywallFooterView = _reactNative.UIManager.getViewManagerConfig('P
|
|
37
38
|
|
38
39
|
// Currently the same as the base type, but can be extended later if needed
|
39
40
|
|
41
|
+
// This is to prevent breaking changes when the native SDK adds new options
|
42
|
+
|
40
43
|
class RevenueCatUI {
|
41
44
|
static Defaults = {
|
42
45
|
PRESENT_PAYWALL_DISPLAY_CLOSE_BUTTON: true
|
@@ -178,11 +181,54 @@ class RevenueCatUI {
|
|
178
181
|
};
|
179
182
|
|
180
183
|
/**
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
184
|
+
* Presents the customer center to the user.
|
185
|
+
*
|
186
|
+
* @param {PresentCustomerCenterParams} params - Optional parameters for presenting the customer center.
|
187
|
+
* @returns {Promise<void>} A promise that resolves when the customer center is presented.
|
188
|
+
*/
|
189
|
+
static presentCustomerCenter(params) {
|
190
|
+
if (params !== null && params !== void 0 && params.callbacks) {
|
191
|
+
const subscriptions = [];
|
192
|
+
const callbacks = params.callbacks;
|
193
|
+
if (callbacks.onFeedbackSurveyCompleted) {
|
194
|
+
const subscription = customerCenterEventEmitter.addListener('onFeedbackSurveyCompleted', event => callbacks.onFeedbackSurveyCompleted && callbacks.onFeedbackSurveyCompleted(event));
|
195
|
+
subscriptions.push(subscription);
|
196
|
+
}
|
197
|
+
if (callbacks.onShowingManageSubscriptions) {
|
198
|
+
const subscription = customerCenterEventEmitter.addListener('onShowingManageSubscriptions', () => callbacks.onShowingManageSubscriptions && callbacks.onShowingManageSubscriptions());
|
199
|
+
subscriptions.push(subscription);
|
200
|
+
}
|
201
|
+
if (callbacks.onRestoreCompleted) {
|
202
|
+
const subscription = customerCenterEventEmitter.addListener('onRestoreCompleted', event => callbacks.onRestoreCompleted && callbacks.onRestoreCompleted(event));
|
203
|
+
subscriptions.push(subscription);
|
204
|
+
}
|
205
|
+
if (callbacks.onRestoreFailed) {
|
206
|
+
const subscription = customerCenterEventEmitter.addListener('onRestoreFailed', event => callbacks.onRestoreFailed && callbacks.onRestoreFailed(event));
|
207
|
+
subscriptions.push(subscription);
|
208
|
+
}
|
209
|
+
if (callbacks.onRestoreStarted) {
|
210
|
+
const subscription = customerCenterEventEmitter.addListener('onRestoreStarted', () => callbacks.onRestoreStarted && callbacks.onRestoreStarted());
|
211
|
+
subscriptions.push(subscription);
|
212
|
+
}
|
213
|
+
if (callbacks.onRefundRequestStarted) {
|
214
|
+
const subscription = customerCenterEventEmitter.addListener('onRefundRequestStarted', event => callbacks.onRefundRequestStarted && callbacks.onRefundRequestStarted(event));
|
215
|
+
subscriptions.push(subscription);
|
216
|
+
}
|
217
|
+
if (callbacks.onRefundRequestCompleted) {
|
218
|
+
const subscription = customerCenterEventEmitter.addListener('onRefundRequestCompleted', event => callbacks.onRefundRequestCompleted && callbacks.onRefundRequestCompleted(event));
|
219
|
+
subscriptions.push(subscription);
|
220
|
+
}
|
221
|
+
if (callbacks.onManagementOptionSelected) {
|
222
|
+
const subscription = customerCenterEventEmitter.addListener('onManagementOptionSelected', event => callbacks.onManagementOptionSelected && callbacks.onManagementOptionSelected(event));
|
223
|
+
subscriptions.push(subscription);
|
224
|
+
}
|
225
|
+
|
226
|
+
// Return a promise that resolves when the customer center is dismissed
|
227
|
+
return RNCustomerCenter.presentCustomerCenter().finally(() => {
|
228
|
+
// Clean up all event listeners when the customer center is dismissed
|
229
|
+
subscriptions.forEach(subscription => subscription.remove());
|
230
|
+
});
|
231
|
+
}
|
186
232
|
return RNCustomerCenter.presentCustomerCenter();
|
187
233
|
}
|
188
234
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_purchasesTypescriptInternal","_react","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","LINKING_ERROR","Platform","select","ios","RNPaywalls","NativeModules","RNCustomerCenter","Error","eventEmitter","NativeEventEmitter","InternalPaywall","UIManager","getViewManagerConfig","requireNativeComponent","InternalPaywallFooterView","RevenueCatUI","Defaults","PRESENT_PAYWALL_DISPLAY_CLOSE_BUTTON","PAYWALL_RESULT","presentPaywall","offering","displayCloseButton","fontFamily","identifier","presentPaywallIfNeeded","requiredEntitlementIdentifier","Paywall","style","children","options","onPurchaseStarted","onPurchaseCompleted","onPurchaseError","onPurchaseCancelled","onRestoreStarted","onRestoreCompleted","onRestoreError","onDismiss","createElement","event","nativeEvent","flex","OriginalTemplatePaywallFooterContainerView","paddingBottom","setPaddingBottom","useState","height","setHeight","useEffect","handleSafeAreaInsetsChange","bottom","subscription","addListener","remove","View","ScrollView","contentContainerStyle","flexGrow","marginTop","android","onMeasure","measurements","presentCustomerCenter","PaywallFooterContainerView","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,IAAAC,4BAAA,GAAAD,OAAA;
|
1
|
+
{"version":3,"names":["_reactNative","require","_purchasesTypescriptInternal","_react","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","LINKING_ERROR","Platform","select","ios","RNPaywalls","NativeModules","RNCustomerCenter","Error","eventEmitter","NativeEventEmitter","customerCenterEventEmitter","InternalPaywall","UIManager","getViewManagerConfig","requireNativeComponent","InternalPaywallFooterView","RevenueCatUI","Defaults","PRESENT_PAYWALL_DISPLAY_CLOSE_BUTTON","PAYWALL_RESULT","presentPaywall","offering","displayCloseButton","fontFamily","identifier","presentPaywallIfNeeded","requiredEntitlementIdentifier","Paywall","style","children","options","onPurchaseStarted","onPurchaseCompleted","onPurchaseError","onPurchaseCancelled","onRestoreStarted","onRestoreCompleted","onRestoreError","onDismiss","createElement","event","nativeEvent","flex","OriginalTemplatePaywallFooterContainerView","paddingBottom","setPaddingBottom","useState","height","setHeight","useEffect","handleSafeAreaInsetsChange","bottom","subscription","addListener","remove","View","ScrollView","contentContainerStyle","flexGrow","marginTop","android","onMeasure","measurements","presentCustomerCenter","params","callbacks","subscriptions","onFeedbackSurveyCompleted","push","onShowingManageSubscriptions","onRestoreFailed","onRefundRequestStarted","onRefundRequestCompleted","onManagementOptionSelected","finally","forEach","PaywallFooterContainerView","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,IAAAC,4BAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAC,uBAAA,CAAAH,OAAA;AAAmE,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,Y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AE;QACpC,MAAMnB,YAAY,GAAG1C,0BAA0B,CAAC2C,WAAW,CACzD,wBAAwB,EACvBb,KAAoC,IAAKyB,SAAS,CAACM,sBAAsB,IACxEN,SAAS,CAACM,sBAAsB,CAAC/B,KAAK,CAC1C,CAAC;QACD0B,aAAa,CAACE,IAAI,CAAChB,YAAY,CAAC;MAClC;MAEA,IAAIa,SAAS,CAACO,wBAAwB,EAAE;QACtC,MAAMpB,YAAY,GAAG1C,0BAA0B,CAAC2C,WAAW,CACzD,0BAA0B,EACzBb,KAAgF,IAAKyB,SAAS,CAACO,wBAAwB,IACtHP,SAAS,CAACO,wBAAwB,CAAChC,KAAK,CAC5C,CAAC;QACD0B,aAAa,CAACE,IAAI,CAAChB,YAAY,CAAC;MAClC;MAEA,IAAIa,SAAS,CAACQ,0BAA0B,EAAE;QACxC,MAAMrB,YAAY,GAAG1C,0BAA0B,CAAC2C,WAAW,CACzD,4BAA4B,EAC3Bb,KAA8D,IAAKyB,SAAS,CAACQ,0BAA0B,IACtGR,SAAS,CAACQ,0BAA0B,CAACjC,KAAK,CAC9C,CAAC;QACD0B,aAAa,CAACE,IAAI,CAAChB,YAAY,CAAC;MAClC;;MAEA;MACA,OAAO9C,gBAAgB,CAACyD,qBAAqB,CAAC,CAAC,CAACW,OAAO,CAAC,MAAM;QAC5D;QACAR,aAAa,CAACS,OAAO,CAACvB,YAAY,IAAIA,YAAY,CAACE,MAAM,CAAC,CAAC,CAAC;MAC9D,CAAC,CAAC;IACJ;IAEA,OAAOhD,gBAAgB,CAACyD,qBAAqB,CAAC,CAAC;EACjD;;EAEA;AACF;AACA;EACE,OAAca,0BAA0B,GACtC5D,YAAY,CAAC2B,0CAA0C;AAC3D;AAACkC,OAAA,CAAA3F,OAAA,GAAA8B,YAAA","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
@@ -15,6 +15,7 @@ if (!RNCustomerCenter) {
|
|
15
15
|
throw new Error(LINKING_ERROR);
|
16
16
|
}
|
17
17
|
const eventEmitter = new NativeEventEmitter(RNPaywalls);
|
18
|
+
const customerCenterEventEmitter = new NativeEventEmitter(RNCustomerCenter);
|
18
19
|
const InternalPaywall = UIManager.getViewManagerConfig('Paywall') != null ? requireNativeComponent('Paywall') : () => {
|
19
20
|
throw new Error(LINKING_ERROR);
|
20
21
|
};
|
@@ -24,6 +25,8 @@ const InternalPaywallFooterView = UIManager.getViewManagerConfig('Paywall') != n
|
|
24
25
|
|
25
26
|
// Currently the same as the base type, but can be extended later if needed
|
26
27
|
|
28
|
+
// This is to prevent breaking changes when the native SDK adds new options
|
29
|
+
|
27
30
|
export default class RevenueCatUI {
|
28
31
|
static Defaults = {
|
29
32
|
PRESENT_PAYWALL_DISPLAY_CLOSE_BUTTON: true
|
@@ -165,11 +168,54 @@ export default class RevenueCatUI {
|
|
165
168
|
};
|
166
169
|
|
167
170
|
/**
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
171
|
+
* Presents the customer center to the user.
|
172
|
+
*
|
173
|
+
* @param {PresentCustomerCenterParams} params - Optional parameters for presenting the customer center.
|
174
|
+
* @returns {Promise<void>} A promise that resolves when the customer center is presented.
|
175
|
+
*/
|
176
|
+
static presentCustomerCenter(params) {
|
177
|
+
if (params !== null && params !== void 0 && params.callbacks) {
|
178
|
+
const subscriptions = [];
|
179
|
+
const callbacks = params.callbacks;
|
180
|
+
if (callbacks.onFeedbackSurveyCompleted) {
|
181
|
+
const subscription = customerCenterEventEmitter.addListener('onFeedbackSurveyCompleted', event => callbacks.onFeedbackSurveyCompleted && callbacks.onFeedbackSurveyCompleted(event));
|
182
|
+
subscriptions.push(subscription);
|
183
|
+
}
|
184
|
+
if (callbacks.onShowingManageSubscriptions) {
|
185
|
+
const subscription = customerCenterEventEmitter.addListener('onShowingManageSubscriptions', () => callbacks.onShowingManageSubscriptions && callbacks.onShowingManageSubscriptions());
|
186
|
+
subscriptions.push(subscription);
|
187
|
+
}
|
188
|
+
if (callbacks.onRestoreCompleted) {
|
189
|
+
const subscription = customerCenterEventEmitter.addListener('onRestoreCompleted', event => callbacks.onRestoreCompleted && callbacks.onRestoreCompleted(event));
|
190
|
+
subscriptions.push(subscription);
|
191
|
+
}
|
192
|
+
if (callbacks.onRestoreFailed) {
|
193
|
+
const subscription = customerCenterEventEmitter.addListener('onRestoreFailed', event => callbacks.onRestoreFailed && callbacks.onRestoreFailed(event));
|
194
|
+
subscriptions.push(subscription);
|
195
|
+
}
|
196
|
+
if (callbacks.onRestoreStarted) {
|
197
|
+
const subscription = customerCenterEventEmitter.addListener('onRestoreStarted', () => callbacks.onRestoreStarted && callbacks.onRestoreStarted());
|
198
|
+
subscriptions.push(subscription);
|
199
|
+
}
|
200
|
+
if (callbacks.onRefundRequestStarted) {
|
201
|
+
const subscription = customerCenterEventEmitter.addListener('onRefundRequestStarted', event => callbacks.onRefundRequestStarted && callbacks.onRefundRequestStarted(event));
|
202
|
+
subscriptions.push(subscription);
|
203
|
+
}
|
204
|
+
if (callbacks.onRefundRequestCompleted) {
|
205
|
+
const subscription = customerCenterEventEmitter.addListener('onRefundRequestCompleted', event => callbacks.onRefundRequestCompleted && callbacks.onRefundRequestCompleted(event));
|
206
|
+
subscriptions.push(subscription);
|
207
|
+
}
|
208
|
+
if (callbacks.onManagementOptionSelected) {
|
209
|
+
const subscription = customerCenterEventEmitter.addListener('onManagementOptionSelected', event => callbacks.onManagementOptionSelected && callbacks.onManagementOptionSelected(event));
|
210
|
+
subscriptions.push(subscription);
|
211
|
+
}
|
212
|
+
|
213
|
+
// Return a promise that resolves when the customer center is dismissed
|
214
|
+
return RNCustomerCenter.presentCustomerCenter().finally(() => {
|
215
|
+
// Clean up all event listeners when the customer center is dismissed
|
216
|
+
subscriptions.forEach(subscription => subscription.remove());
|
217
|
+
});
|
218
|
+
}
|
173
219
|
return RNCustomerCenter.presentCustomerCenter();
|
174
220
|
}
|
175
221
|
|
package/lib/module/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","requireNativeComponent","ScrollView","UIManager","View","PAYWALL_RESULT","React","useEffect","useState","LINKING_ERROR","select","ios","default","RNPaywalls","RNCustomerCenter","Error","eventEmitter","InternalPaywall","getViewManagerConfig","InternalPaywallFooterView","RevenueCatUI","Defaults","PRESENT_PAYWALL_DISPLAY_CLOSE_BUTTON","presentPaywall","offering","displayCloseButton","fontFamily","identifier","presentPaywallIfNeeded","requiredEntitlementIdentifier","Paywall","style","children","options","onPurchaseStarted","onPurchaseCompleted","onPurchaseError","onPurchaseCancelled","onRestoreStarted","onRestoreCompleted","onRestoreError","onDismiss","createElement","event","nativeEvent","flex","OriginalTemplatePaywallFooterContainerView","paddingBottom","setPaddingBottom","height","setHeight","handleSafeAreaInsetsChange","bottom","subscription","addListener","remove","contentContainerStyle","flexGrow","marginTop","android","onMeasure","measurements","presentCustomerCenter","PaywallFooterContainerView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,EACRC,sBAAsB,EACtBC,UAAU,EAEVC,SAAS,EACTC,IAAI,QAEC,cAAc;AACrB,SAEEC,cAAc,
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","requireNativeComponent","ScrollView","UIManager","View","PAYWALL_RESULT","React","useEffect","useState","LINKING_ERROR","select","ios","default","RNPaywalls","RNCustomerCenter","Error","eventEmitter","customerCenterEventEmitter","InternalPaywall","getViewManagerConfig","InternalPaywallFooterView","RevenueCatUI","Defaults","PRESENT_PAYWALL_DISPLAY_CLOSE_BUTTON","presentPaywall","offering","displayCloseButton","fontFamily","identifier","presentPaywallIfNeeded","requiredEntitlementIdentifier","Paywall","style","children","options","onPurchaseStarted","onPurchaseCompleted","onPurchaseError","onPurchaseCancelled","onRestoreStarted","onRestoreCompleted","onRestoreError","onDismiss","createElement","event","nativeEvent","flex","OriginalTemplatePaywallFooterContainerView","paddingBottom","setPaddingBottom","height","setHeight","handleSafeAreaInsetsChange","bottom","subscription","addListener","remove","contentContainerStyle","flexGrow","marginTop","android","onMeasure","measurements","presentCustomerCenter","params","callbacks","subscriptions","onFeedbackSurveyCompleted","push","onShowingManageSubscriptions","onRestoreFailed","onRefundRequestStarted","onRefundRequestCompleted","onManagementOptionSelected","finally","forEach","PaywallFooterContainerView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,aAAa,EACbC,QAAQ,EACRC,sBAAsB,EACtBC,UAAU,EAEVC,SAAS,EACTC,IAAI,QAEC,cAAc;AACrB,SAEEC,cAAc,QAIT,2CAA2C;AAClD,OAAOC,KAAK,IAAoBC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElE,SAASH,cAAc,QAAQ,2CAA2C;AAE1E,MAAMI,aAAa,GACjB,oFAAoF,GACpFT,QAAQ,CAACU,MAAM,CAAC;EAACC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAE,CAAC,CAAC,GACrE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGd,aAAa,CAACc,UAAU;AAC3C,MAAMC,gBAAgB,GAAGf,aAAa,CAACe,gBAAgB;AAEvD,IAAI,CAACD,UAAU,EAAE;EACf,MAAM,IAAIE,KAAK,CAACN,aAAa,CAAC;AAChC;AAEA,IAAI,CAACK,gBAAgB,EAAE;EACrB,MAAM,IAAIC,KAAK,CAACN,aAAa,CAAC;AAChC;AAEA,MAAMO,YAAY,GAAG,IAAIlB,kBAAkB,CAACe,UAAU,CAAC;AACvD,MAAMI,0BAA0B,GAAG,IAAInB,kBAAkB,CAACgB,gBAAgB,CAAC;AAE3E,MAAMI,eAAe,GACnBf,SAAS,CAACgB,oBAAoB,CAAC,SAAS,CAAC,IAAI,IAAI,GAC7ClB,sBAAsB,CAA6B,SAAS,CAAC,GAC7D,MAAM;EACN,MAAM,IAAIc,KAAK,CAACN,aAAa,CAAC;AAChC,CAAC;AAEL,MAAMW,yBAAyB,GAA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B,IACtGR,SAAS,CAACQ,0BAA0B,CAAC7B,KAAK,CAC9C,CAAC;QACDsB,aAAa,CAACE,IAAI,CAACd,YAAY,CAAC;MAClC;;MAEA;MACA,OAAOxC,gBAAgB,CAACiD,qBAAqB,CAAC,CAAC,CAACW,OAAO,CAAC,MAAM;QAC5D;QACAR,aAAa,CAACS,OAAO,CAACrB,YAAY,IAAIA,YAAY,CAACE,MAAM,CAAC,CAAC,CAAC;MAC9D,CAAC,CAAC;IACJ;IAEA,OAAO1C,gBAAgB,CAACiD,qBAAqB,CAAC,CAAC;EACjD;;EAEA;AACF;AACA;EACE,OAAca,0BAA0B,GACtCvD,YAAY,CAAC0B,0CAA0C;AAC3D","ignoreList":[]}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type StyleProp, type ViewStyle } from "react-native";
|
2
|
-
import { type CustomerInfo, PAYWALL_RESULT, type PurchasesError, type PurchasesOffering, type PurchasesPackage, type PurchasesStoreTransaction } from "@revenuecat/purchases-typescript-internal";
|
2
|
+
import { type CustomerInfo, PAYWALL_RESULT, type PurchasesError, type PurchasesOffering, type PurchasesPackage, type PurchasesStoreTransaction, REFUND_REQUEST_STATUS } from "@revenuecat/purchases-typescript-internal";
|
3
3
|
import React, { type ReactNode } from "react";
|
4
4
|
export { PAYWALL_RESULT } from "@revenuecat/purchases-typescript-internal";
|
5
5
|
export interface PresentPaywallParams {
|
@@ -106,6 +106,61 @@ type FooterPaywallViewProps = {
|
|
106
106
|
}) => void;
|
107
107
|
onDismiss?: () => void;
|
108
108
|
};
|
109
|
+
export type CustomerCenterManagementOption = 'cancel' | 'custom_url' | 'missing_purchase' | 'refund_request' | 'change_plans' | 'unknown' | string;
|
110
|
+
export interface CustomerCenterCallbacks {
|
111
|
+
/**
|
112
|
+
* Called when a feedback survey is completed with the selected option ID.
|
113
|
+
*/
|
114
|
+
onFeedbackSurveyCompleted?: ({ feedbackSurveyOptionId }: {
|
115
|
+
feedbackSurveyOptionId: string;
|
116
|
+
}) => void;
|
117
|
+
/**
|
118
|
+
* Called when the manage subscriptions section is being shown.
|
119
|
+
*/
|
120
|
+
onShowingManageSubscriptions?: () => void;
|
121
|
+
/**
|
122
|
+
* Called when a restore operation is completed successfully.
|
123
|
+
*/
|
124
|
+
onRestoreCompleted?: ({ customerInfo }: {
|
125
|
+
customerInfo: CustomerInfo;
|
126
|
+
}) => void;
|
127
|
+
/**
|
128
|
+
* Called when a restore operation fails.
|
129
|
+
*/
|
130
|
+
onRestoreFailed?: ({ error }: {
|
131
|
+
error: PurchasesError;
|
132
|
+
}) => void;
|
133
|
+
/**
|
134
|
+
* Called when a restore operation starts.
|
135
|
+
*/
|
136
|
+
onRestoreStarted?: () => void;
|
137
|
+
/**
|
138
|
+
* Called when a refund request starts with the product identifier. iOS-only callback.
|
139
|
+
*/
|
140
|
+
onRefundRequestStarted?: ({ productIdentifier }: {
|
141
|
+
productIdentifier: string;
|
142
|
+
}) => void;
|
143
|
+
/**
|
144
|
+
* Called when a refund request completes with status information. iOS-only callback.
|
145
|
+
*/
|
146
|
+
onRefundRequestCompleted?: ({ productIdentifier, refundRequestStatus }: {
|
147
|
+
productIdentifier: string;
|
148
|
+
refundRequestStatus: REFUND_REQUEST_STATUS;
|
149
|
+
}) => void;
|
150
|
+
/**
|
151
|
+
* Called when a customer center management option is selected with the option ID and URL.
|
152
|
+
*/
|
153
|
+
onManagementOptionSelected?: ({ option, url }: {
|
154
|
+
option: CustomerCenterManagementOption;
|
155
|
+
url: string;
|
156
|
+
}) => void;
|
157
|
+
}
|
158
|
+
export interface PresentCustomerCenterParams {
|
159
|
+
/**
|
160
|
+
* Optional callbacks for customer center events.
|
161
|
+
*/
|
162
|
+
callbacks?: CustomerCenterCallbacks;
|
163
|
+
}
|
109
164
|
export default class RevenueCatUI {
|
110
165
|
private static Defaults;
|
111
166
|
/**
|
@@ -142,11 +197,12 @@ export default class RevenueCatUI {
|
|
142
197
|
static Paywall: React.FC<FullScreenPaywallViewProps>;
|
143
198
|
static OriginalTemplatePaywallFooterContainerView: React.FC<FooterPaywallViewProps>;
|
144
199
|
/**
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
200
|
+
* Presents the customer center to the user.
|
201
|
+
*
|
202
|
+
* @param {PresentCustomerCenterParams} params - Optional parameters for presenting the customer center.
|
203
|
+
* @returns {Promise<void>} A promise that resolves when the customer center is presented.
|
204
|
+
*/
|
205
|
+
static presentCustomerCenter(params?: PresentCustomerCenterParams): Promise<void>;
|
150
206
|
/**
|
151
207
|
* @deprecated, Use {@link OriginalTemplatePaywallFooterContainerView} instead
|
152
208
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,YAAY,EACjB,cAAc,EAAE,KAAK,cAAc,EACnC,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAC7C,KAAK,yBAAyB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EAGd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,YAAY,EACjB,cAAc,EAAE,KAAK,cAAc,EACnC,KAAK,iBAAiB,EAAE,KAAK,gBAAgB,EAC7C,KAAK,yBAAyB,EAC9B,qBAAqB,EACtB,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAuB,MAAM,OAAO,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAmC3E,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAE7B;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R,kBAA+E,EAC/E,UAAU,GACX,GAAE,oBAAyB,GAAG,OAAO,CAAC,cAAc,CAAC;IAQnF;;;;;;;;;;;;OAYG;WACW,sBAAsB,CAAC,EACE,6BAA6B,EAC7B,QAAQ,EACR,kBAA+E,EAC/E,UAAU,GACX,EAAE,4BAA4B,GAAG,OAAO,CAAC,cAAc,CAAC;IAS9F,OAAc,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAwBzD;IAEF,OAAc,0CAA0C,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,CA+DxF;IAEF;;;;;OAKG;WACW,qBAAqB,CAAC,MAAM,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC;IAqFxF;;OAEG;IACH,OAAc,0BAA0B,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAChB;CAC3D"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "react-native-purchases-ui",
|
3
3
|
"title": "React Native Purchases UI",
|
4
|
-
"version": "8.
|
4
|
+
"version": "8.9.0",
|
5
5
|
"description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android.",
|
6
6
|
"main": "lib/commonjs/index",
|
7
7
|
"module": "lib/module/index",
|
@@ -114,7 +114,7 @@
|
|
114
114
|
]
|
115
115
|
},
|
116
116
|
"dependencies": {
|
117
|
-
"@revenuecat/purchases-typescript-internal": "13.
|
118
|
-
"react-native-purchases": "8.
|
117
|
+
"@revenuecat/purchases-typescript-internal": "13.26.0",
|
118
|
+
"react-native-purchases": "8.9.0"
|
119
119
|
}
|
120
120
|
}
|
package/src/index.tsx
CHANGED
@@ -13,7 +13,8 @@ import {
|
|
13
13
|
type CustomerInfo,
|
14
14
|
PAYWALL_RESULT, type PurchasesError,
|
15
15
|
type PurchasesOffering, type PurchasesPackage,
|
16
|
-
type PurchasesStoreTransaction
|
16
|
+
type PurchasesStoreTransaction,
|
17
|
+
REFUND_REQUEST_STATUS
|
17
18
|
} from "@revenuecat/purchases-typescript-internal";
|
18
19
|
import React, { type ReactNode, useEffect, useState } from "react";
|
19
20
|
|
@@ -37,6 +38,7 @@ if (!RNCustomerCenter) {
|
|
37
38
|
}
|
38
39
|
|
39
40
|
const eventEmitter = new NativeEventEmitter(RNPaywalls);
|
41
|
+
const customerCenterEventEmitter = new NativeEventEmitter(RNCustomerCenter);
|
40
42
|
|
41
43
|
const InternalPaywall =
|
42
44
|
UIManager.getViewManagerConfig('Paywall') != null
|
@@ -155,6 +157,64 @@ type InternalFooterPaywallViewProps = FooterPaywallViewProps & {
|
|
155
157
|
onMeasure?: ({height}: { height: number }) => void;
|
156
158
|
};
|
157
159
|
|
160
|
+
export type CustomerCenterManagementOption =
|
161
|
+
| 'cancel'
|
162
|
+
| 'custom_url'
|
163
|
+
| 'missing_purchase'
|
164
|
+
| 'refund_request'
|
165
|
+
| 'change_plans'
|
166
|
+
| 'unknown'
|
167
|
+
| string; // This is to prevent breaking changes when the native SDK adds new options
|
168
|
+
|
169
|
+
export interface CustomerCenterCallbacks {
|
170
|
+
/**
|
171
|
+
* Called when a feedback survey is completed with the selected option ID.
|
172
|
+
*/
|
173
|
+
onFeedbackSurveyCompleted?: ({feedbackSurveyOptionId}: { feedbackSurveyOptionId: string }) => void;
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Called when the manage subscriptions section is being shown.
|
177
|
+
*/
|
178
|
+
onShowingManageSubscriptions?: () => void;
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Called when a restore operation is completed successfully.
|
182
|
+
*/
|
183
|
+
onRestoreCompleted?: ({customerInfo}: { customerInfo: CustomerInfo }) => void;
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Called when a restore operation fails.
|
187
|
+
*/
|
188
|
+
onRestoreFailed?: ({error}: { error: PurchasesError }) => void;
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Called when a restore operation starts.
|
192
|
+
*/
|
193
|
+
onRestoreStarted?: () => void;
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Called when a refund request starts with the product identifier. iOS-only callback.
|
197
|
+
*/
|
198
|
+
onRefundRequestStarted?: ({productIdentifier}: { productIdentifier: string }) => void;
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Called when a refund request completes with status information. iOS-only callback.
|
202
|
+
*/
|
203
|
+
onRefundRequestCompleted?: ({productIdentifier, refundRequestStatus}: { productIdentifier: string; refundRequestStatus: REFUND_REQUEST_STATUS }) => void;
|
204
|
+
|
205
|
+
/**
|
206
|
+
* Called when a customer center management option is selected with the option ID and URL.
|
207
|
+
*/
|
208
|
+
onManagementOptionSelected?: ({option, url}: { option: CustomerCenterManagementOption; url: string }) => void;
|
209
|
+
}
|
210
|
+
|
211
|
+
export interface PresentCustomerCenterParams {
|
212
|
+
/**
|
213
|
+
* Optional callbacks for customer center events.
|
214
|
+
*/
|
215
|
+
callbacks?: CustomerCenterCallbacks;
|
216
|
+
}
|
217
|
+
|
158
218
|
export default class RevenueCatUI {
|
159
219
|
|
160
220
|
private static Defaults = {
|
@@ -308,15 +368,97 @@ export default class RevenueCatUI {
|
|
308
368
|
);
|
309
369
|
};
|
310
370
|
|
311
|
-
|
371
|
+
/**
|
312
372
|
* Presents the customer center to the user.
|
313
373
|
*
|
374
|
+
* @param {PresentCustomerCenterParams} params - Optional parameters for presenting the customer center.
|
314
375
|
* @returns {Promise<void>} A promise that resolves when the customer center is presented.
|
315
376
|
*/
|
316
|
-
|
317
|
-
|
377
|
+
public static presentCustomerCenter(params?: PresentCustomerCenterParams): Promise<void> {
|
378
|
+
if (params?.callbacks) {
|
379
|
+
const subscriptions: { remove: () => void }[] = [];
|
380
|
+
const callbacks = params.callbacks as CustomerCenterCallbacks;
|
381
|
+
|
382
|
+
if (callbacks.onFeedbackSurveyCompleted) {
|
383
|
+
const subscription = customerCenterEventEmitter.addListener(
|
384
|
+
'onFeedbackSurveyCompleted',
|
385
|
+
(event: { feedbackSurveyOptionId: string }) => callbacks.onFeedbackSurveyCompleted &&
|
386
|
+
callbacks.onFeedbackSurveyCompleted(event)
|
387
|
+
);
|
388
|
+
subscriptions.push(subscription);
|
389
|
+
}
|
390
|
+
|
391
|
+
if (callbacks.onShowingManageSubscriptions) {
|
392
|
+
const subscription = customerCenterEventEmitter.addListener(
|
393
|
+
'onShowingManageSubscriptions',
|
394
|
+
() => callbacks.onShowingManageSubscriptions && callbacks.onShowingManageSubscriptions()
|
395
|
+
);
|
396
|
+
subscriptions.push(subscription);
|
397
|
+
}
|
398
|
+
|
399
|
+
if (callbacks.onRestoreCompleted) {
|
400
|
+
const subscription = customerCenterEventEmitter.addListener(
|
401
|
+
'onRestoreCompleted',
|
402
|
+
(event: { customerInfo: CustomerInfo }) => callbacks.onRestoreCompleted &&
|
403
|
+
callbacks.onRestoreCompleted(event)
|
404
|
+
);
|
405
|
+
subscriptions.push(subscription);
|
406
|
+
}
|
407
|
+
|
408
|
+
if (callbacks.onRestoreFailed) {
|
409
|
+
const subscription = customerCenterEventEmitter.addListener(
|
410
|
+
'onRestoreFailed',
|
411
|
+
(event: { error: PurchasesError }) => callbacks.onRestoreFailed &&
|
412
|
+
callbacks.onRestoreFailed(event)
|
413
|
+
);
|
414
|
+
subscriptions.push(subscription);
|
415
|
+
}
|
416
|
+
|
417
|
+
if (callbacks.onRestoreStarted) {
|
418
|
+
const subscription = customerCenterEventEmitter.addListener(
|
419
|
+
'onRestoreStarted',
|
420
|
+
() => callbacks.onRestoreStarted && callbacks.onRestoreStarted()
|
421
|
+
);
|
422
|
+
subscriptions.push(subscription);
|
423
|
+
}
|
424
|
+
|
425
|
+
if (callbacks.onRefundRequestStarted) {
|
426
|
+
const subscription = customerCenterEventEmitter.addListener(
|
427
|
+
'onRefundRequestStarted',
|
428
|
+
(event: { productIdentifier: string }) => callbacks.onRefundRequestStarted &&
|
429
|
+
callbacks.onRefundRequestStarted(event)
|
430
|
+
);
|
431
|
+
subscriptions.push(subscription);
|
432
|
+
}
|
433
|
+
|
434
|
+
if (callbacks.onRefundRequestCompleted) {
|
435
|
+
const subscription = customerCenterEventEmitter.addListener(
|
436
|
+
'onRefundRequestCompleted',
|
437
|
+
(event: { productIdentifier: string; refundRequestStatus: REFUND_REQUEST_STATUS }) => callbacks.onRefundRequestCompleted &&
|
438
|
+
callbacks.onRefundRequestCompleted(event)
|
439
|
+
);
|
440
|
+
subscriptions.push(subscription);
|
441
|
+
}
|
442
|
+
|
443
|
+
if (callbacks.onManagementOptionSelected) {
|
444
|
+
const subscription = customerCenterEventEmitter.addListener(
|
445
|
+
'onManagementOptionSelected',
|
446
|
+
(event: { option: CustomerCenterManagementOption; url: string }) => callbacks.onManagementOptionSelected &&
|
447
|
+
callbacks.onManagementOptionSelected(event)
|
448
|
+
);
|
449
|
+
subscriptions.push(subscription);
|
450
|
+
}
|
451
|
+
|
452
|
+
// Return a promise that resolves when the customer center is dismissed
|
453
|
+
return RNCustomerCenter.presentCustomerCenter().finally(() => {
|
454
|
+
// Clean up all event listeners when the customer center is dismissed
|
455
|
+
subscriptions.forEach(subscription => subscription.remove());
|
456
|
+
});
|
318
457
|
}
|
319
458
|
|
459
|
+
return RNCustomerCenter.presentCustomerCenter();
|
460
|
+
}
|
461
|
+
|
320
462
|
/**
|
321
463
|
* @deprecated, Use {@link OriginalTemplatePaywallFooterContainerView} instead
|
322
464
|
*/
|