react-native-shield-fraud-plugin 1.0.4 → 1.0.5
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/README.md +56 -1
- package/android/src/main/java/com/shieldfraudplugin/ShieldFraudPluginModule.java +2 -1
- package/ios/ShieldFraudPlugin.m +7 -8
- package/ios/ShieldFraudPlugin.xcodeproj/project.xcworkspace/xcuserdata/deepakraj.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/ShieldFraudPlugin.xcodeproj/xcuserdata/deepakraj.xcuserdatad/xcschemes/xcschememanagement.plist +1 -1
- package/lib/commonjs/index.js +18 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +18 -4
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +7 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +19 -5
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ React Native Plugin for Shield Fraud (www.shield.com)
|
|
|
4
4
|
|
|
5
5
|
React Native Shield Fraud Plugin helps developers to assess malicious activities performed on mobile devices and return risk intelligence based on user's behaviour. It collects device's fingerprint, social metrics and network information.
|
|
6
6
|
|
|
7
|
-
There are
|
|
7
|
+
There are few steps to getting started with the SHIELD SDK:
|
|
8
8
|
|
|
9
9
|
1. [Integrate the SDK](#integrate-the-sdk)
|
|
10
10
|
|
|
@@ -16,6 +16,9 @@ There are four steps to getting started with the SHIELD SDK:
|
|
|
16
16
|
|
|
17
17
|
5. [Send Custom Attributes](#send-custom-attributes)
|
|
18
18
|
|
|
19
|
+
6. [Migration from BRIDGE CODE to PLUGIN](#migration-from-bridge-code-to-plugin)
|
|
20
|
+
|
|
21
|
+
|
|
19
22
|
|
|
20
23
|
### Integrate the SDK
|
|
21
24
|
|
|
@@ -158,4 +161,56 @@ ShieldFraud.isSDKready(async (isReady: boolean) => {
|
|
|
158
161
|
}
|
|
159
162
|
```
|
|
160
163
|
|
|
164
|
+
### Migration from BRIDGE CODE to PLUGIN
|
|
165
|
+
If you've been using the old method of integrating the React Native bridge code for the Shield Fraud SDK on iOS and Android, follow these steps to migrate to our plugin.
|
|
166
|
+
|
|
167
|
+
#### iOS Migration Steps
|
|
168
|
+
|
|
169
|
+
**1. Remove Old Pod Dependency:**
|
|
170
|
+
Open your iOS project's Podfile and remove the line `pod 'ShieldFraud'`. Then, in your project's root directory, run `pod deintegrate` followed by `pod install` to ensure the old ShieldFraud dependency is completely removed.
|
|
171
|
+
|
|
172
|
+
**2. Remove Old Bridge Code Files:**
|
|
173
|
+
In your Xcode project's file explorer, locate and remove the files `ShieldModule.h` and `ShieldModule.m`. Remove all these references as they are no longer needed.
|
|
174
|
+
|
|
175
|
+
**3. Clean the Project:**
|
|
176
|
+
Open your Xcode project. Go to `"Product"` in the top menu and select `"Clean Build Folder"` to make sure any residual build artifacts related to the old ShieldFraud library are removed.
|
|
177
|
+
|
|
178
|
+
**4. Update React Native Project:**
|
|
179
|
+
In your React Native project, search for any code that references the old `ShieldModule`. Remove all these references as they are no longer needed.
|
|
180
|
+
|
|
181
|
+
**5. Follow Plugin Integration Steps:**
|
|
182
|
+
Now that you've cleaned up the old bridge code, follow the integration steps outlined in the documentation under "Integrate the SDK" section, starting from the step of installing the plugin using npm or yarn.
|
|
183
|
+
|
|
184
|
+
#### Android Migration Steps
|
|
185
|
+
If you've been using the old method of integrating the React Native bridge code for the Shield Fraud SDK on Android, follow these steps to migrate to our plugin.
|
|
186
|
+
|
|
187
|
+
**1. Remove Old Dependencies:**
|
|
188
|
+
In your `app/build.gradle` file, locate and remove the line:
|
|
189
|
+
```
|
|
190
|
+
implementation 'com.shield.android:shield-fraud:1.5.+'
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**2. Update Android Settings:**
|
|
194
|
+
In your `settings.gradle` or project level `build.gradle` file from the `repositories` block, locate and remove the `maven url`:
|
|
195
|
+
```
|
|
196
|
+
allprojects {
|
|
197
|
+
repositories {
|
|
198
|
+
maven {
|
|
199
|
+
url "https://cashshield-sdk.s3.amazonaws.com/release/"
|
|
200
|
+
}
|
|
201
|
+
...
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
This is the maven url that you no longer need with the new plugin approach.
|
|
206
|
+
|
|
207
|
+
**3. Remove Old Bridge Code:**
|
|
208
|
+
In your Android project, if you have a ShieldModule.java file as part of the old bridge code integration, you can safely remove it.
|
|
209
|
+
|
|
210
|
+
**4. Update React Native Project:**
|
|
211
|
+
In your React Native project, search for any code that references the old ShieldModule in Java code. Also remove ShieldModule from ReactPackage, Remove all these references as they are no longer needed.
|
|
212
|
+
|
|
213
|
+
**5. Follow Plugin Integration Steps:**
|
|
214
|
+
Now that you've cleaned up the old bridge code, follow the integration steps outlined in the documentation under "Integrate the SDK" section, starting from the step of installing the plugin using npm or yarn.
|
|
161
215
|
|
|
216
|
+
By following these steps, you'll successfully migrate your React Native project from the old bridge code integration to the new Shield Fraud plugin. This migration will make your project more maintainable and allow you to take advantage of the new features and improvements offered by the plugin.
|
|
@@ -42,7 +42,8 @@ public class ShieldFraudPluginModule extends ReactContextBaseJavaModule implemen
|
|
|
42
42
|
return NAME;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
46
|
+
public boolean isShieldInitialized() {
|
|
46
47
|
try {
|
|
47
48
|
return Shield.getInstance() != null;
|
|
48
49
|
} catch (IllegalStateException e) {
|
package/ios/ShieldFraudPlugin.m
CHANGED
|
@@ -34,6 +34,10 @@ RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getSessionId) {
|
|
|
34
34
|
return [[Shield shared]sessionId];
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isShieldInitialized) {
|
|
38
|
+
return @(isShieldInitialized);
|
|
39
|
+
}
|
|
40
|
+
|
|
37
41
|
// get device result to shield
|
|
38
42
|
RCT_EXPORT_METHOD(getLatestDeviceResult:(RCTResponseSenderBlock)successCallback errorCallback: (RCTResponseSenderBlock)errorCallback)
|
|
39
43
|
{
|
|
@@ -50,14 +54,9 @@ RCT_EXPORT_METHOD(getLatestDeviceResult:(RCTResponseSenderBlock)successCallback
|
|
|
50
54
|
|
|
51
55
|
RCT_EXPORT_METHOD(setDeviceResultStateListener:(RCTResponseSenderBlock)callback)
|
|
52
56
|
{
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
|
|
57
|
-
[[Shield shared] setDeviceResultStateListener:^{
|
|
58
|
-
callback(@[]);
|
|
59
|
-
}];
|
|
60
|
-
});
|
|
57
|
+
[[Shield shared] setDeviceResultStateListener:^{
|
|
58
|
+
callback(@[]);
|
|
59
|
+
}];
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
- (NSArray<NSString *> *)supportedEvents {
|
|
Binary file
|
package/lib/commonjs/index.js
CHANGED
|
@@ -106,16 +106,30 @@ class ShieldFraud {
|
|
|
106
106
|
return ShieldFraud.PlatformWrapper.getSessionId();
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Checks whether the ShieldFraud plugin is initialized.
|
|
111
|
+
*
|
|
112
|
+
* @returns A Promise that resolves with a boolean value indicating whether the ShieldFraud plugin is initialized (true) or not (false).
|
|
113
|
+
*/
|
|
114
|
+
static isShieldInitialized() {
|
|
115
|
+
return ShieldFraud.PlatformWrapper.isShieldInitialized();
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
/**
|
|
110
119
|
* Checks if the ShieldFraud SDK is ready and invokes the provided callback with the
|
|
111
120
|
* readiness state.
|
|
112
121
|
*
|
|
113
122
|
* @param callback - The callback function to be invoked with the readiness state.
|
|
114
123
|
*/
|
|
115
|
-
static isSDKready(callback) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
static async isSDKready(callback) {
|
|
125
|
+
const isInitialized = await this.isShieldInitialized();
|
|
126
|
+
if (isInitialized) {
|
|
127
|
+
ShieldFraud.PlatformWrapper.setDeviceResultStateListener(() => {
|
|
128
|
+
callback(true);
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
callback(false);
|
|
132
|
+
}
|
|
119
133
|
}
|
|
120
134
|
|
|
121
135
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","LogLevel","exports","EnvironmentInfo","ShieldFraud","PlatformWrapper","NativeModules","ShieldFraudPlugin","eventEmitter","NativeEventEmitter","initShield","config","callbacks","isOptimizedListener","logLevel","LogLevelNone","environmentInfo","EnvironmentProd","siteID","secretKey","blockedDialog","listeners","addListener","data","onSuccess","error","onFailure","getSessionId","isSDKready","callback","setDeviceResultStateListener","sendAttributes","screenName","getLatestDeviceResult","Promise","resolve","reject","result","_default","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AAFA,IAGYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAMpB;AACA;AACA;AAFAC,OAAA,CAAAD,QAAA,GAAAA,QAAA;AAAA,IAGYE,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAM3B;AACA;AACA;AAYA;AACA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AAFAD,OAAA,CAAAC,eAAA,GAAAA,eAAA;AAQA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,CAAC;EAChB;AACF;AACA;EACE,OAAeC,eAAe,GAAGC,0BAAa,CAACC,iBAAiB;;EAEhE;AACF;AACA;EACE,OAAeC,YAAY,GAAG,IAAIC,+BAAkB,CAACL,WAAW,CAACC,eAAe,CAAC;;EAEjF;AACF;AACA;AACA;AACA;AACA;EACE,OAAcK,UAAUA,CAACC,MAAc,EAAEC,SAA0B,EAAQ;IACzE,MAAMC,mBAAmB,GAAG,CAAC,CAACD,SAAS;;
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LogLevel","exports","EnvironmentInfo","ShieldFraud","PlatformWrapper","NativeModules","ShieldFraudPlugin","eventEmitter","NativeEventEmitter","initShield","config","callbacks","isOptimizedListener","logLevel","LogLevelNone","environmentInfo","EnvironmentProd","siteID","secretKey","blockedDialog","listeners","addListener","data","onSuccess","error","onFailure","getSessionId","isShieldInitialized","isSDKready","callback","isInitialized","setDeviceResultStateListener","sendAttributes","screenName","getLatestDeviceResult","Promise","resolve","reject","result","_default","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA;AACA;AACA;AAFA,IAGYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;AAMpB;AACA;AACA;AAFAC,OAAA,CAAAD,QAAA,GAAAA,QAAA;AAAA,IAGYE,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;AAM3B;AACA;AACA;AAYA;AACA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AAFAD,OAAA,CAAAC,eAAA,GAAAA,eAAA;AAQA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,CAAC;EAChB;AACF;AACA;EACE,OAAeC,eAAe,GAAGC,0BAAa,CAACC,iBAAiB;;EAEhE;AACF;AACA;EACE,OAAeC,YAAY,GAAG,IAAIC,+BAAkB,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CAAA,EAAqB;IACpD,OAAOxB,WAAW,CAACC,eAAe,CAACuB,mBAAmB,EAAE;EAC1D;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,aAAoBC,UAAUA,CAACC,QAAoC,EAAiB;IAClF,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACH,mBAAmB,EAAE;IACtD,IAAIG,aAAa,EAAE;MACjB3B,WAAW,CAACC,eAAe,CAAC2B,4BAA4B,CAAC,MAAM;QAC7DF,QAAQ,CAAC,IAAI,CAAC;MAChB,CAAC,CAAC;IACJ,CAAC,MAAM;MACLA,QAAQ,CAAC,KAAK,CAAC;IACjB;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAcG,cAAcA,CAACC,UAAkB,EAAEX,IAAY,EAAQ;IACnEnB,WAAW,CAACC,eAAe,CAAC4B,cAAc,CAACC,UAAU,EAAEX,IAAI,CAAC;EAC9D;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAcY,qBAAqBA,CAAA,EAAoB;IACrD,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtClC,WAAW,CAACC,eAAe,CAAC8B,qBAAqB,CAC9CI,MAAc,IAAK;QAClB;QACAF,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,EACAd,KAAa,IAAK;QACjB;QACAa,MAAM,CAACb,KAAK,CAAC;MACf,CAAC,CACF;IACH,CAAC,CAAC;EACJ;AACF;AAAC,IAAAe,QAAA,GAEcpC,WAAW;AAAAF,OAAA,CAAAuC,OAAA,GAAAD,QAAA"}
|
package/lib/module/index.js
CHANGED
|
@@ -105,16 +105,30 @@ class ShieldFraud {
|
|
|
105
105
|
return ShieldFraud.PlatformWrapper.getSessionId();
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Checks whether the ShieldFraud plugin is initialized.
|
|
110
|
+
*
|
|
111
|
+
* @returns A Promise that resolves with a boolean value indicating whether the ShieldFraud plugin is initialized (true) or not (false).
|
|
112
|
+
*/
|
|
113
|
+
static isShieldInitialized() {
|
|
114
|
+
return ShieldFraud.PlatformWrapper.isShieldInitialized();
|
|
115
|
+
}
|
|
116
|
+
|
|
108
117
|
/**
|
|
109
118
|
* Checks if the ShieldFraud SDK is ready and invokes the provided callback with the
|
|
110
119
|
* readiness state.
|
|
111
120
|
*
|
|
112
121
|
* @param callback - The callback function to be invoked with the readiness state.
|
|
113
122
|
*/
|
|
114
|
-
static isSDKready(callback) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
123
|
+
static async isSDKready(callback) {
|
|
124
|
+
const isInitialized = await this.isShieldInitialized();
|
|
125
|
+
if (isInitialized) {
|
|
126
|
+
ShieldFraud.PlatformWrapper.setDeviceResultStateListener(() => {
|
|
127
|
+
callback(true);
|
|
128
|
+
});
|
|
129
|
+
} else {
|
|
130
|
+
callback(false);
|
|
131
|
+
}
|
|
118
132
|
}
|
|
119
133
|
|
|
120
134
|
/**
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","NativeEventEmitter","LogLevel","EnvironmentInfo","ShieldFraud","PlatformWrapper","ShieldFraudPlugin","eventEmitter","initShield","config","callbacks","isOptimizedListener","logLevel","LogLevelNone","environmentInfo","EnvironmentProd","siteID","secretKey","blockedDialog","listeners","addListener","data","onSuccess","error","onFailure","getSessionId","isSDKready","callback","setDeviceResultStateListener","sendAttributes","screenName","getLatestDeviceResult","Promise","resolve","reject","result"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;;AAEhE;AACA;AACA;AACA,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;;AAMpB;AACA;AACA;AACA,WAAYC,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;;AAM3B;AACA;AACA;;AAYA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA,MAAMC,WAAW,CAAC;EAChB;AACF;AACA;EACE,OAAeC,eAAe,GAAGL,aAAa,CAACM,iBAAiB;;EAEhE;AACF;AACA;EACE,OAAeC,YAAY,GAAG,IAAIN,kBAAkB,CAACG,WAAW,CAACC,eAAe,CAAC;;EAEjF;AACF;AACA;AACA;AACA;AACA;EACE,OAAcG,UAAUA,CAACC,MAAc,EAAEC,SAA0B,EAAQ;IACzE,MAAMC,mBAAmB,GAAG,CAAC,CAACD,SAAS;;
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","LogLevel","EnvironmentInfo","ShieldFraud","PlatformWrapper","ShieldFraudPlugin","eventEmitter","initShield","config","callbacks","isOptimizedListener","logLevel","LogLevelNone","environmentInfo","EnvironmentProd","siteID","secretKey","blockedDialog","listeners","addListener","data","onSuccess","error","onFailure","getSessionId","isShieldInitialized","isSDKready","callback","isInitialized","setDeviceResultStateListener","sendAttributes","screenName","getLatestDeviceResult","Promise","resolve","reject","result"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;;AAEhE;AACA;AACA;AACA,WAAYC,QAAQ,0BAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;;AAMpB;AACA;AACA;AACA,WAAYC,eAAe,0BAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAfA,eAAe,CAAfA,eAAe;EAAA,OAAfA,eAAe;AAAA;;AAM3B;AACA;AACA;;AAYA;AACA;AACA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,CAAC;MAC5B;IACF,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAcE,YAAYA,CAAA,EAAoB;IAC5C,OAAOrB,WAAW,CAACC,eAAe,CAACoB,YAAY,EAAE;EACnD;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAcC,mBAAmBA,CAAA,EAAqB;IACpD,OAAOtB,WAAW,CAACC,eAAe,CAACqB,mBAAmB,EAAE;EAC1D;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,aAAoBC,UAAUA,CAACC,QAAoC,EAAiB;IAClF,MAAMC,aAAa,GAAG,MAAM,IAAI,CAACH,mBAAmB,EAAE;IACtD,IAAIG,aAAa,EAAE;MACjBzB,WAAW,CAACC,eAAe,CAACyB,4BAA4B,CAAC,MAAM;QAC7DF,QAAQ,CAAC,IAAI,CAAC;MAChB,CAAC,CAAC;IACJ,CAAC,MAAM;MACLA,QAAQ,CAAC,KAAK,CAAC;IACjB;EACF;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE,OAAcG,cAAcA,CAACC,UAAkB,EAAEX,IAAY,EAAQ;IACnEjB,WAAW,CAACC,eAAe,CAAC0B,cAAc,CAACC,UAAU,EAAEX,IAAI,CAAC;EAC9D;;EAEA;AACF;AACA;AACA;AACA;EACE,OAAcY,qBAAqBA,CAAA,EAAoB;IACrD,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;MACtChC,WAAW,CAACC,eAAe,CAAC4B,qBAAqB,CAC9CI,MAAc,IAAK;QAClB;QACAF,OAAO,CAACE,MAAM,CAAC;MACjB,CAAC,EACAd,KAAa,IAAK;QACjB;QACAa,MAAM,CAACb,KAAK,CAAC;MACf,CAAC,CACF;IACH,CAAC,CAAC;EACJ;AACF;AAEA,eAAenB,WAAW"}
|
|
@@ -75,13 +75,19 @@ declare class ShieldFraud {
|
|
|
75
75
|
* @returns A Promise that resolves with the session ID.
|
|
76
76
|
*/
|
|
77
77
|
static getSessionId(): Promise<string>;
|
|
78
|
+
/**
|
|
79
|
+
* Checks whether the ShieldFraud plugin is initialized.
|
|
80
|
+
*
|
|
81
|
+
* @returns A Promise that resolves with a boolean value indicating whether the ShieldFraud plugin is initialized (true) or not (false).
|
|
82
|
+
*/
|
|
83
|
+
static isShieldInitialized(): Promise<Boolean>;
|
|
78
84
|
/**
|
|
79
85
|
* Checks if the ShieldFraud SDK is ready and invokes the provided callback with the
|
|
80
86
|
* readiness state.
|
|
81
87
|
*
|
|
82
88
|
* @param callback - The callback function to be invoked with the readiness state.
|
|
83
89
|
*/
|
|
84
|
-
static isSDKready(callback: (isReady: boolean) => void): void
|
|
90
|
+
static isSDKready(callback: (isReady: boolean) => void): Promise<void>;
|
|
85
91
|
/**
|
|
86
92
|
* Sends attributes to the ShieldFraud plugin for a specific screen.
|
|
87
93
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,QAAQ;IAClB,aAAa,IAAI;IACjB,YAAY,IAAI;IAChB,YAAY,IAAI;CACjB;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB,eAAe,IAAI;IACnB,cAAc,IAAI;IAClB,eAAe,IAAI;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE;QACd,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC;IACT,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED;;GAEG;AACH,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;AAE3C;;GAEG;AACH,KAAK,eAAe,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;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G;IAC3B,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,cAAM,WAAW;IACf;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe,CAAmC;IAEjE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY,CAAuD;IAElF;;;;;OAKG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,cAAc,GAAG,IAAI;IAyB1E;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IAgBxB;;;;OAIG;WACW,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7C;;;;MAIE;WACY,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrD;;;;;OAKG;WACiB,UAAU,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAWnF;;;;;OAKG;WACW,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI;IAIpE;;;;OAIG;WACW,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;CAcvD;AAED,eAAe,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-shield-fraud-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "React Native Shield Fraud Plugin helps developers to assess malicious activities performed on mobile devices and return risk intelligence based on user's behaviour. It collects device's fingerprint, social metrics and network information.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
package/src/index.tsx
CHANGED
|
@@ -75,7 +75,7 @@ class ShieldFraud {
|
|
|
75
75
|
public static initShield(config: Config, callbacks?: ShieldCallback): void {
|
|
76
76
|
const isOptimizedListener = !!callbacks;
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
// Set default values if logLevel is not provided
|
|
79
79
|
const logLevel = config.logLevel || LogLevel.LogLevelNone;
|
|
80
80
|
|
|
81
81
|
// Set default values if environmentInfo is not provided
|
|
@@ -127,16 +127,30 @@ class ShieldFraud {
|
|
|
127
127
|
return ShieldFraud.PlatformWrapper.getSessionId();
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
/**
|
|
131
|
+
* Checks whether the ShieldFraud plugin is initialized.
|
|
132
|
+
*
|
|
133
|
+
* @returns A Promise that resolves with a boolean value indicating whether the ShieldFraud plugin is initialized (true) or not (false).
|
|
134
|
+
*/
|
|
135
|
+
public static isShieldInitialized(): Promise<Boolean> {
|
|
136
|
+
return ShieldFraud.PlatformWrapper.isShieldInitialized();
|
|
137
|
+
}
|
|
138
|
+
|
|
130
139
|
/**
|
|
131
140
|
* Checks if the ShieldFraud SDK is ready and invokes the provided callback with the
|
|
132
141
|
* readiness state.
|
|
133
142
|
*
|
|
134
143
|
* @param callback - The callback function to be invoked with the readiness state.
|
|
135
144
|
*/
|
|
136
|
-
public static isSDKready(callback: (isReady: boolean) => void): void {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
145
|
+
public static async isSDKready(callback: (isReady: boolean) => void): Promise<void> {
|
|
146
|
+
const isInitialized = await this.isShieldInitialized();
|
|
147
|
+
if (isInitialized) {
|
|
148
|
+
ShieldFraud.PlatformWrapper.setDeviceResultStateListener(() => {
|
|
149
|
+
callback(true);
|
|
150
|
+
});
|
|
151
|
+
} else {
|
|
152
|
+
callback(false);
|
|
153
|
+
}
|
|
140
154
|
}
|
|
141
155
|
|
|
142
156
|
/**
|