mobilyflow-react-native-sdk 0.1.1-alpha.1 → 0.1.1-alpha.13
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/MobilyflowReactNativeSdk.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/generated/java/com/mobilyflowreactnativesdk/NativeMobilyflowReactNativeSdkSpec.java +7 -3
- package/android/generated/jni/RNMobilyflowReactNativeSdkSpec-generated.cpp +8 -2
- package/android/generated/jni/react/renderer/components/RNMobilyflowReactNativeSdkSpec/RNMobilyflowReactNativeSdkSpecJSI-generated.cpp +9 -1
- package/android/generated/jni/react/renderer/components/RNMobilyflowReactNativeSdkSpec/RNMobilyflowReactNativeSdkSpecJSI.h +20 -11
- package/android/src/main/java/com/mobilyflowreactnativesdk/MobilyflowReactNativeSdkModule.kt +11 -7
- package/ios/MobilyflowReactNativeSdk.mm +56 -50
- package/ios/Utils/ParserMobilyPurchaseSDKOptions.mm +1 -1
- package/ios/generated/RNMobilyflowReactNativeSdkSpec/RNMobilyflowReactNativeSdkSpec-generated.mm +11 -4
- package/ios/generated/RNMobilyflowReactNativeSdkSpec/RNMobilyflowReactNativeSdkSpec.h +6 -2
- package/ios/generated/RNMobilyflowReactNativeSdkSpecJSI-generated.cpp +9 -1
- package/ios/generated/RNMobilyflowReactNativeSdkSpecJSI.h +20 -11
- package/lib/commonjs/MobilyPurchaseSDK.js +8 -6
- package/lib/commonjs/MobilyPurchaseSDK.js.map +1 -1
- package/lib/commonjs/NativeMobilyflowReactNativeSdk.js.map +1 -1
- package/lib/commonjs/entities/mobily-customer.js +16 -0
- package/lib/commonjs/entities/mobily-customer.js.map +1 -0
- package/lib/commonjs/entities/mobily-product.js.map +1 -1
- package/lib/commonjs/entities/mobily-subscription-offer.js.map +1 -1
- package/lib/commonjs/errors/mobily-purchase-error.js +10 -8
- package/lib/commonjs/errors/mobily-purchase-error.js.map +1 -1
- package/lib/module/MobilyPurchaseSDK.js +8 -6
- package/lib/module/MobilyPurchaseSDK.js.map +1 -1
- package/lib/module/NativeMobilyflowReactNativeSdk.js.map +1 -1
- package/lib/module/entities/mobily-customer.js +11 -0
- package/lib/module/entities/mobily-customer.js.map +1 -0
- package/lib/module/entities/mobily-product.js.map +1 -1
- package/lib/module/errors/mobily-purchase-error.js +10 -8
- package/lib/module/errors/mobily-purchase-error.js.map +1 -1
- package/lib/typescript/commonjs/src/MobilyPurchaseSDK.d.ts +4 -3
- package/lib/typescript/commonjs/src/MobilyPurchaseSDK.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativeMobilyflowReactNativeSdk.d.ts +5 -3
- package/lib/typescript/commonjs/src/NativeMobilyflowReactNativeSdk.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/entities/mobily-customer.d.ts +9 -0
- package/lib/typescript/commonjs/src/entities/mobily-customer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-product.d.ts +1 -0
- package/lib/typescript/commonjs/src/entities/mobily-product.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/entities/mobily-subscription-offer.d.ts +4 -1
- package/lib/typescript/commonjs/src/entities/mobily-subscription-offer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/errors/mobily-purchase-error.d.ts +10 -8
- package/lib/typescript/commonjs/src/errors/mobily-purchase-error.d.ts.map +1 -1
- package/lib/typescript/module/src/MobilyPurchaseSDK.d.ts +4 -3
- package/lib/typescript/module/src/MobilyPurchaseSDK.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeMobilyflowReactNativeSdk.d.ts +5 -3
- package/lib/typescript/module/src/NativeMobilyflowReactNativeSdk.d.ts.map +1 -1
- package/lib/typescript/module/src/entities/mobily-customer.d.ts +9 -0
- package/lib/typescript/module/src/entities/mobily-customer.d.ts.map +1 -0
- package/lib/typescript/module/src/entities/mobily-product.d.ts +1 -0
- package/lib/typescript/module/src/entities/mobily-product.d.ts.map +1 -1
- package/lib/typescript/module/src/entities/mobily-subscription-offer.d.ts +4 -1
- package/lib/typescript/module/src/entities/mobily-subscription-offer.d.ts.map +1 -1
- package/lib/typescript/module/src/errors/mobily-purchase-error.d.ts +10 -8
- package/lib/typescript/module/src/errors/mobily-purchase-error.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/MobilyPurchaseSDK.tsx +8 -6
- package/src/NativeMobilyflowReactNativeSdk.ts +6 -3
- package/src/entities/mobily-customer.ts +13 -0
- package/src/entities/mobily-product.ts +1 -0
- package/src/entities/mobily-subscription-offer.ts +4 -1
- package/src/errors/mobily-purchase-error.ts +4 -2
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
|
|
21
21
|
s.swift_versions = '5.0'
|
22
22
|
|
23
23
|
# Install MobilyFlow SDK
|
24
|
-
s.dependency 'MobilyflowSDK', '0.1.1-alpha.
|
24
|
+
s.dependency 'MobilyflowSDK', '0.1.1-alpha.11'
|
25
25
|
|
26
26
|
#s.subspec 'MobilyflowSDK' do |ss|
|
27
27
|
# ss.source_files = '../mobilyflow-ios-sdk/Sources/MobilyflowSDK/**/*'
|
package/android/build.gradle
CHANGED
@@ -100,7 +100,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
100
100
|
dependencies {
|
101
101
|
implementation "com.facebook.react:react-android"
|
102
102
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
103
|
-
implementation "com.mobilyflow:mobilyflow-android-sdk:0.1.1-alpha.
|
103
|
+
implementation "com.mobilyflow:mobilyflow-android-sdk:0.1.1-alpha.12"
|
104
104
|
implementation "org.jetbrains.kotlinx:kotlinx-datetime:0.6.2"
|
105
105
|
implementation "org.jetbrains.kotlin:kotlin-reflect"
|
106
106
|
}
|
package/android/generated/java/com/mobilyflowreactnativesdk/NativeMobilyflowReactNativeSdkSpec.java
CHANGED
@@ -45,7 +45,7 @@ public abstract class NativeMobilyflowReactNativeSdkSpec extends ReactContextBas
|
|
45
45
|
|
46
46
|
@ReactMethod
|
47
47
|
@DoNotStrip
|
48
|
-
public abstract void login(String uuid, String
|
48
|
+
public abstract void login(String uuid, String externalRef, Promise promise);
|
49
49
|
|
50
50
|
@ReactMethod
|
51
51
|
@DoNotStrip
|
@@ -77,7 +77,7 @@ public abstract class NativeMobilyflowReactNativeSdkSpec extends ReactContextBas
|
|
77
77
|
|
78
78
|
@ReactMethod
|
79
79
|
@DoNotStrip
|
80
|
-
public abstract void openRefundDialog(String uuid, String
|
80
|
+
public abstract void openRefundDialog(String uuid, String productId, Promise promise);
|
81
81
|
|
82
82
|
@ReactMethod
|
83
83
|
@DoNotStrip
|
@@ -93,5 +93,9 @@ public abstract class NativeMobilyflowReactNativeSdkSpec extends ReactContextBas
|
|
93
93
|
|
94
94
|
@ReactMethod
|
95
95
|
@DoNotStrip
|
96
|
-
public abstract void isForwardingEnable(String uuid, Promise promise);
|
96
|
+
public abstract void isForwardingEnable(String uuid, String externalRef, Promise promise);
|
97
|
+
|
98
|
+
@ReactMethod
|
99
|
+
@DoNotStrip
|
100
|
+
public abstract void getCustomer(String uuid, Promise promise);
|
97
101
|
}
|
@@ -84,7 +84,12 @@ static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI
|
|
84
84
|
|
85
85
|
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_isForwardingEnable(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
86
86
|
static jmethodID cachedMethodId = nullptr;
|
87
|
-
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "isForwardingEnable", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
87
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "isForwardingEnable", "(Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
88
|
+
}
|
89
|
+
|
90
|
+
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_getCustomer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
91
|
+
static jmethodID cachedMethodId = nullptr;
|
92
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "getCustomer", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
88
93
|
}
|
89
94
|
|
90
95
|
NativeMobilyflowReactNativeSdkSpecJSI::NativeMobilyflowReactNativeSdkSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
@@ -103,7 +108,8 @@ NativeMobilyflowReactNativeSdkSpecJSI::NativeMobilyflowReactNativeSdkSpecJSI(con
|
|
103
108
|
methodMap_["purchaseProduct"] = MethodMetadata {3, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_purchaseProduct};
|
104
109
|
methodMap_["sendDiagnotic"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_sendDiagnotic};
|
105
110
|
methodMap_["getStoreCountry"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_getStoreCountry};
|
106
|
-
methodMap_["isForwardingEnable"] = MethodMetadata {
|
111
|
+
methodMap_["isForwardingEnable"] = MethodMetadata {2, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_isForwardingEnable};
|
112
|
+
methodMap_["getCustomer"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_getCustomer};
|
107
113
|
}
|
108
114
|
|
109
115
|
std::shared_ptr<TurboModule> RNMobilyflowReactNativeSdkSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
@@ -113,6 +113,13 @@ static jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getSto
|
|
113
113
|
}
|
114
114
|
static jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_isForwardingEnable(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
115
115
|
return static_cast<NativeMobilyflowReactNativeSdkCxxSpecJSI *>(&turboModule)->isForwardingEnable(
|
116
|
+
rt,
|
117
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
118
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
|
119
|
+
);
|
120
|
+
}
|
121
|
+
static jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getCustomer(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
122
|
+
return static_cast<NativeMobilyflowReactNativeSdkCxxSpecJSI *>(&turboModule)->getCustomer(
|
116
123
|
rt,
|
117
124
|
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
118
125
|
);
|
@@ -134,7 +141,8 @@ NativeMobilyflowReactNativeSdkCxxSpecJSI::NativeMobilyflowReactNativeSdkCxxSpecJ
|
|
134
141
|
methodMap_["purchaseProduct"] = MethodMetadata {3, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_purchaseProduct};
|
135
142
|
methodMap_["sendDiagnotic"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_sendDiagnotic};
|
136
143
|
methodMap_["getStoreCountry"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getStoreCountry};
|
137
|
-
methodMap_["isForwardingEnable"] = MethodMetadata {
|
144
|
+
methodMap_["isForwardingEnable"] = MethodMetadata {2, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_isForwardingEnable};
|
145
|
+
methodMap_["getCustomer"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getCustomer};
|
138
146
|
}
|
139
147
|
|
140
148
|
|
@@ -130,7 +130,7 @@ protected:
|
|
130
130
|
public:
|
131
131
|
virtual jsi::String instantiate(jsi::Runtime &rt, jsi::String appId, jsi::String apiKey, double environment, std::optional<jsi::Object> options) = 0;
|
132
132
|
virtual void close(jsi::Runtime &rt, jsi::String uuid) = 0;
|
133
|
-
virtual jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
133
|
+
virtual jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) = 0;
|
134
134
|
virtual jsi::Value getProducts(jsi::Runtime &rt, jsi::String uuid, jsi::Array identifiers, bool onlyAvailable) = 0;
|
135
135
|
virtual jsi::Value getSubscriptionGroups(jsi::Runtime &rt, jsi::String uuid, jsi::Array identifiers, bool onlyAvailable) = 0;
|
136
136
|
virtual jsi::Value getEntitlementForSubscription(jsi::Runtime &rt, jsi::String uuid, jsi::String subscriptionGroupId) = 0;
|
@@ -138,11 +138,12 @@ public:
|
|
138
138
|
virtual jsi::Value getEntitlements(jsi::Runtime &rt, jsi::String uuid, jsi::Array productIds) = 0;
|
139
139
|
virtual jsi::Value requestTransferOwnership(jsi::Runtime &rt, jsi::String uuid) = 0;
|
140
140
|
virtual jsi::Value openManageSubscription(jsi::Runtime &rt, jsi::String uuid) = 0;
|
141
|
-
virtual jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
141
|
+
virtual jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String productId) = 0;
|
142
142
|
virtual jsi::Value purchaseProduct(jsi::Runtime &rt, jsi::String uuid, jsi::String productId, std::optional<jsi::Object> options) = 0;
|
143
143
|
virtual void sendDiagnotic(jsi::Runtime &rt, jsi::String uuid) = 0;
|
144
144
|
virtual jsi::Value getStoreCountry(jsi::Runtime &rt, jsi::String uuid) = 0;
|
145
|
-
virtual jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid) = 0;
|
145
|
+
virtual jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) = 0;
|
146
|
+
virtual jsi::Value getCustomer(jsi::Runtime &rt, jsi::String uuid) = 0;
|
146
147
|
|
147
148
|
};
|
148
149
|
|
@@ -189,13 +190,13 @@ private:
|
|
189
190
|
return bridging::callFromJs<void>(
|
190
191
|
rt, &T::close, jsInvoker_, instance_, std::move(uuid));
|
191
192
|
}
|
192
|
-
jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
193
|
+
jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) override {
|
193
194
|
static_assert(
|
194
195
|
bridging::getParameterCount(&T::login) == 3,
|
195
196
|
"Expected login(...) to have 3 parameters");
|
196
197
|
|
197
198
|
return bridging::callFromJs<jsi::Value>(
|
198
|
-
rt, &T::login, jsInvoker_, instance_, std::move(uuid), std::move(
|
199
|
+
rt, &T::login, jsInvoker_, instance_, std::move(uuid), std::move(externalRef));
|
199
200
|
}
|
200
201
|
jsi::Value getProducts(jsi::Runtime &rt, jsi::String uuid, jsi::Array identifiers, bool onlyAvailable) override {
|
201
202
|
static_assert(
|
@@ -253,13 +254,13 @@ private:
|
|
253
254
|
return bridging::callFromJs<jsi::Value>(
|
254
255
|
rt, &T::openManageSubscription, jsInvoker_, instance_, std::move(uuid));
|
255
256
|
}
|
256
|
-
jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
257
|
+
jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String productId) override {
|
257
258
|
static_assert(
|
258
259
|
bridging::getParameterCount(&T::openRefundDialog) == 3,
|
259
260
|
"Expected openRefundDialog(...) to have 3 parameters");
|
260
261
|
|
261
262
|
return bridging::callFromJs<jsi::Value>(
|
262
|
-
rt, &T::openRefundDialog, jsInvoker_, instance_, std::move(uuid), std::move(
|
263
|
+
rt, &T::openRefundDialog, jsInvoker_, instance_, std::move(uuid), std::move(productId));
|
263
264
|
}
|
264
265
|
jsi::Value purchaseProduct(jsi::Runtime &rt, jsi::String uuid, jsi::String productId, std::optional<jsi::Object> options) override {
|
265
266
|
static_assert(
|
@@ -285,13 +286,21 @@ private:
|
|
285
286
|
return bridging::callFromJs<jsi::Value>(
|
286
287
|
rt, &T::getStoreCountry, jsInvoker_, instance_, std::move(uuid));
|
287
288
|
}
|
288
|
-
jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid) override {
|
289
|
+
jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) override {
|
289
290
|
static_assert(
|
290
|
-
bridging::getParameterCount(&T::isForwardingEnable) ==
|
291
|
-
"Expected isForwardingEnable(...) to have
|
291
|
+
bridging::getParameterCount(&T::isForwardingEnable) == 3,
|
292
|
+
"Expected isForwardingEnable(...) to have 3 parameters");
|
292
293
|
|
293
294
|
return bridging::callFromJs<jsi::Value>(
|
294
|
-
rt, &T::isForwardingEnable, jsInvoker_, instance_, std::move(uuid));
|
295
|
+
rt, &T::isForwardingEnable, jsInvoker_, instance_, std::move(uuid), std::move(externalRef));
|
296
|
+
}
|
297
|
+
jsi::Value getCustomer(jsi::Runtime &rt, jsi::String uuid) override {
|
298
|
+
static_assert(
|
299
|
+
bridging::getParameterCount(&T::getCustomer) == 2,
|
300
|
+
"Expected getCustomer(...) to have 2 parameters");
|
301
|
+
|
302
|
+
return bridging::callFromJs<jsi::Value>(
|
303
|
+
rt, &T::getCustomer, jsInvoker_, instance_, std::move(uuid));
|
295
304
|
}
|
296
305
|
|
297
306
|
private:
|
package/android/src/main/java/com/mobilyflowreactnativesdk/MobilyflowReactNativeSdkModule.kt
CHANGED
@@ -54,10 +54,10 @@ class MobilyflowReactNativeSdkModule(reactContext: ReactApplicationContext) : Na
|
|
54
54
|
_sdkInstances[uuid]!!.close()
|
55
55
|
}
|
56
56
|
|
57
|
-
override fun login(uuid: String,
|
57
|
+
override fun login(uuid: String, externalRef: String, promise: Promise) {
|
58
58
|
try {
|
59
|
-
_sdkInstances[uuid]!!.login(
|
60
|
-
promise.resolve(
|
59
|
+
val customer = _sdkInstances[uuid]!!.login(externalRef)
|
60
|
+
promise.resolve(customer.toReadableMap())
|
61
61
|
} catch (error: Exception) {
|
62
62
|
throwError(error, promise)
|
63
63
|
}
|
@@ -126,7 +126,7 @@ class MobilyflowReactNativeSdkModule(reactContext: ReactApplicationContext) : Na
|
|
126
126
|
}
|
127
127
|
}
|
128
128
|
|
129
|
-
override fun openRefundDialog(uuid: String,
|
129
|
+
override fun openRefundDialog(uuid: String, productId: String, promise: Promise) {
|
130
130
|
promise.reject("-1", "Not implemented")
|
131
131
|
}
|
132
132
|
|
@@ -141,7 +141,7 @@ class MobilyflowReactNativeSdkModule(reactContext: ReactApplicationContext) : Na
|
|
141
141
|
val purchaseOptions = PurchaseOptions()
|
142
142
|
val offerId = options?.getString("offerId")
|
143
143
|
|
144
|
-
val product = sdk.
|
144
|
+
val product = sdk.getProductFromCacheWithId(productId)
|
145
145
|
if (product == null) {
|
146
146
|
throw MobilyPurchaseException(MobilyPurchaseException.Type.PRODUCT_UNAVAILABLE)
|
147
147
|
}
|
@@ -174,8 +174,12 @@ class MobilyflowReactNativeSdkModule(reactContext: ReactApplicationContext) : Na
|
|
174
174
|
promise.reject("-1", "Not implemented")
|
175
175
|
}
|
176
176
|
|
177
|
-
override fun isForwardingEnable(uuid: String, promise: Promise) {
|
178
|
-
promise.resolve(_sdkInstances[uuid]!!.isForwardingEnable())
|
177
|
+
override fun isForwardingEnable(uuid: String, externalRef: String, promise: Promise) {
|
178
|
+
promise.resolve(_sdkInstances[uuid]!!.isForwardingEnable(externalRef))
|
179
|
+
}
|
180
|
+
|
181
|
+
override fun getCustomer(uuid: String, promise: Promise) {
|
182
|
+
promise.resolve(_sdkInstances[uuid]!!.getCustomer())
|
179
183
|
}
|
180
184
|
|
181
185
|
companion object {
|
@@ -45,12 +45,12 @@ RCT_EXPORT_MODULE()
|
|
45
45
|
return [[self getInstance:uuid] close];
|
46
46
|
}
|
47
47
|
|
48
|
-
- (void)login:(NSString *)uuid
|
49
|
-
[[self getInstance:uuid]
|
48
|
+
- (void)login:(NSString *)uuid externalRef:(NSString *)externalRef resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
49
|
+
[[self getInstance:uuid] loginWithExternalRef:externalRef completionHandler:^(MobilyCustomer * _Nullable customer, NSError * _Nullable error) {
|
50
50
|
if (error) {
|
51
51
|
reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
|
52
52
|
} else {
|
53
|
-
resolve(
|
53
|
+
resolve([customer toDictionary]);
|
54
54
|
}
|
55
55
|
}];
|
56
56
|
}
|
@@ -133,9 +133,14 @@ RCT_EXPORT_MODULE()
|
|
133
133
|
}];
|
134
134
|
}
|
135
135
|
|
136
|
-
- (void)openRefundDialog:(NSString *)uuid
|
137
|
-
|
138
|
-
|
136
|
+
- (void)openRefundDialog:(NSString *)uuid productId:(NSString *)productId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
137
|
+
MobilyProduct* product = [[self getInstance:uuid] getProductFromCacheWithIdWithId:productId];
|
138
|
+
if (product == nil) {
|
139
|
+
reject(@"3", @"MobilyflowSDK.MobilyError.unknown_error", [NSError errorWithDomain:@"MobilyflowSDK.MobilyError" code:3 userInfo:nil]);
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
|
143
|
+
[[self getInstance:uuid] openRefundDialogWithProduct:product completionHandler:^(enum RefundDialogResult result) {
|
139
144
|
resolve([NSNumber numberWithBool:result]);
|
140
145
|
}];
|
141
146
|
}
|
@@ -143,56 +148,41 @@ RCT_EXPORT_MODULE()
|
|
143
148
|
- (void)purchaseProduct:(NSString *)uuid productId:(NSString *)productId options:(JS::NativeMobilyflowReactNativeSdk::PurchaseOptions &)options resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
144
149
|
|
145
150
|
MobilyPurchaseSDK* sdk = [self getInstance:uuid];
|
151
|
+
|
152
|
+
MobilyProduct* product = [[self getInstance:uuid] getProductFromCacheWithIdWithId:productId];
|
153
|
+
if (product == nil) {
|
154
|
+
reject(@"1", @"MobilyflowSDK.MobilyPurchaseError.product_unavailable", [NSError errorWithDomain:@"MobilyflowSDK.MobilyPurchaseError" code:1 userInfo:nil]);
|
155
|
+
return;
|
156
|
+
}
|
146
157
|
|
147
158
|
NSString *offerId = options.offerId();
|
148
159
|
int quantity = (int)options.quantity();
|
149
|
-
|
150
|
-
[sdk getProductsWithIdentifiers:nil onlyAvailable:NO completionHandler:^(NSArray<MobilyProduct *> * _Nullable products, NSError * _Nullable error) {
|
151
|
-
if (error) {
|
152
|
-
reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
|
153
|
-
} else {
|
154
|
-
PurchaseOptions *purchaseOptions = [[PurchaseOptions alloc] init];
|
155
|
-
if (quantity > 1) {
|
156
|
-
purchaseOptions = [purchaseOptions setQuantity:quantity];
|
157
|
-
}
|
158
160
|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
product = it;
|
164
|
-
|
165
|
-
if (offerId != nil) {
|
166
|
-
if ([it.subscriptionProduct.baseOffer.id isEqualToString:offerId]) {
|
167
|
-
purchaseOptions = [purchaseOptions setOffer:it.subscriptionProduct.baseOffer];
|
168
|
-
} else if (it.subscriptionProduct.freeTrial != nil && [it.subscriptionProduct.freeTrial.id isEqualToString:offerId]) {
|
169
|
-
purchaseOptions = [purchaseOptions setOffer:it.subscriptionProduct.freeTrial];
|
170
|
-
} else {
|
171
|
-
for (MobilySubscriptionOffer *off in it.subscriptionProduct.promotionalOffers) {
|
172
|
-
if ([off.id isEqualToString:offerId]) {
|
173
|
-
purchaseOptions = [purchaseOptions setOffer:off];
|
174
|
-
break;
|
175
|
-
}
|
176
|
-
}
|
177
|
-
}
|
178
|
-
}
|
161
|
+
PurchaseOptions *purchaseOptions = [[PurchaseOptions alloc] init];
|
162
|
+
if (quantity > 1) {
|
163
|
+
purchaseOptions = [purchaseOptions setQuantity:quantity];
|
164
|
+
}
|
179
165
|
|
166
|
+
if (offerId != nil) {
|
167
|
+
if ([product.subscriptionProduct.baseOffer.id isEqualToString:offerId]) {
|
168
|
+
purchaseOptions = [purchaseOptions setOffer:product.subscriptionProduct.baseOffer];
|
169
|
+
} else if (product.subscriptionProduct.freeTrial != nil && [product.subscriptionProduct.freeTrial.id isEqualToString:offerId]) {
|
170
|
+
purchaseOptions = [purchaseOptions setOffer:product.subscriptionProduct.freeTrial];
|
171
|
+
} else {
|
172
|
+
for (MobilySubscriptionOffer *off in product.subscriptionProduct.promotionalOffers) {
|
173
|
+
if ([off.id isEqualToString:offerId]) {
|
174
|
+
purchaseOptions = [purchaseOptions setOffer:off];
|
180
175
|
break;
|
181
176
|
}
|
182
177
|
}
|
178
|
+
}
|
179
|
+
}
|
183
180
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
[sdk purchaseProduct:product options:purchaseOptions completionHandler:^(enum WebhookStatus status, NSError * _Nullable error) {
|
190
|
-
if (error) {
|
191
|
-
reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
|
192
|
-
} else {
|
193
|
-
resolve([NSNumber numberWithInt:status]);
|
194
|
-
}
|
195
|
-
}];
|
181
|
+
[sdk purchaseProduct:product options:purchaseOptions completionHandler:^(enum WebhookStatus status, NSError * _Nullable error) {
|
182
|
+
if (error) {
|
183
|
+
reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
|
184
|
+
} else {
|
185
|
+
resolve([NSNumber numberWithInt:status]);
|
196
186
|
}
|
197
187
|
}];
|
198
188
|
}
|
@@ -207,9 +197,25 @@ RCT_EXPORT_MODULE()
|
|
207
197
|
}];
|
208
198
|
}
|
209
199
|
|
210
|
-
- (void)isForwardingEnable:(NSString *)uuid resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
211
|
-
|
212
|
-
|
200
|
+
- (void)isForwardingEnable:(NSString *)uuid externalRef:(NSString *)externalRef resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
201
|
+
|
202
|
+
[[self getInstance:uuid] isForwardingEnableWithExternalRef:externalRef completionHandler:^(BOOL result, NSError * _Nullable error) {
|
203
|
+
if (error) {
|
204
|
+
reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
|
205
|
+
} else {
|
206
|
+
resolve([NSNumber numberWithBool:result]);
|
207
|
+
}
|
208
|
+
}];
|
209
|
+
}
|
210
|
+
|
211
|
+
- (void)getCustomer:(NSString *)uuid resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
|
212
|
+
|
213
|
+
[[self getInstance:uuid] getCustomerWithCompletionHandler:^(MobilyCustomer * _Nullable customer, NSError * _Nullable error) {
|
214
|
+
if (error) {
|
215
|
+
reject([NSString stringWithFormat:@"%ld", error.code], error.description, error);
|
216
|
+
} else {
|
217
|
+
resolve([customer toDictionary]);
|
218
|
+
}
|
213
219
|
}];
|
214
220
|
}
|
215
221
|
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
NSString* apiURL = jsi.apiURL().length > 0 ? jsi.apiURL() : nil;
|
21
21
|
|
22
|
-
return [[MobilyPurchaseSDKOptions alloc]
|
22
|
+
return [[MobilyPurchaseSDKOptions alloc] initWithLocales:languages debug:debug apiURL:apiURL];
|
23
23
|
}
|
24
24
|
|
25
25
|
@end
|
package/ios/generated/RNMobilyflowReactNativeSdkSpec/RNMobilyflowReactNativeSdkSpec-generated.mm
CHANGED
@@ -46,7 +46,7 @@ namespace facebook::react {
|
|
46
46
|
}
|
47
47
|
|
48
48
|
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_login(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
49
|
-
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "login", @selector(login:
|
49
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "login", @selector(login:externalRef:resolve:reject:), args, count);
|
50
50
|
}
|
51
51
|
|
52
52
|
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_getProducts(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
@@ -78,7 +78,7 @@ namespace facebook::react {
|
|
78
78
|
}
|
79
79
|
|
80
80
|
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_openRefundDialog(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
81
|
-
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "openRefundDialog", @selector(openRefundDialog:
|
81
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "openRefundDialog", @selector(openRefundDialog:productId:resolve:reject:), args, count);
|
82
82
|
}
|
83
83
|
|
84
84
|
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_purchaseProduct(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
@@ -94,7 +94,11 @@ namespace facebook::react {
|
|
94
94
|
}
|
95
95
|
|
96
96
|
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_isForwardingEnable(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
97
|
-
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "isForwardingEnable", @selector(isForwardingEnable:resolve:reject:), args, count);
|
97
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "isForwardingEnable", @selector(isForwardingEnable:externalRef:resolve:reject:), args, count);
|
98
|
+
}
|
99
|
+
|
100
|
+
static facebook::jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_getCustomer(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
101
|
+
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "getCustomer", @selector(getCustomer:resolve:reject:), args, count);
|
98
102
|
}
|
99
103
|
|
100
104
|
NativeMobilyflowReactNativeSdkSpecJSI::NativeMobilyflowReactNativeSdkSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
@@ -142,7 +146,10 @@ namespace facebook::react {
|
|
142
146
|
methodMap_["getStoreCountry"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_getStoreCountry};
|
143
147
|
|
144
148
|
|
145
|
-
methodMap_["isForwardingEnable"] = MethodMetadata {
|
149
|
+
methodMap_["isForwardingEnable"] = MethodMetadata {2, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_isForwardingEnable};
|
150
|
+
|
151
|
+
|
152
|
+
methodMap_["getCustomer"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkSpecJSI_getCustomer};
|
146
153
|
|
147
154
|
}
|
148
155
|
} // namespace facebook::react
|
@@ -73,7 +73,7 @@ namespace JS {
|
|
73
73
|
options:(JS::NativeMobilyflowReactNativeSdk::MobilyPurchaseSDKOptions &)options;
|
74
74
|
- (void)close:(NSString *)uuid;
|
75
75
|
- (void)login:(NSString *)uuid
|
76
|
-
|
76
|
+
externalRef:(NSString *)externalRef
|
77
77
|
resolve:(RCTPromiseResolveBlock)resolve
|
78
78
|
reject:(RCTPromiseRejectBlock)reject;
|
79
79
|
- (void)getProducts:(NSString *)uuid
|
@@ -105,7 +105,7 @@ namespace JS {
|
|
105
105
|
resolve:(RCTPromiseResolveBlock)resolve
|
106
106
|
reject:(RCTPromiseRejectBlock)reject;
|
107
107
|
- (void)openRefundDialog:(NSString *)uuid
|
108
|
-
|
108
|
+
productId:(NSString *)productId
|
109
109
|
resolve:(RCTPromiseResolveBlock)resolve
|
110
110
|
reject:(RCTPromiseRejectBlock)reject;
|
111
111
|
- (void)purchaseProduct:(NSString *)uuid
|
@@ -118,8 +118,12 @@ namespace JS {
|
|
118
118
|
resolve:(RCTPromiseResolveBlock)resolve
|
119
119
|
reject:(RCTPromiseRejectBlock)reject;
|
120
120
|
- (void)isForwardingEnable:(NSString *)uuid
|
121
|
+
externalRef:(NSString *)externalRef
|
121
122
|
resolve:(RCTPromiseResolveBlock)resolve
|
122
123
|
reject:(RCTPromiseRejectBlock)reject;
|
124
|
+
- (void)getCustomer:(NSString *)uuid
|
125
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
126
|
+
reject:(RCTPromiseRejectBlock)reject;
|
123
127
|
|
124
128
|
@end
|
125
129
|
|
@@ -113,6 +113,13 @@ static jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getSto
|
|
113
113
|
}
|
114
114
|
static jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_isForwardingEnable(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
115
115
|
return static_cast<NativeMobilyflowReactNativeSdkCxxSpecJSI *>(&turboModule)->isForwardingEnable(
|
116
|
+
rt,
|
117
|
+
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt),
|
118
|
+
count <= 1 ? throw jsi::JSError(rt, "Expected argument in position 1 to be passed") : args[1].asString(rt)
|
119
|
+
);
|
120
|
+
}
|
121
|
+
static jsi::Value __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getCustomer(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
122
|
+
return static_cast<NativeMobilyflowReactNativeSdkCxxSpecJSI *>(&turboModule)->getCustomer(
|
116
123
|
rt,
|
117
124
|
count <= 0 ? throw jsi::JSError(rt, "Expected argument in position 0 to be passed") : args[0].asString(rt)
|
118
125
|
);
|
@@ -134,7 +141,8 @@ NativeMobilyflowReactNativeSdkCxxSpecJSI::NativeMobilyflowReactNativeSdkCxxSpecJ
|
|
134
141
|
methodMap_["purchaseProduct"] = MethodMetadata {3, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_purchaseProduct};
|
135
142
|
methodMap_["sendDiagnotic"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_sendDiagnotic};
|
136
143
|
methodMap_["getStoreCountry"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getStoreCountry};
|
137
|
-
methodMap_["isForwardingEnable"] = MethodMetadata {
|
144
|
+
methodMap_["isForwardingEnable"] = MethodMetadata {2, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_isForwardingEnable};
|
145
|
+
methodMap_["getCustomer"] = MethodMetadata {1, __hostFunction_NativeMobilyflowReactNativeSdkCxxSpecJSI_getCustomer};
|
138
146
|
}
|
139
147
|
|
140
148
|
|
@@ -130,7 +130,7 @@ protected:
|
|
130
130
|
public:
|
131
131
|
virtual jsi::String instantiate(jsi::Runtime &rt, jsi::String appId, jsi::String apiKey, double environment, std::optional<jsi::Object> options) = 0;
|
132
132
|
virtual void close(jsi::Runtime &rt, jsi::String uuid) = 0;
|
133
|
-
virtual jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
133
|
+
virtual jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) = 0;
|
134
134
|
virtual jsi::Value getProducts(jsi::Runtime &rt, jsi::String uuid, jsi::Array identifiers, bool onlyAvailable) = 0;
|
135
135
|
virtual jsi::Value getSubscriptionGroups(jsi::Runtime &rt, jsi::String uuid, jsi::Array identifiers, bool onlyAvailable) = 0;
|
136
136
|
virtual jsi::Value getEntitlementForSubscription(jsi::Runtime &rt, jsi::String uuid, jsi::String subscriptionGroupId) = 0;
|
@@ -138,11 +138,12 @@ public:
|
|
138
138
|
virtual jsi::Value getEntitlements(jsi::Runtime &rt, jsi::String uuid, jsi::Array productIds) = 0;
|
139
139
|
virtual jsi::Value requestTransferOwnership(jsi::Runtime &rt, jsi::String uuid) = 0;
|
140
140
|
virtual jsi::Value openManageSubscription(jsi::Runtime &rt, jsi::String uuid) = 0;
|
141
|
-
virtual jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
141
|
+
virtual jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String productId) = 0;
|
142
142
|
virtual jsi::Value purchaseProduct(jsi::Runtime &rt, jsi::String uuid, jsi::String productId, std::optional<jsi::Object> options) = 0;
|
143
143
|
virtual void sendDiagnotic(jsi::Runtime &rt, jsi::String uuid) = 0;
|
144
144
|
virtual jsi::Value getStoreCountry(jsi::Runtime &rt, jsi::String uuid) = 0;
|
145
|
-
virtual jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid) = 0;
|
145
|
+
virtual jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) = 0;
|
146
|
+
virtual jsi::Value getCustomer(jsi::Runtime &rt, jsi::String uuid) = 0;
|
146
147
|
|
147
148
|
};
|
148
149
|
|
@@ -189,13 +190,13 @@ private:
|
|
189
190
|
return bridging::callFromJs<void>(
|
190
191
|
rt, &T::close, jsInvoker_, instance_, std::move(uuid));
|
191
192
|
}
|
192
|
-
jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
193
|
+
jsi::Value login(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) override {
|
193
194
|
static_assert(
|
194
195
|
bridging::getParameterCount(&T::login) == 3,
|
195
196
|
"Expected login(...) to have 3 parameters");
|
196
197
|
|
197
198
|
return bridging::callFromJs<jsi::Value>(
|
198
|
-
rt, &T::login, jsInvoker_, instance_, std::move(uuid), std::move(
|
199
|
+
rt, &T::login, jsInvoker_, instance_, std::move(uuid), std::move(externalRef));
|
199
200
|
}
|
200
201
|
jsi::Value getProducts(jsi::Runtime &rt, jsi::String uuid, jsi::Array identifiers, bool onlyAvailable) override {
|
201
202
|
static_assert(
|
@@ -253,13 +254,13 @@ private:
|
|
253
254
|
return bridging::callFromJs<jsi::Value>(
|
254
255
|
rt, &T::openManageSubscription, jsInvoker_, instance_, std::move(uuid));
|
255
256
|
}
|
256
|
-
jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String
|
257
|
+
jsi::Value openRefundDialog(jsi::Runtime &rt, jsi::String uuid, jsi::String productId) override {
|
257
258
|
static_assert(
|
258
259
|
bridging::getParameterCount(&T::openRefundDialog) == 3,
|
259
260
|
"Expected openRefundDialog(...) to have 3 parameters");
|
260
261
|
|
261
262
|
return bridging::callFromJs<jsi::Value>(
|
262
|
-
rt, &T::openRefundDialog, jsInvoker_, instance_, std::move(uuid), std::move(
|
263
|
+
rt, &T::openRefundDialog, jsInvoker_, instance_, std::move(uuid), std::move(productId));
|
263
264
|
}
|
264
265
|
jsi::Value purchaseProduct(jsi::Runtime &rt, jsi::String uuid, jsi::String productId, std::optional<jsi::Object> options) override {
|
265
266
|
static_assert(
|
@@ -285,13 +286,21 @@ private:
|
|
285
286
|
return bridging::callFromJs<jsi::Value>(
|
286
287
|
rt, &T::getStoreCountry, jsInvoker_, instance_, std::move(uuid));
|
287
288
|
}
|
288
|
-
jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid) override {
|
289
|
+
jsi::Value isForwardingEnable(jsi::Runtime &rt, jsi::String uuid, jsi::String externalRef) override {
|
289
290
|
static_assert(
|
290
|
-
bridging::getParameterCount(&T::isForwardingEnable) ==
|
291
|
-
"Expected isForwardingEnable(...) to have
|
291
|
+
bridging::getParameterCount(&T::isForwardingEnable) == 3,
|
292
|
+
"Expected isForwardingEnable(...) to have 3 parameters");
|
292
293
|
|
293
294
|
return bridging::callFromJs<jsi::Value>(
|
294
|
-
rt, &T::isForwardingEnable, jsInvoker_, instance_, std::move(uuid));
|
295
|
+
rt, &T::isForwardingEnable, jsInvoker_, instance_, std::move(uuid), std::move(externalRef));
|
296
|
+
}
|
297
|
+
jsi::Value getCustomer(jsi::Runtime &rt, jsi::String uuid) override {
|
298
|
+
static_assert(
|
299
|
+
bridging::getParameterCount(&T::getCustomer) == 2,
|
300
|
+
"Expected getCustomer(...) to have 2 parameters");
|
301
|
+
|
302
|
+
return bridging::callFromJs<jsi::Value>(
|
303
|
+
rt, &T::getCustomer, jsInvoker_, instance_, std::move(uuid));
|
295
304
|
}
|
296
305
|
|
297
306
|
private:
|
@@ -12,6 +12,7 @@ var _reactNative = require("react-native");
|
|
12
12
|
var _mobilyError = require("./errors/mobily-error.js");
|
13
13
|
var _mobilyPurchaseError = require("./errors/mobily-purchase-error.js");
|
14
14
|
var _mobilyTransferOwnershipError = require("./errors/mobily-transfer-ownership-error.js");
|
15
|
+
var _mobilyCustomer = require("./entities/mobily-customer.js");
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
16
17
|
class MobilyPurchaseSDK {
|
17
18
|
constructor(appId, apiKey, environment, options) {
|
@@ -46,9 +47,10 @@ class MobilyPurchaseSDK {
|
|
46
47
|
throw this.throwError(error);
|
47
48
|
}
|
48
49
|
}
|
49
|
-
async login(
|
50
|
+
async login(externalRef) {
|
50
51
|
try {
|
51
|
-
await _NativeMobilyflowReactNativeSdk.default.login(this._uuid,
|
52
|
+
const customer = await _NativeMobilyflowReactNativeSdk.default.login(this._uuid, externalRef);
|
53
|
+
return _mobilyCustomer.MobilyCustomer.parseFromAPI(customer);
|
52
54
|
} catch (error) {
|
53
55
|
throw this.throwError(error);
|
54
56
|
}
|
@@ -107,12 +109,12 @@ class MobilyPurchaseSDK {
|
|
107
109
|
throw this.throwError(error);
|
108
110
|
}
|
109
111
|
}
|
110
|
-
async openRefundDialog(
|
112
|
+
async openRefundDialog(productId) {
|
111
113
|
if (_reactNative.Platform.OS === 'android') {
|
112
114
|
throw new Error('openRefundDialog not implemented on Android');
|
113
115
|
} else {
|
114
116
|
try {
|
115
|
-
return await _NativeMobilyflowReactNativeSdk.default.openRefundDialog(this._uuid,
|
117
|
+
return await _NativeMobilyflowReactNativeSdk.default.openRefundDialog(this._uuid, productId);
|
116
118
|
} catch (error) {
|
117
119
|
throw this.throwError(error);
|
118
120
|
}
|
@@ -146,9 +148,9 @@ class MobilyPurchaseSDK {
|
|
146
148
|
}
|
147
149
|
}
|
148
150
|
}
|
149
|
-
async isForwardingEnable() {
|
151
|
+
async isForwardingEnable(externalRef) {
|
150
152
|
try {
|
151
|
-
return await _NativeMobilyflowReactNativeSdk.default.isForwardingEnable(this._uuid);
|
153
|
+
return await _NativeMobilyflowReactNativeSdk.default.isForwardingEnable(this._uuid, externalRef);
|
152
154
|
} catch (error) {
|
153
155
|
throw this.throwError(error);
|
154
156
|
}
|