react-native-nami-sdk 3.0.9 → 3.0.10
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/.eslintignore +2 -0
- package/.eslintrc.js +12 -0
- package/.github/workflows/CI.yaml +610 -0
- package/.github/workflows/app_prod.yaml +316 -0
- package/.github/workflows/app_stg.yaml +114 -1
- package/.pre-commit-config.yaml +0 -1
- package/android/build.gradle +2 -2
- package/android/src/main/java/com/nami/reactlibrary/NamiBridgeModule.kt +5 -18
- package/android/src/main/java/com/nami/reactlibrary/NamiBridgePackage.java +0 -1
- package/android/src/main/java/com/nami/reactlibrary/NamiCampaignManagerBridge.kt +45 -27
- package/android/src/main/java/com/nami/reactlibrary/NamiCustomerManagerBridge.kt +26 -20
- package/android/src/main/java/com/nami/reactlibrary/NamiEntitlementManagerBridgeModule.kt +15 -12
- package/android/src/main/java/com/nami/reactlibrary/NamiMLManagerBridgeModule.kt +8 -0
- package/android/src/main/java/com/nami/reactlibrary/NamiPaywallManagerBridgeModule.kt +142 -95
- package/android/src/main/java/com/nami/reactlibrary/NamiPurchaseManagerBridge.kt +12 -14
- package/android/src/main/java/com/nami/reactlibrary/NamiUtil.kt +3 -47
- package/ios/Nami.m +3 -25
- package/ios/NamiCampaignManagerBridge.swift +13 -7
- package/ios/NamiCustomerManager.swift +26 -7
- package/ios/NamiEntitlementManagerBridge.swift +9 -1
- package/ios/NamiMLManagerBridge.m +0 -2
- package/ios/NamiPaywallManagerBridge.m +2 -59
- package/ios/NamiPaywallManagerBridge.swift +67 -58
- package/ios/NamiPurchaseManagerBridge.m +2 -98
- package/ios/NamiPurchaseManagerBridge.swift +45 -5
- package/ios/RNNami-Bridging-Header.h +0 -1
- package/ios/RNNami.xcodeproj/project.pbxproj +1 -62
- package/ios/RNNami.xcworkspace/contents.xcworkspacedata +0 -3
- package/package.json +14 -4
- package/react-native-nami-sdk.podspec +4 -2
- package/src/Nami.d.ts +0 -1
- package/src/NamiCustomerManager.js +2 -2
- package/src/NamiMLManager.d.ts +3 -3
- package/src/NamiMLManager.js +1 -1
- package/src/NamiPaywallManager.d.ts +11 -30
- package/src/NamiPaywallManager.js +13 -8
- package/src/NamiPurchaseManager.d.ts +7 -3
- package/src/types.ts +10 -3
- package/android/src/main/java/com/nami/reactlibrary/NamiEmitter.kt +0 -163
- package/ios/NamiBridgeUtil.h +0 -32
- package/ios/NamiBridgeUtil.m +0 -231
- package/ios/NamiEmitter.m +0 -350
- package/ios/Podfile +0 -71
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
//
|
|
2
2
|
// NamiPurchaseManagerBridge.m
|
|
3
|
-
// namiReactNative
|
|
4
3
|
//
|
|
5
|
-
// Created by Kendall Helmstetter Gelner on 12/11/19.
|
|
6
4
|
// Copyright © 2019 Nami ML Inc. All rights reserved.
|
|
7
5
|
//
|
|
8
6
|
|
|
9
7
|
#import <Foundation/Foundation.h>
|
|
10
8
|
#import <NamiApple/NamiApple.h>
|
|
11
|
-
#import "NamiBridgeUtil.h"
|
|
12
9
|
|
|
13
10
|
#import <React/RCTBridgeModule.h>
|
|
14
11
|
#import <React/RCTEventEmitter.h>
|
|
@@ -29,102 +26,9 @@ RCT_EXTERN_METHOD(registerPurchasesChangedHandler)
|
|
|
29
26
|
|
|
30
27
|
RCT_EXTERN_METHOD(registerRestorePurchasesHandler)
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
return YES;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@end
|
|
37
|
-
|
|
38
|
-
@interface NamiEmitter : RCTEventEmitter
|
|
39
|
-
- (void)sendRestorePurchasesStateChanged: (enum NamiRestorePurchasesState) state
|
|
40
|
-
newPurchases: (NSArray<NamiPurchase *> * _Nonnull) newPurchases
|
|
41
|
-
oldPurchases: (NSArray<NamiPurchase *> * _Nonnull) oldPurchases
|
|
42
|
-
error: (NSError * _Nullable) error;
|
|
43
|
-
- (NSDictionary *)buildRestorePurchasesStateChangedDict: (enum NamiRestorePurchasesState) state
|
|
44
|
-
newPurchases: (NSArray<NamiPurchase *> * _Nonnull) newPurchases
|
|
45
|
-
oldPurchases: (NSArray<NamiPurchase *> * _Nonnull) oldPurchases
|
|
46
|
-
error: (NSError * _Nullable) error;
|
|
47
|
-
+ (NamiEmitter *) reactInstance;
|
|
48
|
-
@end
|
|
49
|
-
|
|
50
|
-
@interface NamiPurchaseManagerBridge : NSObject <RCTBridgeModule>
|
|
51
|
-
@end
|
|
52
|
-
@implementation NamiPurchaseManagerBridge (RCTExternModule)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
RCT_EXTERN_METHOD(clearBypassStorePurchases)
|
|
56
|
-
- (void)clearBypassStorePurchases {
|
|
57
|
-
[NamiPurchaseManager clearBypassStorePurchases];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
RCT_EXPORT_METHOD(restorePurchasesWithCompletionHandler:(RCTResponseSenderBlock)completion)
|
|
62
|
-
{
|
|
63
|
-
NSLog(@"NamiBridge: Info: Calling RestorePurchasesWithCompletionHandler");
|
|
64
|
-
|
|
65
|
-
[NamiPurchaseManager restorePurchasesWithStatehandler:^(enum NamiRestorePurchasesState state, NSArray<NamiPurchase *> * _Nonnull newPurchases, NSArray<NamiPurchase *> * _Nonnull oldPurchases, NSError * _Nullable error) {
|
|
66
|
-
NSDictionary *retDict = [[NamiEmitter reactInstance] buildRestorePurchasesStateChangedDict:state newPurchases:newPurchases oldPurchases:oldPurchases error:error];
|
|
67
|
-
completion(@[retDict]);
|
|
68
|
-
}];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
RCT_EXPORT_METHOD(restorePurchases)
|
|
72
|
-
{
|
|
73
|
-
NSLog(@"NamiBridge: Info: Calling RestorePurchases");
|
|
74
|
-
|
|
75
|
-
[NamiPurchaseManager restorePurchasesWithStatehandler:^(enum NamiRestorePurchasesState state, NSArray<NamiPurchase *> * _Nonnull newPurchases, NSArray<NamiPurchase *> * _Nonnull oldPurchases, NSError * _Nullable error) {
|
|
76
|
-
[[NamiEmitter reactInstance] sendRestorePurchasesStateChanged:state newPurchases:newPurchases oldPurchases:oldPurchases error:error];
|
|
77
|
-
}];
|
|
78
|
-
}
|
|
29
|
+
RCT_EXTERN_METHOD(presentCodeRedemptionSheet)
|
|
79
30
|
|
|
80
|
-
|
|
81
|
-
/// For consumable purchases, removes the SKU from Nami so a product may be purchased again.
|
|
82
|
-
RCT_EXPORT_METHOD(presentCodeRedemptionSheet)
|
|
83
|
-
{
|
|
84
|
-
if (@available(iOS 14.0, *)) {
|
|
85
|
-
[NamiPurchaseManager presentCodeRedemptionSheet];
|
|
86
|
-
} else {
|
|
87
|
-
NSLog(@"NamiBridge: Warning: presentCodeRedemptionSheet only present in iOS14 and higher");
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
RCT_EXPORT_METHOD(canPresentCodeRedemptionSheet:(RCTResponseSenderBlock)completion)
|
|
92
|
-
{
|
|
93
|
-
if (@available(iOS 14.0, *)) {
|
|
94
|
-
completion(@[[NSNumber numberWithBool:true]]);
|
|
95
|
-
} else {
|
|
96
|
-
completion(@[[NSNumber numberWithBool:false]]);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/// This method does the purchase work, and can optionally be fed a paywall metadata object to pass along to the purchase flow.
|
|
101
|
-
//- (void) doSKUPurchaseWithSKUID:(nonnull NSString*)skuID namiPaywall:(NamiPaywall * _Nullable)namiPaywall completion:(RCTResponseSenderBlock)completion {
|
|
102
|
-
// [NamiPurchaseManager skusForSKUIdsWithSkuIds:@[skuID] productHandler:^(BOOL success, NSArray<NamiSKU *> * _Nullable products, NSArray<NSString *> * _Nullable invalidProducts, NSError * _Nullable error) {
|
|
103
|
-
// NSLog(@"NamiBridge: Info: Products found are %@, product fetch error is %@", products, [error localizedDescription]);
|
|
104
|
-
// NamiSKU *useProduct = products.firstObject;
|
|
105
|
-
// if (useProduct != nil) {
|
|
106
|
-
// [NamiPurchaseManager buySku:useProduct responseHandler:^(NSArray<NamiPurchase *> * _Nonnull purchase, enum NamiPurchaseState purchaseState, NSError * _Nullable error) {
|
|
107
|
-
// NSLog(@"NamiBridge: Info: Purchase result is %@, purchased is %d, purchaseState is %@, error is %@", purchase, (purchaseState == NamiPurchaseStatePurchased), [NSNumber numberWithInt:(int)purchaseState], [error localizedDescription]);
|
|
108
|
-
// if (purchaseState == NamiPurchaseStatePurchased) {
|
|
109
|
-
// completion(@[[NSNumber numberWithBool:true]]);
|
|
110
|
-
// }
|
|
111
|
-
// }];
|
|
112
|
-
// } else {
|
|
113
|
-
// completion(@[[NSNumber numberWithBool:false]]);
|
|
114
|
-
// }
|
|
115
|
-
// }];
|
|
116
|
-
//
|
|
117
|
-
//}
|
|
118
|
-
|
|
119
|
-
@end
|
|
120
|
-
|
|
121
|
-
@implementation NamiPurchaseManagerBridge
|
|
122
|
-
RCT_EXPORT_MODULE_NO_LOAD(NamiPurchaseManagerBridge, NamiPurchaseManagerBridge)
|
|
123
|
-
|
|
124
|
-
- (dispatch_queue_t)methodQueue
|
|
125
|
-
{
|
|
126
|
-
return dispatch_get_main_queue();
|
|
127
|
-
}
|
|
31
|
+
RCT_EXTERN_METHOD(restorePurchases)
|
|
128
32
|
|
|
129
33
|
+ (BOOL)requiresMainQueueSetup {
|
|
130
34
|
return YES;
|
|
@@ -11,6 +11,13 @@ import React
|
|
|
11
11
|
|
|
12
12
|
@objc(RNNamiPurchaseManager)
|
|
13
13
|
class RNNamiPurchaseManager: RCTEventEmitter {
|
|
14
|
+
public static var shared: RNNamiPurchaseManager?
|
|
15
|
+
|
|
16
|
+
override init() {
|
|
17
|
+
super.init()
|
|
18
|
+
RNNamiPurchaseManager.shared = self
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
override func supportedEvents() -> [String]! {
|
|
15
22
|
return ["PurchasesChanged", "RestorePurchasesStateChanged"]
|
|
16
23
|
}
|
|
@@ -47,12 +54,10 @@ class RNNamiPurchaseManager: RCTEventEmitter {
|
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
let skuDict: [String: Any?] = [
|
|
50
|
-
"
|
|
57
|
+
"id": sku.id,
|
|
51
58
|
"skuId": sku.skuId,
|
|
52
59
|
"type": typeString,
|
|
53
|
-
"
|
|
54
|
-
// "displayText": sku.localizedDisplayText,
|
|
55
|
-
// "displaySubText": sku.localizedSubDisplayText,
|
|
60
|
+
"appleProduct": productDict,
|
|
56
61
|
]
|
|
57
62
|
|
|
58
63
|
return NSDictionary(dictionary: skuDict.compactMapValues { $0 })
|
|
@@ -68,6 +73,7 @@ class RNNamiPurchaseManager: RCTEventEmitter {
|
|
|
68
73
|
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"
|
|
69
74
|
let expiresString = dateFormatter.string(from: purchase.expires ?? Date())
|
|
70
75
|
let purchaseInitiatedString = dateFormatter.string(from: purchase.purchaseInitiatedTimestamp)
|
|
76
|
+
|
|
71
77
|
let purchaseDict: [String: Any?] = [
|
|
72
78
|
"skuId": purchase.skuId,
|
|
73
79
|
"transactionIdentifier": purchase.transactionIdentifier,
|
|
@@ -168,7 +174,41 @@ class RNNamiPurchaseManager: RCTEventEmitter {
|
|
|
168
174
|
"newPurchases": newPurchasesDictionaries,
|
|
169
175
|
"oldPurchases": oldPurchasesDictionaries,
|
|
170
176
|
]
|
|
171
|
-
|
|
177
|
+
RNNamiPurchaseManager.shared?.sendEvent(withName: "RestorePurchasesStateChanged", body: payload)
|
|
172
178
|
}
|
|
173
179
|
}
|
|
180
|
+
|
|
181
|
+
@objc(restorePurchases)
|
|
182
|
+
func restorePurchases() {
|
|
183
|
+
NamiPurchaseManager.restorePurchases { state, newPurchases, oldPurchases, _ in
|
|
184
|
+
let stateString: String
|
|
185
|
+
switch state {
|
|
186
|
+
case .started:
|
|
187
|
+
stateString = "started"
|
|
188
|
+
case .finished:
|
|
189
|
+
stateString = "finished"
|
|
190
|
+
case .error:
|
|
191
|
+
stateString = "error"
|
|
192
|
+
@unknown default:
|
|
193
|
+
stateString = "error"
|
|
194
|
+
}
|
|
195
|
+
let newPurchasesDictionaries = newPurchases.map { purchase in
|
|
196
|
+
RNNamiPurchaseManager.purchaseToPurchaseDict(purchase)
|
|
197
|
+
}
|
|
198
|
+
let oldPurchasesDictionaries = oldPurchases.map { purchase in
|
|
199
|
+
RNNamiPurchaseManager.purchaseToPurchaseDict(purchase)
|
|
200
|
+
}
|
|
201
|
+
let payload: [String: Any?] = [
|
|
202
|
+
"state": stateString,
|
|
203
|
+
"newPurchases": newPurchasesDictionaries,
|
|
204
|
+
"oldPurchases": oldPurchasesDictionaries,
|
|
205
|
+
]
|
|
206
|
+
RNNamiPurchaseManager.shared?.sendEvent(withName: "RestorePurchasesStateChanged", body: payload)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@objc(presentCodeRedemptionSheet)
|
|
211
|
+
func presentCodeRedemptionSheet() {
|
|
212
|
+
NamiPurchaseManager.presentCodeRedemptionSheet()
|
|
213
|
+
}
|
|
174
214
|
}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
-
86FA58043F9BC23498A02E29 /* libPods-RNNami.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D38955F0C8C312F217C02595 /* libPods-RNNami.a */; };
|
|
11
10
|
B3E7B58A1CC2AC0600A0062D /* RNNami.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNNami.m */; };
|
|
12
11
|
EB1C9AFB23BE9C5700CAD548 /* NamiPurchaseManagerBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = EB1C9AF823BE9C5600CAD548 /* NamiPurchaseManagerBridge.m */; };
|
|
13
12
|
EB1C9AFC23BE9C5700CAD548 /* NamiPaywallManagerBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = EB1C9AF923BE9C5600CAD548 /* NamiPaywallManagerBridge.m */; };
|
|
@@ -38,12 +37,9 @@
|
|
|
38
37
|
/* End PBXCopyFilesBuildPhase section */
|
|
39
38
|
|
|
40
39
|
/* Begin PBXFileReference section */
|
|
41
|
-
134814201AA4EA6300B7C361 /* libRNNami.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNNami.a; sourceTree =
|
|
42
|
-
5C0ED6F1EABFB69B20A67C29 /* Pods-RNNami.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNNami.debug.xcconfig"; path = "Target Support Files/Pods-RNNami/Pods-RNNami.debug.xcconfig"; sourceTree = "<group>"; };
|
|
43
|
-
90B290F36EAE177CDC017BA3 /* Pods-RNNami.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNNami.release.xcconfig"; path = "Target Support Files/Pods-RNNami/Pods-RNNami.release.xcconfig"; sourceTree = "<group>"; };
|
|
40
|
+
134814201AA4EA6300B7C361 /* libRNNami.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libRNNami.a; path = "/Users/dannami/Nami/Source/react-native-nami-sdk/ios/build/Debug-iphoneos/libRNNami.a"; sourceTree = "<absolute>"; };
|
|
44
41
|
B3E7B5881CC2AC0600A0062D /* RNNami.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNNami.h; sourceTree = "<group>"; };
|
|
45
42
|
B3E7B5891CC2AC0600A0062D /* RNNami.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNNami.m; sourceTree = "<group>"; };
|
|
46
|
-
D38955F0C8C312F217C02595 /* libPods-RNNami.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNNami.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
47
43
|
EB1C9AF823BE9C5600CAD548 /* NamiPurchaseManagerBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NamiPurchaseManagerBridge.m; sourceTree = "<group>"; };
|
|
48
44
|
EB1C9AF923BE9C5600CAD548 /* NamiPaywallManagerBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NamiPaywallManagerBridge.m; sourceTree = "<group>"; };
|
|
49
45
|
EB1C9AFA23BE9C5700CAD548 /* NamiEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NamiEmitter.m; sourceTree = "<group>"; };
|
|
@@ -67,21 +63,12 @@
|
|
|
67
63
|
isa = PBXFrameworksBuildPhase;
|
|
68
64
|
buildActionMask = 2147483647;
|
|
69
65
|
files = (
|
|
70
|
-
86FA58043F9BC23498A02E29 /* libPods-RNNami.a in Frameworks */,
|
|
71
66
|
);
|
|
72
67
|
runOnlyForDeploymentPostprocessing = 0;
|
|
73
68
|
};
|
|
74
69
|
/* End PBXFrameworksBuildPhase section */
|
|
75
70
|
|
|
76
71
|
/* Begin PBXGroup section */
|
|
77
|
-
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
78
|
-
isa = PBXGroup;
|
|
79
|
-
children = (
|
|
80
|
-
134814201AA4EA6300B7C361 /* libRNNami.a */,
|
|
81
|
-
);
|
|
82
|
-
name = Products;
|
|
83
|
-
sourceTree = "<group>";
|
|
84
|
-
};
|
|
85
72
|
58B511D21A9E6C8500147676 = {
|
|
86
73
|
isa = PBXGroup;
|
|
87
74
|
children = (
|
|
@@ -98,29 +85,9 @@
|
|
|
98
85
|
EBC59E5C23C5514B008A123A /* Nami.m */,
|
|
99
86
|
EB1C9AFA23BE9C5700CAD548 /* NamiEmitter.m */,
|
|
100
87
|
EBEEAC0F243C29C800E01389 /* NamiMLManagerBridge.m */,
|
|
101
|
-
134814211AA4EA7D00B7C361 /* Products */,
|
|
102
|
-
82475599A9F3B58440ACDC6E /* Frameworks */,
|
|
103
|
-
A17A44E9FF56BDEADE788165 /* Pods */,
|
|
104
88
|
);
|
|
105
89
|
sourceTree = "<group>";
|
|
106
90
|
};
|
|
107
|
-
82475599A9F3B58440ACDC6E /* Frameworks */ = {
|
|
108
|
-
isa = PBXGroup;
|
|
109
|
-
children = (
|
|
110
|
-
D38955F0C8C312F217C02595 /* libPods-RNNami.a */,
|
|
111
|
-
);
|
|
112
|
-
name = Frameworks;
|
|
113
|
-
sourceTree = "<group>";
|
|
114
|
-
};
|
|
115
|
-
A17A44E9FF56BDEADE788165 /* Pods */ = {
|
|
116
|
-
isa = PBXGroup;
|
|
117
|
-
children = (
|
|
118
|
-
5C0ED6F1EABFB69B20A67C29 /* Pods-RNNami.debug.xcconfig */,
|
|
119
|
-
90B290F36EAE177CDC017BA3 /* Pods-RNNami.release.xcconfig */,
|
|
120
|
-
);
|
|
121
|
-
path = Pods;
|
|
122
|
-
sourceTree = "<group>";
|
|
123
|
-
};
|
|
124
91
|
FA3AB38329E009D200FD2E8D /* NamiPaywallManager */ = {
|
|
125
92
|
isa = PBXGroup;
|
|
126
93
|
children = (
|
|
@@ -173,7 +140,6 @@
|
|
|
173
140
|
isa = PBXNativeTarget;
|
|
174
141
|
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNNami" */;
|
|
175
142
|
buildPhases = (
|
|
176
|
-
D4E4645754B75DF6DB7C7A3E /* [CP] Check Pods Manifest.lock */,
|
|
177
143
|
58B511D71A9E6C8500147676 /* Sources */,
|
|
178
144
|
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
179
145
|
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
@@ -220,31 +186,6 @@
|
|
|
220
186
|
};
|
|
221
187
|
/* End PBXProject section */
|
|
222
188
|
|
|
223
|
-
/* Begin PBXShellScriptBuildPhase section */
|
|
224
|
-
D4E4645754B75DF6DB7C7A3E /* [CP] Check Pods Manifest.lock */ = {
|
|
225
|
-
isa = PBXShellScriptBuildPhase;
|
|
226
|
-
buildActionMask = 2147483647;
|
|
227
|
-
files = (
|
|
228
|
-
);
|
|
229
|
-
inputFileListPaths = (
|
|
230
|
-
);
|
|
231
|
-
inputPaths = (
|
|
232
|
-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
|
233
|
-
"${PODS_ROOT}/Manifest.lock",
|
|
234
|
-
);
|
|
235
|
-
name = "[CP] Check Pods Manifest.lock";
|
|
236
|
-
outputFileListPaths = (
|
|
237
|
-
);
|
|
238
|
-
outputPaths = (
|
|
239
|
-
"$(DERIVED_FILE_DIR)/Pods-RNNami-checkManifestLockResult.txt",
|
|
240
|
-
);
|
|
241
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
242
|
-
shellPath = /bin/sh;
|
|
243
|
-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
244
|
-
showEnvVarsInLog = 0;
|
|
245
|
-
};
|
|
246
|
-
/* End PBXShellScriptBuildPhase section */
|
|
247
|
-
|
|
248
189
|
/* Begin PBXSourcesBuildPhase section */
|
|
249
190
|
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
250
191
|
isa = PBXSourcesBuildPhase;
|
|
@@ -356,7 +297,6 @@
|
|
|
356
297
|
};
|
|
357
298
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
358
299
|
isa = XCBuildConfiguration;
|
|
359
|
-
baseConfigurationReference = 5C0ED6F1EABFB69B20A67C29 /* Pods-RNNami.debug.xcconfig */;
|
|
360
300
|
buildSettings = {
|
|
361
301
|
CLANG_ENABLE_MODULES = YES;
|
|
362
302
|
HEADER_SEARCH_PATHS = (
|
|
@@ -379,7 +319,6 @@
|
|
|
379
319
|
};
|
|
380
320
|
58B511F11A9E6C8500147676 /* Release */ = {
|
|
381
321
|
isa = XCBuildConfiguration;
|
|
382
|
-
baseConfigurationReference = 90B290F36EAE177CDC017BA3 /* Pods-RNNami.release.xcconfig */;
|
|
383
322
|
buildSettings = {
|
|
384
323
|
CLANG_ENABLE_MODULES = YES;
|
|
385
324
|
HEADER_SEARCH_PATHS = (
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-nami-sdk",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "React Native Module for Nami - Easy subscriptions & in-app purchases, with powerful built-in paywalls and A/B testing.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -41,14 +41,24 @@
|
|
|
41
41
|
}
|
|
42
42
|
],
|
|
43
43
|
"license": "SEE LICENSE FILE",
|
|
44
|
+
"standard": {
|
|
45
|
+
"ignore": [
|
|
46
|
+
"examples/*"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
44
49
|
"peerDependencies": {
|
|
45
|
-
"react": "
|
|
46
|
-
"react-native": "
|
|
50
|
+
"react": ">=17",
|
|
51
|
+
"react-native": ">=0.65"
|
|
47
52
|
},
|
|
48
53
|
"devDependencies": {
|
|
54
|
+
"@react-native-community/eslint-config": "^3.2.0",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
|
56
|
+
"eslint": "^8.41.0",
|
|
57
|
+
"prettier": "^2.8.7",
|
|
49
58
|
"react": "^17.0.2",
|
|
50
59
|
"react-native": "^0.65.2",
|
|
51
|
-
"react-native-codegen": "^0.0.12"
|
|
60
|
+
"react-native-codegen": "^0.0.12",
|
|
61
|
+
"typescript": "^5.0.2"
|
|
52
62
|
},
|
|
53
63
|
"repository": {
|
|
54
64
|
"type": "git",
|
|
@@ -13,12 +13,14 @@ Pod::Spec.new do |s|
|
|
|
13
13
|
s.homepage = package['homepage']
|
|
14
14
|
s.license = package['license']
|
|
15
15
|
|
|
16
|
-
s.
|
|
16
|
+
s.platforms = { :ios => "14.0", :tvos => "15.0" }
|
|
17
|
+
|
|
18
|
+
|
|
17
19
|
s.source = { :git => "https://github.com/namiml/react-native-nami-sdk.git", :tag => "#{s.version}" }
|
|
18
20
|
s.source_files = "ios/**/*.{h,m,swift}"
|
|
19
21
|
s.requires_arc = true
|
|
20
22
|
|
|
21
|
-
s.dependency 'Nami', '3.0.
|
|
23
|
+
s.dependency 'Nami', '3.0.13'
|
|
22
24
|
s.dependency 'React'
|
|
23
25
|
|
|
24
26
|
end
|
package/src/Nami.d.ts
CHANGED
|
@@ -6,14 +6,14 @@ export const NamiCustomerManager = {
|
|
|
6
6
|
emitter: new NativeEventEmitter(RNNamiCustomerManager),
|
|
7
7
|
...RNNamiCustomerManager,
|
|
8
8
|
login: (customerId, callback) => {
|
|
9
|
-
if (Platform.OS === "ios") {
|
|
9
|
+
if (Platform.OS === "ios" || Platform.isTVOS) {
|
|
10
10
|
RNNamiCustomerManager.login(customerId, callback ?? (() => {}));
|
|
11
11
|
} else {
|
|
12
12
|
RNNamiCustomerManager.login(customerId);
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
logout: (callback) => {
|
|
16
|
-
if (Platform.OS === "ios") {
|
|
16
|
+
if (Platform.OS === "ios" || Platform.isTVOS) {
|
|
17
17
|
RNNamiCustomerManager.logout(callback ?? (() => {}));
|
|
18
18
|
} else {
|
|
19
19
|
RNNamiCustomerManager.logout();
|
package/src/NamiMLManager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const NamiMLManager: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
coreAction: (label: string) => void;
|
|
3
|
+
enterCoreContent: (label: string | string[]) => void;
|
|
4
|
+
exitCoreContent: (label: string | string[]) => void;
|
|
5
5
|
};
|
package/src/NamiMLManager.js
CHANGED
|
@@ -2,25 +2,20 @@ import { EmitterSubscription } from "react-native";
|
|
|
2
2
|
import { NamiSKU } from "./types";
|
|
3
3
|
|
|
4
4
|
export const NamiPaywallManager: {
|
|
5
|
-
|
|
6
|
-
buySkuCompleteAmazon: (purchaseSuccess:
|
|
5
|
+
buySkuCompleteApple: (purchaseSuccess: NamiPurchaseSuccessApple) => void;
|
|
6
|
+
buySkuCompleteAmazon: (purchaseSuccess: NamiPurchaseSuccessAmazon) => void;
|
|
7
7
|
buySkuCompleteGooglePlay: (
|
|
8
|
-
purchaseSuccess:
|
|
8
|
+
purchaseSuccess: NamiPurchaseSuccessGooglePlay
|
|
9
9
|
) => void;
|
|
10
|
-
dismiss: (animated
|
|
11
|
-
displayedViewController: () => void;
|
|
12
|
-
renderCustomUiHandler: () => any;
|
|
10
|
+
dismiss: (animated?: boolean) => void;
|
|
13
11
|
registerBuySkuHandler: (
|
|
14
12
|
callback: (sku: NamiSKU) => void
|
|
15
13
|
) => EmitterSubscription["remove"];
|
|
16
|
-
registerCloseHandler: (
|
|
17
|
-
blockDismiss: boolean,
|
|
18
|
-
callback: (resultObject: { blockingPaywallClosed: boolean }) => void
|
|
19
|
-
) => EmitterSubscription["remove"];
|
|
14
|
+
registerCloseHandler: (callback: () => void) => EmitterSubscription["remove"];
|
|
20
15
|
};
|
|
21
16
|
|
|
22
|
-
export type
|
|
23
|
-
product:
|
|
17
|
+
export type NamiPurchaseSuccessApple = {
|
|
18
|
+
product: NamiSKU;
|
|
24
19
|
transactionID: string;
|
|
25
20
|
originalTransactionID: string;
|
|
26
21
|
originalPurchaseDate: number;
|
|
@@ -31,8 +26,8 @@ export type PurchaseSuccessIos = {
|
|
|
31
26
|
locale: string;
|
|
32
27
|
};
|
|
33
28
|
|
|
34
|
-
export type
|
|
35
|
-
product:
|
|
29
|
+
export type NamiPurchaseSuccessGooglePlay = {
|
|
30
|
+
product: NamiSKU;
|
|
36
31
|
orderId: string;
|
|
37
32
|
purchaseDate: number;
|
|
38
33
|
expiresDate?: number;
|
|
@@ -40,8 +35,8 @@ export type PurchaseSuccessGooglePlay = {
|
|
|
40
35
|
purchaseSource: "CAMPAIGN" | "MARKETPLACE" | "UNKNOWN";
|
|
41
36
|
};
|
|
42
37
|
|
|
43
|
-
export type
|
|
44
|
-
product:
|
|
38
|
+
export type NamiPurchaseSuccessAmazon = {
|
|
39
|
+
product: NamiSKU;
|
|
45
40
|
purchaseDate: number;
|
|
46
41
|
expiresDate?: number;
|
|
47
42
|
purchaseSource: "CAMPAIGN" | "MARKETPLACE" | "UNKNOWN";
|
|
@@ -51,19 +46,6 @@ export type PurchaseSuccessAmazon = {
|
|
|
51
46
|
marketplace: string;
|
|
52
47
|
};
|
|
53
48
|
|
|
54
|
-
export type PurchaseSuccessProduct = {
|
|
55
|
-
id: string;
|
|
56
|
-
platformID: string;
|
|
57
|
-
skuId: string;
|
|
58
|
-
languageCode: string;
|
|
59
|
-
name: string;
|
|
60
|
-
featured: boolean;
|
|
61
|
-
storeId: string;
|
|
62
|
-
type: number;
|
|
63
|
-
isFeatured: boolean;
|
|
64
|
-
namiID: string;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
49
|
export enum NamiPaywallAction {
|
|
68
50
|
BUY_SKU = "BUY_SKU",
|
|
69
51
|
SELECT_SKU = "SELECT_SKU",
|
|
@@ -78,5 +60,4 @@ export enum NamiPaywallAction {
|
|
|
78
60
|
PURCHASE_PENDING = "PURCHASE_PENDING",
|
|
79
61
|
PURCHASE_UNKNOWN = "PURCHASE_UNKNOWN",
|
|
80
62
|
PURCHASE_DEFERRED = "PURCHASE_DEFERRED",
|
|
81
|
-
SHOW_PAYWALL = "SHOW_PAYWALL",
|
|
82
63
|
}
|
|
@@ -6,7 +6,7 @@ export const NamiPaywallManager = {
|
|
|
6
6
|
paywallEmitter: new NativeEventEmitter(RNNamiPaywallManager),
|
|
7
7
|
...RNNamiPaywallManager,
|
|
8
8
|
...NamiPaywallManagerBridge,
|
|
9
|
-
|
|
9
|
+
buySkuCompleteApple(purchaseSuccess) {
|
|
10
10
|
RNNamiPaywallManager.buySkuComplete(purchaseSuccess);
|
|
11
11
|
},
|
|
12
12
|
buySkuCompleteAmazon(purchaseSuccess) {
|
|
@@ -18,20 +18,25 @@ export const NamiPaywallManager = {
|
|
|
18
18
|
registerBuySkuHandler(callback) {
|
|
19
19
|
var subscription = this.paywallEmitter.addListener(
|
|
20
20
|
"RegisterBuySKU",
|
|
21
|
-
|
|
21
|
+
(sku) => {
|
|
22
|
+
callback(sku);
|
|
23
|
+
}
|
|
22
24
|
);
|
|
23
25
|
RNNamiPaywallManager.registerBuySkuHandler();
|
|
24
26
|
return subscription.remove;
|
|
25
27
|
},
|
|
26
|
-
registerCloseHandler(
|
|
28
|
+
registerCloseHandler(callback) {
|
|
27
29
|
var subscription;
|
|
28
30
|
subscription = this.paywallEmitter.addListener(
|
|
29
|
-
"
|
|
30
|
-
() => {
|
|
31
|
-
|
|
32
|
-
callback();
|
|
31
|
+
"PaywallCloseRequested",
|
|
32
|
+
(body) => {
|
|
33
|
+
callback(body);
|
|
33
34
|
}
|
|
34
35
|
);
|
|
35
|
-
RNNamiPaywallManager.registerCloseHandler(
|
|
36
|
+
RNNamiPaywallManager.registerCloseHandler();
|
|
37
|
+
return subscription.remove;
|
|
38
|
+
},
|
|
39
|
+
dismiss(animated) {
|
|
40
|
+
RNNamiPaywallManager.dismiss(animated ?? true);
|
|
36
41
|
},
|
|
37
42
|
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { EmitterSubscription } from "react-native";
|
|
2
2
|
import { NamiSKU } from "./types";
|
|
3
|
-
import { NamiEntitlement } from "./NamiEntitlementManager";
|
|
4
3
|
|
|
5
4
|
export const NamiPurchaseManager: {
|
|
6
5
|
allPurchases: () => NamiPurchase[];
|
|
7
6
|
anySkuPurchased: (skuIds: string[]) => boolean;
|
|
8
7
|
consumePurchasedSku: (skuId: string) => void;
|
|
9
|
-
clearBypassStorePurchases: () => void;
|
|
10
8
|
presentCodeRedemptionSheet: () => void;
|
|
11
|
-
restorePurchases: (
|
|
9
|
+
restorePurchases: (
|
|
10
|
+
callback: (
|
|
11
|
+
purchaseState: NamiPurchasesState,
|
|
12
|
+
purchases: NamiPurchase[],
|
|
13
|
+
error: string
|
|
14
|
+
) => void
|
|
15
|
+
) => EmitterSubscription["remove"];
|
|
12
16
|
skuPurchased: (skuId: string) => boolean;
|
|
13
17
|
registerPurchasesChangedHandler: (
|
|
14
18
|
callback: (
|
package/src/types.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export type NamiSKU = {
|
|
2
|
-
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
3
4
|
skuId: string;
|
|
4
|
-
|
|
5
|
+
appleProduct?: AppleProduct;
|
|
6
|
+
googleProduct?: GoogleProduct;
|
|
7
|
+
amazonProduct?: AmazonProduct;
|
|
5
8
|
type: NamiSKUType;
|
|
6
9
|
};
|
|
7
10
|
|
|
@@ -25,7 +28,7 @@ export enum NamiRestorePurchasesState {
|
|
|
25
28
|
|
|
26
29
|
export type NamiSKUType = "unknown" | "one_time_purchase" | "subscription";
|
|
27
30
|
|
|
28
|
-
export type
|
|
31
|
+
export type AppleProduct = {
|
|
29
32
|
localizedDescription: string;
|
|
30
33
|
localizedMultipliedPrice: string;
|
|
31
34
|
localizedPrice: string;
|
|
@@ -34,3 +37,7 @@ export type SKProduct = {
|
|
|
34
37
|
priceCurrency: string;
|
|
35
38
|
priceLanguage: string;
|
|
36
39
|
};
|
|
40
|
+
|
|
41
|
+
export type GoogleProduct = {};
|
|
42
|
+
|
|
43
|
+
export type AmazonProduct = {};
|